// --------------------------------------------------------------------------
//
//	Unmaker
//
// --------------------------------------------------------------------------

ACTOR U_Unmaker : BaseWeapon replaces Unmaker
{
	Weapon.AmmoUse 0
	Weapon.AmmoGive 100
	Weapon.AmmoType "U_SoulAmmo"
	Weapon.SelectionOrder 1800
	-WEAPON.CHEATNOTWEAPON
	Inventory.PickupSound "BFGREADY"
    Inventory.PickupMessage "You got the sinister Unmaker, the power of hell itself."
	tag "Unmaker"
	States
	{
	Spawn:
		UNHW A -1
		Stop

	Select:
		TNT1 A 0 A_JumpIfInventory("IsPlayingAsPurist",1,"PuristGun")
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1010,4)==0, "PuristGun")
		TNT1 A 0 A_Giveinventory("RevenantLauncherSelected",1)
		TNT1 A 0 A_Giveinventory("GoSpecial",1)
		TNT1 A 0 A_Takeinventory("Unloading",1)
		TNT1 A 0 A_Takeinventory("Reloading",1)
		TNT1 A 0 A_TakeInventory("TossGrenade", 1)
		TNT1 A 0 A_Takeinventory("WeapSpecial",1)
		TNT1 A 0 A_Takeinventory("Taunting",1)
		TNT1 A 0 A_Takeinventory("IdleCounter",200)
		TNT1 A 2
		TNT1 A 0 A_Raise
		Wait

	Deselect:
		TNT1 A 0 A_ZoomFactor(1.0)
        UNHS IJKLMN 1
		TNT1 A 0 A_StopSound(5)
		TNT1 A 0 A_TakeInventory("RevenantLauncherSelected", 1)
		TNT1 A 0 A_Lower
		Wait
		
	PuristGun:
		TNT1 A 0 A_TakeInventory("U_Unmaker", 1)
		Goto Deselect

	Ready:
		TNT1 A 0 A_JumpIfInventory("GoFatality",1,"Steady")
        TNT1 A 0 A_PlaySound("BFGREADY")
	Ready1:
		UNHS ABCDEFGH 1
	Ready2:
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		TNT1 A 0 A_JumpIfInventory("Taunting",1,"TauntR")
		TNT1 A 0 A_JumpIfInventory("Salute1",1,"Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2",1,"Salute")
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		UNHG AB 2 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		TNT1 A 0 A_JumpIfInventory("Taunting",1,"TauntR")
		TNT1 A 0 A_JumpIfInventory("Salute1",1,"Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2",1,"Salute")
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		UNHG CD 2 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		TNT1 A 0 A_JumpIfInventory("Taunting",1,"TauntR")
		TNT1 A 0 A_JumpIfInventory("Salute1",1,"Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2",1,"Salute")
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		UNHG DC 2 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		TNT1 A 0 A_JumpIfInventory("Taunting",1,"TauntR")
		TNT1 A 0 A_JumpIfInventory("Salute1",1,"Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2",1,"Salute")
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		UNHG BA 2 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		TNT1 A 0 A_JumpIfInventory("Taunting",1,"TauntR")
		TNT1 A 0 A_JumpIfInventory("Salute1",1,"Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2",1,"Salute")
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		UNHG AA 2 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		TNT1 A 0 A_JumpIfInventory("Taunting",1,"TauntR")
		TNT1 A 0 A_JumpIfInventory("Salute1",1,"Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2",1,"Salute")
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("IdleCounter",200,"PlayerIsIdle")
		UNHG AA 2 A_WeaponReady
		Goto Ready2
	
