Skip to content

Commit d641bb4

Browse files
1 parent 75f06dc commit d641bb4

8 files changed

Lines changed: 147 additions & 0 deletions

File tree

src/Classes/ModDB.lua

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ local ipairs = ipairs
77
local pairs = pairs
88
local select = select
99
local t_insert = table.insert
10+
local t_remove = table.remove
1011
local m_floor = math.floor
1112
local m_min = math.min
1213
local m_max = math.max
@@ -64,6 +65,45 @@ function ModDBClass:ReplaceModInternal(mod)
6465
return false
6566
end
6667

68+
---ConvertModInternal
69+
--- Converts an existing mod with oldName to a new mod with a different name.
70+
--- Moves the mod from the old name's bucket to the new name's bucket.
71+
--- If no matching mod exists, then the function returns false
72+
---@param oldName string @The name of the existing mod to find
73+
---@param mod table @The new mod to replace it with
74+
---@return boolean @Whether any mod was converted
75+
function ModDBClass:ConvertModInternal(oldName, mod)
76+
if not self.mods[oldName] then
77+
if self.parent then
78+
return self.parent:ConvertModInternal(oldName, mod)
79+
end
80+
return false
81+
end
82+
83+
local oldList = self.mods[oldName]
84+
for i = 1, #oldList do
85+
local curMod = oldList[i]
86+
if oldName == curMod.name and mod.type == curMod.type and mod.flags == curMod.flags and mod.keywordFlags == curMod.keywordFlags and mod.source == curMod.source and not curMod.converted then
87+
-- Remove from old name's bucket
88+
t_remove(oldList, i)
89+
-- Add to new name's bucket
90+
local newName = mod.name
91+
if not self.mods[newName] then
92+
self.mods[newName] = { }
93+
end
94+
mod.converted = true
95+
t_insert(self.mods[newName], mod)
96+
return true
97+
end
98+
end
99+
100+
if self.parent then
101+
return self.parent:ConvertModInternal(oldName, mod)
102+
end
103+
104+
return false
105+
end
106+
67107
function ModDBClass:AddList(modList)
68108
local mods = self.mods
69109
for i, mod in ipairs(modList) do

src/Classes/ModList.lua

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,27 @@ function ModListClass:ReplaceModInternal(mod)
4545
return false
4646
end
4747

48+
---ConvertModInternal
49+
--- Converts an existing mod with oldName to a new mod with a different name.
50+
--- If no matching mod exists, then the function returns false
51+
---@param oldName string @The name of the existing mod to find
52+
---@param mod table @The new mod to replace it with
53+
---@return boolean @Whether any mod was converted
54+
function ModListClass:ConvertModInternal(oldName, mod)
55+
for i, curMod in ipairs(self) do
56+
if oldName == curMod.name and mod.type == curMod.type and mod.flags == curMod.flags and mod.keywordFlags == curMod.keywordFlags and mod.source == curMod.source then
57+
self[i] = mod
58+
return true
59+
end
60+
end
61+
62+
if self.parent then
63+
return self.parent:ConvertModInternal(oldName, mod)
64+
end
65+
66+
return false
67+
end
68+
4869
function ModListClass:MergeMod(mod, skipNonAdditive)
4970
if mod.type == "BASE" or mod.type == "INC" or mod.type == "MORE" then
5071
for i = 1, #self do

src/Classes/ModStore.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,19 @@ function ModStoreClass:ReplaceMod(...)
110110
end
111111
end
112112

113+
---ConvertMod
114+
--- Converts an existing mod to a new name, replacing it in the store.
115+
--- Finds a mod matching oldName with the same type, flags, keywordFlags, and source as the new mod.
116+
--- If no matching mod exists, the new mod is added instead.
117+
---@param oldName string @The name of the existing mod to convert
118+
---@param ... any @Parameters to be passed along to the modLib.createMod function (new name, type, value, source, ...)
119+
function ModStoreClass:ConvertMod(oldName, ...)
120+
local mod = mod_createMod(...)
121+
if not self:ConvertModInternal(oldName, mod) then
122+
self:AddMod(mod)
123+
end
124+
end
125+
113126
function ModStoreClass:Combine(modType, cfg, ...)
114127
if modType == "MORE" then
115128
return self:More(cfg, ...)

