// Pyro Cannon (UTNT)

ACTOR IDMPyroCannon : IDMWeapon
{
  Inventory.PickupSound "misc/w_pkup"
  Inventory.PickupMessage "Pyro Cannon! (Slot 7)"
  Tag "Pyro Cannon"
  Weapon.SelectionOrder 50
  //Weapon.PreferredSkin "PyroMarine"
  Weapon.AmmoType "IDMGas"
  Weapon.AmmoGive 100
  Weapon.AmmoUse 20
  +Weapon.Explosive
  +Weapon.BFG
  +WEAPON.NOLMS
  +Weapon.Staff2_KickBack
  States
  {
  Spawn:
    WPYR A -1 Bright
    Loop
  Ready:
    PYRG A 1 A_WeaponReady
    Loop
  Deselect:
    PYRG A 1 A_Lower
    Loop
  Select:
    TNT1 A 0 A_Playsound("Flamethrower/Equip",CHAN_AUTO)
	TNT1 A 0 A_PlaySound("weapons/wswitch",CHAN_WEAPON)
  Sloop:
    PYRG A 1 A_Raise
    Loop
  Fire:
    PYRG A 5
    PYRG B 4 Bright Offset(0,40) A_GunFlash
    PYRG B 4 Bright Offset(0,45)
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
	TNT1 A 0 A_JumpIfInventory("PowerIDMWeaponLevel2",1,"Level2")
    PYRG C 10 Bright Offset(0,55) A_FireCustomMissile("PyroShot", 0, 1, 0, 0)
    PYRG D 5 Bright Offset(0,50)
    PYRG E 5 Bright Offset(0,45)
    PYRG F 5 Bright Offset(0,40)
    PYRG G 5 Bright Offset(0,35)
    PYRG A 5 A_Refire
    Goto Ready
  Quad:
	TNT1 A 0 A_Playsound("misc/qdmg",CHAN_AUTO)
	Goto Fire+4
  Level2:
    PYRG C 10 Bright Offset(0,55) A_FireCustomMissile("BigPyroShot", 0, 1, 0, 0, 0, 10)
    Goto Fire+6
  Flash:
    TNT1 A 8 A_Light1
    TNT1 A 10 A_Light2
    TNT1 A 15 A_Light1
    TNT1 A 1 A_Light0
    Stop
  }
}

Actor PyroShot
{
  Radius 8
  Height 12
  Speed 50
  Damage (40*Random(12, 16))
  Projectile
  RenderStyle Add
  DamageType Fire
  Alpha 0.95
  Scale 0.75
  SeeSound "PyroCannon/Fire"
  DeathSound "PyroCannon/Hit"
  Obituary "%o was incinerated by %k's Pyro Cannon."
  SelfObituary "%o blew %hself up with %p own Pyro blast."
  Decal BigScorch
  +EXTREMEDEATH
  +SKYEXPLODE
  -NOTELEPORT
  States
  {
  Spawn:
    PBAL AAAABBBB 4 Bright A_Explode(50, 128, 0)
    Loop
  Death:
    PYXP AB 2 Bright
    PYXP C 2 Bright A_Explode(192, 128)
    PYXP C 0 A_CustomMissile("PyroSpawner", 0, 0, 0, CMF_TRACKOWNER)
    PYXP C 0 A_CustomMissile("PyroSpawner", 0, 0, 45, CMF_TRACKOWNER)
    PYXP C 0 A_CustomMissile("PyroSpawner", 0, 0, 90, CMF_TRACKOWNER)
    PYXP C 0 A_CustomMissile("PyroSpawner", 0, 0, 135, CMF_TRACKOWNER)
    PYXP C 0 A_CustomMissile("PyroSpawner", 0, 0, 180, CMF_TRACKOWNER)
    PYXP C 0 A_CustomMissile("PyroSpawner", 0, 0, 225, CMF_TRACKOWNER)
    PYXP C 0 A_CustomMissile("PyroSpawner", 0, 0, 270, CMF_TRACKOWNER)
    PYXP C 0 A_CustomMissile("PyroSpawner", 0, 0, 315, CMF_TRACKOWNER)
	PYXP DDEEFFGGHHIIJJKKLLMM 1 Bright A_CustomMissile("PyroFlare",8,0,random(0,359),CMF_TRACKOWNER|CMF_AIMDIRECTION,random(30,90))
	PYXP NOPQRSTU 2 Bright
    Stop
  }
}

