// --------------------------------------------------------------------------
//
//	Base Weapon
//
//		This actor is used as a base for weapons.
//		Here lies the shared states such as grenade toss, kick and taunt.
//
// --------------------------------------------------------------------------

Actor BaseWeapon : Weapon
{
	Inventory.PickupMessage "Replace me!"
	Obituary "Replace me!"
	tag "Replace me!"
	AttackSound "None"
	+WEAPON.NOAUTOAIM
	+WEAPON.NOALERT
	+WEAPON.NOAUTOFIRE
	+WEAPON.NO_AUTO_SWITCH
	+FORCEXYBILLBOARD
	+WEAPON.CHEATNOTWEAPON
	States
	{
	Steady:
		TNT1 A 1
		Goto Ready
		
////////// REPLACE THESE //////////
	Ready:
		TNT1 A 1 A_Weaponready
		Goto Ready
    Select:
		TNT1 A 0
		TNT1 A 0 A_Raise
		Wait
    Deselect:
		TNT1 A 0
		TNT1 A 0 A_Lower
		Wait
    Fire:
		TNT1 A 0
		Goto Ready
///////////////////////////////////

	DoKick:
		TNT1 A 0 A_JumpIf (momZ > 0, "AirKick")
		TNT1 A 0 A_JumpIf (momZ < 0, "AirKick")
		TNT1 A 0 A_GunFlash("KickFlash")
		TNT1 A 0 A_JumpIf (pitch > 32, "LowKickChecker1")
		Goto InitializeNormalKick
		
	LowKickChecker1:
	    TNT1 A 0 A_JumpIf (pitch > 90, "InitializeNormalKick")
		TNT1 A 0 A_FireCustomMissile("KickAttackDetectDowned", 0, 0, 0, 0)
		
	InitializeNormalKick: //16 frames
        TNT1 A 0 A_jumpifinventory("PowerStrength",1,"BerserkerKick")
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 SetPlayerProperty(0,1,0)
		KICK BCD 1
		TNT1 A 0 A_FireCustomMissile("KickAttack", 0, 0, 0, -7)
        KICK H 4
		TNT1 A 0 A_Takeinventory("Kicking",1)
		KICK IGFEDCBA 1 
		TNT1 A 0 SetPlayerProperty(0,0,0)
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		TNT1 A 0 A_Jump(256,"Ready2")
		Goto Ready2

    BerserkerKick:
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 SetPlayerProperty(0,1,0)
		KICK BCD 1
        TNT1 A 0 A_FireCustomMissile("SuperKickAttack", 0, 0, 0, -7)
        KICK H 4
		TNT1 A 0 A_Takeinventory("Kicking",1)
		KICK IGFEDCBA 1
		TNT1 A 0 SetPlayerProperty(0,0,0)
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		TNT1 A 0 A_Jump(256,"Ready2")
		Goto Ready2
	
	AirKick: //18 frames
		TNT1 A 0 A_GunFlash("AirKickFlash")
	    TNT1 A 0 A_jumpifinventory("PowerStrength",1,"SuperAirKick")
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 A_Recoil (-6)
		KICK JKLMN 1
        TNT1 A 0 A_FireCustomMissile("AirKickAttack", 0, 0, 0, -31)
        KICK O 2
		KICK A 0 A_Takeinventory("Kicking",1)
		KICK PQRST 2
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		TNT1 A 0 A_Jump(256,"Ready2")
		Goto Ready2
		
	SuperAirKick:
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 A_Recoil (-6)
		KICK JKLMN 1
        TNT1 A 0 A_FireCustomMissile("SuperAirKickAttack", 0, 0, 0, -31)
        KICK O 2
		KICK A 0 A_Takeinventory("Kicking",1)
		KICK PQRST 2
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		TNT1 A 0 A_Jump(256,"Ready2")
		Goto Ready2

    TauntR: //43 frames
		TNT1 A 0 A_GunFlash("TauntFlash")
		TNT1 A 0 A_JumpIfInventory("RealismMode", 1, "CheckGrab")
		TNT1 A 5
		TNT1 A 5 A_PlaySound("FUCK", 2)
		FUCK A 1
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 0, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", -9, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 9, 0, -1, 0)
        FUCK BCD 1 A_AlertMonsters
		FUCK E 14 A_Takeinventory("Taunting",1)
        FUCK DCBA 1
		TNT1 A 10
		TNT1 A 0 A_Jump(256,"Ready2")
		Goto Ready2

    TauntL: //43 frames
		TNT1 A 0 A_GunFlash("TauntFlash")
		TNT1 A 0 A_JumpIfInventory("RealismMode", 1, "CheckGrab")
		TNT1 A 5
		TNT1 A 5 A_PlaySound("FUCK", 2)
		FUCK F 1
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 0, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", -9, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 9, 0, -1, 0)
        FUCK GHI 1 A_AlertMonsters
		FUCK J 14 A_Takeinventory("Taunting",1)
        FUCK IHGF 1
		TNT1 A 10
		TNT1 A 0 A_Jump(256,"Ready2")
		Goto Ready2

	Salute:
	    TNT1 A 0 SetPlayerProperty(0,1,0)
		TNT1 A 0 A_AlertMonsters
		SALU ABCDEDCDEDCDEDCBA 4
		TNT1 A 0 A_TakeInventory("Salute1",1)
		TNT1 A 0 A_TakeInventory("Salute2",1)
		TNT1 A 0 SetPlayerProperty(0,0,0)
		TNT1 A 0 A_Jump(256,"Ready1")
		Goto Ready+2
		
	CheckGrab:
	    TNT1 A 0 
		TNT1 A 0 A_JumpIfTargetInLOS("CheckDistanceGrab")
		TNT1 A 0 A_Jump(256,"Ready1")
		Goto Ready+2
	CheckDistanceGrab:
	    TNT1 A 0 
		TNT1 A 0 A_JumpIfCloser(100, "Grab")
		TNT1 A 0 A_Jump(256,"Ready1")
		Goto Ready+2
	CheckIfCanGrab:
	    TNT1 A 0 
		TNT1 A 0 A_JumpIfInTargetInventory("CanGrab", 1, "Grab")
		TNT1 A 0 A_Jump(256,"Ready1")
		Goto Ready+2	
	Grab:
	    PKUP ABC 2
		TNT1 A 0 A_CustomMissile("PickupProjectile")
		PKUP DEF 2
		TNT1 A 0 A_Jump(256,"Ready1")
		Goto Ready+2
		
	TossGrenade: //25 frames
		TNT1 A 0 A_TakeInventory("TossGrenade", 1)
		TNT1 A 0 A_JumpIfInventory("GrenadeAmmo", 1, 1)
		Goto NoGrenade
		TNT1 A 0 A_GunFlash("GrenadeFlash")
		TNT1 A 5
		GRHO ABC 1
		GRTH ABCD 1
		TNT1 A 0 A_GiveInventory("FiredGrenade", 1)
		TNT1 A 0 A_PlaySound ("GRNPIN")
		GRTH EEFG 1
		TNT1 A 1
		TNT1 A 0 A_PlaySound ("GRNTOSS")
		GRTH HIJ 1
		TNT1 A 0 A_TakeInventory("GrenadeAmmo", 1)
		TNT1 A 0 A_FireCustomMissile("HandGrenade", random(-2,2), 0, 0, 0, 0, 0)
	    TNT1 A 0 A_TakeInventory("FiredGrenade", 1)
		GRTH KLMN 1
		TNT1 A 1 A_TakeInventory("TossGrenade", 1)
		TNT1 A 0 A_Jump(256,"Ready1")
		Goto Ready+2

	NoGrenade:
		TNT1 A 0 A_Print("No Grenades Left.")
		TNT1 A 0 A_Jump(256,"Ready2")
		Goto Ready2
	}
}