ACTOR Plasma_Gun : BrutalWeapon
{
	Weapon.SelectionOrder 110
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
    Inventory.PickupSound "PLSDRAW"
	Weapon.AmmoType1 "AmmoCell"
	Weapon.AmmoType2 "PlasmaAmmo"
    +WEAPON.NOAUTOAIM
	+FORCEXYBILLBOARD
	Tag "Plasma Rifle"
	Inventory.PickupMessage "Plasma Gun"
	States
	{
	
	PuristGun:
		TNT1 A 1
		PLSN A 0 A_GiveInventory("ClassicPlasmaRifle", 1)
		PLSN A 0 A_TakeInventory("Plasma_Gun", 1)
		PLSN A 0 A_TakeInventory("DualPlasmaRifles", 1)
		TNT1 A 10
		Goto Ready	
		
	
	Ready3:
	Ready:
        PLSN A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		PLSN A 0 A_Giveinventory("HasPlasmaWeapon",1)
        PLSN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        PLSN A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		PLSN A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		PLSN A 0 A_JumpIfInventory("Salute2", 1, "Salute")
        PLSN A 0 A_JumpIfInventory("Reloading",1,"Reload")
		PLSN A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		PLSN A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		PLSN A 0 A_JumpIfInventory("Unloading",1,"Unload")
		PLSN A 0 A_JumpIfInventory("StartDualWield",1,"DualWield")
		Loop
		
	CheckSprint:
		PLSN A 1 A_WeaponReady(WRF_NOFIRE)
		PLSN A 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		PLSN A 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprint")
		Goto Ready
		
	StartSprint:
		PLSN A 1 A_WeaponReady(WRF_NOFIRE)
		PLSN A 0 A_Takeinventory("Zoomed",1)
		PLSN A 0 A_Takeinventory("ADSmode",1)
		PLSN A 0 A_ZoomFactor(1.0)
		PLSN A 0 A_JumpIfInventory("UsedStamina", 40, "StopSprintTired")
		
	Sprinting:	
		PLSP A 0 offset(-9,32) 
		PLSN A 0 offset(-9,32) A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		PLSN A 0 offset(-9,32) A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
		PLAY A 0 offset(-9,32) ACS_ExecuteAlways(852, 0, 0, 0, 0)//Makes player faster.
		PLSN A 0 offset(-9,32) A_JumpIfInventory("PowerStrength", 1, 2)
		PLSN A 0 offset(-9,32) A_GiveInventory("UsedStamina", 4)
		PLSN A 0 offset(-9,32)
		PLSP A 1 offset(-9,34) A_SetPitch(pitch -0.5)
		PLSP A 1 offset(-6,36) A_SetPitch(pitch -0.5)
		PLSP A 1 offset(-3,38) A_SetPitch(pitch -0.5)
		PLSP A 1 offset(0,38) A_SetPitch(pitch -0.5)
		PLSP A 1 offset(3,36) A_SetPitch(pitch -0.5)
		PLSP A 1 offset(6,34) A_SetPitch(pitch -0.5)
		PLSP A 1 offset(9,32) A_SetPitch(pitch -0.5)
		PLSN A 0 offset(9,32) A_WeaponReady(WRF_NOBOB)
		PLSN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        PLSN A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        PLSN A 0 A_JumpIfInventory("Reloading",1,"Reload")
		PLSN A 0 offset(-9,32) A_GiveInventory("UsedStamina", 4)
		PLSN A 0 offset(9,33) A_SpawnItemEx("FootStep", 0, 0, 2, 0, 0, -4)
		PLSP A 1 offset(9,34) A_SetPitch(pitch +0.5)
		PLSP A 1 offset(6,36) A_SetPitch(pitch +0.5)
		PLSP A 1 offset(3,38) A_SetPitch(pitch +0.5)
		PLSP A 1 offset(0,38) A_SetPitch(pitch +0.5)
		PLSP A 1 offset(-3,36) A_SetPitch(pitch +0.5)
		PLSP A 1 offset(-6,34) A_SetPitch(pitch +0.5)
		PLSP A 1 offset(-9,32) A_SetPitch(pitch +0.5)
		PLSN A 0 offset(-9,32) A_WeaponReady(WRF_NOBOB)
		PLSN A 0 offset(-9,32) A_JumpIfInventory("IsRunning", 1, "Sprinting")
		Goto StopSprint
		
	StopSprintTired:
		PLSN A 1
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		PLSN A 0 A_PlaySound("Tired", 2)
		PLSN A 0 A_TakeInventory("UsedStamina", 2)
		PLSN A 5 A_WeaponReady
		PLSN A 0 A_TakeInventory("UsedStamina", 2)
		PLSN A 5 A_WeaponReady
		PLSN A 0 A_TakeInventory("UsedStamina", 2)
		PLSN A 5 A_WeaponReady
		PLSN A 0 A_TakeInventory("UsedStamina", 2)
		PLSN A 5 A_WeaponReady
		PLSN A 0 A_TakeInventory("UsedStamina", 2)
		PLSN A 5 A_WeaponReady
		Goto Ready
	StopSprint:
		PLSP A 1
		PLSN A 0 A_JumpIfInventory("UsedStamina", 60, "StopSprintTired")
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		Goto Ready	
		
	Deselect:
		PLSN A 0 A_Takeinventory("Reloading",1)
		PLSN A 0 A_Takeinventory("HasPlasmaWeapon",1)
		PLSN A 0 A_TakeInventory("TossGrenade", 1)
        PLS9 CBA 1
		TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait
		
	Select:
		PLSN A 0
		PLSN A 0 A_Takeinventory("StartDualWield",1)
		PLSN A 0 A_Giveinventory("GoSpecial",1)
	    PLSN A 0 A_Giveinventory("HasPlasmaWeapon",1)
		PLSN A 0 A_Takeinventory("FistsSelected",1)
		PLSN A 0 A_Takeinventory("SawSelected",1)
		PLSN A 0 A_Takeinventory("ShotgunSelected",1)
		PLSN A 0 A_Takeinventory("SSGSelected",1)
		PLSN A 0 A_Takeinventory("MinigunSelected",1)
		PLSN A 0 A_Giveinventory("PlasmaGunSelected",1)
		PLSN A 0 A_Takeinventory("RocketLauncherSelected",1)
		PLSN A 0 A_Takeinventory("GrenadeLauncherSelected",1)
		PLSN A 0 A_Takeinventory("BFGSelected",1)
		PLSN A 0 A_Takeinventory("BFG10kSelected",1)
		PLSN A 0 A_Takeinventory("RailGunSelected",1)
		PLSN A 0 A_Takeinventory("SubMachineGunSelected",1)
		PLSN A 0 A_Takeinventory("RevenantLauncherSelected",1)
		PLSN A 0 A_Takeinventory("LostSoulSelected",1)
		PLSN A 0 A_Takeinventory("FlameCannonSelected",1)
		PLSN A 0 A_Takeinventory("HasBarrel",1)
		PLSN A 0 A_TakeInventory("TossGrenade", 1)
		
		TNT1 A 1 A_Raise
		TNT1 AAAAAA 0 A_Raise
		PLSN A 0 A_GunFlash
	    PLSN A 0 A_JumpIfInventory("IsPlayingAsPurist", 1, "PuristGun")
		PLSN A 0 A_PlaySound("PLSDRAW")
		SelectAnimation:
        PLS9 ABC 1 A_JumpIfInventory("GoFatality", 1, "Steady")
		PLSN A 0 A_Takeinventory("StartDualWield",1)
		PLSN A 0 A_GunFlash
		Goto Ready
		
	Fire:
		PLSN A 0 A_CheckReload
        PLSN A 0 A_JumpIfInventory("Reloading",1,"Reload")
        PLSN A 0 A_JumpIfInventory("PlasmaAmmo",1,2)
        Goto NoAmmo
        TNT1 AAAA 0
        PLSN A 0 A_PlaySound("PLSM9", 1)
		//PLSN A 0 A_FireCustomMissile("PlasmaFlareSpawn", 0, 0, 0, 0)
		PLSN A 0 A_TakeInventory("DoublePlasmaAmmo", 1)
		PLSN A 0 A_JumpIfInventory("DMgame", 1, "FireDM")
		PLSN A 0 A_ZoomFactor(0.99)
		PLST A 1 BRIGHT A_FireCustomMissile("Plasma_Ball", 0, 1, 0, -5)
		PLSN A 0 A_ZoomFactor(1.0)
		PLST B 1 BRIGHT
		PLST C 1
		PLST D 1
		PLSN A 0 A_Takeinventory("PlasmaAmmo",1)
		Goto Ready
		
	FireDM:	
		PLSN A 0 A_ZoomFactor(0.99)
		PLST A 1 A_FireCustomMissile("PlasmaBallDM", 0, 1, 0, 0)
		PLSN A 0 A_ZoomFactor(1.0)
		PLST B 1
		PLST C 1
		PLST D 1
		PLSN A 0 A_Takeinventory("PlasmaAmmo",1)
		Goto Ready

// Charging up secondary ------------------------------------------------------------

	AltFire:
        PLSN A 0 A_JumpIfInventory("Reloading",1,"Reload")
        PLSN A 0 A_JumpIfInventory("PlasmaAmmo",11,2)
        Goto NoAmmo
        TNT1 AAA 0
		
	PLSN A 0 A_PlaySound("PLSCHARG")
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Takeinventory("PlasmaAmmo",2)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT 
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Takeinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT 
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Takeinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT 
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Takeinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT 
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Takeinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT 
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Takeinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Takeinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Takeinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Takeinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT

	PLSN A 0 A_PlaySound("PLSFULL", 6, 0.8, 1)
	PLSN A 0 A_ReFire

// Holding Charge ------------------------------------------------------------

AltHold:
	
	PLSN A 0 A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
	PLSN A 0 A_JumpIfInventory("Reloading",1,"Cancel")
	PLFA A 1 BRIGHT offset (0, 32)
	
	PLSN A 0 A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
	PLSN A 0 A_JumpIfInventory("Reloading",1,"Cancel")
	PLFA C 1 BRIGHT offset (0, 33)
	
	PLSN A 0 A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
	PLSN A 0 A_JumpIfInventory("Reloading",1,"Cancel")
	PLFA A 1 BRIGHT offset (1, 32)
	
	PLSN A 0 A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
	PLSN A 0 A_JumpIfInventory("Reloading",1,"Cancel")
	PLFA C 1 BRIGHT offset (-1, 32)
    
	PLSN A 0 A_ReFire

// Let Fly --------------------------------------------------------------------------

	PLSN A 0 A_StopSound(6)
	PLST A 1 A_PlaySound("PLSALTFR")
	PLSN A 0 A_ZoomFactor(0.9)
	PLST B 2 BRIGHT A_Recoil(3)
	PLSN A 0 A_StopSound(6)
	PLSN A 0 A_ZoomFactor(1.0)
	TNT1 A 0 A_JumpIfInventory("DMGame", 1, "LetFlyDM")
	PLSN A 0 A_FireCustomMissile("PlasmaBall75", -8, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("PlasmaBall75", -6, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("PlasmaBall75", -4, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("PlasmaBall75", -2, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("PlasmaBall75", 0, 0, -1, 0, 0, 0)
	PLSN A 0 A_FireCustomMissile("PlasmaBall75", 1, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("PlasmaBall75", 2, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("PlasmaBall75", 4, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("PlasmaBall75", 6, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("PlasmaBall75", 8, 0, -1, 0, 0, random(-2,2))
		PLSN A 0 A_FireCustomMissile("PlasmaFlareSpawn",-5,0,0,0)
		PLSN A 0 A_Takeinventory("DoublePlasmaAmmo",10)
        PLSN KLKJ 1
		PLSN A 0 A_SetPitch(pitch - 8.0)
        PLSN BCD 1
		PLSN EEEEEEEEEEEE 3 A_FireCustomMissile("SmokeSpawner",0,0,10,5)
		PLSN DCB 1
        PLSN A 0 A_PlaySound("BEPBEP")
		PLSN A 0 A_PlaySound("BEPBEP", 6)
		Goto Ready
		
		
	LetFlyDM:	
	PLSN A 0 A_FireCustomMissile("PlasmaBallDM", -8, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("PlasmaBallDM", -6, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("PlasmaBallDM", -4, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("PlasmaBallDM", -2, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("PlasmaBallDM", 0, 0, -1, 0, 0, 0)
	PLSN A 0 A_FireCustomMissile("PlasmaBallDM", 1, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("PlasmaBallDM", 2, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("PlasmaBallDM", 4, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("PlasmaBallDM", 6, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("PlasmaBallDM", 8, 0, -1, 0, 0, random(-2,2))
		PLSN A 0 A_FireCustomMissile("PlasmaFlareSpawn",-5,0,0,0)
		PLSN A 0 A_Takeinventory("DoublePlasmaAmmo",10)
        PLSN KLKJ 1
		PLSN A 0 A_SetPitch(pitch - 8.0)
        PLSN BCD 1
		PLSN EEEEEEEEEEEE 3 A_FireCustomMissile("SmokeSpawner",0,0,10,5)
		PLSN DCB 1
        PLSN A 0 A_JumpIfInventory("PlasmaAmmo",1,2)
        Goto Reload
        TNT1 AAAA 0
        PLSN A 0 A_PlaySound("BEPBEP")
		PLSN A 0 A_PlaySound("BEPBEP", 6)
		Goto Ready	

// Cancel Charge --------------------------------------------------------------------------------------------

	Cancel:

			PLSN A 0 A_TakeInventory("Reloading",1)
			PLSN A 0 A_StopSound(6)
			PLSN A 0 A_PlaySound("decharg", 5)

		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Giveinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT 
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Giveinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT 
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Giveinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT 
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Giveinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT 
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Giveinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT 
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Giveinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT A_PlaySound("plscool", 7)
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Giveinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Giveinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Giveinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT
		PLSA A 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA B 1 BRIGHT A_Giveinventory("PlasmaAmmo",1)
		PLSA C 1 BRIGHT A_FireCustomMissile("PlasmaFlareSpawn",0,0,0,0)
		PLSA D 1 BRIGHT

			PLSN A 0 A_TakeInventory("Reloading",1)
			PLSN A 0 A_Giveinventory("DoublePlasmaAmmo",10)
			PLSN A 0 A_PlaySound("BEPBEP", 5, 1.2)
			PLSN A 0 A_ClearReFire

		Goto Ready

//  ------------------------------------------------------------------------------

	
	Spawn:
	    PLSN A 0
		PLSN A 0 A_ChangeFLag("THRUACTORS", 1)
		PLAS A 20
		PLSN A 0 A_SpawnItem("DropedPlasmaGun")
		Stop
		
	NoAmmo:
		RIFG A 0
		RIFG A 0 A_ZoomFactor(1.0)
		RIFG A 0 A_Takeinventory("Zoomed",1)
		RIFG A 0 A_Takeinventory("ADSmode",1)
		RIFG A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
		TNT1 A 0 A_PlaySound("weapons/empty", 4)
		NoAmmo2:
		RIFG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
	    RIFG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		RIFG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		RIFG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		RIFG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		RIFG A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		RIFG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		PLSN A 5 A_WeaponReady(WRF_ALLOWRELOAD | WRF_NOFIRE)
		RIFG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		RIFG A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
		TNT1 A 0 A_JumpIfInventory("NoAutoReload", 1, "NoAmmo2")
		RIFG A 0 A_JumpIfInventory("AmmoCell",1,"Reload")
		RIFG A 0 A_JumpIfInventory("FiredPrimary",1,"NoAmmo2")
		Goto Ready3	

    Reload:

		PLSN A 0 A_Takeinventory("Reloading",1)
		PLSN A 0 A_ClearReFire
		PLSN A 0 A_JumpIfInventory("PlasmaAmmo",50,"Ready")
		PLSN A 0 A_JumpIfInventory("AmmoCell",1,7)

		PLSN A 0 A_PlaySound("BEP")
		PLSR A 4 A_WeaponReady(WRF_NOFIRE)
		PLSN A 0 A_PlaySound("BEP")
		PLSR A 4 A_WeaponReady(WRF_NOFIRE)
		PLSN A 0 A_CheckReload
        Goto Ready
        TNT1 AAAA 0
        PLSN A 0 A_PlaySound("PLREADY")
		PLSN A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
        PLSR AB 1
		PLSN A 0 A_FireCustomMissile("PlasmaCaseSpawn",-210,0,20,-20)
		PLSR CDEEEEEEEEEEEEEEEF 1
        PLSR GHHIIIJJJJJJJJIKLBAAAAA 1
		
		
		
		ReloadingSequence:
		TNT1 AAAAAAAAAA 0
		PLSN A 0 A_JumpIfInventory("PlasmaAmmo",50,15)
		PLSN A 0 A_JumpIfInventory("AmmoCell",1,3)
		Goto Ready
        TNT1 AAAAAA 0
		PLSN A 0 A_Giveinventory("PlasmaAmmo",1)
		PLSN A 0 A_Giveinventory("DoublePlasmaAmmo",1)
		PLSN A 0 A_Takeinventory("AmmoCell",1)
		Goto ReloadingSequence
		TNT1 AAAAAAAA 0
		
		PLSN A 0 A_Takeinventory("Reloading",1)
        Goto Ready
		
	TurboReload:
		PLSN BCDE 0
		Goto ReloadingSequence
		
		
		
	Unload:

		PLSN A 0 A_Takeinventory("Unloading",1)
		PLSN A 0 A_JumpIfInventory("AmmoCell",1,7)
		Goto Ready
		TNT1 AAAAA 0
		PLSN A 0 A_PlaySound("BEP")
		PLSR A 4 A_WeaponReady(WRF_NOFIRE)
		PLSN A 0 A_PlaySound("BEP")
		PLSR A 4 A_WeaponReady(WRF_NOFIRE)
        TNT1 AAAA 0
        PLSN A 0 A_PlaySound("PLREADY")
        PLSR AB 1
		PLSR CDJJJJJJ 1
		PLSR IHGFDECBA 2
		
	UnloadingSequence:
		PLSN A 0
		PLSN A 0 A_Takeinventory("Unloading",1)
		PLSN A 0 A_JumpIfInventory("PlasmaAmmo",1,3)
		Goto Ready
        TNT1 AAAAAAA 0
		PLSN A 0 A_Takeinventory("PlasmaAmmo",1)
		PLSN A 0 A_Takeinventory("DoublePlasmaAmmo",1)
		PLSN A 0 A_Giveinventory("AmmoCell",1)
		Goto UnloadingSequence
		
		
	DualWield:
		TNT1 A 1
		PLSN A 0 A_Takeinventory("StartDualWield",1)
		PLSN A 0 A_JumpIfInventory("DualPlasmaRifles", 1, "GetDual")
		PLSN A 0 A_Print("You must have two identical weapons to dual wield.")
		Goto Ready
		
	 GetDual:	
		PLSN A 0 A_SetCrosshair(0)
		PLSN A 0 A_Takeinventory("Zoomed",1)
		PLSN A 0 A_Takeinventory("ADSmode",1)
		PLSN A 0 A_TakeInventory("TossGrenade", 1)
		PLSN A 0 A_TakeInventory("Kicking",1)
        PLSN A 0 A_TakeInventory("Taunting",1)
        PLSN A 0 A_TakeInventory("Reloading",1)
		PLSN A 0 A_TakeInventory("Unloading",1)
		PLSN A 0 A_TakeInventory("Salute1", 1)
		PLSN A 0 A_TakeInventory("Salute2", 1)
        PLSN A 0 A_ZoomFactor(1.0)
		PLSN A 0 A_SelectWEapon("DualPlasmaRifles")
		Goto Ready	
	}
}



ACTOR Plasma_Ball: FastProjectile
{
	Radius 10
	Height 2
	Speed 60
	Damage (random(40, 40))
    DamageType Plasma
	Decal "SmallerScorch"
	Projectile
	+RANDOMIZE
	+SPECTRAL
	-NOBLOCKMAP
	+NOBLOOD
	+NORADIUSDMG
	+THRUSPECIES
	+MTHRUSPECIES
	+FORCEXYBILLBOARD
	Species "Marines"
	damagefactor "Blood", 0.0 damagefactor "BlueBlood", 0.0 damagefactor "GreenBlood", 0.0 damagefactor "Taunt", 0.0 damagefactor "KillMe", 0.0 damagefactor "Shrapnel", 0.0
	Health 5
	Scale 1.0
	renderstyle ADD
	alpha 0.99
	DeathSound "weapons/plasmax"
	//SeeSound "PLSM9"
    SeeSound "None"
	Obituary "$OB_MPPLASMARIFLE"
	States
	{

	Spawn:
		PLSS ABAB 1 Bright A_SpawnItem("BlueFlareSmall")
		Loop
	Death:
	    PLSN A 0
		PLSN A 0 A_CustomMissile ("BluePlasmaFire", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 AAAAA 0 A_CustomMissile ("BluePlasmaParticle", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 B 1 //A_Explode(5,50,0)
		PLSE ABC 2 BRIGHT A_SpawnItem("BlueFlare")
		PLSE DE 2 Bright A_SpawnItem("BlueFlareSmall")
		TNT2 AAA 9 A_CustomMissile ("PlasmaSmoke", 1, 0, random (0, 360), 2, random (0, 160))
		Stop
		
	
	XDeath:
	    PLSN A 0
		PLSN A 0 A_CustomMissile ("BluePlasmaFire", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 AAAAA 0 A_CustomMissile ("BluePlasmaParticle", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 B 1 A_Explode(5,50,0)
		PLSE ABC 2 BRIGHT A_SpawnItem("BlueFlare")
		PLSE DE 2 Bright A_SpawnItem("BlueFlareSmall")
		Stop
	}
}


ACTOR PlasmaBall75: Plasma_Ball
{
	Damage (random(50, 50))
	SeeSound "PLSM9"
}
ACTOR PlasmaBall99: Plasma_Ball
{
	Damage (random(60, 60))
	SeeSound "PLSM9"
}

ACTOR PlasmaBallDM: Plasma_Ball Replaces PlasmaBall
{
	Speed 50
	-THRUSPECIES
	-MTHRUSPECIES
	Species "None"
	Damage (random(40, 40))
}








ACTOR InvisiblePLasmaAmmo: CustomInventory
{
 scale 1.0
 radius 16
 height 4
 damage 0
   Mass 1
   Inventory.PickupMessage "Plasma Cells."
    States
    {

	 Spawn:
		CELL D -1
		Stop
	Pickup:
	    PLSN A 0
		PLSN A 0 A_GiveInventory("AmmoCell", 50)
		Stop
}}