From e8d314601fd0889c1c451f81e930e877331eef2c Mon Sep 17 00:00:00 2001 From: ThrisStraizo <45871917+ThrisStraizo@users.noreply.github.com> Date: Sat, 31 Jan 2026 15:36:13 -0800 Subject: [PATCH] Self Destruct NM fix This PR fixes the Self-Destruct behavior for various NMs. --- .../zones/Castle_Zvahl_Baileys/mobs/Dark_Spark.lua | 13 +++++++++++++ scripts/zones/Den_of_Rancor/mobs/Friar_Rush.lua | 4 ++++ scripts/zones/Den_of_Rancor/mobs/Rancor_Torch.lua | 13 +++++++++++++ scripts/zones/Ifrits_Cauldron/mobs/Magma.lua | 13 +++++++++++++ scripts/zones/Konschtat_Highlands/mobs/Forger.lua | 4 ++++ 5 files changed, 47 insertions(+) diff --git a/scripts/zones/Castle_Zvahl_Baileys/mobs/Dark_Spark.lua b/scripts/zones/Castle_Zvahl_Baileys/mobs/Dark_Spark.lua index 2384db5b823..902587194b5 100644 --- a/scripts/zones/Castle_Zvahl_Baileys/mobs/Dark_Spark.lua +++ b/scripts/zones/Castle_Zvahl_Baileys/mobs/Dark_Spark.lua @@ -16,4 +16,17 @@ entity.onMobSpawn = function(mob) mob:setMobMod(xi.mobMod.MAGIC_DELAY, 0) end +entity.onMobMobskillChoose = function(mob, target, skillId) + local skillList = + { + xi.mobSkill.BERSERK_BOMB, + } + + if mob:getHPP() < 10 then + table.insert(skillList, xi.mobSkill.SELF_DESTRUCT_BOMB) + end + + return skillList[math.random(1, #skillList)] +end + return entity diff --git a/scripts/zones/Den_of_Rancor/mobs/Friar_Rush.lua b/scripts/zones/Den_of_Rancor/mobs/Friar_Rush.lua index ea1f5889831..ae197c75b15 100644 --- a/scripts/zones/Den_of_Rancor/mobs/Friar_Rush.lua +++ b/scripts/zones/Den_of_Rancor/mobs/Friar_Rush.lua @@ -33,6 +33,10 @@ entity.onMobSpawn = function(mob) mob:setMobMod(xi.mobMod.BASE_DAMAGE_MULTIPLIER, 150) end +entity.onMobMobskillChoose = function(mob, target, skillId) + return xi.mobSkill.BERSERK_BOMB +end + entity.onMobDeath = function(mob, player, optParams) xi.hunts.checkHunt(mob, player, 394) end diff --git a/scripts/zones/Den_of_Rancor/mobs/Rancor_Torch.lua b/scripts/zones/Den_of_Rancor/mobs/Rancor_Torch.lua index 0035bc0abf0..fd7b86ebd66 100644 --- a/scripts/zones/Den_of_Rancor/mobs/Rancor_Torch.lua +++ b/scripts/zones/Den_of_Rancor/mobs/Rancor_Torch.lua @@ -21,6 +21,19 @@ entity.onMobDeath = function(mob, player, optParams) player:setCharVar('rancorCurse', 0) -- Player has been cleansed of the curse end +entity.onMobMobskillChoose = function(mob, target, skillId) + local skillList = + { + xi.mobSkill.BERSERK_BOMB, + } + + if mob:getHPP() < 20 then + table.insert(skillList, xi.mobSkill.SELF_DESTRUCT_BOMB) + end + + return skillList[math.random(1, #skillList)] +end + -- Turns off all the lights once the NM despawns entity.onMobDespawn = function(mob) for npcId = ID.npc.LANTERN_OFFSET + 15, ID.npc.LANTERN_OFFSET + 18 do diff --git a/scripts/zones/Ifrits_Cauldron/mobs/Magma.lua b/scripts/zones/Ifrits_Cauldron/mobs/Magma.lua index 03d69ca8cdd..3cfec751d57 100644 --- a/scripts/zones/Ifrits_Cauldron/mobs/Magma.lua +++ b/scripts/zones/Ifrits_Cauldron/mobs/Magma.lua @@ -23,4 +23,17 @@ entity.onMobSpawn = function(mob) mob:setMobMod(xi.mobMod.BASE_DAMAGE_MULTIPLIER, 200) end +entity.onMobMobskillChoose = function(mob, target, skillId) + local skillList = + { + xi.mobSkill.BERSERK_BOMB, + } + + if mob:getHPP() < 10 then + table.insert(skillList, xi.mobSkill.SELF_DESTRUCT_BOMB) + end + + return skillList[math.random(1, #skillList)] +end + return entity diff --git a/scripts/zones/Konschtat_Highlands/mobs/Forger.lua b/scripts/zones/Konschtat_Highlands/mobs/Forger.lua index c5df4acc48e..76bfa06bc15 100644 --- a/scripts/zones/Konschtat_Highlands/mobs/Forger.lua +++ b/scripts/zones/Konschtat_Highlands/mobs/Forger.lua @@ -11,6 +11,10 @@ entity.onMobInitialize = function(mob) mob:setMobMod(xi.mobMod.IDLE_DESPAWN, 300) end +entity.onMobMobskillChoose = function(mob, target, skillId) + return xi.mobSkill.BERSERK_BOMB +end + entity.onMobDeath = function(mob, player, optParams) xi.tutorial.onMobDeath(player) end