[1.0.4] Vimsense doesn't work correctly on items

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
minmay
Wyrmic
Posts: 286
Joined: Fri Sep 07, 2012 1:34 am
Contact:

[1.0.4] Vimsense doesn't work correctly on items

#1 Post by minmay »

vim.lua line 64:

Code: Select all

a:setEffect(a.EFF_VIMSENSE, 2, {power=self:combatTalentSpellDamage(self.T_VIMSENSE, 10, 45)})
self.T_VIMSENSE is the actor's Vimsense talent, which works fine if you're casting the spell...but doesn't work fine at all if you're using it from an item, such as Corrupted Gaze. Should be changed to

Code: Select all

a:setEffect(a.EFF_VIMSENSE, 2, {power=self:combatTalentSpellDamage(t, 10, 45)})

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

Re: [1.0.4] Vimsense doesn't work correctly on items

#2 Post by Hachem_Muche »

Those changes don't fix the problem. The issue is that, after the initial item activation, the calculation performed in
minmay wrote:vim.lua line 64:

Code: Select all

a:setEffect(a.EFF_VIMSENSE, 2, {power=self:combatTalentSpellDamage(self.T_VIMSENSE, 10, 45)})
is rerun with the player's talent stats (which are overridden by the item's talent stats when it's used by the use object code), that often include no talent levels. The fix is to store the appropriate value for blight resistance and then apply that on each turn as needed. This is the 1.0.5 compatible patch:

Code: Select all

 game/modules/tome/data/talents/corruptions/vim.lua | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/game/modules/tome/data/talents/corruptions/vim.lua b/game/modules/tome/data/talents/corruptions/vim.lua
index 092bbe7..d1081a7 100644
--- a/game/modules/tome/data/talents/corruptions/vim.lua
+++ b/game/modules/tome/data/talents/corruptions/vim.lua
@@ -61,11 +61,12 @@ newTalent{
 		self:setEffect(self.EFF_SENSE, t.getDuration(self,t), {
 			range = rad,
 			actor = 1,
+			VimsensePenalty = t.getResistPenalty(self,t), -- Compute resist penalty at time of activation
 			on_detect = function(self, x, y)
 				local a = game.level.map(x, y, engine.Map.ACTOR)
 				if not a or self:reactionToward(a) >= 0 then return end
 				a:setTarget(game.player)
-				a:setEffect(a.EFF_VIMSENSE, 2, {power=t.getResistPenalty(self,t)})
+				a:setEffect(a.EFF_VIMSENSE, 2, {power=self:hasEffect(self.EFF_SENSE).VimsensePenalty or 0})
 			end,
 		})
 		game:playSoundNear(self, "talents/spell_generic")
Author of the Infinite 500 and PlenumTooltip addons, and the joys of Scaling in ToME.

Post Reply