/*
CREDITS:
Sprites - Banjo (HACX)
Sounds:
Bounce - Raven
Deploy & Countdown, Commando's taunt sounds - Westwood (C&C Renegade, C&C1)
Launch loop - ?
Stop - ?
*/

ACTOR ShitstormDevice : CustomInventory
{
  Tag "Shitstorm"
  Inventory.Amount 1
  Inventory.MaxAmount 2
  Inventory.InterHubAmount 2
  Inventory.Icon "ARTISHIT"
  Inventory.PickupSound "weapons/ShitStormDevicePick"
  Inventory.PickupMessage "You got the malevolent ''Shitstorm'' rocket-spam device!"
  +INVENTORY.INVBAR
  Scale 0.8
  States
  {
  Spawn:
    SHIT X -1
    Stop
  Use:
    TNT1 A 1 A_FireCustomMissile("ShitstormDeployer",0,0,0,0)
    Stop
  }
}

ACTOR ShitstormDeployer
{ 
    Radius 16
    Height 12
    Damage 0
    Obituary "%o couldn't escape from all of that %k's missile spam."
    Speed 15
	Projectile
    BounceType Hexen
    BounceFactor 0.5
    BounceCount 3
    Gravity 1.25
    BounceSound "weapons/ShitStormDeviceBounce"
    -NOGRAVITY
    +THRUGHOST
    +EXPLODEONWATER
    Scale 0.8
    States
   {
    Spawn:
      CRAP Y 1
      Loop
    Death:
      CRAP YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY 1 A_SpawnItemEx("ShitDeviceTrail", 0, 0, 0, 0, random(1,-1), random(1,-1), random(1,-1), 0, 0)
      CRAP Y 70 A_PlaySound("weapons/ShitStormDeviceStart")
    Looper:
      SHIT A 0 A_JumpIfInventory("ShitstormCounter",10,"PresentForYa")
      SHIT A 0 A_GiveInventory("ShitstormCounter",1)
      SHIT I 17 A_PlaySound("weapons/ShitStormDeviceCount")
      CRAP Y 17
      Loop
    PresentForYa:
      SHIT I 0 A_PlaySound("weapons/ShitStormDeviceCount")
      SHIT I 40 A_PlaySoundEx("weapons/ShitStormDevicePresent","Body",0,2)
      TNT1 A 0 A_SpawnItemEx("Shitstorming",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
      Stop
   }
}

ACTOR ShitStormCounter : Inventory
{
     Inventory.MaxAmount 10
}

ACTOR ShitDeviceTrail : MissileExpSmoke
{ 
    Scale 0.3
    Alpha 0.3
    Renderstyle Add
	+CLIENTSIDEONLY
    Speed 0
    States
    {
    Spawn:
      SMOK ABCDEFGHIJKLMNOPQ 2
      Stop
    }
}

ACTOR Shitstorming : ShitstormDeployer
{ 
    +FORCERADIUSDMG
    +DONTSPLASH
    BounceType None
    ReactionTime 30
    States
   {
    Spawn:
      TNT1 A 0
      TNT1 A 0 A_PlaySoundEx("Weapons/PowerOverwhelmingLoop","SoundSlot5",1)
      TNT1 AA 0 A_SpawnItemEx("ShitMissile", 0, 0, 3, random(35,40), random(35,40), random(35,40), random(0,360), CMF_TRACKOWNER, 0)
      SHIT IJ 1
      TNT1 AA 0 A_SpawnItemEx("ShitMissile", 0, 0, 3, random(35,40), random(35,40), random(35,40), random(0,360), CMF_TRACKOWNER, 0)
      SHIT KL 1
      TNT1 AA 0 A_SpawnItemEx("ShitMissile", 0, 0, 3, random(35,40), random(35,40), random(35,40), random(0,360), CMF_TRACKOWNER, 0)
      SHIT MN 1
      TNT1 AA 0 A_SpawnItemEx("ShitMissile", 0, 0, 3, random(35,40), random(35,40), random(35,40), random(0,360), CMF_TRACKOWNER, 0)
      SHIT OA 1
      TNT1 AA 0 A_SpawnItemEx("ShitMissile", 0, 0, 3, random(35,40), random(35,40), random(35,40), random(0,360), CMF_TRACKOWNER, 0)
      SHIT BC 1
      TNT1 AA 0 A_SpawnItemEx("ShitMissile", 0, 0, 3, random(35,40), random(35,40), random(35,40), random(0,360), CMF_TRACKOWNER, 0)
      SHIT DE 1
      TNT1 AA 0 A_SpawnItemEx("ShitMissile", 0, 0, 3, random(35,40), random(35,40), random(35,40), random(0,360), CMF_TRACKOWNER, 0)
      SHIT FG 1
      TNT1 AA 0 A_SpawnItemEx("ShitMissile", 0, 0, 3, random(35,40), random(35,40), random(35,40), random(0,360), CMF_TRACKOWNER, 0)
      SHIT HI 1
      TNT1 A 0 A_CountDown
      Loop
    Death: 
      SHIT I 100 A_PlaySoundEx("weapons/ShitStormDeviceLand","SoundSlot5")
      TNT1 A 1 A_SpawnItemEx("PushkaExplode",0,0,0,0,0,0,0,128,0)
      TNT1 A 0 A_PlaySound("Weapons/PushkaExp")
      THRM AAAAAAAAAAAAAAAAAAAA 0  A_SpawnItemEx("ShitMissile", 0, 0, 3, random(45,55), random(45,55), random(45,55), random(0,360), CMF_TRACKOWNER, 0)
      //TNT1 A 0 A_StopSoundEx("SoundSlot5")
      TNT1 B 0 A_Explode(100,192)
      TNT1 A 0 A_Explode(100,256,0)
      stop
   }
}

ACTOR ShitTrail : MissileExpSmoke
{ 
    Scale 0.175
	+CLIENTSIDEONLY
    Alpha 0.3
    Speed 0
    States
    {
    Spawn:
      SMOK A 0
      SMOK A 0 A_FadeOut(0.025)
      SMOK ABCDEFGHIJKLMNOPQ 1
      Stop
    }
}

actor ShitMissile
{
  Radius 11
  Height 8
  Speed 50
  Damage 200
  Projectile
  -NOGRAVITY
  +FORCERADIUSDMG
  +SEEKERMISSILE
  +SCREENSEEKER
  +THRUGHOST
  +DONTSPLASH
  +EXPLODEONWATER
  Gravity 0.03125
  DeathSound "Weapons/PushkaExp"
  Obituary "%o was crushed by %k's soviet russia missile swarm."
  DamageType "Superweapon"
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 0 A_JumpIfInventory("Roflmao",5,"Mao")
    TNT1 A 0 A_GiveInventory("Roflmao",1)
    TNT1 A 0 A_ChangeVelocity (1, frandom(-24, 24), frandom(-16, 16), 1)
    TNT1 A 0 bright A_PlaySoundEx("Weapons/ShitLoop","Body",1,0)
    TNT1 A 0 bright A_SpawnItemEx("ShitTrail", 0, random(2,-2), random(2,-2), 0, 0, 1, 0, 128, 0)
    HMIS A 1 bright
    Loop
  Mao:
    TNT1 A 0 A_ChangeVelocity (1, frandom(-24, 24), frandom(-16, 16), 1)
    TNT1 A 0 A_SeekerMissile(10,10,SMF_LOOK,256,15)
    TNT1 A 0 A_PlaySoundEx("Weapons/ShitLoop","Body",1,0)
    TNT1 A 0 A_SpawnItemEx("ShitTrail", 0, random(2,-2), random(2,-2), 0, 0, 1, 0, 128, 0)
    HMIS A 1 bright
    Loop
  Death:
    TNT1 A 0 A_StopSoundEx("Body")
    TNT1 A 0 A_Explode(100,164)
    TNT1 A 0 A_SpawnItemEx("PushkaExplode",0,0,0,0,0,0,0,128,0)
    TNT1 A 0 A_Explode(100,256,0)
    TNT1 BCD 4
    stop
  }
}

ACTOR Roflmao : Inventory
{
	Inventory.MaxAmount 99
}
