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

[RUN] Implement Foil; [lua] fix accuracy calculation for mob TP moves #1759

Merged
merged 3 commits into from
May 20, 2022
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
18 changes: 15 additions & 3 deletions scripts/globals/effects/foil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,26 @@ require("scripts/globals/status")
local effect_object = {}

effect_object.onEffectGain = function(target, effect)
effect:addMod(xi.mod.SPECIAL_ATTACK_EVASION, effect:getPower())
target:addMod(xi.mod.SPECIAL_ATTACK_EVASION, effect:getPower())
end

effect_object.onEffectTick = function(target, effect) -- TODO: Determine how Foil ticks down? It's description indicates this.
-- https://www.ffxiah.com/forum/topic/56696/foil-potency-and-decay-testing/#3625559
effect_object.onEffectTick = function(target, effect)

local power = effect:getPower()

-- TODO: Verify Foil evasion floor when more enhancing magic duration+ gear is available or RDM can cast foil from Master Levels.
if power > 0 then -- don't go negative. but we don't know what the floor of Foil is currently.

local powerDecay = 3

effect:setPower(power-powerDecay)
target:delMod(xi.mod.SPECIAL_ATTACK_EVASION, powerDecay)
end
end

effect_object.onEffectLose = function(target, effect)
-- intentionally blank. mod removes itself in C++ due to being added to the effect.
target:delMod(xi.mod.SPECIAL_ATTACK_EVASION, effect:getPower())
end

return effect_object
6 changes: 3 additions & 3 deletions scripts/globals/mobskills.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ xi.mobskills.mobPhysicalMove = function(mob, target, skill, numberofhits, accmod
local lvluser = mob:getMainLvl()
local lvltarget = target:getMainLvl()
local acc = mob:getACC()
local eva = target:getEVA()
local eva = target:getEVA() + target:getMod(xi.mod.SPECIAL_ATTACK_EVASION)

if target:hasStatusEffect(xi.effect.YONIN) and mob:isFacing(target, 23) then -- Yonin evasion boost if mob is facing target
eva = eva + target:getStatusEffect(xi.effect.YONIN):getPower()
Expand All @@ -184,8 +184,8 @@ xi.mobskills.mobPhysicalMove = function(mob, target, skill, numberofhits, accmod
ratio = ratio + lvldiff * 0.05
ratio = utils.clamp(ratio, 0, 4)

--work out hit rate for mobs (bias towards them)
local hitrate = (acc * accmod) - eva + (lvldiff * 2) + 75
--work out hit rate for mobs
local hitrate = ( (acc * accmod) - eva) / 2 + (lvldiff * 2) + 75

hitrate = utils.clamp(hitrate, 20, 95)

Expand Down
6 changes: 2 additions & 4 deletions scripts/globals/spells/white/foil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ spell_object.onMagicCastingCheck = function(caster, target, spell)
return 0
end

-- TODO: determine mechanics of how Foil's "Special Attack" evasion works.
-- Martel has a post about it here: https://www.bluegartr.com/threads/115399-Rune-Fencer-Findings?p=5665305&viewfull=1#post5665305
-- More testing is required (such as determining accuracy of the target used for testing)
-- https://www.ffxiah.com/forum/topic/56696/foil-potency-and-decay-testing/#3625542
spell_object.onSpellCast = function(caster, target, spell)

if target:addStatusEffect(xi.effect.FOIL, 0, 0, 30) then -- power set to 0 because true mechanics are unknown as of now. The primary use of Foil is for enmity anyway.
if target:addStatusEffect(xi.effect.FOIL, 150, 3, 30) then
spell:setMsg(xi.msg.basic.MAGIC_GAIN_EFFECT)
else
spell:setMsg(xi.msg.basic.MAGIC_NO_EFFECT)
Expand Down