Skip to content

Commit

Permalink
Add support for weapon base damage conversion (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
PJacek authored Dec 13, 2024
1 parent 5743e1d commit 7fe8df7
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Data/Bases/axe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ itemBases["Ember Greataxe"] = {
tags = { axe = true, two_hand_weapon = true, weapon = true, twohand = true, default = true, },
influenceTags = { shaper = "2h_axe_shaper", elder = "2h_axe_elder", adjudicator = "2h_axe_adjudicator", basilisk = "2h_axe_basilisk", crusader = "2h_axe_crusader", eyrie = "2h_axe_eyrie", cleansing = "2h_axe_cleansing", tangle = "2h_axe_tangle" },
implicitModTypes = { },
weapon = { PhysicalMin = 58, PhysicalMax = 154, CritChanceBase = 5, AttackRateBase = 1.2, Range = 13, },
weapon = { FireMin = 58, FireMax = 154, CritChanceBase = 5, AttackRateBase = 1.2, Range = 13, },
req = { level = 50, },
}
itemBases["Ceremonial Halberd"] = {
Expand Down
6 changes: 3 additions & 3 deletions src/Data/Bases/bow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ itemBases["Cultist Bow"] = {
tags = { two_hand_weapon = true, vaal_basetype = true, ranged = true, weapon = true, default = true, twohand = true, bow = true, },
influenceTags = { shaper = "bow_shaper", elder = "bow_elder", adjudicator = "bow_adjudicator", basilisk = "bow_basilisk", crusader = "bow_crusader", eyrie = "bow_eyrie", cleansing = "bow_cleansing", tangle = "bow_tangle" },
implicitModTypes = { },
weapon = { PhysicalMin = 36, PhysicalMax = 59, CritChanceBase = 5, AttackRateBase = 1.2, Range = 120, },
weapon = { ChaosMin = 36, ChaosMax = 59, CritChanceBase = 5, AttackRateBase = 1.2, Range = 120, },
req = { level = 33, },
}
itemBases["Zealot Bow"] = {
Expand Down Expand Up @@ -166,7 +166,7 @@ itemBases["Advanced Cultist Bow"] = {
tags = { two_hand_weapon = true, ranged = true, weapon = true, default = true, twohand = true, bow = true, },
influenceTags = { shaper = "bow_shaper", elder = "bow_elder", adjudicator = "bow_adjudicator", basilisk = "bow_basilisk", crusader = "bow_crusader", eyrie = "bow_eyrie", cleansing = "bow_cleansing", tangle = "bow_tangle" },
implicitModTypes = { },
weapon = { PhysicalMin = 41, PhysicalMax = 69, CritChanceBase = 5, AttackRateBase = 1.2, Range = 120, },
weapon = { ChaosMin = 41, ChaosMax = 69, CritChanceBase = 5, AttackRateBase = 1.2, Range = 120, },
req = { level = 59, },
}
itemBases["Advanced Zealot Bow"] = {
Expand Down Expand Up @@ -222,7 +222,7 @@ itemBases["Expert Cultist Bow"] = {
tags = { two_hand_weapon = true, ranged = true, weapon = true, default = true, twohand = true, bow = true, },
influenceTags = { shaper = "bow_shaper", elder = "bow_elder", adjudicator = "bow_adjudicator", basilisk = "bow_basilisk", crusader = "bow_crusader", eyrie = "bow_eyrie", cleansing = "bow_cleansing", tangle = "bow_tangle" },
implicitModTypes = { },
weapon = { PhysicalMin = 52, PhysicalMax = 87, CritChanceBase = 5, AttackRateBase = 1.2, Range = 120, },
weapon = { ChaosMin = 52, ChaosMax = 87, CritChanceBase = 5, AttackRateBase = 1.2, Range = 120, },
req = { level = 79, },
}
itemBases["Expert Zealot Bow"] = {
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Bases/dagger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ itemBases["Moon Dagger"] = {
tags = { maraketh_basetype = true, onehand = true, one_hand_weapon = true, weapon = true, dagger = true, default = true, },
influenceTags = { shaper = "dagger_shaper", elder = "dagger_elder", adjudicator = "dagger_adjudicator", basilisk = "dagger_basilisk", crusader = "dagger_crusader", eyrie = "dagger_eyrie", cleansing = "dagger_cleansing", tangle = "dagger_tangle" },
implicitModTypes = { },
weapon = { PhysicalMin = 11, PhysicalMax = 26, CritChanceBase = 15, AttackRateBase = 1.55, Range = 10, },
weapon = { ColdMin = 11, ColdMax = 26, CritChanceBase = 15, AttackRateBase = 1.55, Range = 10, },
req = { level = 20, },
}
itemBases["Engraved Knife"] = {
Expand Down
6 changes: 3 additions & 3 deletions src/Data/Bases/mace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ itemBases["Smithing Hammer"] = {
tags = { onehand = true, ezomyte_basetype = true, mace = true, weapon = true, one_hand_weapon = true, default = true, },
influenceTags = { shaper = "mace_shaper", elder = "mace_elder", adjudicator = "mace_adjudicator", basilisk = "mace_basilisk", crusader = "mace_crusader", eyrie = "mace_eyrie", cleansing = "mace_cleansing", tangle = "mace_tangle" },
implicitModTypes = { },
weapon = { PhysicalMin = 9, PhysicalMax = 15, CritChanceBase = 5, AttackRateBase = 1.45, Range = 11, },
weapon = { PhysicalMin = 4, PhysicalMax = 7, FireMin = 4, FireMax = 7, CritChanceBase = 5, AttackRateBase = 1.45, Range = 11, },
req = { },
}
itemBases["Slim Mace"] = {
Expand Down Expand Up @@ -128,7 +128,7 @@ itemBases["Advanced Smithing Hammer"] = {
tags = { onehand = true, mace = true, weapon = true, one_hand_weapon = true, default = true, },
influenceTags = { shaper = "mace_shaper", elder = "mace_elder", adjudicator = "mace_adjudicator", basilisk = "mace_basilisk", crusader = "mace_crusader", eyrie = "mace_eyrie", cleansing = "mace_cleansing", tangle = "mace_tangle" },
implicitModTypes = { },
weapon = { PhysicalMin = 38, PhysicalMax = 64, CritChanceBase = 5, AttackRateBase = 1.45, Range = 11, },
weapon = { PhysicalMin = 19, PhysicalMax = 32, FireMin = 19, FireMax = 32, CritChanceBase = 5, AttackRateBase = 1.45, Range = 11, },
req = { level = 45, },
}
itemBases["Advanced Slim Mace"] = {
Expand Down Expand Up @@ -202,7 +202,7 @@ itemBases["Expert Smithing Hammer"] = {
tags = { onehand = true, mace = true, weapon = true, one_hand_weapon = true, default = true, },
influenceTags = { shaper = "mace_shaper", elder = "mace_elder", adjudicator = "mace_adjudicator", basilisk = "mace_basilisk", crusader = "mace_crusader", eyrie = "mace_eyrie", cleansing = "mace_cleansing", tangle = "mace_tangle" },
implicitModTypes = { },
weapon = { PhysicalMin = 61, PhysicalMax = 101, CritChanceBase = 5, AttackRateBase = 1.45, Range = 11, },
weapon = { PhysicalMin = 30, PhysicalMax = 50, FireMin = 30, FireMax = 50, CritChanceBase = 5, AttackRateBase = 1.45, Range = 11, },
req = { level = 77, },
}
itemBases["Expert Warpick"] = {
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Bases/spear.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ itemBases["Striking Spear"] = {
tags = { onehand = true, spear = true, weapon = true, one_hand_weapon = true, default = true, },
influenceTags = { shaper = "spear_shaper", elder = "spear_elder", adjudicator = "spear_adjudicator", basilisk = "spear_basilisk", crusader = "spear_crusader", eyrie = "spear_eyrie", cleansing = "spear_cleansing", tangle = "spear_tangle" },
implicitModTypes = { },
weapon = { PhysicalMin = 23, PhysicalMax = 91, CritChanceBase = 5, AttackRateBase = 1.6, Range = 15, },
weapon = { LightningMin = 23, LightningMax = 91, CritChanceBase = 5, AttackRateBase = 1.6, Range = 15, },
req = { level = 55, },
}
itemBases["Helix Spear"] = {
Expand Down
6 changes: 3 additions & 3 deletions src/Data/Bases/staff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ itemBases["Crackling Quarterstaff"] = {
tags = { two_hand_weapon = true, warstaff = true, maraketh_basetype = true, weapon = true, twohand = true, default = true, },
influenceTags = { shaper = "warstaff_shaper", elder = "warstaff_elder", adjudicator = "warstaff_adjudicator", basilisk = "warstaff_basilisk", crusader = "warstaff_crusader", eyrie = "warstaff_eyrie", cleansing = "warstaff_cleansing", tangle = "warstaff_tangle" },
implicitModTypes = { },
weapon = { PhysicalMin = 13, PhysicalMax = 54, CritChanceBase = 10, AttackRateBase = 1.4, Range = 13, },
weapon = { LightningMin = 13, LightningMax = 54, CritChanceBase = 10, AttackRateBase = 1.4, Range = 13, },
req = { level = 16, },
}
itemBases["Crescent Quarterstaff"] = {
Expand Down Expand Up @@ -267,7 +267,7 @@ itemBases["Advanced Crackling Quarterstaff"] = {
tags = { two_hand_weapon = true, warstaff = true, weapon = true, twohand = true, default = true, },
influenceTags = { shaper = "warstaff_shaper", elder = "warstaff_elder", adjudicator = "warstaff_adjudicator", basilisk = "warstaff_basilisk", crusader = "warstaff_crusader", eyrie = "warstaff_eyrie", cleansing = "warstaff_cleansing", tangle = "warstaff_tangle" },
implicitModTypes = { },
weapon = { PhysicalMin = 30, PhysicalMax = 57, CritChanceBase = 10, AttackRateBase = 1.4, Range = 13, },
weapon = { LightningMin = 30, LightningMax = 57, CritChanceBase = 10, AttackRateBase = 1.4, Range = 13, },
req = { level = 51, },
}
itemBases["Advanced Crescent Quarterstaff"] = {
Expand Down Expand Up @@ -339,7 +339,7 @@ itemBases["Expert Crackling Quarterstaff"] = {
tags = { two_hand_weapon = true, warstaff = true, weapon = true, twohand = true, default = true, },
influenceTags = { shaper = "warstaff_shaper", elder = "warstaff_elder", adjudicator = "warstaff_adjudicator", basilisk = "warstaff_basilisk", crusader = "warstaff_crusader", eyrie = "warstaff_eyrie", cleansing = "warstaff_cleansing", tangle = "warstaff_tangle" },
implicitModTypes = { },
weapon = { PhysicalMin = 43, PhysicalMax = 172, CritChanceBase = 10, AttackRateBase = 1.4, Range = 13, },
weapon = { LightningMin = 43, LightningMax = 172, CritChanceBase = 10, AttackRateBase = 1.4, Range = 13, },
req = { level = 78, },
}
itemBases["Expert Barrier Quarterstaff"] = {
Expand Down
38 changes: 37 additions & 1 deletion src/Export/Scripts/bases.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,43 @@ directiveTable.base = function(state, args, out)
local weaponType = dat("WeaponTypes"):GetRow("BaseItemType", baseItemType)
if weaponType then
out:write('\tweapon = { ')
out:write('PhysicalMin = ', weaponType.DamageMin, ', PhysicalMax = ', weaponType.DamageMax, ', ')
local modConversionMap = {
["local_weapon_implicit_hidden_%_base_damage_is_fire"] = "Fire",
["local_weapon_implicit_hidden_%_base_damage_is_cold"] = "Cold",
["local_weapon_implicit_hidden_%_base_damage_is_lightning"] = "Lightning",
["local_weapon_implicit_hidden_%_base_damage_is_chaos"] = "Chaos",
}
local conversion = {
["Physical"] = 100,
["Fire"] = 0,
["Cold"] = 0,
["Lightning"] = 0,
["Chaos"] = 0,
}
local total = 0
for _, mod in ipairs(baseItemType.ImplicitMods) do
for i = 1, 6 do
if mod["Stat"..i] then
local dmgType = modConversionMap[mod["Stat"..i].Id]
if dmgType then
local value = mod["Stat"..i.."Value"][1]
conversion[dmgType] = conversion[dmgType] + value
total = total + value
end
end
end
end
local factor = total > 100 and 100 / total or 1
for _, type in ipairs({ "Physical", "Fire", "Cold", "Lightning", "Chaos" }) do
if type == "Physical" then
conversion[type] = 1 - math.min(total / 100, 1)
else
conversion[type] = conversion[type] * factor / 100
end
if conversion[type] ~= 0 then
out:write(type, 'Min = ', math.floor(weaponType.DamageMin * conversion[type]), ', ', type, 'Max = ', math.floor(weaponType.DamageMax * conversion[type]), ', ')
end
end
out:write('CritChanceBase = ', weaponType.CritChance / 100, ', ')
out:write('AttackRateBase = ', round(1000 / weaponType.Speed, 2), ', ')
out:write('Range = ', weaponType.Range, ', ')
Expand Down

0 comments on commit 7fe8df7

Please sign in to comment.