

// Nightmare imp
class NightmareImp : DoomImp
{
//custom attack code
//-----------------------------------------------------------------------------
	void A_NightmareAttack()
	{
		let targ = target;
		if (targ)
		{
			if (CheckMeleeRange())
			{
				int damage = random(1,8) * 3;
				A_StartSound ("imp/melee", CHAN_WEAPON);
				int newdam = targ.DamageMobj (self, self, damage, "Melee");
				targ.TraceBleed (newdam > 0 ? newdam : damage, self);
			}
			else
			{
				SpawnMissile (targ, "NightmareBall");
			}
		}
	}
//-----------------------------------------------------------------------------	
	Default
	{
		Radius 20;
		Height 56;
		Speed 16;
		RenderStyle "Translucent";
		Alpha 0.5;
		BloodColor "2D007C";
		Obituary "%o was sneak attacked by a NightmareImp";
	}
 
	States
	{
	Spawn:
		BDTR AB 10 A_Look;
		Loop;
	See:
		BDTR AABBCCDD 3 A_Chase;
		Loop;
	Melee:
	Missile:
		BDTR EF 8 A_FaceTarget;
		BDTR G 6 A_NightmareAttack;
		Goto See;
	Pain:
		BDTR H 2;
		BDTR H 2 A_Pain;
		Goto See;
	Death:
		BDTR I 8;
		BDTR J 8 A_Scream;
		BDTR K 6;
		BDTR L 6 A_NoBlocking;
		BDTR M -1;
		Stop;
	XDeath:
		BDTR N 5;
		BDTR O 5 A_XScream;
		BDTR P 5;
		BDTR Q 5 A_NoBlocking;
		BDTR RST 5;
		BDTR U -1;
		Stop;
	Raise:
		BDTR ML 8;
		BDTR KJI 6;
		Goto See;
	}
}
//Nightmare Imp Ball
class NightmareBall : DoomImpBall
{
	Default
	{
		Radius 6;
		Height 8;
		Speed 20;
		FastSpeed 40;
	}
	States
	{
	Spawn:
		BDBL AB 4 BRIGHT;
		Loop;
	Death:
		BDBL CDE 6 BRIGHT;
		Stop;
	}
}