|
| 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('era_flame_holder') |
| 9 | + |
| 10 | +local validSkills = set |
| 11 | +{ |
| 12 | + xi.automaton.abilities.ARCUBALLISTA, |
| 13 | + xi.automaton.abilities.ARMOR_PIERCER, |
| 14 | + xi.automaton.abilities.ARMOR_SHATTERER, |
| 15 | + xi.automaton.abilities.BONE_CRUSHER, |
| 16 | + xi.automaton.abilities.CANNIBAL_BLADE, |
| 17 | + xi.automaton.abilities.CHIMERA_RIPPER, |
| 18 | + xi.automaton.abilities.DAZE, |
| 19 | + xi.automaton.abilities.KNOCKOUT, |
| 20 | + xi.automaton.abilities.MAGIC_MORTAR, |
| 21 | + xi.automaton.abilities.SLAPSTICK, |
| 22 | + xi.automaton.abilities.STRING_CLIPPER, |
| 23 | + xi.automaton.abilities.STRING_SHREDDER, |
| 24 | +} |
| 25 | + |
| 26 | +m:addOverride('xi.actions.abilities.pets.attachments.flame_holder.onEquip', function(pet, attachment) |
| 27 | + pet:addListener('WEAPONSKILL_STATE_ENTER', 'AUTO_FLAME_HOLDER_START', function(automaton, skillId) |
| 28 | + -- Not a valid skill for Flame Holder |
| 29 | + if not validSkills[skillId] then |
| 30 | + return |
| 31 | + end |
| 32 | + |
| 33 | + local master = automaton:getMaster() |
| 34 | + |
| 35 | + if not master then |
| 36 | + return |
| 37 | + end |
| 38 | + |
| 39 | + -- Fetch the amount of active Fire Maneuvers on weaponskill state entry. |
| 40 | + local fireManeuvers = master:countEffect(xi.effect.FIRE_MANEUVER) |
| 41 | + |
| 42 | + -- No Fire Maneuvers |
| 43 | + if fireManeuvers == 0 then |
| 44 | + return |
| 45 | + end |
| 46 | + |
| 47 | + -- Set the WEAPONSKILL_DAMAGE_BASE mod to 125% / 150% / 175% based on the number of Fire Maneuvers active. |
| 48 | + local flameHolderAmount = 100 + 25 * fireManeuvers |
| 49 | + |
| 50 | + automaton:setLocalVar('fireManeuvers', fireManeuvers) |
| 51 | + automaton:setLocalVar('flameHolderAmount', flameHolderAmount) |
| 52 | + automaton:addMod(xi.mod.WEAPONSKILL_DAMAGE_BASE, flameHolderAmount) |
| 53 | + end) |
| 54 | + |
| 55 | + pet:addListener('WEAPONSKILL_STATE_EXIT', 'AUTO_FLAME_HOLDER_END', function(automaton, skillId, wasExecuted) |
| 56 | + local flameHolderAmount = automaton:getLocalVar('flameHolderAmount') |
| 57 | + |
| 58 | + -- If no Flame Holder bonus is active, do nothing. |
| 59 | + if flameHolderAmount == 0 then |
| 60 | + return |
| 61 | + end |
| 62 | + |
| 63 | + local fireManeuvers = automaton:getLocalVar('fireManeuvers') |
| 64 | + local master = automaton:getMaster() |
| 65 | + |
| 66 | + if not master then |
| 67 | + return |
| 68 | + end |
| 69 | + |
| 70 | + -- Consume all Fire Maneuvers on execution. |
| 71 | + for i = 1, fireManeuvers do |
| 72 | + master:delStatusEffectSilent(xi.effect.FIRE_MANEUVER) |
| 73 | + end |
| 74 | + |
| 75 | + -- Remove the Flame Holder bonus and reset local variables. |
| 76 | + automaton:delMod(xi.mod.WEAPONSKILL_DAMAGE_BASE, flameHolderAmount) |
| 77 | + automaton:setLocalVar('flameHolderAmount', 0) |
| 78 | + automaton:setLocalVar('fireManeuvers', 0) |
| 79 | + end) |
| 80 | +end) |
| 81 | + |
| 82 | +m:addOverride('xi.actions.abilities.pets.attachments.flame_holder.onUnequip', function(pet, attachment) |
| 83 | + local amount = pet:getLocalVar('flameHolderAmount') |
| 84 | + |
| 85 | + -- Should be nearly impossible, but just in case. |
| 86 | + if amount ~= 0 then |
| 87 | + pet:delMod(xi.mod.WEAPONSKILL_DAMAGE_BASE, amount) |
| 88 | + end |
| 89 | + |
| 90 | + pet:setLocalVar('flameHolderAmount', 0) |
| 91 | + pet:setLocalVar('fireManeuvers', 0) |
| 92 | + pet:removeListener('AUTO_FLAME_HOLDER_START') |
| 93 | + pet:removeListener('AUTO_FLAME_HOLDER_END') |
| 94 | +end) |
| 95 | + |
| 96 | +m:addOverride('xi.actions.abilities.pets.attachments.flame_holder.onManeuverGain', function(pet, attachment, maneuvers) |
| 97 | +end) |
| 98 | + |
| 99 | +m:addOverride('xi.actions.abilities.pets.attachments.flame_holder.onManeuverLose', function(pet, attachment, maneuvers) |
| 100 | +end) |
| 101 | + |
| 102 | +m:addOverride('xi.actions.abilities.pets.attachments.flame_holder.onUpdate', function(pet, attachment, maneuvers) |
| 103 | +end) |
| 104 | + |
| 105 | +return m |
0 commit comments