ACTOR "Enraged Legendary Assault Shotgun" : Weapon
{
	Scale 0.85
	Weapon.PreferredSkin "EnragedLegendaryASG-Marine"
	Weapon.SelectionOrder 4500
	Weapon.KickBack 160
	Weapon.AmmoUse 2
    Weapon.AmmoGive 0
    Weapon.AmmoGive2 32
    Weapon.AmmoType "EnragedLegendaryShotgunDrum"
    Weapon.AmmoType2 "EnragedLegendaryShell"
	Inventory.PickupSound "LShotgun/Cock"
	Inventory.PickupMessage "Enraged Legendary Assault Shotgun"
	Obituary "%o ate several Red bullets from %k's Legendary Assault Shotgun."
	Decal EnragedModdedBulletPuff
	+WEAPON.AMMO_OPTIONAL
	+WEAPON.NOALERT
	+INVENTORY.UNDROPPABLE
	States
  {
	Ready:
    TNT1 A 0 A_PlayWeaponSound("LShotgun/Cock")
	ISGR ABCDE 1
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
    IMAG A 1 A_WeaponReady
    Goto Ready+6
  Deselect: 
    TNT1 A 0 A_PlaySound("weapons/weapondown")
    IMAG 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("RedShellCasing",30,5,25,Random(2,4),Random(3,6),Random(3,6),0)
	TNT1 AAAAAA 0 A_FireCustomMissile("RedSGTracer",Random(5,-5),0,0,Random(5,-5))
	TNT1 AAAAAA 0 A_FireCustomMissile("RedSGTracer",Random(10,-10),0,0,Random(10,-10))
    IMAF A 1 Bright A_FireBullets(6.2,3.4,7,Random(20,28),"EnragedModdedBulletPuff")
    IMAF B 1 Bright A_Light2
	TNT1 A 0 A_Light0
    IMAG BCDE 1
	IMAG FA 2
    Goto Ready+6
  Empty:
    IMAG A 10 A_PlaySound("weapons/click")
  AltFire:
  	TNT1 A 0 A_JumpIfInventory("EnragedLegendaryShotgunDrum",16,2)
    TNT1 A 0 A_JumpIfInventory("EnragedLegendaryShell",1,2)
	TNT1 A 0
	Goto Ready+6
	IMAR ABCDEF 1
	IMAR GO 2
	IMAR N 2 A_PlaySound("lasgguy/asgout")
	TNT1 A 0 A_JumpIfInventory("EnragedLegendaryShotgunDrum",1,"MaxReload")
  	IMAR H 3
	IMAR I 2
	IMAR JKL 1
	IMAR M 35 A_FireCustomMissile("EnragedLegendaryEmptyDrumSpawner", 0, 0, 10, 1) 
	IMAR LKJ 1
	IMAR I 2
	TNT1 A 0 A_JumpIfInventory("EnragedLegendaryShell",1,"Reload2")
  Reload:
	TNT1 A 0 A_TakeInventory("EnragedLegendaryShell",1)
	TNT1 A 0 A_GiveInventory("EnragedLegendaryShotgunDrum",1)
	TNT1 A 0 A_JumpIfInventory("EnragedLegendaryShotgunDrum",16,2)
	TNT1 A 0 A_JumpIfInventory("EnragedLegendaryShell",1,"Reload")
	TNT1 A 0
	Goto Ready+6
  MaxReload:
	IMAR H 3
	IMAR I 2
	IMAR JKL 1
	IMAR M 35 A_FireCustomMissile("EnragedLegendaryEmptyDrum", 0, 0, 10, 1) 
	IMAR LKJ 1
	IMAR I 2
	IMAR P 6 A_PlaySound("lasgguy/asgin")
	IMAR NOG 2
	IMAR FEDCBA 1
	IMAG A 5
	TNT1 A 0 A_JumpIfInventory("EnragedLegendaryShell",1,"Reload")
  Reload2:
	TNT1 A 0 A_TakeInventory("EnragedLegendaryShell",1)
	TNT1 A 0 A_GiveInventory("EnragedLegendaryShotgunDrum",1)
	TNT1 A 0 A_JumpIfInventory("EnragedLegendaryShotgunDrum",16,"FullCock")
	TNT1 A 0 A_JumpIfInventory("EnragedLegendaryShell",1,"Reload2")
  Full:
	IMAR P 6 A_PlayWeaponSound("lasgguy/asgin")
	IMAR NOG 2
	IMAR FEDCBA 1
	IMAG A 3
	IMAG A 5
	Goto Ready+6
  FullCock:
	IMAR P 6 A_PlayWeaponSound("lasgguy/asgin")
	IMAR NOG 2
	IMAR FEDCBA 1
	IMAG A 3
	IMAG A 5
	IMCK AB 2
	IMCK C 4 A_PlayWeaponSound("LShotgun/Cock")
	IMCK D 3
	IMCK A 2
	IMAG 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") 
	ISGR 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
	ISGR 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") 
	ISGR 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:
    IMAP A -1
    Stop
  }
}
ACTOR EnragedLegendaryShotgunDrum : Ammo
{
	Inventory.Amount 16
	Inventory.MaxAmount 16
	Ammo.BackpackAmount 16
	Ammo.BackpackMaxAmount 16
	Inventory.Icon "LMAPA0"
	+IGNORESKILL
	+NOTIMEFREEZE
}
ACTOR EnragedLegendaryEmptyDrum : 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 EnragedLegendaryShell : Ammo
{
Scale 0.3
Inventory.PickupMessage "Enraged Legendary Shells"
Inventory.PickupSound "items/shell"
Inventory.Amount 4
Inventory.MaxAmount 40
Ammo.BackpackAmount 10
Ammo.BackpackMaxAmount 90
Inventory.Icon "IHELA0"
+NOTIMEFREEZE
States
{
  Spawn:
    IESS A -1
    Stop
    }
}

ACTOR EnragedLegendaryShellBox : EnragedLegendaryShell
{
Scale 0.75
Inventory.Amount 10
Inventory.PickupMessage "Enraged Legendary Shell Box."
Inventory.PickupSound "items/shellbox"
Inventory.Icon "IBOXA0"
+NOTIMEFREEZE
States
{
  Spawn:
    IBOX A -1
    Stop
    }
}

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

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

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

ACTOR EnragedModdedBulletPuff : ModdedBulletPuff
{
Damagetype "Legendary"
+NOTIMEFREEZE 
}