Skip to content

Commit e53fb9c

Browse files
author
LocalIdentity
committed
Add support for Black Scythe Training Keystone
Adds support for the mod the following mods Chance to Evade Hits is based off of 200% of your Ward instead of your Evasion Rating Physical Damage Reduction from Hits is based off of 200% of your Ward instead of your Armour Correctly apply damage reduction calcs just for physical damage and have it override mods like Transcendence that stops armour from applying to pdr
1 parent 54f9313 commit e53fb9c

3 files changed

Lines changed: 38 additions & 12 deletions

File tree

src/Data/ModCache.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8093,8 +8093,7 @@ c["Chance to Block Spell Damage is Unlucky"]={{[1]={flags=0,keywordFlags=0,name=
80938093
c["Chance to Block Spell Damage is doubled"]={{[1]={flags=0,keywordFlags=0,name="SpellBlockChance",type="MORE",value=100}},nil}
80948094
c["Chance to Block is Lucky"]={{[1]={flags=0,keywordFlags=0,name="BlockChanceIsLucky",type="FLAG",value=true},[2]={flags=0,keywordFlags=0,name="ProjectileBlockChanceIsLucky",type="FLAG",value=true},[3]={flags=0,keywordFlags=0,name="SpellBlockChanceIsLucky",type="FLAG",value=true},[4]={flags=0,keywordFlags=0,name="SpellProjectileBlockChanceIsLucky",type="FLAG",value=true}},nil}
80958095
c["Chance to Block is Unlucky"]={{[1]={flags=0,keywordFlags=0,name="BlockChanceIsUnlucky",type="FLAG",value=true},[2]={flags=0,keywordFlags=0,name="ProjectileBlockChanceIsUnlucky",type="FLAG",value=true},[3]={flags=0,keywordFlags=0,name="SpellBlockChanceIsUnlucky",type="FLAG",value=true},[4]={flags=0,keywordFlags=0,name="SpellProjectileBlockChanceIsUnlucky",type="FLAG",value=true}},nil}
8096-
c["Chance to Evade Hits is based off of 200% of your Ward instead of your Evasion Rating"]={nil,"Chance to Evade Hits is based off of 200% of your Ward instead of your Evasion Rating "}
8097-
c["Chance to Evade Hits is based off of 200% of your Ward instead of your Evasion Rating Physical Damage Reduction from Hits is based off of 200% of your Ward instead of your Armour"]={nil,"Chance to Evade Hits is based off of 200% of your Ward instead of your Evasion Rating Physical Damage Reduction from Hits is based off of 200% of your Ward instead of your Armour "}
8096+
c["Chance to Evade Hits is based off of 200% of your Ward instead of your Evasion Rating"]={{[1]={flags=0,keywordFlags=0,name="EvadeChanceBasedOnWard",type="FLAG",value=true},[2]={flags=0,keywordFlags=0,name="EvadeChanceBasedOnWardPercent",source="Black Scythe Training",type="OVERRIDE",value=200}},nil}
80988097
c["Chance to Suppress Spell Damage is Lucky"]={{[1]={flags=0,keywordFlags=0,name="SpellSuppressionChanceIsLucky",type="FLAG",value=true}},nil}
80998098
c["Channelling Skills deal 12% increased Damage"]={{[1]={[1]={skillType=57,type="SkillType"},flags=0,keywordFlags=0,name="Damage",type="INC",value=12}},nil}
81008099
c["Channelling Skills deal 20% increased Damage"]={{[1]={[1]={skillType=57,type="SkillType"},flags=0,keywordFlags=0,name="Damage",type="INC",value=20}},nil}
@@ -10439,7 +10438,7 @@ c["Permanently Intimidate Enemies on Block"]={{[1]={[1]={type="Condition",var="B
1043910438
c["Petrified during Effect"]={nil,"Petrified during Effect "}
1044010439
c["Petrified during Effect +50% Chance to Block Attack Damage during Effect"]={nil,"Petrified during Effect +50% Chance to Block Attack Damage during Effect "}
1044110440
c["Phasing"]={{[1]={flags=0,keywordFlags=0,name="Condition:Phasing",type="FLAG",value=true}},nil}
10442-
c["Physical Damage Reduction from Hits is based off of 200% of your Ward instead of your Armour"]={nil,"Physical Damage Reduction from Hits is based off of 200% of your Ward instead of your Armour "}
10441+
c["Physical Damage Reduction from Hits is based off of 200% of your Ward instead of your Armour"]={{[1]={flags=0,keywordFlags=0,name="PhysicalReductionBasedOnWard",type="FLAG",value=true},[2]={flags=0,keywordFlags=0,name="PhysicalReductionBasedOnWardPercent",source="Black Scythe Training",type="OVERRIDE",value=200}},nil}
1044310442
c["Physical Damage of Enemies Hitting you is Unlucky"]={nil,"Physical Damage of Enemies Hitting you is Unlucky "}
1044410443
c["Physical Damage taken bypasses Energy Shield"]={{[1]={flags=0,keywordFlags=0,name="PhysicalEnergyShieldBypass",type="BASE",value=100}},nil}
1044510444
c["Plague Bearer has 20% increased Maximum Plague Value"]={{}," Maximum Plague Value "}

src/Modules/CalcDefence.lua

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,13 @@ function calcs.applyDmgTakenConversion(activeSkill, output, breakdown, sourceTyp
8484
local reductMult = 1
8585

8686
local percentOfArmourApplies = m_min((not activeSkill.skillModList:Flag(nil, "ArmourDoesNotApplyTo"..damageType.."DamageTaken") and activeSkill.skillModList:Sum("BASE", nil, "ArmourAppliesTo"..damageType.."DamageTaken") or 0), 100)
87-
if percentOfArmourApplies > 0 then
87+
local physicalReductionBasedOnWard = damageType == "Physical" and activeSkill.skillModList:Flag(nil, "PhysicalReductionBasedOnWard")
88+
if percentOfArmourApplies > 0 or physicalReductionBasedOnWard then
8889
local effArmour = (output.Armour * percentOfArmourApplies / 100) * (1 + output.ArmourDefense)
90+
if physicalReductionBasedOnWard then
91+
local multiplier = activeSkill.skillModList:Override(nil, "PhysicalReductionBasedOnWardPercent") / 100
92+
effArmour = output.Ward * multiplier
93+
end
8994
local effDamage = damage * resMult
9095
armourReduct = round(effArmour ~= 0 and damage * resMult ~= 0 and (effArmour / (effArmour + effDamage * 5) * 100) or 0)
9196
armourReduct = m_min(output.DamageReductionMax, armourReduct)
@@ -1068,9 +1073,18 @@ function calcs.defence(env, actor)
10681073
local enemyAccuracy = round(calcLib.val(enemyDB, "Accuracy"))
10691074
local evadeChance = modDB:Sum("BASE", nil, "EvadeChance")
10701075
local hitChance = calcLib.mod(enemyDB, nil, "HitChance")
1071-
output.EvadeChance = 100 - (calcs.hitChance(output.Evasion, enemyAccuracy) - evadeChance) * hitChance
1072-
output.MeleeEvadeChance = m_max(0, m_min(data.misc.EvadeChanceCap, (100 - (calcs.hitChance(output.MeleeEvasion, enemyAccuracy) - evadeChance) * hitChance) * calcLib.mod(modDB, nil, "EvadeChance", "MeleeEvadeChance")))
1073-
output.ProjectileEvadeChance = m_max(0, m_min(data.misc.EvadeChanceCap, (100 - (calcs.hitChance(output.ProjectileEvasion, enemyAccuracy) - evadeChance) * hitChance) * calcLib.mod(modDB, nil, "EvadeChance", "ProjectileEvadeChance")))
1076+
local evadeStat = output.Evasion
1077+
local meleeEvadeStat= output.MeleeEvasion
1078+
local projectileEvadeStat= output.ProjectileEvasion
1079+
if modDB:Flag(nil, "EvadeChanceBasedOnWard") then
1080+
local multiplier = modDB:Override(nil, "EvadeChanceBasedOnWardPercent") / 100
1081+
evadeStat = output.Ward * multiplier
1082+
meleeEvadeStat = evadeStat
1083+
projectileEvadeStat = evadeStat
1084+
end
1085+
output.EvadeChance = 100 - (calcs.hitChance(evadeStat, enemyAccuracy) - evadeChance) * hitChance
1086+
output.MeleeEvadeChance = m_max(0, m_min(data.misc.EvadeChanceCap, (100 - (calcs.hitChance(meleeEvadeStat, enemyAccuracy) - evadeChance) * hitChance) * calcLib.mod(modDB, nil, "EvadeChance", "MeleeEvadeChance")))
1087+
output.ProjectileEvadeChance = m_max(0, m_min(data.misc.EvadeChanceCap, (100 - (calcs.hitChance(projectileEvadeStat, enemyAccuracy) - evadeChance) * hitChance) * calcLib.mod(modDB, nil, "EvadeChance", "ProjectileEvadeChance")))
10741088
-- Condition for displaying evade chance only if melee or projectile evade chance have the same values
10751089
if output.MeleeEvadeChance ~= output.ProjectileEvadeChance then
10761090
output.splitEvade = true
@@ -1087,13 +1101,13 @@ function calcs.defence(env, actor)
10871101
breakdown.MeleeEvadeChance = {
10881102
s_format("Enemy level: %d ^8(%s the Configuration tab)", env.enemyLevel, env.configInput.enemyLevel and "overridden from" or "can be overridden in"),
10891103
s_format("Average enemy accuracy: %d", enemyAccuracy),
1090-
s_format("Effective Evasion: %d", output.MeleeEvasion),
1104+
s_format("Effective Evasion: %d", meleeEvadeStat),
10911105
s_format("Approximate melee evade chance: %d%%", output.MeleeEvadeChance),
10921106
}
10931107
breakdown.ProjectileEvadeChance = {
10941108
s_format("Enemy level: %d ^8(%s the Configuration tab)", env.enemyLevel, env.configInput.enemyLevel and "overridden from" or "can be overridden in"),
10951109
s_format("Average enemy accuracy: %d", enemyAccuracy),
1096-
s_format("Effective Evasion: %d", output.ProjectileEvasion),
1110+
s_format("Effective Evasion: %d", projectileEvadeStat),
10971111
s_format("Approximate projectile evade chance: %d%%", output.ProjectileEvadeChance),
10981112
}
10991113
end
@@ -1942,6 +1956,11 @@ function calcs.buildDefenceEstimations(env, actor)
19421956
local impaleArmourReduct = 0
19431957
local percentOfArmourApplies = m_min((not modDB:Flag(nil, "ArmourDoesNotApplyTo"..damageType.."DamageTaken") and modDB:Sum("BASE", nil, "ArmourAppliesTo"..damageType.."DamageTaken") or 0), 100)
19441958
local effectiveAppliedArmour = (output.Armour * percentOfArmourApplies / 100) * (1 + output.ArmourDefense)
1959+
local physicalReductionBasedOnWard = damageType == "Physical" and modDB:Flag(nil, "PhysicalReductionBasedOnWard")
1960+
if physicalReductionBasedOnWard then
1961+
local multiplier = modDB:Override(nil, "PhysicalReductionBasedOnWardPercent") / 100
1962+
effectiveAppliedArmour = output.Ward * multiplier
1963+
end
19451964
local resMult = 1 - (resist - enemyPen) / 100
19461965
local reductMult = 1
19471966
local takenFlat = modDB:Sum("BASE", nil, "DamageTaken", damageType.."DamageTaken", "DamageTakenWhenHit", damageType.."DamageTakenWhenHit")
@@ -1953,7 +1972,7 @@ function calcs.buildDefenceEstimations(env, actor)
19531972
takenFlat = takenFlat + modDB:Sum("BASE", nil, "DamageTakenFromAttacks", damageType.."DamageTakenFromAttacks") / 2 + modDB:Sum("BASE", nil, damageType.."DamageTakenFromProjectileAttacks") / 4 + modDB:Sum("BASE", nil, "DamageTakenFromSpells", damageType.."DamageTakenFromSpells") / 2 + modDB:Sum("BASE", nil, "DamageTakenFromSpellProjectiles", damageType.."DamageTakenFromSpellProjectiles") / 4
19541973
end
19551974
output[damageType.."takenFlat"] = takenFlat
1956-
if percentOfArmourApplies > 0 then
1975+
if percentOfArmourApplies > 0 or physicalReductionBasedOnWard then
19571976
armourReduct = calcs.armourReduction(effectiveAppliedArmour, damage * resMult)
19581977
armourReduct = m_min(output.DamageReductionMax, armourReduct)
19591978
if impaleDamage > 0 then
@@ -1975,7 +1994,7 @@ function calcs.buildDefenceEstimations(env, actor)
19751994
else
19761995
t_insert(breakdown[damageType.."DamageReduction"], s_format("Enemy Hit Damage: %d ^8(total incoming damage)", damage))
19771996
end
1978-
if percentOfArmourApplies ~= 100 then
1997+
if percentOfArmourApplies ~= 100 and not physicalReductionBasedOnWard then
19791998
t_insert(breakdown[damageType.."DamageReduction"], s_format("%d%% percent of armour applies", percentOfArmourApplies))
19801999
end
19812000
t_insert(breakdown[damageType.."DamageReduction"], s_format("Reduction from Armour: %d%%", armourReduct))
@@ -2035,7 +2054,7 @@ function calcs.buildDefenceEstimations(env, actor)
20352054
else
20362055
t_insert(breakdown[damageType.."TakenHitMult"], s_format("Enemy Hit Damage: %d ^8(total incoming damage)", damage))
20372056
end
2038-
if percentOfArmourApplies ~= 100 then
2057+
if percentOfArmourApplies ~= 100 and not physicalReductionBasedOnWard then
20392058
t_insert(breakdown[damageType.."TakenHitMult"], s_format("%d%% percent of armour applies", percentOfArmourApplies))
20402059
end
20412060
t_insert(breakdown[damageType.."TakenHitMult"], s_format("Reduction from Armour: %.2f", 1 - armourReduct / 100))

src/Modules/ModParser.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,6 +2109,14 @@ local specialModList = {
21092109
flag("ConvertSpellSuppressionToSpellDodge"),
21102110
mod("SpellSuppressionChance", "OVERRIDE", 0, "Acrobatics"),
21112111
},
2112+
["chance to evade hits is based off of (%d+)%% of your ward instead of your evasion rating"] = function(num) return {
2113+
flag("EvadeChanceBasedOnWard"),
2114+
mod("EvadeChanceBasedOnWardPercent", "OVERRIDE", num, "Black Scythe Training"),
2115+
} end,
2116+
["physical damage reduction from hits is based off of (%d+)%% of your ward instead of your armour"] = function(num) return {
2117+
flag("PhysicalReductionBasedOnWard"),
2118+
mod("PhysicalReductionBasedOnWardPercent", "OVERRIDE", num, "Black Scythe Training"),
2119+
} end,
21122120
["maximum chance to dodge spell hits is (%d+)%%"] = function(num) return { mod("SpellDodgeChanceMax", "OVERRIDE", num, "Acrobatics") } end,
21132121
["dexterity provides no bonus to evasion rating"] = { flag("NoDexBonusToEvasion") },
21142122
["dexterity provides no inherent bonus to evasion rating"] = { flag("NoDexBonusToEvasion") },

0 commit comments

Comments
 (0)