[ToME 1.5.10] Swapping places while pinned.

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
BugReporter
Higher
Posts: 62
Joined: Wed Jun 06, 2018 10:53 am

[ToME 1.5.10] Swapping places while pinned.

#1 Post by BugReporter »

Short description.
A player character can exchange places with a friendly unit while under pin effect.

Actual result.
A pinned player character swaps places when ordered to move to an adjacent tile occupied by a friendly unit.

Expected result.
A pinned player character shouldn't be able to swap places when ordered to move to an adjacent tile occupied by a friendly unit.

Steps to reproduce.
1. Enable Developer Mode.
2. Create a cornac/alchemist character.
3. Apply pinned effect with game.player:setEffect(game.player.EFF_PINNED, 10, {}).
4. Try to switch places with Golem.

Game version.
1.5.10 for windows from ToME site.

Comment.
Also works when a player character tries to switch places with a pinned friendly unit. May be it is intended, but I think it's not unreasonable to consider this move a movement. A summoner can utilise this to cover some ground (while pinned/bone grabbed) in tight places like corridors.
A condition for Displace code (line 59) in ..\mod\class\interface\Combat.lua may do the trick. Definitely requires more testing.

Code: Select all

			-- Displace
			if (not self:attr("never_move")) and (not target:attr("never_move")) then
				local tx, ty, sx, sy = target.x, target.y, self.x, self.y
				target:move(sx, sy, true)
				self:move(tx, ty, true)
				if target.describeFloor then target:describeFloor(target.x, target.y, true) end
				if self.describeFloor then self:describeFloor(self.x, self.y, true) end
	
				local energy = game.energy_to_act * self:combatMovementSpeed(x, y)
				if self:attr("bump_swap_speed_divide") then
					energy = energy / self:attr("bump_swap_speed_divide")
				end
				self:useEnergy(energy)
				self.did_energy = true
			elseif self:attr("never_move") then
				game.logPlayer(self, "You are unable to swap places because you can't move!")
			else
				game.logPlayer(self, "You are unable to swap places because the target can't move!")
			end

Post Reply