Page 1 of 1

Checking for terrain via knockback

Posted: Tue Jan 26, 2016 10:24 pm
by Razakai
So I'm trying to implement a knockback that does 2 things - knocks other enemies aside, and if the target hits a wall, it does a bonus effect. On their own, both work ok. When combined, the wall check fails. I realise this is because in target:knockback theres a 'terrain' parameter which is what stuff like gravity uses, e.g.

Code: Select all

					target:knockback(self.x, self.y, dist, false, function(g, x, y)
However, I'm using a function in the prior bit (where false is) so I lack access to it, or at least can't get the syntax working. Adding a false/nil after the distance causes the talent to break.
Any ideas? Code is below:

Code: Select all

		target:knockback(self.x, self.y, t.getRange(self,t), function(t2, x, y)
			local d = rng.chance(2) and sides.hard_left or sides.hard_right
			local sx, sy = util.coordAddDir(t2.x, t2.y, d)
			local ox, oy = t2.x, t2.y
			t2:knockback(sx, sy, 2, function(t3) return true end)
			DamageType:get(DamageType.PHYSICAL).projector(self, t2.x, t2.y, DamageType.PHYSICAL, t.getDamage(self,t))
			if t2:canBe("stun") then t2:setEffect(t2.EFF_DAZED, 2, {}) end
			if game.level.map:checkAllEntities(x, y, "block_move", target) then
				slam = true
				dam = dam * 1.25
				pin = true
				game.logSeen(target, "%s is crushed against the wall!", target.name:capitalize())
			end
		end)

Re: Checking for terrain via knockback

Posted: Tue Jan 26, 2016 11:05 pm
by Radon26
mighty blow prodigy makes the target take additional damage when it hits the wall.
you could try look at that.