ACTOR "Legendary Quad Shotgun" : Weapon 
{
  Tag "Legendary Quad Shotgun"
  Weapon.PreferredSkin "QuadBarrelSG-Marine"
  Weapon.SelectionOrder 4450
  Weapon.KickBack 100
  Weapon.AmmoUse 0
  Weapon.AmmoGive 4
  Weapon.AmmoGive2 20
  Weapon.AmmoType "LegendaryQuadShell"
  Weapon.AmmoType2 "LegendaryShell"
  Weapon.UpSound "LegendaryQuadShotgun/Up"
  Inventory.PickupMessage "Legendary Quad Shotgun, bring fear into them!"
  Inventory.PickupSound "weapons/pickupqsg"
  Obituary "%o was destroyed by %k's Legendary Quad Shotgun."
  +WEAPON.AMMO_OPTIONAL
  +WEAPON.NOALERT
  +INVENTORY.UNDROPPABLE
  States
  {
  Ready:
    QH09 A 1 A_WeaponReady
    Loop
  Deselect: 
    QH09 A 1 A_Lower
    Loop
  Select:
    QH09 A 1 A_Raise
    Loop
  Fire:
	TNT1 A 0 A_JumpIfInventory("LegendaryQuadShell",4,"QuadFire")
	TNT1 A 0 A_JumpIfInventory("LegendaryShell",2,"Reload")
	Goto Empty
  QuadFire:
	TNT1 A 0 A_PlaySound("LegendaryQuadShotgun/QuadFire")
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_Recoil(2)
    TNT1 A 0 A_GunFlash
	TNT1 A 0 A_Light1
    TNT1 A 0 Radius_Quake(10,5,0,1,0)
	TNT1 A 0 A_TakeInventory("LegendaryQuadShell",4)	
	TNT1 AAAAAAAAAAAA 0 A_FireCustomMissile("BlueSGTracer",Random(8,-8),0,0,Random(10,-10))
    QH09 B 2 Bright A_FireBullets(11.8,7.3,52,Random(20,28),"LegendaryASGBulletPuff")
    QH09 C 2 Bright A_Light2
	TNT1 A 0 A_Light0
	QH09 D 2
	QH09 E 2
	QH09 F 3
	QH09 G 6
	QH09 GFED 2
  QuadReloadCheck:
  	TNT1 A 0 A_JumpIfInventory("LegendaryShell",4,2)
	QH09 J 2
	Goto Ready
	TNT1 A 0
	Goto ReloadFourShells
  AltFire:
    TNT1 A 0 A_JumpIfInventory("LegendaryQuadShell",4,"FireLeft")
	TNT1 A 0 A_JumpIfInventory("LegendaryQuadShell",2,1)
	Goto Reload
    TNT1 A 0 A_PlaySound("LegendaryQuadShotgun/DualFire")	
    TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_GunFlash
	TNT1 A 0 A_Light1
    TNT1 A 0 Radius_Quake(3,3,0,1,0)
	TNT1 A 0 A_TakeInventory("LegendaryQuadShell",2)
	TNT1 AAAAAAAA 0 A_FireCustomMissile("BlueSGTracer",Random(8,-8),0,0,Random(8,-8))
    QH09 K 2 Bright A_FireBullets(11.2,7.1,20,Random(20,28),"LegendaryASGBulletPuff")
	QH09 L 2 Bright A_Light2
	TNT1 A 0 A_Light0
	QH09 OPQPO 1
	QH09 A 1
    Goto Ready
  FireLeft:
    TNT1 A 0 A_PlaySound("LegendaryQuadShotgun/DualFire")	
    TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_GunFlash
	TNT1 A 0 A_Light1
    TNT1 A 0 Radius_Quake(3,3,0,1,0)
	TNT1 A 0 A_TakeInventory("LegendaryQuadShell",2)
	TNT1 AAAAAAAA 0 A_FireCustomMissile("BlueSGTracer",Random(8,-8),0,0,Random(8,-8))
    QH09 M 2 Bright A_FireBullets(11.2,7.1,20,Random(20,28),"LegendaryASGBulletPuff")
	QH09 N 2 Bright A_Light2
	TNT1 A 0 A_Light0
	QH09 OPQPO 1
	QH09 A 1
    Goto Ready	
  Empty:
    QH09 A 10 A_PlayWeaponSound("weapons/click")
	TNT1 A 0 A_JumpIfInventory("LegendaryShell",4,"ReloadFourShells")
	Goto Ready
  Reload:
	TNT1 A 0 A_JumpIfInventory("LegendaryQuadShell",2,"ReloadTwoShells")
	TNT1 A 0 A_JumpIfInventory("LegendaryShell",4,"ReloadFourShells")
	Goto Empty	
  ReloadFourShells:
	QH09 HI 2
	TNT1 AAAA 0 A_SpawnItemEx("BlueShellCasing",25,-2,25,Random(2,4),Random(-3,-6),Random(3,6),0)
	QS2R A 1
	QS2R A 12 A_PlayWeaponSound("LegendaryQuadShotgun/Open")
	QS2R B 1
	QS2R CD 2
	TNT1 A 0 A_TakeInventory("LegendaryShell",2)
	TNT1 A 0 A_GiveInventory("LegendaryQuadShell",2)
	QS2R E 3 A_PlayWeaponSound("LegendaryQuadShotgun/Load")
	QS2R F 3
	QS2R G 2
	QS2R H 1
	QS2R I 8
	QS2R JK 1
	QS2R LM 2
	TNT1 A 0 A_TakeInventory("LegendaryShell",2)
	TNT1 A 0 A_GiveInventory("LegendaryQuadShell",2)
	QS2R N 3 A_PlayWeaponSound("LegendaryQuadShotgun/Load")	
	QS2R O 3
	QS2R P 2
	QS2R Q 2
	QH09 I 2
	QH09 H 2 A_PlayWeaponSound("LegendaryQuadShotgun/Close")
	QH09 A 2
    Goto Ready
  ReloadTwoShells:
    TNT1 A 0 A_JumpIfInventory("LegendaryShell",2,1)
	Goto Ready
	QH09 HI 2
	QS2R A 1
	TNT1 AA 0 A_SpawnItemEx("BlueShellCasing",25,-2,25,Random(2,4),Random(-3,-6),Random(3,6),0)
	QS2R I 12 A_PlayWeaponSound("LegendaryQuadShotgun/Open")
	QS2R JK 1
	QS2R LM 2
	TNT1 A 0 A_TakeInventory("LegendaryShell",2)
	TNT1 A 0 A_GiveInventory("LegendaryQuadShell",2)
	QS2R N 3 A_PlayWeaponSound("LegendaryQuadShotgun/Load")	
	QS2R O 3
	QS2R P 2
	QS2R Q 2
	QH09 I 2
	QH09 H 2 A_PlayWeaponSound("LegendaryQuadShotgun/Close")
	QH09 A 2
	Goto Ready
  Spawn:
    QS2S Z -1
    Stop
    }
}

ACTOR LegendaryQuadShell : Ammo
{
Inventory.Amount 0
Inventory.MaxAmount 4
Ammo.BackpackAmount 0
Ammo.BackpackMaxAmount 4
Inventory.Icon "QS2SZ0"
+IGNORESKILL
}