//subweapon chest

actor subweaponchest 
{
	health 60
	radius 20
	height 38
	+notimefreeze
	+shootable
	+noblood
	+dontrip
	+BRIGHT
	+noradiusdmg
	+quicktoretaliate
	+CANTSEEK
	+ISMONSTER
	mass 2500
	scale 1.5
	BloodType "GMOTANoBlood"
	damagefactor "telefrag", 0.0
	damagefactor "KustamKick", 100.0
	dropitem "chestloot"
	states
	{
	spawn:
		CHST A 0
		CHST A 0 A_JumpIfHealthLower (31, "cracked")
		CHST A 1 A_JumpIfHealthLower (31, "cracked")
		loop
	cracked:
		CHST B 0
		CHST B 1
		loop
	Death.KustamKick:
	death:
		TNT1 A 0
		TNT1 A 0 A_Stop
		TNT1 A 0 ThrustThingZ (0,40,1,0)
		CBRK AB 3 A_Stop
		TNT1 A 0 A_NoBlocking
		CBRK CD 1
		stop		
	death:
		TNT1 A 0
		CBRK AB 3
		TNT1 A 0 A_NoBlocking
		CBRK CD 1
		stop
	Death.Telefrag:
		TNT1 A 0
		TNT1 A 0 A_PlaySound ("skuttle/explode", 0)
		TNT1 AAAAAAA 0 A_SpawnDebris ("missiledebris1")
		TNT1 AAAAAAAAAAAA 0 A_SpawnItemEx ("missiledebris2",random(-16,16),random(-16,16),random(-10,10),random(-100,100)/20.0,random(-100,100)/20.0,random(-100,100)/20.0,0,160)
		MWND E 3 Bright
		MWND F 2 Bright
		MWND G 3 Bright
		MWND H 2 Bright
		MWND I 2 Bright
		stop
	}
}


actor KnightmareChest : subweaponchest 
{
	dropitem "KnightmareLoot"
}



actor lilchest
{ 
	Radius 8
	Height 10
	Speed 40
	+FORCEXYBILLBOARD	
	+LOOKALLAROUND
	+MISSILE
	+DROPOFF
	+CANBOUNCEWATER
	+bounceonceilings
	+bounceonwalls
	+DONTBLAST
	+BRIGHT
	+thruactors
	damagefactor "telefrag", 0.0
	states
	{
	spawn:
		CHS1 D 150
		goto death
	death:
		CHS1 D 40
		TNT1 A 0 A_PlaySound ("subitems/portaexpand",0)
		CHS1 D 1 
		CHS1 C 1 
		CHS1 B 1 
		CHS1 A 1 
		TNT1 A 0 A_SpawnItem ("subweaponchest",0,0,0)
		stop
	}
}


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




Actor SupplyChest : Actor replaces backpack
{
	health 9999999
	radius 20
	height 38
	+FORCEXYBILLBOARD
	+DONTGIB
	+notimefreeze
	+shootable
	+noblood
	+dontrip
	+noradiusdmg
	+DONTBLAST
	mass 9999999
	painchance 256
	scale 1.5
	damagefactor "telefrag", 0.0

	var int user_ItemVomit;
	states
	{
	Spawn:
		BCST A 1
		loop
	Pain:
		TNT1 A 0 A_ChangeFlag ("shootable",0)
		BCST BB 2 
		BCST A 2 
		BCST CC 2 
		BCST BB 2 
		BCST A 2 
		BCST CC 2 
		BCST BB 2 
		BCST A 2
		BCST D 4
		BCST E 1 A_SpawnItemEx ("GMOTAChainsaw", 0, 0, 15, random (-2, 3), random (-2, 3), random (5, 8))
	DroppingStuff:
		BCST E 1 A_SpawnItemEx ("SunderLootOrb", 0, 0, 15, random (-5, 6), random (-3, 5), random (3, 6))
		BCST E 1 A_SetUserVar ("user_ItemVomit", user_ItemVomit+1)
		BCST E 0 A_JumpIf (user_ItemVomit >= 10, "death")
		loop
	Death:
		BCST E 33
		CBRK AB 3
		TNT1 A 0 A_NoBlocking
		CBRK CD 1
		stop
	}
}

