// --------------------------------------------------------------------------
//
// Elite (Demo weapon)
//
// --------------------------------------------------------------------------


//Weapon auxiliar
Actor EliteFireWeaponRight : Inventory
{
Inventory.MaxAmount 1
}

ACTOR "Elite" : CSDMOWeapon //5010
{
	Weapon.SisterWeapon Elite_rat

+AMMO_OPTIONAL

	Weapon.SelectionOrder 600
  weapon.ammotype "EliteClip"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "9mmAmmo"
  weapon.ammouse2 0
  weapon.ammogive2 0 //30
	obituary "%k killed %o with Dual Berettas."
	+WEAPON.WIMPY_WEAPON
	Inventory.Pickupmessage "Picked up a Dual berettas."
	Tag "Dual Berettas"
	Weapon.UpSound "Elite/Ready"
	//AttackSound "Elite/Fire" 
	Scale 0.18
	+NOAUTOFIRE

	States
	{
	Ready:
		W09Y A 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("IsBot",1,"BotReady")
		Loop



	Deselect:
	TNT1 A 0 ACS_NamedExecuteAlways("HSPreviousWeapon", 0, 2, 0, 0)
    TNT1 A 1 
	Goto DeselectLoop

	Select:
	TNT1 A 1 A_Raise
	TNT1 AA 0 A_Raise
	TNT1 A 0 ACS_ExecuteAlways(798, 0, 240, 0, 0)//Weapon Weight
	TNT1 A 1 A_TakeInventory("CrosshairType",2)

	TNT1 A 0 ACS_NamedExecuteAlways("HSPreviousWeapon", 0, 1, 0, 0)
	    TNT1 A 0 A_JumpIfInventory("RAT_Trigger",1,"RAT_TriggerSelect")

		TNT1 A 1 A_WEAPONREADY(WRF_NOFIRE)
		W09A DEFGHIJKLMNOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W09B ABCDEFGHIJ 1 A_WEAPONREADY(WRF_NOFIRE)//K
		Goto Ready

	RAT_TriggerSelect:
    TNT1 A 0 A_TakeInventory("Rat_Trigger",1)

		TNT1 A 1 A_WEAPONREADY(WRF_NOFIRE)
		W09A DEFGHIJKLMNOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W09B ABCDEFGHIJ 1 A_WEAPONREADY//(WRF_NOFIRE)k
		Goto Ready

	Fire:
TNT1 A 0 A_JumpIfInventory("EliteFireWeaponRight", 1, "FireRight")
	W09D U 0 A_JumpIfNoAmmo("AltFire")
	TNT1 A 0 A_JumpIfInventory("IsBot",1,"BotFire")
	TNT1 A 0 A_GiveInventory("EliteFireWeaponRight", 1)
		W09D A 1 A_GunFlash
		W09D BC 1 A_WEAPONREADY(WRF_NOFIRE)
		W09D DEF 1 A_WEAPONREADY
		//W09D D 1

		//TNT1 A 0 A_Refire
		W09D GHIJKLMNOPQRSTUVWXYZ 1 A_WeaponReady
		W09E ABC 1 A_WeaponReady

		Goto Ready


	FireRight:

	W09D U 0 A_JumpIfNoAmmo("AltFire")
		TNT1 A 0 A_JumpIfInventory("IsBot",1,"BotFireRight")
	TNT1 A 0 A_TakeInventory("EliteFireWeaponRight", 1)	
		W09F A 1 A_GunFlash
		W09F BC 1 A_WEAPONREADY(WRF_NOFIRE)
		W09F DEF 1 A_WEAPONREADY
		//W09D D 1

		//TNT1 A 0 A_Refire
		W09F GHIJKLMNOPQRSTUVWXYZ 1 A_WeaponReady
		W09G ABCD 1 A_WeaponReady

		Goto Ready








//Bot compatibility


	BotReady:
		
		W09B L 1 A_WeaponReady
		TNT1 A 0 A_REFIRE
		Loop


	BotFire:
	TNT1 A 0 A_GiveInventory("EliteFireWeaponRight", 1)
		W09D A 1 A_GunFlash
		W09D BCDE 1 A_WEAPONREADY(WRF_NOFIRE)


		W09D FGHIJKLMNOPQRSTUVWXYZ 1 A_Refire
		W09E ABC 1 A_Refire

		Goto Ready


	BotFireRight:
	
	TNT1 A 0 A_TakeInventory("EliteFireWeaponRight", 1)	
		W09F A 1 A_GunFlash
		W09F BCDE 1 A_WEAPONREADY(WRF_NOFIRE)

		W09F FGHIJKLMNOPQRSTUVWXYZ 1 A_Refire
		W09G ABCD 1 A_Refire

		Goto Ready









  Altfire:
    TNT1 A 0 A_JumpIfInventory("EliteClip",30,"Ready")
    TNT1 A 0 A_JumpIfInventory("9mmAmmo",1,"ReloadStart")
    goto Ready


	ReloadStart:
		W09H ABCDEFGHIJ 1 A_WEAPONREADY(WRF_NOFIRE)
		TNT1 A 0 A_PlaySound("Elite/Reload", 6)
		W09H KLMNOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W09I ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W09J ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W09K ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W09L A 1 A_WEAPONREADY(WRF_NOFIRE)
		Goto ReloadAmmo
	
	
  ReloadAmmo:
    TNT1 A 0 A_GiveInventory("EliteClip",1)
    TNT1 A 0 A_TakeInventory("9mmAmmo",1)
    TNT1 A 0 A_JumpIfInventory("EliteClip",0,"ReloadEnd")
    TNT1 A 0 A_JumpIfInventory("9mmAmmo",1,"ReloadAmmo")
    goto ReloadEnd		

	ReloadEnd:
		W09L BCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W09M ABCDE 1 A_WEAPONREADY(WRF_NOFIRE)
		TNT1 A 0 A_JumpIfInventory("Fire_Holdkey",1,"Fire")//A_Refire
		Goto Ready




	Flash:
	TNT1 A 0 ACS_ExecuteAlways(799, 0, 0, 0, 0)
	TNT1 A 0 A_GiveInventory("CrosshairGrow", 7)
	TNT1 A 0 A_PlaySound ("ELITE/FIRE")
		TNT1 A 0 A_PlaySound("ELITE/Distant", 7)
	TNT1 A 0 A_JumpIfInventory("EliteFireWeaponRight", 1, "FlashRight")
	TNT1 A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,13,4)
		TNT1 A 0 Bright A_Light1
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_FireCustomMissile("RifleCaseSpawn",5,0,12,-6)
        TNT1 A 0 BRIGHT A_FireCustomMissile("Tracer", frandom(-1.5,1.5), 0, 11, 0, 0, frandom(-1.5,1.5))
		TNT1 A 3 A_FireBullets(0.65, 0.65, -1, 40.0, "EliteBullet")//6.8
		Goto LightDone


	FlashRight:
	TNT1 A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,-13,4)
		TNT1 A 0 Bright A_Light1
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_FireCustomMissile("RifleCaseSpawn",5,0,-12,-6)
        TNT1 A 0 BRIGHT A_FireCustomMissile("Tracer", frandom(-1.5,1.5), 0, -11, 0, 0, frandom(-1.5,1.5))
		TNT1 A 3 A_FireBullets(0.65, 0.65, -1, 40.0, "EliteBullet")//6,55
		Goto LightDone


 	Spawn:
		W09Z A -1
		Stop
	}
}