//This sprite edit uses bits from the "Union" Rifle by Pillowblaster, sorry man but i really like the wood stock... :-:

Actor Archangel : Weapon Replaces SuperShotgun 25005
{
	Tag "SK-410 Archangel Mk.2"
	Weapon.SelectionOrder 400
	Weapon.SlotNumber 4
	Inventory.PickupSound "misc/w_pkup"
	Inventory.PickupMessage "You got the SK-410 'Archangel Mk.2' Assault Shotgun"
	Weapon.UpSound "Weapons/ArchangelUp"
	Obituary "%o was looking really good, until %g met %k's Archangel Mk.2."
	Weapon.AmmoType "ArchClip"
	Weapon.AmmoType2 "AShot_Magazine"
	Weapon.AmmoGive 0
	Weapon.AmmoUse 1
	Weapon.PreferredSkin "Rifle"
	Weapon.AmmoGive2 2
	Weapon.AmmoUse2 0
	decal "BlazeChip"
	Scale 0.75
	Weapon.Slotnumber 4
	weapon.bobstyle inversesmooth
	weapon.bobrangeX 0.4
	weapon.bobrangeY 0.6
	weapon.bobspeed 2.5
	+AMMO_OPTIONAL
	+NOEXTREMEDEATH
	+NoAutoFire
	+NOALERT
	+NOAUTOAIM
	States
	{
	Ready:
        ASGI A 1 A_WeaponReady(WRF_ALLOWRELOAD)
        loop
	ReadyEmpty:
        ASGE A 1 A_WeaponReady(WRF_ALLOWRELOAD)
        loop
    Deselect:
        TNT1 A 0 SetPlayerProperty(0,1,2)
	    TNT1 A 0 A_SetCrosshair(1)
	    ASGS FEDCBA 1
	    Goto DeselectLoop
    DeselectLoop:
        TNT1 A 1 A_Lower
        Loop
    Select:
		TNT1 A 0 A_JumpIfInventory("ASGToken",1,"SelectSemi")
		TNT1 A 0 A_JumpIfInventory("ArchangelFirstTime",1,1)
		goto SelectAuto
		TNT1 A 0 A_PlaySoundEx("Weapons/ArchangelFirst","WeaponPickedUp",0,0)
		TNT1 A 0 SetPlayerProperty(0,0,2)
		TNT1 A 0 A_SetCrosshair(6)
		ASGS ABCDEF 1
		TNT1 A 0 A_TakeInventory("ArchangelFirstTime",1)
		Goto SelectLoop
	SelectAuto:
		TNT1 A 0 SetPlayerProperty(0,0,2)
		TNT1 A 0 A_SetCrosshair(6)
		ASGS ABCDEF 1
		Goto SelectLoop
	SelectSemi:
		TNT1 A 0 SetPlayerProperty(0,0,2)
		TNT1 A 0 A_SetCrosshair(17)
		ASGS ABCDEF 1
		Goto SelectLoop
    SelectLoop:
        ASGI A 1 A_Raise
	    loop
	Spawn:
		ASGG X -1
		Stop
	Fire:
	    TNT1 A 0 A_JumpIfInventory("ASGToken", 1, "FireSemi")
	FireAuto:
	    TNT1 A 0 A_JumpIfInventory("ArchClip",2,1)
		Goto FireAutoLast
		TNT1 A 0 A_JumpIfInventory("ArchClip",1,1)
		Goto DryFire
		TNT1 A 0 A_AlertMonsters
		TNT1 AAAAA 0 A_FireCustomMissile("gausssmoke_spawner2",0,0,3,4,0)		
	    TNT1 A 0 A_SpawnItem("Lightprojectile",0,0,0,0)
		TNT1 A 0 A_PlaySound("Weapons/SK410Fire",90,0.88,0,1)
	    TNT1 A 0 A_PlaySound("D3SG/Fire",91,0.99,0,1)
		TNT1 A 0 A_SpawnItemEx("Scmitrshell_Casing", 20,-20,32, 8,random(-2,2),random(0,4), random(-55,-80), SXF_NOCHECKPOSITION)
		TNT1 A 0 A_FireCustomMissile("p_pellet_tracer", random(-8, 8), 1, 2.5, 5, 0,random(-5, 5))
		TNT1 AAAAAAAAAAAAAAAAAAAAAAAA 0 A_FireCustomMissile("p_pellet_tracer", random(-8, 8), 0, 2.5, 5, 0,random(-5, 5))
		TNT1 A 0 A_SetPitch(pitch - 2.5)
		ASGF A 1 Bright A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ZoomFactor(0.99)
		ASGF B 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ZoomFactor(0.98)
		ASGF C 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ZoomFactor(0.97)
		ASGF D 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ZoomFactor(0.98)
		ASGI A 3 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_Refire
		TNT1 A 0 A_ZoomFactor(0.99)
		TNT1 A 0 A_ZoomFactor(1.00)
		Goto Ready
	FireAutoLast:
		TNT1 A 0 A_JumpIfInventory("ArchClip",1,1)
		Goto DryFire
		TNT1 A 0 A_AlertMonsters
		TNT1 AAAAA 0 A_FireCustomMissile("gausssmoke_spawner2",0,0,3,4,0)		
	    TNT1 A 0 A_SpawnItem("Lightprojectile",0,0,0,0)
		TNT1 A 0 A_PlaySound("Weapons/SK410Fire",90,0.88,0,1)
	    TNT1 A 0 A_PlaySound("D3SG/Fire",91,0.99,0,1)
		TNT1 A 0 A_PlaySound("Weapons/OmenBolt",92,1.5,0,1)
		TNT1 A 0 A_SpawnItemEx("Scmitrshell_Casing", 20,-20,32, 8,random(-2,2),random(0,4), random(-55,-80), SXF_NOCHECKPOSITION)
		TNT1 A 0 A_FireCustomMissile("p_pellet_tracer", random(-8, 8), 1, 2.5, 5, 0,random(-5, 5))
		TNT1 AAAAAAAAAAAAAAAAAAAAAAAA 0 A_FireCustomMissile("p_pellet_tracer", random(-8, 8), 0, 2.5, 5, 0,random(-5, 5))
		TNT1 A 0 A_SetPitch(pitch - 2.5)
		ASGF E 1 Bright A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ZoomFactor(0.99)
		ASGF F 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ZoomFactor(0.98)
		ASGF G 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ZoomFactor(0.97)
		ASGF H 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ZoomFactor(0.98)
		ASGE A 3 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_Refire
		TNT1 A 0 A_ZoomFactor(0.99)
		TNT1 A 0 A_ZoomFactor(1.00)
		Goto ReadyEmpty
	FireSemi:
	    TNT1 A 0 A_JumpIfInventory("ArchClip",2,1)
		Goto FireSemiLast
		TNT1 A 0 A_JumpIfInventory("ArchClip",1,1)
		Goto DryFire
		TNT1 A 0 A_AlertMonsters
		TNT1 AAAAA 0 A_FireCustomMissile("gausssmoke_spawner2",0,0,3,4,0)		
	    TNT1 A 0 A_SpawnItem("Lightprojectile",0,0,0,0)
		TNT1 A 0 A_PlaySound("Weapons/SK410Fire",90,0.88,0,1)
	    TNT1 A 0 A_PlaySound("D3SG/Fire",91,0.99,0,1)
		TNT1 A 0 A_SpawnItemEx("Scmitrshell_Casing", 20,-20,32, 8,random(-2,2),random(0,4), random(-55,-80), SXF_NOCHECKPOSITION)
		TNT1 A 0 A_FireCustomMissile("p_pellet_tracer", random(-4, 4), 1, 2.5, 5, 0,random(-3, 3))
		TNT1 AAAAAAAAAAAAAAAAAAAAAAAA 0 A_FireCustomMissile("p_pellet_tracer", random(-4, 4), 0, 2.5, 5, 0,random(-3, 3))
		TNT1 A 0 A_SetPitch(pitch - 2.5)
		ASGF A 1 Bright A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ZoomFactor(0.99)
		ASGF B 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ZoomFactor(0.98)
		ASGF C 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ZoomFactor(0.97)
		ASGF D 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ZoomFactor(0.98)
		ASGI A 1 A_WeaponReady
		TNT1 A 0 A_ZoomFactor(0.99)
		TNT1 A 0 A_ZoomFactor(1.00)
		Goto Ready
	FireSemiLast:
		TNT1 A 0 A_JumpIfInventory("ArchClip",1,1)
		Goto DryFire
		TNT1 A 0 A_AlertMonsters
		TNT1 AAAAA 0 A_FireCustomMissile("gausssmoke_spawner2",0,0,3,4,0)		
	    TNT1 A 0 A_SpawnItem("Lightprojectile",0,0,0,0)
		TNT1 A 0 A_PlaySound("Weapons/SK410Fire",90,0.88,0,1)
	    TNT1 A 0 A_PlaySound("D3SG/Fire",91,0.99,0,1)
		TNT1 A 0 A_PlaySound("Weapons/OmenBolt",92,1.5,0,1)
		TNT1 A 0 A_SpawnItemEx("Scmitrshell_Casing", 20,-20,32, 8,random(-2,2),random(0,4), random(-55,-80), SXF_NOCHECKPOSITION)
		TNT1 A 0 A_FireCustomMissile("p_pellet_tracer", random(-4, 4), 1, 2.5, 5, 0,random(-3, 3))
		TNT1 AAAAAAAAAAAAAAAAAAAAAAAA 0 A_FireCustomMissile("p_pellet_tracer", random(-4, 4), 0, 2.5, 5, 0,random(-3, 3))
		TNT1 A 0 A_SetPitch(pitch - 2.5)
		ASGF E 1 Bright A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ZoomFactor(0.99)
		ASGF F 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ZoomFactor(0.98)
		ASGF G 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ZoomFactor(0.97)
		ASGF H 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ZoomFactor(0.98)
		ASGE A 1 A_WeaponReady
		TNT1 A 0 A_ZoomFactor(0.99)
		TNT1 A 0 A_ZoomFactor(1.00)
		Goto ReadyEmpty
	AltFire: //Does checks, if you have no dummy actors, select semi auto
		TNT1 A 0 A_PlaySoundEX("Weapons/FireSelector","Body",0,0)
		SHTG A 0 A_JumpIfInventory("ASGToken", 1, "AltFire2")
		SHTG A 0 A_GiveInventory("ASGToken", 1)
		TNT1 A 0 A_SetCrosshair(17)
		ASGI A 10 A_WeaponReady(WRF_NOFIRE)
		Goto Ready
	AltFire2: //Clears dummy actors, to use full auto
		TNT1 A 0 A_PlaySoundEX("Weapons/FireSelector","Body",0,0)
		SHTG A 0 A_TakeInventory("ASGToken", 1)
		TNT1 A 0 A_SetCrosshair(6)
		ASGI A 10 A_WeaponReady(WRF_NOFIRE)
		Goto Ready
	DryFire:
		TNT1 A 0 A_PlaySound("Shotgun/Empty",199,1.0,0,1)
		ASGE A 5 A_WeaponReady(WRF_NOFIRE)
		Goto ReadyEmpty
	Reload:
	ReloadBegin:
		NULL A 0
		TNT1 A 0 A_JumpIfInventory("ArchClip",15,"Ready")
		TNT1 A 0 A_JumpIfInventory("AShot_Magazine",1,1)
		Goto DryFire
		TNT1 A 0 A_PlaySound("Weapons/SniperPull",94,0.75,0,1)
		ASGR ABCD 1 A_WeaponReady(WRF_NOFIRE)
		ASGR E 2 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_PlaySound("SK410/MagOut",95,0.75,0,1)
		ASGR E 2 A_WeaponReady(WRF_NOFIRE)
		ASGR FGH 2 A_WeaponReady(WRF_NOFIRE)
		4XRR E 0 A_SpawnItemEx("ArchClipDrop",0,0,20)
		ASGR H 20 A_WeaponReady(WRF_NOFIRE)
		ASGR IJK 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_PlaySound("SK410/MagIn",96,0.75,0,1)
		ASGR L 2 A_WeaponReady(WRF_NOFIRE)
		ASGR M 2 A_WeaponReady(WRF_NOFIRE)
		ASGR N 2 A_WeaponReady(WRF_NOFIRE)
		ASGR OP 2 A_WeaponReady(WRF_NOFIRE)
		ASGR Q 2 A_WeaponReady(WRF_NOFIRE)
	ReloadAmmoLoop:
		NULL A 0 A_TakeInventory("AShot_Magazine",1)
		NULL A 0 A_GiveInventory("ArchClip",15)
		NULL A 0 A_JumpIfInventory("AShot_Magazine",1,1) // if not out of ammo, countinue reloading
		goto ReloadEnd
		NULL A 0 A_JumpIfInventory("ArchClip",15,"ReloadEnd") // if clip full, finish reload
		goto ReloadAmmoLoop // otherwise continue
	ReloadEnd:
		TNT1 A 0 A_PlaySound("SK410/BoltCatch",99,0.99,0,1)
		ASGR RSTU 1 A_WeaponReady(WRF_NOFIRE)
		ASGI A 2 A_WeaponReady(WRF_NOFIRE)
		Goto Ready
	}
}

