// --------------------------------------------------------------------------
//
//	KNIFE
//
// --------------------------------------------------------------------------

ACTOR Knife : BaseWeapon
{
	tag "Knife"
    Inventory.PickupSound "items/knife"
	obituary "%o was shanked by %k's combat knife."
	radius 20
	height 16
	inventory.pickupmessage "You got the combat knife!"
	Weapon.SelectionOrder 20000
	+WEAPON.AXEBLOOD
	+WEAPON.MELEEWEAPON
	-WEAPON.CHEATNOTWEAPON
	States
	{
	Spawn:
		KNFW A -1
		stop

	Ready:
		TNT1 A 0 A_JumpIfInventory("JustStartedGame",1,"WarmUp")
        TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
        TNT1 A 0 A_PlaySound("items/knife", 5)
	Ready1:
		TNT1 A 0 A_JumpIfInventory("PowerBloodOnVisor",1,6)
        KNFS EDCBA 1
        Goto Ready2
        KNBS EDCBA 1
        Goto Ready2
	Ready2:
        TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("PowerBloodOnVisor",1,2)
		KNFA A 1 A_WeaponReady
		Goto Ready2
		KNBA A 1 A_WeaponReady
		Goto Ready2
		
	Select:
		TNT1 A 0 A_JumpIfInventory("IsPlayingAsPurist", 1, "PuristGun")
		//TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("CheckRevolver")==0, "PuristGun")
		TNT1 A 0 A_Takeinventory("FistsSelected",1)
		TNT1 A 0 A_Takeinventory("SawSelected",1)
		TNT1 A 0 A_Takeinventory("ShotgunSelected",1)
		TNT1 A 0 A_Takeinventory("SSGSelected",1)
		TNT1 A 0 A_Takeinventory("MinigunSelected",1)
		TNT1 A 0 A_Takeinventory("PlasmaGunSelected",1)
		TNT1 A 0 A_Takeinventory("RocketLauncherSelected",1)
		TNT1 A 0 A_Takeinventory("GrenadeLauncherSelected",1)
		TNT1 A 0 A_Takeinventory("BFGSelected",1)
		TNT1 A 0 A_Takeinventory("BFG10kSelected",1)
		TNT1 A 0 A_Takeinventory("RailGunSelected",1)
		TNT1 A 0 A_Takeinventory("SubMachineGunSelected",1)
		TNT1 A 0 A_Takeinventory("RevenantLauncherSelected",1)
		TNT1 A 0 A_Takeinventory("LostSoulSelected",1)
		TNT1 A 0 A_Takeinventory("FlameCannonSelected",1)
		TNT1 A 0 A_Takeinventory("HasBarrel",1)
		TNT1 A 0 A_TakeInventory("TossGrenade", 1)
		TNT1 A 0 A_Takeinventory("WeapSpecial",1)
		TNT1 A 0 A_Takeinventory("PowerBloodOnVisor",1)
		TNT1 A 0 A_Takeinventory("PowerBlueBloodOnVisor",1)
		TNT1 A 0 A_Takeinventory("PowerGreenBloodOnVisor",1)
		TNT1 A 5
		TNT1 A 0 A_Raise
		Wait
		
	Deselect:
		TNT1 A 0 A_PlaySound("weapons/changing")
		TNT1 A 0 A_JumpIfInventory("PowerBloodOnVisor",1,7)
		KNFS ABCDE 1
		TNT1 A 0 A_Jump(256,6)
		KNBS ABCDE 1
		TNT1 A 0 A_Takeinventory("TossGrenade",1)
		TNT1 A 0 A_Takeinventory("Unloading",1)
		TNT1 A 0 A_Takeinventory("Reloading",1)
		TNT1 A 0 A_Lower
		Wait
		
	PuristGun:
		TNT1 A 0 A_TakeInventory("Knife", 1)
		Goto Deselect

	WarmUp:
		TNT1 A 0 A_TakeInventory("JustStartedGame", 1)
		TNT1 A 10 A_WeaponReady
		PUNS ABCD 1 A_WeaponReady
		TNT1 A 0 A_PlaySound("Knuckled")
		PUNS E 7 A_WeaponReady
		PUNS FGFE 3 A_WeaponReady
		PUNS DCB 1 A_WeaponReady
		TNT1 A 10 A_WeaponReady
		Goto Ready

	Fire:
		TNT1 A 0 A_JumpIfInventory("FireSeq", 2, "Fire3")
		TNT1 A 0 A_JumpIfInventory("FireSeq", 1, "Fire2")
		TNT1 A 0 A_GiveInventory("FireSeq", 1)
		TNT1 A 0 A_JumpIfInventory("PowerBloodOnVisor",1,"FireBlood")
		KNFA BC 1
		TNT1 A 0 A_PlaySound("weapons/wiff")
		KNFA DEFG 1
		//TNT1 A 0 A_Saw("","",2,"",SF_NORANDOM,64,0,0)
		TNT1 A 0 A_CustomPunch(random(10,40),1,0,"knifePuff")
		KNFA HI 1
		TNT1 A 5
		TNT1 A 0 A_Refire
		TNT1 A 0 A_TakeInventory("FireSeq", 3)
		goto Ready1
		
	FireBlood:
		KNBA BC 1
		TNT1 A 0 A_PlaySound("weapons/wiff")
		KNBA DEFG 1
		//TNT1 A 0 A_Saw("","",2,"",SF_NORANDOM,64,0,0)
		TNT1 A 0 A_CustomPunch(random(10,40),1,0,"knifePuff")
		KNBA HI 1
		TNT1 A 5
		TNT1 A 0 A_Refire
		TNT1 A 0 A_TakeInventory("FireSeq", 3)
		goto Ready1

	Fire2:
		TNT1 A 0 A_GiveInventory("FireSeq", 1)
		TNT1 A 0 A_PlaySound("weapons/wiff")
		TNT1 A 0 A_JumpIfInventory("PowerBloodOnVisor",1,"FireBlood2")
		KNFA NOP 1
		TNT1 A 0 A_CustomPunch(random(10,40),1,0,"knifePuff")
		KNFA QRS 1
		TNT1 A 5
		TNT1 A 0 A_Refire
		TNT1 A 0 A_TakeInventory("FireSeq", 3)
		goto Ready1
		
	FireBlood2:
		KNBA NOP 1
		TNT1 A 0 A_CustomPunch(random(10,40),1,0,"knifePuff")
		KNBA QRS 1
		TNT1 A 5
		TNT1 A 0 A_Refire
		TNT1 A 0 A_TakeInventory("FireSeq", 3)
		goto Ready1

	Fire3:
		TNT1 A 0 A_TakeInventory("FireSeq", 1)
		TNT1 A 0 A_JumpIfInventory("PowerBloodOnVisor",1,"FireBlood3")
		KNFA T 1
		TNT1 A 0 A_PlaySound("weapons/wiff")
		KNFA UVFG 1
		TNT1 A 0 A_CustomPunch(random(10,40),1,0,"knifePuff")
		KNFA HI 1
		TNT1 A 5
		TNT1 A 0 A_Refire
		TNT1 A 0 A_TakeInventory("FireSeq", 3)
		goto Ready1
		
	FireBlood3:
		KNBA T 1
		TNT1 A 0 A_PlaySound("weapons/wiff")
		KNBA UVFG 1
		TNT1 A 0 A_CustomPunch(random(10,40),1,0,"knifePuff")
		KNBA HI 1
		TNT1 A 5
		TNT1 A 0 A_Refire
		TNT1 A 0 A_TakeInventory("FireSeq", 3)
		goto Ready1

	AltFire:
		TNT1 A 0 A_JumpIfInventory("PowerBloodOnVisor",1,"AltFireBlood")
		KNFS ABCDE 1
		TNT1 A 3
	AltHold:
		TNT1 A 0 A_JumpIfInventory("PowerBloodOnVisor",1,"AltHoldBlood")
		TNT1 A 0 A_PlaySound("weapons/wiff")
		KNFA JKLM 1
		TNT1 A 0 A_CustomPunch(random(20,45),1,0,"knifePuff")
		KNFA LKJ 1
		TNT1 A 10
		TNT1 A 0 A_Refire
		goto Ready1
		
	AltFireBlood:
		KNBS ABCDE 1
		TNT1 A 3
	AltHoldBlood:
		TNT1 A 0 A_PlaySound("weapons/wiff")
		KNBA JKLM 1
		TNT1 A 0 A_CustomPunch(random(20,45),1,0,"knifePuff")
		KNBA LKJ 1
		TNT1 A 10
		TNT1 A 0 A_Refire
		goto Ready1

	KickFlash:
		TNT1 A 0 A_JumpIfInventory("PowerBloodOnVisor",1,"KickFlashBlood")
		KNFK ABCD 1
		KNFK E 8
		KNFK DCBA 1
		Stop

	KickFlashBlood:
		KNBK ABCD 1
		KNBK E 8
		KNBK DCBA 1
		Stop

	AirKickFlash:
		TNT1 A 0 A_JumpIfInventory("PowerBloodOnVisor",1,"AirKickFlashBlood")
		KNFK ABCD 1
		KNFK E 10
		KNFK DCBA 1
		Stop

	AirKickFlashBlood:
		KNBK ABCD 1
		KNBK E 10
		KNBK DCBA 1
		Stop

	TauntFlash:
		TNT1 A 0 A_JumpIfInventory("PowerBloodOnVisor",1,"TauntFlashBlood")
		KNFF G 34
		Stop

	TauntFlashBlood:
		KNBF G 34
		Stop

	GrenadeFlash:
		TNT1 A 0 A_JumpIfInventory("PowerBloodOnVisor",1,"GrenadeFlashBlood")
		KNFS ABCDE 1
		Stop

	GrenadeFlashBlood:
		KNFS ABCDE 1
		Stop

    Taunt:
		TNT1 A 0 A_GunFlash("TauntFlash")
		TNT1 A 0 A_JumpIfInventory("RealismMode", 1, "CheckGrab")
		KNFF A 3 A_PlaySound("FUCK", 2)
		KNFF B 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)
        KNFF CDE 1 A_AlertMonsters
		KNFF F 22 A_Takeinventory("Taunting",1)
        KNFF EDCB 1
		TNT1 A 0 A_Jump(256,"Ready2")
		Goto Ready2
	}
}

ACTOR knifepuff
{
	renderstyle Translucent
	scale 0.15
	alpha 0.7
	Radius 1
	Height 1
	+NOBLOCKMAP
	+NOGRAVITY
	+NOEXTREMEDEATH
	+FORCEXYBILLBOARD
	+FORCEPAIN
	//DamageType Knife
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_CustomMissile ("SparkX", 2, 0, random (0, 360), 2, random (30, 170))
		RSMK A 1 bright A_PlaySound("items/knife")
		RSMK BCDE 1 bright
		Stop
	}
}