ACTOR PyroShot2 : PyroShot
{
	Speed 20
	Gravity 0.5
	-NOGRAVITY
}

ACTOR BigPyroShot : PyroShot2
{
	Speed 25
	Scale 1.5
	Damage (80*Random(12, 16))
	+RIPPER
	States
	{
	Death:
      PYXP AB 2 Bright
      PYXP C 2 Bright A_Explode(192, 128)
      PYXP C 0 A_CustomMissile("PyroShot2", 12, 0, 45, CMF_TRACKOWNER,15)
	  PYXP C 0 A_CustomMissile("PyroShot2", 12, 0, 135, CMF_TRACKOWNER,15)
      PYXP C 0 A_CustomMissile("PyroShot2", 12, 0, 225, CMF_TRACKOWNER,15)
      PYXP C 0 A_CustomMissile("PyroShot2", 12, 0, 315, CMF_TRACKOWNER,15)
	  PYXP DDEEFFGGHHIIJJKKLLMM 1 Bright A_CustomMissile("PyroFlare",8,0,random(0,359),CMF_TRACKOWNER|CMF_AIMDIRECTION,random(30,90))
	  PYXP NOPQRSTU 2 Bright
      Stop
	}
}

ACTOR SlowBigPyroShot : BigPyroShot
{
	Speed 5
}

Actor PyroSpawner
{
  Radius 1
  Height 1
  Damage (0)
  Projectile
  Speed 15
  +Ripper
  +BloodlessImpact
  -NOTELEPORT
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 AAAAA 5 Bright A_CustomMissile("PyroBoom", 0, 0, 0, CMF_TRACKOWNER)
    Stop
  }
}

Actor PyroBoom
{
  Radius 0
  Height 1
  Damage (0)
  Projectile
  RenderStyle Add
  DamageType "Rocket"
  Alpha 0.95
  Scale 0.67
  SeeSound "PyroCannon/Explosion"
  Obituary "%o was incinerated by %k's Pyro Cannon."
  SelfObituary "%o blew %hself up with %p own Pyro blast."
  +EXTREMEDEATH
  -NOTELEPORT
  States
  {
  Spawn:
    PYXP AB 2 Bright
    PYXP C 2 Bright A_Explode(192, 128)
    PYXP DEFGHIJKLMNOPQRST 2 Bright
    Stop
  }
}

Actor PyroFlare
{
  Radius 8
  Height 11
  Speed 20
  Damage (10*Random(2, 3))
  Projectile
  RenderStyle Add
  DamageType Fire
  Decal DoomImpScorch
  Alpha 0.95
  -NoGravity
  +EXTREMEDEATH
  +SKYEXPLODE
  -NOTELEPORT
  DeathSound "Pyrocannon/Boom"
  Obituary "%o was incinerated by %k's Pyro Cannon."
  SelfObituary "%o blew %hself up with %p own Pyro blast."
  States
  {
  Spawn:
    TNT1 A 1 Bright A_SpawnItemEx("PyroFX", 0, 0, 0, 0, 0, 0, 0, 128)
    Loop
  Death:
    FRFX HIJ 2 Bright
    FRFX J 0 A_Explode(64, 64)
    FRFX J 0 A_CustomMissile("PyroDropFire", 0, 0, 0, CMF_TRACKOWNER)
    FRFX KLMNO 2 Bright
    Stop
  }
}

Actor PyroFX
{
  Radius 0
  Height 1
  Speed 0
  Projectile
  RenderStyle Add
  Alpha 0.85
  +CLIENTSIDEONLY
  States
  {
  Spawn:
    TNT1 A 3
    PYFX ABCDE 3 Bright
    Stop
  }
}

ACTOR PyroDropFire : DropFire
{
  Obituary "%o was incinerated by %k's Pyro Cannon."
  SelfObituary "%o blew %hself up with %p own Pyro blast."
}