Page 1 of 1

Damage types

Posted: Mon Jan 10, 2011 6:07 am
by Final Master
During talk on IRC about various things, the need/usefulness of a random blind damage type came up. Edge coded this up in a jiffy.

Code: Select all

newDamageType{
	name = "Random Blind", type = "RANDOM_BLIND",
	projector = function(src, x, y, type, dam)
		local target = game.level.map(x, y, Map.ACTOR)
		if target and rng.percent(10) then
			if target:checkHit(src:combatAttackDex(), target:combatPhysicalResist(), 0, 95, 15) and target:canBe("blind") then
				target:setEffect(target.EFF_BLINDED, 4, {})
			else
				game.logSeen(target, "%s resists!", target.name:capitalize())
			end
		end
	end,
}
I would recommend any further damage type changes/ideas to be posted here with code.

Re: Damage types

Posted: Mon Jan 10, 2011 6:37 am
by yufra
You should change the duration of the effect (currently 4) to use the "dam" argument passed in to be more flexible. Actually, just take a closer look at the RANDOM_CONFUSION damage type and change the EFF_CONFUSED to EFF_BLINDED.