//Special chests

actor CheatBox : Custominventory 
{
	radius 20
	height 38
	scale 1.5
	-COUNTITEM
	+INVENTORY.ALWAYSPICKUP
	+BRIGHT
	inventory.pickupmessage "Cheat box, full arsenal!"
	inventory.pickupsound "powerups/special"
	states
	{
	spawn:
		RCST A 1
		loop
	Pickup:
		TNT1 A 0 
		TNT1 A 0 A_JumpIfInventory ("IamLordBlaz",1,"GiveBlazStuff")
		TNT1 A 0 A_JumpIfInventory ("IamDoomSlayer",1,"GiveSlayerStuff")
		TNT1 A 0 A_JumpIfInventory ("IamKustam",1,"GiveKustamStuff")
		TNT1 A 1
		stop
	GiveBlazStuff:
		TNT1 A 0 A_GiveInventory ("ChainUpgrade", 1)
		TNT1 A 0 A_GiveInventory ("ThrowBoostTech", 1)
		TNT1 A 0 A_GiveInventory ("SwordCleaveUpgrade", 1)
		TNT1 A 0 A_GiveInventory ("ShatterUpgrade",1)
		TNT1 A 0 A_GiveInventory ("OverloadUpgrade",1)
		TNT1 A 0 A_GiveInventory ("TerrorUpgrade",1)
		TNT1 A 0 A_GiveInventory ("SpiritForce",999)
		TNT1 A 1 A_GiveInventory ("unleasher",1)
		Stop
	GiveSlayerStuff:
		TNT1 A 0 A_GiveInventory ("StunCasterUpgrade", 1)
		TNT1 A 0 A_GiveInventory ("MourningStar",1)
		TNT1 A 0 A_GiveInventory ("ThunderBuss",1)
		TNT1 A 0 A_GiveInventory ("ReignStorm",1)
		TNT1 A 0 A_GiveInventory ("Wrathcaster",1)
		TNT1 A 0 A_GiveInventory ("Magmauler",1)
		TNT1 A 0 A_GiveInventory ("SlayerMettle",300)
		TNT1 A 0 A_GiveInventory ("SlayerGrit",300)
		TNT1 A 0 A_GiveInventory ("SlayerBFGCharge",300)
		TNT1 A 1 A_GiveInventory ("unleasher",1)
		stop
	GiveKustamStuff:
		TNT1 A 0 A_GiveInventory ("ReclaimatorBooster",1)
		TNT1 A 0 A_GiveInventory ("ScatterUpgrade",1)
		TNT1 A 0 A_GiveInventory ("ScatterComboUpgrade",1)
		TNT1 A 0 A_GiveInventory ("LaserComboUpgrade",1)
		TNT1 A 0 A_GiveInventory ("SlowModule",1)
		TNT1 A 0 A_GiveInventory ("GlaiveBoostModule",1)
		TNT1 A 0 A_GiveInventory ("KustamKineticBattery",300)
		TNT1 A 0 A_GiveInventory ("KustamLaserBattery",300)
		TNT1 A 0 A_GiveInventory ("SentinelCharge",100)
		TNT1 A 1 A_GiveInventory ("unleasher",1)
		Stop
	}
}


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


//Shade ring
ACTOR ShadeRing : PowerupGiver replaces blursphere
{
	+INVENTORY.PICKUPFLASH
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	+INVENTORY.BIGPOWERUP
	Inventory.MaxAmount 0
	Powerup.Type PowerShade
	Inventory.PickupMessage "Shade ring! Limited invisibility and immunity to physical projectiles!"
	inventory.pickupsound "powerups/shadering"
	States
	{
	Spawn:
		IRNG A 15 Bright
		IRNG A 10 
		Loop
	}
}

