
//==============================================================================================================================================
//==============================================================================
//		DEMONIC BOOTS
//==============================================================================
//==============================================================================================================================================


ACTOR RLDemonicBootsPickup : RLGenericBootsPickup
{
    //$category "Demonic Boots"
	//$Sprite DEMBA0
    Tag "Demonic Boots"
    Inventory.Icon "DEMBBOX"
	Inventory.RespawnTics 105000
	States
	{
	SpawnRarityBeam:
// Create the appropriate rarity beam for the item.
		TNT1 A 0 A_SpawnItemEx("RLRarityBeamDemonic", 0,0,0, 0,0,0, 0, SXF_SETMASTER)
		TNT1 A 0 A_Jump (256, "SpawnDRPGCheck")
		Goto SpawnDRPGCheck
		
    SpawnLoopFall:
		DEMB A 0 A_JumpIf(Abs(VelZ) <= 0.01 && user_floorhit == 0, "FloorHit")
		"####" "#" 1
		Loop
	FloorHit:
		"####" "#" 0 A_PlaySound("weapons/gundropflesh", 7, 1, 0, 1.5)
		"####" "#" 0 A_ScaleVelocity (0.5)
		"####" "#" 0 A_ChangeFlag("SPECIAL", true)
		"####" "#" 0 A_ChangeFlag("THRUACTORS", false)
		"####" "#" 0 A_SetUserVar("user_floorhit", 1)
		"####" "#" 0 A_Jump(256, "SpawnLoop")
		Goto SpawnLoop
	SpawnLoop:
// Play the armor's sprite animation.
		DEMB A 6
		DEMB A 6 Bright
		Loop
		
//------------------------------------------------------------------------------
	Use:
		TNT1 A 0
// Check to see if these boots have been activated once before.
		TNT1 A 0 A_JumpIfInventory("RLDemonicBootsUse",1,"BootsEquip")
		TNT1 A 0 A_Jump (256, "UseTokenRemoval")
		Goto UseTokenRemoval
		
	UseTokenGiven:
// Gives you the identifier that indicates what boots you are manipulating right now.
		TNT1 A 0 A_GiveInventory("RLDemonicBootsUse", 1)
// Check to see if you are already wearing boots and change the activation message.
		TNT1 A 0 A_Jump (256, "BootsWornCheck")
		Goto BootsWornCheck
		
	BootsEquipTokens:
		TNT1 A 0 A_TakeInventory("RLDemonicBootsUse",1)
		TNT1 A 0 A_TakeInventory("RLArmorInInventory",1)
// Give the Token and/or Bonus items that are used to define the boots as being worn.
		TNT1 A 0 A_GiveInventory("RLDemonicBootsToken",1)
		TNT1 A 0 A_GiveInventory("PowerRLDemonicBootsProtection",1)
		TNT1 A 0 A_GiveInventory("RLBootsWorn",1)
		TNT1 A 0 A_Jump (256, "EquipFinish")
		Goto EquipFinish

//------------------------------------------------------------------------------
// Equip messages are grouped down here.
	PickupDisplayMessage:
// Picking up boots, and you have room for it.
		"####" "#" 0 A_GiveInventory("RLUniqueItemFound",1, AAPTR_PLAYER1)
		TNT1 A 0 A_Print("Picked up the \cgDemonic Boots.", 2)
		Stop
	EquipFinish:
// Successfully wearing boots.
		TNT1 A 0 A_Print("\cgDemonic Boots \c-equipped.", 2)
		TNT1 A 0 ACS_NamedExecuteWithResult("RLDemonicSetBonusCheck", 1) // Checks for all parts of the set bonus, gives or removes it accordingly - argument is tic delay before checking
		Stop
		
	NotPickup:
// This is for when you walk over an armor you cannot pick up.
		TNT1 A 0 A_JumpIfInventory("DRLA_ArmorAntiLogFloodCheck",1,"NotPickup_NoPrint")
		TNT1 A 0 A_GiveInventory("DRLA_ArmorAntiLogFloodCheck")
		TNT1 A 0 A_Print("\cg= Demonic Boots =", 2, "CONFONT")
		Fail
		
//------------------------------------------------------------------------------
/*	SetBonusChecking:
		TNT1 A 0 A_GiveInventory("RLDemonicSetBonusBoots",1)
		TNT1 A 0 A_JumpIfInventory("RLDemonicSetBonusArmor",1,"SetBonusCheckingDetection")
		Stop
	SetBonusCheckingDetection:
		TNT1 A 0 A_JumpIfInventory("RLDemonicSetBonusArmor",1,1)
		Stop
		TNT1 A 0 A_GiveInventory("RLDemonicSetBonusActive",1)
		TNT1 A 0 A_Print("\cgDemonic Boots \c-equipped.\n\cf= DEMONIC VENGEANCE =\n\cgCan fire homing plasmatic doom from your armor", 8, "CONFONT")
		Stop*/
//------------------------------------------------------------------------------
// Color code reference
// j = Standard (White)
// t = Exotic (Purple)
// v = Assembled (Cyan)
// i = Superior (Orange)
// d = Unique (Green)
// g = Demonic (Red)
// k = Legendary (Yellow)
// u = Onyx (Dark Gray)
	}
}

