From 5e029338df814018f9e45e5d540bfd6655c244da Mon Sep 17 00:00:00 2001 From: Xaver-DaRed Date: Tue, 22 Apr 2025 20:50:34 +0200 Subject: [PATCH 1/4] Minor bluemagic.lua script cleanup --- scripts/globals/bluemagic.lua | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/scripts/globals/bluemagic.lua b/scripts/globals/bluemagic.lua index 515f19a9c99..faac6a2d57b 100644 --- a/scripts/globals/bluemagic.lua +++ b/scripts/globals/bluemagic.lua @@ -40,14 +40,16 @@ end -- Get WSC local function calculateWSC(attacker, params) - local wsc = calculateAlpha(attacker:getMainLvl()) * - (attacker:getStat(xi.mod.STR) * params.str_wsc + - attacker:getStat(xi.mod.DEX) * params.dex_wsc + - attacker:getStat(xi.mod.VIT) * params.vit_wsc + - attacker:getStat(xi.mod.AGI) * params.agi_wsc + - attacker:getStat(xi.mod.INT) * params.int_wsc + - attacker:getStat(xi.mod.MND) * params.mnd_wsc + - attacker:getStat(xi.mod.CHR) * params.chr_wsc) + local alpha = calculateAlpha(attacker:getMainLvl()) + local wscSTR = attacker:getStat(xi.mod.STR) * params.str_wsc + local wscDEX = attacker:getStat(xi.mod.DEX) * params.dex_wsc + local wscVIT = attacker:getStat(xi.mod.VIT) * params.vit_wsc + local wscAGI = attacker:getStat(xi.mod.AGI) * params.agi_wsc + local wscINT = attacker:getStat(xi.mod.INT) * params.int_wsc + local wscMND = attacker:getStat(xi.mod.MND) * params.mnd_wsc + local wscCHR = attacker:getStat(xi.mod.CHR) * params.chr_wsc + + local wsc = (wscSTR + wscDEX + wscVIT + wscAGI + wscINT + wscMND + wscCHR) * alpha return wsc end @@ -180,7 +182,7 @@ xi.spells.blue.usePhysicalSpell = function(caster, target, spell, params) local bonusWSC = 0 -- BLU AF3 bonus (triples the base WSC when it procs) - if caster:getMod(xi.mod.AUGMENT_BLU_MAGIC) > math.random(0, 99) then + if math.random(1, 100) <= caster:getMod(xi.mod.AUGMENT_BLU_MAGIC) then bonusWSC = 2 end @@ -302,7 +304,7 @@ xi.spells.blue.usePhysicalSpell = function(caster, target, spell, params) return xi.spells.blue.applySpellDamage(caster, target, spell, finaldmg, params, trickAttackTarget) end --- Get the damage for a magical Blue Magic spell +-- Get the damage for a magical Blue Magic spell. Called from spell scripts. xi.spells.blue.useMagicalSpell = function(caster, target, spell, params) -- In individual magical spells, don't use params.effect for the added effect -- This would affect the resistance check for damage here @@ -314,20 +316,19 @@ xi.spells.blue.useMagicalSpell = function(caster, target, spell, params) params.skillType = xi.skill.BLUE_MAGIC -- WSC - local wsc = calculateWSC(caster, params) - local bonusWSC = 0 + local wsc = calculateWSC(caster, params) + local wscMultiplier = 1 -- BLU AF3 bonus (triples the base WSC when it procs) - if caster:getMod(xi.mod.AUGMENT_BLU_MAGIC) > math.random(0, 99) then - bonusWSC = 2 + if math.random(1, 100) <= caster:getMod(xi.mod.AUGMENT_BLU_MAGIC) then + wscMultiplier = wscMultiplier + 1 end if caster:hasStatusEffect(xi.effect.BURST_AFFINITY) then - bonusWSC = bonusWSC + 1 -- Burst Affinity doubles base WSC - bonusWSC = bonusWSC + (caster:getMod(xi.mod.ENHANCES_BURST_AFFINITY) / 100) + wscMultiplier = wscMultiplier + 1 + caster:getMod(xi.mod.ENHANCES_BURST_AFFINITY) / 100 end - wsc = wsc * (1 + bonusWSC) -- Bonus WSC from AF3/BA + wsc = wsc * wscMultiplier -- Bonus WSC from AF3/BA -- INT/MND/CHR dmg bonuses params.diff = caster:getStat(params.attribute) - target:getStat(params.attribute) From 8383a977cc90d899dc5b8ae7d5392efad4c890d1 Mon Sep 17 00:00:00 2001 From: Xaver-DaRed Date: Tue, 22 Apr 2025 21:38:25 +0200 Subject: [PATCH 2/4] Audit breath blue spells status effects Uses new functions for breath spells. Creates new function to apply status effects better --- scripts/actions/spells/blue/bad_breath.lua | 45 +++--- .../actions/spells/blue/flying_hip_press.lua | 15 +- scripts/actions/spells/blue/frost_breath.lua | 28 ++-- scripts/actions/spells/blue/heat_breath.lua | 16 +- scripts/actions/spells/blue/hecatomb_wave.lua | 28 ++-- .../actions/spells/blue/magnetite_cloud.lua | 28 ++-- scripts/actions/spells/blue/poison_breath.lua | 28 ++-- .../actions/spells/blue/radiant_breath.lua | 35 +++-- .../actions/spells/blue/sub-zero_smash.lua | 4 +- scripts/globals/bluemagic.lua | 144 ++++++++++++++---- 10 files changed, 248 insertions(+), 123 deletions(-) diff --git a/scripts/actions/spells/blue/bad_breath.lua b/scripts/actions/spells/blue/bad_breath.lua index 40a61111788..e4413c685e9 100644 --- a/scripts/actions/spells/blue/bad_breath.lua +++ b/scripts/actions/spells/blue/bad_breath.lua @@ -21,29 +21,36 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.PLANTOID + params.ecosystem = xi.ecosystem.PLANTOID params.attackType = xi.attackType.BREATH params.damageType = xi.damageType.EARTH - params.diff = 0 -- no stat increases magic accuracy - params.skillType = xi.skill.BLUE_MAGIC - params.hpMod = 8 - params.lvlMod = 3 - - local results = xi.spells.blue.useBreathSpell(caster, target, spell, params, true) - local damage = results[1] - local resist = results[2] - - local duration = 60 -- 30s/60s - if resist >= 0.5 then - target:addStatusEffect(xi.effect.SLOW, 2000, 0, duration * resist) - target:addStatusEffect(xi.effect.SILENCE, 1, 0, duration * resist) - target:addStatusEffect(xi.effect.PARALYSIS, 15, 0, duration * resist) - target:addStatusEffect(xi.effect.BIND, 1, 0, duration * resist) - target:addStatusEffect(xi.effect.WEIGHT, 20, 0, duration * resist) - target:addStatusEffect(xi.effect.POISON, 4, 0, duration * resist) - target:addStatusEffect(xi.effect.BLINDNESS, 20, 0, duration * resist) + params.diff = 0 -- no stat increases magic accuracy + params.skillType = xi.skill.BLUE_MAGIC + params.hpMod = 8 + params.lvlMod = 3 + parmas.isConal = true + + -- Handle damage. + local damage = xi.spells.blue.useBreathSpell(caster, target, spell, params) + + if damage <= 0 then + return damage end + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.SLOW, 2000, 0, 60 }, + [2] = { xi.effect.SILENCE, 1, 0, 60 }, + [3] = { xi.effect.PARALYSIS, 15, 0, 60 }, + [4] = { xi.effect.BIND, 1, 0, 60 }, + [5] = { xi.effect.WEIGHT, 20, 0, 60 }, + [6] = { xi.effect.POISON, 4, 0, 60 }, + [7] = { xi.effect.BLINDNESS, 20, 0, 60 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) + return damage end diff --git a/scripts/actions/spells/blue/flying_hip_press.lua b/scripts/actions/spells/blue/flying_hip_press.lua index cd4fb1dd11f..1b1f068e8e9 100644 --- a/scripts/actions/spells/blue/flying_hip_press.lua +++ b/scripts/actions/spells/blue/flying_hip_press.lua @@ -21,18 +21,15 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.BEASTMEN + params.ecosystem = xi.ecosystem.BEASTMEN params.attackType = xi.attackType.BREATH params.damageType = xi.damageType.WIND - params.diff = 0 -- no stat increases magic accuracy - params.skillType = xi.skill.BLUE_MAGIC - params.hpMod = 3 - params.lvlMod = 0 + params.diff = 0 -- no stat increases magic accuracy + params.skillType = xi.skill.BLUE_MAGIC + params.hpMod = 3 + params.lvlMod = 0 - local results = xi.spells.blue.useBreathSpell(caster, target, spell, params, false) - local damage = results[1] - - return damage + return xi.spells.blue.useBreathSpell(caster, target, spell, params) end return spellObject diff --git a/scripts/actions/spells/blue/frost_breath.lua b/scripts/actions/spells/blue/frost_breath.lua index ed01a8f53ef..7a6a632a987 100644 --- a/scripts/actions/spells/blue/frost_breath.lua +++ b/scripts/actions/spells/blue/frost_breath.lua @@ -21,22 +21,30 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.LIZARD + params.ecosystem = xi.ecosystem.LIZARD params.attackType = xi.attackType.BREATH params.damageType = xi.damageType.ICE - params.diff = 0 -- no stat increases magic accuracy - params.skillType = xi.skill.BLUE_MAGIC - params.hpMod = 3 - params.lvlMod = 0.625 + params.diff = 0 -- no stat increases magic accuracy + params.skillType = xi.skill.BLUE_MAGIC + params.hpMod = 3 + params.lvlMod = 0.625 + parmas.isConal = true - local results = xi.spells.blue.useBreathSpell(caster, target, spell, params, true) - local damage = results[1] - local resist = results[2] + -- Handle damage. + local damage = xi.spells.blue.useBreathSpell(caster, target, spell, params) - if resist >= 0.5 then - target:addStatusEffect(xi.effect.PARALYSIS, 15, 0, 60 * resist) + if damage <= 0 then + return damage end + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.PARALYSIS, 15, 0, 60 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) + return damage end diff --git a/scripts/actions/spells/blue/heat_breath.lua b/scripts/actions/spells/blue/heat_breath.lua index 9d517fba325..61304ac4393 100644 --- a/scripts/actions/spells/blue/heat_breath.lua +++ b/scripts/actions/spells/blue/heat_breath.lua @@ -21,18 +21,16 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.BEAST + params.ecosystem = xi.ecosystem.BEAST params.attackType = xi.attackType.BREATH params.damageType = xi.damageType.FIRE - params.diff = 0 -- no stat increases magic accuracy - params.skillType = xi.skill.BLUE_MAGIC - params.hpMod = 2 - params.lvlMod = 0 + params.diff = 0 -- no stat increases magic accuracy + params.skillType = xi.skill.BLUE_MAGIC + params.hpMod = 2 + params.lvlMod = 0 + parmas.isConal = true - local results = xi.spells.blue.useBreathSpell(caster, target, spell, params, true) - local damage = results[1] - - return damage + return xi.spells.blue.useBreathSpell(caster, target, spell, params) end return spellObject diff --git a/scripts/actions/spells/blue/hecatomb_wave.lua b/scripts/actions/spells/blue/hecatomb_wave.lua index 32a9e478219..dabccb2f3fc 100644 --- a/scripts/actions/spells/blue/hecatomb_wave.lua +++ b/scripts/actions/spells/blue/hecatomb_wave.lua @@ -21,22 +21,30 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.DEMON + params.ecosystem = xi.ecosystem.DEMON params.attackType = xi.attackType.BREATH params.damageType = xi.damageType.WIND - params.diff = 0 -- no stat increases magic accuracy - params.skillType = xi.skill.BLUE_MAGIC - params.hpMod = 4 - params.lvlMod = 1.5 + params.diff = 0 -- no stat increases magic accuracy + params.skillType = xi.skill.BLUE_MAGIC + params.hpMod = 4 + params.lvlMod = 1.5 + parmas.isConal = true - local results = xi.spells.blue.useBreathSpell(caster, target, spell, params, true) - local damage = results[1] - local resist = results[2] + -- Handle damage. + local damage = xi.spells.blue.useBreathSpell(caster, target, spell, params) - if resist >= 0.5 then - target:addStatusEffect(xi.effect.BLINDNESS, 20, 0, 60 * resist) + if damage <= 0 then + return damage end + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.BLINDNESS, 20, 0, 60 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) + return damage end diff --git a/scripts/actions/spells/blue/magnetite_cloud.lua b/scripts/actions/spells/blue/magnetite_cloud.lua index 5ffd33215bb..e7a869f474d 100644 --- a/scripts/actions/spells/blue/magnetite_cloud.lua +++ b/scripts/actions/spells/blue/magnetite_cloud.lua @@ -21,22 +21,30 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.BEASTMEN + params.ecosystem = xi.ecosystem.BEASTMEN params.attackType = xi.attackType.BREATH params.damageType = xi.damageType.EARTH - params.diff = 0 -- no stat increases magic accuracy - params.skillType = xi.skill.BLUE_MAGIC - params.hpMod = 6 - params.lvlMod = 1.875 + params.diff = 0 -- no stat increases magic accuracy + params.skillType = xi.skill.BLUE_MAGIC + params.hpMod = 6 + params.lvlMod = 1.875 + parmas.isConal = true - local results = xi.spells.blue.useBreathSpell(caster, target, spell, params, true) - local damage = results[1] - local resist = results[2] + -- Handle damage. + local damage = xi.spells.blue.useBreathSpell(caster, target, spell, params) - if resist >= 0.5 then - target:addStatusEffect(xi.effect.WEIGHT, 25, 0, 60 * resist) + if damage <= 0 then + return damage end + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.WEIGHT, 25, 0, 60 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) + return damage end diff --git a/scripts/actions/spells/blue/poison_breath.lua b/scripts/actions/spells/blue/poison_breath.lua index 0d98bcaea10..ac244a4db8e 100644 --- a/scripts/actions/spells/blue/poison_breath.lua +++ b/scripts/actions/spells/blue/poison_breath.lua @@ -21,22 +21,30 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.UNDEAD + params.ecosystem = xi.ecosystem.UNDEAD params.attackType = xi.attackType.BREATH params.damageType = xi.damageType.WATER - params.diff = 0 -- no stat increases magic accuracy - params.skillType = xi.skill.BLUE_MAGIC - params.hpMod = 10 - params.lvlMod = 1.25 + params.diff = 0 -- no stat increases magic accuracy + params.skillType = xi.skill.BLUE_MAGIC + params.hpMod = 10 + params.lvlMod = 1.25 + parmas.isConal = true - local results = xi.spells.blue.useBreathSpell(caster, target, spell, params, true) - local damage = results[1] - local resist = results[2] + -- Handle damage. + local damage = xi.spells.blue.useBreathSpell(caster, target, spell, params) - if resist >= 0.5 then - target:addStatusEffect(xi.effect.POISON, 4, 0, 60 * resist) + if damage <= 0 then + return damage end + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.POISON, 4, 0, 60 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) + return damage end diff --git a/scripts/actions/spells/blue/radiant_breath.lua b/scripts/actions/spells/blue/radiant_breath.lua index f367811e3e3..4c567c28f5d 100644 --- a/scripts/actions/spells/blue/radiant_breath.lua +++ b/scripts/actions/spells/blue/radiant_breath.lua @@ -21,24 +21,31 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.DRAGON + params.ecosystem = xi.ecosystem.DRAGON params.attackType = xi.attackType.BREATH params.damageType = xi.damageType.LIGHT - params.diff = 0 -- no stat increases magic accuracy - params.skillType = xi.skill.BLUE_MAGIC - params.hpMod = 5 - params.lvlMod = 0.75 - - local results = xi.spells.blue.useBreathSpell(caster, target, spell, params, true) - local damage = results[1] - local resist = results[2] - - local duration = 60 - if resist >= 0.5 then - target:addStatusEffect(xi.effect.SLOW, 2500, 0, duration * resist) - target:addStatusEffect(xi.effect.SILENCE, 25, 0, duration * resist) + params.diff = 0 -- no stat increases magic accuracy + params.skillType = xi.skill.BLUE_MAGIC + params.hpMod = 5 + params.lvlMod = 0.75 + parmas.isConal = true + + -- Handle damage. + local damage = xi.spells.blue.useBreathSpell(caster, target, spell, params) + + if damage <= 0 then + return damage end + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.SLOW, 2500, 0, 60 }, + [2] = { xi.effect.SILENCE, 25, 0, 60 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) + return damage end diff --git a/scripts/actions/spells/blue/sub-zero_smash.lua b/scripts/actions/spells/blue/sub-zero_smash.lua index 8dcaa77b027..25506512b2a 100644 --- a/scripts/actions/spells/blue/sub-zero_smash.lua +++ b/scripts/actions/spells/blue/sub-zero_smash.lua @@ -48,7 +48,9 @@ spellObject.onSpellCast = function(caster, target, spell) local duration = 180 local damage = xi.spells.blue.usePhysicalSpell(caster, target, spell, params) - xi.spells.blue.usePhysicalSpellAddedEffect(caster, target, spell, params, damage, power, tick, duration) + if damage > 0 then + xi.spells.blue.usePhysicalSpellAddedEffect(caster, target, spell, params, damage, power, tick, duration) + end return damage end diff --git a/scripts/globals/bluemagic.lua b/scripts/globals/bluemagic.lua index faac6a2d57b..4f19739d7de 100644 --- a/scripts/globals/bluemagic.lua +++ b/scripts/globals/bluemagic.lua @@ -2,9 +2,11 @@ -- Blue Magic utilities -- Used for Blue Magic spells. ----------------------------------- +require('scripts/globals/combat/physical_utilities') +require('scripts/globals/combat/magic_hit_rate') require('scripts/globals/magic') require('scripts/globals/mobskills') -require('scripts/globals/combat/physical_utilities') +require('scripts/globals/spells/damage_spell') ----------------------------------- xi = xi or {} xi.spells = xi.spells or {} @@ -416,11 +418,15 @@ xi.spells.blue.useDrainSpell = function(caster, target, spell, params, damageCap return finalDamage end --- Get the damage and resistance for a breath Blue Magic spell -xi.spells.blue.useBreathSpell = function(caster, target, spell, params, isConal) - local results = {} - results[1] = 0 -- damage - results[2] = 0 -- resistance (used in spell to determine added effect resistance) +-- Breath-type blue magic spells. +xi.spells.blue.useBreathSpell = function(caster, target, spell, params) + -- Early return. + if + parmas.isConal and -- Conal breath spells + not target:isInfront(caster, 32) -- Conal check (45° cone) + then + return 0 + end -- Initial damage local dmg = caster:getHP() / params.hpMod @@ -428,39 +434,87 @@ xi.spells.blue.useBreathSpell = function(caster, target, spell, params, isConal) dmg = dmg + caster:getMainLvl() / params.lvlMod end - -- Conal breath spells - if isConal then - -- Conal check (45° cone) - local isInCone = 0 - if target:isInfront(caster, 32) then - isInCone = 1 - end + -- Parameters + local spellId = spell:getID() or 0 + local spellFamily = spell:getSpellFamily() or 0 + local spellElement = spell:getElement() or 0 - dmg = dmg * isInCone - end + -- Multipliers + local correlationMultiplier = 1 + calculateCorrelation(params.ecosystem, target:getEcosystem(), caster:getMerit(xi.merit.MONSTER_CORRELATION)) + local breathSDT = 1 + caster:getMod(xi.mod.BREATH_DMG_DEALT) / 100) + + local targetMagicDamageAdjustment = xi.spells.damage.calculateTMDA(target, spellElement) + local multipleTargetReduction = xi.spells.damage.calculateMTDR(spell) + local elementalStaffBonus = xi.spells.damage.calculateElementalStaffBonus(caster, spellElement) + local elementalAffinityBonus = xi.spells.damage.calculateElementalAffinityBonus(caster, spellElement) + local resistTier = xi.combat.magicHitRate.calculateResistRate(caster, target, spellFamily, xi.skill.BLUE_MAGIC, 0, spellElement, 0, 0, 0) + local additionalResistTier = xi.spells.damage.calculateAdditionalResistTier(caster, target, spellElement) + local elementalSDT = xi.spells.damage.calculateSDT(target, spellElement) + local dayAndWeather = xi.spells.damage.calculateDayAndWeather(caster, spellElement, false) + local magicBonusDiff = xi.spells.damage.calculateMagicBonusDiff(caster, target, spellId, xi.skill.BLUE_MAGIC, spellElement) + local skillTypeMultiplier = xi.spells.damage.calculateSkillTypeMultiplier(xi.skill.BLUE_MAGIC) + local ninFutaeBonus = xi.spells.damage.calculateNinFutaeBonus(caster, xi.skill.BLUE_MAGIC) + local ninjutsuMultiplier = xi.spells.damage.calculateNinjutsuMultiplier(caster, target, xi.skill.BLUE_MAGIC) + local scarletDeliriumMultiplier = xi.spells.damage.calculateScarletDeliriumMultiplier(caster) + local areaOfEffectResistance = xi.spells.damage.calculateAreaOfEffectResistance(target, spell) + + dmg = math.floor(dmg * correlationMultiplier) + dmg = math.floor(dmg * breathSDT) + dmg = math.floor(dmg * targetMagicDamageAdjustment) + dmg = math.floor(dmg * multipleTargetReduction) + dmg = math.floor(dmg * elementalStaffBonus) + dmg = math.floor(dmg * elementalAffinityBonus) + dmg = math.floor(dmg * resistTier) + dmg = math.floor(dmg * additionalResistTier) + dmg = math.floor(dmg * elementalSDT) + dmg = math.floor(dmg * dayAndWeather) + dmg = math.floor(dmg * magicBonusDiff) + dmg = math.floor(dmg * skillTypeMultiplier) + dmg = math.floor(dmg * ninFutaeBonus) + dmg = math.floor(dmg * ninjutsuMultiplier) + dmg = math.floor(dmg * scarletDeliriumMultiplier) + dmg = math.floor(dmg * areaOfEffectResistance) + + -- Handle "Nuke Wall". It must be handled after all previous calculations, but before clamp. + if nukeAbsorbOrNullify > 0 then + local nukeWallFactor = xi.spells.damage.calculateNukeWallFactor(target, spellElement, dmg) + dmg = math.floor(finalDamage * nukeWallFactor) + end + + -- Apply damage + dmg = target:breathDmgTaken(dmg) - -- Monster correlation - local correlationMultiplier = calculateCorrelation(params.ecosystem, target:getEcosystem(), caster:getMerit(xi.merit.MONSTER_CORRELATION)) - dmg = math.floor(dmg * (1 + correlationMultiplier)) + -- Handle Magic Absorb message and HP recovery. + if dmg < 0 then + dmg = target:addHP(-dmg) + spell:setMsg(xi.msg.basic.MAGIC_RECOVERS_HP) - -- Monster elemental adjustments - local mobEleAdjustments = xi.spells.damage.calculateSDT(target, spell:getElement()) - dmg = math.floor(dmg * mobEleAdjustments) + return dmg + end - -- Modifiers - dmg = math.floor(dmg * (1 + caster:getMod(xi.mod.BREATH_DMG_DEALT) / 100)) + -- Final adjustments. + if dmg > 0 then + dmg = utils.clamp(dmg - target:getMod(xi.mod.PHALANX), 0, 99999) + dmg = utils.clamp(utils.oneforall(target, dmg), 0, 99999) + dmg = utils.clamp(utils.stoneskin(target, dmg), -99999, 99999) + dmg = utils.clamp(dmg, 0, target:getHP()) + dmg = target:checkDamageCap(dmg) + end - -- Resistance - local resistance = applyResistanceEffect(caster, target, spell, params) - dmg = math.floor(dmg * resistance) + target:takeSpellDamage(caster, spell, dmg, attackType, damageType) - -- Final damage - dmg = target:breathDmgTaken(dmg) + -- Handle TP + local tpHits = params.tphitslanded or 0 + local extraTPGained = xi.combat.tp.calculateTPGainOnMagicalDamage(dmg, caster, target) * math.max(tpHits - 1, 0) -- Calculate extra TP gained from multihits. takeSpellDamage accounts for one already. + target:addTP(extraTPGained) - results[1] = xi.spells.blue.applySpellDamage(caster, target, spell, dmg, params, nil) - results[2] = resistance + -- Handle Afflatus Misery. + target:handleAfflatusMiseryDamage(finalDamage) - return results + -- Handle Enmity. + target:updateEnmityFromDamage(caster, finalDamage) + + return dmg end -- Apply spell damage @@ -627,6 +681,34 @@ xi.spells.blue.useMagicalSpellAddedEffect = function(caster, target, spell, para end end +xi.spells.blue.applyBlueAdditionalEffect = function(caster, target, params, effectTable) + -- Sanitize parameters. + local element = params.damageType and params.damageType - 5 or 0 + local stat = params.attribute and params.attribute or xi.mod.NONE + + -- Calculate resist and early return. + local resist = xi.combat.magicHitRate.calculateResistRate(caster, target, 0, xi.skill.BLUE_MAGIC, 0, element, stat, 0, 0) + + if resist <= 0.25 then + return + end + + for entry = 1, #effectTable do + local effect = effectTable[entry][1] + local power = effectTable[entry][2] + local tick = effectTable[entry][3] + local duration = effectTable[entry][4] + + if + not xi.combat.statusEffect.isTargetImmune(target, effect, element) and -- Target isn't immune. + not xi.combat.statusEffect.isTargetResistant(caster, target, effect) and -- Target didn't trigger a job trait resistance. + not xi.combat.statusEffect.isEffectNullified(target, effect) -- Target doesn't have an status effect that nullifies current. + then + target:addStatusEffect(effect, power, tick, math.floor(duration * resist)) + end + end +end + --[[ +-------+ | NOTES | From a9b6faf7c2d1579178cc939da23443417e118e33 Mon Sep 17 00:00:00 2001 From: Xaver-DaRed Date: Tue, 22 Apr 2025 22:34:01 +0200 Subject: [PATCH 3/4] Audit magical blue spells status effects --- scripts/actions/spells/blue/blastbomb.lua | 45 +++++++++------- scripts/actions/spells/blue/blitzstrahl.lua | 45 +++++++++------- scripts/actions/spells/blue/ice_break.lua | 45 +++++++++------- scripts/actions/spells/blue/maelstrom.lua | 45 +++++++++------- scripts/actions/spells/blue/mind_blast.lua | 51 +++++++++++-------- .../actions/spells/blue/mysterious_light.lua | 49 ++++++++++-------- scripts/actions/spells/blue/regurgitation.lua | 48 +++++++++-------- scripts/actions/spells/blue/sandspin.lua | 49 ++++++++++-------- scripts/globals/bluemagic.lua | 13 ----- 9 files changed, 216 insertions(+), 174 deletions(-) diff --git a/scripts/actions/spells/blue/blastbomb.lua b/scripts/actions/spells/blue/blastbomb.lua index d731b92805f..a05c2e32e4a 100644 --- a/scripts/actions/spells/blue/blastbomb.lua +++ b/scripts/actions/spells/blue/blastbomb.lua @@ -21,28 +21,35 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.BEASTMEN - params.attackType = xi.attackType.MAGICAL - params.damageType = xi.damageType.FIRE - params.attribute = xi.mod.INT - params.multiplier = 1.375 + params.ecosystem = xi.ecosystem.BEASTMEN + params.attackType = xi.attackType.MAGICAL + params.damageType = xi.damageType.FIRE + params.attribute = xi.mod.INT + params.multiplier = 1.375 params.tMultiplier = 1.0 - params.duppercap = 30 - params.str_wsc = 0.0 - params.dex_wsc = 0.0 - params.vit_wsc = 0.0 - params.agi_wsc = 0.0 - params.int_wsc = 0.2 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.0 - - params.addedEffect = xi.effect.BIND - local power = 1 - local tick = 0 - local duration = 30 + params.duppercap = 30 + params.str_wsc = 0.0 + params.dex_wsc = 0.0 + params.vit_wsc = 0.0 + params.agi_wsc = 0.0 + params.int_wsc = 0.2 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.useMagicalSpell(caster, target, spell, params) - xi.spells.blue.useMagicalSpellAddedEffect(caster, target, spell, params, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.BIND, 1, 0, 30 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/blitzstrahl.lua b/scripts/actions/spells/blue/blitzstrahl.lua index a9c41cd617c..068a37b23ac 100644 --- a/scripts/actions/spells/blue/blitzstrahl.lua +++ b/scripts/actions/spells/blue/blitzstrahl.lua @@ -21,28 +21,35 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.ARCANA - params.attackType = xi.damageType.ELEMENTAL - params.damageType = xi.damageType.THUNDER - params.attribute = xi.mod.INT - params.multiplier = 1.5625 + params.ecosystem = xi.ecosystem.ARCANA + params.attackType = xi.damageType.ELEMENTAL + params.damageType = xi.damageType.THUNDER + params.attribute = xi.mod.INT + params.multiplier = 1.5625 params.tMultiplier = 1.0 - params.duppercap = 61 - params.str_wsc = 0.0 - params.dex_wsc = 0.0 - params.vit_wsc = 0.0 - params.agi_wsc = 0.0 - params.int_wsc = 0.3 - params.mnd_wsc = 0.1 - params.chr_wsc = 0.0 - - params.addedEffect = xi.effect.STUN - local power = 1 - local tick = 0 - local duration = 5 + params.duppercap = 61 + params.str_wsc = 0.0 + params.dex_wsc = 0.0 + params.vit_wsc = 0.0 + params.agi_wsc = 0.0 + params.int_wsc = 0.3 + params.mnd_wsc = 0.1 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.useMagicalSpell(caster, target, spell, params) - xi.spells.blue.useMagicalSpellAddedEffect(caster, target, spell, params, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.STUN, 1, 0, 5 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/ice_break.lua b/scripts/actions/spells/blue/ice_break.lua index 5beb61b0ac4..583a97e0c83 100644 --- a/scripts/actions/spells/blue/ice_break.lua +++ b/scripts/actions/spells/blue/ice_break.lua @@ -21,28 +21,35 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.ARCANA - params.attackType = xi.attackType.MAGICAL - params.damageType = xi.damageType.ICE - params.attribute = xi.mod.INT - params.multiplier = 2.25 + params.ecosystem = xi.ecosystem.ARCANA + params.attackType = xi.attackType.MAGICAL + params.damageType = xi.damageType.ICE + params.attribute = xi.mod.INT + params.multiplier = 2.25 params.tMultiplier = 1.0 - params.duppercap = 69 - params.str_wsc = 0.0 - params.dex_wsc = 0.0 - params.vit_wsc = 0.0 - params.agi_wsc = 0.0 - params.int_wsc = 0.3 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.0 - - params.addedEffect = xi.effect.BIND - local power = 1 - local tick = 0 - local duration = 30 + params.duppercap = 69 + params.str_wsc = 0.0 + params.dex_wsc = 0.0 + params.vit_wsc = 0.0 + params.agi_wsc = 0.0 + params.int_wsc = 0.3 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.useMagicalSpell(caster, target, spell, params) - xi.spells.blue.useMagicalSpellAddedEffect(caster, target, spell, params, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.BIND, 1, 0, 30 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/maelstrom.lua b/scripts/actions/spells/blue/maelstrom.lua index d692f07f4ef..37b3339e094 100644 --- a/scripts/actions/spells/blue/maelstrom.lua +++ b/scripts/actions/spells/blue/maelstrom.lua @@ -21,28 +21,35 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.AQUAN - params.attackType = xi.attackType.MAGICAL - params.damageType = xi.damageType.WATER - params.attribute = xi.mod.INT - params.multiplier = 2.375 + params.ecosystem = xi.ecosystem.AQUAN + params.attackType = xi.attackType.MAGICAL + params.damageType = xi.damageType.WATER + params.attribute = xi.mod.INT + params.multiplier = 2.375 params.tMultiplier = 1.5 - params.duppercap = 69 - params.str_wsc = 0.0 - params.dex_wsc = 0.0 - params.vit_wsc = 0.0 - params.agi_wsc = 0.0 - params.int_wsc = 0.3 - params.mnd_wsc = 0.1 - params.chr_wsc = 0.0 - - params.addedEffect = xi.effect.STR_DOWN - local power = 20 - local tick = 0 - local duration = 60 + params.duppercap = 69 + params.str_wsc = 0.0 + params.dex_wsc = 0.0 + params.vit_wsc = 0.0 + params.agi_wsc = 0.0 + params.int_wsc = 0.3 + params.mnd_wsc = 0.1 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.useMagicalSpell(caster, target, spell, params) - xi.spells.blue.useMagicalSpellAddedEffect(caster, target, spell, params, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.STR_DOWN, 20, 0, 60 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/mind_blast.lua b/scripts/actions/spells/blue/mind_blast.lua index 7d68c7e4d99..0a8c34f465b 100644 --- a/scripts/actions/spells/blue/mind_blast.lua +++ b/scripts/actions/spells/blue/mind_blast.lua @@ -21,29 +21,36 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.DEMON - params.attackType = xi.attackType.MAGICAL - params.damageType = xi.damageType.THUNDER - params.attribute = xi.mod.MND - params.multiplier = 2.08 - params.azureBonus = 0.5 + params.ecosystem = xi.ecosystem.DEMON + params.attackType = xi.attackType.MAGICAL + params.damageType = xi.damageType.THUNDER + params.attribute = xi.mod.MND + params.multiplier = 2.08 + params.azureBonus = 0.5 params.tMultiplier = 1.5 - params.duppercap = 69 - params.str_wsc = 0.0 - params.dex_wsc = 0.0 - params.vit_wsc = 0.0 - params.agi_wsc = 0.0 - params.int_wsc = 0.0 - params.mnd_wsc = 0.3 - params.chr_wsc = 0.0 - - params.addedEffect = xi.effect.PARALYSIS - local power = 20 - local tick = 0 - local duration = 90 - - local damage = xi.spells.blue.useMagicalSpell(caster, target, spell, params) - xi.spells.blue.useMagicalSpellAddedEffect(caster, target, spell, params, power, tick, duration) + params.duppercap = 69 + params.str_wsc = 0.0 + params.dex_wsc = 0.0 + params.vit_wsc = 0.0 + params.agi_wsc = 0.0 + params.int_wsc = 0.0 + params.mnd_wsc = 0.3 + params.chr_wsc = 0.0 + + -- Handle damage. + local damage = xi.spells.blue.useBreathSpell(caster, target, spell, params) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.PARALYSIS, 20, 0, 90 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/mysterious_light.lua b/scripts/actions/spells/blue/mysterious_light.lua index 09abaf536ca..47592c6a265 100644 --- a/scripts/actions/spells/blue/mysterious_light.lua +++ b/scripts/actions/spells/blue/mysterious_light.lua @@ -21,28 +21,35 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.ARCANA - params.attackType = xi.attackType.MAGICAL - params.damageType = xi.damageType.WIND - params.attribute = xi.mod.CHR - params.multiplier = 2.0 + params.ecosystem = xi.ecosystem.ARCANA + params.attackType = xi.attackType.MAGICAL + params.damageType = xi.damageType.WIND + params.attribute = xi.mod.CHR + params.multiplier = 2.0 params.tMultiplier = 1.0 - params.duppercap = 56 - params.str_wsc = 0.0 - params.dex_wsc = 0.0 - params.vit_wsc = 0.0 - params.agi_wsc = 0.0 - params.int_wsc = 0.0 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.3 - - params.addedEffect = xi.effect.WEIGHT - local power = 25 - local tick = 0 - local duration = 60 - - local damage = xi.spells.blue.useMagicalSpell(caster, target, spell, params) - xi.spells.blue.useMagicalSpellAddedEffect(caster, target, spell, params, power, tick, duration) + params.duppercap = 56 + params.str_wsc = 0.0 + params.dex_wsc = 0.0 + params.vit_wsc = 0.0 + params.agi_wsc = 0.0 + params.int_wsc = 0.0 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.3 + + -- Handle damage. + local damage = xi.spells.blue.useBreathSpell(caster, target, spell, params) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.WEIGHT, 25, 0, 60 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/regurgitation.lua b/scripts/actions/spells/blue/regurgitation.lua index 229ea87b377..90bb632deba 100644 --- a/scripts/actions/spells/blue/regurgitation.lua +++ b/scripts/actions/spells/blue/regurgitation.lua @@ -21,32 +21,38 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.LIZARD - params.attackType = xi.attackType.MAGICAL - params.damageType = xi.damageType.WATER - params.attribute = xi.mod.INT - params.multiplier = 1.83 + params.ecosystem = xi.ecosystem.LIZARD + params.attackType = xi.attackType.MAGICAL + params.damageType = xi.damageType.WATER + params.attribute = xi.mod.INT + params.multiplier = 1.83 params.tMultiplier = 2.0 - params.duppercap = 69 - params.str_wsc = 0.0 - params.dex_wsc = 0.0 - params.vit_wsc = 0.0 - params.agi_wsc = 0.0 - params.int_wsc = 0.0 - params.mnd_wsc = 0.3 - params.chr_wsc = 0.0 - - params.addedEffect = xi.effect.BIND - local power = 1 - local tick = 0 - local duration = 30 - - local damage = xi.spells.blue.useMagicalSpell(caster, target, spell, params) + params.duppercap = 69 + params.str_wsc = 0.0 + params.dex_wsc = 0.0 + params.vit_wsc = 0.0 + params.agi_wsc = 0.0 + params.int_wsc = 0.0 + params.mnd_wsc = 0.3 + params.chr_wsc = 0.0 + + -- Handle damage. + local damage = xi.spells.blue.useBreathSpell(caster, target, spell, params) if caster:isBehind(target) then damage = math.floor(damage * 1.25) end - xi.spells.blue.useMagicalSpellAddedEffect(caster, target, spell, params, power, tick, duration) + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.BIND, 1, 0, 30 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/sandspin.lua b/scripts/actions/spells/blue/sandspin.lua index 4d28ecf700e..5a715160066 100644 --- a/scripts/actions/spells/blue/sandspin.lua +++ b/scripts/actions/spells/blue/sandspin.lua @@ -21,28 +21,35 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.AMORPH - params.attackType = xi.attackType.MAGICAL - params.damageType = xi.damageType.EARTH - params.attribute = xi.mod.INT - params.multiplier = 1.0 + params.ecosystem = xi.ecosystem.AMORPH + params.attackType = xi.attackType.MAGICAL + params.damageType = xi.damageType.EARTH + params.attribute = xi.mod.INT + params.multiplier = 1.0 params.tMultiplier = 1.0 - params.duppercap = 13 - params.str_wsc = 0.0 - params.dex_wsc = 0.0 - params.vit_wsc = 0.0 - params.agi_wsc = 0.0 - params.int_wsc = 0.2 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.0 - - params.addedEffect = xi.effect.ACCURACY_DOWN - local power = 25 - local tick = 0 - local duration = 60 - - local damage = xi.spells.blue.useMagicalSpell(caster, target, spell, params) - xi.spells.blue.useMagicalSpellAddedEffect(caster, target, spell, params, power, tick, duration) + params.duppercap = 13 + params.str_wsc = 0.0 + params.dex_wsc = 0.0 + params.vit_wsc = 0.0 + params.agi_wsc = 0.0 + params.int_wsc = 0.2 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.0 + + -- Handle damage. + local damage = xi.spells.blue.useBreathSpell(caster, target, spell, params) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.ACCURACY_DOWN, 25, 0, 60 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/globals/bluemagic.lua b/scripts/globals/bluemagic.lua index 4f19739d7de..2be7e6cc13e 100644 --- a/scripts/globals/bluemagic.lua +++ b/scripts/globals/bluemagic.lua @@ -668,19 +668,6 @@ xi.spells.blue.usePhysicalSpellAddedEffect = function(caster, target, spell, par end end --- Inflict an added enfeebling effect (after a magical spell) -xi.spells.blue.useMagicalSpellAddedEffect = function(caster, target, spell, params, power, tick, duration) - -- Blue Magic skill + whichever attribute the spell uses will be used as resistance modifiers - params.diff = caster:getStat(params.attribute) - target:getStat(params.attribute) - params.skillType = xi.skill.BLUE_MAGIC - params.effect = params.addedEffect -- renamed to avoid magical spells' dmg resistance check being influenced by this - local resist = applyResistanceEffect(caster, target, spell, params) - - if resist >= 0.5 then - target:addStatusEffect(params.effect, power, tick, duration * resist) - end -end - xi.spells.blue.applyBlueAdditionalEffect = function(caster, target, params, effectTable) -- Sanitize parameters. local element = params.damageType and params.damageType - 5 or 0 From d1e42ceceda3f820d5a0299a0565e3010107fea5 Mon Sep 17 00:00:00 2001 From: Xaver-DaRed Date: Tue, 22 Apr 2025 23:37:47 +0200 Subject: [PATCH 4/4] Audit physical blue spells status effects --- scripts/actions/spells/blue/bad_breath.lua | 2 +- scripts/actions/spells/blue/battle_dance.lua | 49 +++++++++-------- scripts/actions/spells/blue/disseverment.lua | 46 +++++++++------- scripts/actions/spells/blue/feather_storm.lua | 45 +++++++++------- scripts/actions/spells/blue/frost_breath.lua | 2 +- scripts/actions/spells/blue/frypan.lua | 49 +++++++++-------- scripts/actions/spells/blue/head_butt.lua | 49 +++++++++-------- scripts/actions/spells/blue/heat_breath.lua | 2 +- scripts/actions/spells/blue/hecatomb_wave.lua | 2 +- .../actions/spells/blue/magnetite_cloud.lua | 2 +- scripts/actions/spells/blue/pinecone_bomb.lua | 50 +++++++++-------- scripts/actions/spells/blue/poison_breath.lua | 2 +- scripts/actions/spells/blue/queasyshroom.lua | 49 +++++++++-------- .../actions/spells/blue/radiant_breath.lua | 2 +- scripts/actions/spells/blue/seedspray.lua | 51 ++++++++++-------- scripts/actions/spells/blue/spiral_spin.lua | 49 +++++++++-------- scripts/actions/spells/blue/sprout_smack.lua | 49 +++++++++-------- .../actions/spells/blue/sub-zero_smash.lua | 53 ++++++++++--------- scripts/actions/spells/blue/sudden_lunge.lua | 53 +++++++++++-------- scripts/actions/spells/blue/tail_slap.lua | 53 +++++++++++-------- scripts/actions/spells/blue/terror_touch.lua | 51 ++++++++++-------- scripts/actions/spells/blue/wild_oats.lua | 49 +++++++++-------- scripts/globals/bluemagic.lua | 33 +++++------- 23 files changed, 443 insertions(+), 349 deletions(-) diff --git a/scripts/actions/spells/blue/bad_breath.lua b/scripts/actions/spells/blue/bad_breath.lua index e4413c685e9..fcf1fb866b2 100644 --- a/scripts/actions/spells/blue/bad_breath.lua +++ b/scripts/actions/spells/blue/bad_breath.lua @@ -28,7 +28,7 @@ spellObject.onSpellCast = function(caster, target, spell) params.skillType = xi.skill.BLUE_MAGIC params.hpMod = 8 params.lvlMod = 3 - parmas.isConal = true + params.isConal = true -- Handle damage. local damage = xi.spells.blue.useBreathSpell(caster, target, spell, params) diff --git a/scripts/actions/spells/blue/battle_dance.lua b/scripts/actions/spells/blue/battle_dance.lua index 48e9989e1e7..9bb67f352c4 100644 --- a/scripts/actions/spells/blue/battle_dance.lua +++ b/scripts/actions/spells/blue/battle_dance.lua @@ -21,32 +21,39 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.BEASTMEN - params.tpmod = xi.spells.blue.tpMod.DURATION + params.ecosystem = xi.ecosystem.BEASTMEN + params.tpmod = xi.spells.blue.tpMod.DURATION params.attackType = xi.attackType.PHYSICAL params.damageType = xi.damageType.SLASHING - params.scattr = xi.skillchainType.IMPACTION - params.numhits = 1 + params.scattr = xi.skillchainType.IMPACTION + params.numhits = 1 params.multiplier = 2.0 - params.tp150 = 2.0 - params.tp300 = 2.0 - params.azuretp = 2.0 - params.duppercap = 17 - params.str_wsc = 0.3 - params.dex_wsc = 0.0 - params.vit_wsc = 0.0 - params.agi_wsc = 0.0 - params.int_wsc = 0.0 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.0 - - params.effect = xi.effect.DEX_DOWN - local power = 9 - local tick = 6 - local duration = 60 + params.tp150 = 2.0 + params.tp300 = 2.0 + params.azuretp = 2.0 + params.duppercap = 17 + params.str_wsc = 0.3 + params.dex_wsc = 0.0 + params.vit_wsc = 0.0 + params.agi_wsc = 0.0 + params.int_wsc = 0.0 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.usePhysicalSpell(caster, target, spell, params) - xi.spells.blue.usePhysicalSpellAddedEffect(caster, target, spell, params, damage, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.DEX_DOWN, 9, 6, 60 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/disseverment.lua b/scripts/actions/spells/blue/disseverment.lua index 918dab007b4..996c3d8974c 100644 --- a/scripts/actions/spells/blue/disseverment.lua +++ b/scripts/actions/spells/blue/disseverment.lua @@ -32,28 +32,36 @@ spellObject.onSpellCast = function(caster, target, spell) params.attackType = xi.attackType.PHYSICAL params.damageType = xi.damageType.PIERCING - params.scattr = xi.skillchainType.DISTORTION - params.numhits = 5 + params.scattr = xi.skillchainType.DISTORTION + params.numhits = 5 params.multiplier = 1.5 - params.tp150 = 1.5 - params.tp300 = 1.5 - params.azuretp = 1.5 - params.duppercap = 100 - params.str_wsc = 0.2 - params.dex_wsc = 0.2 - params.vit_wsc = 0.0 - params.agi_wsc = 0.0 - params.int_wsc = 0.0 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.0 - - params.effect = xi.effect.POISON - local power = (caster:getMainLvl() / 5) + 3 - local tick = 0 - local duration = 180 + params.tp150 = 1.5 + params.tp300 = 1.5 + params.azuretp = 1.5 + params.duppercap = 100 + params.str_wsc = 0.2 + params.dex_wsc = 0.2 + params.vit_wsc = 0.0 + params.agi_wsc = 0.0 + params.int_wsc = 0.0 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.usePhysicalSpell(caster, target, spell, params) - xi.spells.blue.usePhysicalSpellAddedEffect(caster, target, spell, params, damage, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local power = 3 + caster:getMainLvl() / 5 + local effectTable = + { + [1] = { xi.effect.POISON, power, 3, 180 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/feather_storm.lua b/scripts/actions/spells/blue/feather_storm.lua index f6747ab904e..7dea80ad9b8 100644 --- a/scripts/actions/spells/blue/feather_storm.lua +++ b/scripts/actions/spells/blue/feather_storm.lua @@ -32,28 +32,35 @@ spellObject.onSpellCast = function(caster, target, spell) params.attackType = xi.attackType.RANGED params.damageType = xi.damageType.PIERCING - params.scattr = xi.skillchainType.TRANSFIXION - params.numhits = 1 + params.scattr = xi.skillchainType.TRANSFIXION + params.numhits = 1 params.multiplier = 2 - params.tp150 = 2 - params.tp300 = 2 - params.azuretp = 2 - params.duppercap = 17 - params.str_wsc = 0.0 - params.dex_wsc = 0.0 - params.vit_wsc = 0.0 - params.agi_wsc = 0.3 - params.int_wsc = 0.0 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.0 - - params.effect = xi.effect.POISON - local power = 1 - local tick = 0 - local duration = 180 + params.tp150 = 2 + params.tp300 = 2 + params.azuretp = 2 + params.duppercap = 17 + params.str_wsc = 0.0 + params.dex_wsc = 0.0 + params.vit_wsc = 0.0 + params.agi_wsc = 0.3 + params.int_wsc = 0.0 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.usePhysicalSpell(caster, target, spell, params) - xi.spells.blue.usePhysicalSpellAddedEffect(caster, target, spell, params, damage, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.POISON, 1, 3, 180 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/frost_breath.lua b/scripts/actions/spells/blue/frost_breath.lua index 7a6a632a987..acf235592a3 100644 --- a/scripts/actions/spells/blue/frost_breath.lua +++ b/scripts/actions/spells/blue/frost_breath.lua @@ -28,7 +28,7 @@ spellObject.onSpellCast = function(caster, target, spell) params.skillType = xi.skill.BLUE_MAGIC params.hpMod = 3 params.lvlMod = 0.625 - parmas.isConal = true + params.isConal = true -- Handle damage. local damage = xi.spells.blue.useBreathSpell(caster, target, spell, params) diff --git a/scripts/actions/spells/blue/frypan.lua b/scripts/actions/spells/blue/frypan.lua index 838e4f324c2..873ed0288bc 100644 --- a/scripts/actions/spells/blue/frypan.lua +++ b/scripts/actions/spells/blue/frypan.lua @@ -22,8 +22,8 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} params.ecosystem = xi.ecosystem.BEASTMEN - params.tpmod = xi.spells.blue.tpMod.ACC - params.bonusacc = 0 + params.tpmod = xi.spells.blue.tpMod.ACC + params.bonusacc = 0 if caster:hasStatusEffect(xi.effect.AZURE_LORE) then params.bonusacc = 70 elseif caster:hasStatusEffect(xi.effect.CHAIN_AFFINITY) then @@ -32,28 +32,35 @@ spellObject.onSpellCast = function(caster, target, spell) params.attackType = xi.attackType.PHYSICAL params.damageType = xi.damageType.BLUNT - params.scattr = xi.skillchainType.IMPACTION - params.numhits = 1 + params.scattr = xi.skillchainType.IMPACTION + params.numhits = 1 params.multiplier = 1.78 - params.tp150 = 1.78 - params.tp300 = 1.78 - params.azuretp = 1.78 - params.duppercap = 75 - params.str_wsc = 0.2 - params.dex_wsc = 0.0 - params.vit_wsc = 0.0 - params.agi_wsc = 0.0 - params.int_wsc = 0.0 - params.mnd_wsc = 0.2 - params.chr_wsc = 0.0 - - params.effect = xi.effect.STUN - local power = 1 - local tick = 0 - local duration = 5 + params.tp150 = 1.78 + params.tp300 = 1.78 + params.azuretp = 1.78 + params.duppercap = 75 + params.str_wsc = 0.2 + params.dex_wsc = 0.0 + params.vit_wsc = 0.0 + params.agi_wsc = 0.0 + params.int_wsc = 0.0 + params.mnd_wsc = 0.2 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.usePhysicalSpell(caster, target, spell, params) - xi.spells.blue.usePhysicalSpellAddedEffect(caster, target, spell, params, damage, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.STUN, 1, 0, 5 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/head_butt.lua b/scripts/actions/spells/blue/head_butt.lua index 163d351a097..487bb9307b7 100644 --- a/scripts/actions/spells/blue/head_butt.lua +++ b/scripts/actions/spells/blue/head_butt.lua @@ -21,32 +21,39 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.BEASTMEN - params.tpmod = xi.spells.blue.tpMod.DAMAGE + params.ecosystem = xi.ecosystem.BEASTMEN + params.tpmod = xi.spells.blue.tpMod.DAMAGE params.attackType = xi.attackType.PHYSICAL params.damageType = xi.damageType.BLUNT - params.scattr = xi.skillchainType.IMPACTION - params.numhits = 1 + params.scattr = xi.skillchainType.IMPACTION + params.numhits = 1 params.multiplier = 1.75 - params.tp150 = 2.125 - params.tp300 = 2.25 - params.azuretp = 2.375 - params.duppercap = 17 - params.str_wsc = 0.2 - params.dex_wsc = 0.0 - params.vit_wsc = 0.0 - params.agi_wsc = 0.0 - params.int_wsc = 0.2 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.0 - - params.effect = xi.effect.STUN - local power = 1 - local tick = 0 - local duration = 5 + params.tp150 = 2.125 + params.tp300 = 2.25 + params.azuretp = 2.375 + params.duppercap = 17 + params.str_wsc = 0.2 + params.dex_wsc = 0.0 + params.vit_wsc = 0.0 + params.agi_wsc = 0.0 + params.int_wsc = 0.2 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.usePhysicalSpell(caster, target, spell, params) - xi.spells.blue.usePhysicalSpellAddedEffect(caster, target, spell, params, damage, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.STUN, 1, 0, 5 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/heat_breath.lua b/scripts/actions/spells/blue/heat_breath.lua index 61304ac4393..f32d4ef3328 100644 --- a/scripts/actions/spells/blue/heat_breath.lua +++ b/scripts/actions/spells/blue/heat_breath.lua @@ -28,7 +28,7 @@ spellObject.onSpellCast = function(caster, target, spell) params.skillType = xi.skill.BLUE_MAGIC params.hpMod = 2 params.lvlMod = 0 - parmas.isConal = true + params.isConal = true return xi.spells.blue.useBreathSpell(caster, target, spell, params) end diff --git a/scripts/actions/spells/blue/hecatomb_wave.lua b/scripts/actions/spells/blue/hecatomb_wave.lua index dabccb2f3fc..3451e12d628 100644 --- a/scripts/actions/spells/blue/hecatomb_wave.lua +++ b/scripts/actions/spells/blue/hecatomb_wave.lua @@ -28,7 +28,7 @@ spellObject.onSpellCast = function(caster, target, spell) params.skillType = xi.skill.BLUE_MAGIC params.hpMod = 4 params.lvlMod = 1.5 - parmas.isConal = true + params.isConal = true -- Handle damage. local damage = xi.spells.blue.useBreathSpell(caster, target, spell, params) diff --git a/scripts/actions/spells/blue/magnetite_cloud.lua b/scripts/actions/spells/blue/magnetite_cloud.lua index e7a869f474d..8bcd795c2e2 100644 --- a/scripts/actions/spells/blue/magnetite_cloud.lua +++ b/scripts/actions/spells/blue/magnetite_cloud.lua @@ -28,7 +28,7 @@ spellObject.onSpellCast = function(caster, target, spell) params.skillType = xi.skill.BLUE_MAGIC params.hpMod = 6 params.lvlMod = 1.875 - parmas.isConal = true + params.isConal = true -- Handle damage. local damage = xi.spells.blue.useBreathSpell(caster, target, spell, params) diff --git a/scripts/actions/spells/blue/pinecone_bomb.lua b/scripts/actions/spells/blue/pinecone_bomb.lua index 90ec4c8f18e..ce3fe709b62 100644 --- a/scripts/actions/spells/blue/pinecone_bomb.lua +++ b/scripts/actions/spells/blue/pinecone_bomb.lua @@ -21,33 +21,39 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.PLANTOID - params.tpmod = xi.spells.blue.tpMod.DURATION + params.ecosystem = xi.ecosystem.PLANTOID + params.tpmod = xi.spells.blue.tpMod.DURATION params.attackType = xi.attackType.RANGED params.damageType = xi.damageType.PIERCING - params.scattr = xi.skillchainType.LIQUEFACTION - - params.numhits = 1 + params.scattr = xi.skillchainType.LIQUEFACTION + params.numhits = 1 params.multiplier = 2.25 - params.tp150 = 2.25 - params.tp300 = 2.25 - params.azuretp = 2.25 - params.duppercap = 37 - params.str_wsc = 0.2 - params.dex_wsc = 0.0 - params.vit_wsc = 0.0 - params.agi_wsc = 0.2 - params.int_wsc = 0.0 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.0 - - params.effect = xi.effect.SLEEP_I - local power = 1 - local tick = 0 - local duration = 60 + params.tp150 = 2.25 + params.tp300 = 2.25 + params.azuretp = 2.25 + params.duppercap = 37 + params.str_wsc = 0.2 + params.dex_wsc = 0.0 + params.vit_wsc = 0.0 + params.agi_wsc = 0.2 + params.int_wsc = 0.0 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.usePhysicalSpell(caster, target, spell, params) - xi.spells.blue.usePhysicalSpellAddedEffect(caster, target, spell, params, damage, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.SLEEP_I, 1, 0, 60 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/poison_breath.lua b/scripts/actions/spells/blue/poison_breath.lua index ac244a4db8e..38f45edd4af 100644 --- a/scripts/actions/spells/blue/poison_breath.lua +++ b/scripts/actions/spells/blue/poison_breath.lua @@ -28,7 +28,7 @@ spellObject.onSpellCast = function(caster, target, spell) params.skillType = xi.skill.BLUE_MAGIC params.hpMod = 10 params.lvlMod = 1.25 - parmas.isConal = true + params.isConal = true -- Handle damage. local damage = xi.spells.blue.useBreathSpell(caster, target, spell, params) diff --git a/scripts/actions/spells/blue/queasyshroom.lua b/scripts/actions/spells/blue/queasyshroom.lua index d401304cc18..2b711e733af 100644 --- a/scripts/actions/spells/blue/queasyshroom.lua +++ b/scripts/actions/spells/blue/queasyshroom.lua @@ -21,32 +21,39 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.PLANTOID - params.tpmod = xi.spells.blue.tpMod.DURATION + params.ecosystem = xi.ecosystem.PLANTOID + params.tpmod = xi.spells.blue.tpMod.DURATION params.attackType = xi.attackType.RANGED params.damageType = xi.damageType.PIERCING - params.scattr = xi.skillchainType.COMPRESSION - params.numhits = 1 + params.scattr = xi.skillchainType.COMPRESSION + params.numhits = 1 params.multiplier = 1.75 - params.tp150 = 1.75 - params.tp300 = 1.75 - params.azuretp = 1.75 - params.duppercap = 15 - params.str_wsc = 0.0 - params.dex_wsc = 0.0 - params.vit_wsc = 0.0 - params.agi_wsc = 0.0 - params.int_wsc = 0.2 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.0 - - params.effect = xi.effect.POISON - local power = 3 - local tick = 0 - local duration = 180 + params.tp150 = 1.75 + params.tp300 = 1.75 + params.azuretp = 1.75 + params.duppercap = 15 + params.str_wsc = 0.0 + params.dex_wsc = 0.0 + params.vit_wsc = 0.0 + params.agi_wsc = 0.0 + params.int_wsc = 0.2 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.usePhysicalSpell(caster, target, spell, params) - xi.spells.blue.usePhysicalSpellAddedEffect(caster, target, spell, params, damage, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.POISON, 3, 3, 180 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/radiant_breath.lua b/scripts/actions/spells/blue/radiant_breath.lua index 4c567c28f5d..c6b22442db1 100644 --- a/scripts/actions/spells/blue/radiant_breath.lua +++ b/scripts/actions/spells/blue/radiant_breath.lua @@ -28,7 +28,7 @@ spellObject.onSpellCast = function(caster, target, spell) params.skillType = xi.skill.BLUE_MAGIC params.hpMod = 5 params.lvlMod = 0.75 - parmas.isConal = true + params.isConal = true -- Handle damage. local damage = xi.spells.blue.useBreathSpell(caster, target, spell, params) diff --git a/scripts/actions/spells/blue/seedspray.lua b/scripts/actions/spells/blue/seedspray.lua index c7008e157e0..e0a74c7298c 100644 --- a/scripts/actions/spells/blue/seedspray.lua +++ b/scripts/actions/spells/blue/seedspray.lua @@ -21,33 +21,40 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.PLANTOID - params.tpmod = xi.spells.blue.tpMod.DURATION + params.ecosystem = xi.ecosystem.PLANTOID + params.tpmod = xi.spells.blue.tpMod.DURATION params.attackType = xi.attackType.PHYSICAL params.damageType = xi.damageType.SLASHING - params.scattr = xi.skillchainType.INDURATION - params.scattr2 = xi.skillchainType.DETONATION - params.numhits = 3 + params.scattr = xi.skillchainType.INDURATION + params.scattr2 = xi.skillchainType.DETONATION + params.numhits = 3 params.multiplier = 0.875 - params.tp150 = 0.875 - params.tp300 = 0.875 - params.azuretp = 0.875 - params.duppercap = 69 - params.str_wsc = 0.0 - params.dex_wsc = 0.3 - params.vit_wsc = 0.0 - params.agi_wsc = 0.0 - params.int_wsc = 0.0 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.0 - - params.effect = xi.effect.DEFENSE_DOWN - local power = 8 - local tick = 0 - local duration = 120 + params.tp150 = 0.875 + params.tp300 = 0.875 + params.azuretp = 0.875 + params.duppercap = 69 + params.str_wsc = 0.0 + params.dex_wsc = 0.3 + params.vit_wsc = 0.0 + params.agi_wsc = 0.0 + params.int_wsc = 0.0 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.usePhysicalSpell(caster, target, spell, params) - xi.spells.blue.usePhysicalSpellAddedEffect(caster, target, spell, params, damage, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.DEFENSE_DOWN, 8, 0, 120 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/spiral_spin.lua b/scripts/actions/spells/blue/spiral_spin.lua index 84306dcd041..fbd2573646f 100644 --- a/scripts/actions/spells/blue/spiral_spin.lua +++ b/scripts/actions/spells/blue/spiral_spin.lua @@ -21,32 +21,39 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.VERMIN - params.tpmod = xi.spells.blue.tpMod.DURATION + params.ecosystem = xi.ecosystem.VERMIN + params.tpmod = xi.spells.blue.tpMod.DURATION params.attackType = xi.attackType.PHYSICAL params.damageType = xi.damageType.SLASHING - params.scattr = xi.skillchainType.TRANSFIXION - params.numhits = 1 + params.scattr = xi.skillchainType.TRANSFIXION + params.numhits = 1 params.multiplier = 2.0 - params.tp150 = 2.0 - params.tp300 = 2.0 - params.azuretp = 2.0 - params.duppercap = 69 - params.str_wsc = 0.0 - params.dex_wsc = 0.0 - params.vit_wsc = 0.0 - params.agi_wsc = 0.3 - params.int_wsc = 0.0 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.0 - - params.effect = xi.effect.ACCURACY_DOWN - local power = 15 - local tick = 0 - local duration = 60 + params.tp150 = 2.0 + params.tp300 = 2.0 + params.azuretp = 2.0 + params.duppercap = 69 + params.str_wsc = 0.0 + params.dex_wsc = 0.0 + params.vit_wsc = 0.0 + params.agi_wsc = 0.3 + params.int_wsc = 0.0 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.usePhysicalSpell(caster, target, spell, params) - xi.spells.blue.usePhysicalSpellAddedEffect(caster, target, spell, params, damage, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.ACCURACY_DOWN, 15, 0, 60 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/sprout_smack.lua b/scripts/actions/spells/blue/sprout_smack.lua index 7177bc684df..74ab02fffaf 100644 --- a/scripts/actions/spells/blue/sprout_smack.lua +++ b/scripts/actions/spells/blue/sprout_smack.lua @@ -21,32 +21,39 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.PLANTOID - params.tpmod = xi.spells.blue.tpMod.DURATION + params.ecosystem = xi.ecosystem.PLANTOID + params.tpmod = xi.spells.blue.tpMod.DURATION params.attackType = xi.attackType.PHYSICAL params.damageType = xi.damageType.BLUNT - params.scattr = xi.skillchainType.REVERBERATION - params.numhits = 1 + params.scattr = xi.skillchainType.REVERBERATION + params.numhits = 1 params.multiplier = 1.5 - params.tp150 = 1.5 - params.tp300 = 1.5 - params.azuretp = 1.5 - params.duppercap = 11 - params.str_wsc = 0.0 - params.dex_wsc = 0.0 - params.vit_wsc = 0.3 - params.agi_wsc = 0.0 - params.int_wsc = 0.0 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.0 - - params.effect = xi.effect.SLOW - local power = 1500 - local tick = 0 - local duration = 180 + params.tp150 = 1.5 + params.tp300 = 1.5 + params.azuretp = 1.5 + params.duppercap = 11 + params.str_wsc = 0.0 + params.dex_wsc = 0.0 + params.vit_wsc = 0.3 + params.agi_wsc = 0.0 + params.int_wsc = 0.0 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.usePhysicalSpell(caster, target, spell, params) - xi.spells.blue.usePhysicalSpellAddedEffect(caster, target, spell, params, damage, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.SLOW, 1500, 0, 180 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/sub-zero_smash.lua b/scripts/actions/spells/blue/sub-zero_smash.lua index 25506512b2a..bcbda3751be 100644 --- a/scripts/actions/spells/blue/sub-zero_smash.lua +++ b/scripts/actions/spells/blue/sub-zero_smash.lua @@ -21,37 +21,42 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.AQUAN - params.tpmod = xi.spells.blue.tpMod.DAMAGE + params.ecosystem = xi.ecosystem.AQUAN + params.tpmod = xi.spells.blue.tpMod.DAMAGE params.attackType = xi.attackType.PHYSICAL params.damageType = xi.damageType.BLUNT - params.scattr = xi.skillchainType.FRAGMENTATION - params.attribute = xi.mod.INT - params.skillType = xi.skill.BLUE_MAGIC - params.numhits = 1 + params.scattr = xi.skillchainType.FRAGMENTATION + params.attribute = xi.mod.INT + params.skillType = xi.skill.BLUE_MAGIC + params.numhits = 1 params.multiplier = 2.0 - params.tp150 = 2.0 - params.tp300 = 2.0 - params.azuretp = 2.0 - params.duppercap = 72 - params.str_wsc = 0.0 - params.dex_wsc = 0.0 - params.vit_wsc = 0.6 - params.agi_wsc = 0.0 - params.int_wsc = 0.0 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.0 - - params.effect = xi.effect.PARALYSIS - local power = 10 - local tick = 0 - local duration = 180 + params.tp150 = 2.0 + params.tp300 = 2.0 + params.azuretp = 2.0 + params.duppercap = 72 + params.str_wsc = 0.0 + params.dex_wsc = 0.0 + params.vit_wsc = 0.6 + params.agi_wsc = 0.0 + params.int_wsc = 0.0 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.usePhysicalSpell(caster, target, spell, params) - if damage > 0 then - xi.spells.blue.usePhysicalSpellAddedEffect(caster, target, spell, params, damage, power, tick, duration) + + if damage <= 0 then + return damage end + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.PARALYSIS, 10, 0, 180 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) + return damage end diff --git a/scripts/actions/spells/blue/sudden_lunge.lua b/scripts/actions/spells/blue/sudden_lunge.lua index e605c2198ec..0bf4661b8b1 100644 --- a/scripts/actions/spells/blue/sudden_lunge.lua +++ b/scripts/actions/spells/blue/sudden_lunge.lua @@ -21,34 +21,41 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.VERMIN - params.tpmod = xi.spells.blue.tpMod.DAMAGE + params.ecosystem = xi.ecosystem.VERMIN + params.tpmod = xi.spells.blue.tpMod.DAMAGE params.attackType = xi.attackType.PHYSICAL params.damageType = xi.damageType.SLASHING - params.scattr = xi.skillchainType.DETONATION - params.attribute = xi.mod.INT - params.skillType = xi.skill.BLUE_MAGIC - params.numhits = 1 + params.scattr = xi.skillchainType.DETONATION + params.attribute = xi.mod.INT + params.skillType = xi.skill.BLUE_MAGIC + params.numhits = 1 params.multiplier = 1.5 - params.tp150 = 2.5 - params.tp300 = 3 - params.azuretp = 3.5 - params.duppercap = 100 - params.str_wsc = 0.0 - params.dex_wsc = 0.0 - params.vit_wsc = 0.0 - params.agi_wsc = 0.4 - params.int_wsc = 0.0 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.0 - - params.effect = xi.effect.STUN - local power = 1 - local tick = 0 - local duration = 5 + params.tp150 = 2.5 + params.tp300 = 3 + params.azuretp = 3.5 + params.duppercap = 100 + params.str_wsc = 0.0 + params.dex_wsc = 0.0 + params.vit_wsc = 0.0 + params.agi_wsc = 0.4 + params.int_wsc = 0.0 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.usePhysicalSpell(caster, target, spell, params) - xi.spells.blue.usePhysicalSpellAddedEffect(caster, target, spell, params, damage, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.STUN, 1, 0, 5 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/tail_slap.lua b/scripts/actions/spells/blue/tail_slap.lua index 3521ed10a08..fcb5132f48b 100644 --- a/scripts/actions/spells/blue/tail_slap.lua +++ b/scripts/actions/spells/blue/tail_slap.lua @@ -21,34 +21,41 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.BEASTMEN - params.tpmod = xi.spells.blue.tpMod.ATTACK + params.ecosystem = xi.ecosystem.BEASTMEN + params.tpmod = xi.spells.blue.tpMod.ATTACK params.attackType = xi.attackType.PHYSICAL params.damageType = xi.damageType.HTH - params.scattr = xi.skillchainType.REVERBERATION - params.attribute = xi.mod.INT - params.skillType = xi.skill.BLUE_MAGIC - params.numhits = 1 + params.scattr = xi.skillchainType.REVERBERATION + params.attribute = xi.mod.INT + params.skillType = xi.skill.BLUE_MAGIC + params.numhits = 1 params.multiplier = 1.625 - params.tp150 = 1.625 - params.tp300 = 1.625 - params.azuretp = 1.625 - params.duppercap = 75 - params.str_wsc = 0.2 - params.dex_wsc = 0.0 - params.vit_wsc = 0.5 - params.agi_wsc = 0.0 - params.int_wsc = 0.0 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.0 - - params.effect = xi.effect.STUN - local power = 1 - local tick = 0 - local duration = 5 + params.tp150 = 1.625 + params.tp300 = 1.625 + params.azuretp = 1.625 + params.duppercap = 75 + params.str_wsc = 0.2 + params.dex_wsc = 0.0 + params.vit_wsc = 0.5 + params.agi_wsc = 0.0 + params.int_wsc = 0.0 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.usePhysicalSpell(caster, target, spell, params) - xi.spells.blue.usePhysicalSpellAddedEffect(caster, target, spell, params, damage, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.STUN, 1, 0, 5 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/terror_touch.lua b/scripts/actions/spells/blue/terror_touch.lua index e4f836d2ce7..713e1ba4ebc 100644 --- a/scripts/actions/spells/blue/terror_touch.lua +++ b/scripts/actions/spells/blue/terror_touch.lua @@ -23,8 +23,8 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} params.ecosystem = xi.ecosystem.UNDEAD - params.tpmod = xi.spells.blue.tpMod.ACC - params.bonusacc = 0 + params.tpmod = xi.spells.blue.tpMod.ACC + params.bonusacc = 0 if caster:hasStatusEffect(xi.effect.AZURE_LORE) then params.bonusacc = 70 elseif caster:hasStatusEffect(xi.effect.CHAIN_AFFINITY) then @@ -33,29 +33,36 @@ spellObject.onSpellCast = function(caster, target, spell) params.attackType = xi.attackType.PHYSICAL params.damageType = xi.damageType.HTH - params.scattr = xi.skillchainType.COMPRESSION - params.scattr2 = xi.skillchainType.REVERBERATION - params.numhits = 1 + params.scattr = xi.skillchainType.COMPRESSION + params.scattr2 = xi.skillchainType.REVERBERATION + params.numhits = 1 params.multiplier = 1.5 - params.tp150 = 1.5 - params.tp300 = 1.5 - params.azuretp = 1.5 - params.duppercap = 41 - params.str_wsc = 0.0 - params.dex_wsc = 0.2 - params.vit_wsc = 0.0 - params.agi_wsc = 0.0 - params.int_wsc = 0.2 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.0 - - params.effect = xi.effect.ATTACK_DOWN - local power = 15 - local tick = 0 - local duration = 60 + params.tp150 = 1.5 + params.tp300 = 1.5 + params.azuretp = 1.5 + params.duppercap = 41 + params.str_wsc = 0.0 + params.dex_wsc = 0.2 + params.vit_wsc = 0.0 + params.agi_wsc = 0.0 + params.int_wsc = 0.2 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.usePhysicalSpell(caster, target, spell, params) - xi.spells.blue.usePhysicalSpellAddedEffect(caster, target, spell, params, damage, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.ATTACK_DOWN, 15, 0, 60 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/actions/spells/blue/wild_oats.lua b/scripts/actions/spells/blue/wild_oats.lua index e1b5cac2919..a9eddf2b3b8 100644 --- a/scripts/actions/spells/blue/wild_oats.lua +++ b/scripts/actions/spells/blue/wild_oats.lua @@ -21,32 +21,39 @@ end spellObject.onSpellCast = function(caster, target, spell) local params = {} - params.ecosystem = xi.ecosystem.PLANTOID - params.tpmod = xi.spells.blue.tpMod.DURATION + params.ecosystem = xi.ecosystem.PLANTOID + params.tpmod = xi.spells.blue.tpMod.DURATION params.attackType = xi.attackType.PHYSICAL params.damageType = xi.damageType.PIERCING - params.scattr = xi.skillchainType.TRANSFIXION - params.numhits = 1 + params.scattr = xi.skillchainType.TRANSFIXION + params.numhits = 1 params.multiplier = 1.84 - params.tp150 = 1.84 - params.tp300 = 1.84 - params.azuretp = 1.84 - params.duppercap = 11 - params.str_wsc = 0.0 - params.dex_wsc = 0.0 - params.vit_wsc = 0.0 - params.agi_wsc = 0.3 - params.int_wsc = 0.0 - params.mnd_wsc = 0.0 - params.chr_wsc = 0.0 - - params.effect = xi.effect.VIT_DOWN - local power = 9 - local tick = 6 - local duration = 60 + params.tp150 = 1.84 + params.tp300 = 1.84 + params.azuretp = 1.84 + params.duppercap = 11 + params.str_wsc = 0.0 + params.dex_wsc = 0.0 + params.vit_wsc = 0.0 + params.agi_wsc = 0.3 + params.int_wsc = 0.0 + params.mnd_wsc = 0.0 + params.chr_wsc = 0.0 + -- Handle damage. local damage = xi.spells.blue.usePhysicalSpell(caster, target, spell, params) - xi.spells.blue.usePhysicalSpellAddedEffect(caster, target, spell, params, damage, power, tick, duration) + + if damage <= 0 then + return damage + end + + -- Handle status effects. + local effectTable = + { + [1] = { xi.effect.VIT_DOWN, 9, 6, 60 }, + } + + xi.spells.blue.applyBlueAdditionalEffect(caster, target, params, effectTable) return damage end diff --git a/scripts/globals/bluemagic.lua b/scripts/globals/bluemagic.lua index 2be7e6cc13e..e90a8229eb3 100644 --- a/scripts/globals/bluemagic.lua +++ b/scripts/globals/bluemagic.lua @@ -422,7 +422,7 @@ end xi.spells.blue.useBreathSpell = function(caster, target, spell, params) -- Early return. if - parmas.isConal and -- Conal breath spells + params.isConal and -- Conal breath spells not target:isInfront(caster, 32) -- Conal check (45° cone) then return 0 @@ -438,11 +438,14 @@ xi.spells.blue.useBreathSpell = function(caster, target, spell, params) local spellId = spell:getID() or 0 local spellFamily = spell:getSpellFamily() or 0 local spellElement = spell:getElement() or 0 + local attackType = params.attackType or xi.attackType.NONE + local damageType = params.damageType or xi.damageType.NONE -- Multipliers local correlationMultiplier = 1 + calculateCorrelation(params.ecosystem, target:getEcosystem(), caster:getMerit(xi.merit.MONSTER_CORRELATION)) - local breathSDT = 1 + caster:getMod(xi.mod.BREATH_DMG_DEALT) / 100) + local breathSDT = 1 + caster:getMod(xi.mod.BREATH_DMG_DEALT) / 100 + local nukeAbsorbOrNullify = xi.spells.damage.calculateNukeAbsorbOrNullify(target, spellElement) local targetMagicDamageAdjustment = xi.spells.damage.calculateTMDA(target, spellElement) local multipleTargetReduction = xi.spells.damage.calculateMTDR(spell) local elementalStaffBonus = xi.spells.damage.calculateElementalStaffBonus(caster, spellElement) @@ -478,7 +481,7 @@ xi.spells.blue.useBreathSpell = function(caster, target, spell, params) -- Handle "Nuke Wall". It must be handled after all previous calculations, but before clamp. if nukeAbsorbOrNullify > 0 then local nukeWallFactor = xi.spells.damage.calculateNukeWallFactor(target, spellElement, dmg) - dmg = math.floor(finalDamage * nukeWallFactor) + dmg = math.floor(dmg * nukeWallFactor) end -- Apply damage @@ -509,10 +512,10 @@ xi.spells.blue.useBreathSpell = function(caster, target, spell, params) target:addTP(extraTPGained) -- Handle Afflatus Misery. - target:handleAfflatusMiseryDamage(finalDamage) + target:handleAfflatusMiseryDamage(dmg) -- Handle Enmity. - target:updateEnmityFromDamage(caster, finalDamage) + target:updateEnmityFromDamage(caster, dmg) return dmg end @@ -653,25 +656,13 @@ xi.spells.blue.useCuringSpell = function(caster, target, spell, params) return final end --- Inflict an added enfeebling effect (after a physical spell) -xi.spells.blue.usePhysicalSpellAddedEffect = function(caster, target, spell, params, damage, power, tick, duration) - -- Physical spell needs to do damage before added effect can hit - if damage > 0 then - -- INT and Blue Magic skill are the default resistance modifiers - params.diff = caster:getStat(xi.mod.INT) - target:getStat(xi.mod.INT) - params.skillType = xi.skill.BLUE_MAGIC - local resist = applyResistanceEffect(caster, target, spell, params) - - if resist >= 0.5 then - target:addStatusEffect(params.effect, power, tick, duration * resist) - end - end -end - xi.spells.blue.applyBlueAdditionalEffect = function(caster, target, params, effectTable) -- Sanitize parameters. local element = params.damageType and params.damageType - 5 or 0 - local stat = params.attribute and params.attribute or xi.mod.NONE + local stat = params.attribute and params.attribute or xi.mod.INT + if params.attackType == xi.attackType.BREATH then + stat = 0 + end -- Calculate resist and early return. local resist = xi.combat.magicHitRate.calculateResistRate(caster, target, 0, xi.skill.BLUE_MAGIC, 0, element, stat, 0, 0)