// Knife (Counter-Strike)

Actor Knife : IDMWeapon
{
  Weapon.SelectionOrder 1500
  Weapon.SisterWeapon "Machete"
  Weapon.Kickback 100
  //Weapon.PreferredSkin "KnifeMarine"
  +WEAPON.MELEEWEAPON
  +WEAPON.NOLMS
  Inventory.PickupMessage "Knife! (Slot 1)"
  Obituary "%o brought a gun to %k's knifefight."
  DamageType "Knife"
  Decal BulletChip
  Tag "Knife"
  States
  {
  Spawn:
    KNFE A -1 Bright
    loop
  Ready:
    KNFG A 1 A_WeaponReady
    loop
  Deselect:
    KNFG A 0 A_Lower
    KNFG A 0 A_Lower
    KNFG A 1 A_Lower
	TNT1 A 0 A_TakeInventory("PowerKnifeSpeed")
    loop
  Select:
	TNT1 A 0 A_PlaySound("KnifeSelect",CHAN_WEAPON)
	TNT1 A 0 A_GiveInventory("KnifeSpeed")
  Sloop:
    KNFG A 0 A_Raise
    KNFG A 0 A_Raise
    KNFG A 1 A_Raise
    loop
  Fire:
    KNFG B 2
	TNT1 A 0 A_Playsound("KnifeMiss")
	TNT1 A 0 A_GunFlash
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
    KNFG C 2 A_CustomPunch(random(100,200),1,0,"KnifePuff",104)
    KNFG D 2
    KNFG E 2
    KNFG F 1
	TNT1 A 3
    KNFG A 2 A_ReFire
    goto Ready
  Quad:
	TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5)
	Goto Fire+4
  Flash:
    TNT1 A 1
	Goto LightDone
  }
}

Actor Machete : Knife
{
  Weapon.Kickback 100
  Weapon.SisterWeapon "Knife"
  +POWERED_UP
  +WEAPON.MELEEWEAPON
  States
  {
  Ready:
    MHTG G 1 A_WeaponReady
    loop
  Deselect:
    MHTG G 0 A_Lower
    MHTG G 0 A_Lower
	TNT1 A 0 A_TakeInventory("PowerKnifeSpeed")
    MHTG G 1 A_Lower
	TNT1 A 0 A_TakeInventory("PowerKnifeSpeed")
    loop
  Select:
	TNT1 A 0 A_PlaySound("KnifeSelect",CHAN_WEAPON)
	TNT1 A 0 A_GiveInventory("KnifeSpeed")
  Sloop:
    MHTG G 0 A_Raise
    MHTG G 0 A_Raise
    MHTG G 1 A_Raise
    loop
  Fire:
    TNT1 A 0 A_Jump(128,"Fire4")
    TNT1 A 0 A_Jump(128,"Fire3")
    TNT1 A 0 A_Jump(128,"Fire2")
    MHTG A 1 A_PlayWeaponSound("MacheteSwing")
    MHTG B 1
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
    MHTG CCC 1 A_CustomPunch(random(125,200),0,0,"KnifePuff",104)
    MHTG D 1
    MHTG E 1
    MHTG F 1
    MHTG G 2
    MHTG H 1
    MHTG I 2
    goto Ready
  Quad:
	TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5)
	Goto Fire+6
  Fire2:
    MHT2 A 1 A_PlayWeaponSound("MacheteSwing")
    MHT2 B 1
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad2")
    MHT2 CCC 1 A_CustomPunch(random(125,200),0,0,"KnifePuff",104)
    MHT2 D 1
    MHT2 E 1
    MHT2 F 1
    MHT2 G 1
    MHT2 H 2 
    goto Ready
  Quad2:
	TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5)
	Goto Fire2+3
  Fire3:
    MHT3 A 1 A_PlayWeaponSound("MacheteSwing")
    MHT3 B 1
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad3")
    MHT3 CCC 1 A_CustomPunch(random(125,200),0,0,"KnifePuff",104)
    MHT3 D 1
    MHT3 E 1
    MHT3 F 1
    MHT3 G 2
    TNT1 A 0 A_ReFire
    goto Ready
  Quad3:
	TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5)
	Goto Fire3+3
  Fire4:
    MHT4 A 1 A_PlayWeaponSound("MacheteSwing")
    MHT4 B 1
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad4")
    MHT4 CCC 1 A_CustomPunch(random(125,200),0,0,"KnifePuff",104)
    MHT4 D 1
    MHT4 E 1
    MHT4 F 2
    MHT4 G 1
    TNT1 A 0 A_ReFire
    goto Ready
  Quad4:
	TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5)
	Goto Fire4+3
  }
}

ACTOR KnifeFightKnife : Knife
{
  Obituary "%o was shanked by %k's knife."
  +WEAPON.CHEATNOTWEAPON
  States
  {
  Fire:
    KNFG B 2
	TNT1 A 0 A_Playsound("KnifeMiss")
	TNT1 A 0 A_GunFlash
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
    KNFG C 2 A_CustomPunch(random(200,300),1,0,"KnifePuff",104)
    KNFG D 2
    KNFG E 2
    KNFG F 1
	TNT1 A 3
    KNFG A 2 A_ReFire
    goto Ready
  }
}

ACTOR KnifePuff
{
  +NOBLOCKMAP
  +NOGRAVITY
  +PUFFONACTORS
  +CLIENTSIDEONLY
  RenderStyle Translucent
  Alpha 0.6
  SeeSound "KnifeHitThing"
  AttackSound "KnifeHitWall"
  VSpeed 0
  DamageType "Knife"
  States
  {
  Spawn:
  See:
	TNT1 A 0
	TNT1 A 0 A_Jump(256,"See1","See2","See3","See4")
  See1:
    PUFF A 3 Bright
    PUFF BCD 2
	Stop
  See2:
    BPUF A 3 Bright
    BPUF BCD 2
	Stop
  See3:
    PUFY A 3 Bright
    PUFY BCD 2
	Stop
  See4:
    FPUF A 3 Bright
    FPUF BCD 2
	Stop
  XDeath:
	TNT1 A 1
	Stop
  }
}

ACTOR PowerKnifeSpeed : PowerSpeed
{
	Speed 1.15
	+POWERSPEED.NOTRAIL
}

ACTOR KnifeSpeed : PowerupGiver
{
	Inventory.maxamount 0
	Powerup.Type "KnifeSpeed"
	Powerup.Duration 0x7FFFFFFF
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
}