Skip to content

Commit

Permalink
Fixed some bosses checks from (opentibiabr#1724).
Browse files Browse the repository at this point in the history
  • Loading branch information
elsongabriel committed Oct 25, 2023
1 parent f17f918 commit 042c35b
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function teleportBoss.onStepIn(creature, item, position, fromPosition)
creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "All the players need to be level " .. value.requiredLevel .. " or higher.")
return true
end
if creature:canFightBoss(value.bossName) then
if not creature:canFightBoss(value.bossName) then
creature:teleportTo(fromPosition, true)
creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have to wait " .. value.timeToFightAgain .. " hours to face " .. value.bossName .. " again!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function ferumbrasAscendantLever.onUse(player, item, fromPosition, target, toPos
for y = 31477, 31481 do
local playerTile = Tile(Position(x, y, 14)):getTopCreature()
if playerTile and playerTile:isPlayer() then
if playerTile:canFightBoss("Ferumbras Mortal Shell") then
if not playerTile:canFightBoss("Ferumbras Mortal Shell") then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You or a member in your team have to wait 5 days to face Ferumbras again!")
item:transform(8912)
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function teleportBoss.onStepIn(creature, item, position, fromPosition)
creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "All the players need to be level " .. value.requiredLevel .. " or higher.")
return true
end
if creature:canFightBoss(value.bossName) then
if not creature:canFightBoss(value.bossName) then
creature:teleportTo(fromPosition, true)
creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have to wait " .. value.timeToFightAgain .. " hours to face " .. value.bossName .. " again!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function entranceTeleport.onStepIn(creature, item, position, fromPosition)
return true
end

if player:canFightBoss(setting.bossName) then
if not player:canFightBoss(setting.bossName) then
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:teleportTo(fromPosition)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function servantTeleport.onStepIn(creature, item, position, fromPosition)
return
end

if player:canFightBoss("LLoyd") then
if not player:canFightBoss("LLoyd") then
player:teleportTo(Position(32815, 32872, 13))
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
position:sendMagicEffect(CONST_ME_TELEPORT)
Expand Down
5 changes: 1 addition & 4 deletions data/libs/functions/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -677,8 +677,5 @@ end

function Player:canFightBoss(bossNameOrId)
local cooldown = self:getBossCooldown(bossNameOrId)
if cooldown > os.time() then
return false
end
return true
return cooldown > os.time() and false or true
end

0 comments on commit 042c35b

Please sign in to comment.