ACTOR PowerShade : PowerInvisibility
{
	+GHOST
	Powerup.Duration -60
	Powerup.Strength 60
	Powerup.Mode "translucent"
    //inventory.icon "IRGICN"
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


//yashichi
actor yashichi : custominventory
{
	inventory.pickupmessage "Yashichi! How did -THAT- get here?"
	inventory.pickupsound "powerups/special"
	+notimefreeze
	+floatbob
	scale 0.60
	states
	{
	spawn:
		YASH A 6
		YASH A 6 bright
		loop
	pickup:
		TNT1 A 0 A_GiveInventory ("soulsphere", 2)
		TNT1 A 0 A_GiveInventory ("GMOTAGoldArmor", 2)
		TNT1 A 1
		stop
	}
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


//SUPER Burger

actor superburger : soulsphere replaces soulsphere
{
	inventory.pickupmessage "Superburger, big HP!"
	inventory.pickupsound "powerups/burger"
	+floatbob
	states
	{
	spawn:
		BURG A 10
		BURG A 6 bright
		loop
	}
}

actor superburgerdrop : superburger
{
	+dropped
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


//crystal ball
actor crystalball : CustomInventory
{
	+notimefreeze
	+floatbob
	+INVENTORY.ALWAYSPICKUP
	scale 1
	Inventory.MaxAmount 0
	Inventory.PickupSound "powerups/smallpower"
	Inventory.PickupMessage "The crystal ball reveals all on your map!"
	states
	{
	Spawn:
		CBAL A 6 
		CBAL A 6 BRIGHT
		Loop
	Pickup:
		TNT1 A 1 A_GiveInventory ("Allmap")
		TNT1 A 0 A_GiveInventory ("crystalballreveal")
		stop
	}
}

actor crystalballreveal : PowerupGiver
{
	powerup.type "Scanner"
	powerup.duration 0x7FFFFFFF
	+notimefreeze
	+INVENTORY.AUTOACTIVATE
	states
	{
	Spawn:
		TNT1 A 1
		stop
	}
}



//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


//==Ring of might==

//This ring enhances the hero's melee abilities, (primary weapon)
//granting them new attacks and boosting pre-existing ones

actor mightring : custominventory replaces berserk
{
	Inventory.PickupMessage "Ring of Might! Melee power enhanced!"
	inventory.pickupsound "subitems/upgradeitem"
	Inventory.Amount 1
	Inventory.MaxAmount 1
	+FLOORCLIP
	+floatbob
	+THRUACTORS
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_ChangeFlag ("THRUACTORS",0)
		goto SpawnLoop
	SpawnLoop:
		MIRN A 10 bright
		MIRN A 4 
		Loop
	pickup:
		TNT1 A 0
		TNT1 A 0 A_GiveInventory ("ATKringpowerup", 1)
        TNT1 A 0 A_JumpIf(CallACS("BerserkValue") == 1, "VanillaHeal")		
		TNT1 A 0 A_GiveInventory ("healthbonus", 50)
		TNT1 A 1
		stop
	VanillaHeal:
		TNT1 A 1 A_GiveInventory ("Health", 100)
		stop
		
	} 
}

actor ATKringpowerup : inventory
{inventory.maxamount 1}


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


//==Magic Boots==

//Enchanted boots that allows the hero to pass
//through damaging floors safely

actor MagicBoots : custominventory replaces radsuit
{
	Inventory.PickupMessage "Seven League Boots, hazard immunity!"
	inventory.pickupsound "subitems/upgradeitem"
	Inventory.Amount 1
	Inventory.MaxAmount 1
	Inventory.InterHubAmount 1
	+INVENTORY.ALWAYSPICKUP
	+floatbob
	States
	{
	Spawn:
		BOOT A 10 bright
		BOOT A 4 
		Loop
	pickup:
		TNT1 A 0 A_GiveInventory ("Bootprotection", 1)
		stop
	} 
}

actor bootprotection : powerironfeet
{
	Powerup.Duration -80
	Powerup.Color 0, 0, 0, 0
	inventory.maxamount 1
	+INVENTORY.ALWAYSPICKUP
	+INVENTORY.AUTOACTIVATE
}	

actor BootMeterHUD : PowerupGiver
{
	inventory.pickupmessage ""
	inventory.maxamount 0
	Powerup.Duration -80
	Powerup.Color 0, 0, 0, 0
	powerup.type "bootprotection"
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	Inventory.PickupSound ""
	states
	{
	Spawn:
		TNT1 A 0
		Stop
	}
}


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


//Knight vision visor
ACTOR Knightvision : PowerupGiver replaces infrared
{
	+COUNTITEM
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	+bright
	Inventory.MaxAmount 0
	inventory.pickupsound "subitems/upgradeitem"
	Powerup.Type "LightAmp"
	Inventory.PickupMessage "Knight Vision Visor!"
	States
	{
	Spawn:
		KNVS A 10
		KNVS B 10
		Loop
	}
}
	

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


//Invuln Helmet

actor powershield : powerupgiver
{
	Inventory.PickupMessage "Helmet of Invulnerability!"
    Inventory.PickupSound "powerups/superpower"
    Powerup.Type "shieldprotection"
    Powerup.Duration -30
    inventory.maxamount 0
	Powerup.Color blue2 0.10
    +notimefreeze
    +floatbob
    +bright
	+INVENTORY.AUTOACTIVATE
    states
    {
    spawn:
		IHLM A 4
		IHLM ABCD 6
		IHLM D 12 
		IHLM DCBA 6
		loop
    }
}

actor powershieldprotection : powerprotection
{
    DamageFactor "Normal", 0.0
    +noradiusdmg
    +nopain
}
	
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



//--random spawners--//

actor treatspawner : randomspawner
{
	dropitem "icecreamcone", 255, 3
	dropitem "strawberrycone", 255, 3
	dropitem "sundae", 255, 3
	dropitem "popsicle", 255, 3
}

actor chestloot : randomspawner
{
	dropitem "arthurslance", 255, 3
	dropitem "arthursdagger", 255, 3
	dropitem "RoysMattock", 255, 3
	dropitem "wardingshield", 255, 3
	dropitem "WicksFlame", 255, 3
	dropitem "boomerangweapon", 255, 3
	dropitem "goldenboner", 255, 1
	dropitem "haelinsgift", 255, 2
}

actor GoldBonerCompanion : randomspawner
{
	dropitem "arthurslance", 255, 3
	dropitem "arthursdagger", 255, 3
	dropitem "RoysMattock", 255, 3
	dropitem "wardingshield", 255, 3
	dropitem "WicksFlame", 255, 3
	dropitem "boomerangweapon", 255, 3
}


actor KnightMareLoot : randomspawner
{
	dropitem "arthurslance", 255, 3
	dropitem "arthursdagger", 255, 3
	dropitem "RoysMattock", 255, 3
	dropitem "wardingshield", 255, 3
	dropitem "WicksFlame", 255, 3
	dropitem "boomerangweapon", 255, 3
	dropitem "ChestSpider", 255, 2
	//dropitem "CrystalSpiderSpawn", 255, 4
	dropitem "goldenboner", 255, 1
	dropitem "haelinsgift", 255, 2
}

actor Spiderloot : RandomSpawner
{
	dropitem "arthurslance", 255, 3
	dropitem "arthursdagger", 255, 3
	dropitem "RoysMattock", 255, 3
	dropitem "wardingshield", 255, 3
	dropitem "WicksFlame", 255, 3
	dropitem "boomerangweapon", 255, 3
}

actor permasubchestloot : randomspawner
{
	dropitem "arthurslance", 255, 3
	dropitem "arthursdagger", 255, 3
	dropitem "RoysMattock", 255, 3
	dropitem "wardingshield", 255, 3
	dropitem "WicksFlame", 255, 3
}


actor mapspawner : randomspawner replaces allmap
{
	dropitem "crystalball", 255, 1
}

actor randommegaspherespawner : randomspawner replaces megasphere
{
	dropitem "yashichi", 255, 1
}

actor shieldspherespawner : randomspawner replaces InvulnerabilitySphere
{
	dropitem "powershield", 255,1
}