// --------------------------------------------------------------------------
//
//	Fire
//
// --------------------------------------------------------------------------
	
	Fire:
		TNT1 A 0 A_JumpIfInventory("U_SoulAmmo", 3, 1)
		Goto DryFire
		TNT1 A 0 A_PlaySound("UNMSTA", 1)
		UNHF ABCD 1
		TNT1 A 0 A_PlaySound("UNMLOP", 5, 1, 1)
		TNT1 A 0 A_ZoomFactor(0.95)
				
	Hold:
		TNT1 A 0 A_JumpIfInventory("U_SoulAmmo", 3, 1)
		Goto NoFire
		TNT1 A 0 A_TakeInventory("U_SoulAmmo", 3)
		TNT1 A 0 A_GiveInventory("WasFiring", 1)
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_JumpIfInventory("FireSeq", 1, "Hold2")
	
	Hold1:
		TNT1 A 0 A_GiveInventory("FireSeq", 1)
	    UNHF E 1 BRIGHT
		TNT1 A 0 A_FireCustomMissile("UnmakerLaser", 0, 1, 0, 0, 0, 0)
		TNT1 A 0 A_RailAttack(1, 0, 0, "none", "red", RGF_NOPIERCING | RGF_SILENT | RGF_CENTERZ | RGF_FULLBRIGHT, 0, "hitpuff", 0, 0, 9999, 1)
		TNT1 A 0 A_SetAngle(frandom(1, -1) + angle)
		TNT1 A 0 A_SetPitch(-0.7 + pitch)
		UNHF F 1 BRIGHT
		TNT1 A 0 A_FireCustomMissile("UnmakerLaser", 0, 1, 0, 0, 0, 0)
		TNT1 A 0 A_RailAttack(1, 0, 0, "none", "red", RGF_NOPIERCING | RGF_SILENT | RGF_CENTERZ | RGF_FULLBRIGHT, 0, "hitpuff", 0, 0, 9999, 1)
		TNT1 A 0 A_SetAngle(frandom(1, -1) + angle)
		TNT1 A 0 A_SetPitch(-0.7 + pitch)
		////////////////////////////////
		TNT1 A 0 A_Refire
		TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_StopSound(1)
		TNT1 A 0 A_StopSound(5)
		TNT1 A 0 A_PlaySound("UNMSTO", 1, 0.5)
		TNT1 A 0 A_FireCustomMissile("FlamethrowerMissile", 0, 0, 0, 0)
		TNT1 A 0 A_TakeInventory("WasFiring", 1)
		UNHF DCBA 1
		Goto Ready2
		
	Hold2:
		TNT1 A 0 A_TakeInventory("FireSeq", 1)
		UNHF G 1 BRIGHT
		TNT1 A 0 A_FireCustomMissile("UnmakerLaser", 0, 1, 0, 0, 0, 0)
		TNT1 A 0 A_RailAttack(1, 0, 0, "none", "red", RGF_NOPIERCING | RGF_SILENT | RGF_CENTERZ | RGF_FULLBRIGHT, 0, "hitpuff", 0, 0, 9999, 1)
		TNT1 A 0 A_SetAngle(frandom(1, -1) + angle)
		TNT1 A 0 A_SetPitch(-0.7 + pitch)
		UNHF H 1 BRIGHT
		TNT1 A 0 A_FireCustomMissile("UnmakerLaser", 0, 1, 0, 0, 0, 0)
		TNT1 A 0 A_RailAttack(1, 0, 0, "none", "red", RGF_NOPIERCING | RGF_SILENT | RGF_CENTERZ | RGF_FULLBRIGHT, 0, "hitpuff", 0, 0, 9999, 1)
		TNT1 A 0 A_SetAngle(frandom(1, -1) + angle)
		TNT1 A 0 A_SetPitch(-0.7 + pitch)
		////////////////////////////////
		TNT1 A 0 A_Refire
		TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_StopSound(1)
		TNT1 A 0 A_StopSound(5)
		TNT1 A 0 A_PlaySound("UNMSTO", 1, 0.5)
		TNT1 A 0 A_FireCustomMissile("FlamethrowerMissile", 0, 0, 0, 0)
		TNT1 A 0 A_TakeInventory("WasFiring", 1)
		UNHF DCBA 1
		Goto Ready2

	DryFire:
		UNHF ABCD 1
		
	NoFire:
		TNT1 A 0 A_JumpIfInventory("WasFiring", 1, "NoFireWasFiring")
		UNHF D 2
		TNT1 A 0 A_Refire
		UNHF DCBA 1
		Goto Ready2
		
	NoFireWasFiring:
		TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_StopSound(1)
		TNT1 A 0 A_StopSound(5)
		TNT1 A 0 A_PlaySound("UNMSTO", 1, 0.5)
		TNT1 A 0 A_FireCustomMissile("FlamethrowerMissile", 0, 0, 0, 0)
		TNT1 A 0 A_TakeInventory("WasFiring", 1)
		Goto NoFire	

// --------------------------------------------------------------------------
//
//	End Stuff
//
// --------------------------------------------------------------------------

	KickFlash:
		UNHK ABCD 1
		UNHK EFGH 2
		UNHK DCBA 1
		UNHG A 1
		Stop

	AirKickFlash:
		UNHK ABCD 1
		UNHK EFGHH 2
		UNHK DCBA 1
		UNHG A 1
		Stop
		
	TauntFlash:
		UNHK ABCDE 1
		UNHK EFGHHGFEEEEEEFGHH 2
		UNHK DCBA 1
		UNHG A 1
		Stop
	
	GrenadeFlash:
		UNHS IJKLMN 1
		Stop
	}
}

ACTOR U_SoulAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 666
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 666
   Inventory.Icon "UNHWA0"
}