From 464f7b4a86b111c3eaa20dfa6d931b5f7f8932a1 Mon Sep 17 00:00:00 2001 From: Skold <113406182+Skold177@users.noreply.github.com> Date: Tue, 19 May 2026 23:08:18 -0400 Subject: [PATCH] [lua] Automaton Replicator Update the Automaton Attachment Replicator --- modules/abyssea/lua/replicator.lua | 45 +++++++++++++++++++ .../pets/attachments/damage_gauge.lua | 9 +++- .../abilities/pets/attachments/replicator.lua | 41 ++++++++++++++--- .../abilities/pets/automaton/replicator.lua | 26 +++++++---- scripts/globals/automaton.lua | 4 +- 5 files changed, 107 insertions(+), 18 deletions(-) create mode 100644 modules/abyssea/lua/replicator.lua diff --git a/modules/abyssea/lua/replicator.lua b/modules/abyssea/lua/replicator.lua new file mode 100644 index 00000000000..fb829cb77a9 --- /dev/null +++ b/modules/abyssea/lua/replicator.lua @@ -0,0 +1,45 @@ +----------------------------------- +-- Replicator (Pre-2011) +-- Description : Applies Blink based on Wind Maneuvers when HP is below a certain threshold. Cooldown of 1 minute. Consumes all Wind Maneuvers on use. +-- If Automaton has a Damage Gauge equipped, activation threshold is increased to 75% HP. +-- Amount of images increased on December 15th, 2011. +-- Changed from Blink to Copy Image on August 5th, 2015. +-- Changed to not consume Wind Maneuvers on August 6th, 2019. +-- https://wiki.ffo.jp/html/12225.html +----------------------------------- +require('modules/module_utils') +----------------------------------- + +local m = Module:new('era_replicator') + +local shadowTable = +{ + [1] = 2, + [2] = 3, + [3] = 4, +} + +m:addOverride('xi.actions.abilities.pets.automaton.replicator.onAutomatonAbilityCheck', function(target, automaton, skill) + return 0 +end) + +m:addOverride('xi.actions.abilities.pets.automaton.replicator.onAutomatonAbility', function(target, automaton, skill, master, action) + local windManeuvers = master:countEffect(xi.effect.WIND_MANEUVER) + local shadows = shadowTable[windManeuvers] + + automaton:addRecast(xi.recast.ABILITY, skill:getID(), 60) + + for i = 1, windManeuvers do + master:delStatusEffectSilent(xi.effect.WIND_MANEUVER) + end + + if target:addStatusEffect(xi.effect.BLINK, { power = shadows, duration = 300, origin = automaton }) then + skill:setMsg(xi.msg.basic.SKILL_GAIN_EFFECT) + else + skill:setMsg(xi.msg.basic.SKILL_NO_EFFECT) + end + + return xi.effect.BLINK +end) + +return m diff --git a/scripts/actions/abilities/pets/attachments/damage_gauge.lua b/scripts/actions/abilities/pets/attachments/damage_gauge.lua index 834b2e0eaab..cbcff4d27e2 100644 --- a/scripts/actions/abilities/pets/attachments/damage_gauge.lua +++ b/scripts/actions/abilities/pets/attachments/damage_gauge.lua @@ -1,15 +1,20 @@ ----------------------------------- -- Attachment: Damage Gauge +-- Causes an automaton with access to healing magic use Cure sooner and reduces the recast time for healing magic. Reduces healing magic cooldown further for each active light maneuver. +-- Light Maneuvers increase the percent that the automaton will cure its master, but not itself, this will always remain at 50%. +-- Equipping Damage Gauge also increases when Replicator activates, from ≤50% to ≤75%. ----------------------------------- ---@type TAttachment local attachmentObject = {} attachmentObject.onEquip = function(pet, attachment) - xi.automaton.onAttachmentEquip(pet, attachment) + xi.automaton.onAttachmentEquip(pet, attachment) -- Used for Healing Magic interactions. + pet:setLocalVar('damageGaugeEquipped', 1) -- Used for Replicator interactions. end attachmentObject.onUnequip = function(pet, attachment) - xi.automaton.onAttachmentUnequip(pet, attachment) + xi.automaton.onAttachmentUnequip(pet, attachment) -- Used for Healing Magic interactions. + pet:setLocalVar('damageGaugeEquipped', 0) -- Used for Replicator interactions. end attachmentObject.onManeuverGain = function(pet, attachment, maneuvers) diff --git a/scripts/actions/abilities/pets/attachments/replicator.lua b/scripts/actions/abilities/pets/attachments/replicator.lua index 53863f5c882..2769c3043b0 100644 --- a/scripts/actions/abilities/pets/attachments/replicator.lua +++ b/scripts/actions/abilities/pets/attachments/replicator.lua @@ -7,16 +7,45 @@ local attachmentObject = {} attachmentObject.onEquip = function(pet) pet:addListener('AUTOMATON_ATTACHMENT_CHECK', 'ATTACHMENT_REPLICATOR', function(automaton, target) local master = automaton:getMaster() - local hpthreshold = (automaton:getLocalVar('damagegauge') > 0) and 75 or 50 + -- If no master, return. + if not master then + return + end + + -- If blink or copy image is still active, return. if - master and - master:countEffect(xi.effect.WIND_MANEUVER) > 0 and - automaton:getHPP() <= hpthreshold and - not automaton:hasStatusEffect(xi.effect.BLINK) + automaton:hasStatusEffect(xi.effect.BLINK) or + automaton:hasStatusEffect(xi.effect.COPY_IMAGE) then - automaton:useMobAbility(xi.automaton.abilities.REPLICATOR, automaton) + return + end + + local windManeuvers = master:countEffect(xi.effect.WIND_MANEUVER) + + -- If no wind maneuvers, return. + if windManeuvers == 0 then + return + end + + -- If Replicator is on cooldown, return. + if automaton:hasRecast(xi.recast.ABILITY, xi.automaton.abilities.REPLICATOR) then + return end + + local activationThreshold = 50 + + -- If Damage Gauge is equipped, increase activation threshold to 75%. + if automaton:getLocalVar('damageGaugeEquipped') == 1 then + activationThreshold = 75 + end + + -- If HP is above activation threshold, return. + if automaton:getHPP() > activationThreshold then + return + end + + automaton:useMobAbility(xi.automaton.abilities.REPLICATOR, automaton) end) end diff --git a/scripts/actions/abilities/pets/automaton/replicator.lua b/scripts/actions/abilities/pets/automaton/replicator.lua index 91dc447995b..c5cd06b8025 100644 --- a/scripts/actions/abilities/pets/automaton/replicator.lua +++ b/scripts/actions/abilities/pets/automaton/replicator.lua @@ -1,29 +1,39 @@ ----------------------------------- -- Replicator +-- Description : Applies Copy Image based on Wind Maneuvers when HP is below a certain threshold. Cooldown of 1 minute. +-- If Automaton has a Damage Gauge equipped, activation threshold is increased to 75% HP +-- Amount of images increased on December 15th, 2011. +-- Changed from Blink to Copy Image on August 5th, 2015. +-- Changed to not consume Wind Maneuvers on August 6th, 2019. +-- https://wiki.ffo.jp/html/12225.html ----------------------------------- ---@type TAbilityAutomaton local abilityObject = {} +local shadowTable = +{ + [1] = 3, + [2] = 7, + [3] = 10, +} + abilityObject.onAutomatonAbilityCheck = function(target, automaton, skill) return 0 end abilityObject.onAutomatonAbility = function(target, automaton, skill, master, action) + local windManeuvers = master:countEffect(xi.effect.WIND_MANEUVER) + local shadows = shadowTable[windManeuvers] + automaton:addRecast(xi.recast.ABILITY, skill:getID(), 60) - local maneuvers = master:countEffect(xi.effect.WIND_MANEUVER) - local duration = 300 - local shadows = 1 + maneuvers -- math.floor(maneuvers * 3.5) currently on retail - if target:addStatusEffect(xi.effect.BLINK, { power = shadows, duration = duration, origin = automaton }) then + if target:addStatusEffect(xi.effect.COPY_IMAGE, { power = shadows, duration = 300, origin = automaton, subPower = shadows }) then skill:setMsg(xi.msg.basic.SKILL_GAIN_EFFECT) - for i = 1, maneuvers do - master:delStatusEffectSilent(xi.effect.WIND_MANEUVER) - end else skill:setMsg(xi.msg.basic.SKILL_NO_EFFECT) end - return xi.effect.BLINK + return xi.effect.COPY_IMAGE end return abilityObject diff --git a/scripts/globals/automaton.lua b/scripts/globals/automaton.lua index 891d04983d2..cbf77748b8a 100644 --- a/scripts/globals/automaton.lua +++ b/scripts/globals/automaton.lua @@ -117,8 +117,8 @@ local attachmentModifiers = { xi.mod.REGEN, { nil, nil, nil, nil }, true }, }, ['coiler'] = { { xi.mod.DOUBLE_ATTACK, { 3, 10, 20, 30 }, true }, }, ['coiler_ii'] = { { xi.mod.DOUBLE_ATTACK, { 10, 15, 25, 35 }, true }, }, - ['damage_gauge'] = { { xi.mod.AUTO_HEALING_THRESHOLD, { 30, 40, 50, 75 }, true }, - { xi.mod.AUTO_HEALING_DELAY, { 3, 6, 8, 10 }, false }, }, + ['damage_gauge'] = { { xi.mod.AUTO_HEALING_THRESHOLD, { 50, 60, 70, 85 }, true }, + { xi.mod.AUTO_HEALING_DELAY, { 0, 3, 6, 9 }, false }, }, ['drum_magazine'] = { { xi.mod.AUTO_RANGED_DELAY, { 3, 6, 9, 15 }, true }, }, ['dynamo'] = { { xi.mod.CRITHITRATE, { 3, 5, 7, 9 }, true }, }, ['dynamo_ii'] = { { xi.mod.CRITHITRATE, { 5, 10, 15, 20 }, true }, },