Page 1 of 1

[b42] Brainlocked or knocked back?

Posted: Fri Oct 05, 2012 1:59 pm
by jenx
Just working through some code in damage_types.lua and noticed what seem to be two inconsistencies:

Code: Select all

-- Darkness damage + repulsion; checks for spell power against mental resistance
newDamageType{
	name = "darkness knockback", type = "DARKKNOCKBACK",
	projector = function(src, x, y, type, dam, tmp)
		local target = game.level.map(x, y, Map.ACTOR)
		if _G.type(dam) ~= "table" then dam = {dam=dam, dist=3} end
		tmp = tmp or {}
		if target and not tmp[target] then
			tmp[target] = true
			DamageType:get(DamageType.DARKNESS).projector(src, x, y, DamageType.DARKNESS, dam.dam)
			if target:canBe("knockback") then
				if target:checkHit(src:combatSpellpower(), target:combatMentalResist(), 0, 95, 15) then
					target:knockback(src.x, src.y, dam.dist)
					target:crossTierEffect(target.EFF_BRAINLOCKED, src:combatSpellpower())
					game.logSeen(target, "%s is knocked back!", target.name:capitalize())
				end
			else
				game.logSeen(target, "%s resists the darkness!", target.name:capitalize())
			end
		end
	end,
}
and

Code: Select all

-- Fear check + repulsion; checks for mind power against physical resistance
newDamageType{
	name = "fear knockback", type = "FEARKNOCKBACK",
	projector = function(src, x, y, type, dam, tmp)
		local target = game.level.map(x, y, Map.ACTOR)
		tmp = tmp or {}
		if target and not tmp[target] then
			tmp[target] = true
			if target:canBe("fear") then
				if target:checkHit(src:combatMindpower(), target:combatPhysicalResist(), 0, 95, 15) then
					target:knockback(dam.x, dam.y, dam.dist)
					target:crossTierEffect(target.EFF_BRAINLOCKED, src:combatMindpower())
					game.logSeen(target, "%s is knocked back!", target.name:capitalize())
				end
			else
				game.logSeen(target, "%s resists the frightening sight!", target.name:capitalize())
			end
		end
	end,
}
From looking at the description, and at similar effects, I would have thought that both should set EFF_OFFBALANCE and not EFF_BRAINLOCKED. But perhaps this is knocking back + brainlock and is correct as is.

Re: [b42] Brainlocked or knocked back?

Posted: Fri Oct 05, 2012 4:31 pm
by phantomglider
The first works right. It's checking against mental save (because it's making them so frightened they run away) so it causes a mental cross-tier effect. The second should probably check against mental save too.