Skip to content

Commit

Permalink
Merge pull request #6454 from WinterSolstice8/mnk_ability_audit
Browse files Browse the repository at this point in the history
Chakra, Dodge, Focus retail functionality audit
  • Loading branch information
zach2good authored Nov 25, 2024
2 parents 74d448a + 1b8d3a7 commit a2410cd
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 53 deletions.
12 changes: 8 additions & 4 deletions scripts/effects/dodge.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@
---@type TEffect
local effectObject = {}

-- TODO: implement Glanzfaust effects
effectObject.onEffectGain = function(target, effect)
local jpLevel = target:getJobPointLevel(xi.jp.DODGE_EFFECT) * 2
target:addMod(xi.mod.EVA, effect:getPower() + jpLevel)
local jpLevel = target:getJobPointLevel(xi.jp.DODGE_EFFECT)
local dodgeMod = target:getMod(xi.mod.DODGE_EFFECT)
local monkLevel = utils.getActiveJobLevel(target, xi.job.MNK)

-- https://www.bg-wiki.com/ffxi/Dodge
effect:addMod(xi.mod.EVA, monkLevel + 1 + dodgeMod + jpLevel)
effect:addMod(xi.mod.ADDITIVE_GUARD, math.floor((monkLevel + 1) * 0.2))
end

effectObject.onEffectTick = function(target, effect)
end

effectObject.onEffectLose = function(target, effect)
local jpLevel = target:getJobPointLevel(xi.jp.DODGE_EFFECT) * 2
target:delMod(xi.mod.EVA, effect:getPower() + jpLevel)
end

return effectObject
15 changes: 11 additions & 4 deletions scripts/effects/focus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@
---@type TEffect
local effectObject = {}

-- TODO: implement Glanzfaust effects
-- TODO: implement focus ranged accuracy bonus (needs verification)
effectObject.onEffectGain = function(target, effect)
local jpLevel = target:getJobPointLevel(xi.jp.FOCUS_EFFECT)
target:addMod(xi.mod.ACC, effect:getPower() + jpLevel)
local jpLevel = target:getJobPointLevel(xi.jp.FOCUS_EFFECT)
local focusMod = target:getMod(xi.mod.FOCUS_EFFECT)
local monkLevel = utils.getActiveJobLevel(target, xi.job.MNK)

-- https://wiki.ffo.jp/html/2841.html
effect:addMod(xi.mod.ACC, monkLevel + 1 + focusMod + jpLevel)

-- https://www.bg-wiki.com/ffxi/Focus
effect:addMod(xi.mod.CRITHITRATE, math.floor((monkLevel + 1) * .2))
end

effectObject.onEffectTick = function(target, effect)
end

effectObject.onEffectLose = function(target, effect)
local jpLevel = target:getJobPointLevel(xi.jp.FOCUS_EFFECT)
target:delMod(xi.mod.ACC, effect:getPower() + jpLevel)
end

return effectObject
3 changes: 3 additions & 0 deletions scripts/enum/mod.lua
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,9 @@ xi.mod =
ENHANCES_RESTRAINT = 1045, -- Enhances "Restraint" effect/"Restraint" + (Increases the damage bonus of Restraint by XXX%)
ENHANCES_BLOOD_RAGE = 1046, -- Enhances "Blood Rage" effect/"Blood Rage" duration +

-- Monk
ADDITIVE_GUARD = 1092, -- Additive % bonus to final Guard rate (adds after clamp)

