Skip to content

Commit f285f49

Browse files
authored
Add support for "Penetrate" (Amazon Ascendancy Notable) (#932)
* Adjust SumInternal from ModDB to work with source that contain multiple ":" * Add isMartialWeapon local function to CalcOffence * Add certain weapon base stats to output in CalcOffence for "PerStat" mods * Add support for generic "attacks using your weapons" mods via preFlag * Add support for "Penetrate" (Amazon Ascendancy Notable) * Fix typo "calssified" to "classified" --------- Co-authored-by: majochem <majochem@users.noreply.github.com>
1 parent ae5a764 commit f285f49

File tree

4 files changed

+44
-5
lines changed

4 files changed

+44
-5
lines changed

src/Classes/ModDB.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function ModDBClass:SumInternal(context, modType, cfg, flags, keywordFlags, sour
9696
if modList then
9797
for i = 1, #modList do
9898
local mod = modList[i]
99-
if mod.type == modType and band(flags, mod.flags) == mod.flags and MatchKeywordFlags(keywordFlags, mod.keywordFlags) and (not source or ( mod.source and mod.source:match("[^:]+") == source )) then
99+
if mod.type == modType and band(flags, mod.flags) == mod.flags and MatchKeywordFlags(keywordFlags, mod.keywordFlags) and (not source or ( mod.source and (mod.source:match("[^:]+") == source or mod.source == source))) then
100100
if mod[1] then
101101
local value = context:EvalMod(mod, cfg) or 0
102102
if mod[1].globalLimit and mod[1].globalLimitKey then

src/Data/ModCache.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3452,8 +3452,8 @@ c["Attacks have +1% to Critical Hit Chance"]={{[1]={flags=1,keywordFlags=0,name=
34523452
c["Attacks have 10% chance to Maim on Hit"]={{}," to Maim "}
34533453
c["Attacks have 25% chance to Maim on Hit"]={{}," to Maim "}
34543454
c["Attacks used by Totems have 4% increased Attack Speed"]={{[1]={flags=1,keywordFlags=16384,name="Speed",type="INC",value=4}},nil}
3455-
c["Attacks using your Weapons have Added Physical Damage equal"]={nil,"Attacks using your Weapons have Added Physical Damage equal "}
3456-
c["Attacks using your Weapons have Added Physical Damage equal to 25% of the Accuracy Rating on the Weapon"]={nil,"Attacks using your Weapons have Added Physical Damage equal to 25% of the Accuracy Rating on the Weapon "}
3455+
c["Attacks using your Weapons have Added Physical Damage equal"]={nil,"Added Physical Damage equal "}
3456+
c["Attacks using your Weapons have Added Physical Damage equal to 25% of the Accuracy Rating on the Weapon"]={{[1]={[1]={percent="25",stat="AccuracyOnWeapon 1",type="PercentStat"},[2]={neg=true,skillType=167,type="SkillType"},[3]={type="Condition",var="MainHandAttack"},flags=1,keywordFlags=0,name="PhysicalMin",type="BASE",value=1},[2]={[1]={percent="25",stat="AccuracyOnWeapon 1",type="PercentStat"},[2]={neg=true,skillType=167,type="SkillType"},[3]={type="Condition",var="MainHandAttack"},flags=1,keywordFlags=0,name="PhysicalMax",type="BASE",value=1},[3]={[1]={percent="25",stat="AccuracyOnWeapon 2",type="PercentStat"},[2]={neg=true,skillType=167,type="SkillType"},[3]={type="Condition",var="OffHandAttack"},flags=1,keywordFlags=0,name="PhysicalMin",type="BASE",value=1},[4]={[1]={percent="25",stat="AccuracyOnWeapon 2",type="PercentStat"},[2]={neg=true,skillType=167,type="SkillType"},[3]={type="Condition",var="OffHandAttack"},flags=1,keywordFlags=0,name="PhysicalMax",type="BASE",value=1}},nil}
34573457
c["Attacks with this Weapon gain 50% of Physical damage as Extra damage of each Element"]={{[1]={[1]={type="Condition",var="{Hand}Attack"},[2]={skillType=1,type="SkillType"},flags=0,keywordFlags=0,name="PhysicalDamage",type="BASE",value=50}}," as Extra damage of each Element "}
34583458
c["Attribute Requirements of Gems can be satisified by your highest Attribute"]={{[1]={flags=0,keywordFlags=0,name="GemAttributeRequirementsSatisfiedByHighestAttribute",type="FLAG",value=true}},nil}
34593459
c["Aura Skills have 1% more Aura Effect per 2% of maximum Mana they Reserve"]={{[1]={[1]={skillType=39,type="SkillType"},[2]={div=2,stat="ManaReservedPercent",type="PerStat"},flags=0,keywordFlags=0,name="AuraEffect",type="MORE",value=1}},nil}
@@ -4678,8 +4678,6 @@ c["of their maximum Life as Physical Damage"]={nil,"of their maximum Life as Phy
46784678
c["of their maximum Life as Physical Damage Chance is doubled against Undead and Demons"]={nil,"of their maximum Life as Physical Damage Chance is doubled against Undead and Demons "}
46794679
c["the enemy's Power for 6 seconds, up to a total of 500"]={nil,"the enemy's Power for 6 seconds, up to a total of 500 "}
46804680
c["the same damage to enemies within 1.8 metres"]={nil,"the same damage to enemies within 1.8 metres "}
4681-
c["to 25% of the Accuracy Rating on the Weapon"]={nil,"to 25% of the Accuracy Rating on the Weapon "}
4682-
c["to 25% of your main hand Weapon's Damage"]={nil,"to 25% of your main hand Weapon's Damage "}
46834681
c["until you take no Damage to Life for 5 seconds"]={nil,"until you take no Damage to Life for 5 seconds "}
46844682
c["your Ailments on them"]={nil,"your Ailments on them "}
46854683
c["your Ailments on them 30% reduced Duration of Ignite, Shock and Chill on Enemies"]={nil,"your Ailments on them 30% reduced Duration of Ignite, Shock and Chill on Enemies "}

src/Modules/CalcOffence.lua

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,22 @@ function calcs.offence(env, actor, activeSkill)
527527
func(activeSkill, output, breakdown)
528528
end
529529
end
530+
-- Checks if a given item is classified as a martial weapon base on global data.weaponTypeInfo table
531+
-- Note: long-term it might be better to add "MartialWeapon" flags to items instead potentially once PR #688 is complete
532+
---@param item table @item as contained in actor.itemList
533+
---@return boolean
534+
local function isMartialWeapon(item)
535+
local itemType = item.type or "None"
536+
if itemType == "Staff" and not (item.base.subType == "Warstaff" or (item.baseName and item.baseName:find("Quarterstaff"))) then return false end -- Workaround to rule out caster staves
537+
local nonMartialWeapons = {"None", "Wand", "Fishing Rod" } -- filter out other non-martial bases
538+
for _, val in pairs(nonMartialWeapons) do
539+
if val == itemType then return false end
540+
end
541+
for key, _ in pairs(data.weaponTypeInfo) do
542+
if itemType == key then return true end
543+
end
544+
return false
545+
end
530546

531547
runSkillFunc("initialFunc")
532548

@@ -617,6 +633,24 @@ function calcs.offence(env, actor, activeSkill)
617633
end
618634
end
619635
end
636+
-- Add weapon base stats to output for use in mods like Tactician's ""Watch How I Do It" Ascendancy notable" and Amazon's "Penetrate"
637+
-- Note: This might run into issues with Energy Blade or similar mechanics that could "replace" the weapon items, but it's hard to test because PoE2 doesn't have those mechanics yet
638+
for i in pairs({ "1", "2" }) do
639+
-- Section for martial weapons only for now
640+
if actor.itemList["Weapon " .. i] and isMartialWeapon(actor.itemList["Weapon " .. i]) then
641+
-- Add base min and max damage
642+
for _, damageType in ipairs(dmgTypeList) do
643+
if actor.itemList["Weapon " .. i] and actor["weaponData" .. i][damageType .. "Min"] then
644+
output[damageType .. "Min" .. "OnWeapon " .. i] = actor["weaponData" .. i][damageType .. "Min"]
645+
end
646+
if actor["weaponData" .. i][damageType .. "Max"] then
647+
output[damageType .. "Max" .. "OnWeapon " .. i] = actor["weaponData" .. i][damageType .. "Max"]
648+
end
649+
end
650+
-- Add total local accuracy
651+
output["AccuracyOnWeapon " .. i] = actor.itemList["Weapon " .. i].baseModList:Sum("BASE", nil, "Accuracy")
652+
end
653+
end
620654
if skillModList:Flag(nil, "MinionDamageAppliesToPlayer") or skillModList:Flag(skillCfg, "MinionDamageAppliesToPlayer") then
621655
-- Minion Damage conversion from Spiritual Aid and The Scourge
622656
local multiplier = (skillModList:Max(skillCfg, "ImprovedMinionDamageAppliesToPlayer") or 100) / 100

src/Modules/ModParser.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,7 @@ local preFlagList = {
11441144
["^hits with this weapon [hd][ae][va][el] "] = { flags = ModFlag.Hit, tagList = { { type = "Condition", var = "{Hand}Attack" }, { type = "SkillType", skillType = SkillType.Attack } } },
11451145
-- Skill types
11461146
["^attacks [ghd][ae][iva][eln] "] = { flags = ModFlag.Attack },
1147+
["^attacks using your weapons [ghd][ae][iva][eln] "] = { flags = ModFlag.Attack, tag = { type = "SkillType", skillType = SkillType.NonWeaponAttack, neg = true }},
11471148
["^attack skills [hd][ae][va][el] "] = { keywordFlags = KeywordFlag.Attack },
11481149
["^spells [hd][ae][va][el] a? ?"] = { flags = ModFlag.Spell },
11491150
["^spell skills [hd][ae][va][el] "] = { keywordFlags = KeywordFlag.Spell },
@@ -2410,6 +2411,12 @@ local specialModList = {
24102411
-- Amazon
24112412
["chance to hit with attacks can exceed 100%%"] = {flag("Condition:HitChanceCanExceed100", { type = "Skilltype", skillType = SkillType.Attack})},
24122413
["gain additional critical hit chance equal to (%d+)%% of excess chance to hit with attacks"] = function(num) return { mod("CritChance", "BASE", 0.01 * num, { type = "Multiplier", var = "ExcessHitChance" }, { type = "SkillType", skillType = SkillType.Attack})} end,
2414+
["attacks using your weapons have added (%a+) damage equal to (%d+)%% of the accuracy rating on the weapon"] = function(_, dmgType, num) return {
2415+
mod(firstToUpper(dmgType) .. "Min", "BASE", 1, nil, ModFlag.Attack, { type = "PercentStat", stat = "AccuracyOnWeapon 1", percent = num }, { type = "SkillType", skillType = SkillType.NonWeaponAttack, neg = true } , { type = "Condition", var = "MainHandAttack" }),
2416+
mod(firstToUpper(dmgType) .. "Max", "BASE", 1, nil, ModFlag.Attack, { type = "PercentStat", stat = "AccuracyOnWeapon 1", percent = num }, { type = "SkillType", skillType = SkillType.NonWeaponAttack, neg = true } , { type = "Condition", var = "MainHandAttack" }),
2417+
mod(firstToUpper(dmgType) .. "Min", "BASE", 1, nil, ModFlag.Attack, { type = "PercentStat", stat = "AccuracyOnWeapon 2", percent = num }, { type = "SkillType", skillType = SkillType.NonWeaponAttack, neg = true } , { type = "Condition", var = "OffHandAttack" }),
2418+
mod(firstToUpper(dmgType) .. "Max", "BASE", 1, nil, ModFlag.Attack, { type = "PercentStat", stat = "AccuracyOnWeapon 2", percent = num }, { type = "SkillType", skillType = SkillType.NonWeaponAttack, neg = true } , { type = "Condition", var = "OffHandAttack" }),
2419+
} end,
24132420
-- Ascendant
24142421
["grants (%d+) passive skill points?"] = function(num) return { mod("ExtraPoints", "BASE", num) } end,
24152422
["can allocate passives from the %a+'s starting point"] = { },

0 commit comments

Comments
 (0)