ACTOR DualPlasmaRifles : BrutalWeapon
{
	Weapon.SelectionOrder 100
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
    Inventory.PickupSound "PLSDRAW"
	Weapon.AmmoType1 "AmmoCell"
	Weapon.AmmoType2 "DoublePlasmaAmmo"
    +WEAPON.NOAUTOAIM
	+FORCEXYBILLBOARD
	+WEAPON.NO_AUTO_SWITCH
	Tag "Dual Plasma Rifles"
	Inventory.PickupMessage "You got dual plasma rifles! (Slot 2)"
	DropItem "PLasmagunSpawner"
	scale 0.9
	States
	{
	Ready:
	Ready3:
        DUPL A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        DUPL A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		DUPL A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		DUPL A 0 A_JumpIfInventory("Salute2", 1, "Salute")
        DUPL A 0 A_JumpIfInventory("Reloading",1,"Reload")
		DUPL A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		DUPL A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		DUPL A 0 A_JumpIfInventory("Unloading",1,"Unload")
		DUPL A 0 A_JumpIfInventory("StartDualWield",1,"DualWield")
		DUPL A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
		Loop

	DualWield:
		DUPL A 1
		DUPL A 0 A_GiveInventory("Plasma_Gun",1)
		DUPL A 0 A_Takeinventory("StartDualWield",1)
		DUPL A 0 A_SelectWEapon("Plasma_Gun")
		Goto Ready

	StartSprint:
		DUPL A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		SHTN A 0 A_Takeinventory("Zoomed",1)
        SHTN A 0 A_ZoomFactor(1.0)
		SHTN A 0 A_Takeinventory("ADSmode",1)
		RIFG A 0 A_SetCrosshair(0)
		SHTN A 0 A_Giveinventory("GoSpecial",1)
		TNT1 A 0 ACS_NamedExecuteAlways("BDSprint", 0, 0, 0, 0)//Makes player faster.

	Sprinting:
		DUPL A 1 offset(-9,34) A_SetPitch(pitch -0.5)
		DUPL A 1 offset(-6,36) A_SetPitch(pitch -0.5)
		DUPL A 1 offset(-3,38) A_SetPitch(pitch -0.5)
		DUPL A 1 offset(0,38) A_SetPitch(pitch -0.5)
		DUPL A 1 offset(3,36) A_SetPitch(pitch -0.5)
		DUPL A 1 offset(6,34) A_SetPitch(pitch -0.5)
		DUPL A 1 offset(9,32) A_SetPitch(pitch -0.5)
		TNT1 A 0 A_GiveInventory("UsedStamina", 3)
		SMGG A 0 A_WeaponReady(WRF_NOBOB)
		SMGG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        SMGG A 0 A_JumpIfInventory("Reloading",1,"Reload")

		DUPL A 1 offset(9,34) A_SetPitch(pitch +0.5)
		DUPL A 1 offset(6,36) A_SetPitch(pitch +0.5)
		DUPL A 1 offset(3,38) A_SetPitch(pitch +0.5)
		DUPL A 1 offset(0,38) A_SetPitch(pitch +0.5)
		DUPL A 1 offset(-3,36) A_SetPitch(pitch +0.5)
		DUPL A 1 offset(-6,34) A_SetPitch(pitch +0.5)
		DUPL A 1 offset(-9,32) A_SetPitch(pitch +0.5)
		TNT1 A 0 A_GiveInventory("UsedStamina", 3)
		SMGG A 0 A_WeaponReady(WRF_NOBOB)
		SMGG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        SMGG A 0 A_JumpIfInventory("Reloading",1,"Reload")

		PLAY A 0 ACS_NamedExecuteAlways("BDSprint", 0, 0, 0, 0)//Makes player faster.
		SMGG A 0 A_JumpIfInventory("IsRunning", 1, "Sprinting")
		Goto StopSprint

	StopSprint:
		DUPL A 0 A_JumpIfInventory("PowerStrength", 1, 2)
		DUPL A 0 A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
		DUPL A 1 ACS_NamedExecuteAlways("BDTacticalSpeed", 0, 0, 0, 0)//Makes player slower.
		Goto Ready

	StopSprintTired:
		DUPL A 1 ACS_NamedExecuteAlways("BDTacticalSpeed", 0, 0, 0, 0)//Makes player slower.
		DUPL A 0 A_PlaySound("Tired", 2)
		Goto Ready

	Deselect:
		DUPL A 0 A_Takeinventory("Reloading",1)
		DUPL A 0 A_Takeinventory("HasPlasmaWeapon",1)
		DUPL A 0 A_TakeInventory("TossGrenade", 1)
        DUPL A 1 Offset(0, 34)
		DUPL A 1 Offset(0, 38)
		DUPL A 1 Offset(0, 42)
		DUPL A 1 Offset(0, 50)
		DUPL A 0 Offset(0, 32)
		TNT1 AAAAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait

	Select:
		TNT1 A 0 A_Giveinventory("GoSpecial",1)
	    DUPL A 0 A_Giveinventory("HasPlasmaWeapon",1)
		TNT1 A 0 A_TakeInventory("FistsSelected", 1)
		TNT1 A 0 A_TakeInventory("ShotgunSelected", 1)
		TNT1 A 0 A_TakeInventory("MinigunSelected", 1)
		TNT1 A 0 A_TakeInventory("SSGSelected", 1)
		TNT1 A 0 A_TakeInventory("RocketLauncherSelected", 1)
		TNT1 A 0 A_TakeInventory("GrenadeLauncherSelected", 1)
		TNT1 A 0 A_GiveInventory("PlasmaGunSelected", 1)
		TNT1 A 0 A_GiveInventory("HasDualPlasma",1)
		TNT1 A 0 A_TakeInventory("RailGunSelected", 1)
		TNT1 A 0 A_TakeInventory("RevenantLauncherSelected", 1)
		TNT1 A 0 A_TakeInventory("SubMachineGunSelected", 1)
		TNT1 A 0 A_TakeInventory("BFG10KSelected", 1)
		TNT1 A 0 A_TakeInventory("BFGSelected", 1)
		TNT1 A 0 A_TakeInventory("FlameCannonSelected", 1)
		TNT1 A 0 A_TakeInventory("SawSelected", 1)
		DUPL A 0 A_Takeinventory("HasBarrel",1)
		DUPL A 0 A_TakeInventory("TossGrenade", 1)
		DUPL A 0 A_TakeInventory("Plasma_Gun", 1)
		DUPL A 0 A_GunFlash
		TNT1 A 1 A_Raise
		TNT1 AAAAAAAAAAAA 0 A_Raise
		DUPL A 0 A_PlaySound("PLSDRAW")
		SelectAnimation:
        DUPL A 1 Offset(0, 50)
		DUPL A 1 Offset(0, 42)
		DUPL A 1 Offset(0, 38)
		DUPL A 1 Offset(0, 34)
		DUPL A 0 Offset(0, 32)
		DUPL A 0 A_Takeinventory("StartDualWield",1)
		Goto Ready

	Fire:
		DUPL A 0
        DUPL A 0 A_JumpIfInventory("PlasmaAmmo",1,1)
		Goto FireLeft
        DUPL A 0 A_PlaySound("PLSM9", CHAN_WEAPON)
		DUPL A 0 A_FireCustomMissile("PlasmaFlareSpawn", 0, 0, 8, 0)
		TNT1 A 0 A_FireCustomMissile("Alerter",0,0)
		DUPL B 1 BRIGHT A_FireCustomMissile("Plasma_Ball", frandom(-1.6, 1.6), 1, 8, 0, 0, frandom(-1.2, 1.2))
		DUPL A 0 A_ZoomFactor(0.99)
		DUPL A 0 A_Takeinventory("PlasmaAmmo",1)
		DUPL A 0 A_Takeinventory("DoublePlasmaAmmo",1)
		TNT1 A 0 A_SetPitch(-0.2 + pitch)
		DUPL C 1
		DUPL A 0 A_ZoomFactor(1.0)

		DUPL A 0 A_JumpIfInventory("DoublePlasmaAmmo",1,1)
        Goto NoAmmo
        DUPL A 0 A_PlaySound("PLSM9", CHAN_WEAPON)
		DUPL A 0 A_FireCustomMissile("PlasmaFlareSpawn", 0, 0, -8, 0)
		TNT1 A 0 A_SetPitch(-0.2 + pitch)
		DUPL D 1 BRIGHT A_FireCustomMissile("Plasma_Ball", frandom(-1.6, 1.6), 1, -8, 0, 0, frandom(-1.2, 1.2))
		DUPL A 0 A_ZoomFactor(0.99)
		DUPL A 0 A_Takeinventory("DoublePlasmaAmmo",1)
		DUPL E 1
		DUPL A 0 A_ZoomFactor(1.0)
		DUPL A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		Goto Ready

	FireLeft:
		DUPL A 0
        DUPL A 0 A_JumpIfInventory("DoublePlasmaAmmo",1,1)
        Goto NoAmmo
        DUPL A 0 A_PlaySound("PLSM9", CHAN_WEAPON)
		DUPL A 0 A_FireCustomMissile("PlasmaFlareSpawn", 0, 0, -8, 0)
		TNT1 A 0 A_SetPitch(-0.2 + pitch)
		DUPL D 1 BRIGHT A_FireCustomMissile("Plasma_Ball", frandom(-1.6, 1.6), 1, -8, 0, 0, frandom(-1.2, 1.2))
		DUPL A 0 A_ZoomFactor(0.99)
		DUPL A 0 A_Takeinventory("DoublePlasmaAmmo",1)
		DUPL E 1
		DUPL A 0 A_ZoomFactor(1.0)
		DUPL A 2
		DUPL A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		Goto Ready

	Spawn:
		PLAS A -1
		Stop

    Reload:
		DUPL A 4
		DUPL A 0 A_Takeinventory("Reloading",1)
		DUPL A 0 A_JumpIfInventory("AmmoCell",1,3)
		Goto Ready
		DUPL AAA 0
		DUPL A 0 A_JumpIfInventory("DoublePlasmaAmmo",100,"Ready")
		DUPL A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
		PLSN A 0 A_JumpIfInventory("PlasmaUnloaded",1,"PutMag")

		PLSR BCD 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		PLSN A 0 A_PlaySound("PLSDRAW")
		PLSR JIHGFE 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		PLSN A 0 A_FireCustomMissile("EmptyCellSpawn",0,0,0,-20)
		PLSR E 8
	PutMag:
		PLSR E 8
        PLSR FGHI 1
		PLSR J 4 A_PlaySound("PLREADY")
		PLSR KL 1
		PLSN A 0 A_JumpIfInventory("PlasmaUnloaded",1,"PutMag2")

		P2SR BCD 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		PLSN A 0 A_PlaySound("PLSDRAW")
		P2SR JIHGFE 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		PLSN A 0 A_FireCustomMissile("EmptyCellSpawn",225,0,-10,-20)
		P2SR E 8
	PutMag2:
		P2SR E 8
        P2SR FGHI 1
		P2SR J 4 A_PlaySound("PLREADY")
		P2SR KL 1
		PLSR A 0 A_TakeInventory("PlasmaUnloaded",1)

		ReloadingSequence:
		TNT1 AAAAAAAAAA 0
		DUPL A 0 A_JumpIfInventory("DoublePlasmaAmmo",100,15)
		DUPL A 0 A_JumpIfInventory("AmmoCell",1,3)
		Goto Ready
        TNT1 AAAAAA 0
		DUPL A 0 A_Giveinventory("PlasmaAmmo",1)
		DUPL A 0 A_Giveinventory("DoublePlasmaAmmo",1)
		DUPL A 0 A_Takeinventory("AmmoCell",1)
		Goto ReloadingSequence
		TNT1 AAAAAAAA 0
		TNT1 A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		DUPL A 1 A_Takeinventory("Reloading",1)
        Goto Ready

	TurboReload:
		DUPL A 0 A_Takeinventory("Unloading",1)
		DUPL A 0 A_JumpIfInventory("AmmoCell",1,3)
		Goto Ready
		DUPL AAA 0
		Goto ReloadingSequence

	Unload:
		DUPL A 0 A_Takeinventory("Unloading",1)
		DUPL A 0 A_JumpIfInventory("PlasmaAmmo",1,3)
		Goto UnloadLeft
		TNT1 AAAAA 0
        PLSR BCD 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		PLSN A 0 A_PlaySound("PLSDRAW")
		PLSR JIHGFE 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		PLSR E 8

		P2SR BCD 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		PLSN A 0 A_PlaySound("PLSDRAW")
		P2SR JIHGFE 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		P2SR E 8
		PLSN A 0 A_GiveInventory("PlasmaUnloaded",1)
		Goto RemoveBullets

	UnloadLeft:
		TNT1 A 0
		DUPL A 0 A_JumpIfInventory("DoublePlasmaAmmo",1,3)
		Goto Ready
		TNT1 AAAAA 0
		P2SR BCD 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		PLSN A 0 A_PlaySound("PLSDRAW")
		P2SR JIHGFE 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		P2SR E 8
		PLSN A 0 A_GiveInventory("PlasmaUnloaded",1)
		Goto RemoveBullets

	RemoveBullets:
		DUPL A 0
		DUPL A 0 A_Takeinventory("Unloading",1)
		DUPL A 0 A_JumpIfInventory("DoublePlasmaAmmo",1,3)
		Goto Ready
        TNT1 AAAAAAA 0
		DUPL A 0 A_Takeinventory("PlasmaAmmo",1)
		DUPL A 0 A_Takeinventory("DoublePlasmaAmmo",1)
		DUPL A 0 A_Giveinventory("AmmoCell",1)
		Goto RemoveBullets

	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")
		DUPL A 5 A_PlaySound("BEP", 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("ExecuteDownedEnemy", 1, "DoExecution")
		RIFG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		DUPL 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, 2)
		RIFG A 0 A_JumpIfInventory("AmmoCell",1,"Reload")
		RIFG A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
		Goto Ready3
	}
}

ACTOR DoublePlasmaAmmo : Ammo //Your weapon's magazine ammo.
{
   Inventory.Amount 0
   Inventory.MaxAmount 100 //Your weapon's magazine ammo limit. Always leave one more bullet, so you can do the 12+1 effect.
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 100
   Inventory.Icon "PLASB0"
}