ACTOR PDReaper : Weapon
{
  Weapon.Kickback 100
  Scale 0.050
  
  Tag "Reaper"
        Weapon.Ammotype1 "ReaperClip"
  Weapon.Ammotype2 "PDReaperAmmo"
    Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoGive2 200
  +WEAPON.AMMO_OPTIONAL
  Inventory.PickupMessage "Picked up a Reaper."
  Obituary  "%o got scorched in half by %k's unholy Reaper."
  	Inventory.PickupSound "PerfectDark/Items/PickupWeapon"
  States
  {
  Spawn:
    TKA4 S -1
    Loop
  Ready:
  TNT1 A 0 A_PlaySound ("PerfectDark/Weapons/ReaperReady","Weapon")
    TK84 ABCDEFGHIJKLMNOPQRSTUVXYZ 1
    TK85 ABCDE 1
    TK85 F -1 A_WeaponReady(WRF_ALLOWRELOAD)
	goto ReloadCheck
	TK85 F 1 A_WeaponReady(WRF_ALLOWRELOAD)
    Goto Ready+7
	
	  ReloadCheck:
	 KLBG A 0 A_JumpIfInventory("ReaperClip",200,2)
	 KLBG A 0 A_JumpIfInventory("PDReaperAmmo",1,"ReloadStart")
	 KLBG A 0
	 Goto Ready+7

  ReloadStart:
     TK86 UVXYZ 1
	 TK87 ABCDEFGHIJKLMNOPQ 1
	 KLBR A 0 A_PlaySound("PerfectDark/Weapons/ReaperReload","Weapon")
	 TK87 STUVXYZ 1
	 TK88 ABCDEFGHIJKLMNOPQRSTUVXYZ 1
	 TK89 ABCDEFGHIJK 1
	 goto ReloadAmmo

  ReloadAmmo:
	 TNT1 A 0 A_TakeInventory("PDReaperAmmo",1)
	 TNT1 A 0 A_GiveInventory("ReaperClip",1)
	 TNT1 A 0 A_JumpIfInventory("ReaperClip",200,"ReloadDone")
	 TNT1 A 0 A_JumpIfInventory("PDReaperAmmo",1,"ReloadAmmo")
	 goto ReloadDone
	 
	 ReloadDone:
	 TK89 LMNOPQRSTUVXYZ 1
	 TK90 ABCDEFGHIJKLMNOPQRSTUV 1
	 Goto Ready+26
	
  Deselect:
  TNT1 A 0 A_Stopsound(7)
    TK86 OPQRST 2
    TK08 A 0 A_Lower
    wait
  Select: 
    TK08 A 0 A_Raise 
    Loop  
  Fire:
  KLBG A 0 A_JumpIfNoAmmo("ReloadCheck")
	TNT1 A 0 A_PlaySound ("PerfectDark/Weapons/ReaperFireStart","Weapon")
    TK85 G 2 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
    TK85 H 2
	TK85 I 2 
	TK85 J 2
	TK85 K 2 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TK85 L 2
	TK85 M 2 
	TK85 N 2
	TK85 O 2 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TK85 P 2
	TK85 Q 2 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TK85 R 2
	TK85 S 2 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TK85 T 2
	TK85 U 2 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TK85 V 2
	TK85 X 2 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TK85 Y 2
	TK85 Z 2 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
    NULL A 0 A_ReFire
    goto hold+10
  Hold:
  KLBG A 0 A_JumpIfNoAmmo("RestNoAmmo")
  TK27 T 0 A_PlaySound("PerfectDark/Weapons/ReaperFireLoop",7,1,TRUE)
    TL51 A 1 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TL51 B 1
	TL51 C 1 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TL51 D 1
	TL51 E 1 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TL51 F 1
	TL51 G 1 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TL51 H 1
	TL51 I 1 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TL51 J 1
	TL51 K 1 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TL51 L 1
	TL51 M 1 A_ReFire
	Goto Rest
	
	Rest:
	TNT1 A 0 A_Stopsound(7)
    NULL A 0 A_PlaySound ("PerfectDark/Weapons/ReaperFireStop")
    TL51 O 2
	TL51 P 2 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TL51 Q 2
	TL51 R 2 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TL51 S 2
	TL51 T 2 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TL51 U 2
	TL51 V 2 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TL51 X 2
	TL51 Y 2 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TL51 Z 2
	TK86 A 2 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TK86 B 2
	TK86 C 2 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TK86 D 2
	TK86 E 2 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TK86 F 2
	TK86 G 2 bright A_FireBullets (12,9,2,6,"PDGreenPuff")
	TK86 H 2
	TK86 I 2 
	TK86 J 2
	TK86 K 2 
	TK86 L 2
	TK86 M 2 
	TK86 N 2
	KLBG A 0 A_JumpIfNoAmmo("ReloadCheck")
    goto ready+26
	
	RestNoAmmo:
	TNT1 A 0 A_Stopsound(7)
    NULL A 0 A_PlaySound ("PerfectDark/Weapons/ReaperFireStop","Weapon")
    TL51 O 2
	TL51 P 2 
	TL51 Q 2
	TL51 R 2 
	TL51 S 2
	TL51 T 2 
	TL51 U 2
	TL51 V 2 
	TL51 X 2
	TL51 Y 2 
	TL51 Z 2
	TK86 A 2 
	TK86 B 2
	TK86 C 2 
	TK86 D 2
	TK86 E 2 
	TK86 F 2
	TK86 G 2 
	TK86 H 2
	TK86 I 2 
	TK86 J 2
	TK86 K 2 
	TK86 L 2
	TK86 M 2 
	TK86 N 2
	KLBG A 0 A_JumpIfNoAmmo("ReloadCheck")
    goto ready+26
	
		Reload:
		TK04 A 0
		goto ReloadCheck
		
	AltFire:
	TNT1 A 0 A_PlaySound ("PerfectDark/Weapons/ReaperAltStart","Weapon")
    TL61 A 2 A_CustomPunch(20, false, 0, "PDReaperPuff")
    TL61 B 2
	TL61 C 2 A_CustomPunch(20, false, 0, "PDReaperPuff")
	TL61 D 2
	TL61 E 2 A_CustomPunch(20, false, 0, "PDReaperPuff")
	TL61 F 2
	TL61 G 2 A_CustomPunch(20, false, 0, "PDReaperPuff")
	TL61 H 2
	TL61 I 2 A_CustomPunch(20, false, 0, "PDReaperPuff")
	TL61 J 2
	TL61 K 2 A_CustomPunch(20, false, 0, "PDReaperPuff")
	TL61 L 2
	TL61 M 2 A_CustomPunch(20, false, 0, "PDReaperPuff")
	TL61 N 2
	TL61 O 2 A_CustomPunch(20, false, 0, "PDReaperPuff")
	TL61 P 2
	TL61 Q 2 A_CustomPunch(20, false, 0, "PDReaperPuff")
	TL61 R 2 
	TL61 S 2 
    NULL A 0 A_ReFire
    goto althold+10
  AltHold:
  TK27 T 0 A_PlaySound("PerfectDark/Weapons/ReaperAltLoop",7,1,TRUE)
    TL61 T 1 A_CustomPunch(20, false, 0, "PDReaperPuff")
	TL61 U 1
	TL61 V 1 A_CustomPunch(20, false, 0, "PDReaperPuff")
	TL61 X 1
	TL61 Y 1 A_CustomPunch(20, false, 0, "PDReaperPuff")
	TL61 Z 1
	TL62 A 1 A_CustomPunch(20, false, 0, "PDReaperPuff")
	TL62 B 1
	TL62 C 1 A_CustomPunch(20, false, 0, "PDReaperPuff")
	TL62 D 1
	TL62 E 1 A_CustomPunch(20, false, 0, "PDReaperPuff")
	TL62 F 1
	TL62 G 1 A_ReFire
	Goto AltRest
	
	AltRest:
	TNT1 A 0 A_Stopsound(7)
    NULL A 0 A_PlaySound ("PerfectDark/Weapons/ReaperAltStop","Weapon")
	TL65 ABCDEFGHIJKLMNOPQRSTUVXYZ 1
	TL66 ABCDEFGHIJKLMNOPQRSTUVXYZ 1
	TL67 ABCDEFGHIJ 1
    goto ready+26
		
  }
}

