actor PyroImp 14564
{
	//$Category monsters
    Health 150
    Radius 20
    Height 56
    Speed 9
    PainChance 200
	Mass 1000
    MONSTER 
    +FLOORCLIP
	+DONTHURTSPECIES
    SeeSound "imp/sight"
    PainSound "imp/pain"
    DeathSound "imp/death"
    ActiveSound "imp/active"
    MeleeSound "imp/melee"
    Obituary "%o was burned by a pyro imp."
    HitObituary "%o was cut open by a pyro imp."
    MeleeDamage 3
    States
    {
    Spawn:
        PRIM AB 10 A_Look
        Loop
    See:
        PRIM AABBCCDD 3 A_Chase
        Loop
    Melee:
		PRIM EF 8 A_FaceTarget
        PRIM G 6 A_MeleeAttack
    Missile:
		PRIM E 0 A_JumpIfCloser(256, "Missile1")
		PRIM EF 8 A_FaceTarget
        PRIM G 6 A_CustomMissile (PyroImpBallNoGravity, 32, 12, 0, 0, 0)
		Goto See
	Missile1:
        PRIM EF 4 A_FaceTarget
        PRIM G 3 A_CustomMissile (PyroImpBall, 32, 12, 0, 2, 10)
		PRIM EF 4 A_FaceTarget
        PRIM G 3 A_CustomMissile (PyroImpBall, 32, 12, 0, 2, 10)
		PRIM EF 4 A_FaceTarget
        PRIM G 3 A_CustomMissile (PyroImpBall, 32, 12, 0, 2, 10)
		Goto See
    Pain:
        PRIM H 4 A_Pain
        Goto See
    Death:
        PRIM N 5 A_SpawnItemEx (PyroImpExplosion, 0, 0, 30)
        PRIM O 5 A_XScream
        PRIM P 5
        PRIM Q 5 A_Fall
        PRIM RST 5
        PRIM U -1
        Stop
    Raise:
        PRIM UTSRQPON 4
        Goto See
    }
}

actor PyroImpBall : DoomImpBall
{
  renderstyle Add
  DamageType Fire
  +RANDOMIZE
  +LOWGRAVITY
  -NOGRAVITY
  states
  {
  Spawn:
    BAL1 A 1 bright
    BAL1 A 0 bright A_SpawnItemEx (PyroImpBallFire, random(1,-1), random(1,-1), random(1,-1), 0, 0, 0 , random(0,360), 16, 0)
    BAL1 B 1 bright
    BAL1 B 0 bright A_SpawnItemEx (PyroImpBallFire, random(1,-1), random(1,-1), random(1,-1), 0, 0, 0 , random(0,360), 16, 0)
    loop
  Death:
	BAL1 C 0 bright A_CustomMissile (PyroImpBallFire2, 0, 0, 0, 0)
    BAL1 C 4 bright A_Explode (5, 56, 1)
    BAL1 CCCCCCCCC 0 bright A_SpawnItemEx (PyroImpBallFire, random(1,-1), random(1,-1), random(1,-1), 6, 0, random(1,-1) , random(0,360), 0, 0)
    BAL1 DE 4 bright
    stop
  }
}

actor PyroImpBallNoGravity : PyroImpBall
{
	+NOGRAVITY
	-LOWGRAVITY
	states
  	{
  Death:
    BAL1 C 4 bright A_Explode (5, 56, 1)
    BAL1 CCCCCCCCC 0 bright A_SpawnItemEx (PyroImpBallFire, random(1,-1), random(1,-1), random(1,-1), 6, 0, random(1,-1) , random(0,360), 0, 0)
    BAL1 DE 4 bright
    stop
  }
}

actor PyroImpFire
{
  radius 6
  height 8
  damage 0
  scale 0.7
  renderstyle Add
  +NOBLOCKMAP
  +NOGRAVITY
  +MISSILE
  +NOTELEPORT
  +DONTSPLASH
  +RANDOMIZE
  states
  {
  Spawn:
    CFCF ABCDEFGHIJKLMNOP 2 bright 
    stop
  }
}

actor PyroImpBallFire : PyroImpFire
{
  scale 0.4
  states
  {
  Spawn:
    TNT1 A 2
    CFCF ABCDEFGHIJKLMNOP 1 bright 
    stop
  }
}

actor PyroImpBallFire2
{
  DamageType Fire
  scale 2.0
  Radius 8
  Height 40
  renderstyle Add
  alpha 0.90
  PROJECTILE
  -NOGRAVITY
  +LOWGRAVITY
  +NOEXPLODEFLOOR
  +NODAMAGETHRUST
  +THRUGHOST
  DONTHURTSHOOTER
  states
  {
  Spawn:
    CFCF PON 2 bright 
	CFCF A 1 bright A_PlaySound("weapons/onfire")
	CFCF A 1 bright A_Explode (4, 56)
	CFCF BCDEFGHIJKLM 2 bright A_Explode (4, 56)
	CFCF A 1 bright A_PlaySound ("weapons/onfire")
	CFCF A 1 bright A_Explode (4, 56)
	CFCF BCDEFGHIJKLM 2 bright A_Explode(4, 56)
	CFCF A 1 bright A_PlaySound ("weapons/onfire")
	CFCF A 1 bright A_Explode (4, 56)
	CFCF BCDEFGHIJKLM 2 bright A_Explode (4, 56)
	CFCF NOP 2 bright 
    stop
  }
}

actor PyroImpExplosion
{
  radius 6
  height 8
  damage 0
  scale 0.8
  renderstyle Add
  alpha 0.7
  +NOBLOCKMAP
  +NOGRAVITY
  states
  {
  Spawn:
    MISL B 0 bright A_PlaySound ("weapons/rocklx")
  	MISL B 4 bright A_Explode (15, 72, 1)
	MISL CDE 6 bright
	stop
  }
}

