/*
==WHIPLASH SHOTGUN==

Not much has changed with the Whiplash over the years,
other than a smaller, more compact design and a new coat
of paint to match Arti's default color scheme. While
still considered unconventional, it continues to prove
that sometimes all you need to put down a demon is a 
blast of buckshot or two.

The weapon's altfire still features a super blast by cramming
shells in, it's just now the weapon is better designed for this
*/


actor WhiplashShotgun : weapon
{
	weapon.slotnumber 3
	+WEAPON.NOALERT
	weapon.bobstyle smooth
	weapon.bobrangex 0.1
	weapon.bobrangey 0.6
	weapon.bobspeed 2
	Weapon.AmmoUse 1
	Weapon.AmmoType "Shell"
	Inventory.RestrictedTo "Artificer"
	Inventory.PickupMessage "You got the Whiplash shotgun!"
	+NOAUTOAIM
	Tag "Whiplash shotgun"
	states
	{
	spawn:
		ESHT A -1
		stop
	select:
		TNT1 A 0
		TNT1 A 0 a_playsound ("shotgun/draw",0)
	draw:	
		TNT1 A 0
		WP1S AAAA 0 A_Raise
		WP1S A 1 A_Raise
		loop
	deselect:
		TNT1 A 0
		TNT1 A 0 a_jumpifhealthlower (1, "deadlower")
		TNT1 A 0 a_playsound ("shotgun/holster",0)
	holster:
		TNT1 A 0
		WP1S A 1 a_lower
		TNT1 A 0 a_takeinventory ("secretaction", 99)
		TNT1 AA 0 a_lower
		loop
	deadlower:
		TNT1 A 0
		TNT1 A 0
		TNT1 AAAAAAAAAAAAA 0 a_lower
		TNT1 A 1 a_lower
		wait		
	Ready:
		WP1S A 1 A_WeaponReady
		wait
	Fire:
		TNT1 A 0
		TNT1 A 0 a_gunflash
		WP1S B 0 Bright A_PlaySound("shotgun/fire", 1)
		SHTG A 0 A_FireBullets (5.6, 2, 7, 6, "WhipLashPuff")
		TNT1 A 0 a_alertmonsters
		TNT1 A 0 A_Quake(2, 5, 0, 32)
		WP1S A 1
		WP1S BC 1 bright
		WP1S D 1 bright offset (0,43)
		WP1S E 1 
		TNT1 A 0 offset (0,35)
		WP1S A 1
		TNT1 A 0 offset (0,32)
		WP3S ABCDE 2
		WP3S F 1
		TNT1 A 0 a_playsound ("shotgun/pump1",0)
		//WP3S G 2 
		WP3S H 1 offset (0,35)
		WP3S H 1 offset (0,34)
		D3PS C 0 A_FireCustomMissile("Shellcasingspawner",0,0,2,2)
		WP3S I 1 offset (0,33)
		WP3S I 1 offset (0,32)
		WP3S I 1 
		TNT1 A 0  a_playsound ("shotgun/pump2",0)
		WP3S JKLM 2
		WP3S NN 1
		WP3S OP 1
		WP1S A 4 A_ReFire
		Goto Ready
	altfire:
		WP1S A 1 a_jumpifinventory ("shell", 5, "whiplashshot")
		goto ready
	whiplashshot:
		WP3S A 1 A_PlaySound("pipe/swing")
		WP3S BCDE 1
		WP3S F 1 
		WP3S G 1 a_playsound ("shotgun/pump1",0)
		WP3S H 1 offset (0,35)
		WP3S I 1 offset (0,34)
		WP2S A 1
		WP2S BCDE 1
		WP2S FG 2
		WP2S HI 1
		WP2S JK 1
		TNT1 A 0 A_playsound ("shotgun/shellcram")
		TNT1 A 0 a_takeinventory ("shell",5)
		WP2S L 1 A_spawnitemex("Shellcasing",15,0,40,random (-5,5),random (-5,5),random (-5,5))
		CRAM IIIII 0 A_spawnitemex("Shellcasing",15,0,40,random (-5,5),random (-5,5),random (-5,5))
		WP2S MNOPQRS 2
		TNT1 A 0  a_playsound ("shotgun/pump2",0)
		WP2S T 1
		WP3S KLM 2
		WP3S NN 1
		WP3S OP 1
		TNT1 A 0 a_refire ("holdthatgun")
		goto whiplashfinish
	Holdthatgun:
		TNT1 A 0
		WP1S A 1
		TNT1 A 0 a_refire ("stillholding")
		goto whiplashfinish
	stillholding:
		TNT1 A 0
		WP1S A 1 
		TNT1 A 0 A_Quake(1, 2, 0, 5, 0)
		TNT1 A 0 a_refire ("holdthatgun")
		goto whiplashfinish
	whiplashfinish: 
		WP1S B 0 Bright A_PlaySound("shotgun/superfire", 0)
		TNT1 A 0 a_alertmonsters
		WP1S B 2 Bright A_FireCustomMissile("BitchinPellet", Frandom(-1500, 1500) / 1000.0, 1, 0, 8, 0, Frandom(-1200, 1200) / 1000.0)
		TNT1 A 0 ThrustThingZ (0, 15, 0, 0)	
		TNT1 A 0 A_ChangeVelocity(Cos(Pitch)*-30,0,Sin(Pitch)*20,1)
		WP1S BBBBBBBBBBBBBBBBBB 0 Bright A_FireCustomMissile("BitchinPellet", Frandom(-1500, 1500) / 1000.0, 0, 0, 8, 0, Frandom(-1200, 1200) / 1000.0)
		D3PS BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB 0 A_firecustommissile ("WhipLashSpray",Frandom(6, -6), 0, -1, 1, 0, Frandom(6, -6))
		TNT1 A 0 a_alertmonsters
		TNT1 A 0  A_Quake(5, 10, 0, 32)
		WP2S UV 1 bright
		TNT1 A 0 offset (0,45)
		WP2S WWXX 1 bright
		WP2S Y 2
		WP2S Y 1 offset (0,42)
		WP2S Y 1 offset (0,40)
		WP2S Y 1 offset (0,35)
		TNT1 A 0 offset (0,32)
		WP1S F 2		
		WP3S ABCDE 2
		WP3S F 1 
		TNT1 A 0 a_playsound ("shotgun/pump1",0)
		//WP3S G 2 
		WP3S H 1 offset (0,35)
		WP3S H 1 offset (0,34)
		D3PS CCCCCC 0 A_FireCustomMissile("Shellcasingspawner",0,0,-3,2)
		WP3S I 1 offset (0,33)
		WP3S I 2 offset (0,32) 
		WP3S I 2 
		TNT1 A 0  a_playsound ("shotgun/pump2",0)
		WP3S JKLM 2
		WP3S NN 1
		WP3S OP 1
		Goto Ready
	Flash:
		TNT1 A 2 Bright A_Light(3)
		TNT1 A 2 Bright A_Light2
		TNT1 A 2 Bright A_Light1
		Goto LightDone
	}
}

