From 6feafdf0864c5b8df20d3ab8186c5f268dc76295 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Tue, 18 Dec 2012 00:20:49 +0000
Subject: [PATCH] Shield damage displays for classes that can bump attack with
 them

git-svn-id: http://svn.net-core.org/repos/t-engine4@6124 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/class/interface/Combat.lua         | 2 +-
 game/modules/tome/class/interface/PlayerDumpJSON.lua | 6 +++---
 game/modules/tome/dialogs/CharacterSheet.lua         | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/game/modules/tome/class/interface/Combat.lua b/game/modules/tome/class/interface/Combat.lua
index 37dbc432b8..ec4f24ea39 100644
--- a/game/modules/tome/class/interface/Combat.lua
+++ b/game/modules/tome/class/interface/Combat.lua
@@ -186,7 +186,7 @@ function _M:attackTarget(target, damtype, mult, noenergy, force_unharmed)
 	-- Barehanded ?
 	if not speed and self.combat then
 		print("[ATTACK] attacking with innate combat")
-		local combat = self:getObjectCombat(o, "barehand")
+		local combat = self:getObjectCombat(nil, "barehand")
 		local s, h = self:attackTargetWith(target, combat, damtype, mult)
 		speed = math.max(speed or 0, s)
 		hit = hit or h
diff --git a/game/modules/tome/class/interface/PlayerDumpJSON.lua b/game/modules/tome/class/interface/PlayerDumpJSON.lua
index 420aba1c2d..7b1d6fc344 100644
--- a/game/modules/tome/class/interface/PlayerDumpJSON.lua
+++ b/game/modules/tome/class/interface/PlayerDumpJSON.lua
@@ -169,7 +169,7 @@ function _M:dumpToJSON(js, bypass, nosub)
 	if self:getInven(self.INVEN_MAINHAND) then
 		c.mainhand = {}
 		for i, o in ipairs(self:getInven(self.INVEN_MAINHAND)) do
-			local mean, dam = o.combat, o.combat
+			local mean, dam = self:getObjectCombat(o, "mainhand"), self:getObjectCombat(o, "mainhand")
 			if o.archery and mean then
 				dam = (self:getInven("QUIVER")[1] and self:getInven("QUIVER")[1].combat)
 			end
@@ -187,7 +187,7 @@ function _M:dumpToJSON(js, bypass, nosub)
 	end
 	--Unarmed?
 	if self:isUnarmed() then
-		local mean, dam = self.combat, self.combat
+		local mean, dam = self:getObjectCombat(nil, "barehand"), self:getObjectCombat(nil, "barehand")
 		local d = {}
 		c.barehand = {}
 		c.barehand[#c.barehand+1] = d
@@ -204,7 +204,7 @@ function _M:dumpToJSON(js, bypass, nosub)
 		c.offhand = {}
 		for i, o in ipairs(self:getInven(self.INVEN_OFFHAND)) do
 			local offmult = self:getOffHandMult(o.combat)
-			local mean, dam = o.combat, o.combat
+			local mean, dam = self:getObjectCombat(o, "offhand"), self:getObjectCombat(o, "offhand")
 			if o.archery and mean then
 				dam = (self:getInven("QUIVER")[1] and self:getInven("QUIVER")[1].combat)
 			end
diff --git a/game/modules/tome/dialogs/CharacterSheet.lua b/game/modules/tome/dialogs/CharacterSheet.lua
index 91edf7e0da..c503ffd721 100644
--- a/game/modules/tome/dialogs/CharacterSheet.lua
+++ b/game/modules/tome/dialogs/CharacterSheet.lua
@@ -559,7 +559,7 @@ function _M:drawDialog(kind, actor_to_compare)
 			WeaponTxt = WeaponTxt..":"
 
 			for i, o in ipairs(player:getInven(player.INVEN_MAINHAND)) do
-				local mean, dam = o.combat, o.combat
+				local mean, dam = player:getObjectCombat(o, "mainhand"), player:getObjectCombat(o, "mainhand")
 				if o.archery and mean then
 					dam = (player:getInven("QUIVER") and player:getInven("QUIVER")[1] and player:getInven("QUIVER")[1].combat)
 				end
@@ -584,7 +584,7 @@ function _M:drawDialog(kind, actor_to_compare)
 		-- Handle bare-handed combat
 		else
 			s:drawColorStringBlended(self.font, "#LIGHT_BLUE#Unarmed:", w, h, 255, 255, 255, true) h = h + self.font_h
-			local mean, dam = player.combat, player.combat
+			local mean, dam = player:getObjectCombat(nil, "barehand"), player:getObjectCombat(nil, "barehand")
 			if mean and dam then
 				text = compare_fields(player, actor_to_compare, function(actor, ...) return math.floor(actor:combatAttack(...)) end, "%3d", "%+.0f", 1, false, false, mean)
 				dur_text = ("%d"):format(math.floor(player:combatAttack(player.combat)/5))
@@ -609,7 +609,7 @@ function _M:drawDialog(kind, actor_to_compare)
 		if player:getInven(player.INVEN_OFFHAND) then
 			for i, o in ipairs(player:getInven(player.INVEN_OFFHAND)) do
 				local offmult = player:getOffHandMult(o.combat)
-				local mean, dam = o.combat, o.combat
+				local mean, dam = player:getObjectCombat(o, "offhand"), player:getObjectCombat(o, "offhand")
 				if o.archery and mean then
 					dam = (player:getInven("QUIVER") and player:getInven("QUIVER")[1] and player:getInven("QUIVER")[1].combat)
 				end
-- 
GitLab