From 4e15c4b45c3d56b4f65c4662c50528254c934522 Mon Sep 17 00:00:00 2001 From: Shibari <ShibariTOME@Gmail.com> Date: Sat, 21 Dec 2019 23:11:47 -0500 Subject: [PATCH] Fix weapon damage display on Actor tooltips This was using a very naive combatDamage call on each slot instead of doing the interpreting the character sheet does. Now they both use the same method, though I'm not 100% I covered all the special casing. --- game/modules/tome/class/Actor.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index 2307d8f7ec..c38715116f 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -2098,7 +2098,8 @@ function _M:tooltip(x, y, seen_by) local tst = ("#LIGHT_BLUE#Main:#LAST#"..o:getShortName({force_id=true, do_color=true, no_add_name=true})):toTString() tst = tst:splitLines(game.tooltip.max-1, game.tooltip.font, 2) tst = tst:extractLines(true)[1] - tst:add(" ("..math.floor(self:combatDamage(o.combat))..")") + local stats = self:getCombatStats("mainhand", self.INVEN_MAINHAND, i ) + tst:add(" (#RED#"..math.floor(stats.dmg).."#LAST#)") table.append(ts, tst) ts:add(true) end @@ -2107,8 +2108,9 @@ function _M:tooltip(x, y, seen_by) for i, o in ipairs(self:getInven("OFFHAND")) do local tst = ("#LIGHT_BLUE#Off :#LAST#"..o:getShortName({force_id=true, do_color=true, no_add_name=true})):toTString() tst = tst:splitLines(game.tooltip.max-1, game.tooltip.font, 2) - tst = tst:extractLines(true)[1] - tst:add(" ("..math.floor(self:combatDamage(o.combat))..")") + tst = tst:extractLines(true)[1] + local stats = self:getCombatStats("offhand", self.INVEN_OFFHAND, i) + tst:add(" (#RED#"..math.floor(stats.dmg).."#LAST#)") table.append(ts, tst) ts:add(true) end @@ -2118,7 +2120,8 @@ function _M:tooltip(x, y, seen_by) local tst = ("#LIGHT_BLUE#Psi :#LAST#"..o:getShortName({force_id=true, do_color=true, no_add_name=true})):toTString() tst = tst:splitLines(game.tooltip.max-1, game.tooltip.font, 2) tst = tst:extractLines(true)[1] - tst:add(" ("..math.floor(self:combatDamage(o.combat))..")") + local stats = self:getCombatStats("psionic", self.INVEN_PSIONIC_FOCUS, i) + tst:add(" (#RED#"..math.floor(stats.dmg).."#LAST#)") table.append(ts, tst) ts:add(true) end @@ -2128,7 +2131,6 @@ function _M:tooltip(x, y, seen_by) local tst = ("#LIGHT_BLUE#Ammo:#LAST#"..o:getShortName({force_id=true, do_color=true, no_add_name=true})):toTString() tst = tst:splitLines(game.tooltip.max-1, game.tooltip.font, 2) tst = tst:extractLines(true)[1] - tst:add(" ("..math.floor(self:combatDamage(o.combat))..")") table.append(ts, tst) ts:add(true) end @@ -2140,7 +2142,8 @@ function _M:tooltip(x, y, seen_by) local tst = ("#LIGHT_BLUE#Unarmed:#LAST#"..o:getShortName({force_id=true, do_color=true, no_add_name=true})):toTString() tst = tst:splitLines(game.tooltip.max-1, game.tooltip.font, 2) tst = tst:extractLines(true)[1] - tst:add(" ("..math.floor(self:combatDamage(self.combat))..") ") + local stats = self:getCombatStats("barehand", self.INVEN_MAINHAND, i) + tst:add(" (#RED#"..math.floor(stats.dmg).."#LAST#)") table.append(ts, tst) ts:add(true) end @@ -2149,7 +2152,8 @@ function _M:tooltip(x, y, seen_by) local tst = ("#LIGHT_BLUE#Unarmed:#LAST#"):toTString() tst = tst:splitLines(game.tooltip.max-1, game.tooltip.font, 2) tst = tst:extractLines(true)[1] - tst:add(" ("..math.floor(self:combatDamage(self.combat))..") ") + local stats = self:getCombatStats("barehand", self.INVEN_MAINHAND, i) + tst:add(" (#RED#"..math.floor(stats.dmg).."#LAST#)") table.append(ts, tst) ts:add(true) end -- GitLab