ACTOR AssaultShotgun : BrutalWeapon
{
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 10
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	YScale 0.6
	XScale 0.8
	Weapon.SelectionOrder 1200
	Weapon.AmmoType1 "AmmoShell"
	Weapon.AmmoType2 "AssaultShotgunAmmo"
	Obituary "%o was shot down by %k's Assault Shotgun."
    AttackSound "None"
    Inventory.PickupSound "CLIPIN"
	Inventory.Pickupmessage "You got the Assault Shotgun!"
    +WEAPON.NOAUTOAIM
    +WEAPON.NOALERT
    +WEAPON.NOAUTOFIRE
	+FORCEXYBILLBOARD
	+WEAPON.NO_AUTO_SWITCH
    Scale 0.8
	Tag "Assault Shotgun"
	States
	{
	SelectAnimation:
        TNT1 AA 1 A_JumpIfInventory("GoFatality", 1, "Steady")
        TNT1 A 0 A_PlaySound("CLIPIN")
        A12S ABCD 1
        TNT1 AAAAAAAA 0
        TNT1 A 0 //A_JumpIfInventory("AssaultShotgunAmmo",1,2)
        //Goto Reload
        TNT1 AAAA 0

	Ready:
	Ready3:
        TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
        TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("Unloading",1,"Unload")
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		A12G A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		Loop
		
	Ready2:
        TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
        TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("Unloading",1,"Unload")
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		A12A D 1 A_WeaponReady(WRF_ALLOWRELOAD)
		Loop	
	
	 ReadyNoFuckingAmmo:
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
        TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("Unloading",1,"Unload")
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		A12E A 1 A_WeaponReady
		
		Loop
	
	
	Deselect:
		TNT1 A 0
		TNT1 A 0 A_Takeinventory("Zoomed",1)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_TakeInventory("TossGrenade", 1)
        TNT1 A 0 A_ZoomFactor(1.0)
		A12S DCBA 1
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1
		Wait
		
	Select:
		TNT1 A 0 A_Giveinventory("GoSpecial",1)
		TNT1 A 0 A_Takeinventory("FistsSelected",1)
		TNT1 A 0 A_Takeinventory("SawSelected",1)
		TNT1 A 0 A_Takeinventory("ShotgunSelected",1)
		TNT1 A 0 A_Takeinventory("SSGSelected",1)
		TNT1 A 0 A_Takeinventory("MinigunSelected",1)
		TNT1 A 0 A_Takeinventory("PlasmaGunSelected",1)
		TNT1 A 0 A_Takeinventory("RocketLauncherSelected",1)
		TNT1 A 0 A_Takeinventory("GrenadeLauncherSelected",1)
		TNT1 A 0 A_Takeinventory("BFGSelected",1)
		TNT1 A 0 A_Takeinventory("BFG10kSelected",1)
		TNT1 A 0 A_Takeinventory("RailGunSelected",1)
		TNT1 A 0 A_Takeinventory("SubMachineGunSelected",1)
		TNT1 A 0 A_Takeinventory("RevenantLauncherSelected",1)
		TNT1 A 0 A_Takeinventory("LostSoulSelected",1)
		TNT1 A 0 A_Takeinventory("FlameCannonSelected",1)
		TNT1 A 0 A_Takeinventory("HasBarrel",1)
		TNT1 A 0 A_TakeInventory("TossGrenade", 1)
		MARN A 0 ACS_ExecuteAlways(728, 0, 0, 0, 0)//Check if penetration is on.
		TNT1 A 1 A_Raise
		TNT1 A 0 A_GunFlash
		TNT1 AAAAAAAAA 0 A_Raise
		Goto SelectAnimation
	
    Fire:
        TNT1 A 0 A_JumpIfInventory("AssaultShotgunAmmo",1,2)
        Goto Reload
        TNT1 AAAA 0

        TNT1 A 0 A_PlaySound("A12FIR", 1)
		RIFF A 0 A_FireCustomMissile("DistantFireSoundShotgun", random(-1,1), 0, 0, -12, 0, random(-1,1))
		RIFF A 0 A_FireCustomMissile("GunFireSmoke", 0, 0, 0, 0, 0, 0)
		TNT1 AAAAAAAAAAAA 0 BRIGHT A_FireCustomMissile("ShotgunParticles", random(-12,12), 0, -1, 0, 0, random(-9,9))
		TNT1 AAA 0 BRIGHT A_FireCustomMissile("ShotgunParticles2", random(-12,12), 0, -1, 0, 0, random(-9,9))
		TNT1 A 0 A_JumpIfInventory("Zoomed",1,"Fire2")
		A12F A 1 BRIGHT A_AlertMonsters
		TNT1 A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
		A12F A 0 BRIGHT A_FireBullets (5, 5, 9, 10, "ShotgunPuff", FBF_NORANDOM)
        RIFF AAAAAAAA 0 A_FireCustomMissile("DecorativeTracer", random(-4,4), 0, -1, -12, 0, random(-4,4))
		TNT1 A 0
		TNT1 AA 0 A_SetANgle(angle+random(-1, 1))
		TNT1 A 0 A_ZoomFactor(0.9)
        TNT1 A 0 A_SetPitch(-2.0 + pitch)
		TNT1 A 0 A_Takeinventory("AssaultShotgunAmmo",1)
		TNT1 A 0 A_SetPitch(+0.6 + pitch)
		A12F B 1 A_FireCustomMissile("ShotCaseSpawn",5,0,6,-14)
		TNT1 A 0 A_ZoomFactor(1.0)
        A12F C 1 A_SetPitch(+0.6 + pitch)
		A12F DEF 1
		A12G A 1
		A12G A 0 A_Refire
		A12G A 5 A_WeaponReady(1)
		Goto Ready
		
	 Fire2: //Aiming DOwn the Sights
        A12A E 1 BRIGHT A_AlertMonsters
		TNT1 A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
		A12F A 0 BRIGHT A_FireBullets (5, 5, 9, 10, "ShotgunPuff", FBF_NORANDOM)
        RIFF AAAAAAAA 0 A_FireCustomMissile("DecorativeTracer", random(-4,4), 0, -1, -12, 0, random(-4,4))
		TNT1 A 0
		TNT1 AA 0 A_SetANgle(angle+random(-1, 1))
		TNT1 A 0 A_ZoomFactor(1.2)
        TNT1 A 0 A_SetPitch(-1.0 + pitch)
		TNT1 A 0 A_Takeinventory("AssaultShotgunAmmo",1)
		TNT1 A 0 A_SetPitch(+0.3 + pitch)
		A12A F 1 A_FireCustomMissile("ShotCaseSpawn",5,0,6,0)
		TNT1 A 0 A_ZoomFactor(1.3)
        A12A G 1 A_SetPitch(+0.3 + pitch)
		A12A DDDD 1
		A12G A 0 A_Refire
		A12A D 5 A_WeaponReady(1)
		Goto Ready2	
		
	AltFire:
        TNT1 A 0
		TNT1 A 0 A_Giveinventory("GoSpecial",1)
		TNT1 A 0 A_JumpIfInventory("Zoomed",1,"NoAim")
		TNT1 A 0 A_Giveinventory("Zoomed",1)
        TNT1 A 0 A_ZoomFactor(1.3)
		TNT1 A 0 A_SetCrosshair(41)
		TNT1 A 0 A_Giveinventory("ADSmode",1)
        A12A ABC 1
        Goto Ready2
		NoAim:
        
		TNT1 A 0 A_SetCrosshair(0)
		TNT1 A 0 A_Takeinventory("Zoomed",1)
        TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
		A12A CBA 1
        Goto Ready3
	
	NoAmmo:
	A12G A 1 A_PlaySound("weapons/empty")
	TNT1 A 0 A_Takeinventory("Zoomed",1)
    TNT1 A 0 A_ZoomFactor(1.0)
	TNT1 A 0 A_Takeinventory("ADSmode",1)
	Goto Ready
	
    Reload:
		A12G A 0
		TNT1 A 0 A_JumpIfInventory("HasUnloaded", 1, "PutMag")
		A12G A 1 A_WeaponReady
		TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_Takeinventory("Reloading",1)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_Takeinventory("Zoomed",1)
		TNT1 A 0 A_JumpIfInventory("AssaultShotgunAmmo",20,"Ready")
		
        TNT1 A 0 A_JumpIfInventory("AmmoShell",1,3)
        Goto NoAmmo
        TNT1 AAA 0
		TNT1 A 0 A_Takeinventory("Zoomed",1)
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
		TNT1 A 0 A_Takeinventory("Reloading",1)
		TNT1 A 0 A_JumpIfInventory("TurboReload", 1, "InsertBullets")
		TNT1 A 0 A_JumpIfInventory("HasUnloaded", 1, "PutMag")
		TNT1 A 0
        //A12S DCBA 1 A_JumpIfInventory("Kicking",1,"DoKick")
		//TNT1 AAAAA 1 A_JumpIfInventory("Kicking",1,"DoKick")
		A12S DCBA 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		
		A12R EFGHIIIIIJKLM 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		TNT1 A 0 A_PlaySound("AACL", 1)
		A12R NNNNNNNOPQRRQPPPPPPPPP 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R STUVWWWWWWWWWW 1
		TNT1 A 0 A_PlaySound("Reload", 1)
		TNT1 A 0 A_Giveinventory("HasUnloaded",1)
		A12R XYZ 1
		A12E A 1
		
	PutMag:
		A12E BBBB 5 A_JumpIfInventory("Kicking",1,"DoKick")
		TNT1 A 0 A_Takeinventory("Reloading",1)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_Takeinventory("Zoomed",1)
        
		A12R ZYX 1
		A12R WWWWWWWWW 1
		
		
		A12S ABCD 1
		
		TNT1 A 0 A_Takeinventory("HasUnloaded",1)
		//TNT1 A 0 A_JumpIfInventory("AssaultShotgunAmmo",1,"InsertBullets2")AA12's cant have 20+1 shells.
		
	InsertBullets:
		TNT1 AAAA 0
		TNT1 A 0 A_JumpIfInventory("AssaultShotgunAmmo",20,15)
		TNT1 A 0 A_JumpIfInventory("AmmoShell",1,3)
		Goto Ready
        TNT1 AAAAAA 0
		TNT1 A 0 A_Giveinventory("AssaultShotgunAmmo",1)
		TNT1 A 0 A_Takeinventory("AmmoShell",1)
		Goto InsertBullets
		
		TNT1 AAAAAAAAAA 0
		TNT1 A 0 A_Takeinventory("Reloading",1)
		
		TNT1 A 0 A_Refire
        Goto Ready
		TNT1 AAAA 0
		TNT1 A 0 A_Takeinventory("Reloading",1)
		
		TNT1 A 0 A_Refire
        Goto Ready
		
	InsertBullets2:
		TNT1 AAAA 0
		TNT1 A 0 A_JumpIfInventory("AssaultShotgunAmmo",21,15)
		TNT1 A 0 A_JumpIfInventory("AmmoShell",1,3)
		Goto Ready
        TNT1 AAAAAA 0
		TNT1 A 0 A_Giveinventory("AssaultShotgunAmmo",1)
		TNT1 A 0 A_Takeinventory("AmmoShell",1)
		Goto InsertBullets2
		
		TNT1 AAAAAAAAAA 0
		TNT1 A 0 A_Takeinventory("Reloading",1)
		TNT1 A 0 A_Refire
        Goto Ready
		TNT1 AAAA 0
		TNT1 A 0 A_Takeinventory("Reloading",1)
		
		TNT1 A 0 A_Refire
        Goto Ready	
		
		
		
		
		
		
		
		
	Unload:
		A12G A 1 A_WeaponReady
		TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_Takeinventory("Unloading",1)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_Takeinventory("Zoomed",1)
        TNT1 A 0 A_JumpIfInventory("AssaultShotgunAmmo",1,3)
        Goto NoAmmo
        TNT1 AAA 0
		TNT1 A 0 A_Takeinventory("Zoomed",1)
		 A12S DCBA 1 A_JumpIfInventory("Kicking",1,"DoKick")
		TNT1 AAAAA 1 A_JumpIfInventory("Kicking",1,"DoKick")
		A12R EFGHIJKLM 1
		TNT1 A 0 A_PlaySound("CLIPIN", 1)
		A12R NOPQRRQPPP 1
		A12R STUVWWWW 1
        TNT1 A 0 A_PlaySound("Reload")
		A12R XYZ 1
		A12E A 1
		A12E B 5
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
		TNT1 A 0 A_Takeinventory("Unloading",1)
		
	RemoveBullets:
		TNT1 AAAA 0
		TNT1 A 0 A_JumpIfInventory("AssaultShotgunAmmo",1,3)
		Goto FinishUnload
        TNT1 AAAAAA 0
		TNT1 A 0 A_Takeinventory("AssaultShotgunAmmo",1)
		TNT1 A 0 A_Giveinventory("AmmoShell",1)
		Goto RemoveBullets
	
	FInishUnload:
		TNT1 A 0
		TNT1 A 0 A_PlaySound("DryFire")
		TNT1 A 0 A_GiveInventory("HasUnloaded", 1)
		TNT1 A 0 A_Takeinventory("Unloading",1)
		Goto ReadyNoFuckingAMmo
		
		
	
	CheckSprint:
		A12G A 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		TNT1 A 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprint")
		Goto Ready3
		
	CheckSprint2:
		RI2G A 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		TNT1 A 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprint")
		Goto Ready2	
		
	StartSprint:
		A12G A 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_Takeinventory("Zoomed",1)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_JumpIfInventory("UsedStamina", 40, "StopSprintTired")
		
	Sprinting:	
		A1SP A 0 offset(-9,32) 
		TNT1 A 0 offset(-9,32) A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		TNT1 A 0 offset(-9,32) A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
		PLAY A 0 offset(-9,32) ACS_ExecuteAlways(852, 0, 0, 0, 0)//Makes player faster.
		TNT1 A 0 offset(-9,32) A_JumpIfInventory("PowerStrength", 1, 2)
		TNT1 A 0 offset(-9,32) A_GiveInventory("UsedStamina", 6)
		TNT1 A 0 offset(-9,32)
		A1SP A 1 offset(-9,34) A_SetPitch(pitch -0.5)
		A1SP A 1 offset(-6,36) A_SetPitch(pitch -0.5)
		A1SP A 1 offset(-3,38) A_SetPitch(pitch -0.5)
		A1SP A 1 offset(0,38) A_SetPitch(pitch -0.5)
		A1SP A 1 offset(3,36) A_SetPitch(pitch -0.5)
		A1SP A 1 offset(6,34) A_SetPitch(pitch -0.5)
		A1SP A 1 offset(9,32) A_SetPitch(pitch -0.5)
		TNT1 A 0 offset(9,32) A_WeaponReady(WRF_NOBOB)
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 offset(-9,32) A_GiveInventory("UsedStamina", 6)
		TNT1 A 0 offset(9,33) A_SpawnItemEx("FootStep", 0, 0, 2, 0, 0, -4)
		A1SP A 1 offset(9,34) A_SetPitch(pitch +0.5)
		A1SP A 1 offset(6,36) A_SetPitch(pitch +0.5)
		A1SP A 1 offset(3,38) A_SetPitch(pitch +0.5)
		A1SP A 1 offset(0,38) A_SetPitch(pitch +0.5)
		A1SP A 1 offset(-3,36) A_SetPitch(pitch +0.5)
		A1SP A 1 offset(-6,34) A_SetPitch(pitch +0.5)
		A1SP A 1 offset(-9,32) A_SetPitch(pitch +0.5)
		TNT1 A 0 offset(-9,32) A_WeaponReady(WRF_NOBOB)
		TNT1 A 0 offset(-9,32) A_JumpIfInventory("IsRunning", 1, "Sprinting")
		
		Goto StopSprint
	StopSprintTired:
		A12G A 1
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		TNT1 A 0 A_PlaySound("Tired", 2)
		TNT1 A 0 A_TakeInventory("UsedStamina", 2)
		A12G A 5 A_WeaponReady
		TNT1 A 0 A_TakeInventory("UsedStamina", 2)
		A12G A 5 A_WeaponReady
		TNT1 A 0 A_TakeInventory("UsedStamina", 2)
		A12G A 5 A_WeaponReady
		TNT1 A 0 A_TakeInventory("UsedStamina", 2)
		A12G A 5 A_WeaponReady
		TNT1 A 0 A_TakeInventory("UsedStamina", 2)
		A12G A 5 A_WeaponReady
		Goto Ready3
	StopSprint:
		A1SP A 1
		TNT1 A 0 A_JumpIfInventory("UsedStamina", 60, "StopSprintTired")
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		Goto Ready3
	
 	Spawn:
		A12P A -1
		Stop
	}
}

ACTOR AssaultShotgunAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 20
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 20
   Inventory.Icon "A12PA0"
}
