actor PlasmaBeam : Weapon
{
  obituary "%o was vapourised by %k's plasma beam."
  radius 20
  height 16
  Weapon.AmmoUse 1
  weapon.ammogive 999
  Weapon.AmmoType1 "PlasmaBeamammo"
  Weapon.SelectionOrder 1300  
  inventory.pickupmessage "You got the plasma beam!"
  states
  {
  Ready:
	M1GE A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
	AK47 A 0 A_JumpIfInventory("Kinfeammo",1,"UseKnife")
    LECH A 1 A_WeaponReady
    loop
  Deselect:
    LECH A 0 A_Lower
    LECH A 0 A_Lower
    LECH A 1 A_Lower
    LECH A 0 A_StopSoundEx (soundslot7)
    Loop
  Select:
    LECH A 0 A_Raise
    LECH A 0 A_Raise
    LECH A 1 A_Raise
    LECH A 0 A_StopSoundEx (soundslot7)
    Loop
  Fire:
    LECH A 1 A_FireCustomMissile (LeechBeam, 0, 1, 0, 0, 0)
    LECH A 0 A_PlaySoundEx ("Leech/Fire", soundslot7, 1)
    LECH A 1 A_GunFlash
    LECH A 1 A_ReFire
    LECH A 10 A_StopSoundEx (soundslot7)
    goto Ready
  Flash:
    LECH B 2 bright A_Light1
    LECH C 3 bright A_Light2
    LECH A 0 bright A_Light0
    stop
  ThrowGrenade:
     HNDG BCD 1
     HNDG E 1 A_PlaySound("weapons/grenadepin")
     HNDG FGHH 1
     HNDG I 1 A_PlaySound("weapons/grenadethr") 
     HNDG J 0 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
     HNDG J 0 A_PlaySound("weapons/grenadethr")
     HNDG JKLMNOPQ 1
     HNDG Q 0 A_TakeInventory("thrownade")
     Goto Ready
  Useknife:
     KNFG A 0 A_jumpifinventory("Machete",1,"UseMachete")
     KNFG ABC 2
	 KNFG C 0 A_CustomPunch (110,1,0,"KnifePuff")
	 KNFG DEF 2
	 KNFG F 0 A_TakeInventory("Kinfeammo")
	 goto ready
  UseMachete:
     MHT4 ABC 2
	 MHT4 C 0 A_CustomPunch (450,1,0,"Machetepuff")
	 MHT4 DEFG 2
	 MHT4 G 0 A_TakeInventory("Kinfeammo")
	 goto ready
  Spawn:
    BEMP A -1
    Stop
  }
}

ACTOR LeechBeam : MageWandMissile
{
  Speed 200
  Radius 13
  Height 8
  Damage (random(3000,3000))
  Decal DoomImpScorch
  damagetype "Zap"
  -RIPPER
  -CANNOTPUSH
  -NODAMAGETHRUST
  states
  {
  Death:
    APBX BCDE 3 bright
    stop
  }
}

ACTOR PAPLeechBeam : MageWandMissile
{
  Speed 200
  Radius 13
  Height 8
  Damage (random(6000,6000))
  Decal DoomImpScorch
  damagetype "Zap"
  -RIPPER
  -CANNOTPUSH
  -NODAMAGETHRUST
  states
  {
  Death:
    APBX BCDE 3 bright
    stop
  }
}

ACTOR BeamTrail : MageWandSmoke replaces MageWandSmoke
{
  RenderStyle Add
  Scale 0.4
  States
  {
  Spawn:
    APBX BCD 1
    stop
  }
}



actor PlasmaBeamammo : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 80
    inventory.maxamount 600
    ammo.backpackamount 80
    ammo.backpackmaxamount 600
    +IGNORESKILL
    inventory.pickupmessage "Got PlasmaBeam ammo!"  
    States
    {
    Spawn:
      CLIP A -1
      Stop
    }
}

actor PAPPlasmaBeam : Weapon
{
  obituary "%o was vapourised by %k's plasma beam."
  radius 20
  height 16
  Weapon.AmmoUse 1
  Weapon.AmmoGive1 999
  Weapon.AmmoType1 "PlasmaBeamAmmo"
  Weapon.SelectionOrder 1300  
  inventory.pickupmessage "You got the plasma beam!"
  states
  {
  Ready:
	M1GE A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
	AK47 A 0 A_JumpIfInventory("Kinfeammo",1,"UseKnife")
    LECH A 1 A_WeaponReady
    loop
  Deselect: 
    LECH A 0 A_Lower
    LECH A 0 A_Lower
    LECH A 1 A_Lower
    LECH A 0 A_StopSoundEx (soundslot7)
    loop
  Select:
    LECH A 0 A_Raise
    LECH A 0 A_Raise
    LECH A 1 A_Raise
    LECH A 0 A_StopSoundEx (soundslot7)
    loop
  Useknife:
     KNFG A 0 A_jumpifinventory("Machete",1,"UseMachete")
     KNFG ABC 2
	 KNFG C 0 A_CustomPunch (110,1,0,"KnifePuff")
	 KNFG DEF 2
	 KNFG F 0 A_TakeInventory("Kinfeammo")
	 goto ready
  UseMachete:
     MHT4 ABC 2
	 MHT4 C 0 A_CustomPunch (450,1,0,"Machetepuff")
	 MHT4 DEFG 2
	 MHT4 G 0 A_TakeInventory("Kinfeammo")
	 goto ready
  Fire:
    LECH A 1 A_FireCustomMissile (PAPLeechBeam, 0, 1, 0, 0, 0)
    LECH A 0 A_PlaySoundEx ("Leech/Fire", soundslot7, 1)
    LECH A 1 A_GunFlash
    LECH A 1 A_ReFire
    LECH A 10 A_StopSoundEx (soundslot7)
    goto Ready
  Altfire:
    LECH C 2 A_BFGSound
    LECH B 0 A_Takeinventory("PlasmaBeamAmmo",40)
    LECH B 2
    LECH C 2
    LECH B 2
    LECH C 2
    LECH B 2
    LECH C 2
    LECH B 2
    LECH B 20 A_FireBFG
	LECH C 2 A_REFIRE
	Goto ready
  Flash:
    LECH B 2 bright A_Light1
    LECH C 3 bright A_Light2
    LECH A 0 bright A_Light0
    stop
  ThrowGrenade:
     HNDG BCD 1
     HNDG E 1 A_PlaySound("weapons/grenadepin")
     HNDG FGHH 1
     HNDG I 1 A_PlaySound("weapons/grenadethr") 
     HNDG J 0 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
     HNDG J 0 A_PlaySound("weapons/grenadethr")
     HNDG JKLMNOPQ 1
     HNDG Q 0 A_TakeInventory("thrownade")
     Goto Ready
  Spawn:
    BEMP A -1
    Stop
  }
}