ACTOR RLDemonicBootsWorldSpawnPickup : RLDemonicBootsPickup 19032
{
    Inventory.InterHubAmount 0
    Inventory.MaxAmount 0
	+INVENTORY.AUTOACTIVATE
	States
	{
	SpawnRarityBeam:
// Check for DoomRPG, if found, skip the check for special starts. If the armor shouldn't spawn, we need to skip the thunder sound.
		TNT1 A 0 A_JumpIf(CallACS("DRPGCheckTiem"), 2)
		TNT1 A 0 A_JumpIf(CallACS("DRLA_specialstarts") == 2, "Duke2Stuff")
// This makes a thunder sound when it spawns, and emits twinkling noises every now and then to alert players.
		TNT1 A 0 A_SpawnItemEx("RLRarityBeamDemonicWorld", 0,0,0, 0,0,0, 0, SXF_SETMASTER)
		TNT1 A 0 A_PlaySound("weapons/demonicspawned", 7, 0.25, 0, 0)
		TNT1 A 0 A_GiveInventory("RLDemonicItemSpawnMessageSender",1)
		TNT1 A 0 A_Jump (256, "SpawnDRPGCheck")
		Goto SpawnDRPGCheck
//------------------------------------------------------------------------------
	Pickup:
		TNT1 A 0
// Check to see if you have the capacity to pickup these boots.
		TNT1 A 0 A_JumpIfInventory("RLArmorInInventory",0,"NotPickup")
		TNT1 A 0 A_GiveInventory("RLDemonicBootsPickup",1)
// Activates demonic boss system and increases dangerlevel
		TNT1 A 0 A_GiveInventory("RLDemonicItemFound",1, AAPTR_PLAYER1)
		TNT1 A 0 A_GiveInventory("RLDangerLevelDemonicGiver",1, AAPTR_PLAYER1)
		Stop
//------------------------------------------------------------------------------
	Use:
		Stop	
	}
}

ACTOR RLDemonicBootsPickupSpecial : RLDemonicBootsPickup
{
    Inventory.InterHubAmount 0
    Inventory.MaxAmount 0
	+INVENTORY.AUTOACTIVATE
	States
	{
	SpawnDRPGCheck:
// Initialize the item with DoomRPG so it can be used with cool stuff.
// We skip the special start checks so we don't make infinite loops.
		TNT1 A 0 A_JumpIf(CallACS("DRPGCheckTiem"), "DRPGInit")
		TNT1 A 0 A_Jump (256, "SpawnLoopFall")
		Goto SpawnLoopFall	
//------------------------------------------------------------------------------
	Pickup:
		TNT1 A 0
// Check to see if you have the capacity to pickup these boots.
//		TNT1 A 0 A_JumpIf(CallACS("DRPGCheckTiem"), "PickupNonLimited")
		TNT1 A 0 A_JumpIfInventory("RLArmorInInventory",0,"NotPickup")
		TNT1 A 0 A_GiveInventory("RLDemonicBootsPickup",1)
		Stop
		
	PickupNonLimited:
		TNT1 A 0
// Check to see if you have the capacity to pickup these boots.
        TNT1 A 0 ACS_NamedExecuteWithResult("CheckCapacity") // Special Capacity checking function for armor
		TNT1 A 0 A_GiveInventory("RLDemonicBootsPickup",1)
		Stop
//------------------------------------------------------------------------------
	Use:
		Stop	
	}
}
	
actor PowerRLDemonicBootsProtection : PowerRLGenericBootsProtection
{
   damagefactor "Slime", 0.2
}

Actor RLDemonicBootsToken : RLPermanentInventory {}
Actor RLDemonicBootsUse : RLPermanentInventory {}

//==============================================================================
