|
| 1 | +----------------------------------- |
| 2 | +-- Flame Holder |
| 3 | +-- Reverts Flame Holder to its pre-2019 functionality - Where it consumed Fire Maneuvers on skill execution. |
| 4 | +-- Source : https://wiki.ffo.jp/html/11183.html |
| 5 | +----------------------------------- |
| 6 | +require('modules/module_utils') |
| 7 | +----------------------------------- |
| 8 | +local m = Module:new('legacy_flame_holder') |
| 9 | + |
| 10 | +local validSkills = set{ |
| 11 | + xi.automaton.abilities.ARCUBALLISTA, |
| 12 | + xi.automaton.abilities.ARMOR_PIERCER, |
| 13 | + xi.automaton.abilities.ARMOR_SHATTERER, |
| 14 | + xi.automaton.abilities.BONE_CRUSHER, |
| 15 | + xi.automaton.abilities.CANNIBAL_BLADE, |
| 16 | + xi.automaton.abilities.CHIMERA_RIPPER, |
| 17 | + xi.automaton.abilities.DAZE, |
| 18 | + xi.automaton.abilities.KNOCKOUT, |
| 19 | + xi.automaton.abilities.MAGIC_MORTAR, |
| 20 | + xi.automaton.abilities.SLAPSTICK, |
| 21 | + xi.automaton.abilities.STRING_CLIPPER, |
| 22 | + xi.automaton.abilities.STRING_SHREDDER, |
| 23 | +} |
| 24 | + |
| 25 | +m:addOverride('xi.actions.abilities.pets.attachments.flame_holder.onEquip', function(pet, attachment) |
| 26 | + pet:addListener('WEAPONSKILL_STATE_ENTER', 'AUTO_FLAME_HOLDER_START', function(automaton, skillId) |
| 27 | + -- Not a valid skill for Flame Holder |
| 28 | + if not validSkills[skillId] then |
| 29 | + return |
| 30 | + end |
| 31 | + |
| 32 | + local master = automaton:getMaster() |
| 33 | + |
| 34 | + if not master then |
| 35 | + return |
| 36 | + end |
| 37 | + |
| 38 | + local fireManeuvers = utils.clamp(master:countEffect(xi.effect.FIRE_MANEUVER), 0, 3) |
| 39 | + |
| 40 | + -- No Fire Maneuvers |
| 41 | + if fireManeuvers == 0 then |
| 42 | + return |
| 43 | + end |
| 44 | + |
| 45 | + local amount = 25 * fireManeuvers |
| 46 | + |
| 47 | + automaton:setLocalVar('flameholdermaneuvers', fireManeuvers) |
| 48 | + automaton:setLocalVar('flameholder', amount) |
| 49 | + automaton:addMod(xi.mod.WEAPONSKILL_DAMAGE_BASE, amount) |
| 50 | + end) |
| 51 | + |
| 52 | + pet:addListener('WEAPONSKILL_STATE_EXIT', 'AUTO_FLAME_HOLDER_END', function(automaton, skillId, wasExecuted) |
| 53 | + local amount = automaton:getLocalVar('flameholder') |
| 54 | + |
| 55 | + -- If no amount was set, do nothing. |
| 56 | + if amount == 0 then |
| 57 | + return |
| 58 | + end |
| 59 | + |
| 60 | + local fireManeuvers = automaton:getLocalVar('flameholdermaneuvers') |
| 61 | + local master = automaton:getMaster() |
| 62 | + |
| 63 | + -- Consume all Fire Maneuvers on execution. |
| 64 | + if master then |
| 65 | + for i = 1, fireManeuvers do |
| 66 | + master:delStatusEffectSilent(xi.effect.FIRE_MANEUVER) |
| 67 | + end |
| 68 | + end |
| 69 | + |
| 70 | + automaton:delMod(xi.mod.WEAPONSKILL_DAMAGE_BASE, amount) |
| 71 | + automaton:setLocalVar('flameholder', 0) |
| 72 | + automaton:setLocalVar('flameholdermaneuvers', 0) |
| 73 | + end) |
| 74 | +end) |
| 75 | + |
| 76 | +m:addOverride('xi.actions.abilities.pets.attachments.flame_holder.onUnequip', function(pet, attachment) |
| 77 | + local amount = pet:getLocalVar('flameholder') |
| 78 | + |
| 79 | + -- Should be nearly impossible, but just in case. |
| 80 | + if amount ~= 0 then |
| 81 | + pet:delMod(xi.mod.WEAPONSKILL_DAMAGE_BASE, amount) |
| 82 | + end |
| 83 | + |
| 84 | + pet:setLocalVar('flameholder', 0) |
| 85 | + pet:setLocalVar('flameholdermaneuvers', 0) |
| 86 | + pet:removeListener('AUTO_FLAME_HOLDER_START') |
| 87 | + pet:removeListener('AUTO_FLAME_HOLDER_END') |
| 88 | +end) |
| 89 | + |
| 90 | +m:addOverride('xi.actions.abilities.pets.attachments.flame_holder.onManeuverGain', function(pet, attachment, maneuvers) |
| 91 | +end) |
| 92 | + |
| 93 | +m:addOverride('xi.actions.abilities.pets.attachments.flame_holder.onManeuverLose', function(pet, attachment, maneuvers) |
| 94 | +end) |
| 95 | + |
| 96 | +m:addOverride('xi.actions.abilities.pets.attachments.flame_holder.onUpdate', function(pet, attachment, maneuvers) |
| 97 | +end) |
| 98 | + |
| 99 | +return m |
0 commit comments