ACTOR "Legendary Assault Shotgun" : Weapon 16601
{
//$Category Weapons/LCA
//$Sprite LMAPA0
//$Title "Legendary Assault Shotgun"
	Scale 0.85
	Weapon.PreferredSkin "LegendaryASG-Marine"
	Weapon.SelectionOrder 4500
	Weapon.KickBack 160
	Weapon.AmmoUse 1
    Weapon.AmmoGive 16
    Weapon.AmmoGive2 32
    Weapon.AmmoType "LegendaryShotgunDrum"
    Weapon.AmmoType2 "LegendaryShell"
	Inventory.PickupSound "LShotgun/Cock"
	Inventory.PickupMessage "Legendary Assault Shotgun"
	Obituary "%o ate several blue bullets from %k's Legendary Assault Shotgun."
	Decal LegBulletChip
	+WEAPON.AMMO_OPTIONAL
	+WEAPON.NOALERT
	+INVENTORY.UNDROPPABLE
	States
  {
	Ready:
    TNT1 A 0 A_PlayWeaponSound("LShotgun/Cock")
	LSGR ABCDE 1
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
    LMAG A 1 A_WeaponReady
    Goto Ready+6
  Deselect: 
    TNT1 A 0 A_PlaySound("weapons/weapondown")
    LMAG A 1 A_Lower
    Goto Deselect+1
  Select:
	TNT1 A 0 A_Raise
    Wait	
  Fire:
	TNT1 A 0 A_JumpIfNoAmmo("Empty")
	TNT1 A 0 A_PlaySound("Weapons/LegAutoShotgun", 1)
	TNT1 A 0 A_AlertMonsters
    TNT1 A 0 Radius_Quake(3,3,0,1,0)
    TNT1 A 0 A_GunFlash
	TNT1 A 0 A_Light1
	TNT1 A 0 A_SpawnItemEx("BlueShellCasing",30,5,25,Random(2,4),Random(3,6),Random(3,6),0)

	// Ark patch: START
	TNT1 AAAAAA 0 A_FireCustomMissile("BlueSGTracer",Random(5,-5),0,0,Random(5,-5))
    TNT1 A      0 A_FireCustomMissile("PlayerLegendaryASGPellet", random(-400, 400)/100.00, 1, 0, 1, 0)
    TNT1 AAAAAA 0 A_FireCustomMissile("PlayerLegendaryASGPellet", random(-400, 400)/100.00, 0, 0, 1, 0)
    LMAF A 1 Bright //A_FireBullets(6.2,3.4,7,Random(20,28),"LegendaryASGBulletPuff")
	// Ark patch: END

    LMAF B 1 Bright A_Light2
	TNT1 A 0 A_Light0
    LMAG BCDE 1
	LMAG FA 2
    Goto Ready+6
  Empty:
    LMAG A 10 A_PlaySound("weapons/click")
  AltFire:
  	TNT1 A 0 A_JumpIfInventory("LegendaryShotgunDrum",16,2)
    TNT1 A 0 A_JumpIfInventory("LegendaryShell",1,2)
	TNT1 A 0
	Goto Ready+6
	LMAR ABCDEF 1
	LMAR GO 2
	LMAR N 2 A_PlaySound("lasgguy/asgout")
	TNT1 A 0 A_JumpIfInventory("LegendaryShotgunDrum",1,"MaxReload")
  	LMAR H 3
	LMAR I 2
	LMAR JKL 1
	LMAR M 35 A_FireCustomMissile("LegendaryEmptyDrumSpawner", 0, 0, 10, 1) 
	LMAR LKJ 1
	LMAR I 2
	TNT1 A 0 A_JumpIfInventory("LegendaryShell",1,"Reload2")
  Reload:
	TNT1 A 0 A_TakeInventory("LegendaryShell",1)
	TNT1 A 0 A_GiveInventory("LegendaryShotgunDrum",1)
	TNT1 A 0 A_JumpIfInventory("LegendaryShotgunDrum",16,2)
	TNT1 A 0 A_JumpIfInventory("LegendaryShell",1,"Reload")
	TNT1 A 0
	Goto Ready+6
  MaxReload:
	LMAR H 3
	LMAR I 2
	LMAR JKL 1
	LMAR M 35 A_FireCustomMissile("LegendaryEmptyDrum", 0, 0, 10, 1) 
	LMAR LKJ 1
	LMAR I 2
	LMAR P 6 A_PlaySound("lasgguy/asgin")
	LMAR NOG 2
	LMAR FEDCBA 1
	LMAG A 5
	TNT1 A 0 A_JumpIfInventory("LegendaryShell",1,"Reload")
  Reload2:
	TNT1 A 0 A_TakeInventory("LegendaryShell",1)
	TNT1 A 0 A_GiveInventory("LegendaryShotgunDrum",1)
	TNT1 A 0 A_JumpIfInventory("LegendaryShotgunDrum",15,"FullCock")
	TNT1 A 0 A_JumpIfInventory("LegendaryShell",1,"Reload2")
  Full:
	LMAR P 6 A_PlayWeaponSound("lasgguy/asgin")
	LMAR NOG 2
	LMAR FEDCBA 1
	LMAG A 3
	LMAG A 5
	Goto Ready+6
  FullCock:
	LMAR P 6 A_PlayWeaponSound("lasgguy/asgin")
	LMAR NOG 2
	LMAR FEDCBA 1
	LMAG A 3
	LMAG A 5
	LMCK AB 2
	LMCK C 4 A_PlayWeaponSound("LShotgun/Cock")
	LMCK D 3
	LMCK A 2
	LMAG A 3	
	Goto Ready+6
  GrenadeCheck:
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAmmo",1,"GrenadeToss")
	TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	Goto Ready+6
  GrenadeToss:
  	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown") 
	LSGR EDCBA 1
	TNT1 A 6
	HGRN ABC 1
	HGRN D 3
	HGRN EFGHI 2
	TNT1 A 14 A_PlayWeaponSound("weapons/hgrenadepin")
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	TNT1 A 0 A_TakeInventory("HandGrenadeAmmo",1)
	HGRN J 1 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
	HGRN KLM 2
	TNT1 A 6
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAmmo",1,2)
    TNT1 A 0 A_TakeInventory("Hand Grenade",1)
	TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	TNT1 A 0
	LSGR ABCDE 1
	Goto Ready+6
  MineCheck:
	TNT1 A 0 A_JumpIfInventory("MineAmmo",1,"MineToss")
	TNT1 A 0 A_TakeInventory("MineAction",1)
	Goto Ready+6
  MineToss:
  	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown") 
	LSGR EDCBA 1
	TNT1 A 10
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	MINE ABCDEF 1		
	TNT1 A 0 A_TakeInventory("MineAmmo",1)	  
	MINE G 1 A_FireCustomMissile("ThrownMine",0,0,0,0)
	MINE HI 1
	MINE JK 2
	TNT1 A 0 A_JumpIfInventory("MineAmmo",1,2)
    TNT1 A 0 A_TakeInventory("Land Mine",1)
	TNT1 A 0 A_TakeInventory("MineAction",1)
	TNT1 A 0
	TNT1 A 5
	Goto Ready+1
  Spawn:
    LMAP A -1
    Stop
  }
}

