Page 1 of 1

[b43 and earlier]Onslaught and Switch Place creates clones

Posted: Mon Dec 03, 2012 5:41 am
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,
}

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

Posted: Mon Dec 03, 2012 5:54 am
by tiger_eye
Yup, good catch, and already fixed exactly as you proposed:

http://git.develz.org/?p=tome.git;a=com ... da92128142

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

Posted: Mon Dec 03, 2012 4:40 pm
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: