//==BFG==
//Blaz gets the Fatal draw, a focused sword slash that decimates crowds with
//a single strike

//The Doomslayer gets the Berserk Rune, able to build rage from damaging
//foes before unleashing it for a temporary burst of super strength

//Kustam gets the overclock, allowing him to activate the Sentinel Arms,
//allowing him to fight with twin arm cannons and increasing his defense


Actor GMOTABFG : custominventory replaces BFG9000
{
	Radius 14
	Height 14
	+quiet
    +DONTGIB
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_CustomMissile ("BlazFatalDrawSprite",0,0,0,CMF_AIMDIRECTION)
		TNT1 A 0 A_CustomMissile ("DoomslayerBerserkSprite",0,0,0,CMF_AIMDIRECTION)
		TNT1 A 0 A_CustomMissile ("KustamOverclockSprite",0,0,0,CMF_AIMDIRECTION)
	spawn1:
		ITRO ABCDEFGH 1 Bright
		loop
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("IamLordBlaz",1,"BlazFataldraw")
		TNT1 A 0 A_JumpIfInventory ("IamDoomSlayer",1,"DoomslayerBerserk")
		TNT1 A 0 A_JumpIfInventory ("IamKustam",1,"KustamOverclock")
		TNT1 A 1
		stop
	BlazFatalDraw:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 A_SetBlend (FFFFFF,0.3,10)
		TNT1 A 0 A_PlaySound ("powerups/superpower",CHAN_ITEM)
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,6,0,0)			
		//TNT1 A 0 a_log ("Unleasher the fatal draw!")
		TNT1 A 0 A_JumpIfInventory ("unleasher", 1, "nohelp")
		TNT1 A 0 A_Print ("Press the UNLEASHER key to arm a fatal draw.")
		TNT1 A 0 A_GiveInventory ("unleasher",1)
		TNT1 A 0 A_GiveInventory ("SpiritForce", 100)
		TNT1 A 1 
		stop
	nohelp:
		TNT1 A 0
		TNT1 A 1 A_GiveInventory ("SpiritForce", 100)
		stop
	DoomslayerBerserk:
		TNT1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,6,0,0)
		TNT1 A 0 A_GiveInventory ("SlayerBFGCharge",300)
		//TNT1 A 0 a_log ("Rip and tear until it is done!")
		TNT1 A 0 A_JumpIfInventory ("unleasher", 1, "nohelpslayer")
		TNT1 A 0 A_PlaySound ("doomslayer/berserkget",0)
		TNT1 A 0 A_SetBlend (FF0000,0.5,50)
		TNT1 A 0 Radius_Quake (2,45,0,10,0)
		TNT1 A 0 A_Print ("Arm the BFUG with the UNLEASHER key!")
		TNT1 A 0 A_GiveInventory ("unleasher",1)
		TNT1 A 1
		stop
	nohelpSlayer:
		TNT1 A 0
		TNT1 A 0 A_PlaySound ("doomslayer/berserkgetagain",0)
		TNT1 A 0 A_SetBlend (FF0000,0.5,35)
		TNT1 A 0 Radius_Quake (2,20,0,10,0)
		stop
	KustamOverclock:
		TNT1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,6,0,0)			
		TNT1 A 0 A_JumpIfInventory ("unleasher", 1, "nohelpkustam")
		TNT1 A 0 A_PlaySound ("kustam/overclockget",0)
		TNT1 A 0 A_SetBlend (6A5ACD,0.5,50)
		TNT1 A 0 A_GiveInventory ("SentinelCharge",100)
		TNT1 A 0 A_Print ("Transform with UNLEASHER key")
		TNT1 A 0 A_GiveInventory ("unleasher",1)
		TNT1 A 1
		stop
	nohelpKustam:
		TNT1 A 0
		TNT1 A 0 A_PlaySound ("kustam/overclockgetagain",0)
		TNT1 A 0 A_SetBlend (6A5ACD,0.5,35)
		TNT1 A 1 A_GiveInventory ("SentinelCharge",100)
		stop
	}
}

actor BlazFatalDrawSprite : GMOTAweaponsprite
{
	VisibleToPlayerClass LordBlaz
    States
    {
	spawn:
		TNT1 A 0
		BLZU A 1 bright
		TNT1 A 0 a_warp (AAPTR_TARGET,0,0,0,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
		TNT1 A 0 a_checkflag ("SPECIAL","spawn",AAPTR_TARGET)
		BLZU A 1 bright
		goto death
	death:
		TNT1 A 1
		stop
    }
}

actor DoomSlayerBerserkSprite : GMOTAWeaponsprite
{
    +bright
	VisibleToPlayerClass DoomSlayer
    States
    {
	spawn:
		TNT1 A 0
		DSBR A 1 bright
		TNT1 A 0 a_warp (AAPTR_TARGET,0,0,0,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
		TNT1 A 0 a_checkflag ("SPECIAL","spawn",AAPTR_TARGET)
		DSBR A 1 bright
		goto death
	death:
		TNT1 A 0
		TNT1 A 1
		stop
    }
}


actor KustamOverclockSprite : GMOTAWeaponsprite
{
    +bright
	VisibleToPlayerClass Kustam
    States
    {
	spawn:
		TNT1 A 0
		KSTU A 1 bright
		TNT1 A 0 a_warp (AAPTR_TARGET,0,0,0,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
		TNT1 A 0 a_checkflag ("SPECIAL","spawn",AAPTR_TARGET)
		KSTU A 1 bright
		goto death
	death:
		TNT1 A 0
		TNT1 A 1
		stop
    }
}



actor unleasher : custominventory
{
	Inventory.Amount 1
	Inventory.MaxAmount 1
	Inventory.InterHubAmount 1
	Inventory.Icon BLZUI
	+INVBAR
	+FLOORCLIP
	+floatbob
	states
	{
	use:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("IAmLordBlaz", 1, "Fataldrawcheck")
		TNT1 A 0 A_JumpIfInventory ("IAmDoomslayer", 1, "BFUGCheck")
		TNT1 A 0 A_JumpIfInventory ("IAmKustam", 1, "Overclockcheck")
		fail
	FatalDrawcheck:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("SpiritForce", 100, "drawon")
		fail
	drawon:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("FatalDrawToken", 1, "CancelUltimate")
		TNT1 A 0 A_GiveInventory ("fataldrawgo", 1)
		fail
	BFUGCheck:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("SlayerBFGCharge", 200, "BFUGUp")
		fail
	BFUGUp:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("BFGArmed", 1, "CancelUltimate")
		TNT1 A 0 A_GiveInventory ("BFGReady")
		fail
	Overclockcheck:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("SentinelCharge", 100, "SentinelMode")
		fail
	SentinelMode:
		TNT1 A 0
		TNT1 A 0 A_GiveInventory ("GunArms", 1)
		fail
	
	CancelUltimate:
		TNT1 A 0
		TNT1 A 0 A_GiveInventory ("UnleasherCancel", 1)
		fail
		
		
	}
}

actor fataldrawgo : powerup
{
	powerup.duration 20
}


actor BFGReady : powerup
{
	powerup.duration 20
}


actor GunArms : powerup
{
	powerup.duration 20
}

actor UnleasherCancel : powerup
{
	powerup.duration 20
}