ACTOR LegendaryShotgunDrum : Ammo
{
	Inventory.Amount 16
	Inventory.MaxAmount 16
	Ammo.BackpackAmount 16
	Ammo.BackpackMaxAmount 16
	Inventory.Icon "LMAPA0"
	+IGNORESKILL
	+NOTIMEFREEZE
}
ACTOR LegendaryEmptyDrum : BulletCasing
{
	Scale 0.2
	Seesound "weapons/emptydrum"
	+NOTIMEFREEZE
	States
	{
	Spawn:
	  TNT1 A 0
      TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "Toaster")
	  LDRM ABCD 3 
	  Loop
    Death:
	  TNT1 A 0
      TNT1 A 0 A_Jump(128,3)
      LDRM A 100
      LDRM A 5 A_FadeOut(0.10)
      Goto Death+3
      LDRM C 100
	  LDRM C 5 A_FadeOut(0.10)
	  Goto Death+5
	  }
}

ACTOR LegendaryShell : Ammo 16801
{
//$Category Ammunition/LCA
//$Sprite LESSA0
//$Title "Legendary Shells"
Scale 0.3
Inventory.PickupMessage "Legendary Shells"
Inventory.PickupSound "items/shell"
Inventory.Amount 4
Inventory.MaxAmount 40
Ammo.BackpackAmount 5
Ammo.BackpackMaxAmount 90
Inventory.Icon "LHELA0"
+NOTIMEFREEZE
States
{
  Spawn:
    LESS A -1
    Stop
    }
}

ACTOR LegendaryShellBox : LegendaryShell 16802
{
//$Category Ammunition/LCA
//$Sprite LBOXA0
//$Title "Legendary Shell Box"
Scale 0.75
Inventory.Amount 10
Inventory.PickupMessage "Legendary Shell Box"
Inventory.PickupSound "items/shellbox"
Inventory.Icon "LBOXA0"
+NOTIMEFREEZE
States
{
  Spawn:
    LBOX A -1
    Stop
    }
}

ACTOR BlueSGTracer : Tracer
{
Speed 100
Scale 0.075
+NOTIMEFREEZE
States
{
Spawn:
    BRAC A 10 Bright
	Stop
	}
}

ACTOR LegendaryEmptyDrumSpawner : CasingSpawner
{
+NOTIMEFREEZE
States
{
Spawn:
    TNT1 A 0
    TNT1 A 1 A_SpawnItemEx("LegendaryEmptyDrum", 2, 0, -12, 1, 0, 0, Random(-100, -110), 128)
    Stop
    }
}

ACTOR LegendaryASGBulletPuff : ModdedBulletPuff {
DamageType "Legendary"
Decal "LegBulletChip"
+NOTIMEFREEZE
}
