Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Status] Add "Nocturne" effect script and "Plague" immunity #6680

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/actions/weaponskills/tachi_gekko.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ weaponskillObject.onUseWeaponSkill = function(player, target, wsID, tp, primary,
end

local damage, criticalHit, tpHits, extraHits = xi.weaponskills.doPhysicalWeaponskill(player, target, wsID, params, tp, action, primary, taChar)

-- Handle status effect
local effectId = xi.effect.SILENCE
local actionElement = xi.element.WIND
Expand Down
20 changes: 20 additions & 0 deletions scripts/effects/nocturne.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-----------------------------------
-- xi.effect.NOCTURNE
-----------------------------------
---@type TEffect
local effectObject = {}

effectObject.onEffectGain = function(target, effect)
local power = effect:getPower()

effect:addMod(xi.mod.FASTCAST, -power)
effect:addMod(xi.mod.MACC, -power)
end

effectObject.onEffectTick = function(target, effect)
end

effectObject.onEffectLose = function(target, effect)
end

return effectObject
37 changes: 19 additions & 18 deletions scripts/enum/immunity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@ xi = xi or {}
---@enum xi.immunity
xi.immunity =
{
NONE = 0x00000000,
ADDLE = 0x00000001,
GRAVITY = 0x00000002,
BIND = 0x00000004,
STUN = 0x00000008,
SILENCE = 0x00000010, -- 16
PARALYZE = 0x00000020, -- 32
BLIND = 0x00000040, -- 64
SLOW = 0x00000080, -- 128
POISON = 0x00000100, -- 256
ELEGY = 0x00000200, -- 512
REQUIEM = 0x00000400, -- 1024
LIGHT_SLEEP = 0x00000800, -- 2048
DARK_SLEEP = 0x00001000, -- 4096
ASPIR = 0x00002000, -- 8192
TERROR = 0x00004000, -- 16384
DISPEL = 0x00008000, -- 32768
PETRIFY = 0x00010000, -- 65536
NONE = 0x00000000, -- 0
ADDLE = 0x00000001, -- 1
GRAVITY = 0x00000002, -- 2
BIND = 0x00000004, -- 4
STUN = 0x00000008, -- 8
SILENCE = 0x00000010, -- 16
PARALYZE = 0x00000020, -- 32
BLIND = 0x00000040, -- 64
SLOW = 0x00000080, -- 128
POISON = 0x00000100, -- 256
ELEGY = 0x00000200, -- 512
REQUIEM = 0x00000400, -- 1024
LIGHT_SLEEP = 0x00000800, -- 2048
DARK_SLEEP = 0x00001000, -- 4096
ASPIR = 0x00002000, -- 8192
TERROR = 0x00004000, -- 16384
DISPEL = 0x00008000, -- 32768
PETRIFY = 0x00010000, -- 65536
PLAGUE = 0x00020000, -- 131064
}
49 changes: 25 additions & 24 deletions scripts/globals/combat/status_effect_tables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,28 @@ local column =
-- Table associating an status effect with their corresponding immunobreak, MEVA and resistance modifiers and immunities.
xi.combat.statusEffect.dataTable =
{
[xi.effect.ADDLE ] = { 0, 0, xi.element.FIRE, xi.immunity.ADDLE, xi.mod.SLOWRES, 0, 0, xi.mod.ADDLE_IMMUNOBREAK },
[xi.effect.BIND ] = { 0, 0, xi.element.ICE, xi.immunity.BIND, xi.mod.BINDRES, 0, xi.mod.BIND_MEVA, xi.mod.BIND_IMMUNOBREAK },
[xi.effect.BLINDNESS ] = { 0, 0, xi.element.DARK, xi.immunity.BLIND, xi.mod.BLINDRES, 0, xi.mod.BLIND_MEVA, xi.mod.BLIND_IMMUNOBREAK },
[xi.effect.BURN ] = { xi.effect.DROWN, 0, xi.element.FIRE, 0, 0, 0, 0, 0 },
[xi.effect.CHOKE ] = { xi.effect.FROST, 0, xi.element.WIND, 0, 0, 0, 0, 0 },
[xi.effect.CURSE_I ] = { 0, 0, xi.element.DARK, xi.immunity.NONE, xi.mod.CURSERES, 0, xi.mod.CURSE_MEVA, 0 },
[xi.effect.DROWN ] = { xi.effect.SHOCK, 0, xi.element.WATER, 0, 0, 0, 0, 0 },
[xi.effect.FLASH ] = { 0, 0, xi.element.LIGHT, xi.immunity.BLIND, xi.mod.BLINDRES, 0, xi.mod.BLIND_MEVA, xi.mod.BLIND_IMMUNOBREAK },
[xi.effect.FROST ] = { xi.effect.BURN, 0, xi.element.ICE, 0, 0, 0, 0, 0 },
[xi.effect.NONE ] = { 0, 0, xi.element.DARK, xi.immunity.DISPEL, 0, 0, 0, 0 },
[xi.effect.PARALYSIS ] = { 0, 0, xi.element.ICE, xi.immunity.PARALYZE, xi.mod.PARALYZERES, 0, xi.mod.PARALYZE_MEVA, xi.mod.PARALYZE_IMMUNOBREAK },
[xi.effect.PETRIFICATION] = { 0, 0, xi.element.EARTH, xi.immunity.PETRIFY, xi.mod.PETRIFYRES, 0, xi.mod.PETRIFY_MEVA, xi.mod.PETRIFY_IMMUNOBREAK },
[xi.effect.PLAGUE ] = { 0, 0, xi.element.FIRE, xi.immunity.NONE, xi.mod.VIRUSRES, 0, xi.mod.VIRUS_MEVA, 0 },
[xi.effect.POISON ] = { 0, 0, xi.element.WATER, xi.immunity.POISON, xi.mod.POISONRES, 0, xi.mod.POISON_MEVA, xi.mod.POISON_IMMUNOBREAK },
[xi.effect.RASP ] = { xi.effect.CHOKE, 0, xi.element.EARTH, 0, 0, 0, 0, 0 },
[xi.effect.SHOCK ] = { xi.effect.RASP, 0, xi.element.THUNDER, 0, 0, 0, 0, 0 },
[xi.effect.SILENCE ] = { 0, 0, xi.element.WIND, xi.immunity.SILENCE, xi.mod.SILENCERES, 0, xi.mod.SILENCE_MEVA, xi.mod.SILENCE_IMMUNOBREAK },
[xi.effect.SLEEP_I ] = { 0, 0, xi.element.DARK, xi.immunity.DARK_SLEEP, xi.mod.SLEEPRES, 0, xi.mod.SLEEP_MEVA, xi.mod.SLEEP_IMMUNOBREAK },
[xi.effect.SLOW ] = { 0, 0, xi.element.EARTH, xi.immunity.SLOW, xi.mod.SLOWRES, 0, xi.mod.SLOW_MEVA, xi.mod.SLOW_IMMUNOBREAK },
[xi.effect.STUN ] = { 0, 0, xi.element.THUNDER, xi.immunity.STUN, xi.mod.STUNRES, 0, xi.mod.STUN_MEVA, 0 },
[xi.effect.WEIGHT ] = { 0, 0, xi.element.WIND, xi.immunity.GRAVITY, xi.mod.GRAVITYRES, 0, xi.mod.GRAVITY_MEVA, xi.mod.GRAVITY_IMMUNOBREAK },
[xi.effect.ADDLE ] = { 0, xi.effect.NOCTURNE, xi.element.FIRE, xi.immunity.ADDLE, xi.mod.SLOWRES, 0, 0, xi.mod.ADDLE_IMMUNOBREAK }, -- Addle cant be immunobroken?
[xi.effect.BIND ] = { 0, 0, xi.element.ICE, xi.immunity.BIND, xi.mod.BINDRES, 0, xi.mod.BIND_MEVA, xi.mod.BIND_IMMUNOBREAK },
[xi.effect.BLINDNESS ] = { 0, 0, xi.element.DARK, xi.immunity.BLIND, xi.mod.BLINDRES, 0, xi.mod.BLIND_MEVA, xi.mod.BLIND_IMMUNOBREAK },
[xi.effect.BURN ] = { xi.effect.DROWN, 0, xi.element.FIRE, 0, 0, 0, 0, 0 },
[xi.effect.CHOKE ] = { xi.effect.FROST, 0, xi.element.WIND, 0, 0, 0, 0, 0 },
[xi.effect.CURSE_I ] = { 0, 0, xi.element.DARK, xi.immunity.NONE, xi.mod.CURSERES, 0, xi.mod.CURSE_MEVA, 0 },
[xi.effect.DROWN ] = { xi.effect.SHOCK, 0, xi.element.WATER, 0, 0, 0, 0, 0 },
[xi.effect.FLASH ] = { 0, 0, xi.element.LIGHT, xi.immunity.BLIND, xi.mod.BLINDRES, 0, xi.mod.BLIND_MEVA, xi.mod.BLIND_IMMUNOBREAK },
[xi.effect.FROST ] = { xi.effect.BURN, 0, xi.element.ICE, 0, 0, 0, 0, 0 },
[xi.effect.NOCTURNE ] = { xi.effect.ADDLE, 0, xi.element.FIRE, xi.immunity.ADDLE, xi.mod.SLOWRES, 0, 0, 0 },
[xi.effect.NONE ] = { 0, 0, xi.element.DARK, xi.immunity.DISPEL, 0, 0, 0, 0 },
[xi.effect.PARALYSIS ] = { 0, 0, xi.element.ICE, xi.immunity.PARALYZE, xi.mod.PARALYZERES, 0, xi.mod.PARALYZE_MEVA, xi.mod.PARALYZE_IMMUNOBREAK },
[xi.effect.PETRIFICATION] = { 0, 0, xi.element.EARTH, xi.immunity.PETRIFY, xi.mod.PETRIFYRES, 0, xi.mod.PETRIFY_MEVA, xi.mod.PETRIFY_IMMUNOBREAK },
[xi.effect.PLAGUE ] = { 0, 0, xi.element.FIRE, xi.immunity.PLAGUE, xi.mod.VIRUSRES, 0, xi.mod.VIRUS_MEVA, 0 },
[xi.effect.POISON ] = { 0, 0, xi.element.WATER, xi.immunity.POISON, xi.mod.POISONRES, 0, xi.mod.POISON_MEVA, xi.mod.POISON_IMMUNOBREAK },
[xi.effect.RASP ] = { xi.effect.CHOKE, 0, xi.element.EARTH, 0, 0, 0, 0, 0 },
[xi.effect.SHOCK ] = { xi.effect.RASP, 0, xi.element.THUNDER, 0, 0, 0, 0, 0 },
[xi.effect.SILENCE ] = { 0, 0, xi.element.WIND, xi.immunity.SILENCE, xi.mod.SILENCERES, 0, xi.mod.SILENCE_MEVA, xi.mod.SILENCE_IMMUNOBREAK },
[xi.effect.SLEEP_I ] = { 0, 0, xi.element.DARK, xi.immunity.DARK_SLEEP, xi.mod.SLEEPRES, 0, xi.mod.SLEEP_MEVA, xi.mod.SLEEP_IMMUNOBREAK },
[xi.effect.SLOW ] = { 0, 0, xi.element.EARTH, xi.immunity.SLOW, xi.mod.SLOWRES, 0, xi.mod.SLOW_MEVA, xi.mod.SLOW_IMMUNOBREAK },
[xi.effect.STUN ] = { 0, 0, xi.element.THUNDER, xi.immunity.STUN, xi.mod.STUNRES, 0, xi.mod.STUN_MEVA, 0 },
[xi.effect.WEIGHT ] = { 0, 0, xi.element.WIND, xi.immunity.GRAVITY, xi.mod.GRAVITYRES, 0, xi.mod.GRAVITY_MEVA, xi.mod.GRAVITY_IMMUNOBREAK },
}

-----------------------------------
Expand Down Expand Up @@ -213,10 +214,10 @@ xi.combat.statusEffect.isTargetResistant = function(actor, target, effectId)
end

xi.combat.statusEffect.isEffectNullified = function(target, effectId)
local effectId = xi.combat.statusEffect.getNullificatingEffect(effectId)
local nullificatingEffect = xi.combat.statusEffect.getNullificatingEffect(effectId)
if
effectId > 0 and
target:hasStatusEffect(effectId)
nullificatingEffect > 0 and
target:hasStatusEffect(nullificatingEffect)
then
return true
end
Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/spells/enfeebling_spell.lua
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ xi.spells.enfeebling.handleEffectNullification = function(caster, target, spell,
end

-- Target already has an status effect that nullifies current.
if xi.combat.statusEffect.isEffectNullified(spellEffect) then
if xi.combat.statusEffect.isEffectNullified(target, spellEffect) then
spell:setMsg(xi.msg.basic.MAGIC_NO_EFFECT)

return true
Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/weaponskills.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,7 @@ xi.weaponskills.handleWeaponskillEffect = function(actor, target, effectId, acti
not target:hasStatusEffect(effectId) and
not xi.combat.statusEffect.isTargetImmune(target, effectId, actionElement) and
not xi.combat.statusEffect.isTargetResistant(actor, target, effectId) and
not xi.combat.statusEffect.isEffectNullified(effectId)
not xi.combat.statusEffect.isEffectNullified(target, effectId)
then
target:addStatusEffect(effectId, power, 0, duration)
end
Expand Down
37 changes: 19 additions & 18 deletions src/map/entities/battleentity.h
Original file line number Diff line number Diff line change
Expand Up @@ -457,24 +457,25 @@ DECLARE_FORMAT_AS_UNDERLYING(SKILLCHAIN_ELEMENT);

enum IMMUNITY : uint32
{
IMMUNITY_NONE = 0x00000000,
IMMUNITY_ADDLE = 0x00000001,
IMMUNITY_GRAVITY = 0x00000002,
IMMUNITY_BIND = 0x00000004,
IMMUNITY_STUN = 0x00000008,
IMMUNITY_SILENCE = 0x00000010, // 16
IMMUNITY_PARALYZE = 0x00000020, // 32
IMMUNITY_BLIND = 0x00000040, // 64
IMMUNITY_SLOW = 0x00000080, // 128
IMMUNITY_POISON = 0x00000100, // 256
IMMUNITY_ELEGY = 0x00000200, // 512
IMMUNITY_REQUIEM = 0x00000400, // 1024
IMMUNITY_LIGHT_SLEEP = 0x00000800, // 2048
IMMUNITY_DARK_SLEEP = 0x00001000, // 4096
IMMUNITY_ASPIR = 0x00002000, // 8192
IMMUNITY_TERROR = 0x00004000, // 16384
IMMUNITY_DISPEL = 0x00008000, // 32768
IMMUNITY_PETRIFY = 0x00010000, // 65536
IMMUNITY_NONE = 0x00000000, // 0
IMMUNITY_ADDLE = 0x00000001, // 1
IMMUNITY_GRAVITY = 0x00000002, // 2
IMMUNITY_BIND = 0x00000004, // 4
IMMUNITY_STUN = 0x00000008, // 8
IMMUNITY_SILENCE = 0x00000010, // 16
IMMUNITY_PARALYZE = 0x00000020, // 32
IMMUNITY_BLIND = 0x00000040, // 64
IMMUNITY_SLOW = 0x00000080, // 128
IMMUNITY_POISON = 0x00000100, // 256
IMMUNITY_ELEGY = 0x00000200, // 512
IMMUNITY_REQUIEM = 0x00000400, // 1024
IMMUNITY_LIGHT_SLEEP = 0x00000800, // 2048
IMMUNITY_DARK_SLEEP = 0x00001000, // 4096
IMMUNITY_ASPIR = 0x00002000, // 8192
IMMUNITY_TERROR = 0x00004000, // 16384
IMMUNITY_DISPEL = 0x00008000, // 32768
IMMUNITY_PETRIFY = 0x00010000, // 65536
IMMUNITY_PLAGUE = 0x00020000, // 131064
};
DECLARE_FORMAT_AS_UNDERLYING(IMMUNITY);

Expand Down
Loading