//===========================================================================
//
// Pain Elemental
//
//===========================================================================
ACTOR 46MAN //71
{
	Game Doom

	var int user_delay46MANatk;	
	
	SpawnID 8
	Health 250
	PainChance 45
	Speed 12
	Radius 30
	Height 56
	Mass 400
	Monster
Translation "112:127=[128,0,0]:[0,0,0]"
	+FLOORCLIP +FASTER +FASTMELEE
        SeeSound "Gensight"
        PainSound "Genpain"
        DeathSound "Gendeath"
        ActiveSound "Genactive"

	AttackSound "AWP/FIRE"
	Obituary "$OB_DEMONHIT"

	DropItem "DropSpawner5", 128
	DropItem "DeadClip5Inv", 160
		Species "PainMan"

	States
	{
	Spawn:
		PHOB AB 10 A_Look
		Loop
		
	See:
		TNT1 A 0 A_JumpIf(user_delay46MANatk<1,"See_atk")

	See_noatk:
		PHOB AABBCCDD 3 A_Chase("","")
TNT1 A 0 A_SetUserVar(user_delay46MANatk,user_delay46MANatk-1)
		Loop

	See_atk:
		PHOB AABBCCDD 3 A_Chase
TNT1 A 0 A_SetUserVar(user_delay46MANatk,user_delay46MANatk-1)
		Loop
		


		
	Missile:
		PHOB E 6 A_FaceTarget
		                PHOB F 0 BRIGHT //A_CPosAttack
                PHOB F 0 BRIGHT //A_CPosAttack
                PHOB F 0 BRIGHT //A_CPosAttack
                PHOB F 0 BRIGHT //A_CPosAttack
                PHOB F 0 BRIGHT //A_CPosAttack
		TNT1 A 0 A_PlaySound("AWP/Distant", 7)

		TNT1 A 0 A_PlaySound("AWP/FIRE", CHAN_WEAPON)
		TNT1 A 0 A_CustomBulletAttack(5.5, 0, 1, random(5,15)*2, "BulletPuff", 0, CBAF_NORANDOM)		
		TNT1 A 0 A_CustomMissile("Tracer_Monster",36,5,FRandom(-8,8),CMF_OFFSETPITCH,FRandom(-5,5))		
		TNT1 A 0 A_SetUserVar(user_delay46MANatk,4)

		
//TNT1 A 0 A_ChangeFlag("NOPAIN", true)
                PHOB F 5 BRIGHT //A_CPosAttack
                PHOB F 15
        //B46G A 0 A_PlaySoundEx("W46FB","soundslot5",0)
                PHOB D 10 
                PHOB E 24
//TNT1 A 0 A_ChangeFlag("NOPAIN", false)
		Goto See
	Pain:
		PHOB G 3
		PHOB G 3 A_Pain
		Goto See

	Pain.FLASHBANGFREEZE:
TNT1 A 0 A_ChangeFlag("NOPAIN", true)
		PHOB G 2
		PHOB A 175 A_Pain
TNT1 A 0 A_ChangeFlag("NOPAIN", false)
		Goto See

	Death:
//TNT1 A 0 A_GiveToTarget("MoneySystem", 250)

		PHOB H 5
		PHOB I 5 A_Scream
		PHOB J 5 A_NoBlocking
		PHOB K 4
		PHOB L 4 
		PHOB M 4
		PHOB N -1
		Stop





XDeath:
//TNT1 A 0 A_GiveToTarget("MoneySystem", 500)
PHOB O 0 A_SpawnItemEx("NashGore_GibPieceGenerator11",0,0,0,0,0,0,0,128)
PHOB O 0 A_SpawnItemEx("NashGore_GibPieceGenerator11",0,0,0,0,0,0,0,128)
PHOB O 0 A_SpawnItemEx("NashGore_GibPieceGeneratorSARG",0,0,0,0,0,0,0,128)
PHOB O 0 A_SpawnItemEx("NashGore_GibGenerator",0,0,0,0,0,0,0,128)
PHOB O 0 A_SpawnItemEx("NashGore_GibGenerator",0,0,0,0,0,0,0,128)
PHOB O 5
PHOB O 0 A_SpawnItemEx("NashGore_GibGenerator",0,0,0,0,0,0,0,128)
PHOB P 5 A_playsound("demon/xdeath")
PHOB P 0 A_SpawnItemEx("NashGore_GibGenerator",0,0,0,0,0,0,0,128)
PHOB Q 5
PHOB Q 0 A_SpawnItemEx("NashGore_GibGenerator",0,0,0,0,0,0,0,128)
PHOB R 5 A_NoBlocking
PHOB STUV 5
PHOB W -1
stop
	Raise:
		PHOB N 5
		PHOB MLKJI 5
		Goto See
	}
}