Skip to content

Commit

Permalink
add: Frozen Mist and Hydro Wave mobskills
Browse files Browse the repository at this point in the history
  • Loading branch information
ampitere committed May 14, 2024
1 parent e42b3b4 commit b51de73
Show file tree
Hide file tree
Showing 30 changed files with 233 additions and 41 deletions.
2 changes: 1 addition & 1 deletion scripts/actions/abilities/blade_bash.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ abilityObject.onUseAbility = function(player, target, ability)
local damage = math.floor(player:getMod(xi.mod.WEAPON_BASH) + (jobLevel + 11) / 4)

-- Calculating and applying Blade Bash damage
damage = utils.stoneskin(target, damage)
damage = utils.stoneskin(target, damage, xi.attackType.PHYSICAL)
target:takeDamage(damage, player, xi.attackType.PHYSICAL, xi.damageType.BLUNT)
target:updateEnmityFromDamage(player, damage)

Expand Down
2 changes: 1 addition & 1 deletion scripts/actions/abilities/mijin_gakure.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ abilityObject.onUseAbility = function(player, target, ability)
-- Job Point Bonus (3% per Level)
dmg = dmg * (1 + (player:getJobPointLevel(xi.jp.MIJIN_GAKURE_EFFECT) * 0.03))
dmg = dmg * resist
dmg = utils.stoneskin(target, dmg)
dmg = utils.stoneskin(target, dmg, xi.attackType.SPECIAL)

