Skip to content

Commit 1af4148

Browse files
authored
Add support for Giant's Blood (#166)
* Add support for Giant's Blood * Constantly check for items in weapon slots
1 parent 6d7773f commit 1af4148

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

src/Classes/ItemsTab.lua

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,9 @@ function ItemsTabClass:Draw(viewPort, inputEvents)
11271127
end
11281128

11291129
self:UpdateSockets()
1130+
-- Update weapon slots in case we got Giant's Blood from somewhere
1131+
self.slots["Weapon 2"]:Populate()
1132+
self.slots["Weapon 2 Swap"]:Populate()
11301133

11311134
self:DrawControls(viewPort)
11321135
if self.controls.scrollBarH:IsShown() then
@@ -1814,10 +1817,17 @@ function ItemsTabClass:IsItemValidForSlot(item, slotName, itemSet)
18141817
elseif slotName == "Weapon 2" or slotName == "Weapon 2 Swap" then
18151818
local weapon1Sel = itemSet[slotName == "Weapon 2" and "Weapon 1" or "Weapon 1 Swap"].selItemId or 0
18161819
local weapon1Base = self.items[weapon1Sel] and self.items[weapon1Sel].base or "Unarmed"
1820+
-- Calcs tab isn't loaded yet when the items tab gets loaded, so assume we have Giant's Blood until proven wrong
1821+
local giantsBlood = true
1822+
if self.build.calcsTab and self.build.calcsTab.mainEnv then
1823+
giantsBlood = self.build.calcsTab.mainEnv.modDB:Flag(nil, "GiantsBlood")
1824+
end
18171825
if weapon1Base.type == "Bow" then
18181826
return item.type == "Quiver"
1819-
elseif weapon1Base == "Unarmed" or weapon1Base.tags.onehand then
1820-
return item.type == "Shield" or item.type == "Focus" or item.type == "Sceptre" or (item.base.tags.one_hand_weapon and weapon1Base.type ~= "Wand" and weapon1Base.type ~= "Sceptre")
1827+
elseif weapon1Base == "Unarmed" or weapon1Base.tags.onehand or (giantsBlood and (weapon1Base.tags.axe or weapon1Base.tags.mace or weapon1Base.tags.sword)) then
1828+
return item.type == "Shield" or item.type == "Focus" or item.type == "Sceptre"
1829+
or (item.base.tags.one_hand_weapon and weapon1Base.type ~= "Wand" and weapon1Base.type ~= "Sceptre")
1830+
or (giantsBlood and (item.base.tags.axe or item.base.tags.mace or item.base.tags.sword))
18211831
end
18221832
end
18231833
end
@@ -2502,7 +2512,7 @@ function ItemsTabClass:AddItemSetTooltip(tooltip, itemSet)
25022512
if not slot.nodeId then
25032513
local item = self.items[itemSet[slot.slotName].selItemId]
25042514
if item then
2505-
tooltip:AddLine(16, s_format("^7%s: %s%s", slot.label, colorCodes[item.rarity], item.name))
2515+
tooltip:AddLine(16, s_format("^7%s: %s%s", slot.slotName, colorCodes[item.rarity], item.name))
25062516
end
25072517
end
25082518
end