ACTOR WhipLashPuff : BulletPuff
{
	+NOBLOCKMAP
	+NOGRAVITY
	+ALLOWPARTICLES
	+RANDOMIZE
	+thruspecies
	+MTHRUSPECIES
	+PUFFONACTORS
	+bright
	species "player"
	RenderStyle add
	Alpha 0.90
	scale 0.90
	VSpeed 0
	Mass 5
	decal "BulletChip"
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 2
		// Intentional fall-through
	Xdeath:
		WLPF A 1
		TNT1 A 0 a_playsound ("blastmaster/puffhit",CHAN_VOICE,0.60,0,1.5)
		WLPF BCDE 1
		Stop
	Crash:
		TNT1 A 1
		TNT1 A 0 a_setscale (1,1)
		TNT1 AAA 0 a_spawnitemex ("CABulletSpark",4,0,0,Frandom(-200,200)/20.0,Frandom(-200,200)/20.0,Frandom(-200,200)/20.0,0,SXF_NOCHECKPOSITION)		
		WLPF A 2
		TNT1 A 0 a_playsound ("blastmaster/ricochet",CHAN_VOICE,0.5,0,1.5)
		WLPF FGH 1
		Stop		
	}
}





actor BitchinPellet : FastProjectile
{
	+notimefreeze
    +FORCEXYBILLBOARD	
	+thruspecies
	obituary "%o got SMACKED THE FUCK UP by %k's badass shotgun."
	damage (random(9,10))
	species "player"
	missiletype "CAbullettracer"
    missileheight 1
	speed 1
	height 1
	radius 1
	gravity 0.01
	scale 0.90
	alpha 0.95
	-NOGRAVITY
	+BLOODSPLATTER
	+NOEXTREMEDEATH
	decal "BulletChip"
	states
	{
	Spawn:
		TNT1 A 1
		TNT1 A 1 A_ScaleVelocity(600)
	Spawn2:
		TNT1 A 35 A_ScaleVelocity(0.98)
		loop
	Xdeath:
		WLPF A 1
		TNT1 A 0 a_playsound ("blastmaster/puffhit",CHAN_VOICE,0.60,0,1.5)
		WLPF BCDE 1
		Stop
	Crash:
		TNT1 A 1
		TNT1 A 0 a_setscale (1,1)
		TNT1 AAA 0 a_spawnitemex ("CABulletSpark",4,0,0,Frandom(-200,200)/20.0,Frandom(-200,200)/20.0,Frandom(-200,200)/20.0,0,SXF_NOCHECKPOSITION)		
		WLPF A 2
		TNT1 A 0 a_playsound ("blastmaster/ricochet",CHAN_VOICE,0.5,0,1.5)
		WLPF FGH 1
		Stop		
	}
}



