[git] Bonus accuracy on ammo doesn't seem to work

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
grmblfzzz
Thalore
Posts: 133
Joined: Fri Nov 25, 2011 7:53 pm

[git] Bonus accuracy on ammo doesn't seem to work

#1 Post by grmblfzzz »

Not sure if this applies in 1.04 as well, or just the git version, but all the ammo I've found with bonus accuracy doesn't actually give it to you. Unless it's super secret and just doesn't show up on your character sheet accuracy value.

Hachem_Muche
Uruivellas
Posts: 744
Joined: Thu Nov 18, 2010 6:42 pm

Re: [git] Bonus accuracy on ammo doesn't seem to work

#2 Post by Hachem_Muche »

This is a character sheet issue only. (You can confirm that you're getting ammo bonuses in te4_log.txt)

There's an additional error in that the character sheet is not checking the ammo type versus the launcher and incorrectly showing the damage for the ammo that cannot be used. In this case, you're actually left with a (weak) melee attack.
Fix:

Code: Select all

 game/modules/tome/dialogs/CharacterSheet.lua | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/game/modules/tome/dialogs/CharacterSheet.lua b/game/modules/tome/dialogs/CharacterSheet.lua
index f7c9b19..4671ec9 100644
--- a/game/modules/tome/dialogs/CharacterSheet.lua
+++ b/game/modules/tome/dialogs/CharacterSheet.lua
@@ -562,12 +562,17 @@ function _M:drawDialog(kind, actor_to_compare)
 
 			for i, o in ipairs(player:getInven(player.INVEN_MAINHAND)) do
 				local mean, dam = player:getObjectCombat(o, "mainhand"), player:getObjectCombat(o, "mainhand")
+				local range
 				if o.archery and mean then
-					dam = (player:getInven("QUIVER") and player:getInven("QUIVER")[1] and player:getInven("QUIVER")[1].combat)
+					local ammo = player:getInven("QUIVER") and player:getInven("QUIVER")[1]
+					if ammo and ammo.archery_ammo == o.archery then -- make sure ammo matches launcher
+						dam = player:getObjectCombat(ammo, "mainhand")
+						range = mean.range
+					end
 				end
 				if mean and dam then
 					s:drawColorStringBlended(self.font, WeaponTxt, w, h, 255, 255, 255, true) h = h + self.font_h
-					text = compare_fields(player, actor_to_compare, function(actor, ...) return math.floor(actor:combatAttack(...)) end, "%3d", "%+.0f", 1, false, false, mean)
+					text = compare_fields(player, actor_to_compare, function(actor, ...) return math.floor(actor:combatAttack(...)) end, "%3d", "%+.0f", 1, false, false, mean, dam)
 					dur_text = ("%d"):format(math.floor(player:combatAttack(o.combat)/5))
 					self:mouseTooltip(self.TOOLTIP_COMBAT_ATTACK, s:drawColorStringBlended(self.font, ("Accuracy    : #00ff00#%s"):format(text), w, h, 255, 255, 255, true)) h = h + self.font_h
 					text = compare_fields(player, actor_to_compare, function(actor, ...) return actor:combatDamage(...) end, "%3d", "%+.0f", 1, false, false, dam)
@@ -579,8 +584,8 @@ function _M:drawDialog(kind, actor_to_compare)
 					text = compare_fields(player, actor_to_compare, function(actor, ...) return actor:combatSpeed(...) end, "%.2f%%", "%+.2f%%", 100, true, false, mean)
 					self:mouseTooltip(self.TOOLTIP_COMBAT_SPEED,  s:drawColorStringBlended(self.font, ("Speed       : #00ff00#%s"):format(text), w, h, 255, 255, 255, true)) h = h + self.font_h
 				end
-				if mean and mean.range then
-					self:mouseTooltip(self.TOOLTIP_COMBAT_RANGE, s:drawColorStringBlended(self.font, ("Range (Main Hand): #00ff00#%3d"):format(mean.range), w, h, 255, 255, 255, true)) h = h + self.font_h
+				if range then
+					self:mouseTooltip(self.TOOLTIP_COMBAT_RANGE, s:drawColorStringBlended(self.font, ("Range (Main Hand): #00ff00#%3d"):format(range), w, h, 255, 255, 255, true)) h = h + self.font_h
 				end
 			end
 		-- Handle bare-handed combat
Author of the Infinite 500 and PlenumTooltip addons, and the joys of Scaling in ToME.

Post Reply