Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions scripts/actions/abilities/pets/attachments/reactive_shield.lua
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
-----------------------------------
-- Attachment: Reactive Shield
-- Reactive Shield
-- Grants Blaze Spikes to the automaton for 60 seconds.
-- https://wiki.ffo.jp/html/10431.html
-----------------------------------
---@type TAttachment
local attachmentObject = {}

attachmentObject.onEquip = function(pet)
pet:addListener('AUTOMATON_ATTACHMENT_CHECK', 'ATTACHMENT_REACTIVE_SHIELD', function(automaton, target)
if automaton:hasRecast(xi.recast.ABILITY, xi.automaton.abilities.REACTIVE_SHIELD) then
return
end

local master = automaton:getMaster()
if
not automaton:hasRecast(xi.recast.ABILITY, xi.automaton.abilities.REACTIVE_SHIELD) and
master and
master:countEffect(xi.effect.FIRE_MANEUVER) > 0
then
automaton:useMobAbility(xi.automaton.abilities.REACTIVE_SHIELD, automaton)

if not master then
return
end

local fireManeuvers = master:countEffect(xi.effect.FIRE_MANEUVER)

if fireManeuvers == 0 then
return
end

automaton:useMobAbility(xi.automaton.abilities.REACTIVE_SHIELD, automaton)
end)
end

Expand Down
15 changes: 10 additions & 5 deletions scripts/actions/abilities/pets/automaton/reactive_shield.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
-----------------------------------
-- Reactive Shield
-- Grants Blaze Spikes to the automaton for 60 seconds.
-- https://wiki.ffo.jp/html/10431.html
-- Power formula derived from brief testing. TODO: Gather more data and refine formula.
-----------------------------------
---@type TAbilityAutomaton
local abilityObject = {}
Expand All @@ -9,12 +12,14 @@ abilityObject.onAutomatonAbilityCheck = function(target, automaton, skill)
end

abilityObject.onAutomatonAbility = function(target, automaton, skill, master, action)
automaton:addRecast(xi.recast.ABILITY, skill:getID(), 65)
local pMod = automaton:getSkillLevel(xi.skill.AUTOMATON_MAGIC)
local duration = 60
local power = math.floor((pMod / 56)^3 / 8) + 4 -- No idea how the actual formula used Automaton skill level, so heres a placeholder (4 @ lvl 1, 10 @ lvl 61, 20 @ lvl 75, 62 @ lvl 99)
automaton:addRecast(xi.recast.ABILITY, skill:getID(), 60)

if target:addStatusEffect(xi.effect.BLAZE_SPIKES, { power = power, duration = duration, origin = automaton }) then
local skillLevel = math.max(automaton:getSkillLevel(xi.skill.AUTOMATON_MELEE), automaton:getSkillLevel(xi.skill.AUTOMATON_RANGED), automaton:getSkillLevel(xi.skill.AUTOMATON_MAGIC))
local intelligence = automaton:getStat(xi.mod.INT)

local power = math.floor(skillLevel / 16) + math.floor(intelligence / 8)

if target:addStatusEffect(xi.effect.BLAZE_SPIKES, { power = power, duration = 60, origin = automaton }) then
skill:setMsg(xi.msg.basic.SKILL_GAIN_EFFECT)
else
skill:setMsg(xi.msg.basic.SKILL_NO_EFFECT)
Expand Down
Loading