[b43 and earlier]Onslaught and Switch Place creates clones

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
Hachem_Muche
Uruivellas
Posts: 744
Joined: Thu Nov 18, 2010 6:42 pm

[b43 and earlier]Onslaught and Switch Place creates clones

#1 Post by Hachem_Muche »

A long standing bug: Using Switch Place with Onslaught in effect can cause the target to be knocked back and then create an inert clone when you switch places. An extra check that the target has not moved before doing the switch fixes the problem:

Code: Select all

newTalent{
	name = "Switch Place",
	type = {"cunning/dirty", 3},
	points = 5,
	random_ego = "defensive",
	cooldown = 10,
	stamina = 15,
	require = cuns_req3,
	requires_target = true,
	tactical = { DISABLE = 2 },
	getDuration = function(self, t) return 1 + self:getTalentLevel(t) end,
	action = function(self, t)
		local tg = {type="hit", range=self:getTalentRange(t)}
		local x, y, target = self:getTarget(tg)
		if not x or not y or not target then return nil end
		if core.fov.distance(self.x, self.y, x, y) > 1 then return nil end
		local tx, ty, sx, sy = target.x, target.y, self.x, self.y
		local hitted = self:attackTarget(target, nil, 0, true)

		if hitted and not self.dead then
			self:setEffect(self.EFF_EVASION, t.getDuration(self, t), {chance=50})

			-- Displace
--			if not target.dead then
			if not target.dead and target.x == tx and target.y == ty then -- EXTRA CHECK
				self.x = nil self.y = nil
				self:move(tx, ty, true)
				target.x = nil target.y = nil
				target:move(sx, sy, true)
			end
		end

		return true
	end,
	info = function(self, t)
		local duration = t.getDuration(self, t)
		return ([[Using a series of tricks and maneuvers, you switch places with your target.
		Switching places will confuse your foes, granting you evasion(50%%) for %d turns.
		While switching places your weapon(s) will connect with the target, not damaging it but on hit effects can trigger.]]):
		format(duration)
	end,
}
Author of the Infinite 500 and PlenumTooltip addons, and the joys of Scaling in ToME.

tiger_eye
Perspiring Physicist
Posts: 889
Joined: Thu Feb 17, 2011 5:20 am

Re: [b43 and earlier]Onslaught and Switch Place creates clon

#2 Post by tiger_eye »

Yup, good catch, and already fixed exactly as you proposed:

http://git.develz.org/?p=tome.git;a=com ... da92128142
darkgod wrote:OMFG tiger eye you are my hero!

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

Re: [b43 and earlier]Onslaught and Switch Place creates clon

#3 Post by Hachem_Muche »

Cool. I got tired of a boss littering a level with my clones, so I stopped playing and squashed that bug. :twisted:
Author of the Infinite 500 and PlenumTooltip addons, and the joys of Scaling in ToME.

Post Reply