actor WhipLashSpray : genkabulletspray
{
	speed 80
	RenderStyle add
	alpha 0.90
	scale 0.90
	states
	{
	Xdeath:
		WLPF A 1
		TNT1 A 0 a_playsound ("blastmaster/puffhit",CHAN_VOICE,0.60,0,1.5)
		WLPF BCDE 1
		Stop
	Death:
	Crash:
		TNT1 A 1
		TNT1 A 0 a_setscale (1,1)
		TNT1 AAA 0 a_spawnitemex ("CABulletSpark",4,0,0,Frandom(-200,200)/20.0,Frandom(-200,200)/20.0,Frandom(-200,200)/20.0,0,SXF_NOCHECKPOSITION)		
		WLPF A 2
		TNT1 A 0 a_playsound ("blastmaster/ricochet",CHAN_VOICE,0.5,0,1.5)
		WLPF FGH 1
		Stop
	}
}


actor Blockorb : FastProjectile
{
    Radius 32
    Height 32
    Health 2
    Speed 64
    Damage 0
    PainChance 255
    RadiusDamageFactor 0.0
    Projectile
	species "Player"
	+THRUSPECIES
    +SHOOTABLE
    +NOBLOOD
    +BLOODLESSIMPACT
    +DONTSPLASH
    +NODAMAGE
	+DONTBLAST
    -NOBLOCKMAP
    States
    {
    Spawn:
        TNT1 AA 1
        Stop
    Pain:
        TNT1 A 0
        TNT1 A 0 A_Stop
        TNT1 A 1
        stop
    Death:
        TNT1 A 0
        TNT1 A 0 A_Stop
		TNT1 A 1
        Stop
    }
}


actor Pipewall : Inventory
{
	inventory.maxamount 1
}

actor pipehit : inventory 
{
	inventory.maxamount 1
}
