// Hellstorm Cannon

Actor HellstormCannon : IDMWeapon
{
  Weapon.SelectionOrder 50
  Weapon.AmmoUse 5
  Weapon.AmmoGive 15
  Weapon.AmmoType "IDMRocketAmmo"
  //Weapon.PreferredSkin "HellstormMarine"
  DamageType "Hellstorm"
  +WEAPON.NOAUTOAIM
  +WEAPON.BFG
  +WEAPON.NOLMS
  Inventory.PickupMessage "HellStorm Cannon! (Slot 5)"
  Tag "Hellstorm Cannon"
  States
  {
  Ready:
    HSTM B 1 A_WeaponReady
    Loop
  Deselect:
    HSTM B 1 A_Lower
    Loop
  Select:
	TNT1 A 0 A_PlaySound("weapons/wswitch",CHAN_WEAPON)
  Sloop:
    HSTM B 1 A_Raise
    Loop
  Fire:
	HSTM B 15 A_PlayWeaponSound("Hellstorm/Prime")
    HSTM B 3 Bright A_GunFlash
    TNT1 A 0 A_PlayWeaponSound("HellStorm/Fire")
	TNT1 A 0 A_Recoil(3)
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
	Goto Normal
  Quad:
	TNT1 A 0 A_Playsound("misc/qdmg",CHAN_AUTO,1)
	// Oh boy here we go...
  Normal:
    TNT1 A 0 A_FireCustomMissile("HellstormRocket1", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
    TNT1 A 0 A_FireCustomMissile("HellstormRocket2", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
 	TNT1 A 0 A_FireCustomMissile("HellstormTracer", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormFatShot", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormImpBall", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormCacoBall", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormSkull", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormBaronBall", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	HSTM C 1 Bright
	TNT1 A 0 A_CheckForReload(9,"Normal")
    TNT1 A 0 A_FireCustomMissile("HellstormRocket1", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
    TNT1 A 0 A_FireCustomMissile("HellstormRocket2", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
 	TNT1 A 0 A_FireCustomMissile("HellstormTracer", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormFatShot", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormImpBall", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormCacoBall", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormSkull", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormBaronBall", frandom(-20, 20), 1, 0, 0, 0, frandom(-2, 2))
	HSTM C 1 Bright
	TNT1 A 0 A_JumpIfInventory("PowerIDMWeaponLevel2",1,"Level2")
	Goto FireEnd
  Level2:
    TNT1 A 0 A_FireCustomMissile("HellstormRocket1", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
    TNT1 A 0 A_FireCustomMissile("HellstormRocket2", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
 	TNT1 A 0 A_FireCustomMissile("HellstormTracer", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormFatShot", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormImpBall", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormCacoBall", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormSkull", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormBaronBall", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	HSTM C 1 Bright
	TNT1 A 0 A_CheckForReload(19,"Level2")
    TNT1 A 0 A_FireCustomMissile("HellstormRocket1", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
    TNT1 A 0 A_FireCustomMissile("HellstormRocket2", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
 	TNT1 A 0 A_FireCustomMissile("HellstormTracer", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormFatShot", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormImpBall", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormCacoBall", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormSkull", frandom(-20, 20), 0, 0, 0, 0, frandom(-2, 2))
	TNT1 A 0 A_FireCustomMissile("HellstormBaronBall", frandom(-20, 20), 1, 0, 0, 0, frandom(-2, 2))
	HSTM C 1 Bright
  FireEnd:
	TNT1 A 0 A_ResetReloadCounter
    HSTM D 10 A_PlaySoundEx("HellStorm/Reload", "SoundSlot6", 0)
    HSTM B 38
	TNT1 A 0 A_Refire
    Goto Ready
  Flash:
    TNT1 A 12 Bright
    Goto Lightdone
  Spawn:
    HSTM A -1 Bright
    Stop
  }
}

// Hellstorm Projectiles

ACTOR HellstormRocket1 : IDMRocket
{
	Speed 30
	Obituary "%o was sent to hell by %k's HellStorm Cannon!"
	SelfObituary "%o sent %hself to hell with %p Hellstorm Cannon!"
	DeathSound "weapons/hstx"
	DamageType "Hellstorm"
	+EXTREMEDEATH
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_Scalevelocity(frandom(0.5,2.0))
    SpawnLoop:
		MISL A 1 Bright A_Weave(frandom(1,5),frandom(1,4),frandom(1,2),frandom(1,2))
		Loop
	Death:
		MISL B 6 Bright A_Explode(200,128,1)
		MISL C 5 Bright
		MISL D 4 Bright
		Stop
	}
}

ACTOR HellstormRocket2 : HellstormRocket1
{
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_Scalevelocity(frandom(0.5,2.0))
	SpawnLoop:
		MISL A 1 Bright A_Weave(frandom(-5,-1),frandom(-4,-1),frandom(1,2),frandom(1,2))
		Loop
	}
}

ACTOR HellstormTracer : HellstormRocket1
{
	Speed 20
	Damage 40
	SeeSound "skeleton/attack"
	+SEEKERMISSILE
	-ROCKETTRAIL
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_Scalevelocity(frandom(0.5,2.0))
    SpawnLoop:
		FATB AB 2 Bright
		Loop
	Death:
		FBXP A 6 Bright
		FBXP B 5 Bright
		FBXP C 4 Bright
		Stop
	}
}

ACTOR HellstormFatShot : FatShot
{
	Speed 30
	Damage 32
	SeeSound "imp/attack"
	DeathSound "imp/shotx"
	DamageType "Hellstorm"
	Obituary "%o was sent to hell by %k's HellStorm Cannon!"
	+EXTREMEDEATH
	+SKYEXPLODE
	-NOTELEPORT
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 0 A_Scalevelocity(frandom(0.5,2.0))
    SpawnLoop:
	  MANF AB 4 Bright
	  Loop
	Death:
      MISL B 6 Bright
      MISL C 5 Bright
      MISL D 4 Bright
	  Stop
	}
}

ACTOR HellstormSkull : HellstormFatShot
{
	Damage 32
	Seesound "skull/melee"
	Obituary "%o was sent to hell by %k's HellStorm Cannon!"
	SelfObituary "%o sent %hself to hell with %p Hellstorm Cannon!"
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 0 A_Scalevelocity(frandom(0.5,2.0))
	SpawnLoop:
	  SKMS CD 4 Bright
	  Loop
	Death:
	  SKMS F 5 Bright A_Explode(64,128,1)
	  SKMS GHIJK 5 Bright
	  Stop
	}
}

ACTOR HellstormImpBall : DoomImpBall
{
  DamageType "Hellstorm"
  Speed 20
  Damage 12
  +RANDOMIZE
  +EXTREMEDEATH
  +SKYEXPLODE
  -NOTELEPORT
  SeeSound "imp/attack"
  DeathSound "imp/shotx"
  Obituary "%o was sent to hell by %k's HellStorm Cannon!"
  States
  {
  Spawn:
	TNT1 A 0 A_Scalevelocity(frandom(0.5,2.0))
  SpawnLoop:
    BAL1 AB 4 Bright
    Loop
  Death:
    BAL1 CDE 4 Bright
    Stop
  }
}

ACTOR HellstormCacoBall : CacodemonBall
{
  DamageType "Hellstorm"
  Speed 25
  Damage 20
  SeeSound "caco/attack"
  DeathSound "caco/shotx"
  Obituary "%o was sent to hell by %k's HellStorm Cannon!"
  +SKYEXPLODE
  -NOTELEPORT
  +EXTREMEDEATH
  +RANDOMIZE
  States
  {
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_Scalevelocity(frandom(0.5,2.0))
  SpawnLoop:
    BAL2 AB 4 Bright
    Loop
  Death:
    BAL2 CDE 4 Bright
   Stop
  }
}

ACTOR HellstormBaronBall : Baronball
{
  DamageType "Hellstorm"
  Speed 30
  Damage 32
  SeeSound "baron/attack"
  DeathSound "baron/shotx"
  Decal "BaronScorch"
  Obituary "%o was sent to hell by %k's HellStorm Cannon!"
  +SKYEXPLODE
  -NOTELEPORT
  +EXTREMEDEATH
  +RANDOMIZE
  States
  {
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_Scalevelocity(frandom(0.5,2.0))
  SpawnLoop:
    BAL7 AB 4 Bright
    Loop
  Death:
    BAL7 C 6 Bright
	BAL7 DE 6 Bright
    Stop
  }
}