
// *** MODIFIED BY CHEBMASTER
// I mark places modified by me with //***Che 

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	
		
		//***Che disabling player weapons for cutscenes and for the evacuation center
		HoldFire:
			PLSN E 0 offset(0,52) A_JumpIfInventory("Taunting",1,"Taunt")
			PLSN E 0 A_JumpIfInventory("Salute1", 1, "Salute")
			PLSN E 0 A_JumpIfInventory("Salute2", 1, "Salute")
			PLSN E 0 A_JumpIfInventory("Reloading",1,"Reload")
			PLSN E 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
			PLSN E 0 A_JumpIfInventory("Unloading",1,"Unload")
			PLSN E 0 A_JumpIfInventory("StartDualWield",1,"DualWield")
			PLSN E 1 offset(0,52) A_WeaponReady(WRF_NOBOB | WRF_NOFIRE | WRF_ALLOWRELOAD)
			PLSN E 0 A_JumpIfInventory("DisablePlayerWeapons", 1, "HoldFire")
			Goto Ready
		
	Ready3:
	Ready:
		//"----" A 0 A_JumpIfInventory("DisablePlayerWeapons", 1, "HoldFire") //***Che
        // Did you know that is you use the "----" (repeat previous) frame 
		//    as the first frame in the weapon's Ready state 
		//    that weapon is silently ignored by the game engine?
		// I mean, that was of course stupid of me -- there is no previous
		//    frame to repeat... But you get no error message, nothing. 
		//    Weapon just won't select as if it did not exist. 
		PLSN A 0 A_JumpIfInventory("DisablePlayerWeapons", 1, "HoldFire") //***Che
		
		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)
	
	//***Che
		"----" A 0 A_Takeinventory("UnmakerSelected",1)
		"----" A 0 A_Takeinventory("MG42Selected",1) //***Che
		"----" A 0 A_Takeinventory("AxeSelected",1) //***Che
			
			"----" A 0 A_Takeinventory("DragonslayerSelected",1) //***Che
			"----" A 0 A_Takeinventory("SniperRifleSelected",1)
			"----" A 0 A_Takeinventory("ShotolverSelected",1)
			"----" A 0 A_Takeinventory("Shotolver2Selected",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:
		"----" A 0 A_JumpIfInventory("DisablePlayerWeapons", 1, "HoldFire") //***Che
		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
		
		"----" A 0 A_JumpIf(waterlevel > 2, "ShortUnderwater")
		
			"----" A 0 A_JumpIfInventory("QPowerQuadDamage", 1, 2)
			"----" A 0 A_JumpIf(true, 2)
			"----" A 0 A_PlaySound("quaddamage/echo", CHAN_7)
			"----" A 0 A_GiveInventory ("PlayerIsFighting", 150) //***Che encourages the follower NPCs to get da fug out of your line of fire
		
		
        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("FBD_PlayersPlasmaBall", 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


	ShortUnderwater:
		PLSN E 1 A_PlaySound("KYBFGSPR", 6)
		PLSN E 0 A_RadiusGive("ElectricShock", 150, RGF_MONSTERS | RGF_PLAYERS | RGF_GIVESELF) 
		PLSN A 0 A_Takeinventory("PlasmaAmmo",1)
		PLSN E 0 A_JumpIfInventory("PlasmaAmmo",1,1)
		Goto ShortUnderwaterAftermath
		PLSN E 0 A_RadiusGive("ElectricShock", 150, RGF_MONSTERS | RGF_PLAYERS | RGF_GIVESELF) 
		PLSN A 0 A_Takeinventory("PlasmaAmmo",1)
		PLSN E 0 A_JumpIfInventory("PlasmaAmmo",1,1)
		Goto ShortUnderwaterAftermath
		PLSN E 0 A_RadiusGive("ElectricShock", 150, RGF_MONSTERS | RGF_PLAYERS | RGF_GIVESELF) 
		PLSN A 0 A_Takeinventory("PlasmaAmmo",1)
		PLSN E 0 A_JumpIfInventory("PlasmaAmmo",1,1)
		Goto ShortUnderwaterAftermath
		PLSN E 0 A_RadiusGive("ElectricShock", 150, RGF_MONSTERS | RGF_PLAYERS | RGF_GIVESELF) 
		PLSN A 0 A_Takeinventory("PlasmaAmmo",1)
		PLSN E 0 A_JumpIfInventory("PlasmaAmmo",1,1)
		Goto ShortUnderwaterAftermath
		PLSN E 0 A_RadiusGive("ElectricShock", 150, RGF_MONSTERS | RGF_PLAYERS | RGF_GIVESELF) 
		PLSN A 0 A_Takeinventory("PlasmaAmmo",1)
		PLSN E 0 A_JumpIfInventory("PlasmaAmmo",1,1)
		Goto ShortUnderwaterAftermath
		PLSN E 0 A_RadiusGive("ElectricShock", 150, RGF_MONSTERS | RGF_PLAYERS | RGF_GIVESELF) 
		PLSN A 0 A_Takeinventory("PlasmaAmmo",1)
		PLSN E 0 A_JumpIfInventory("PlasmaAmmo",1,1)
		Goto ShortUnderwaterAftermath
		PLSN E 0 A_RadiusGive("ElectricShock", 150, RGF_MONSTERS | RGF_PLAYERS | RGF_GIVESELF) 
		PLSN A 0 A_Takeinventory("PlasmaAmmo",1)
		PLSN E 0 A_JumpIfInventory("PlasmaAmmo",1,1)
		Goto ShortUnderwaterAftermath
		PLSN E 0 A_RadiusGive("ElectricShock", 150, RGF_MONSTERS | RGF_PLAYERS | RGF_GIVESELF) 
		PLSN A 0 A_Takeinventory("PlasmaAmmo",1)
		PLSN E 0 A_JumpIfInventory("PlasmaAmmo",1,1)
		Goto ShortUnderwaterAftermath
		PLSN E 0 A_RadiusGive("ElectricShock", 150, RGF_MONSTERS | RGF_PLAYERS | RGF_GIVESELF) 
		PLSN A 0 A_Takeinventory("PlasmaAmmo",1)
		PLSN E 0 A_JumpIfInventory("PlasmaAmmo",1,1)
		Goto ShortUnderwaterAftermath
		PLSN E 0 A_RadiusGive("ElectricShock", 150, RGF_MONSTERS | RGF_PLAYERS | RGF_GIVESELF) 
		PLSN A 0 A_Takeinventory("PlasmaAmmo",1)
		PLSN E 0 A_JumpIfInventory("PlasmaAmmo",1,1)
		Goto ShortUnderwaterAftermath
		
	ShortUnderwaterAftermath:	
		PLSN E 70
		Goto Ready
		
// Charging up secondary ------------------------------------------------------------

	AltFire:
        "----" A 0 A_JumpIfInventory("DisablePlayerWeapons", 1, "HoldFire") //***Che
		PLSN A 0 A_JumpIfInventory("Reloading",1,"Reload")
        PLSN A 0 A_JumpIfInventory("PlasmaAmmo",11,2)
        Goto NoAmmo
        TNT1 AAA 0
		
		"----" A 0 A_GiveInventory ("PlayerIsFighting", 150) //***Che encourages the follower NPCs to get da fug out of your line of fire
	PLSN A 0 A_PlaySound("PLSCHARG")
		"----" A 0 A_JumpIf(waterlevel > 2, "ShortUnderwater")
		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 
		"----" A 0 A_JumpIf(waterlevel > 2, "ShortUnderwater")
		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 
		"----" A 0 A_JumpIf(waterlevel > 2, "ShortUnderwater")
		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 
		"----" A 0 A_JumpIf(waterlevel > 2, "ShortUnderwater")
		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 
		"----" A 0 A_JumpIf(waterlevel > 2, "ShortUnderwater")
		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 
		"----" A 0 A_JumpIf(waterlevel > 2, "ShortUnderwater")
		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
		"----" A 0 A_JumpIf(waterlevel > 2, "ShortUnderwater")
		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
		"----" A 0 A_JumpIf(waterlevel > 2, "ShortUnderwater")
		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
		"----" A 0 A_JumpIf(waterlevel > 2, "ShortUnderwater")
		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
		"----" A 0 A_JumpIf(waterlevel > 2, "ShortUnderwater")
	PLSN A 0 A_PlaySound("PLSFULL", 6, 0.8, 1)
	PLSN A 0 A_ReFire

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

AltHold:
	
	PLSN A 0 A_JumpIf(waterlevel > 2, "ShortUnderwater")
	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)
	
	"----" A 0 A_JumpIf(waterlevel > 2, "ShortUnderwater")
	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)
	
	"----" A 0 A_JumpIf(waterlevel > 2, "ShortUnderwater")
	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)
	
	"----" A 0 A_JumpIf(waterlevel > 2, "ShortUnderwater")
	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)
	
	"----" A 0 A_GiveInventory ("PlayerIsFighting", 20) //***Che encourages the follower NPCs to get da fug out of your line of fire
    
	PLSN A 0 A_ReFire

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

			"----" A 0 A_JumpIfInventory("QPowerQuadDamage", 1, 2)
			"----" A 0 A_JumpIf(true, 2)
			"----" A 0 A_PlaySound("quaddamage/echo", CHAN_7)
			"----" A 0 A_GiveInventory ("PlayerIsFighting", 150) //***Che encourages the follower NPCs to get da fug out of your line of fire

	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("FBD_PlayersPlasmaBall50", -8, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("FBD_PlayersPlasmaBall50", -6, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("FBD_PlayersPlasmaBall50", -4, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("FBD_PlayersPlasmaBall50", -2, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("FBD_PlayersPlasmaBall50", 0, 0, -1, 0, 0, 0)
	PLSN A 0 A_FireCustomMissile("FBD_PlayersPlasmaBall50", 1, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("FBD_PlayersPlasmaBall50", 2, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("FBD_PlayersPlasmaBall50", 4, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("FBD_PlayersPlasmaBall50", 6, 0, -1, 0, 0, random(-2,2))
	PLSN A 0 A_FireCustomMissile("FBD_PlayersPlasmaBall50", 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	
	}
}



//***Che: evicted to FBD_Plasma_ball.txt