src/Data/ModCache.lua.rej

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff a/src/Data/ModCache.lua b/src/Data/ModCache.lua (rejected hunks)
2+
@@ -8413,7 +8413,7 @@ c["Elemental Ailments you inflict are Reflected to you Elemental Damage with Hit
3+
c["Elemental Damage with Hits is Lucky while you are Shocked"]={{[1]={[1]={type="Condition",var="Shocked"},flags=0,keywordFlags=0,name="ElementalLuckHits",type="FLAG",value=true}},nil}
4+
c["Elemental Damage you Deal with Hits is Resisted by lowest Elemental Resistance instead"]={{[1]={flags=0,keywordFlags=0,name="ElementalDamageUsesLowestResistance",type="FLAG",value=true}},nil}
5+
c["Elemental Equilibrium"]={{[1]={flags=0,keywordFlags=0,name="Keystone",type="LIST",value="Elemental Equilibrium"}},nil}
6+
-c["Elemental Hit's Added Damage cannot be replaced this way"]={nil,"Elemental Hit's Added Damage cannot be replaced this way "}
7+
+c["Elemental Hit's Added Damage cannot be replaced this way"]={{},nil}
8+
c["Elemental Overload"]={{[1]={flags=0,keywordFlags=0,name="Keystone",type="LIST",value="Elemental Overload"}},nil}
9+
c["Elemental Resistance values as inverted"]={nil,"Elemental Resistance values as inverted "}
10+
c["Elemental Resistance values as inverted Limited to 1 Runegraft of the Gauche"]={nil,"Elemental Resistance values as inverted Limited to 1 Runegraft of the Gauche "}
11+
@@ -12581,11 +12581,8 @@ c["You count as on Low Life while you are Cursed with Vulnerability"]={{[1]={[1]
12+
c["You do not inherently take less Damage for having Fortification"]={{[1]={flags=0,keywordFlags=0,name="Condition:NoFortificationMitigation",type="FLAG",value=true}},nil}
13+
c["You gain 3 Grasping Vines when you take a Critical Strike"]={{}," Grasping Vines when you take a Critical Strike "}
14+
c["You gain 3 Grasping Vines when you take a Critical Strike Nearby stationary Enemies gain a Grasping Vine every 0.5 seconds"]={{}," Grasping Vines when you take a Critical Strike Nearby stationary Enemies gain a Grasping Vine every 0.5 seconds "}
15+
-c["You gain Added Cold Damage instead of Added Damage of other types if Dexterity exceeds both other Attributes"]={nil,"Added Cold Damage instead of Added Damage of other types if Dexterity exceeds both other Attributes "}
16+
-c["You gain Added Cold Damage instead of Added Damage of other types if Dexterity exceeds both other Attributes You gain Added Lighting Damage instead of Added Damage of other types if Intelligence exceeds both other Attributes"]={nil,"Added Cold Damage instead of Added Damage of other types if Dexterity exceeds both other Attributes You gain Added Lighting Damage instead of Added Damage of other types if Intelligence exceeds both other Attributes "}
17+
-c["You gain Added Cold Damage instead of Added Damage of other types if Dexterity exceeds both other Attributes You gain Added Lighting Damage instead of Added Damage of other types if Intelligence exceeds both other Attributes Elemental Hit's Added Damage cannot be replaced this way"]={nil,"Added Cold Damage instead of Added Damage of other types if Dexterity exceeds both other Attributes You gain Added Lighting Damage instead of Added Damage of other types if Intelligence exceeds both other Attributes Elemental Hit's Added Damage cannot be replaced this way "}
18+
-c["You gain Added Lighting Damage instead of Added Damage of other types if Intelligence exceeds both other Attributes"]={nil,"Added Lighting Damage instead of Added Damage of other types if Intelligence exceeds both other Attributes "}
19+
-c["You gain Added Lighting Damage instead of Added Damage of other types if Intelligence exceeds both other Attributes Elemental Hit's Added Damage cannot be replaced this way"]={nil,"Added Lighting Damage instead of Added Damage of other types if Intelligence exceeds both other Attributes Elemental Hit's Added Damage cannot be replaced this way "}
20+
+c["You gain Added Cold Damage instead of Added Damage of other types if Dexterity exceeds both other Attributes"]={{[1]={[1]={type="Condition",var="DexSingleHighestAttribute"},flags=0,keywordFlags=0,name="AllAddedDamageAsCold",type="FLAG",value=true}},nil}
21+
+c["You gain Added Lighting Damage instead of Added Damage of other types if Intelligence exceeds both other Attributes"]={{[1]={[1]={type="Condition",var="IntSingleHighestAttribute"},flags=0,keywordFlags=0,name="AllAddedDamageAsLightning",type="FLAG",value=true}},nil}
22+
c["You gain Divinity for 10 seconds on reaching maximum Divine Charges"]={{[1]={[1]={type="Condition",var="Divinity"},flags=0,keywordFlags=0,name="ElementalDamage",type="MORE",value=75},[2]={[1]={type="Condition",var="Divinity"},flags=0,keywordFlags=0,name="ElementalDamageTaken",type="MORE",value=-25}},nil}
23+
c["You gain Onslaught for 1 seconds on Killing Taunted Enemies"]={{[1]={[1]={type="Condition",var="KilledTauntedEnemyRecently"},flags=0,keywordFlags=0,name="Condition:Onslaught",type="FLAG",value=true}},nil}
24+
c["You gain Onslaught for 1 seconds per Endurance Charge when Hit"]={{[1]={[1]={type="Multiplier",var="EnduranceCharge"},flags=0,keywordFlags=0,name="Condition:Onslaught",type="FLAG",value=true}}," when Hit "}

src/Modules/CalcOffence.lua.rej

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff a/src/Modules/CalcOffence.lua b/src/Modules/CalcOffence.lua (rejected hunks)
2+
@@ -3059,17 +3059,18 @@ function calcs.offence(env, actor, activeSkill)
3+
addedDamageRedirectType = "Cold"
4+
end
5+
if addedDamageRedirectType then
6+
- local skipRedirect = activeSkill.activeEffect.grantedEffect.name == "Elemental Hit"
7+
- if not skipRedirect then
8+
- for _, damageType in ipairs(dmgTypeList) do
9+
- if damageType ~= addedDamageRedirectType then
10+
- for _, value in ipairs(skillModList:Tabulate("BASE", cfg, damageType.."Min")) do
11+
- local mod = value.mod
12+
- skillModList:ConvertMod(damageType.."Min", addedDamageRedirectType.."Min", "BASE", mod.value, mod.source, mod.flags, mod.keywordFlags, unpack(mod))
13+
+ for _, damageType in ipairs(dmgTypeList) do
14+
+ if damageType ~= addedDamageRedirectType then
15+
+ for _, value in ipairs(skillModList:Tabulate("BASE", cfg, damageType.."Min")) do
16+
+ local mod = value.mod
17+
+ if mod.source ~= "Skill:ElementalHit" then
18+
+ skillModList:ConvertMod(damageType.."Min", addedDamageRedirectType.."Min", "BASE", mod.value, mod.source, mod.flags, mod.keywordFlags, { type = "Cryogenesis Added Damage" }, unpack(mod))
19+
end
20+
- for _, value in ipairs(skillModList:Tabulate("BASE", cfg, damageType.."Max")) do
21+
- local mod = value.mod
22+
- skillModList:ConvertMod(damageType.."Max", addedDamageRedirectType.."Max", "BASE", mod.value, mod.source, mod.flags, mod.keywordFlags, unpack(mod))
23+
+ end
24+
+ for _, value in ipairs(skillModList:Tabulate("BASE", cfg, damageType.."Max")) do
25+
+ local mod = value.mod
26+
+ if mod.source ~= "Skill:ElementalHit" then
27+
+ skillModList:ConvertMod(damageType.."Max", addedDamageRedirectType.."Max", "BASE", mod.value, mod.source, mod.flags, mod.keywordFlags, { type = "Cryogenesis Added Damage" }, unpack(mod))
28+
end
29+
end
30+
end

src/Modules/CalcPerform.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,8 @@ local function doActorAttribsConditions(env, actor)
376376
condList["StrHighestAttribute"] = output.Str >= output.Dex and output.Str >= output.Int
377377
condList["IntHighestAttribute"] = output.Int >= output.Str and output.Int >= output.Dex
378378
condList["DexHighestAttribute"] = output.Dex >= output.Str and output.Dex >= output.Int
379+
condList["IntSingleHighestAttribute"] = output.Int > output.Str and output.Int > output.Dex
380+
condList["DexSingleHighestAttribute"] = output.Dex > output.Str and output.Dex > output.Int
379381
end
380382
end
381383

src/Modules/CalcPerform.lua.rej

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
diff a/src/Modules/CalcPerform.lua b/src/Modules/CalcPerform.lua (rejected hunks)
2+
@@ -457,6 +459,8 @@ local function doActorAttribsConditions(env, actor)
3+
condList["StrHighestAttribute"] = output.Str >= output.Dex and output.Str >= output.Int
4+
condList["IntHighestAttribute"] = output.Int >= output.Str and output.Int >= output.Dex
5+
condList["DexHighestAttribute"] = output.Dex >= output.Str and output.Dex >= output.Int
6+
+ condList["IntSingleHighestAttribute"] = output.Int > output.Str and output.Int > output.Dex
7+
+ condList["DexSingleHighestAttribute"] = output.Dex > output.Str and output.Dex > output.Int
8+
end
9+
end
10+

src/Modules/ModParser.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5711,6 +5711,13 @@ local specialModList = {
57115711
["consecrated path and purifying flame create profane ground instead of consecrated ground"] = {
57125712
flag("Condition:CreateProfaneGround"),
57135713
},
5714+
["you gain added cold damage instead of added damage of other types if dexterity exceeds both other attributes"] = {
5715+
flag("AllAddedDamageAsCold", { type = "Condition", var = "DexSingleHighestAttribute" }),
5716+
},
5717+
["you gain added lightn?ing damage instead of added damage of other types if intelligence exceeds both other attributes"] = {
5718+
flag("AllAddedDamageAsLightning", { type = "Condition", var = "IntSingleHighestAttribute" }),
5719+
},
5720+
["elemental hit's added damage cannot be replaced this way"] = { },
57145721
["you have consecrated ground around you while stationary if strength is your highest attribute"] = {
57155722
flag("Condition:OnConsecratedGround", { type = "Condition", var = "StrHighestAttribute" }, { type = "Condition", var = "Stationary" }),
57165723
},

0 commit comments

Comments
 (0)