target:takeDamage(dmg, player, xi.attackType.SPECIAL, xi.damageType.ELEMENTAL)
player:setLocalVar('MijinGakure', 1)
Expand Down
2 changes: 1 addition & 1 deletion scripts/actions/abilities/pets/automaton/shield_bash.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ abilityObject.onAutomatonAbility = function(target, automaton, skill, master, ac

damage = damage * (pdif / 1000)

damage = utils.stoneskin(target, damage)
damage = utils.stoneskin(target, damage, xi.attackType.PHYSICAL)
target:takeDamage(damage, automaton, xi.attackType.PHYSICAL, xi.damageType.BLUNT)
target:updateEnmityFromDamage(automaton, damage)
target:addEnmity(automaton, 450, 900)
Expand Down
2 changes: 1 addition & 1 deletion scripts/actions/abilities/pets/concentric_pulse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abilityObject.onPetAbility = function(target, pet, skill)
dmg = dmg + (dmg * 0.01 * dmgBoost)
end

dmg = utils.stoneskin(target, dmg)
dmg = utils.stoneskin(target, dmg, xi.attackType.MAGICAL)

target:takeDamage(dmg, pet, xi.attackType.MAGICAL, xi.damageType.NONE)

Expand Down
36 changes: 36 additions & 0 deletions scripts/actions/mobskills/frozen_mist.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
-----------------------------------
-- Frozen Mist
-- Description: Deals ice damage to enemies around the caster. Additional effect: Terror
-- Type: Magical (Ice)
-----------------------------------
local mobskillObject = {}

mobskillObject.onMobSkillCheck = function(target, mob, skill)
return 0
end

mobskillObject.onMobWeaponSkill = function(target, mob, skill)
local duration = 30
local resist = applyResistanceAddEffect(mob, target, xi.element.ICE, 0)

xi.mobskills.mobStatusEffectMove(mob, target, xi.effect.TERROR, 30, 0, duration * resist)

local dmgmod = 1.5
local info = xi.mobskills.mobMagicalMove(mob, target, skill, mob:getWeaponDmg(), xi.element.ICE, dmgmod, xi.mobskills.magicalTpBonus.NO_EFFECT)
local dmg = xi.mobskills.mobFinalAdjustments(info.dmg, mob, skill, target, xi.attackType.MAGICAL, xi.damageType.ICE, xi.mobskills.shadowBehavior.WIPE_SHADOWS)

target:takeDamage(dmg, mob, xi.attackType.MAGICAL, xi.damageType.ICE)

mob:addStatusEffect(xi.effect.STONESKIN, 0, 0, 180, 1, 1000)
mob:setAnimationSub(1)

local effect = mob:getStatusEffect(xi.effect.STONESKIN)
if effect then
mob:addMod(xi.mod.ICE_ABSORB, 100)
effect:addMod(xi.mod.ICE_ABSORB, 100)
end

return dmg
end

return mobskillObject
4 changes: 2 additions & 2 deletions scripts/actions/mobskills/fuscous_ooze.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-----------------------------------
-- Fuscous Ooze
-- Family: Slugs
-- Description: A dusky slime inflicts encumberance and weight.
-- Description: A dusky slime inflicts encumbrance and weight.
-- Type: Magical
-- Utsusemi/Blink absorb: Ignores shadows
-- Range: Cone
Expand All @@ -13,7 +13,7 @@ mobskillObject.onMobSkillCheck = function(target, mob, skill)
end

mobskillObject.onMobWeaponSkill = function(target, mob, skill)
-- TODO: Encumberance seems to do nothing?
-- TODO: Encumbrance seems to do nothing?
xi.mobskills.mobStatusEffectMove(mob, target, xi.effect.WEIGHT, 50, 0, 45)

local dmgmod = 1
Expand Down
36 changes: 36 additions & 0 deletions scripts/actions/mobskills/hydro_wave.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
-----------------------------------
-- Hydro Wave
-- Description: Deals water damage to enemies around the caster.
-- Type: Magical (Water)
-----------------------------------
local mobskillObject = {}

mobskillObject.onMobSkillCheck = function(target, mob, skill)
return 0
end

mobskillObject.onMobWeaponSkill = function(target, mob, skill)
local duration = 30
local resist = applyResistanceAddEffect(mob, target, xi.element.WATER, 0)

xi.mobskills.mobStatusEffectMove(mob, target, xi.effect.ENCUMBRANCE_II, math.random(1,16), 0, (duration * resist))

local dmgmod = 2.5
local info = xi.mobskills.mobMagicalMove(mob, target, skill, mob:getWeaponDmg(), xi.element.WATER, dmgmod, xi.mobskills.magicalTpBonus.NO_EFFECT)
local dmg = xi.mobskills.mobFinalAdjustments(info.dmg, mob, skill, target, xi.attackType.MAGICAL, xi.damageType.WATER, xi.mobskills.shadowBehavior.WIPE_SHADOWS)

target:takeDamage(dmg, mob, xi.attackType.MAGICAL, xi.damageType.WATER)

mob:addStatusEffect(xi.effect.STONESKIN, 0, 0, 180, 2, 1500)
mob:setAnimationSub(2)

local effect = mob:getStatusEffect(xi.effect.STONESKIN)
if effect then
mob:addMod(xi.mod.WATER_ABSORB, 100)
effect:addMod(xi.mod.WATER_ABSORB, 100)
end

return dmg
end

return mobskillObject
2 changes: 1 addition & 1 deletion scripts/actions/mobskills/spirits_within.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ mobskillObject.onMobWeaponSkill = function(target, mob, skill)
return 0
end

dmg = utils.stoneskin(target, dmg)
dmg = utils.stoneskin(target, dmg, xi.attackType.BREATH)

if dmg > 0 then
target:wakeUp()
Expand Down
2 changes: 1 addition & 1 deletion scripts/effects/bio.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ effectObject.onEffectTick = function(target, effect)
-- handle diabolos nightmare bio damage explicitly
if effect:getTier() > 0 then
-- re-using logic from helix effect processing
local dmg = utils.stoneskin(target, effect:getPower())
local dmg = utils.stoneskin(target, effect:getPower(), xi.attackType.MAGICAL)

if dmg > 0 then
target:takeDamage(dmg, nil, nil, nil, { wakeUp = false, breakBind = false })
Expand Down
2 changes: 1 addition & 1 deletion scripts/effects/encumbrance.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-----------------------------------
-- xi.effect.ENCUMBERANCE
-- xi.effect.ENCUMBRANCE
-----------------------------------
local effectObject = {}

Expand Down
2 changes: 1 addition & 1 deletion scripts/effects/helix.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ effectObject.onEffectGain = function(target, effect)
end

effectObject.onEffectTick = function(target, effect)
local dmg = utils.stoneskin(target, effect:getPower())
local dmg = utils.stoneskin(target, effect:getPower(), xi.attackType.MAGICAL)

if dmg > 0 then
target:takeDamage(dmg)
Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/ability.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ xi.ability.adjustDamage = function(dmg, mob, skill, target, skilltype, skillpara
dmg = utils.oneforall(target, dmg)
end

dmg = utils.stoneskin(target, dmg)
dmg = utils.stoneskin(target, dmg, skilltype)

if dmg > 0 then
target:wakeUp()
Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/bluemagic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ xi.spells.blue.applySpellDamage = function(caster, target, spell, dmg, params, t
end

-- handle stoneskin
dmg = utils.stoneskin(target, dmg)
dmg = utils.stoneskin(target, dmg, attackType)

target:takeSpellDamage(caster, spell, dmg, attackType, damageType)

Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/job_utils/dancer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ xi.job_utils.dancer.useViolentFlourishAbility = function(player, target, ability
ability:setMsg(xi.msg.basic.JA_DAMAGE)
end

dmg = utils.stoneskin(target, dmg)
dmg = utils.stoneskin(target, dmg, xi.attackType.PHYSICAL)
target:takeDamage(dmg, player, xi.attackType.PHYSICAL, player:getWeaponDamageType(xi.slot.MAIN))
target:updateEnmityFromDamage(player, dmg)

Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/job_utils/paladin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ xi.job_utils.paladin.useShieldBash = function(player, target, ability)
local randomizer = 1 + (math.random(1, 5) / 100)

damage = damage * randomizer
damage = utils.stoneskin(target, damage)
damage = utils.stoneskin(target, damage, xi.attackType.PHYSICAL)

target:takeDamage(damage, player, xi.attackType.PHYSICAL, xi.damageType.BLUNT)
target:updateEnmityFromDamage(player, damage)
Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/job_utils/rune_fencer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ local function calculateSwipeLungeDamage(player, target, skillModifier, gearBonu

-- Handle Stoneskin
if damage > 0 then
damage = utils.clamp(utils.stoneskin(target, damage), -99999, 99999)
damage = utils.clamp(utils.stoneskin(target, damage, xi.attackType.MAGICAL), -99999, 99999)
end

return damage
Expand Down
6 changes: 3 additions & 3 deletions scripts/globals/job_utils/white_mage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ xi.job_utils.white_mage.useDevotion = function(player, target, ability)
local damageHP = math.floor(player:getHP() * 0.25)

-- If stoneskin is present, it should absorb damage
damageHP = utils.stoneskin(player, damageHP)
damageHP = utils.stoneskin(player, damageHP, xi.attackType.MAGICAL)

local healMP = player:getHP() * mpPercent
healMP = utils.clamp(healMP, 0, target:getMaxMP() - target:getMP())

damageHP = utils.stoneskin(player, damageHP)
damageHP = utils.stoneskin(player, damageHP, xi.attackType.MAGICAL)
player:delHP(damageHP)
target:addMP(healMP)

Expand Down Expand Up @@ -143,7 +143,7 @@ xi.job_utils.white_mage.useMartyr = function(player, target, ability)
healHP = utils.clamp(healHP, 0, target:getMaxHP() - target:getHP())

-- If stoneskin is present, it should absorb damage
damageHP = utils.stoneskin(player, damageHP)
damageHP = utils.stoneskin(player, damageHP, xi.attackType.MAGICAL)
player:delHP(damageHP)
target:addHP(healHP)

Expand Down
4 changes: 2 additions & 2 deletions scripts/globals/magic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ function finalMagicAdjustments(caster, target, spell, dmg)
dmg = utils.oneforall(target, dmg)

--handling stoneskin
dmg = utils.stoneskin(target, dmg)
dmg = utils.stoneskin(target, dmg, xi.attackType.MAGICAL)
dmg = utils.clamp(dmg, -99999, 99999)

if dmg < 0 then
Expand Down Expand Up @@ -490,7 +490,7 @@ function finalMagicNonSpellAdjustments(caster, target, ele, dmg)
dmg = utils.oneforall(target, dmg)

-- handling stoneskin
dmg = utils.stoneskin(target, dmg)
dmg = utils.stoneskin(target, dmg, xi.attackType.MAGICAL)

dmg = utils.clamp(dmg, -99999, 99999)

Expand Down
4 changes: 2 additions & 2 deletions scripts/globals/mobskills.lua
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ xi.mobskills.mobBreathMove = function(mob, target, skill, percent, base, element

-- Handle Stoneskin
if damage > 0 then
damage = utils.clamp(utils.stoneskin(target, damage), -99999, 99999)
damage = utils.clamp(utils.stoneskin(target, damage, xi.attackType.BREATH), -99999, 99999)
end

-- breath mob skills are single hit so provide single Melee hit TP return if primary target
Expand Down Expand Up @@ -601,7 +601,7 @@ xi.mobskills.mobFinalAdjustments = function(dmg, mob, skill, target, attackType,
end
end

dmg = utils.stoneskin(target, dmg)
dmg = utils.stoneskin(target, dmg, attackType)

if dmg > 0 then
target:updateEnmityFromDamage(mob, dmg)
Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/spells/damage_spell.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ xi.spells.damage.useDamageSpell = function(caster, target, spell)

-- Handle Stoneskin
if finalDamage > 0 then
finalDamage = utils.clamp(utils.stoneskin(target, finalDamage), -99999, 99999)
finalDamage = utils.clamp(utils.stoneskin(target, finalDamage, xi.attackType.MAGICAL), -99999, 99999)
end

-- Handle Magic Absorb
Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/summon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ xi.summon.avatarFinalAdjustments = function(dmg, mob, skill, target, skilltype,
end

-- handling stoneskin
dmg = utils.stoneskin(target, dmg)
dmg = utils.stoneskin(target, dmg, skilltype)

return dmg
end
Expand Down
40 changes: 38 additions & 2 deletions scripts/globals/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ function utils.counter(predicate)
end

-- returns unabsorbed damage
function utils.stoneskin(target, dmg)
function utils.stoneskin(target, dmg, attackType)
--handling stoneskin
if dmg > 0 then
local skin = target:getMod(xi.mod.STONESKIN)
Expand All @@ -365,14 +365,50 @@ function utils.stoneskin(target, dmg)
else --absorbs some damage then wear
target:delStatusEffect(xi.effect.STONESKIN)
target:setMod(xi.mod.STONESKIN, 0)
return dmg - skin
dmg = dmg - skin
end
end
end

local effect = target:getStatusEffect(xi.effect.STONESKIN)

if effect ~= nil then
local subID = effect:getSubType()

if subID == 1 and dmg > 0 then
local physicalSkin = effect:getSubPower()

if physicalSkin > 0 and attackType == xi.attackType.PHYSICAL then
dmg = utils.stoneskinSubPower(target, effect, physicalSkin, dmg)
end
end

if subID == 2 and dmg > 0 then
local magicSkin = effect:getSubPower()

if
dmg > 0 and
magicSkin > 0 and
(attackType == xi.attackType.MAGICAL or attackType == xi.attackType.BREATH or attackType == xi.attackType.SPECIAL)
then
dmg = utils.stoneskinSubPower(target, effect, magicSkin, dmg)
end
end
end

return dmg
end

function utils.stoneskinSubPower(target, effect, skin, dmg)
if skin > dmg then --absorb all damage
effect:setSubPower(skin - dmg)
return 0
else --absorbs some damage then wear
target:delStatusEffect(xi.effect.STONESKIN)
return dmg - skin
end
end

-- returns reduced magic damage from RUN buff, 'One for All'
function utils.oneforall(target, dmg)
if dmg > 0 then
Expand Down
8 changes: 4 additions & 4 deletions scripts/globals/weaponskills.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ local function souleaterBonus(attacker, wsParams)
local bonusDamage = math.floor(attacker:getHP() * (0.1 + souleaterEffect + souleaterEffectII))

if bonusDamage >= 1 then
attacker:delHP(utils.stoneskin(attacker, bonusDamage * stalwartSoulBonus))
attacker:delHP(utils.stoneskin(attacker, bonusDamage * stalwartSoulBonus, xi.attackType.PHYSICAL))

if attacker:getMainJob() ~= xi.job.DRK then
return math.floor(bonusDamage / 2)
Expand Down Expand Up @@ -349,7 +349,7 @@ local function getSingleHitDamage(attacker, target, dmg, ftp, wsParams, calcPara
magicdmg = magicdmg - target:getMod(xi.mod.PHALANX)
magicdmg = utils.clamp(magicdmg, 0, 99999)
magicdmg = utils.oneforall(target, magicdmg)
magicdmg = utils.stoneskin(target, magicdmg)
magicdmg = utils.stoneskin(target, magicdmg, xi.attackType.MAGICAL)
end

finaldmg = finaldmg + magicdmg
Expand Down Expand Up @@ -398,7 +398,7 @@ local function modifyMeleeHitDamage(attacker, target, attackTbl, wsParams, rawDa
adjustedDamage = utils.clamp(adjustedDamage, 0, 99999)
end

adjustedDamage = utils.stoneskin(target, adjustedDamage)
adjustedDamage = utils.stoneskin(target, adjustedDamage, xi.attackType.PHYSICAL)

return adjustedDamage
end
Expand Down Expand Up @@ -937,7 +937,7 @@ xi.weaponskills.doMagicWeaponskill = function(attacker, target, wsID, wsParams,
end

dmg = utils.oneforall(target, dmg)
dmg = utils.stoneskin(target, dmg)
dmg = utils.stoneskin(target, dmg, xi.attackType.MAGICAL)

dmg = dmg * xi.settings.main.WEAPON_SKILL_POWER -- Add server bonus
else
Expand Down
13 changes: 13 additions & 0 deletions scripts/mixins/families/ruszor.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require('scripts/globals/mixins')

g_mixins = g_mixins or {}

g_mixins.ruszor = function(ruszorMob)
ruszorMob:addListener('EFFECT_LOSE', 'STONESKIN', function(mob, effect)
if effect:getEffectType() == xi.effect.STONESKIN then
mob:setAnimationSub(0)
end
end)
end

return g_mixins.ruszor
Loading

0 comments on commit b51de73

Please sign in to comment.