actor SwatFists : Weapon
{
  Weapon.SelectionOrder 3700
  Weapon.Kickback 100
  Inventory.PickupMessage "You Learned CQC!!!"
  +WEAPON.MELEEWEAPON
  Weapon.AmmoType "Stamina"
  Weapon.AmmoGive 100
  +AMMO_OPTIONAL
  Obituary "%o Was Taught a lesson by %k And His CQC"
  Tag "CQC Fists"
  Inventory.RestrictedTo "SwatClass"
  States
  {
  Spawn:
    FIST P -1
    Loop
  Ready:
    PUCH A 0 A_JumpIfInventory("StamGen",5,3)
    PUCH A 0 A_GiveInventory("StamGen",2)
    PUCH A 1 a_weaponready(WRF_ALLOWZOOM)
    loop
    PUCH A 0 A_TakeInventory("StamGen",5)
    PUCH A 0 A_JumpIfInventory("Stamina",100,2)
    PUCH A 0 A_GiveInventory("Stamina",2)
    PUCH A 1 a_weaponready(WRF_ALLOWZOOM)
    loop
  Deselect:
    PUCH A 1 A_Lower
	TNT1 A 0 A_Lower
	TNT1 A 0 A_Lower
    loop
  Select: 
    PUCH A 1 A_Raise
	TNT1 A 0 A_Raise
	TNT1 A 0 A_Raise
    loop
  Fire:
    PUCH A 0 A_JumpIfInventory("Stamina",5,1)
	TNT1 A 0 A_JumpIfInventory("PowerStrength", 1, "BerserkedFists")
	Goto NormalPunch
    NormalPunch:
    PUCH A 0 A_JumpIfInventory("FistToken", 1, "LeftPunch")
    PUCH A 3 A_Playsound ("FIST/SWING")
    PUCH B 2
    PUCH L 2 A_CustomPunch(15,true,0,"BulletPuff",96) 
    PUCH L 0 A_CustomPunch(15,true,0,"BulletPuff",96)
    PUCH L 0 A_CustomPunch(15,true,0,"BulletPuff",96)  
    PUCH C 2
    PUCH M 2
    PUCH D 2
    PUCH N 2
    PUCH E 2
    PUCH R 2
    PUCH R 0 A_TakeInventory("Stamina",1)
    PUCH K 0 A_GiveInventory("FistToken",1)
    PUCH K 3 A_ReFire  	
    goto Ready
    LeftPunch:
    PUCH F 3 A_Playsound ("FIST/SWING")
    PUCH G 2
    PUCH O 2 A_CustomPunch(15,true,0,"BulletPuff",96) 
    PUCH O 0 A_CustomPunch(15,true,0,"BulletPuff",96)
    PUCH O 0 A_CustomPunch(15,true,0,"BulletPuff",96)
    PUCH H 2
    PUCH P 2
    PUCH I 2
    PUCH Q 2
    PUCH J 2
    PUCH K 0 A_TakeInventory("Stamina",1)
    PUCH K 0 A_TakeInventory("FistToken",1) 
    PUCH K 3 A_ReFire  	
    goto Ready 
   BerserkedFists:
    PUCH A 0 A_JumpIfInventory("Stamina",2,1)
    goto Ready
    PUCH A 0 A_JumpIfInventory("FistToken", 1, "BerserkedLeftPunch")
    PUCH A 2 A_Playsound ("FIST/SWING")
    PUCH B 1
    PUCH L 1 A_CustomPunch(60,true,0,"BulletPuff",96) 
    PUCH L 0 A_CustomPunch(60,true,0,"BulletPuff",96)
    PUCH L 0 A_CustomPunch(60,true,0,"BulletPuff",96)  
    PUCH C 1
    PUCH M 1
    PUCH D 1
    PUCH N 1
    PUCH E 1
    PUCH R 1
    PUCH R 0 A_TakeInventory("Stamina",1)
    PUCH K 0 A_GiveInventory("FistToken",1)
    PUCH K 2 A_ReFire  	
    goto Ready
    BerserkedLeftPunch:
    PUCH F 2 A_Playsound ("FIST/SWING")
    PUCH G 1
    PUCH O 1 A_CustomPunch(60,true,0,"BulletPuff",96) 
    PUCH O 0 A_CustomPunch(60,true,0,"BulletPuff",96)
    PUCH O 0 A_CustomPunch(60,true,0,"BulletPuff",96)
    PUCH H 1
    PUCH P 1
    PUCH I 1
    PUCH Q 1
    PUCH J 1
    PUCH K 0 A_TakeInventory("Stamina",1)
    PUCH K 0 A_TakeInventory("FistToken",1) 
    PUCH K 2 A_ReFire  	
    goto Ready 
  Altfire:
    PUCH K 0 A_JumpIfInventory("Stamina",10,1)
	TNT1 A 0 A_JumpIfInventory("PowerStrength", 1, "BerserkedKick")
    goto NormalKick
	NormalKick:
    PUCH K 2 A_Playsound ("FIST/SWING")
    MLEG A 2
    MLEG B 2 
    MLEG C 2 A_CustomPunch (25,true,0,"BulletPuff",96)
    MLEG C 0 A_CustomPunch (25,true,0,"BulletPuff",96)
    MLEG C 0 A_CustomPunch (25,true,0,"BulletPuff",96)
    MLEG C 0 A_CustomPunch(25,true,0,"BulletPuff",96)
    MLEG C 0 A_CustomPunch(25,true,0,"BulletPuff",96)
    MLEG D 2
    MLEG E 2
    MLEG F 2
    MLEG G 2
    MLEG H 2
    PUCH K 0 A_TakeInventory("Stamina",10)
    PUCH K 4 A_ReFire
    goto Ready  
	  BerserkedKick:
    PUCH K 0 A_JumpIfInventory("Stamina",5,1)
    goto Ready
    PUCH K 1 A_Playsound ("FIST/SWING")
    MLEG A 1
    MLEG B 1 
    MLEG C 1 A_CustomPunch (100,true,0,"BulletPuff",96)
    MLEG C 0 A_CustomPunch (100,true,0,"BulletPuff",96)
    MLEG C 0 A_CustomPunch (100,true,0,"BulletPuff",96)
    MLEG C 0 A_CustomPunch(100,true,0,"BulletPuff",96)
    MLEG C 0 A_CustomPunch(100,true,0,"BulletPuff",96)
    MLEG D 1
    MLEG E 1
    MLEG F 1
    MLEG G 1
    MLEG H 1
    PUCH K 0 A_TakeInventory("Stamina",5)
    PUCH K 2 A_ReFire
    goto Ready  
  Zoom:
    TNT1 A 0 A_JumpIfInventory("HasSwatGrenades", 1, "CheckAmmo")
    Goto DontThrow
  CheckAmmo:
    TNT1 A 0 A_JumpIfInventory("SwatGrenadeAmmo", 1, "DoThrow")
    Goto DontThrow
  DoThrow:
    TNT1 A 0
    Goto ThrowFrag
	ThrowFrag:
	FGGN BCD 2
	TNT1 A 0 A_TakeInventory("SwatGrenadeAmmo", 1) // ONLY grenade ammo removed
	FGGN E 2 A_PlaySound("weapons/grnpullpin")
	FGGN FGHH 2
	FGGN J 0 A_FireCustomMissile("ThrownGrenade30", 0, 0, 0, 0)
	FGGN J 0 A_PlaySound("weapons/grntoss")
	FGGN JKLMNOPQ 2
	FGGN A 0
	NULL A 12 A_CheckReload
		Goto RaiseAfterThrow
  RaiseAfterThrow:
    PUCH A 1 Offset(0, 50)
    PUCH A 1 Offset(0, 40)
    PUCH A 1 Offset(0, 30)
	Goto Ready
  DontThrow:
	PUCH A 1
	Goto Ready
  } 
}

actor Stamina : Ammo
{
	Inventory.MaxAmount 100
}

actor StamGen: Ammo 
{
	Inventory.MaxAmount 5
}

actor FistToken: Ammo 
{
	Inventory.MaxAmount 1
}
