Skip to content

Commit

Permalink
initial draft of heist implicts and enchants
Browse files Browse the repository at this point in the history
  • Loading branch information
Regisle committed Aug 30, 2024
1 parent 8d7119a commit 25f2d1f
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 28 deletions.
110 changes: 85 additions & 25 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,15 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
-- preprocess looking for modifier effect multipliers
local modLineMultipliers = {}
for _, line in ipairs(self.rawLines) do
if line:find("effect") then
if line:find("Modifier magnitudes") then
local tag = line:match("ed Explicit (%a+) Modifier magnitudes") or (line:match("ed Suffix Modifier magnitudes") and "Suffix") or (line:match("ed Prefix Modifier magnitudes") and "Prefix") or "AllExplicit"
local value = (line:match("^(%d+)%% increased ") or 0) - (line:match("^(%d+)%% reduced ") or 0)
modLineMultipliers[tag] = (modLineMultipliers[tag] or 0) + value
elseif line:find("effect") then
modLineMultipliers["localEffect"] = (modLineMultipliers["localEffect"] or 0) + (line:match("^(%d+)%% increased effect") or 0) - (line:match("^(%d+)%% reduced effect") or 0)
end
end

self.checkSection = false
self.sockets = { }
self.classRequirementModLines = { }
Expand Down Expand Up @@ -721,12 +726,19 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
end
end
end
if not self.base.tincture then
if not self.base.tincture and gameModeStage == "EXPLICIT" then
for searchTag, mult in pairs(modLineMultipliers) do
if searchTag ~= "localEffect" then
if searchTag == "AllExplicit" then
-- this was still matching implicts

