//ASSAULT RIFLES (c) 2014 SGT MARK IV tm

ACTOR DualPlasmaRifles: DoomWeapon
{
	Weapon.AmmoUse1 0 
	Weapon.SelectionOrder 100
	Weapon.AmmoGive1 0 //How much ammo can be gathered with this weapon
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	Weapon.AmmoType1 "Cell" //Reserve ammo type
	Weapon.AmmoType2 "DoublePlasmagunAmmo" //Magazine ammo type
	Obituary "%o was drilled by %k's Double Plasmaguns." //Kill message
    AttackSound "None" //You better leave this clear
	Inventory.Pickupmessage "" //Pickup message
    +WEAPON.NOAUTOAIM //Makes this weapon never autoaim, so recoil can work better
    Scale 0.6 //Weapon's pickup sprite size
	+INVENTORY.UNDROPPABLE
	+WEAPON.NOAUTOFIRE
	+WEAPON.NO_AUTO_SWITCH
	States
	{
	
	Spawn:
	    TNT1 A 0
		TNT1 A 0 A_ChangeFLag("THRUACTORS", 1)
		PLAS A 20
		TNT1 A 0 A_SpawnItem("DropedPlasmaGun")
		Stop
	
	Ready:
	    TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("IsPlayingAsPurist", 1, "PuristGun")
		TNT1 A 0 A_JumpIfInventory("Plasma_Gun", 1, 1)
		Goto RemoveDual
		TNT1 A 0 A_PlaySound("PLSDRAW", 1)
		TNT1 A 0 A_TakeInventory("StopDualWield", 1)
		PLRS AB 1
		TNT1 A 0 A_PlaySound("PLSDRAW", 3)
		PLRS CDEF 1
		TNT1 A 0 A_GunFlash
		Goto ReadyToFire
		
		
	Fire:
	TNT1 A 0
	TNT1 A 0 A_JumpIfInventory("FiredPrimary",1,"FireLeftGun") //Check if player wants to reload
	DPR2 A 1
	TNT1 A 0 A_JumpIfInventory("FiredPrimary",1,"FireLeftGun") //Check if player wants to reload
	TNT1 A 0 A_Refire
	Goto ReadyToFire
	
	ReadyToFire:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("FiredPrimary",1,"FireLeftGun") //Check if player wants to reload
		DPR2 A 1 A_WeaponReady// Weapon is ready to fire
		//TNT1 A 0 A_JumpIfInventory("IsFiringSecondary", 1, 1)
		//TNT1 A 0 A_GunFlash
		TNT1 A 0 A_JumpIfInventory("FiredPrimary",1,"FireLeftGun") //Check if player wants to reload
		TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload2") //Check if player wants to reload
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		Loop
		
	Deselect:
		TNT1 AAAAAA 0 A_Lower
		TNT1 A 0 A_TakeInventory("TossGrenade", 1)
		TNT1 A 1 A_Lower //Makes player switch weapons faster
		Wait
	Select:
		TNT1 A 0 A_Raise //Makes the weapon always be selected fast
		Wait
	
	RemoveDual:
	     TNT1 A 0 A_GiveInventory("Plasma_gun", 1)
		 TNT1 A 0 A_TakeInventory("DualPlasmaRifles", 1)
		 Goto Ready
	
	DryFire:
	    DPR2 A 1 A_PlaySound("DRYFIRE", 1)
		DPR2 A 10
		Goto ReadyToFire
	 
	FireLeftGun:
	    P2W2 A 0
		TNT1 A 0 A_JumpIfInventory("DoublePlasmagunAmmo", 1, 1)//First of all, checks if there is ammo inside the gun
		Goto Reload//Couldn't find any ammo. Reload
		
		TNT1 A 0 A_JumpIfInventory("LeftPlasmagunAmmo", 1, 1)//Checks if there is ammo inside the left Plasmagun
		Goto DryFire//Couldn't find any ammo. Don't fire.
		
		TNT1 A 0 A_TakeInventory("DoublePlasmagunAmmo", 1)//Removes 1 ammo from magazine
		TNT1 A 0 A_AlertMonsters
	    DPR2 B 1 BRIGHT A_FireCustomMissile("PlasmaBall", random(-10,4), 0, -6, -4, 0, random(-2,2))//Horizontal Spread, Vertical Spread, Numbers of Projectiles (Leave as -1 if its a single one), Damage Factor
		TNT1 A 0 A_FireCustomMissile("Shakeyourassminor", 0, 0, 0, 0)//Shakes the camera to simulate recoil.
		TNT1 A 0 A_PlaySound("PLSM9", 1)//Play gun fire sound
		TNT1 A 0 A_SetPitch(+0.6 + pitch)//Vertical recoil up
		DPR2 C 1 BRIGHT
		DPR2 C 0 A_SetPitch(-0.6 + pitch)//Vertical recoil down
		DPR2 D 1 A_TakeInventory("LeftPlasmagunAmmo", 1)//Remove the fake ammo
		DPR2 A 1
		TNT1 A 0 A_JumpIfInventory("DoublePlasmagunAmmo", 1, 1)//Checks if there is ammo inside the gun
		Goto Reload//Couldn't find any ammo. Reload.
		P2W2 A 0
		TNT1 A 0 A_JumpIfInventory("FiredPrimary",1,"FireLeftGun") //Check if player still is firing left gun
		Goto Fire//No need to reload. Get back to Ready state.
		
	Flash:	
	    TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("StopDualWield", 1, "LightDone")
		DPR1 A 1
		TNT1 A 0 A_JumpIfInventory("FiredSecondary", 1, "FireRightGun")
		//P2W1 A 1
		Loop
	
	DontFlash:
	    TNT1 A 1
		Goto Flash
	
	FireRightGun:
	    P2W1 A 0
		
		TNT1 A 0 A_JumpIfInventory("StopDualWield", 1, "LightDone")
		TNT1 A 0 A_GiveInventory("IsFiringSecondary", 1)
		TNT1 A 0 A_JumpIfInventory("DoublePlasmagunAmmo", 1, 2)//First of all, checks if there is ammo inside the gun
		TNT1 A 0 //A_GiveInventory("Reloading", 1)//Couldn't find any ammo. Reload
		Goto Flash//Couldn't find any ammo. Reload
		
		TNT1 A 0 A_JumpIfInventory("RightPlasmagunAmmo", 1, 1)//Checks if there is ammo inside the left Plasmagun
		Goto DryFire2//Couldn't find any ammo. Don't fire.
		
		TNT1 A 0 A_TakeInventory("DoublePlasmagunAmmo", 1)//Removes 1 ammo from magazine
		
		TNT1 A 0 A_AlertMonsters
	    DPR1 B 1 BRIGHT A_FireCustomMissile("PlasmaBall", random(-4,10), 0, 6, -4, 0, random(-2,2))//Horizontal Spread, Vertical Spread, Numbers of Projectiles (Leave as -1 if its a single one), Damage Factor
		TNT1 A 0 A_PlaySound("PLSM9", 3)//Play gun fire sound
		TNT1 A 0 A_FireCustomMissile("Shakeyourassminor", 0, 0, 0, 0)//Shakes the camera to simulate recoil.
		TNT1 A 0 A_SetPitch(+0.6 + pitch)//Vertical recoil up
		DPR1 C 1 BRIGHT
		P2W1 C 0 A_SetPitch(-0.6 + pitch)//Vertical recoil down
		DPR1 D 1 A_TakeInventory("RightPlasmagunAmmo", 1)//Remove the fake ammo
		DPR1 A 1
		TNT1 A 0 A_JumpIfInventory("DoublePlasmagunAmmo", 1, 1)//Checks if there is ammo inside the gun
		TNT1 A 0 //A_GiveInventory("Reloading", 1)//Couldn't find any ammo. Reload
		TNT1 A 0 A_JumpIfInventory("FiredSecondary", 1, "FireRightGun")
		Goto Flash
		
	DryFIre2:
	    PLRS G 1 A_PlaySound("DRYFIRE", 1)
		PLRS GGGGG 1 A_JumpIfInventory("StopDualWield", 1, "LightDone")
		Goto Flash
		
		
		
		
		
		
		
		
		
	Reload:
	Reload2:
	    
	    PLRS G 1 //Always leave one free line before the reload animation to prevent bugs
		TNT1 A 0 A_TakeInventory("Reloading")//Always put this to make sure that the game understand that you already are reloading your weapon, and calling this state again is not necessary
		TNT1 A 0 A_JumpIfInventory("DoublePlasmagunAmmo", 100, "ReadytoFire")//Checks if the weapon is not fully reloaded, if yes, cancel reload.
		TNT1 A 0 A_PlaySound("DRYFIRE", 1)
		TNT1 A 0 A_JumpIfInventory("Cell", 1, 1)//Checks if you have spare ammo
		Goto DryFire//Identified that you have no spare ammo. Get back to Ready animation
		TNT1 A 0 A_GiveInventory("StopDualWield", 1)
        
	Refill:	
	    TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("Cell", 1, 1)//Check if you have spare ammo again. This line is necessary in case you don't have enough ammo to fill an entire clip.
		Goto FinishReload//Gun is fully loaded. Go to finish animation
	    TNT1 A 0 A_TakeInventorY("Cell", 1)//Removes one spare bullet
		TNT1 A 0 A_GiveInventory("DoublePlasmagunAmmo", 1)//Puts one bullet inside the clip
		TNT1 A 0 A_JumpIfInventory("DoublePlasmagunAmmo", 100, "FinishReload")//Checks if weapons is full
		Loop
		
	 FinishReload:	//Weapon is fully loaded. Time to play the reloading animation.
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("LeftPlasmagunAmmo", 50, "FinishReloadRightOnly")
		TNT1 A 0 A_JumpIfInventory("RightPlasmagunAmmo", 50, "FinishReloadLeftOnly")
		TNT1 A 0 A_GiveInventory("LeftPlasmagunAmmo", 50)
		TNT1 A 0 A_GiveInventory("RightPlasmagunAmmo", 50)
		PLRS FEDCBA 1
		TNT1 A 5
		PLSR B 1
		TNT1 A 0 A_PlaySound("PLREADY", 1)
		TNT1 A 0 A_FireCustomMissile("PlasmaCaseSpawn",-210,0,20,-20)
		PLSR CDEEEEEEEEEEEEEEEF 1
        PLSR GHHIIIJJJJJJJJIKLB 1
		TNT1 A 10
		P2SR B 1
		TNT1 A 0 A_PlaySound("PLREADY", 3)
		TNT1 A 0 A_FireCustomMissile("PlasmaCaseSpawn",-210,0,20,-20)
		P2SR CDEEEEEEEEEEEEEEEF 1
        P2SR GHHIIIJJJJJJJJIKLB 1
		TNT1 A 0 A_TakeInventory("StopDualWield", 1)
		TNT1 A 0 A_TakeInventory("FiredPrimary", 1)
		TNT1 A 0 A_TakeInventory("FiredSecondary", 1)
		TNT1 A 5
		PLRS ABCDEF 1
		TNT1 A 0 A_TakeInventory("Reloading")//Always put this to make sure that the game understand that you already are reloading your weapon, and calling this state again is not necessary
		TNT1 A 0 A_GunFlash
		Goto ReadyToFire
		
		
	
	FinishReloadLeftOnly:	//Weapon is fully loaded. Time to play the reloading animation.
		TNT1 A 0 A_GiveInventory("LeftPlasmagunAmmo", 50)
		TNT1 A 0 A_GiveInventory("RightPlasmagunAmmo", 50)
		PLRS FEDCBA 1
		TNT1 A 5
		
		P2SR B 1
		TNT1 A 0 A_PlaySound("PLREADY", 3)
		TNT1 A 0 A_FireCustomMissile("PlasmaCaseSpawn",-210,0,20,-20)
		P2SR CDEEEEEEEEEEEEEEEF 1
        P2SR GHHIIIJJJJJJJJIKLB 1
		TNT1 A 0 A_TakeInventory("StopDualWield", 1)
		TNT1 A 0 A_TakeInventory("FiredPrimary", 1)
		TNT1 A 0 A_TakeInventory("FiredSecondary", 1)
		TNT1 A 5
		
		PLRS ABCDEF 1
		TNT1 A 0 A_TakeInventory("Reloading")//Always put this to make sure that the game understand that you already are reloading your weapon, and calling this state again is not necessary
		TNT1 A 0 A_GunFlash
		Goto ReadyToFire	
		
	FinishReloadRightOnly:	//Weapon is fully loaded. Time to play the reloading animation.
		TNT1 A 0 A_GiveInventory("LeftPlasmagunAmmo", 50)
		TNT1 A 0 A_GiveInventory("RightPlasmagunAmmo", 50)
		PLRS FEDCBA 1
		
		TNT1 A 5
		PLSR B 1
		TNT1 A 0 A_PlaySound("PLREADY", 3)
		TNT1 A 0 A_FireCustomMissile("PlasmaCaseSpawn",-210,0,20,-20)
		PLSR CDEEEEEEEEEEEEEEEF 1
        PLSR GHHIIIJJJJJJJJIKLB 1
		TNT1 A 0 A_TakeInventory("StopDualWield", 1)
		TNT1 A 0 A_TakeInventory("FiredPrimary", 1)
		TNT1 A 0 A_TakeInventory("FiredSecondary", 1)
		TNT1 A 5
		
		PLRS ABCDEF 1
		TNT1 A 0 A_TakeInventory("Reloading")//Always put this to make sure that the game understand that you already are reloading your weapon, and calling this state again is not necessary
		TNT1 A 0 A_GunFlash
		Goto ReadyToFire		
		
		
		
	 DoKick:
		NULL A 0 A_JumpIf (momZ > 0, "AirKick")
		NULL A 0 A_JumpIf (momZ < 0, "AirKick")
		
        TNT1 A 0 A_jumpifinventory("PowerStrength",1,"BerserkerKick")
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 SetPlayerProperty(0,1,0)
		KIN2 ABC 1
		RIFF A 0 A_FireCustomMissile("KickAttack", 0, 0, 0, -7)
        KIN2 D 6
		KIN2 EECBA 1
		KICK A 0 A_Takeinventory("Kicking",1)
		TNT1 A 0 SetPlayerProperty(0,0,0)
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		Goto ReadyToFire
    BerserkerKick:
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 SetPlayerProperty(0,1,0)
		KIN2 ABC 1
		RIFF A 0 A_FireCustomMissile("SuperKickAttack", 0, 0, 0, -7)
        KIN2 D 6
		KIN2 EECBA 1
		TNT1 A 0 SetPlayerProperty(0,0,0)
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		Goto ReadyToFire
	
	AirKick:
	    TNT1 A 0 A_jumpifinventory("PowerStrength",1,"SuperAirKick")
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 A_Recoil (-6)
		KLCK JKLMN 1
        RIFF A 0 A_FireCustomMissile("AirKickAttack", 0, 0, 0, -31)
        KLCK O 3
		KLCK A 0 A_Takeinventory("Kicking",1)
		KLCK PQRST 2
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		Goto ReadyToFire
		
	SuperAirKick:
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 A_Recoil (-6)
		KLCK JKLMN 1
        RIFF A 0 A_FireCustomMissile("SuperAirKickAttack", 0, 0, 0, -31)
        KLCK O 3
		KLCK A 0 A_Takeinventory("Kicking",1)
		KLCK PQRST 2
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		Goto ReadyToFire
	Taunt:
		TNT1 A 0 A_Takeinventory("Zoomed",1)
        TNT1 A 0 A_ZoomFactor(1.0)
        TNT1 A 10
		FUCK F 1
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 0, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", -9, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 9, 0, -1, 0)
        FUCK G 1 A_PlaySound("FUCK", 2)
        FUCK HI 1 A_AlertMonsters
		FUCK J 15 A_Takeinventory("Taunting",1)
        FUCK IHGF 1
        TNT1 A 10
		Goto ReadyToFire
	Salute:
	    TNT1 A 0 SetPlayerProperty(0,1,0)
		TNT1 A 0 A_ALertMonsters
		SALU ABCDEDCDEDCDEDCBA 4
		TNT1 A 0 A_TakeInventory("Salute1",1)
		TNT1 A 0 A_TakeInventory("Salute2",1)
		TNT1 A 0 SetPlayerProperty(0,0,0)
		Goto ReadyToFire	
	Steady:
	TNT1 A 1
	Goto ReadyToFire	
		
	PuristGun:
		TNT1 A 1
		TNT1 A 0 A_GiveInventory("ClassicPlasmaRifle", 1)
		TNT1 A 0 A_TakeInventory("Plasma_Gun", 1)
		TNT1 A 0 A_TakeInventory("DualPlasmaRifles", 1)
		TNT1 A 10
		Goto Ready	
		
	}
}

ACTOR DoublePlasmagunAmmo : 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 "PLASA0"
}


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


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