actor CamDecimator : Weapon
{
  Weapon.SlotNumber 7
  Weapon.SelectionOrder 2800
  Weapon.AmmoUse 50
  Weapon.AmmoGive 50
  Weapon.AmmoType "CamPlasmaAmmo"
  +WEAPON.NOAUTOFIRE
  Inventory.RestrictedTo "CameronClass"
  Inventory.PickupMessage "You got the Decimator!"
  Tag "Decimator"
  States
  {
  Ready:
    CBFG A 1 A_WeaponReady
    Loop
  Deselect:
    CBFG A 1 A_Lower
	TNT1 A 0 A_Lower
	TNT1 A 0 A_Lower
    Loop
  Select:
    CBFG A 1 A_Raise
	TNT1 A 0 A_Raise
	TNT1 A 0 A_Raise
    Loop
  Fire:
    CBFG B 6 A_PlaySound("weapons/cambfgcharge")
    CBFG C 6
    CBFG D 6
    CBFG E 6 
    CBFG F 6
    CBFG G 6 
    CBFG H 6
	TNT1 A 0 A_PlaySound ("weapons/cambfgfire")
	CBFG A 0 A_Recoil (4)
    CBFG I 6 A_FireCustomMissile ("DecimatorBall", 0, 1, 2, -1)
    CBFG J 6
    CBFG K 6 
	TNT1 A 0 A_JumpIfNoAmmo ("Ready")
    CBFG L 3 A_PlaySound("weapons/cambfgrld1")
    CBFG M 3 
    CBFG N 3
    CBFG O 3 
    CBFG P 3
    CBFG Q 3 
    CBFG R 3
    CBFG S 3 
    CBFG T 3 A_PlaySound("weapons/cambfgrld2")
    CBFG U 3 
    CBFG V 3
    CBFG W 3 
    CBFG A 3 A_ReFire
    Goto Ready
  Spawn:
    CBFW A -1
    Stop
  }
}


Actor DeciCluster : DoomImpBall
{
  Damage (Random(5, 10))
  Height 5
  Radius 5
  Speed 20
  Decal PlasmaScorch
  DeathSound "weapons/plasmax"
  Species "Player"
  Obituary "%o was decimated by %k."
  +FRIENDLY
  +THRUSPECIES
  +FORCERADIUSDMG
  -NOGRAVITY
  States
  {
  Spawn:
    CDCB AAAABBBB 1 Bright A_SpawnItemEx("DeciClusterTrail", -(MomX/1.2), -(MomY/1.2), (MomZ/1.2*-1), (MomX/1.2), (MomY/1.2), (MomZ/1.2), -Angle, 138)
    Loop
  Death:
    CDCB C 0 Bright A_Explode(25, 100, 0, 1, 25)
    CDCB CDEFG 3 Bright
    Stop
  }
}

Actor DeciClusterTrail
{
  Projectile
  RenderStyle Add
  Alpha 0.5
  States
  {
  Spawn:
    CDCB AABB 2 Bright A_FadeOut(0.05)
    Loop
  }
}


ACTOR DecimatorBall
{
	Radius 12
	Height 12
	Speed 15
	Damage 50
	PROJECTILE
      +ExtremeDeath
	  +FORCERADIUSDMG
	  +FRIENDLY
	  Species "Player"
	  Obituary "%o was decimated by %k."
	Renderstyle Add
    DEATHSOUND "weapons/cambfgexp"
    	Decal DCMLightning
	states
	{
	Spawn:
		PBTS A 2 BRIGHT A_SpawnItemEx("DecimatorBallTrail",0,0,0,0,0,0,0,128)
		PBTS B 2 BRIGHT A_SpawnItemEx("DecimatorBallTrail",0,0,0,0,0,0,0,128)
		PBTS C 2 BRIGHT A_SpawnItemEx("DecimatorBallTrail",0,0,0,0,0,0,0,128)
		PBTS D 2 BRIGHT A_SpawnItemEx("DecimatorBallTrail",0,0,0,0,0,0,0,128)
		PBTS E 2 BRIGHT A_SpawnItemEx("DecimatorBallTrail",0,0,0,0,0,0,0,128)
		PBTS F 2 BRIGHT A_SpawnItemEx("DecimatorBallTrail",0,0,0,0,0,0,0,128)
		PBTS G 2 BRIGHT A_SpawnItemEx("DecimatorBallTrail",0,0,0,0,0,0,0,128)
		PBTS H 2 BRIGHT A_SpawnItemEx("DecimatorBallTrail",0,0,0,0,0,0,0,128)
		PBTS I 2 BRIGHT A_SpawnItemEx("DecimatorBallTrail",0,0,0,0,0,0,0,128)
		PBTS J 2 BRIGHT A_SpawnItemEx("DecimatorBallTrail",0,0,0,0,0,0,0,128)
		Loop
	Death:	
		TNT1 A 0 BRIGHT A_Mushroom ("DeciCluster",6,MSF_DontHurt)
		TNT1 A 0 BRIGHT A_Mushroom ("DeciCluster",12,MSF_DontHurt,3,0.6)
		TNT1 A 0 BRIGHT A_Mushroom ("DeciCluster",24,MSF_DontHurt,2,0.7)
		TNT1 A 0 BRIGHT A_Mushroom ("DeciCluster",36,MSF_DontHurt,1,0.8)
		CBTS K 2 BRIGHT A_Explode(250,250,0)
		PBTS LMNOPQRSTUVW 2 BRIGHT
		Stop
	}
}

ACTOR DecimatorBallTrail
{   
   Radius 1
   Height 1
   Speed 0
   Scale 0.8
   +Noclip
   PROJECTILE
   RENDERSTYLE Add
   Alpha 0.6
   states
   {
   Spawn:
      NULL A 4
      PBTS LMNOPQRSTUVW 2 A_FadeOut
      Stop
   }
}
