//==SHOTGUN==
//Blaz gets a scroll of sword throw, allowing him to toss his sword 
//for a powerful ranged attack at the cost of fighting unarmed
//Doomslayer gets the mourning star, a reliable, powerful shotgun.

Actor GMOTAShotgun : custominventory replaces shotgun
{
	Radius 14
	Height 14
	+quiet
    +DONTGIB
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
        TNT1 A 0 a_custommissile ("BlazScrollSprite",0,0,0,CMF_AIMDIRECTION)
        TNT1 A 0 a_custommissile ("DoomslayerShotgunSprite",0,0,0,CMF_AIMDIRECTION)
	spawn1:
		ITRO ABCDEFGH 1 Bright
		loop
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("IamLordBlaz",1,"BlazScroll")
		TNT1 A 0 A_JumpIfInventory ("IamDoomSlayer",1,"DoomSlayerShotgun")
		TNT1 A 1
		stop
	BlazScroll:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_setblend (FFFF00,0.1,5)
		TNT1 A 0 a_playsound ("powerups/upgrade",CHAN_ITEM)
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,1,0,0)			
		//TNT1 A 0 a_log ("Sword art scroll: Sword throw!")
		TNT1 A 0 a_jumpifinventory ("throwscroll", 1, "nohelpblaz")
		TNT1 A 0 a_print ("Hold primary attack to prepare a sword throw!")
	nohelpblaz:
		TNT1 A 0
		TNT1 A 0 a_giveinventory ("throwscroll", 1)
		TNT1 A 1 a_giveinventory ("arcaneforce", 2)
		stop
	DoomslayerShotgun:
		TNT1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,1,0,0)			
		//TNT1 A 0 a_log ("You got the Mourning Star shotgun!")
		TNT1 A 0 a_playsound ("misc/w_pkup",CHAN_ITEM)
		TNT1 A 0 a_setblend (FFFF00,0.1,5)
		TNT1 A 0 a_giveinventory ("maceorbs",2)
		TNT1 A 0 a_giveinventory ("morningstar",1)
		TNT1 A 0 a_giveinventory ("GotMorningstar",1)
		TNT1 A 1
		stop
	}
}

actor throwscroll : inventory
{inventory.maxamount 1}

actor GotMorningStar : inventory
{
	+UNTOSSABLE
	inventory.maxamount 1
}


actor BlazScrollSprite : GMOTAweaponsprite
{
    scale 0.7
	VisibleToPlayerClass LordBlaz
    States
    {
	spawn:
		TNT1 A 0
		TWSC 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)
		TWSC A 1 bright
		goto death
	death:
		TNT1 A 0
		TNT1 A 1 
		stop
    }
}

actor DoomSlayerShotgunSprite : GMOTAWeaponsprite
{
    VisibleToPlayerClass DoomSlayer
    States
    {
	spawn:
		TNT1 A 0
		MSPU 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)
		MSPU A 1 bright
		goto death
	death:
		TNT1 A 0
		TNT1 A 1
		stop
    }
}