ACTOR ReaperClip : Ammo
{
Inventory.MaxAmount 200 // size of the clip
Ammo.BackpackAmount 0
Ammo.BackpackMaxAmount 200 //MUST be the same as Inventory.MaxAmmount
+INVENTORY.IGNORESKILL
}

ACTOR PDReaperPickup : Custominventory
{
   Scale 0.050
  Inventory.PickupMessage "Picked up a Reaper."
  	Inventory.PickupSound "PerfectDark/Items/PickupWeapon"
   States
   {
   Spawn:
	  TKA4 S -1
	  loop
   Pickup:
	  TNT1 A 0 A_GiveInventory("PDReaper")
	  TNT1 A 0 A_JumpIfInventory("PlayingasPerfectKirby",1,"PickupPerfectKirby")
	  TNT1 A 0 A_JumpIfInventory("PlayingasRED",1,"PickupRED")
	  stop
	  PickupPerfectKirby:
	 	TNT1 A 0 A_PlaySound ("PerfectDark/Player/PerfectKirby/PerfectKirbyWeaponPickup")
		Stop
	  PickupRED:
	 	TNT1 A 0 A_PlaySound ("PerfectDark/Player/RED/REDWeaponPickup")
		Stop
   }
}

actor PDReaperPuff
{
  +NOBLOCKMAP
  +NOGRAVITY
  +PUFFONACTORS // this is necessary for it to still make sound on enemies
  activesound ""
  attacksound "melee/wall" // what sound it makes when you hit a wall with it
  seesound "PerfectDark/Weapons/ReaperAltHit" // what sound it makes when you beat somebody up with it
  states
  {
  Spawn:
    TNT1 A 0
    TNT1 A 1
    stop
  Crash:
     TNT1 A 0
     TNT1 A 1
     stop
  Melee:
     TNT1 A 0
     TNT1 A 1
     stop
  }
}