ACTOR NecromancerDevastator : Weapon
{
   Inventory.PickupSound "misc/w_pkup"
   Inventory.PickupMessage "You got the 'Devastator' Seeker Missile Launcher!"
   Weapon.UpSound "weapons/gemiup"
   Weapon.AmmoType "RocketAmmo"
   Weapon.AmmoGive 6
   Weapon.AmmoUse 1
   Inventory.RestrictedTo "NecromancerClass"
   Tag "Devastator"
   Scale 0.85
   States
   {
   Spawn:
      RNPR A -1
      LOOP
   Ready: 
      RPRL A 1 A_WeaponReady
      LOOP
   Deselect: 
      RPRL A 1 A_Lower
	  TNT1 A 0 A_Lower
	  TNT1 A 0 A_Lower
      Loop
   Select: 
      RPRL A 1 A_Raise
	  TNT1 A 0 A_Raise
	  TNT1 A 0 A_Raise
      Loop
  Fire:
  RPRL A 0 A_GunFlash

  // First Rocket
  RPRL B 1 Bright
  RPRL C 0 A_JumpIfNoAmmo("NoAmmo")
  RPRL C 0 A_PlaySoundEx("weapons/gemifire", "Auto")
  RPRL C 0 A_FireCustomMissile("DevastatorRocket", random(3, -6), 1, 15, random(5, -5))
  // Second Rocket
  RPRL D 1 Bright
  RPRL E 1 Bright
  RPRL F 1 Bright
  RPRL C 0 A_JumpIfNoAmmo("NoAmmo")
  RPRL C 0 A_PlaySoundEx("weapons/gemifire", "Auto")
  RPRL C 0 A_FireCustomMissile("DevastatorRocket", random(3, -6), 1, 15, random(5, -5))
  // Third Rocket
  RPRL D 1 Bright
  RPRL E 1 Bright
  RPRL F 1 Bright
  RPRL C 0 A_JumpIfNoAmmo("NoAmmo")
  RPRL C 0 A_PlaySoundEx("weapons/gemifire", "Auto")
  RPRL C 0 A_FireCustomMissile("DevastatorRocket", random(3, -6), 1, 15, random(5, -5))
  // Fourth Rocket
  RPRL D 1 Bright
  RPRL E 1 Bright
  RPRL F 1 Bright
  RPRL C 0 A_JumpIfNoAmmo("NoAmmo")
  RPRL C 0 A_PlaySoundEx("weapons/gemifire", "Auto")
  RPRL C 0 A_FireCustomMissile("DevastatorRocket", random(3, -6), 1, 15, random(5, -5))
  // Fifth Rocket
  RPRL D 1 Bright
  RPRL E 1 Bright
  RPRL F 1 Bright
  RPRL C 0 A_JumpIfNoAmmo("NoAmmo")
  RPRL C 0 A_PlaySoundEx("weapons/gemifire", "Auto")
  RPRL C 0 A_FireCustomMissile("DevastatorRocket", random(3, -6), 1, 15, random(5, -5))
  RPRL D 1 Bright
  RPRL E 1 Bright
  RPRL F 1 Bright
  RPRL A 30
  Goto Ready
 NoAmmo:
  Goto Ready
	AltFire:
      RPRL A 0 A_JumpIfInventory("RocketAmmo", 5, 1)
      Goto Ready
      RPRL A 0 A_TakeInventory("RocketAmmo", 5)
      RPRL A 0 A_PlaySoundEx("weapons/gemifire", "Auto")
      RPRL A 0 A_GunFlash
      RPRL BC 2 Bright           // Slow these frames down (2 tics each)
      RPRL C 0 A_FireCustomMissile("BigDevastatorRocket", 0, 1, 15, 0)
      RPRL DEF 5 Bright          // Longer post-fire animation
      RPRL A 35                   // Delay before Ready
      Goto Ready
   Flash:
      TNT1 A 5 A_Light2
      TNT1 A 3 A_Light1
      TNT1 A 0 A_Light0
      Stop
   }
}

ACTOR DevastatorRocket : Rocket
{
  Speed 75
  Scale 0.8
  Damage 15
  +SEEKERMISSILE
  -RANDOMIZE
  -ROCKETTRAIL
  SeeSound ""
  Decal Scorch
    SelfObituary "%o went kaboom with %p own rockets."
  States
  {
  Spawn:
    TNT1 A 0 A_SeekerMissile(3, 6, SMF_LOOK, 128, 16) // More balanced seeking
    DROK A 1 Bright A_SpawnItemEx("DevastatorSmokeTrail", 0, 0, 0, 0, 0, 0, 0, 128, 0)
    Loop

  Death:
    TNT1 A 0 A_Explode (75, 128, 1)
    TNT1 AAAAAAAAAA 0 Bright A_SpawnItemEx("DevastatorSmoke", 0, 0, 0, random(-2,2), random(-2,2), 1+random(-3,1), 0, 128, 0)
    TNT1 AAAA 0 Bright A_SpawnItemEx("DevastatorBoomy", 0, random(-2,2), random(-2,2), 0, 0, 1, 0, 128, 0)
    TNT1 A 1
    Stop
  }
}

ACTOR BigDevastatorRocket : Rocket
{
    Speed 18
    Damage 100
    Radius 11
    Height 8
    Scale 1.5
    +NoBlockMap
    +Missile
    +RANDOMIZE
    SeeSound ""
    Decal Scorch
    RenderStyle Normal
    Alpha 1.0
  SelfObituary "%o got nuked with %p own Giga Rocket."
    States
    {
    Spawn:
        DROK A 1 Bright
        Loop
    Death:
        TNT1 A 0 A_Explode(500, 400, 1) // Bigger blast radius and damage
        TNT1 AAAAAAAAAA 0 bright A_SpawnItemEx("DevastatorSmoke", 0, 0, 0, random(2,-2), random(2,-2), 1+random(1,-3), 0, 128, 0)
        TNT1 AAAA 0 bright A_SpawnItemEx("BigDevastatorBoomy", 0, random(2,-2), random(2,-2), 0, 0, 1, 0, 128, 0)
        TNT1 A 1
        Stop
    }
}
ACTOR DevastatorSmoke
{ 
    Scale 0.5
    Alpha 0.55
    RenderStyle Add
    +NOCLIP
    +NOGRAVITY
    States
    {
    Spawn:
      DSMO ABCDEFGHIJKLMNOPQ 1 BRIGHT
      Stop
    }
}

ACTOR DevastatorBoomy
{ 
    Scale 1
    Alpha 0.75
    RenderStyle Add
    +NOCLIP
    +NOGRAVITY
    States
    {
    Spawn:
      TNT1 A 0 Nodelay A_Jump(255,"Spawn1","Spawn2")
    Spawn1:    
      DXP1 ABCDEFGHIJKLMNOP 1 BRIGHT 
      Stop
    Spawn2:    
      DXP2 ABCDEFGHIJKLMNOP 1 BRIGHT
      Stop
    }
}

ACTOR BigDevastatorBoomy
{ 
    Scale 5
    Alpha 0.75
    RenderStyle Add
    +NOCLIP
    +NOGRAVITY
    States
    {
    Spawn:
      TNT1 A 0 Nodelay A_Jump(255,"Spawn1","Spawn2")
    Spawn1:    
      DXP1 ABCDEFGHIJKLMNOP 1 BRIGHT
      Stop
    Spawn2:    
      DXP2 ABCDEFGHIJKLMNOP 1 BRIGHT
      Stop
    }
}

ACTOR DevastatorSmokeTrail : DevastatorSmoke
{ 
    Scale 0.175
    Alpha 0.3
}