-- Paladin
ENHANCES_CHIVALRY = 1061, -- Enhances "Chivalry" effect (increases the base TP modifier by the provided value / 100, e.g. mod value 5 = +0.05)
ENHANCES_DIVINE_EMBLEM = 1062, -- Enhances "Divine Emblem" effect/"Divine Emblem" + (increases the ability's special enmity bonus by the provided value)
Expand Down
3 changes: 2 additions & 1 deletion scripts/globals/combat/physical_utilities.lua
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,8 @@ xi.combat.physical.calculateGuardRate = function(defender, attacker)
local attackerDex = attacker:getStat(xi.mod.DEX)
local defenderAgi = defender:getStat(xi.mod.AGI)

guardRate = utils.clamp(((guardSkill * 0.1 + (defenderAgi - attackerDex) * 0.125 + 10) * levelDiffMult), 5, 25)
-- Dodge's guard bonus goes over the cap
guardRate = utils.clamp(((guardSkill * 0.1 + (defenderAgi - attackerDex) * 0.125 + 10) * levelDiffMult), 5, 25) + defender:getMod(xi.mod.ADDITIVE_GUARD)

return guardRate
end
Expand Down
17 changes: 9 additions & 8 deletions scripts/globals/job_utils/monk.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ xi.job_utils.monk.useBoost = function(player, target, ability)
end
end

-- TODO: add Melee Gloves +2 aug
xi.job_utils.monk.useChakra = function(player, target, ability)
local chakraRemoval = player:getMod(xi.mod.CHAKRA_REMOVAL)

Expand All @@ -51,9 +52,13 @@ xi.job_utils.monk.useChakra = function(player, target, ability)
end
end

-- see https://www.bg-wiki.com/ffxi/Chakra
local monkLevel = utils.getActiveJobLevel(player, xi.job.MNK)
local jpModifier = target:getJobPointLevel(xi.jp.CHAKRA_EFFECT) -- NOTE: Level is the modified value, so 10 per point spent
local maxRecoveryAmount = (player:getStat(xi.mod.VIT) * (2 + player:getMod(xi.mod.CHAKRA_MULT) / 10)) + jpModifier
local recoveryAmount = math.min(player:getMaxHP() - player:getHP(), maxRecoveryAmount) -- TODO: Figure out "function of level" addition (August 2017 update)
local hpModifier = ((monkLevel + 1) * 0.2 / 100) * player:getMaxHP()
local chakraMultiplier = 1 + player:getMod(xi.mod.CHAKRA_MULT) / 100
local maxRecoveryAmount = (player:getStat(xi.mod.VIT) * 2 + hpModifier) * chakraMultiplier + jpModifier
local recoveryAmount = math.min(player:getMaxHP() - player:getHP(), maxRecoveryAmount)

player:setHP(player:getHP() + recoveryAmount)

Expand Down Expand Up @@ -94,15 +99,11 @@ xi.job_utils.monk.useCounterstance = function(player, target, ability)
end

xi.job_utils.monk.useDodge = function(player, target, ability)
local power = 20 + player:getMod(xi.mod.DODGE_EFFECT)

player:addStatusEffect(xi.effect.DODGE, power, 0, 120)
player:addStatusEffect(xi.effect.DODGE, 0, 0, 30)
end

xi.job_utils.monk.useFocus = function(player, target, ability)
local power = 20 + player:getMod(xi.mod.FOCUS_EFFECT)

player:addStatusEffect(xi.effect.FOCUS, power, 0, 120)
player:addStatusEffect(xi.effect.FOCUS, 0, 0, 30)
end

xi.job_utils.monk.useFootwork = function(player, target, ability)
Expand Down
6 changes: 3 additions & 3 deletions sql/abilities.sql
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ INSERT INTO `abilities` VALUES (32,'warcry',1,35,1,300,2,116,0,28,2000,0,6,20.0,
INSERT INTO `abilities` VALUES (33,'defender',1,25,1,180,3,117,0,1,2000,0,6,20.0,0,1,80,386,0,NULL);
INSERT INTO `abilities` VALUES (34,'aggressor',1,45,1,300,4,118,0,2,2000,0,6,20.0,0,1,80,390,0,NULL);
INSERT INTO `abilities` VALUES (35,'provoke',1,5,4,30,5,0,0,3,2000,0,6,18.0,0,1,1800,0,0,NULL);
INSERT INTO `abilities` VALUES (36,'focus',2,25,1,300,13,120,0,4,2000,0,6,20.0,0,1,300,448,0,NULL);
INSERT INTO `abilities` VALUES (37,'dodge',2,15,1,300,14,121,0,5,2000,0,6,20.0,0,1,300,450,0,NULL);
INSERT INTO `abilities` VALUES (38,'chakra',2,35,1,300,15,102,0,6,2000,0,6,20.0,0,1,300,452,0,NULL);
INSERT INTO `abilities` VALUES (36,'focus',2,25,1,120,13,120,0,4,2000,0,6,20.0,0,1,300,448,0,NULL);
INSERT INTO `abilities` VALUES (37,'dodge',2,15,1,120,14,121,0,5,2000,0,6,20.0,0,1,300,450,0,NULL);
INSERT INTO `abilities` VALUES (38,'chakra',2,35,1,180,15,102,0,6,2000,0,6,20.0,0,1,300,452,0,NULL);
INSERT INTO `abilities` VALUES (39,'boost',2,5,1,15,16,116,0,7,2000,0,6,20.0,0,1,300,0,0,NULL);
INSERT INTO `abilities` VALUES (40,'counterstance',2,45,1,300,17,0,0,8,2000,0,6,20.0,0,1,900,0,0,NULL);
INSERT INTO `abilities` VALUES (41,'steal',6,5,4,300,60,125,0,181,2000,0,3,4.4,0,1,300,0,0,NULL);
Expand Down
56 changes: 28 additions & 28 deletions sql/item_mods.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2703,13 +2703,13 @@ INSERT INTO `item_mods` VALUES (10690,23,17); -- ATT: 17
INSERT INTO `item_mods` VALUES (10690,161,-300); -- DMGPHYS: -300

-- Melee Gloves +2
INSERT INTO `item_mods` VALUES (10691,1,20); -- DEF: 20
INSERT INTO `item_mods` VALUES (10691,3,4); -- HPP: 4
INSERT INTO `item_mods` VALUES (10691,23,21); -- ATT: 21
INSERT INTO `item_mods` VALUES (10691,25,21); -- ACC: 21
INSERT INTO `item_mods` VALUES (10691,289,6); -- SUBTLE_BLOW: 6
INSERT INTO `item_mods` VALUES (10691,1026,8); -- CHAKRA_MULT: 8
INSERT INTO `item_mods` VALUES (10691,1027,6); -- CHAKRA_REMOVAL: 6
INSERT INTO `item_mods` VALUES (10691,1,20); -- DEF: 20
INSERT INTO `item_mods` VALUES (10691,3,4); -- HPP: 4
INSERT INTO `item_mods` VALUES (10691,23,21); -- ATT: 21
INSERT INTO `item_mods` VALUES (10691,25,21); -- ACC: 21
INSERT INTO `item_mods` VALUES (10691,289,6); -- SUBTLE_BLOW: 6
INSERT INTO `item_mods` VALUES (10691,1026,40); -- CHAKRA_MULT: 40 -- M = 0.4
INSERT INTO `item_mods` VALUES (10691,1027,6); -- CHAKRA_REMOVAL: 6

-- Clerics Mitts +2
INSERT INTO `item_mods` VALUES (10692,1,21); -- DEF: 21
Expand Down Expand Up @@ -13332,7 +13332,7 @@ INSERT INTO `item_mods` VALUES (12639,1,41); -- DEF: 41
INSERT INTO `item_mods` VALUES (12639,2,20); -- HP: 20
INSERT INTO `item_mods` VALUES (12639,10,3); -- VIT: 3
INSERT INTO `item_mods` VALUES (12639,25,5); -- ACC: 5
INSERT INTO `item_mods` VALUES (12639,1026,10); -- CHAKRA_MULT: 10
INSERT INTO `item_mods` VALUES (12639,1026,50); -- CHAKRA_MULT: 50 -- M = 0.5
INSERT INTO `item_mods` VALUES (12639,1027,1); -- CHAKRA_REMOVAL: 1

-- Healers Briault
Expand Down Expand Up @@ -22249,7 +22249,7 @@ INSERT INTO `item_mods` VALUES (14474,2,20); -- HP: 20
INSERT INTO `item_mods` VALUES (14474,8,6); -- STR: 6
INSERT INTO `item_mods` VALUES (14474,10,6); -- VIT: 6
INSERT INTO `item_mods` VALUES (14474,25,5); -- ACC: 5
INSERT INTO `item_mods` VALUES (14474,1026,10); -- CHAKRA_MULT: 10
INSERT INTO `item_mods` VALUES (14474,1026,50); -- CHAKRA_MULT: 50 -- M = 0.5
INSERT INTO `item_mods` VALUES (14474,1027,1); -- CHAKRA_REMOVAL: 1

-- Healers Briault +1
Expand Down Expand Up @@ -24435,12 +24435,12 @@ INSERT INTO `item_mods` VALUES (14909,23,14); -- ATT: 14
INSERT INTO `item_mods` VALUES (14909,27,2); -- ENMITY: 2

-- Melee Gloves +1
INSERT INTO `item_mods` VALUES (14910,1,16); -- DEF: 16
INSERT INTO `item_mods` VALUES (14910,3,3); -- HPP: 3
INSERT INTO `item_mods` VALUES (14910,23,18); -- ATT: 18
INSERT INTO `item_mods` VALUES (14910,289,5); -- SUBTLE_BLOW: 5
INSERT INTO `item_mods` VALUES (14910,1026,6); -- CHAKRA_MULT: 6
INSERT INTO `item_mods` VALUES (14910,1027,2); -- CHAKRA_REMOVAL: 2
INSERT INTO `item_mods` VALUES (14910,1,16); -- DEF: 16
INSERT INTO `item_mods` VALUES (14910,3,3); -- HPP: 3
INSERT INTO `item_mods` VALUES (14910,23,18); -- ATT: 18
INSERT INTO `item_mods` VALUES (14910,289,5); -- SUBTLE_BLOW: 5
INSERT INTO `item_mods` VALUES (14910,1026,30); -- CHAKRA_MULT: 30 -- M = 0.3
INSERT INTO `item_mods` VALUES (14910,1027,2); -- CHAKRA_REMOVAL: 2

-- Clerics Mitts +1
INSERT INTO `item_mods` VALUES (14911,1,17); -- DEF: 17
Expand Down Expand Up @@ -25593,12 +25593,12 @@ INSERT INTO `item_mods` VALUES (15102,23,12); -- ATT: 12
INSERT INTO `item_mods` VALUES (15102,27,2); -- ENMITY: 2

-- Melee Gloves
INSERT INTO `item_mods` VALUES (15103,1,15); -- DEF: 15
INSERT INTO `item_mods` VALUES (15103,3,3); -- HPP: 3
INSERT INTO `item_mods` VALUES (15103,23,16); -- ATT: 16
INSERT INTO `item_mods` VALUES (15103,289,4); -- SUBTLE_BLOW: 4
INSERT INTO `item_mods` VALUES (15103,1026,6); -- CHAKRA_MULT: 6
INSERT INTO `item_mods` VALUES (15103,1027,2); -- CHAKRA_REMOVAL: 2
INSERT INTO `item_mods` VALUES (15103,1,15); -- DEF: 15
INSERT INTO `item_mods` VALUES (15103,3,3); -- HPP: 3
INSERT INTO `item_mods` VALUES (15103,23,16); -- ATT: 16
INSERT INTO `item_mods` VALUES (15103,289,4); -- SUBTLE_BLOW: 4
INSERT INTO `item_mods` VALUES (15103,1026,30); -- CHAKRA_MULT: 30 -- M = 0.3
INSERT INTO `item_mods` VALUES (15103,1027,2); -- CHAKRA_REMOVAL: 2

-- Clerics Mitts
INSERT INTO `item_mods` VALUES (15104,1,16); -- DEF: 16
Expand Down Expand Up @@ -48222,7 +48222,7 @@ INSERT INTO `item_mods` VALUES (23108,31,63); -- MEVA: 63
INSERT INTO `item_mods` VALUES (23108,68,62); -- EVA: 62
INSERT INTO `item_mods` VALUES (23108,384,400); -- HASTE_GEAR: 400
INSERT INTO `item_mods` VALUES (23108,421,4); -- CRIT_DMG_INCREASE: 4
INSERT INTO `item_mods` VALUES (23108,1026,14); -- CHAKRA_MULT: 14
INSERT INTO `item_mods` VALUES (23108,1026,64); -- CHAKRA_MULT: 64 -- M = 0.64
INSERT INTO `item_mods` VALUES (23108,1027,1); -- CHAKRA_REMOVAL: 1

-- Theophany Briault +2
Expand Down Expand Up @@ -50095,7 +50095,7 @@ INSERT INTO `item_mods` VALUES (23198,68,32); -- EVA: 32
INSERT INTO `item_mods` VALUES (23198,73,5); -- STORETP: 5
INSERT INTO `item_mods` VALUES (23198,289,9); -- SUBTLE_BLOW: 9
INSERT INTO `item_mods` VALUES (23198,384,400); -- HASTE_GEAR: 4%
INSERT INTO `item_mods` VALUES (23198,1026,15); -- CHAKRA_MULT: 15
INSERT INTO `item_mods` VALUES (23198,1026,48); -- CHAKRA_MULT: 48 -- M = 0.48
INSERT INTO `item_mods` VALUES (23198,1027,6); -- CHAKRA_REMOVAL: 6

-- Piety Mitts +2
Expand Down Expand Up @@ -54291,7 +54291,7 @@ INSERT INTO `item_mods` VALUES (23443,31,73); -- MEVA: 73
INSERT INTO `item_mods` VALUES (23443,68,72); -- EVA: 72
INSERT INTO `item_mods` VALUES (23443,384,400); -- HASTE_GEAR: 400
INSERT INTO `item_mods` VALUES (23443,421,8); -- CRIT_DMG_INCREASE: 8
INSERT INTO `item_mods` VALUES (23443,1026,16); -- CHAKRA_MULT: 16
INSERT INTO `item_mods` VALUES (23443,1026,66); -- CHAKRA_MULT: 66 -- M = 0.66
INSERT INTO `item_mods` VALUES (23443,1027,1); -- CHAKRA_REMOVAL: 1

-- Theophany Briault +3
Expand Down Expand Up @@ -66454,7 +66454,7 @@ INSERT INTO `item_mods` VALUES (26978,31,18); -- MEVA: 18
INSERT INTO `item_mods` VALUES (26978,68,10); -- EVA: 10
INSERT INTO `item_mods` VALUES (26978,289,7); -- SUBTLE_BLOW: 7
INSERT INTO `item_mods` VALUES (26978,384,400); -- HASTE_GEAR: 400
INSERT INTO `item_mods` VALUES (26978,1026,10); -- CHAKRA_MULT: 10
INSERT INTO `item_mods` VALUES (26978,1026,42); -- CHAKRA_MULT: 42 -- M = 0.42
INSERT INTO `item_mods` VALUES (26978,1027,6); -- CHAKRA_REMOVAL: 6

-- Hesychasts Gloves +1
Expand All @@ -66474,7 +66474,7 @@ INSERT INTO `item_mods` VALUES (26979,31,26); -- MEVA: 26
INSERT INTO `item_mods` VALUES (26979,68,22); -- EVA: 22
INSERT INTO `item_mods` VALUES (26979,289,8); -- SUBTLE_BLOW: 8
INSERT INTO `item_mods` VALUES (26979,384,400); -- HASTE_GEAR: 400
INSERT INTO `item_mods` VALUES (26979,1026,12); -- CHAKRA_MULT: 12
INSERT INTO `item_mods` VALUES (26979,1026,45); -- CHAKRA_MULT: 45 -- M = 0.45
INSERT INTO `item_mods` VALUES (26979,1027,6); -- CHAKRA_REMOVAL: 6

-- Piety Mitts
Expand Down Expand Up @@ -75212,7 +75212,7 @@ INSERT INTO `item_mods` VALUES (27808,29,2); -- MDEF: 2
INSERT INTO `item_mods` VALUES (27808,31,36); -- MEVA: 36
INSERT INTO `item_mods` VALUES (27808,68,24); -- EVA: 24
INSERT INTO `item_mods` VALUES (27808,384,400); -- HASTE_GEAR: 400
INSERT INTO `item_mods` VALUES (27808,1026,12); -- CHAKRA_MULT: 12
INSERT INTO `item_mods` VALUES (27808,1026,60); -- CHAKRA_MULT: 60 -- M = 0.6
INSERT INTO `item_mods` VALUES (27808,1027,1); -- CHAKRA_REMOVAL: 1

-- Theophany Briault
Expand Down Expand Up @@ -75611,7 +75611,7 @@ INSERT INTO `item_mods` VALUES (27829,29,4); -- MDEF: 4
INSERT INTO `item_mods` VALUES (27829,31,53); -- MEVA: 53
INSERT INTO `item_mods` VALUES (27829,68,52); -- EVA: 52
INSERT INTO `item_mods` VALUES (27829,384,400); -- HASTE_GEAR: 400
INSERT INTO `item_mods` VALUES (27829,1026,12); -- CHAKRA_MULT: 12
INSERT INTO `item_mods` VALUES (27829,1026,62); -- CHAKRA_MULT: 62 -- M = 0.62
INSERT INTO `item_mods` VALUES (27829,1027,1); -- CHAKRA_REMOVAL: 1

-- Theophany Briault +1
Expand Down
6 changes: 3 additions & 3 deletions sql/merits.sql
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ INSERT INTO `merits` VALUES (386,'defender_recast',5,6,1,6,5);
INSERT INTO `merits` VALUES (388,'warcry_recast',5,10,1,6,5);
INSERT INTO `merits` VALUES (390,'aggressor_recast',5,10,1,6,5);
INSERT INTO `merits` VALUES (392,'double_attack_rate',5,1,1,6,5);
INSERT INTO `merits` VALUES (448,'focus_recast',5,10,2,6,6);
INSERT INTO `merits` VALUES (450,'dodge_recast',5,10,2,6,6);
INSERT INTO `merits` VALUES (452,'chakra_recast',5,10,2,6,6);
INSERT INTO `merits` VALUES (448,'focus_recast',5,4,2,6,6);
INSERT INTO `merits` VALUES (450,'dodge_recast',5,4,2,6,6);
INSERT INTO `merits` VALUES (452,'chakra_recast',5,6,2,6,6);
INSERT INTO `merits` VALUES (454,'counter_rate',5,1,2,6,6);
INSERT INTO `merits` VALUES (456,'kick_attack_rate',5,1,2,6,6);
INSERT INTO `merits` VALUES (512,'divine_seal_recast',5,20,4,6,7);
Expand Down
3 changes: 2 additions & 1 deletion src/map/modifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ enum class Mod
COUNTERSTANCE_EFFECT = 543, // Counterstance effect in percents
DODGE_EFFECT = 552, // Dodge effect in percents
FOCUS_EFFECT = 561, // Focus effect in percents
ADDITIVE_GUARD = 1092, // Additive % bonus to final Guard rate (adds after clamp)

// White Mage
AFFLATUS_SOLACE = 293, // Pool of HP accumulated during Afflatus Solace
Expand Down Expand Up @@ -1030,7 +1031,7 @@ enum class Mod
// The spares take care of finding the next ID to use so long as we don't forget to list IDs that have been freed up by refactoring.
// 570 through 825 used by WS DMG mods these are not spares.
//
// SPARE IDs: 1092 and onward
// SPARE IDs: 1093 and onward
};

// temporary workaround for using enum class as unordered_map key until compilers support it
Expand Down
3 changes: 2 additions & 1 deletion src/map/utils/battleutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2050,7 +2050,8 @@ namespace battleutils
float dex = PAttacker->DEX();
float agi = PDefender->AGI();

return std::clamp<uint8>((uint8)((skill * 0.1f + (agi - dex) * 0.125f + 10.0f) * diff), 5, 25);
// Dodge's guard bonus goes over the cap
return std::clamp<uint8>((uint8)((skill * 0.1f + (agi - dex) * 0.125f + 10.0f) * diff), 5, 25) + PDefender->getMod(Mod::ADDITIVE_GUARD);
}

return 0;
Expand Down

0 comments on commit a2410cd

Please sign in to comment.