From c2889a8e260265508cdb2265922925d8442bcbcc Mon Sep 17 00:00:00 2001 From: Skold177 <113406182+Skold177@users.noreply.github.com> Date: Fri, 16 Jan 2026 01:49:13 -0500 Subject: [PATCH] [lua] Legion XI chooseAction conversion Converts their logic over to the new chooseAction system --- .../mobs/Hoplomachus_XI-XXVI.lua | 72 ++++--------------- .../mobs/Retiarius_XI-XIX.lua | 62 +++++++--------- 2 files changed, 36 insertions(+), 98 deletions(-) diff --git a/scripts/zones/Chamber_of_Oracles/mobs/Hoplomachus_XI-XXVI.lua b/scripts/zones/Chamber_of_Oracles/mobs/Hoplomachus_XI-XXVI.lua index ba729f10453..1e4dc13e1f9 100644 --- a/scripts/zones/Chamber_of_Oracles/mobs/Hoplomachus_XI-XXVI.lua +++ b/scripts/zones/Chamber_of_Oracles/mobs/Hoplomachus_XI-XXVI.lua @@ -9,20 +9,6 @@ mixins = { require('scripts/mixins/job_special') } ---@type TMobEntity local entity = {} -local buffTable = -{ - [1] = { xi.magic.spell.PROTECT_III, xi.effect.PROTECT }, - [2] = { xi.magic.spell.SHELL_III, xi.effect.SHELL }, -} - -local groupTable = -{ - [1] = -2, -- Secutor XI-XXXII - [2] = -1, -- Retiarius XI-XIX - [3] = 0, -- Hoplamachus XI-XXVI - [4] = 1, -- Centurio XI-I -} - entity.onMobInitialize = function(mob) mob:setMobMod(xi.mobMod.MAGIC_COOL, 20) mob:setMod(xi.mod.DARK_SLEEP_RES_RANK, 8) @@ -33,55 +19,21 @@ end entity.onMobSpellChoose = function(mob, target, spellId) local spellList = { - { xi.magic.spell.BANISH_II, target }, - { xi.magic.spell.FLASH, target }, + [1] = { xi.magic.spell.BANISH_II, target, false, xi.action.type.DAMAGE_TARGET, nil, 0, 100 }, + [2] = { xi.magic.spell.FLASH, target, false, xi.action.type.ENFEEBLING_TARGET, xi.effect.FLASH, 0, 100 }, + [3] = { xi.magic.spell.PROTECT_III, mob, true, xi.action.type.ENHANCING_TARGET, xi.effect.PROTECT, 0, 25 }, + [4] = { xi.magic.spell.SHELL_III, mob, true, xi.action.type.ENHANCING_TARGET, xi.effect.SHELL, 0, 25 }, + [5] = { xi.magic.spell.CURE_IV, mob, true, xi.action.type.HEALING_TARGET, 33, 0, 100 }, } - local baseMobId = mob:getID() - - -- Check for missing buffs on self and allies - for i = 1, #buffTable do - local buffTargets = {} - - for j = 1, #groupTable do - local allyEntity = GetMobByID(baseMobId + groupTable[j]) - if - allyEntity and - allyEntity:isAlive() and - not allyEntity:hasStatusEffect(buffTable[i][2]) - then - table.insert(buffTargets, allyEntity) - end - end - - -- Adds each missing buff to the spell list one time with a random target that is missing it - if #buffTargets > 0 then - table.insert(spellList, - { - buffTable[i][1], - buffTargets[math.random(#buffTargets)], - }) - end - end - - -- Check for low HP allies to heal (33% or lower) - for j = 1, #groupTable do - local allyEntity = GetMobByID(baseMobId + groupTable[j]) - if - allyEntity and - allyEntity:isAlive() and - allyEntity:getHPP() <= 33 - then - table.insert(spellList, { xi.magic.spell.CURE_IV, allyEntity }) - end - end - - -- Pick a random spell from the compiled list - local randomEntry = math.random(1, #spellList) - local spellIdChosen = spellList[randomEntry][1] - local entityChosen = spellList[randomEntry][2] + local groupTable = + { + GetMobByID(mob:getID() - 2), -- Secutor XI-XXXII + GetMobByID(mob:getID() - 1), -- Retiarius XI-XIX + GetMobByID(mob:getID() + 1), -- Centurio XI-I + } - return spellIdChosen, entityChosen + return xi.combat.behavior.chooseAction(mob, target, groupTable, spellList) end return entity diff --git a/scripts/zones/Chamber_of_Oracles/mobs/Retiarius_XI-XIX.lua b/scripts/zones/Chamber_of_Oracles/mobs/Retiarius_XI-XIX.lua index 5fc1ea6b06a..a28ca1faf32 100644 --- a/scripts/zones/Chamber_of_Oracles/mobs/Retiarius_XI-XIX.lua +++ b/scripts/zones/Chamber_of_Oracles/mobs/Retiarius_XI-XIX.lua @@ -9,18 +9,6 @@ mixins = { require('scripts/mixins/job_special') } ---@type TMobEntity local entity = {} -local enfeebleTable = -{ - [1] = { xi.magic.spell.FROST, xi.effect.FROST }, - [2] = { xi.magic.spell.DROWN, xi.effect.DROWN }, - [3] = { xi.magic.spell.RASP, xi.effect.RASP }, - [4] = { xi.magic.spell.POISONGA_II, xi.effect.POISON }, - [5] = { xi.magic.spell.BIO_II, xi.effect.BIO }, - [6] = { xi.magic.spell.BLIND, xi.effect.BLINDNESS }, - [7] = { xi.magic.spell.SLEEPGA, xi.effect.SLEEP_I }, - [8] = { xi.magic.spell.SLEEPGA_II, xi.effect.SLEEP_I }, -} - entity.onMobInitialize = function(mob) mob:setMobMod(xi.mobMod.MAGIC_COOL, 20) mob:setMod(xi.mod.LIGHT_SLEEP_RES_RANK, 8) @@ -31,34 +19,32 @@ end entity.onMobSpellChoose = function(mob, target, spellId) local spellList = { - xi.magic.spell.AERO_III, - xi.magic.spell.FIRE_III, - xi.magic.spell.BLIZZARD_III, - xi.magic.spell.BLIZZAGA_II, - xi.magic.spell.THUNDAGA_II, - xi.magic.spell.STONEGA_III, - xi.magic.spell.BURST, - xi.magic.spell.FLARE, - xi.magic.spell.FLOOD, - xi.magic.spell.DRAIN, - xi.magic.spell.STUN, + [ 1] = { xi.magic.spell.AERO_III, target, false, xi.action.type.DAMAGE_TARGET, nil, 0, 100 }, + [ 2] = { xi.magic.spell.FIRE_III, target, false, xi.action.type.DAMAGE_TARGET, nil, 0, 100 }, + [ 3] = { xi.magic.spell.BLIZZARD_III, target, false, xi.action.type.DAMAGE_TARGET, nil, 0, 100 }, + [ 4] = { xi.magic.spell.BLIZZAGA_II, target, false, xi.action.type.DAMAGE_TARGET, nil, 0, 100 }, + [ 5] = { xi.magic.spell.THUNDAGA_II, target, false, xi.action.type.DAMAGE_TARGET, nil, 0, 100 }, + [ 6] = { xi.magic.spell.STONEGA_III, target, false, xi.action.type.DAMAGE_TARGET, nil, 0, 100 }, + [ 7] = { xi.magic.spell.BURST, target, false, xi.action.type.DAMAGE_TARGET, nil, 0, 100 }, + [ 8] = { xi.magic.spell.FLARE, target, false, xi.action.type.DAMAGE_TARGET, nil, 0, 100 }, + [ 9] = { xi.magic.spell.FLOOD, target, false, xi.action.type.DAMAGE_TARGET, nil, 0, 100 }, + [10] = { xi.magic.spell.DRAIN, target, false, xi.action.type.DRAIN_HP, nil, 0, 100 }, + [11] = { xi.magic.spell.ASPIR, target, false, xi.action.type.DRAIN_MP, nil, 0, 100 }, + [12] = { xi.magic.spell.STUN, target, false, xi.action.type.ENFEEBLING_TARGET, xi.effect.STUN, 0, 100 }, + [13] = { xi.magic.spell.FROST, target, false, xi.action.type.ENFEEBLING_TARGET, xi.effect.FROST, 0, 100 }, + [14] = { xi.magic.spell.DROWN, target, false, xi.action.type.ENFEEBLING_TARGET, xi.effect.DROWN, 0, 100 }, + [15] = { xi.magic.spell.RASP, target, false, xi.action.type.ENFEEBLING_TARGET, xi.effect.RASP, 0, 100 }, + [16] = { xi.magic.spell.POISONGA_II, target, false, xi.action.type.ENFEEBLING_TARGET, xi.effect.POISON, 0, 100 }, + [17] = { xi.magic.spell.BIO_II, target, false, xi.action.type.ENFEEBLING_TARGET, xi.effect.BIO, 4, 100 }, + [18] = { xi.magic.spell.BLIND, target, false, xi.action.type.ENFEEBLING_TARGET, xi.effect.BLINDNESS, 0, 100 }, + [19] = { xi.magic.spell.SLEEP, target, false, xi.action.type.ENFEEBLING_TARGET, xi.effect.SLEEP_I, 0, 25 }, + [20] = { xi.magic.spell.SLEEP_II, target, false, xi.action.type.ENFEEBLING_TARGET, xi.effect.SLEEP_I, 0, 25 }, + [21] = { xi.magic.spell.SLEEPGA, target, false, xi.action.type.ENFEEBLING_TARGET, xi.effect.SLEEP_I, 0, 25 }, + [22] = { xi.magic.spell.SLEEPGA_II, target, false, xi.action.type.ENFEEBLING_TARGET, xi.effect.SLEEP_I, 0, 25 }, + [23] = { xi.magic.spell.BLAZE_SPIKES, mob, false, xi.action.type.ENHANCING_FORCE_SELF, xi.effect.BLAZE_SPIKES, 0, 100 }, } - if target:getMP() > 0 then - table.insert(spellList, xi.magic.spell.ASPIR) - end - - if not mob:hasStatusEffect(xi.effect.BLAZE_SPIKES) then - table.insert(spellList, xi.magic.spell.BLAZE_SPIKES) - end - - for i = 1, #enfeebleTable do - if not target:hasStatusEffect(enfeebleTable[i][2]) then - table.insert(spellList, enfeebleTable[i][1]) - end - end - - return spellList[math.random(1, #spellList)] + return xi.combat.behavior.chooseAction(mob, target, nil, spellList) end return entity