Check warning on line 732 in src/Classes/Item.lua

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (implicts)
if line:match("Modifier") then
break
else
rangeScalar = rangeScalar * (100 + mult) / 100
end
elseif searchTag ~= "localEffect" then
for _, curTag in ipairs(modLine.modTags) do
if curTag == searchTag then
rangeScalar = rangeScalar * mult
if curTag == searchTag:lower() then
rangeScalar = rangeScalar * (100 + mult) / 100
break
end
end
Expand Down Expand Up @@ -1190,6 +1202,27 @@ function ItemClass:Craft()
end
end
end
else
if self.base.type == "Ring" or self.base.type == "Amulet" then
for _, modLine in ipairs(self.implicitModLines) do
if modLine.line:find("Modifier magnitudes") then
local tag = modLine.line:match("ed Explicit (%a+) Modifier magnitudes") or (modLine.line:match("ed Suffix Modifier magnitudes") and "Suffix") or (modLine.line:match("ed Prefix Modifier magnitudes") and "Prefix") or "AllExplicit"
local value = (modLine.line:match("^(%d+)%% increased ") or 0) - (modLine.line:match("^(%d+)%% reduced ") or 0)
modLineMultipliers[tag] = (modLineMultipliers[tag] or 0) + value
end
end
end
for _, modLine in ipairs(self.enchantModLines) do
if modLine.line:find("Modifier magnitudes") then
if modLine.line:find("increased") then
local value, tag = modLine.line:match("^(%d+)%% increased Explicit (%a+) Modifier magnitudes")
modLineMultipliers[tag] = (modLineMultipliers[tag] or 0) + (value or 0)
else
local value, tag = modLine.line:match("^(%d+)%% reduced Explicit (%a+) Modifier magnitudes")
modLineMultipliers[tag] = (modLineMultipliers[tag] or 0) - (value or 0)
end
end
end
end
for _, list in ipairs({self.prefixes,self.suffixes}) do
for i = 1, self.affixLimit / 2 do
Expand Down Expand Up @@ -1218,15 +1251,17 @@ function ItemClass:Craft()
end
if not self.base.tincture then
for searchTag, mult in pairs(modLineMultipliers) do
if searchTag == mod.type then
rangeScalar = rangeScalar * mult
if searchTag == "AllExplicit" then
--rangeScalar = rangeScalar * (100 + mult) / 100
elseif searchTag == mod.type then
rangeScalar = rangeScalar * (100 + mult) / 100
else
for _, curTag in ipairs(modLine.modTags) do
if curTag == searchTag then
rangeScalar = rangeScalar * mult
break
end
end
-- for _, curTag in ipairs(mod.modTags) do
-- if curTag == searchTag:lower() then
-- rangeScalar = rangeScalar * (100 + mult) / 100
-- break
-- end
-- end
end
end
end
Expand Down Expand Up @@ -1629,8 +1664,29 @@ function ItemClass:BuildModList()
modLineMultipliers["localEffect"] = (modLineMultipliers["localEffect"] or 0) + (modLine.line:match("^(%d+)%% increased effect") or 0) - (modLine.line:match("^(%d+)%% reduced effect") or 0)
end
end
else
if self.base.type == "Ring" or self.base.type == "Amulet" then
for _, modLine in ipairs(self.implicitModLines) do
if modLine.line:find("Modifier magnitudes") then
local tag = modLine.line:match("ed Explicit (%a+) Modifier magnitudes") or "AllExplicit"
local value = (modLine.line:match("^(%d+)%% increased Explicit ") or 0) - (modLine.line:match("^(%d+)%% reduced Explicit ") or 0)
modLineMultipliers[tag] = (modLineMultipliers[tag] or 0) + value
end
end
end
for _, modLine in ipairs(self.enchantModLines) do
if modLine.line:find("Modifier magnitudes") then
if modLine.line:find("increased") then
local value, tag = modLine.line:match("^(%d+)%% increased Explicit (%a+) Modifier magnitudes")
modLineMultipliers[tag] = (modLineMultipliers[tag] or 0) + (value or 0)
else
local value, tag = modLine.line:match("^(%d+)%% reduced Explicit (%a+) Modifier magnitudes")
modLineMultipliers[tag] = (modLineMultipliers[tag] or 0) - (value or 0)
end
end
end
end
local function processModLine(modLine)
local function processModLine(modLine, lineType)
if self:CheckModLineVariant(modLine) then
-- special section for variant over-ride of pre-modifier item parameters
if modLine.line:find("Requires Class") then
Expand Down Expand Up @@ -1658,12 +1714,16 @@ function ItemClass:BuildModList()
end
end
end
if not self.base.tincture then
if not self.base.tincture and lineType == "explicitModLines" then
for searchTag, mult in pairs(modLineMultipliers) do
for _, curTag in ipairs(modLine.modTags) do
if curTag == searchTag then
rangeScalar = rangeScalar * mult
break
if searchTag == "AllExplicit" then
rangeScalar = rangeScalar * (100 + mult) / 100
else
for _, curTag in ipairs(modLine.modTags) do
if curTag == searchTag:lower() then
rangeScalar = rangeScalar * (100 + mult) / 100
break
end
end
end
end
Expand All @@ -1688,22 +1748,22 @@ function ItemClass:BuildModList()
end
end
end
for _, modLine in ipairs(self.enchantModLines) do
for _, modLine in ipairs(self.enchantModLines, "enchantModLines") do
processModLine(modLine)
end
for _, modLine in ipairs(self.scourgeModLines) do
for _, modLine in ipairs(self.scourgeModLines, "scourgeModLines") do
processModLine(modLine)
end
for _, modLine in ipairs(self.classRequirementModLines) do
for _, modLine in ipairs(self.classRequirementModLines, "classRequirementModLines") do
processModLine(modLine)
end
for _, modLine in ipairs(self.implicitModLines) do
for _, modLine in ipairs(self.implicitModLines, "implicitModLines") do
processModLine(modLine)
end
for _, modLine in ipairs(self.explicitModLines) do
for _, modLine in ipairs(self.explicitModLines, "explicitModLines") do
processModLine(modLine)
end
for _, modLine in ipairs(self.crucibleModLines) do
for _, modLine in ipairs(self.crucibleModLines, "crucibleModLines") do
processModLine(modLine)
end
if self.name == "Tabula Rasa, Simple Robe" or self.name == "Skin of the Loyal, Simple Robe" or self.name == "Skin of the Lords, Simple Robe" or self.name == "The Apostate, Cabalist Regalia" then
Expand Down
5 changes: 2 additions & 3 deletions src/Data/ModCache.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2450,7 +2450,7 @@ c["100% increased Evasion Rating if Energy Shield Recharge has started in the pa
c["100% increased Evasion Rating if you have been Hit Recently"]={{[1]={[1]={type="Condition",var="BeenHitRecently"},flags=0,keywordFlags=0,name="Evasion",type="INC",value=100}},nil}
c["100% increased Evasion Rating while you have Onslaught"]={{[1]={[1]={type="Condition",var="Onslaught"},flags=0,keywordFlags=0,name="Evasion",type="INC",value=100}},nil}
c["100% increased Evasion and Energy Shield"]={{[1]={flags=0,keywordFlags=0,name="EvasionAndEnergyShield",type="INC",value=100}},nil}
c["100% increased Explicit Modifier magnitudes"]={{}," Explicit Modifier magnitudes "}
c["100% increased Explicit Modifier magnitudes"]={{},nil}
c["100% increased Fire Damage"]={{[1]={flags=0,keywordFlags=0,name="FireDamage",type="INC",value=100}},nil}
c["100% increased Fire Damage if you have been Hit Recently"]={{[1]={[1]={type="Condition",var="BeenHitRecently"},flags=0,keywordFlags=0,name="FireDamage",type="INC",value=100}},nil}
c["100% increased Fire Damage with Hits and Ailments against Bleeding Enemies"]={{[1]={[1]={actor="enemy",type="ActorCondition",var="Bleeding"},flags=0,keywordFlags=786432,name="FireDamage",type="INC",value=100}},nil}
Expand Down Expand Up @@ -4108,8 +4108,7 @@ c["25% increased Stun Duration on Enemies"]={{[1]={flags=0,keywordFlags=0,name="
c["25% increased Stun Duration with Melee Weapons"]={{[1]={flags=67108864,keywordFlags=0,name="EnemyStunDuration",type="INC",value=25}},nil}
c["25% increased Stun Duration with Two Handed Melee Weapons on Enemies"]={{[1]={flags=603979780,keywordFlags=0,name="EnemyStunDuration",type="INC",value=25}},nil}
c["25% increased Stun and Block Recovery"]={{[1]={flags=0,keywordFlags=0,name="StunRecovery",type="INC",value=25}},nil}
c["25% increased Suffix Modifier magnitudes"]={{}," Suffix Modifier magnitudes "}
c["25% increased Suffix Modifier magnitudes +27% to Fire Resistance"]={{[1]={flags=0,keywordFlags=0,name="FireResist",type="INC",value=25}}," Suffix Modifier magnitudes +27% to "}
c["25% increased Suffix Modifier magnitudes"]={{},nil}
c["25% increased Tincture Cooldown Recovery Rate"]={{[1]={flags=0,keywordFlags=0,name="TinctureCooldownRecovery",type="INC",value=25}},nil}
c["25% increased Totem Damage"]={{[1]={flags=0,keywordFlags=16384,name="Damage",type="INC",value=25}},nil}
c["25% increased Totem Life"]={{[1]={flags=0,keywordFlags=0,name="TotemLife",type="INC",value=25}},nil}
Expand Down
6 changes: 6 additions & 0 deletions src/Modules/ModParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5079,6 +5079,12 @@ local specialModList = {
["you can have two different banners at the same time"] = { },
["can have a second enchantment modifier"] = { },
["can have (%d+) additional enchantment modifiers"] = { },
["(%d+)%% increased explicit (%a+) modifier magnitudes"] = { },
["(%d+)%% reduced explicit (%a+) modifier magnitudes"] = { },
["(%d+)%% increased explicit modifier magnitudes"] = { },
["(%d+)%% reduced explicit modifier magnitudes"] = { },
["(%d+)%% increased suffix modifier magnitudes"] = { },
["(%d+)%% increased prefix modifier magnitudes"] = { },
["this item can be anointed by cassia"] = { },
["has a crucible passive skill tree"] = { },
["has a two handed sword crucible passive skill tree"] = { },
Expand Down

0 comments on commit 25f2d1f

Please sign in to comment.