Fix for dammod description

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Fix for dammod description

#1 Post by yufra »

First, kudos to DG and everyone else for great work. It has been a while since I booted ToME up and I am loving all the new features.

I noticed that some gauntlets actually have a negative dammod, but this is currently displayed as "+-60%" instead of "-60%". The attached patch fixes this.
Attachments
dammod_description.txt
(875 Bytes) Downloaded 151 times
<DarkGod> lets say it's intended

edge2054
Retired Ninja
Posts: 3756
Joined: Fri May 28, 2010 4:38 pm

Re: Fix for dammod description

#2 Post by edge2054 »

I'm still trying to figure out how to fix this. I'd like for it to display 40% (the -60% it's showing is actually a modifier to the base of 1 from self.combat).

So while +-60% is wrong -60% is too.

The range on gauntlets is having the same issue (also a modifier to the base) so it'll display 0.3 instead of 1.4.

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Fix for dammod description

#3 Post by yufra »

edge2054 wrote:I'm still trying to figure out how to fix this. I'd like for it to display 40% (the -60% it's showing is actually a modifier to the base of 1 from self.combat).

So while +-60% is wrong -60% is too.

The range on gauntlets is having the same issue (also a modifier to the base) so it'll display 0.3 instead of 1.4.
The dammod have always shown the differences from the base, not the percentage of the base. Do you really want +60% to show 160%? If you do then this should do the trick:

Code: Select all

diff --git a/game/modules/tome/class/Object.lua b/game/modules/tome/class/Object.lua
index 5379879..f3fbb20 100644
--- a/game/modules/tome/class/Object.lua
+++ b/game/modules/tome/class/Object.lua
@@ -238,7 +238,7 @@ function _M:getTextualDesc()
 	local desc_combat = function(combat)
 		local dm = {}
 		for stat, i in pairs(combat.dammod or {}) do
-			dm[#dm+1] = ("+%d%% %s"):format(i * 100, Stats.stats_def[stat].name)
+			dm[#dm+1] = ("%d%% %s"):format(i * 100 + 100, Stats.stats_def[stat].name)
 		end
 		if #dm > 0 or (combat.dam or 0) ~= 0 or combat.damrange or (combat.atk or 0) ~= 0 or (combat.apr or 0) ~= 0 or (combat.physcrit or 0) ~= 0 then
 			desc:add(("%d Power [Range %0.2f] (%s), %d Accuracy, %d Armor Penetration, Crit %d%%"):format(combat.dam or 0, combat.damrange or 1.1, table.concat(dm, ','), combat.atk or 0, combat.apr or 0, combat.physcrit or 0), true)
<DarkGod> lets say it's intended

edge2054
Retired Ninja
Posts: 3756
Joined: Fri May 28, 2010 4:38 pm

Re: Fix for dammod description

#4 Post by edge2054 »

I talked with yufra about this on IRC and we came up with a decent solution.

The problem is I have no idea how to implement it. I've been goofing around with it but had very little success.

Line 457 in object.lua should take the players base combat values, subtract out whatever they're currently wearing, and then add in the tooltip for the item. The problem I'm having is I have no idea how to mix tables together like that.

edge2054
Retired Ninja
Posts: 3756
Joined: Fri May 28, 2010 4:38 pm

Re: Fix for dammod description

#5 Post by edge2054 »

With yufra and tiger eye's help got a fix put together for this and a diff mailed to Darkgod.

Should be fixed for next beta.

Post Reply