Skip to content

Commit

Permalink
Cleanup enfeebling songs
Browse files Browse the repository at this point in the history
- Add MACC logic for soul voice
- Remove unnecesary steps and columns
- Correct effect of gear on potency, macc and such
  • Loading branch information
Xaver-DaRed committed Jan 23, 2025
1 parent f0cc683 commit e3ae51e
Show file tree
Hide file tree
Showing 5 changed files with 211 additions and 308 deletions.
3 changes: 1 addition & 2 deletions scripts/effects/elegy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
local effectObject = {}

effectObject.onEffectGain = function(target, effect)
target:addMod(xi.mod.HASTE_MAGIC, -effect:getPower())
effect:addMod(xi.mod.HASTE_MAGIC, -effect:getPower())
end

effectObject.onEffectTick = function(target, effect)
end

effectObject.onEffectLose = function(target, effect)
target:delMod(xi.mod.HASTE_MAGIC, -effect:getPower())
end

return effectObject
3 changes: 1 addition & 2 deletions scripts/effects/threnody.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
local effectObject = {}

effectObject.onEffectGain = function(target, effect)
target:addMod(effect:getSubPower(), effect:getPower())
effect:addMod(effect:getSubPower(), -effect:getPower())
end

effectObject.onEffectTick = function(target, effect)
end

effectObject.onEffectLose = function(target, effect)
target:delMod(effect:getSubPower(), effect:getPower())
end

return effectObject
31 changes: 27 additions & 4 deletions scripts/globals/combat/magic_hit_rate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,30 @@ local function magicAccuracyFromFoodMultiplier(actor)
return magicAcc
end

local function magicAccuracyFromSoulVoiceMultiplier(actor, skillType, effectId)
local effectTable =
set{
xi.effect.SLEEP_I, -- Lullabies
xi.effect.NONE, -- Magic Finale
xi.effect.CHARM_I -- Maiden's Virellai
}

if
effectTable[effectId] and
skillType == xi.skill.SINGING
then
if actor:hasStatusEffect(xi.effect.SOUL_VOICE) then
return 2
elseif actor:hasStatusEffect(xi.effect.MARCATO) then
return 1.5
end
end

return 1
end

-- Global function to calculate total magicc accuracy.
xi.combat.magicHitRate.calculateActorMagicAccuracy = function(actor, target, spellGroup, skillType, skillRank, actionElement, statUsed, bonusMacc)
xi.combat.magicHitRate.calculateActorMagicAccuracy = function(actor, target, spellGroup, skillType, skillRank, actionElement, statUsed, effectId, bonusMacc)
local finalMagicAcc = 0

local magicAccBase = actor:getMod(xi.mod.MACC) + actor:getILvlMacc(xi.slot.MAIN)
Expand All @@ -349,11 +371,12 @@ xi.combat.magicHitRate.calculateActorMagicAccuracy = function(actor, target, spe
local magicAccWeather = magicAccuracyFromWeatherElement(actor, actionElement)

-- Multipliers
local magicAccFoodFactor = magicAccuracyFromFoodMultiplier(actor)
local magicAccFoodFactor = magicAccuracyFromFoodMultiplier(actor)
local magicAccSoulVoiceFactor = magicAccuracyFromSoulVoiceMultiplier(actor, skillType, effectId)

-- Add up food magic accuracy.
finalMagicAcc = magicAccBase + magicAccSkill + magicAccElement + magicAccStatDiff + magicAccEffects + magicAccMerits + magicAccJobPoints + magicAccBurst + magicAccDay + magicAccWeather + bonusMacc
finalMagicAcc = math.floor(finalMagicAcc * magicAccFoodFactor)
finalMagicAcc = math.floor(finalMagicAcc * magicAccFoodFactor * magicAccSoulVoiceFactor)

return finalMagicAcc
end
Expand Down Expand Up @@ -537,7 +560,7 @@ xi.combat.magicHitRate.calculateResistRate = function(actor, target, spellGroup,
end

-- Get Actor Magic Accuracy and target Magic Evasion
local magicAcc = xi.combat.magicHitRate.calculateActorMagicAccuracy(actor, target, spellGroup, skillType, skillRank, actionElement, statUsed, bonusMacc)
local magicAcc = xi.combat.magicHitRate.calculateActorMagicAccuracy(actor, target, spellGroup, skillType, skillRank, actionElement, statUsed, effectId, bonusMacc)
local magicEva = xi.combat.magicHitRate.calculateTargetMagicEvasion(actor, target, actionElement, magicEvasionModifier, rankModifier)
local magicHitRate = xi.combat.magicHitRate.calculateMagicHitRate(magicAcc, magicEva)
local resistRate = xi.combat.magicHitRate.calculateResistanceFactor(actor, target, actionElement, magicHitRate, rankModifier)
Expand Down
Loading

0 comments on commit e3ae51e

Please sign in to comment.