actor NetherImp : Imp
{
  Obituary "%o was cursed by a Nether Imp."
  HitObituary "%o was touched by a Nether Imp." // ;)
  Health 200
  Speed 9
  Scale 1.1
  Painchance 80
  DropItem "LifeEssence" 125
  DropItem "ArmorBonusMax" 125
  DropItem "DustMana" 70 30
  Seesound "devil/Sight"
  Painsound "voidimp/Pain"
  Deathsound "devil/Death"
  Activesound "superimp/Active"
  BloodColor "Green"
  +MISSILEMORE
  states
  {
  Spawn:
    NIMP A 5 A_Look
    loop
  See:
  	TNT1 A 0 A_Jump(46,"Evade")
    NIMP AABB 3 A_Chase
	TNT1 A 0 A_SpawnItem("HumanishStep",0,0,0,0)
	NIMP CCDD 3 A_Chase
	TNT1 A 0 A_SpawnItem("HumanishStep",0,0,0,0)
    loop
  Evade:
	TNT1 A 0 A_Jump(128,7)
	TNT1 A 0 ThrustThing(Angle*256/360+64,16,0,0)
	NIMP AAAA 3 A_Chase
	TNT1 A 0 A_Stop
	Goto See
	TNT1 A 0 ThrustThing(Angle*256/360+192,16,0,0)
	NIMP AAAA 3 A_Chase
	TNT1 A 0 A_Stop
	TNT1 A 0 A_JumpIfTargetInLOS("Missile")
	Goto See
  Melee: 
    NIMP EF 5 A_FaceTarget
    NIMP G 4 A_CustomMeleeAttack(20)
	NIMP FE 5 A_FaceTarget
    Goto See 
  Missile:
    NIMP E 0 A_Jump(256, "Attack1", "Attack2")
    Goto See
  Attack1:
    NIMP EF 8 Bright A_FaceTarget
    NIMP G 6 Bright A_CustomMissile("NetherLightning", 34, 0, 0)
    NIMP FEF 8 Bright A_FaceTarget
    NIMP G 6 Bright A_CustomMissile("NetherLightning", 34, 0, 0)
    Goto See
  Attack2:
    NIMP IJ 8 Bright A_FaceTarget
    NIMP K 4 Bright A_CustomMissile("NetherBall", 34, 0, 0)
    NIMP K 0 A_CustomMissile("NetherBall", 34, 0, 6)
    NIMP K 4 Bright A_CustomMissile("NetherBall", 34, 0, -6)
    Goto See
  Pain:
    NIMP H 2 
    NIMP H 2 A_Pain
    goto See
  Death:
    NIMP L 8 A_Scream
    NIMP MN 6
    NIMP O 6 A_Fall
    NIMP P -1
    Stop
  XDeath:
    NIMP Q 3 
	NIMP R 3 A_XScream
	NIMP S 3 A_SpawnItemEx("GreenGibbedGenerator",0,0,0,0,0,0,0,128,0)
	NIMP T 3 A_Fall
	NIMP UVW 3
	NIMP X -1
    Stop
  Raise:
	TNT1 A 0
	TNT1 A 0 A_SpawnItemEx("VileHealEffect",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION)
	NIMP PONML 6
	Goto See
  }
}

actor NetherBall
{
  Projectile
  Damagetype "ImpComet"
  Radius 8
  Height 6
  Speed 20
  Damage 7
  Renderstyle Add
  Alpha 0.67
  SeeSound "imp/attack"
  DeathSound "imp/shotx"
  Decal DoomImpScorch
  States
  {
  Spawn:
    IBAL AAAABBBB 1 Bright A_SpawnItemEx ("NetherImpFireBallFX", 0, 0, 0, random(0, -4), random(-2, 2), random(-2, 2), 0, 0, 0)
    Loop
  Death:
	TNT1 A 0 A_SpawnItemEx("GreenParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
	TNT1 AAA 0 A_CustomMissile("Kaboom4", 0, 0, random(0,360), 2, random(0,360))
	TNT1 AAA 0 A_CustomMissile("SmokeFX4", 0, 0, random(0,360), 2, random(0,360))
    IBAL CDE 4 Bright
    Stop
  }
}

ACTOR NetherImpFireBallFX : ImpBallTrail
{
  RenderStyle Add
  Alpha 1
  Scale 0.35
  States
  {
  Spawn:
	TNT1 A 0
    TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "Toaster")
    TNT1 A 2
    FIG1 ABCDEFGHIJKL 1 Bright A_ChangeVelocity(0,0,1)
    Stop
  }
}

ACTOR NetherLightning : FastProjectile
{
  Damagetype "ImpComet"
  Radius 8
  Height 6
  Speed 50
  Damage 5
  +FORCEXYBILLBOARD
  SeeSound "NetherLightning"
  DeathSound "imp/shotx"
  Missileheight 8
  Missiletype "NetherLightningTrailSpawner"
  Renderstyle Add
  Scale 0.2
  States
  {
  Spawn:
	NLIG ABCDE 1 Bright
    Loop
  Death:
	TNT1 A 0 A_SpawnItemEx("YellowParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
	TNT1 AAA 0 A_CustomMissile("KaboomGoldBabySent", 0, 0, random(0,360), 2, random(0,360))
	TNT1 AAA 0 A_CustomMissile("SmokeFX4", 0, 0, random(0,360), 2, random(0,360))
	TNT1 A 0 A_SetScale(0.75)
    NLIT ABCDEFG 1 Bright
    Stop
  }
}

actor NetherLightningTrailSpawner : ImpBallTrail
{
  States
  {
  Spawn:
	TNT1 A 0
    TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "Toaster")
    TNT1 AA 0 A_SpawnItemEx("NetherLightningTrail", Random(-5, 5), Random(-5, 5), Random(-5, 5), 0, 0, 0, 0, 160)
	Stop
  }
}

actor NetherLightningTrail : ImpballTrail
{
  Scale 0.2
  Renderstyle Add
  Alpha 0.8
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "Toaster")
    TNT1 A 1
    TNT1 A 0 A_Jump(255, "Puff1", "Puff2", "Puff3")
  Puff1:
    NLIG F 1 Bright A_FadeOut(0.1)
    Loop
  Puff2:
    NLIG G 1 Bright A_FadeOut(0.1)
    Loop
  Puff3:
    NLIG H 1 Bright A_FadeOut(0.1)
    Loop
  }
}