//Attention to those who want to use this for their own mod for any reason:
//This system wouldn't be possible without the combined efforts of Terminusest13
//and Yholl, I owe them my uneding thanks for helping me create a system
//That works with GZDoom and Zandronum 3.0, so make sure to credit them
//If you use this.
//ALL HAIL YHOLL, KING CRIMERA HAXFUCKER


//===UPGRADE ITEMS===//
//These replace the standard doom weapons and give each character
//Unique abilities or items to further enhance their moveset


//The foundation of the "disguise" sprites, these are purely cosmetic
//sprites that act as the visual indicator for the player
actor GMOTAweaponsprite
{
	projectile
	Scale 1
	+NOCLIP
	+NOINTERACTION
	+CLIENTSIDEONLY
	+Dontblast
    -SOLID
    +DONTGIB
}

	
//==CHAINSAW==
//For Blaz, his upgrade grants him a powerful finishing
//strike that hits multiple times

//Doomslayer gets Sunder, a saw gauntlet that allows him to punch a monster
//for heavy damage and causes ammo gems to spill out, with a long cooldown afterwards

//Kustam gets a defensive steam venter when overheated, pushing enemies back,
//dealing minor damage, and flinching them

Actor GMOTAChainsaw : custominventory replaces chainsaw
{
	Radius 14
	Height 14
	+quiet
    +DONTGIB
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
        TNT1 A 0 A_CustomMissile ("BlazChainSprite",0,0,0,CMF_AIMDIRECTION)
        TNT1 A 0 A_CustomMissile ("DoomSlayerStunSprite",0,0,0,CMF_AIMDIRECTION)
        TNT1 A 0 A_CustomMissile ("KustamReclaimatorSprite",0,0,0,CMF_AIMDIRECTION)
	spawn1:
		ITRO ABCDEFGH 1 Bright
		loop
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("IamLordBlaz",1,"BlazChain")
		TNT1 A 0 A_JumpIfInventory ("IamDoomSlayer",1,"DoomSlayerSaw")
		TNT1 A 0 A_JumpIfInventory ("IamKustam",1,"KustamReclaimator")
		TNT1 A 1
		stop
	BlazChain:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,0,0,0)	
		TNT1 A 0 A_SetBlend (FFFF00,0.1,5)
		TNT1 A 0 A_PlaySound ("powerups/upgrade",CHAN_ITEM)
		TNT1 A 0 A_GiveInventory ("ChainUpgrade", 1)
		TNT1 A 1 A_GiveInventory ("arcaneforce", 100)
		TNT1 A 0 A_GiveInventory ("DecayPause",1)
		stop
	Doomslayersaw:
		TNT1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,0,0,0)	
		TNT1 A 0 A_PlaySound ("misc/w_pkup",CHAN_ITEM)
		TNT1 A 0 A_GiveInventory ("StunCasterUpgrade", 1)
		TNT1 A 0 A_SetBlend (FFFF00,0.1,5)
		TNT1 A 1
		stop
	KustamReclaimator:
		TNT1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,0,0,0)
		TNT1 A 0 A_PlaySound ("Kustam/upgradeget",CHAN_ITEM)
		TNT1 A 0 A_SetBlend (FFFF00,0.1,5)
		TNT1 A 0 A_GiveInventory ("KustamLaserBattery", 15)
		TNT1 A 0 A_GiveInventory ("KustamKineticBattery", 15)
		TNT1 A 0 A_GiveInventory ("ReclaimatorBooster",1)
		TNT1 A 1
	}
}

//Blaz item token
actor ChainUpgrade : inventory
{inventory.maxamount 1}

//Doomslayer item tokens
actor StunCasterUpgrade : inventory
{inventory.maxamount 1}

//Kustam item token
actor ReclaimatorBooster : inventory
{inventory.maxamount 1}



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



actor DoomSlayerStunSprite : GMOTAweaponsprite 
{
    VisibleToPlayerClass Doomslayer
    States
    {
	spawn:
		TNT1 A 0
		SCPU 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)
		SCPU A 1 bright
		goto death
	death:
		TNT1 A 1
		stop
    }
}

actor KustamReclaimatorSprite : GMOTAweaponsprite 
{
    VisibleToPlayerClass Kustam
    States
    {
	spawn:
		TNT1 A 0
		HCVS 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)
		HCVS A 1 bright
		goto death
	death:
		TNT1 A 1
		stop
    }
}