src/Data/ModCache.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2924,7 +2924,7 @@ c["Trigger skills refund half of Energy spent"]={nil,"Trigger skills refund half
29242924
c["Triggered Spells deal 14% increased Spell Damage"]={{[1]={[1]={skillType=41,type="SkillType"},flags=2,keywordFlags=131072,name="Damage",type="INC",value=14}},nil}
29252925
c["Triggered Spells deal 16% increased Spell Damage"]={{[1]={[1]={skillType=41,type="SkillType"},flags=2,keywordFlags=131072,name="Damage",type="INC",value=16}},nil}
29262926
c["Triggered Spells deal 45% increased Spell Damage"]={{[1]={[1]={skillType=41,type="SkillType"},flags=2,keywordFlags=131072,name="Damage",type="INC",value=45}},nil}
2927-
c["Triple Attribute requirements of weapons"]={nil,"Triple Attribute requirements of weapons "}
2927+
c["Triple Attribute requirements of weapons"]={{[1]={flags=0,keywordFlags=0,name="GlobalWeaponAttributeRequirements",type="MORE",value=200}},nil}
29282928
c["Unaffected by Chill during Dodge Roll"]={nil,"Unaffected by Chill during Dodge Roll "}
29292929
c["Unaffected by Chill while Leeching Mana"]={{[1]={[1]={type="Condition",var="LeechingMana"},flags=0,keywordFlags=0,name="SelfChillEffect",type="MORE",value=-100}},nil}
29302930
c["Undead Minions have 20% reduced Reservation"]={nil,"Undead Minions have 20% reduced Reservation "}
@@ -2954,8 +2954,7 @@ c["You can only Socket Ruby Jewels in this item"]={nil,"You can only Socket Ruby
29542954
c["You can only Socket Ruby Jewels in this item You can only Socket Emerald Jewels in this item"]={nil,"You can only Socket Ruby Jewels in this item You can only Socket Emerald Jewels in this item "}
29552955
c["You can only Socket Sapphire Jewels in this item"]={nil,"You can only Socket Sapphire Jewels in this item "}
29562956
c["You can use two copies of the same Support Gem in different Skills"]={{[1]={flags=0,keywordFlags=0,name="MaxSupportGemCopies",type="OVERRIDE",value=2}},nil}
2957-
c["You can wield Two-Handed Axes, Maces and Swords in one hand"]={nil,"You can wield Two-Handed Axes, Maces and Swords in one hand "}
2958-
c["You can wield Two-Handed Axes, Maces and Swords in one hand Triple Attribute requirements of weapons"]={nil,"You can wield Two-Handed Axes, Maces and Swords in one hand Triple Attribute requirements of weapons "}
2957+
c["You can wield Two-Handed Axes, Maces and Swords in one hand"]={{[1]={flags=0,keywordFlags=0,name="GiantsBlood",type="FLAG",value=true}},nil}
29592958
c["You cannot Block"]={nil,"You cannot Block "}
29602959
c["You cannot Block No Chance to Block"]={nil,"You cannot Block No Chance to Block "}
29612960
c["You cannot Recharge Energy Shield"]={{[1]={flags=0,keywordFlags=0,name="NoEnergyShieldRecharge",type="FLAG",value=true}},nil}

src/Modules/CalcPerform.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1382,8 +1382,10 @@ function calcs.perform(env, skipEHP)
13821382
do
13831383
local reqMultItem = calcLib.mod(modDB, nil, "GlobalAttributeRequirements", "GlobalItemAttributeRequirements")
13841384
local reqMultGem = calcLib.mod(modDB, nil, "GlobalAttributeRequirements", "GlobalGemAttributeRequirements")
1385+
local reqMultWeapon = calcLib.mod(modDB, nil, "GlobalAttributeRequirements", "GlobalItemAttributeRequirements", "GlobalWeaponAttributeRequirements")
13851386
output.GlobalItemAttributeRequirements = reqMultItem
13861387
output.GlobalGemAttributeRequirements = reqMultGem
1388+
output.GlobalWeaponAttributeRequirements = reqMultWeapon
13871389
local gemAttributeRequirementsSatisfiedByHighestAttribute = modDB:Flag(nil, "GemAttributeRequirementsSatisfiedByHighestAttribute")
13881390
local attrTable = {"Str","Dex","Int"}
13891391
local highestAttributeValue = 0
@@ -1414,7 +1416,11 @@ function calcs.perform(env, skipEHP)
14141416
if reqSource[attr] and reqSource[attr] > 0 then
14151417
local req = 0
14161418
if reqSource.source == "Item" then
1417-
req = m_floor(reqSource[attr] * reqMultItem)
1419+
if reqSource.sourceItem.base.weapon then
1420+
req = m_floor(reqSource[attr] * reqMultWeapon)
1421+
else
1422+
req = m_floor(reqSource[attr] * reqMultItem)
1423+
end
14181424
elseif reqSource.source == "Gem" then
14191425
req = m_floor(reqSource[attr] * reqMultGem)
14201426
end

src/Modules/CalcSections.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,7 @@ return {
13831383
{ label = "Intelligence", { format = "{0:output:Int}", { breakdown = "Int" }, { modName = "Int" }, }, },
13841384
{ label = "Gem Req Mod", { format = "{2:output:GlobalGemAttributeRequirements}", { modName = { "GlobalGemAttributeRequirements", "GlobalAttributeRequirements"} }, }, },
13851385
{ label = "Item Req Mod", { format = "{2:output:GlobalItemAttributeRequirements}", { modName = { "GlobalItemAttributeRequirements", "GlobalAttributeRequirements"} }, }, },
1386+
{ label = "Weapon Req Mod", { format = "{2:output:GlobalWeaponAttributeRequirements}", { modName = { "GlobalWeaponAttributeRequirements", "GlobalItemAttributeRequirements", "GlobalAttributeRequirements"} }, }, },
13861387
{ notFlag = "minionSkill", label = "Str. Required", { format = "{output:ReqStrString}", { breakdown = "ReqStr" }, }, },
13871388
{ notFlag = "minionSkill", label = "Dex. Required", { format = "{output:ReqDexString}", { breakdown = "ReqDex" }, }, },
13881389
{ notFlag = "minionSkill", label = "Int. Required", { format = "{output:ReqIntString}", { breakdown = "ReqInt" }, }, },

src/Modules/ModParser.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2225,6 +2225,7 @@ local specialModList = {
22252225
mod("ArmourDefense", "MAX", math.min(numChance / 100, 1.0) * 100, "Armour Mastery: Average Calc", { type = "Condition", var = "ArmourAvg" }, { type = "Multiplier", var = "BeenHitRecently", limit = cap / numChance }),
22262226
mod("ArmourDefense", "MAX", math.min(math.floor(numChance / 100), 1.0) * 100, "Armour Mastery: Min Calc", { type = "Condition", var = "ArmourMax", neg = true }, { type = "Condition", var = "ArmourAvg", neg = true }, { type = "Multiplier", var = "BeenHitRecently", limit = cap / numChance }),
22272227
} end,
2228+
["you can wield two%-handed axes, maces and swords in one hand"] = { flag("GiantsBlood") },
22282229
-- Legacy support
22292230
["(%d+)%% chance to defend with double armour"] = function(numChance) return {
22302231
mod("ArmourDefense", "MAX", 100, "Armour Mastery: Max Calc", { type = "Condition", var = "ArmourMax" }),
@@ -4701,6 +4702,7 @@ local specialModList = {
47014702
["equipment and skill gems have (%d+)%% reduced attribute requirements"] = function(num) return { mod("GlobalAttributeRequirements", "INC", -num) } end,
47024703
["equipment and skill gems have (%d+)%% increased attribute requirements"] = function(num) return { mod("GlobalAttributeRequirements", "INC", num) } end,
47034704
["skill gems have (%d+)%% more attribute requirements"] = function(num) return { mod("GlobalGemAttributeRequirements", "MORE", num) } end,
4705+
["triple attribute requirements of weapons"] = function() return { mod("GlobalWeaponAttributeRequirements", "MORE", 200) } end,
47044706
["mana reservation of herald skills is always (%d+)%%"] = function(num) return { mod("SkillData", "LIST", { key = "ManaReservationPercentForced", value = num }, { type = "SkillType", skillType = SkillType.Herald }) } end,
47054707
["([%a%s]+) reserves no mana"] = function(_, name) return {
47064708
mod("SkillData", "LIST", { key = "manaReservationFlat", value = 0 }, { type = "SkillId", skillId = gemIdLookup[name] }, { type = "SkillType", skillType = SkillType.Blessing, neg = true }),

0 commit comments

Comments
 (0)