From bf1067e159144437c4b98cb3c4832f8b404e5c74 Mon Sep 17 00:00:00 2001 From: mrmdbeng Date: Fri, 16 May 2025 10:44:43 -0400 Subject: [PATCH 1/7] fix: grave danger darashia boss --- .../quests/grave_danger/bosses/sir_baeloc.lua | 6 +- .../grave_danger/bosses/sir_nictros.lua | 9 +- .../actions_baeloc_nictros.lua | 184 +++++++++++++----- .../creaturescripts_baeloc_nictros.lua | 119 ----------- 4 files changed, 141 insertions(+), 177 deletions(-) delete mode 100644 data-otservbr-global/scripts/quests/grave_danger_quest/creaturescripts_baeloc_nictros.lua diff --git a/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua b/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua index 7e05cbdb61d..d9c6e83df80 100644 --- a/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua +++ b/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua @@ -21,9 +21,7 @@ monster.speed = 125 monster.manaCost = 0 monster.events = { - "sir_baeloc_health", - "brothers_summon", - "grave_danger_death", + "BossHealthCheck" } monster.changeTarget = { @@ -80,6 +78,7 @@ monster.voices = { monster.loot = { { name = "platinum coin", minCount = 1, maxCount = 5, chance = 100000 }, { name = "crystal coin", minCount = 0, maxCount = 2, chance = 50000 }, + { name = "silver token", minCount = 0, maxCount = 3, chance = 40000 }, { name = "supreme health potion", minCount = 0, maxCount = 6, chance = 35000 }, { name = "ultimate mana potion", minCount = 0, maxCount = 20, chance = 32000 }, { name = "ultimate spirit potion", minCount = 0, maxCount = 20, chance = 32000 }, @@ -87,7 +86,6 @@ monster.loot = { { name = "berserk potion", minCount = 0, maxCount = 10, chance = 12000 }, { name = "piece of draconian steel", minCount = 0, maxCount = 4, chance = 9000 }, { id = 3039, minCount = 0, maxCount = 1, chance = 12000 }, -- red gem - { name = "silver token", minCount = 0, maxCount = 2, chance = 9500 }, { id = 23542, chance = 5200 }, -- collar of blue plasma { id = 23544, chance = 5200 }, -- collar of red plasma { name = "knight legs", chance = 11000 }, diff --git a/data-otservbr-global/monster/quests/grave_danger/bosses/sir_nictros.lua b/data-otservbr-global/monster/quests/grave_danger/bosses/sir_nictros.lua index 60b14f17b24..87652425b0b 100644 --- a/data-otservbr-global/monster/quests/grave_danger/bosses/sir_nictros.lua +++ b/data-otservbr-global/monster/quests/grave_danger/bosses/sir_nictros.lua @@ -20,16 +20,15 @@ monster.corpse = 31599 monster.speed = 125 monster.manaCost = 0 -monster.events = { - "sir_nictros_health", - "brothers_summon", -} - monster.changeTarget = { interval = 4000, chance = 10, } +monster.events = { + "BossHealthCheck", +} + monster.bosstiary = { bossRaceId = 1754, bossRace = RARITY_ARCHFOE, diff --git a/data-otservbr-global/scripts/quests/grave_danger_quest/actions_baeloc_nictros.lua b/data-otservbr-global/scripts/quests/grave_danger_quest/actions_baeloc_nictros.lua index b7e6bd0725c..047f642720e 100644 --- a/data-otservbr-global/scripts/quests/grave_danger_quest/actions_baeloc_nictros.lua +++ b/data-otservbr-global/scripts/quests/grave_danger_quest/actions_baeloc_nictros.lua @@ -1,58 +1,144 @@ local nictrosPosition = Position(33427, 31428, 13) local baelocPosition = Position(33422, 31428, 13) +local healthStates = { + nictros85 = false, + baeloc85 = false +} + local config = { - boss = { - name = "Sir Nictros", - createFunction = function() - local nictros = Game.createMonster("Sir Nictros", nictrosPosition, true, true) - local baeloc = Game.createMonster("Sir Baeloc", baelocPosition, true, true) - return nictros and baeloc - end, - }, - requiredLevel = 250, - playerPositions = { - { pos = Position(33424, 31413, 13), teleport = Position(33423, 31448, 13) }, - { pos = Position(33425, 31413, 13), teleport = Position(33423, 31448, 13) }, - { pos = Position(33426, 31413, 13), teleport = Position(33423, 31448, 13) }, - { pos = Position(33427, 31413, 13), teleport = Position(33423, 31448, 13) }, - { pos = Position(33428, 31413, 13), teleport = Position(33423, 31448, 13) }, - }, - specPos = { - from = Position(33414, 31426, 13), - to = Position(33433, 31449, 13), - }, - onUseExtra = function(player) - addEvent(function() - local baeloc = Creature("Sir Baeloc") - local nictros = Creature("Sir Nictros") - - if baeloc then - baeloc:say("Ah look my Brother! Challengers! After all this time finally a chance to prove our skills!") - addEvent(function() - local nictros = Creature("Sir Nictros") - if nictros then - nictros:say("Indeed! It has been a while! As the elder one I request the right of the first battle!") - end - end, 6 * 1000) - end - - addEvent(function() - local baeloc = Creature("Sir Baeloc") - local nictros = Creature("Sir Nictros") - if baeloc then - baeloc:say("Oh, man! You always get the fun!") - if nictros then - nictros:teleportTo(Position(33426, 31437, 13)) - nictros:setMoveLocked(false) - end - end - end, 12 * 1000) - end, 4 * 1000) - end, - exit = Position(33290, 32474, 9), + boss = { + name = "Sir Nictros", + createFunction = function() + local nictros = Game.createMonster("Sir Nictros", nictrosPosition, true, true) + local baeloc = Game.createMonster("Sir Baeloc", baelocPosition, true, true) + + if nictros then + nictros:registerEvent("BossHealthCheck") + -- Start with Nictros active + nictros:setMoveLocked(false) + end + if baeloc then + -- Start with Baeloc locked + baeloc:setMoveLocked(true) + baeloc:registerEvent("BossHealthCheck") + end + + -- Reset health triggers in case this is a retry + healthStates.nictros85 = false + healthStates.baeloc85 = false + + return nictros and baeloc + end, + }, + requiredLevel = 250, + playerPositions = { + { pos = Position(33424, 31413, 13), teleport = Position(33423, 31448, 13) }, + { pos = Position(33425, 31413, 13), teleport = Position(33423, 31448, 13) }, + { pos = Position(33426, 31413, 13), teleport = Position(33423, 31448, 13) }, + { pos = Position(33427, 31413, 13), teleport = Position(33423, 31448, 13) }, + { pos = Position(33428, 31413, 13), teleport = Position(33423, 31448, 13) }, + }, + specPos = { + from = Position(33414, 31426, 13), + to = Position(33433, 31449, 13), + }, + onUseExtra = function(player) + addEvent(function() + local baeloc = Creature("Sir Baeloc") + local nictros = Creature("Sir Nictros") + + if baeloc then + baeloc:say("Ah look my Brother! Challengers! After all this time finally a chance to prove our skills!") + addEvent(function() + local nictros = Creature("Sir Nictros") + if nictros then + nictros:say("Indeed! It has been a while! As the elder one I request the right of the first battle!") + end + end, 6 * 1000) + end + + addEvent(function() + local baeloc = Creature("Sir Baeloc") + local nictros = Creature("Sir Nictros") + if baeloc then + baeloc:say("Oh, man! You always get the fun!") + -- Keep Baeloc locked initially - will be released later + baeloc:setMoveLocked(true) + end + if nictros then + nictros:teleportTo(Position(33426, 31437, 13)) + -- Make sure Nictros can move and attack + nictros:setMoveLocked(false) + end + end, 12 * 1000) + end, 4 * 1000) + end, + exit = Position(33290, 32474, 9), } local lever = BossLever(config) lever:position(Position(33423, 31413, 13)) lever:register() + +-- Health Trigger Logic +local BossHealthCheck = CreatureEvent("BossHealthCheck") + +function BossHealthCheck.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) + -- Safety check + if not creature or not creature:isMonster() then + return primaryDamage, primaryType, secondaryDamage, secondaryType + end + + local name = creature:getName() + + -- Calculate health percentage correctly + local function getHealthPercentage(creature) + local health = creature:getHealth() + local maxHealth = creature:getMaxHealth() + return (health / maxHealth) * 100 + end + + local healthPercent = getHealthPercentage(creature) + + -- Debug logging + print("[BossHealthCheck] Health check for:", name, "Health:", creature:getHealth(), "/", creature:getMaxHealth(), "=", healthPercent, "%") + + -- NICTROS reaches 85% health + if name == "Sir Nictros" and not healthStates.nictros85 and healthPercent <= 85 then + healthStates.nictros85 = true + print("[BossHealthCheck] Nictros at 85% or below - releasing Baeloc") + + creature:say("I'll step back now. Let's see how you handle my brother!") + creature:teleportTo(nictrosPosition) + creature:setMoveLocked(true) -- Lock Nictros until Baeloc hits 85% + + -- Release Baeloc to fight + local baeloc = Creature("Sir Baeloc") + if baeloc then + baeloc:teleportTo(Position(33426, 31435, 13)) + baeloc:setDirection(DIRECTION_SOUTH) + baeloc:setMoveLocked(false) -- Allow Baeloc to move and attack + baeloc:say("My turn! Let me show you my skills!") + end + + -- BAELOC reaches 85% health + elseif name == "Sir Baeloc" and healthStates.nictros85 and not healthStates.baeloc85 and healthPercent <= 85 then + healthStates.baeloc85 = true + print("[BossHealthCheck] Baeloc at 85% - releasing Nictros for joint attack") + + creature:say("Brother! I need your assistance!") + + -- Release Nictros to join the fight + local nictros = Creature("Sir Nictros") + if nictros then + nictros:setMoveLocked(false) -- Allow Nictros to move and attack again + nictros:teleportTo(Position(33424, 31435, 13)) -- Teleport near Baeloc + nictros:say("Now we fight together, brother!") + end + end + + return primaryDamage, primaryType, secondaryDamage, secondaryType +end + +BossHealthCheck:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/grave_danger_quest/creaturescripts_baeloc_nictros.lua b/data-otservbr-global/scripts/quests/grave_danger_quest/creaturescripts_baeloc_nictros.lua deleted file mode 100644 index 2bebddca492..00000000000 --- a/data-otservbr-global/scripts/quests/grave_danger_quest/creaturescripts_baeloc_nictros.lua +++ /dev/null @@ -1,119 +0,0 @@ -local config = { - centerRoom = Position(33424, 31439, 13), - newPosition = Position(33425, 31431, 13), - exitPos = Position(33290, 32474, 9), - x = 12, - y = 12, - baelocPos = Position(33422, 31428, 13), - nictrosPos = Position(33427, 31428, 13), - timer = Storage.Quest.U12_20.GraveDanger.Bosses.BaelocNictros.Timer, - room = Storage.Quest.U12_20.GraveDanger.Bosses.BaelocNictros.Room, - fromPos = Position(33418, 31434, 13), - toPos = Position(33431, 31445, 13), -} - -local brothers_summon = CreatureEvent("brothers_summon") - -function brothers_summon.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType) - local chance = math.random(1, 100) - local position = Position(math.random(config.fromPos.x, config.toPos.x), math.random(config.fromPos.y, config.toPos.y), config.fromPos.z) - local tile = Tile(position) - - if chance >= 90 then - if tile:isWalkable(false, false, false, true, false) then - local summon = creature:getName():lower() == "sir nictros" and "Squire Of Nictros" or "Retainer Of Baeloc" - Game.createMonster(summon, position, false, true) - end - end - - return primaryDamage, primaryType, -secondaryDamage, secondaryType -end - -brothers_summon:register() - -local sir_nictros_health = CreatureEvent("sir_nictros_health") - -function sir_nictros_health.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType) - local players = Game.getSpectators(config.centerRoom, false, true, config.x, config.x, config.y, config.y) - for _, player in pairs(players) do - if player:isPlayer() then - if player:getStorageValue(config.timer) < os.time() then - player:setStorageValue(config.timer, os.time() + 20 * 3600) - end - if player:getStorageValue(config.room) < os.time() then - player:setStorageValue(config.room, os.time() + 30 * 60) - end - end - end - - if primaryType == COMBAT_HEALING then - return primaryDamage, primaryType, -secondaryDamage, secondaryType - end - - local health = creature:getMaxHealth() * 0.60 - local brother_diff = (creature:getHealth() / creature:getMaxHealth()) * 100 - local brother = Creature("Sir Baeloc") - - if brother then - if brother_diff < 55 then - local brother_percent = (brother:getHealth() / brother:getMaxHealth()) * 100 - if (brother_percent - brother_diff) > 5 then - creature:addHealth(28000) - end - end - end - - creature:setStorageValue(1, creature:getStorageValue(1) + primaryDamage + secondaryDamage) - if creature:getStorageValue(2) < 1 and creature:getStorageValue(1) >= health then - creature:setStorageValue(2, 1) - creature:say("Now it's your chance for entertaiment, dear brother!") - creature:teleportTo(config.nictrosPos) - creature:setMoveLocked(true) - local baeloc = Creature("Sir Baeloc") - if baeloc then - baeloc:teleportTo(Position(33424, 31436, 13)) - baeloc:setMoveLocked(false) - end - end - - return primaryDamage, primaryType, -secondaryDamage, secondaryType -end - -sir_nictros_health:register() - -local sir_baeloc_health = CreatureEvent("sir_baeloc_health") - -function sir_baeloc_health.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType) - if primaryType == COMBAT_HEALING then - return primaryDamage, primaryType, -secondaryDamage, secondaryType - end - - local health = creature:getMaxHealth() * 0.60 - local brother_diff = (creature:getHealth() / creature:getMaxHealth()) * 100 - local brother = Creature("Sir Nictros") - - if brother then - if brother_diff < 55 then - local brother_percent = (brother:getHealth() / brother:getMaxHealth()) * 100 - if (brother_percent - brother_diff) > 5 then - creature:addHealth(28000) - end - end - end - - creature:setStorageValue(1, creature:getStorageValue(1) + primaryDamage + secondaryDamage) - - if creature:getStorageValue(2) < 1 and creature:getStorageValue(1) >= health then - creature:setStorageValue(2, 1) - creature:say("Join me in battle my brother. Let's share the fun!") - local nictros = Creature("Sir Nictros") - if nictros then - nictros:teleportTo(Position(33426, 31438, 13)) - nictros:setMoveLocked(false) - end - end - - return primaryDamage, primaryType, -secondaryDamage, secondaryType -end - -sir_baeloc_health:register() From 308e1d2ea4383552dfacdcb7968c34ad671340d3 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Fri, 16 May 2025 14:45:23 +0000 Subject: [PATCH 2/7] Lua code format - (Stylua) --- .../quests/grave_danger/bosses/sir_baeloc.lua | 2 +- .../actions_baeloc_nictros.lua | 250 +++++++++--------- 2 files changed, 126 insertions(+), 126 deletions(-) diff --git a/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua b/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua index d9c6e83df80..385c25eb48a 100644 --- a/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua +++ b/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua @@ -21,7 +21,7 @@ monster.speed = 125 monster.manaCost = 0 monster.events = { - "BossHealthCheck" + "BossHealthCheck", } monster.changeTarget = { diff --git a/data-otservbr-global/scripts/quests/grave_danger_quest/actions_baeloc_nictros.lua b/data-otservbr-global/scripts/quests/grave_danger_quest/actions_baeloc_nictros.lua index 047f642720e..2cb43831c85 100644 --- a/data-otservbr-global/scripts/quests/grave_danger_quest/actions_baeloc_nictros.lua +++ b/data-otservbr-global/scripts/quests/grave_danger_quest/actions_baeloc_nictros.lua @@ -2,79 +2,79 @@ local nictrosPosition = Position(33427, 31428, 13) local baelocPosition = Position(33422, 31428, 13) local healthStates = { - nictros85 = false, - baeloc85 = false + nictros85 = false, + baeloc85 = false, } local config = { - boss = { - name = "Sir Nictros", - createFunction = function() - local nictros = Game.createMonster("Sir Nictros", nictrosPosition, true, true) - local baeloc = Game.createMonster("Sir Baeloc", baelocPosition, true, true) - - if nictros then - nictros:registerEvent("BossHealthCheck") - -- Start with Nictros active - nictros:setMoveLocked(false) - end - if baeloc then - -- Start with Baeloc locked - baeloc:setMoveLocked(true) - baeloc:registerEvent("BossHealthCheck") - end - - -- Reset health triggers in case this is a retry - healthStates.nictros85 = false - healthStates.baeloc85 = false - - return nictros and baeloc - end, - }, - requiredLevel = 250, - playerPositions = { - { pos = Position(33424, 31413, 13), teleport = Position(33423, 31448, 13) }, - { pos = Position(33425, 31413, 13), teleport = Position(33423, 31448, 13) }, - { pos = Position(33426, 31413, 13), teleport = Position(33423, 31448, 13) }, - { pos = Position(33427, 31413, 13), teleport = Position(33423, 31448, 13) }, - { pos = Position(33428, 31413, 13), teleport = Position(33423, 31448, 13) }, - }, - specPos = { - from = Position(33414, 31426, 13), - to = Position(33433, 31449, 13), - }, - onUseExtra = function(player) - addEvent(function() - local baeloc = Creature("Sir Baeloc") - local nictros = Creature("Sir Nictros") - - if baeloc then - baeloc:say("Ah look my Brother! Challengers! After all this time finally a chance to prove our skills!") - addEvent(function() - local nictros = Creature("Sir Nictros") - if nictros then - nictros:say("Indeed! It has been a while! As the elder one I request the right of the first battle!") - end - end, 6 * 1000) - end - - addEvent(function() - local baeloc = Creature("Sir Baeloc") - local nictros = Creature("Sir Nictros") - if baeloc then - baeloc:say("Oh, man! You always get the fun!") - -- Keep Baeloc locked initially - will be released later - baeloc:setMoveLocked(true) - end - if nictros then - nictros:teleportTo(Position(33426, 31437, 13)) - -- Make sure Nictros can move and attack - nictros:setMoveLocked(false) - end - end, 12 * 1000) - end, 4 * 1000) - end, - exit = Position(33290, 32474, 9), + boss = { + name = "Sir Nictros", + createFunction = function() + local nictros = Game.createMonster("Sir Nictros", nictrosPosition, true, true) + local baeloc = Game.createMonster("Sir Baeloc", baelocPosition, true, true) + + if nictros then + nictros:registerEvent("BossHealthCheck") + -- Start with Nictros active + nictros:setMoveLocked(false) + end + if baeloc then + -- Start with Baeloc locked + baeloc:setMoveLocked(true) + baeloc:registerEvent("BossHealthCheck") + end + + -- Reset health triggers in case this is a retry + healthStates.nictros85 = false + healthStates.baeloc85 = false + + return nictros and baeloc + end, + }, + requiredLevel = 250, + playerPositions = { + { pos = Position(33424, 31413, 13), teleport = Position(33423, 31448, 13) }, + { pos = Position(33425, 31413, 13), teleport = Position(33423, 31448, 13) }, + { pos = Position(33426, 31413, 13), teleport = Position(33423, 31448, 13) }, + { pos = Position(33427, 31413, 13), teleport = Position(33423, 31448, 13) }, + { pos = Position(33428, 31413, 13), teleport = Position(33423, 31448, 13) }, + }, + specPos = { + from = Position(33414, 31426, 13), + to = Position(33433, 31449, 13), + }, + onUseExtra = function(player) + addEvent(function() + local baeloc = Creature("Sir Baeloc") + local nictros = Creature("Sir Nictros") + + if baeloc then + baeloc:say("Ah look my Brother! Challengers! After all this time finally a chance to prove our skills!") + addEvent(function() + local nictros = Creature("Sir Nictros") + if nictros then + nictros:say("Indeed! It has been a while! As the elder one I request the right of the first battle!") + end + end, 6 * 1000) + end + + addEvent(function() + local baeloc = Creature("Sir Baeloc") + local nictros = Creature("Sir Nictros") + if baeloc then + baeloc:say("Oh, man! You always get the fun!") + -- Keep Baeloc locked initially - will be released later + baeloc:setMoveLocked(true) + end + if nictros then + nictros:teleportTo(Position(33426, 31437, 13)) + -- Make sure Nictros can move and attack + nictros:setMoveLocked(false) + end + end, 12 * 1000) + end, 4 * 1000) + end, + exit = Position(33290, 32474, 9), } local lever = BossLever(config) @@ -85,60 +85,60 @@ lever:register() local BossHealthCheck = CreatureEvent("BossHealthCheck") function BossHealthCheck.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) - -- Safety check - if not creature or not creature:isMonster() then - return primaryDamage, primaryType, secondaryDamage, secondaryType - end - - local name = creature:getName() - - -- Calculate health percentage correctly - local function getHealthPercentage(creature) - local health = creature:getHealth() - local maxHealth = creature:getMaxHealth() - return (health / maxHealth) * 100 - end - - local healthPercent = getHealthPercentage(creature) - - -- Debug logging - print("[BossHealthCheck] Health check for:", name, "Health:", creature:getHealth(), "/", creature:getMaxHealth(), "=", healthPercent, "%") - - -- NICTROS reaches 85% health - if name == "Sir Nictros" and not healthStates.nictros85 and healthPercent <= 85 then - healthStates.nictros85 = true - print("[BossHealthCheck] Nictros at 85% or below - releasing Baeloc") - - creature:say("I'll step back now. Let's see how you handle my brother!") - creature:teleportTo(nictrosPosition) - creature:setMoveLocked(true) -- Lock Nictros until Baeloc hits 85% - - -- Release Baeloc to fight - local baeloc = Creature("Sir Baeloc") - if baeloc then - baeloc:teleportTo(Position(33426, 31435, 13)) - baeloc:setDirection(DIRECTION_SOUTH) - baeloc:setMoveLocked(false) -- Allow Baeloc to move and attack - baeloc:say("My turn! Let me show you my skills!") - end - - -- BAELOC reaches 85% health - elseif name == "Sir Baeloc" and healthStates.nictros85 and not healthStates.baeloc85 and healthPercent <= 85 then - healthStates.baeloc85 = true - print("[BossHealthCheck] Baeloc at 85% - releasing Nictros for joint attack") - - creature:say("Brother! I need your assistance!") - - -- Release Nictros to join the fight - local nictros = Creature("Sir Nictros") - if nictros then - nictros:setMoveLocked(false) -- Allow Nictros to move and attack again - nictros:teleportTo(Position(33424, 31435, 13)) -- Teleport near Baeloc - nictros:say("Now we fight together, brother!") - end - end - - return primaryDamage, primaryType, secondaryDamage, secondaryType + -- Safety check + if not creature or not creature:isMonster() then + return primaryDamage, primaryType, secondaryDamage, secondaryType + end + + local name = creature:getName() + + -- Calculate health percentage correctly + local function getHealthPercentage(creature) + local health = creature:getHealth() + local maxHealth = creature:getMaxHealth() + return (health / maxHealth) * 100 + end + + local healthPercent = getHealthPercentage(creature) + + -- Debug logging + print("[BossHealthCheck] Health check for:", name, "Health:", creature:getHealth(), "/", creature:getMaxHealth(), "=", healthPercent, "%") + + -- NICTROS reaches 85% health + if name == "Sir Nictros" and not healthStates.nictros85 and healthPercent <= 85 then + healthStates.nictros85 = true + print("[BossHealthCheck] Nictros at 85% or below - releasing Baeloc") + + creature:say("I'll step back now. Let's see how you handle my brother!") + creature:teleportTo(nictrosPosition) + creature:setMoveLocked(true) -- Lock Nictros until Baeloc hits 85% + + -- Release Baeloc to fight + local baeloc = Creature("Sir Baeloc") + if baeloc then + baeloc:teleportTo(Position(33426, 31435, 13)) + baeloc:setDirection(DIRECTION_SOUTH) + baeloc:setMoveLocked(false) -- Allow Baeloc to move and attack + baeloc:say("My turn! Let me show you my skills!") + end + + -- BAELOC reaches 85% health + elseif name == "Sir Baeloc" and healthStates.nictros85 and not healthStates.baeloc85 and healthPercent <= 85 then + healthStates.baeloc85 = true + print("[BossHealthCheck] Baeloc at 85% - releasing Nictros for joint attack") + + creature:say("Brother! I need your assistance!") + + -- Release Nictros to join the fight + local nictros = Creature("Sir Nictros") + if nictros then + nictros:setMoveLocked(false) -- Allow Nictros to move and attack again + nictros:teleportTo(Position(33424, 31435, 13)) -- Teleport near Baeloc + nictros:say("Now we fight together, brother!") + end + end + + return primaryDamage, primaryType, secondaryDamage, secondaryType end -BossHealthCheck:register() \ No newline at end of file +BossHealthCheck:register() From 02a3c90715edfb0128710f419627dba105ccec08 Mon Sep 17 00:00:00 2001 From: mrmdbeng Date: Fri, 16 May 2025 11:00:10 -0400 Subject: [PATCH 3/7] Revert "fix: grave danger darashia boss" This reverts commit bf1067e159144437c4b98cb3c4832f8b404e5c74. --- .../quests/grave_danger/bosses/sir_baeloc.lua | 6 +- .../grave_danger/bosses/sir_nictros.lua | 9 +- .../actions_baeloc_nictros.lua | 184 +++++------------- .../creaturescripts_baeloc_nictros.lua | 119 +++++++++++ 4 files changed, 177 insertions(+), 141 deletions(-) create mode 100644 data-otservbr-global/scripts/quests/grave_danger_quest/creaturescripts_baeloc_nictros.lua diff --git a/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua b/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua index d9c6e83df80..7e05cbdb61d 100644 --- a/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua +++ b/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua @@ -21,7 +21,9 @@ monster.speed = 125 monster.manaCost = 0 monster.events = { - "BossHealthCheck" + "sir_baeloc_health", + "brothers_summon", + "grave_danger_death", } monster.changeTarget = { @@ -78,7 +80,6 @@ monster.voices = { monster.loot = { { name = "platinum coin", minCount = 1, maxCount = 5, chance = 100000 }, { name = "crystal coin", minCount = 0, maxCount = 2, chance = 50000 }, - { name = "silver token", minCount = 0, maxCount = 3, chance = 40000 }, { name = "supreme health potion", minCount = 0, maxCount = 6, chance = 35000 }, { name = "ultimate mana potion", minCount = 0, maxCount = 20, chance = 32000 }, { name = "ultimate spirit potion", minCount = 0, maxCount = 20, chance = 32000 }, @@ -86,6 +87,7 @@ monster.loot = { { name = "berserk potion", minCount = 0, maxCount = 10, chance = 12000 }, { name = "piece of draconian steel", minCount = 0, maxCount = 4, chance = 9000 }, { id = 3039, minCount = 0, maxCount = 1, chance = 12000 }, -- red gem + { name = "silver token", minCount = 0, maxCount = 2, chance = 9500 }, { id = 23542, chance = 5200 }, -- collar of blue plasma { id = 23544, chance = 5200 }, -- collar of red plasma { name = "knight legs", chance = 11000 }, diff --git a/data-otservbr-global/monster/quests/grave_danger/bosses/sir_nictros.lua b/data-otservbr-global/monster/quests/grave_danger/bosses/sir_nictros.lua index 87652425b0b..60b14f17b24 100644 --- a/data-otservbr-global/monster/quests/grave_danger/bosses/sir_nictros.lua +++ b/data-otservbr-global/monster/quests/grave_danger/bosses/sir_nictros.lua @@ -20,15 +20,16 @@ monster.corpse = 31599 monster.speed = 125 monster.manaCost = 0 +monster.events = { + "sir_nictros_health", + "brothers_summon", +} + monster.changeTarget = { interval = 4000, chance = 10, } -monster.events = { - "BossHealthCheck", -} - monster.bosstiary = { bossRaceId = 1754, bossRace = RARITY_ARCHFOE, diff --git a/data-otservbr-global/scripts/quests/grave_danger_quest/actions_baeloc_nictros.lua b/data-otservbr-global/scripts/quests/grave_danger_quest/actions_baeloc_nictros.lua index 047f642720e..b7e6bd0725c 100644 --- a/data-otservbr-global/scripts/quests/grave_danger_quest/actions_baeloc_nictros.lua +++ b/data-otservbr-global/scripts/quests/grave_danger_quest/actions_baeloc_nictros.lua @@ -1,144 +1,58 @@ local nictrosPosition = Position(33427, 31428, 13) local baelocPosition = Position(33422, 31428, 13) -local healthStates = { - nictros85 = false, - baeloc85 = false -} - local config = { - boss = { - name = "Sir Nictros", - createFunction = function() - local nictros = Game.createMonster("Sir Nictros", nictrosPosition, true, true) - local baeloc = Game.createMonster("Sir Baeloc", baelocPosition, true, true) - - if nictros then - nictros:registerEvent("BossHealthCheck") - -- Start with Nictros active - nictros:setMoveLocked(false) - end - if baeloc then - -- Start with Baeloc locked - baeloc:setMoveLocked(true) - baeloc:registerEvent("BossHealthCheck") - end - - -- Reset health triggers in case this is a retry - healthStates.nictros85 = false - healthStates.baeloc85 = false - - return nictros and baeloc - end, - }, - requiredLevel = 250, - playerPositions = { - { pos = Position(33424, 31413, 13), teleport = Position(33423, 31448, 13) }, - { pos = Position(33425, 31413, 13), teleport = Position(33423, 31448, 13) }, - { pos = Position(33426, 31413, 13), teleport = Position(33423, 31448, 13) }, - { pos = Position(33427, 31413, 13), teleport = Position(33423, 31448, 13) }, - { pos = Position(33428, 31413, 13), teleport = Position(33423, 31448, 13) }, - }, - specPos = { - from = Position(33414, 31426, 13), - to = Position(33433, 31449, 13), - }, - onUseExtra = function(player) - addEvent(function() - local baeloc = Creature("Sir Baeloc") - local nictros = Creature("Sir Nictros") - - if baeloc then - baeloc:say("Ah look my Brother! Challengers! After all this time finally a chance to prove our skills!") - addEvent(function() - local nictros = Creature("Sir Nictros") - if nictros then - nictros:say("Indeed! It has been a while! As the elder one I request the right of the first battle!") - end - end, 6 * 1000) - end - - addEvent(function() - local baeloc = Creature("Sir Baeloc") - local nictros = Creature("Sir Nictros") - if baeloc then - baeloc:say("Oh, man! You always get the fun!") - -- Keep Baeloc locked initially - will be released later - baeloc:setMoveLocked(true) - end - if nictros then - nictros:teleportTo(Position(33426, 31437, 13)) - -- Make sure Nictros can move and attack - nictros:setMoveLocked(false) - end - end, 12 * 1000) - end, 4 * 1000) - end, - exit = Position(33290, 32474, 9), + boss = { + name = "Sir Nictros", + createFunction = function() + local nictros = Game.createMonster("Sir Nictros", nictrosPosition, true, true) + local baeloc = Game.createMonster("Sir Baeloc", baelocPosition, true, true) + return nictros and baeloc + end, + }, + requiredLevel = 250, + playerPositions = { + { pos = Position(33424, 31413, 13), teleport = Position(33423, 31448, 13) }, + { pos = Position(33425, 31413, 13), teleport = Position(33423, 31448, 13) }, + { pos = Position(33426, 31413, 13), teleport = Position(33423, 31448, 13) }, + { pos = Position(33427, 31413, 13), teleport = Position(33423, 31448, 13) }, + { pos = Position(33428, 31413, 13), teleport = Position(33423, 31448, 13) }, + }, + specPos = { + from = Position(33414, 31426, 13), + to = Position(33433, 31449, 13), + }, + onUseExtra = function(player) + addEvent(function() + local baeloc = Creature("Sir Baeloc") + local nictros = Creature("Sir Nictros") + + if baeloc then + baeloc:say("Ah look my Brother! Challengers! After all this time finally a chance to prove our skills!") + addEvent(function() + local nictros = Creature("Sir Nictros") + if nictros then + nictros:say("Indeed! It has been a while! As the elder one I request the right of the first battle!") + end + end, 6 * 1000) + end + + addEvent(function() + local baeloc = Creature("Sir Baeloc") + local nictros = Creature("Sir Nictros") + if baeloc then + baeloc:say("Oh, man! You always get the fun!") + if nictros then + nictros:teleportTo(Position(33426, 31437, 13)) + nictros:setMoveLocked(false) + end + end + end, 12 * 1000) + end, 4 * 1000) + end, + exit = Position(33290, 32474, 9), } local lever = BossLever(config) lever:position(Position(33423, 31413, 13)) lever:register() - --- Health Trigger Logic -local BossHealthCheck = CreatureEvent("BossHealthCheck") - -function BossHealthCheck.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) - -- Safety check - if not creature or not creature:isMonster() then - return primaryDamage, primaryType, secondaryDamage, secondaryType - end - - local name = creature:getName() - - -- Calculate health percentage correctly - local function getHealthPercentage(creature) - local health = creature:getHealth() - local maxHealth = creature:getMaxHealth() - return (health / maxHealth) * 100 - end - - local healthPercent = getHealthPercentage(creature) - - -- Debug logging - print("[BossHealthCheck] Health check for:", name, "Health:", creature:getHealth(), "/", creature:getMaxHealth(), "=", healthPercent, "%") - - -- NICTROS reaches 85% health - if name == "Sir Nictros" and not healthStates.nictros85 and healthPercent <= 85 then - healthStates.nictros85 = true - print("[BossHealthCheck] Nictros at 85% or below - releasing Baeloc") - - creature:say("I'll step back now. Let's see how you handle my brother!") - creature:teleportTo(nictrosPosition) - creature:setMoveLocked(true) -- Lock Nictros until Baeloc hits 85% - - -- Release Baeloc to fight - local baeloc = Creature("Sir Baeloc") - if baeloc then - baeloc:teleportTo(Position(33426, 31435, 13)) - baeloc:setDirection(DIRECTION_SOUTH) - baeloc:setMoveLocked(false) -- Allow Baeloc to move and attack - baeloc:say("My turn! Let me show you my skills!") - end - - -- BAELOC reaches 85% health - elseif name == "Sir Baeloc" and healthStates.nictros85 and not healthStates.baeloc85 and healthPercent <= 85 then - healthStates.baeloc85 = true - print("[BossHealthCheck] Baeloc at 85% - releasing Nictros for joint attack") - - creature:say("Brother! I need your assistance!") - - -- Release Nictros to join the fight - local nictros = Creature("Sir Nictros") - if nictros then - nictros:setMoveLocked(false) -- Allow Nictros to move and attack again - nictros:teleportTo(Position(33424, 31435, 13)) -- Teleport near Baeloc - nictros:say("Now we fight together, brother!") - end - end - - return primaryDamage, primaryType, secondaryDamage, secondaryType -end - -BossHealthCheck:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/grave_danger_quest/creaturescripts_baeloc_nictros.lua b/data-otservbr-global/scripts/quests/grave_danger_quest/creaturescripts_baeloc_nictros.lua new file mode 100644 index 00000000000..2bebddca492 --- /dev/null +++ b/data-otservbr-global/scripts/quests/grave_danger_quest/creaturescripts_baeloc_nictros.lua @@ -0,0 +1,119 @@ +local config = { + centerRoom = Position(33424, 31439, 13), + newPosition = Position(33425, 31431, 13), + exitPos = Position(33290, 32474, 9), + x = 12, + y = 12, + baelocPos = Position(33422, 31428, 13), + nictrosPos = Position(33427, 31428, 13), + timer = Storage.Quest.U12_20.GraveDanger.Bosses.BaelocNictros.Timer, + room = Storage.Quest.U12_20.GraveDanger.Bosses.BaelocNictros.Room, + fromPos = Position(33418, 31434, 13), + toPos = Position(33431, 31445, 13), +} + +local brothers_summon = CreatureEvent("brothers_summon") + +function brothers_summon.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType) + local chance = math.random(1, 100) + local position = Position(math.random(config.fromPos.x, config.toPos.x), math.random(config.fromPos.y, config.toPos.y), config.fromPos.z) + local tile = Tile(position) + + if chance >= 90 then + if tile:isWalkable(false, false, false, true, false) then + local summon = creature:getName():lower() == "sir nictros" and "Squire Of Nictros" or "Retainer Of Baeloc" + Game.createMonster(summon, position, false, true) + end + end + + return primaryDamage, primaryType, -secondaryDamage, secondaryType +end + +brothers_summon:register() + +local sir_nictros_health = CreatureEvent("sir_nictros_health") + +function sir_nictros_health.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType) + local players = Game.getSpectators(config.centerRoom, false, true, config.x, config.x, config.y, config.y) + for _, player in pairs(players) do + if player:isPlayer() then + if player:getStorageValue(config.timer) < os.time() then + player:setStorageValue(config.timer, os.time() + 20 * 3600) + end + if player:getStorageValue(config.room) < os.time() then + player:setStorageValue(config.room, os.time() + 30 * 60) + end + end + end + + if primaryType == COMBAT_HEALING then + return primaryDamage, primaryType, -secondaryDamage, secondaryType + end + + local health = creature:getMaxHealth() * 0.60 + local brother_diff = (creature:getHealth() / creature:getMaxHealth()) * 100 + local brother = Creature("Sir Baeloc") + + if brother then + if brother_diff < 55 then + local brother_percent = (brother:getHealth() / brother:getMaxHealth()) * 100 + if (brother_percent - brother_diff) > 5 then + creature:addHealth(28000) + end + end + end + + creature:setStorageValue(1, creature:getStorageValue(1) + primaryDamage + secondaryDamage) + if creature:getStorageValue(2) < 1 and creature:getStorageValue(1) >= health then + creature:setStorageValue(2, 1) + creature:say("Now it's your chance for entertaiment, dear brother!") + creature:teleportTo(config.nictrosPos) + creature:setMoveLocked(true) + local baeloc = Creature("Sir Baeloc") + if baeloc then + baeloc:teleportTo(Position(33424, 31436, 13)) + baeloc:setMoveLocked(false) + end + end + + return primaryDamage, primaryType, -secondaryDamage, secondaryType +end + +sir_nictros_health:register() + +local sir_baeloc_health = CreatureEvent("sir_baeloc_health") + +function sir_baeloc_health.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType) + if primaryType == COMBAT_HEALING then + return primaryDamage, primaryType, -secondaryDamage, secondaryType + end + + local health = creature:getMaxHealth() * 0.60 + local brother_diff = (creature:getHealth() / creature:getMaxHealth()) * 100 + local brother = Creature("Sir Nictros") + + if brother then + if brother_diff < 55 then + local brother_percent = (brother:getHealth() / brother:getMaxHealth()) * 100 + if (brother_percent - brother_diff) > 5 then + creature:addHealth(28000) + end + end + end + + creature:setStorageValue(1, creature:getStorageValue(1) + primaryDamage + secondaryDamage) + + if creature:getStorageValue(2) < 1 and creature:getStorageValue(1) >= health then + creature:setStorageValue(2, 1) + creature:say("Join me in battle my brother. Let's share the fun!") + local nictros = Creature("Sir Nictros") + if nictros then + nictros:teleportTo(Position(33426, 31438, 13)) + nictros:setMoveLocked(false) + end + end + + return primaryDamage, primaryType, -secondaryDamage, secondaryType +end + +sir_baeloc_health:register() From 93bd17ebfc422aa0495d180aca355e39569c27df Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Fri, 16 May 2025 15:04:04 +0000 Subject: [PATCH 4/7] Lua code format - (Stylua) --- .../actions_baeloc_nictros.lua | 225 +++++++++--------- 1 file changed, 112 insertions(+), 113 deletions(-) diff --git a/data-otservbr-global/scripts/quests/grave_danger_quest/actions_baeloc_nictros.lua b/data-otservbr-global/scripts/quests/grave_danger_quest/actions_baeloc_nictros.lua index affa62c92ff..8c14edba969 100644 --- a/data-otservbr-global/scripts/quests/grave_danger_quest/actions_baeloc_nictros.lua +++ b/data-otservbr-global/scripts/quests/grave_danger_quest/actions_baeloc_nictros.lua @@ -2,76 +2,76 @@ local nictrosPosition = Position(33427, 31428, 13) local baelocPosition = Position(33422, 31428, 13) local healthStates = { - nictros85 = false, - baeloc85 = false + nictros85 = false, + baeloc85 = false, } local config = { - boss = { - name = "Sir Nictros", - createFunction = function() - local nictros = Game.createMonster("Sir Nictros", nictrosPosition, true, true) - local baeloc = Game.createMonster("Sir Baeloc", baelocPosition, true, true) - - if nictros then - nictros:registerEvent("BossHealthCheck") - -- Start with Nictros active - nictros:setMoveLocked(false) - end - if baeloc then - -- Start with Baeloc locked - baeloc:setMoveLocked(true) - baeloc:registerEvent("BossHealthCheck") - end - - healthStates.nictros85 = false - healthStates.baeloc85 = false - - return nictros and baeloc - end, - }, - requiredLevel = 250, - playerPositions = { - { pos = Position(33424, 31413, 13), teleport = Position(33423, 31448, 13) }, - { pos = Position(33425, 31413, 13), teleport = Position(33423, 31448, 13) }, - { pos = Position(33426, 31413, 13), teleport = Position(33423, 31448, 13) }, - { pos = Position(33427, 31413, 13), teleport = Position(33423, 31448, 13) }, - { pos = Position(33428, 31413, 13), teleport = Position(33423, 31448, 13) }, - }, - specPos = { - from = Position(33414, 31426, 13), - to = Position(33433, 31449, 13), - }, - onUseExtra = function(player) - addEvent(function() - local baeloc = Creature("Sir Baeloc") - local nictros = Creature("Sir Nictros") - - if baeloc then - baeloc:say("Ah look my Brother! Challengers! After all this time finally a chance to prove our skills!") - addEvent(function() - local nictros = Creature("Sir Nictros") - if nictros then - nictros:say("Indeed! It has been a while! As the elder one I request the right of the first battle!") - end - end, 6 * 1000) - end - - addEvent(function() - local baeloc = Creature("Sir Baeloc") - local nictros = Creature("Sir Nictros") - if baeloc then - baeloc:say("Oh, man! You always get the fun!") - baeloc:setMoveLocked(true) - end - if nictros then - nictros:teleportTo(Position(33426, 31437, 13)) - nictros:setMoveLocked(false) - end - end, 12 * 1000) - end, 4 * 1000) - end, - exit = Position(33290, 32474, 9), + boss = { + name = "Sir Nictros", + createFunction = function() + local nictros = Game.createMonster("Sir Nictros", nictrosPosition, true, true) + local baeloc = Game.createMonster("Sir Baeloc", baelocPosition, true, true) + + if nictros then + nictros:registerEvent("BossHealthCheck") + -- Start with Nictros active + nictros:setMoveLocked(false) + end + if baeloc then + -- Start with Baeloc locked + baeloc:setMoveLocked(true) + baeloc:registerEvent("BossHealthCheck") + end + + healthStates.nictros85 = false + healthStates.baeloc85 = false + + return nictros and baeloc + end, + }, + requiredLevel = 250, + playerPositions = { + { pos = Position(33424, 31413, 13), teleport = Position(33423, 31448, 13) }, + { pos = Position(33425, 31413, 13), teleport = Position(33423, 31448, 13) }, + { pos = Position(33426, 31413, 13), teleport = Position(33423, 31448, 13) }, + { pos = Position(33427, 31413, 13), teleport = Position(33423, 31448, 13) }, + { pos = Position(33428, 31413, 13), teleport = Position(33423, 31448, 13) }, + }, + specPos = { + from = Position(33414, 31426, 13), + to = Position(33433, 31449, 13), + }, + onUseExtra = function(player) + addEvent(function() + local baeloc = Creature("Sir Baeloc") + local nictros = Creature("Sir Nictros") + + if baeloc then + baeloc:say("Ah look my Brother! Challengers! After all this time finally a chance to prove our skills!") + addEvent(function() + local nictros = Creature("Sir Nictros") + if nictros then + nictros:say("Indeed! It has been a while! As the elder one I request the right of the first battle!") + end + end, 6 * 1000) + end + + addEvent(function() + local baeloc = Creature("Sir Baeloc") + local nictros = Creature("Sir Nictros") + if baeloc then + baeloc:say("Oh, man! You always get the fun!") + baeloc:setMoveLocked(true) + end + if nictros then + nictros:teleportTo(Position(33426, 31437, 13)) + nictros:setMoveLocked(false) + end + end, 12 * 1000) + end, 4 * 1000) + end, + exit = Position(33290, 32474, 9), } local lever = BossLever(config) @@ -82,51 +82,50 @@ lever:register() local BossHealthCheck = CreatureEvent("BossHealthCheck") function BossHealthCheck.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) - if not creature or not creature:isMonster() then - return primaryDamage, primaryType, secondaryDamage, secondaryType - end - - local name = creature:getName() - - local function getHealthPercentage(creature) - local health = creature:getHealth() - local maxHealth = creature:getMaxHealth() - return (health / maxHealth) * 100 - end - - local healthPercent = getHealthPercentage(creature) - - if name == "Sir Nictros" and not healthStates.nictros85 and healthPercent <= 85 then - healthStates.nictros85 = true - - creature:say("I'll step back now. Let's see how you handle my brother!") - creature:teleportTo(nictrosPosition) - creature:setMoveLocked(true) - - -- Release Baeloc to fight - local baeloc = Creature("Sir Baeloc") - if baeloc then - baeloc:teleportTo(Position(33426, 31435, 13)) - baeloc:setDirection(DIRECTION_SOUTH) - baeloc:setMoveLocked(false) - baeloc:say("My turn! Let me show you my skills!") - end - - elseif name == "Sir Baeloc" and healthStates.nictros85 and not healthStates.baeloc85 and healthPercent <= 85 then - healthStates.baeloc85 = true - - creature:say("Brother! I need your assistance!") - - -- Release Nictros to join the fight - local nictros = Creature("Sir Nictros") - if nictros then - nictros:setMoveLocked(false) - nictros:teleportTo(Position(33424, 31435, 13)) - nictros:say("Now we fight together, brother!") - end - end - - return primaryDamage, primaryType, secondaryDamage, secondaryType + if not creature or not creature:isMonster() then + return primaryDamage, primaryType, secondaryDamage, secondaryType + end + + local name = creature:getName() + + local function getHealthPercentage(creature) + local health = creature:getHealth() + local maxHealth = creature:getMaxHealth() + return (health / maxHealth) * 100 + end + + local healthPercent = getHealthPercentage(creature) + + if name == "Sir Nictros" and not healthStates.nictros85 and healthPercent <= 85 then + healthStates.nictros85 = true + + creature:say("I'll step back now. Let's see how you handle my brother!") + creature:teleportTo(nictrosPosition) + creature:setMoveLocked(true) + + -- Release Baeloc to fight + local baeloc = Creature("Sir Baeloc") + if baeloc then + baeloc:teleportTo(Position(33426, 31435, 13)) + baeloc:setDirection(DIRECTION_SOUTH) + baeloc:setMoveLocked(false) + baeloc:say("My turn! Let me show you my skills!") + end + elseif name == "Sir Baeloc" and healthStates.nictros85 and not healthStates.baeloc85 and healthPercent <= 85 then + healthStates.baeloc85 = true + + creature:say("Brother! I need your assistance!") + + -- Release Nictros to join the fight + local nictros = Creature("Sir Nictros") + if nictros then + nictros:setMoveLocked(false) + nictros:teleportTo(Position(33424, 31435, 13)) + nictros:say("Now we fight together, brother!") + end + end + + return primaryDamage, primaryType, secondaryDamage, secondaryType end -BossHealthCheck:register() \ No newline at end of file +BossHealthCheck:register() From 6f720eb9b7b327681790770e5f25a845ce50140d Mon Sep 17 00:00:00 2001 From: mrmdbeng Date: Fri, 16 May 2025 11:04:46 -0400 Subject: [PATCH 5/7] Delete creaturescripts_baeloc_nictros.lua --- .../creaturescripts_baeloc_nictros.lua | 119 ------------------ 1 file changed, 119 deletions(-) delete mode 100644 data-otservbr-global/scripts/quests/grave_danger_quest/creaturescripts_baeloc_nictros.lua diff --git a/data-otservbr-global/scripts/quests/grave_danger_quest/creaturescripts_baeloc_nictros.lua b/data-otservbr-global/scripts/quests/grave_danger_quest/creaturescripts_baeloc_nictros.lua deleted file mode 100644 index 2bebddca492..00000000000 --- a/data-otservbr-global/scripts/quests/grave_danger_quest/creaturescripts_baeloc_nictros.lua +++ /dev/null @@ -1,119 +0,0 @@ -local config = { - centerRoom = Position(33424, 31439, 13), - newPosition = Position(33425, 31431, 13), - exitPos = Position(33290, 32474, 9), - x = 12, - y = 12, - baelocPos = Position(33422, 31428, 13), - nictrosPos = Position(33427, 31428, 13), - timer = Storage.Quest.U12_20.GraveDanger.Bosses.BaelocNictros.Timer, - room = Storage.Quest.U12_20.GraveDanger.Bosses.BaelocNictros.Room, - fromPos = Position(33418, 31434, 13), - toPos = Position(33431, 31445, 13), -} - -local brothers_summon = CreatureEvent("brothers_summon") - -function brothers_summon.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType) - local chance = math.random(1, 100) - local position = Position(math.random(config.fromPos.x, config.toPos.x), math.random(config.fromPos.y, config.toPos.y), config.fromPos.z) - local tile = Tile(position) - - if chance >= 90 then - if tile:isWalkable(false, false, false, true, false) then - local summon = creature:getName():lower() == "sir nictros" and "Squire Of Nictros" or "Retainer Of Baeloc" - Game.createMonster(summon, position, false, true) - end - end - - return primaryDamage, primaryType, -secondaryDamage, secondaryType -end - -brothers_summon:register() - -local sir_nictros_health = CreatureEvent("sir_nictros_health") - -function sir_nictros_health.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType) - local players = Game.getSpectators(config.centerRoom, false, true, config.x, config.x, config.y, config.y) - for _, player in pairs(players) do - if player:isPlayer() then - if player:getStorageValue(config.timer) < os.time() then - player:setStorageValue(config.timer, os.time() + 20 * 3600) - end - if player:getStorageValue(config.room) < os.time() then - player:setStorageValue(config.room, os.time() + 30 * 60) - end - end - end - - if primaryType == COMBAT_HEALING then - return primaryDamage, primaryType, -secondaryDamage, secondaryType - end - - local health = creature:getMaxHealth() * 0.60 - local brother_diff = (creature:getHealth() / creature:getMaxHealth()) * 100 - local brother = Creature("Sir Baeloc") - - if brother then - if brother_diff < 55 then - local brother_percent = (brother:getHealth() / brother:getMaxHealth()) * 100 - if (brother_percent - brother_diff) > 5 then - creature:addHealth(28000) - end - end - end - - creature:setStorageValue(1, creature:getStorageValue(1) + primaryDamage + secondaryDamage) - if creature:getStorageValue(2) < 1 and creature:getStorageValue(1) >= health then - creature:setStorageValue(2, 1) - creature:say("Now it's your chance for entertaiment, dear brother!") - creature:teleportTo(config.nictrosPos) - creature:setMoveLocked(true) - local baeloc = Creature("Sir Baeloc") - if baeloc then - baeloc:teleportTo(Position(33424, 31436, 13)) - baeloc:setMoveLocked(false) - end - end - - return primaryDamage, primaryType, -secondaryDamage, secondaryType -end - -sir_nictros_health:register() - -local sir_baeloc_health = CreatureEvent("sir_baeloc_health") - -function sir_baeloc_health.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType) - if primaryType == COMBAT_HEALING then - return primaryDamage, primaryType, -secondaryDamage, secondaryType - end - - local health = creature:getMaxHealth() * 0.60 - local brother_diff = (creature:getHealth() / creature:getMaxHealth()) * 100 - local brother = Creature("Sir Nictros") - - if brother then - if brother_diff < 55 then - local brother_percent = (brother:getHealth() / brother:getMaxHealth()) * 100 - if (brother_percent - brother_diff) > 5 then - creature:addHealth(28000) - end - end - end - - creature:setStorageValue(1, creature:getStorageValue(1) + primaryDamage + secondaryDamage) - - if creature:getStorageValue(2) < 1 and creature:getStorageValue(1) >= health then - creature:setStorageValue(2, 1) - creature:say("Join me in battle my brother. Let's share the fun!") - local nictros = Creature("Sir Nictros") - if nictros then - nictros:teleportTo(Position(33426, 31438, 13)) - nictros:setMoveLocked(false) - end - end - - return primaryDamage, primaryType, -secondaryDamage, secondaryType -end - -sir_baeloc_health:register() From 3d5d6fbd7491bd431051059028785701b80b9411 Mon Sep 17 00:00:00 2001 From: mrmdbeng Date: Fri, 16 May 2025 11:06:26 -0400 Subject: [PATCH 6/7] Fixing my own mistakes. --- .../monster/quests/grave_danger/bosses/sir_baeloc.lua | 6 ++---- .../monster/quests/grave_danger/bosses/sir_nictros.lua | 9 ++++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua b/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua index 7e05cbdb61d..d9c6e83df80 100644 --- a/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua +++ b/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua @@ -21,9 +21,7 @@ monster.speed = 125 monster.manaCost = 0 monster.events = { - "sir_baeloc_health", - "brothers_summon", - "grave_danger_death", + "BossHealthCheck" } monster.changeTarget = { @@ -80,6 +78,7 @@ monster.voices = { monster.loot = { { name = "platinum coin", minCount = 1, maxCount = 5, chance = 100000 }, { name = "crystal coin", minCount = 0, maxCount = 2, chance = 50000 }, + { name = "silver token", minCount = 0, maxCount = 3, chance = 40000 }, { name = "supreme health potion", minCount = 0, maxCount = 6, chance = 35000 }, { name = "ultimate mana potion", minCount = 0, maxCount = 20, chance = 32000 }, { name = "ultimate spirit potion", minCount = 0, maxCount = 20, chance = 32000 }, @@ -87,7 +86,6 @@ monster.loot = { { name = "berserk potion", minCount = 0, maxCount = 10, chance = 12000 }, { name = "piece of draconian steel", minCount = 0, maxCount = 4, chance = 9000 }, { id = 3039, minCount = 0, maxCount = 1, chance = 12000 }, -- red gem - { name = "silver token", minCount = 0, maxCount = 2, chance = 9500 }, { id = 23542, chance = 5200 }, -- collar of blue plasma { id = 23544, chance = 5200 }, -- collar of red plasma { name = "knight legs", chance = 11000 }, diff --git a/data-otservbr-global/monster/quests/grave_danger/bosses/sir_nictros.lua b/data-otservbr-global/monster/quests/grave_danger/bosses/sir_nictros.lua index 60b14f17b24..87652425b0b 100644 --- a/data-otservbr-global/monster/quests/grave_danger/bosses/sir_nictros.lua +++ b/data-otservbr-global/monster/quests/grave_danger/bosses/sir_nictros.lua @@ -20,16 +20,15 @@ monster.corpse = 31599 monster.speed = 125 monster.manaCost = 0 -monster.events = { - "sir_nictros_health", - "brothers_summon", -} - monster.changeTarget = { interval = 4000, chance = 10, } +monster.events = { + "BossHealthCheck", +} + monster.bosstiary = { bossRaceId = 1754, bossRace = RARITY_ARCHFOE, From 862701ceceb60e4559d5bcf0cb4ce946edd70d05 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Fri, 16 May 2025 15:06:59 +0000 Subject: [PATCH 7/7] Lua code format - (Stylua) --- .../monster/quests/grave_danger/bosses/sir_baeloc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua b/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua index d9c6e83df80..385c25eb48a 100644 --- a/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua +++ b/data-otservbr-global/monster/quests/grave_danger/bosses/sir_baeloc.lua @@ -21,7 +21,7 @@ monster.speed = 125 monster.manaCost = 0 monster.events = { - "BossHealthCheck" + "BossHealthCheck", } monster.changeTarget = {