ACTOR ASGToken : Inventory {Inventory.MaxAmount 1}

ACTOR ArchangelFirstTime : Inventory {Inventory.MaxAmount 1 Inventory.InterHubAmount 1}

ACTOR ArchClip : Ammo
{
Inventory.Amount 0
Inventory.MaxAmount 15
Ammo.BackpackAmount 0
Ammo.BackpackMaxAmount 15
+IGNORESKILL
}

actor AShot_Magazine : ammo 26203 {
  radius 16
  height 8
  Scale 0.55
  inventory.pickupmessage "Magazine of Blackeart Shells for the SK-410 Archangel"
  inventory.pickupsound "SK410/MagIn"
  inventory.amount 1
  inventory.maxamount 4
  ammo.backpackamount 2
  ammo.backpackmaxamount 8
  states
  {
  Spawn:
    BLTC A -1
    stop
  }
}

ACTOR ArchClipDrop
{
   Radius 4
   Height 6
   Speed 0
   Scale 0.26
   BounceSound "Clip/ASR"
   PROJECTILE
   -NOGRAVITY
   +BOUNCEONACTORS
   +BOUNCEONCEILINGS
   +NOTIMEFREEZE
   Gravity 0.75
   BounceType Doom
   BounceCount 4
   BounceFactor 0.6
   States
   {
   Spawn:
      CLP2 A 0
      CLP2 ABCDEFGH 1
      Loop
   Death:
      CLP1 A 0 A_SpawnItemEx("ArchClipLiedown")
      stop
   }
}

actor ArchClipLiedown
{
	-NOGRAVITY
	+FLOORCLIP
	+NOTIMEFREEZE
    Scale 0.26
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 0 A_Jump(255,"Spawn1","Spawn2")
	  stop
	Spawn1:
	  CLP2 I 1
	  Goto Ded
	Spawn2:
	  CLP2 J 1
	  Goto Ded
	Ded:
	  "####" "#" 210 A_CheckSight("Fadying")
	  Loop
	Fadying:
	  "####" "#" 1 A_FadeOut(0.1)
	  Wait
   }
}