
//==============================================================================================================================================
//==============================================================================
//		DEMONIC ARMORS
//==============================================================================
//==============================================================================================================================================


ACTOR RLDemonicCarapaceArmorPickup : RLGenericArmorPickup
{
    //$category "Demonic Armor"
	//$Sprite DEMAA0
    Tag "Demonic Carapace"
    Inventory.Icon "DEMABOX"
	Inventory.PickupSound "misc/rlarmor4"
	Inventory.UseSound "armor/equip"
	Inventory.RespawnTics 105000
	+DONTGIB
	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:
		DEMA 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.25)
		"####" "#" 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.
		DEMA A 6
		DEMA A 6 Bright
		Loop
			
//------------------------------------------------------------------------------
// Apply an Onyx mod to the armor in your inventory.
// Or not.
	OnyxModActivate:
		TNT1 A 0 A_GiveInventory("RLDeselectionFunction",1)
		TNT1 A 0 A_PlaySound ("hud/error", 7, 1)
		TNT1 A 0 A_Print("This armor cannot be made \cuindestructible.\c-")
		Fail
		
//------------------------------------------------------------------------------
	ArmorModReconfigure:
// This armor can't be reconfigured, so throw out an error and don't activate the armor or anything.
		TNT1 A 0 A_GiveInventory("RLDeselectionFunction",1)
		TNT1 A 0 A_PlaySound ("hud/error", 7, 1)
		TNT1 A 0 A_Print("This armor is not a reconfigurable\ntype of armor.")
		Fail
		
//------------------------------------------------------------------------------
// These two states are used to detect armor modpacks if the armor can be altered.
// These states only need to be redefined if the armor cannot be converted with them.
	ArmorAlreadyEquipped:
// You are wearing armor, but you can still drop the armor you are manipulating.
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItem", 1, "ArmorAlreadyEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemBlue", 1, "ArmorAlreadyEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemRed", 1, "ArmorAlreadyEquippedArmorMod")
		TNT1 A 0 A_Jump (256, "ArmorAlreadyEquippedMessage")
		Goto ArmorAlreadyEquippedMessage
	NoArmorEquipped:
// You are free to either wear the armor or drop it.
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItem", 1, "NoArmorEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemBlue", 1, "NoArmorEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemRed", 1, "NoArmorEquippedArmorMod")
		TNT1 A 0 A_Jump (256, "NoArmorEquippedMessage")
		Goto NoArmorEquippedMessage
		
//------------------------------------------------------------------------------
	ArmorAlreadyEquippedMessage:
// Check for an Onyx mod in your inventory, and print a different string if there is.
// Comment out the jump if it cannot be Onyx modded.
//		TNT1 A 0 A_JumpIfInventory("RLOnyxModItem", 1, "ArmorAlreadyEquippedMessage2")
		TNT1 A 0 A_Jump (256, "ArmorAlreadyEquippedMessage1")
		Goto ArmorAlreadyEquippedMessage1
		
	ArmorAlreadyEquippedArmorMod:
// Check for an Onyx mod in your inventory, and print a different string if there is.
// Comment out the jump if it cannot be Onyx modded.
//		TNT1 A 0 A_JumpIfInventory("RLOnyxModItem", 1, "ArmorAlreadyEquippedArmorMod2")
		TNT1 A 0 A_Jump (256, "ArmorAlreadyEquippedArmorMod1")
		Goto ArmorAlreadyEquippedArmorMod1
		
	NoArmorEquippedMessage:
// Check for an Onyx mod in your inventory, and print a different string if there is.
// Comment out the jump if it cannot be Onyx modded.
//		TNT1 A 0 A_JumpIfInventory("RLOnyxModItem", 1, "NoArmorEquippedMessage2")
		TNT1 A 0 A_Jump (256, "NoArmorEquippedMessage1")
		Goto NoArmorEquippedMessage1
		
	NoArmorEquippedArmorMod:
// You may also convert it with an armor modpack.
// Check for an Onyx mod in your inventory, and print a different string if there is.
// Comment out the jump if it cannot be Onyx modded.
//		TNT1 A 0 A_JumpIfInventory("RLOnyxModItem", 1, "NoArmorEquippedArmorMod2")
		TNT1 A 0 A_Jump (256, "NoArmorEquippedArmorMod1")
		Goto NoArmorEquippedArmorMod1
		
//------------------------------------------------------------------------------
	NoArmorModpackActive:
// Check to see if this armor has been activated once before.
		TNT1 A 0 A_JumpIfInventory("RLDemonicCarapaceArmorUse",1,"ArmorEquip")
		TNT1 A 0 A_Jump (256, "UseTokenRemoval")
		Goto UseTokenRemoval
		
	UseTokenGiven:
// Gives you the identifier that indicates what armor you are manipulating right now.
		TNT1 A 0 A_GiveInventory("RLDemonicCarapaceArmorUse", 1)
// Check to see if you are already wearing armor and change the activation message.
		TNT1 A 0 A_Jump (256, "ArmorWornCheck")
		Goto ArmorWornCheck
		
	ArmorEquipTokens:
		TNT1 A 0 A_TakeInventory("RLDemonicCarapaceArmorUse",1)
		TNT1 A 0 A_TakeInventory("RLArmorInInventory",1)
// Give the Token and/or Bonus items that are used to define the armor as being worn.
		TNT1 A 0 A_GiveInventory("RLDemonicCarapaceArmorToken",1)
		TNT1 A 0 A_GiveInventory("RLDemonicCarapaceArmorBonus",1)
		TNT1 A 0 A_GiveInventory("RLIndestructibleArmorWorn",1)
// Give a different armor based on whether or not you are the Renegade.
		TNT1 A 0 A_JumpIfInventory("RLShellshockPerk",1,"RenegadeEquip")
		TNT1 A 0 A_GiveInventory("RLDemonicCarapaceArmor",1)
		TNT1 A 0 A_Jump (256, "EquipFinish")
		Goto EquipFinish
		
// The Renegade gets a version of the armor with 1.5x more protection, up to a max of 80%.
	RenegadeEquip:
		TNT1 A 0 A_GiveInventory("RLDemonicCarapaceArmorRenegade",1)
		TNT1 A 0 A_Jump (256, "EquipFinish")
		Goto EquipFinish

//------------------------------------------------------------------------------
// Equip messages are grouped down here.
	PickupDisplayMessage:
// Picking up an armor, and you have room for it.
		"####" "#" 0 A_GiveInventory("RLUniqueItemFound",1, AAPTR_PLAYER1)
		TNT1 A 0 A_Print("Picked up the \cgDemonic Carapace.", 2)
		Stop
	EquipFinish:
// Successfully wearing an armor.
		TNT1 A 0 A_Print("\cgDemonic Carapace \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
		
	ArmorAlreadyEquipped:
// You are wearing armor, but you can still drop the armor you are manipulating.
// Check for armor modpack modes that are compatible with this armor.
// Comment out the incompatible jumps.
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItem",1,"ArmorAlreadyEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemBlue",1,"ArmorAlreadyEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemRed",1,"ArmorAlreadyEquippedArmorMod")
		TNT1 A 0 A_Jump (256, "ArmorAlreadyEquippedMessage")
		Goto ArmorAlreadyEquippedMessage
	NoArmorEquipped:
// You are free to either wear the armor or drop it.
// Check for armor modpack modes that are compatible with this armor.
// Comment out the incompatible jumps.
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItem",1,"NoArmorEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemBlue",1,"NoArmorEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemRed",1,"NoArmorEquippedArmorMod")
		TNT1 A 0 A_Jump (256, "NoArmorEquippedMessage")
		Goto NoArmorEquippedMessage
		
	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 Carapace =", 2, "CONFONT")
		Fail
		
//------------------------------------------------------------------------------
/*	SetBonusChecking:
		TNT1 A 0 A_GiveInventory("RLDemonicSetBonusArmor",1)
		TNT1 A 0 A_JumpIfInventory("RLDemonicSetBonusBoots",1,"SetBonusCheckingDetection")
		Stop
	SetBonusCheckingDetection:
		TNT1 A 0 A_JumpIfInventory("RLDemonicSetBonusBoots",1,1)
		Stop
		TNT1 A 0 A_GiveInventory("RLDemonicSetBonusActive",1)
		TNT1 A 0 A_Print("\cgDemonic Carapace \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 RLDemonicCarapaceArmorWorldSpawnPickup : RLDemonicCarapaceArmorPickup 18072
{
    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 this armor.
		TNT1 A 0 A_JumpIfInventory("RLArmorInInventory",0,"NotPickup")
		TNT1 A 0 A_GiveInventory("RLDemonicCarapaceArmorPickup",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 RLDemonicCarapaceArmorPickupSpecial : RLDemonicCarapaceArmorPickup
{
    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 this armor.
//		TNT1 A 0 A_JumpIf(CallACS("DRPGCheckTiem"), "PickupNonLimited")
		TNT1 A 0 A_JumpIfInventory("RLArmorInInventory",0,"NotPickup")
		TNT1 A 0 A_GiveInventory("RLDemonicCarapaceArmorPickup",1)
		Stop
		
	PickupNonLimited:
		TNT1 A 0
// Check to see if you have the capacity to pickup this armor.
        TNT1 A 0 ACS_NamedExecuteWithResult("CheckCapacity") // Special Capacity checking function for armor
		TNT1 A 0 A_GiveInventory("RLDemonicCarapaceArmorPickup",1)
		Stop
//------------------------------------------------------------------------------
	Use:
		Stop	
	}
}
		
Actor RLDemonicCarapaceArmor : RLGenericArmor
{
  Armor.Savepercent 30
  Armor.Saveamount 99999
  DamageFactor "Melee", 0.90
  DamageFactor "Bullet", 0.90
  DamageFactor "Fire", 0.75
  DamageFactor "Plasma", 0.75
}
	
Actor RLDemonicCarapaceArmorRenegade : RLDemonicCarapaceArmor
{
  Armor.Savepercent 45
}

Actor RLDemonicCarapaceArmorToken : RLPermanentInventory {}
Actor RLDemonicCarapaceArmorBonus : RLPermanentInventory {}
Actor RLDemonicCarapaceArmorUse : RLPermanentInventory {}

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

ACTOR RLNecroArmorPickup : RLGenericArmorPickup
{
    //$category "Demonic Armor"
	//$Sprite NECRA0
    Tag "Necroarmor"
    Inventory.Icon "NECRBOX"
	Inventory.PickupSound "misc/rlarmor4"
	Inventory.UseSound "armor/equip"
	Inventory.RespawnTics 105000
	+DONTGIB
	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:
		NECR A 0 A_JumpIf(Abs(VelZ) <= 0.01 && user_floorhit == 0, "FloorHit")
		"####" "#" 1
		Loop
	SpawnLoop:
// Play the armor's sprite animation.
		NECR A 6
		NECR A 6 Bright
		Loop
			
//------------------------------------------------------------------------------
// Apply an Onyx mod to the armor in your inventory.
// Or not.
	OnyxModActivate:
		TNT1 A 0 A_GiveInventory("RLDeselectionFunction",1)
		TNT1 A 0 A_PlaySound ("hud/error", 7, 1)
		TNT1 A 0 A_Print("This armor cannot be made \cuindestructible.\c-")
		Fail
		
//------------------------------------------------------------------------------
	ArmorModReconfigure:
// This armor can't be reconfigured, so throw out an error and don't activate the armor or anything.
		TNT1 A 0 A_GiveInventory("RLDeselectionFunction",1)
		TNT1 A 0 A_PlaySound ("hud/error", 7, 1)
		TNT1 A 0 A_Print("This armor is not a reconfigurable\ntype of armor.")
		Fail
		
//------------------------------------------------------------------------------
// These two states are used to detect armor modpacks if the armor can be altered.
// These states only need to be redefined if the armor cannot be converted with them.
	ArmorAlreadyEquipped:
// You are wearing armor, but you can still drop the armor you are manipulating.
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItem", 1, "ArmorAlreadyEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemBlue", 1, "ArmorAlreadyEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemRed", 1, "ArmorAlreadyEquippedArmorMod")
		TNT1 A 0 A_Jump (256, "ArmorAlreadyEquippedMessage")
		Goto ArmorAlreadyEquippedMessage
	NoArmorEquipped:
// You are free to either wear the armor or drop it.
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItem", 1, "NoArmorEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemBlue", 1, "NoArmorEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemRed", 1, "NoArmorEquippedArmorMod")
		TNT1 A 0 A_Jump (256, "NoArmorEquippedMessage")
		Goto NoArmorEquippedMessage
		
//------------------------------------------------------------------------------
	ArmorAlreadyEquippedMessage:
// Check for an Onyx mod in your inventory, and print a different string if there is.
// Comment out the jump if it cannot be Onyx modded.
//		TNT1 A 0 A_JumpIfInventory("RLOnyxModItem", 1, "ArmorAlreadyEquippedMessage2")
		TNT1 A 0 A_Jump (256, "ArmorAlreadyEquippedMessage1")
		Goto ArmorAlreadyEquippedMessage1
		
	ArmorAlreadyEquippedArmorMod:
// Check for an Onyx mod in your inventory, and print a different string if there is.
// Comment out the jump if it cannot be Onyx modded.
//		TNT1 A 0 A_JumpIfInventory("RLOnyxModItem", 1, "ArmorAlreadyEquippedArmorMod2")
		TNT1 A 0 A_Jump (256, "ArmorAlreadyEquippedArmorMod1")
		Goto ArmorAlreadyEquippedArmorMod1
		
	NoArmorEquippedMessage:
// Check for an Onyx mod in your inventory, and print a different string if there is.
// Comment out the jump if it cannot be Onyx modded.
//		TNT1 A 0 A_JumpIfInventory("RLOnyxModItem", 1, "NoArmorEquippedMessage2")
		TNT1 A 0 A_Jump (256, "NoArmorEquippedMessage1")
		Goto NoArmorEquippedMessage1
		
	NoArmorEquippedArmorMod:
// You may also convert it with an armor modpack.
// Check for an Onyx mod in your inventory, and print a different string if there is.
// Comment out the jump if it cannot be Onyx modded.
//		TNT1 A 0 A_JumpIfInventory("RLOnyxModItem", 1, "NoArmorEquippedArmorMod2")
		TNT1 A 0 A_Jump (256, "NoArmorEquippedArmorMod1")
		Goto NoArmorEquippedArmorMod1
		
//------------------------------------------------------------------------------
	NoArmorModpackActive:
// Check to see if this armor has been activated once before.
		TNT1 A 0 A_JumpIfInventory("RLNecroArmorUse",1,"ArmorEquip")
		TNT1 A 0 A_Jump (256, "UseTokenRemoval")
		Goto UseTokenRemoval
		
	UseTokenGiven:
// Gives you the identifier that indicates what armor you are manipulating right now.
		TNT1 A 0 A_GiveInventory("RLNecroArmorUse", 1)
// Check to see if you are already wearing armor and change the activation message.
		TNT1 A 0 A_Jump (256, "ArmorWornCheck")
		Goto ArmorWornCheck
		
	ArmorEquipTokens:
		TNT1 A 0 A_TakeInventory("RLNecroArmorUse",1)
		TNT1 A 0 A_TakeInventory("RLArmorInInventory",1)
// Give the Token and/or Bonus items that are used to define the armor as being worn.
		TNT1 A 0 A_GiveInventory("RLNecroArmorToken",1)
		TNT1 A 0 A_GiveInventory("RL100ArmorWorn",1)
// Give a different armor based on whether or not you are the Renegade.
		TNT1 A 0 A_JumpIfInventory("RLShellshockPerk",1,"RenegadeEquip")
		TNT1 A 0 A_GiveInventory("RLNecroArmor",1)
		TNT1 A 0 A_Jump (256, "EquipFinish")
		Goto EquipFinish
		
// The Renegade gets a version of the armor with 1.5x more protection, up to a max of 80%.
	RenegadeEquip:
		TNT1 A 0 A_GiveInventory("RLNecroArmorRenegade",1)
		TNT1 A 0 A_Jump (256, "EquipFinish")
		Goto EquipFinish

//------------------------------------------------------------------------------
// Equip messages are grouped down here.
	PickupDisplayMessage:
// Picking up an armor, and you have room for it.
		"####" "#" 0 A_GiveInventory("RLUniqueItemFound",1, AAPTR_PLAYER1)
		TNT1 A 0 A_Print("Picked up the \cgNecroarmor.", 2)
		Stop
	EquipFinish:
// Successfully wearing an armor.
		TNT1 A 0 A_Print("\cgNecroarmor \c-equipped.", 2)
		Stop
		
	ArmorAlreadyEquipped:
// You are wearing armor, but you can still drop the armor you are manipulating.
// Check for armor modpack modes that are compatible with this armor.
// Comment out the incompatible jumps.
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItem",1,"ArmorAlreadyEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemBlue",1,"ArmorAlreadyEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemRed",1,"ArmorAlreadyEquippedArmorMod")
		TNT1 A 0 A_Jump (256, "ArmorAlreadyEquippedMessage")
		Goto ArmorAlreadyEquippedMessage
	NoArmorEquipped:
// You are free to either wear the armor or drop it.
// Check for armor modpack modes that are compatible with this armor.
// Comment out the incompatible jumps.
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItem",1,"NoArmorEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemBlue",1,"NoArmorEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemRed",1,"NoArmorEquippedArmorMod")
		TNT1 A 0 A_Jump (256, "NoArmorEquippedMessage")
		Goto NoArmorEquippedMessage
		
	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= Necroarmor =", 2, "CONFONT")
		Fail
//------------------------------------------------------------------------------
// 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 RLNecroArmorWorldSpawnPickup : RLNecroArmorPickup 18073
{
    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 this armor.
		TNT1 A 0 A_JumpIfInventory("RLArmorInInventory",0,"NotPickup")
		TNT1 A 0 A_GiveInventory("RLNecroArmorPickup",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 RLNecroArmorPickupSpecial : RLNecroArmorPickup
{
    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 this armor.
//		TNT1 A 0 A_JumpIf(CallACS("DRPGCheckTiem"), "PickupNonLimited")
		TNT1 A 0 A_JumpIfInventory("RLArmorInInventory",0,"NotPickup")
		TNT1 A 0 A_GiveInventory("RLNecroArmorPickup",1)
		Stop
		
	PickupNonLimited:
		TNT1 A 0
// Check to see if you have the capacity to pickup this armor.
        TNT1 A 0 ACS_NamedExecuteWithResult("CheckCapacity") // Special Capacity checking function for armor
		TNT1 A 0 A_GiveInventory("RLNecroArmorPickup",1)
		Stop
//------------------------------------------------------------------------------
	Use:
		Stop	
	}
}
		
Actor RLNecroArmor : RLGenericArmor
{
  Armor.Savepercent 60
  Armor.Saveamount 100
}
	
Actor RLNecroArmorRenegade : RLNecroArmor
{
  Armor.Savepercent 80
}

Actor RLNecroArmorToken : RLPermanentInventory {}
Actor RLNecroArmorUse : RLPermanentInventory {}

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

ACTOR RLSoulshatterArmorPickup : RLGenericArmorPickup
{
    //$category "Demonic Armor"
	//$Sprite SOLSA0
    Tag "Soulshatter Armor"
    Inventory.Icon "SOLSBOX"
	Inventory.PickupSound "misc/rlarmor3"
	Inventory.UseSound "armor/equip"
	Inventory.RespawnTics 105000
	+DONTGIB
	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:
		SOLS A 0 A_JumpIf(Abs(VelZ) <= 0.01 && user_floorhit == 0, "FloorHit")
		"####" "#" 1
		Loop
	SpawnLoop:
// Play the armor's sprite animation.
		SOLS A 6
		SOLS A 6 Bright
		Loop
			
//------------------------------------------------------------------------------
// Apply an Onyx mod to the armor in your inventory.
// Or not.
	OnyxModActivate:
		TNT1 A 0 A_GiveInventory("RLDeselectionFunction",1)
		TNT1 A 0 A_PlaySound ("hud/error", 7, 1)
		TNT1 A 0 A_Print("This armor cannot be made \cuindestructible.\c-")
		Fail
		
//------------------------------------------------------------------------------
	ArmorModReconfigure:
// This armor can't be reconfigured, so throw out an error and don't activate the armor or anything.
		TNT1 A 0 A_GiveInventory("RLDeselectionFunction",1)
		TNT1 A 0 A_PlaySound ("hud/error", 7, 1)
		TNT1 A 0 A_Print("This armor is not a reconfigurable\ntype of armor.")
		Fail
		
//------------------------------------------------------------------------------
// These two states are used to detect armor modpacks if the armor can be altered.
// These states only need to be redefined if the armor cannot be converted with them.
	ArmorAlreadyEquipped:
// You are wearing armor, but you can still drop the armor you are manipulating.
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItem", 1, "ArmorAlreadyEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemBlue", 1, "ArmorAlreadyEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemRed", 1, "ArmorAlreadyEquippedArmorMod")
		TNT1 A 0 A_Jump (256, "ArmorAlreadyEquippedMessage")
		Goto ArmorAlreadyEquippedMessage
	NoArmorEquipped:
// You are free to either wear the armor or drop it.
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItem", 1, "NoArmorEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemBlue", 1, "NoArmorEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemRed", 1, "NoArmorEquippedArmorMod")
		TNT1 A 0 A_Jump (256, "NoArmorEquippedMessage")
		Goto NoArmorEquippedMessage
		
//------------------------------------------------------------------------------
	ArmorAlreadyEquippedMessage:
// Check for an Onyx mod in your inventory, and print a different string if there is.
// Comment out the jump if it cannot be Onyx modded.
//		TNT1 A 0 A_JumpIfInventory("RLOnyxModItem", 1, "ArmorAlreadyEquippedMessage2")
		TNT1 A 0 A_Jump (256, "ArmorAlreadyEquippedMessage1")
		Goto ArmorAlreadyEquippedMessage1
		
	ArmorAlreadyEquippedArmorMod:
// Check for an Onyx mod in your inventory, and print a different string if there is.
// Comment out the jump if it cannot be Onyx modded.
//		TNT1 A 0 A_JumpIfInventory("RLOnyxModItem", 1, "ArmorAlreadyEquippedArmorMod2")
		TNT1 A 0 A_Jump (256, "ArmorAlreadyEquippedArmorMod1")
		Goto ArmorAlreadyEquippedArmorMod1
		
	NoArmorEquippedMessage:
// Check for an Onyx mod in your inventory, and print a different string if there is.
// Comment out the jump if it cannot be Onyx modded.
//		TNT1 A 0 A_JumpIfInventory("RLOnyxModItem", 1, "NoArmorEquippedMessage2")
		TNT1 A 0 A_Jump (256, "NoArmorEquippedMessage1")
		Goto NoArmorEquippedMessage1
		
	NoArmorEquippedArmorMod:
// You may also convert it with an armor modpack.
// Check for an Onyx mod in your inventory, and print a different string if there is.
// Comment out the jump if it cannot be Onyx modded.
//		TNT1 A 0 A_JumpIfInventory("RLOnyxModItem", 1, "NoArmorEquippedArmorMod2")
		TNT1 A 0 A_Jump (256, "NoArmorEquippedArmorMod1")
		Goto NoArmorEquippedArmorMod1
		
//------------------------------------------------------------------------------
	NoArmorModpackActive:
// Check to see if this armor has been activated once before.
		TNT1 A 0 A_JumpIfInventory("RLSoulshatterArmorUse",1,"ArmorEquip")
		TNT1 A 0 A_Jump (256, "UseTokenRemoval")
		Goto UseTokenRemoval
		
	UseTokenGiven:
// Gives you the identifier that indicates what armor you are manipulating right now.
		TNT1 A 0 A_GiveInventory("RLSoulshatterArmorUse", 1)
// Check to see if you are already wearing armor and change the activation message.
		TNT1 A 0 A_Jump (256, "ArmorWornCheck")
		Goto ArmorWornCheck
		
	ArmorEquipTokens:
		TNT1 A 0 A_TakeInventory("RLSoulshatterArmorUse",1)
		TNT1 A 0 A_TakeInventory("RLArmorInInventory",1)
// Give the Token and/or Bonus items that are used to define the armor as being worn.
		TNT1 A 0 A_GiveInventory("RLSoulshatterArmorToken",1)
		TNT1 A 0 A_GiveInventory("RLSoulshatterArmorBonus",1)
		TNT1 A 0 A_GiveInventory("RLIndestructibleArmorWorn",1)
// Give a different armor based on whether or not you are the Renegade.
		TNT1 A 0 A_JumpIfInventory("RLShellshockPerk",1,"RenegadeEquip")
		TNT1 A 0 A_GiveInventory("RLSoulshatterArmor",1)
		TNT1 A 0 A_Jump (256, "EquipFinish")
		Goto EquipFinish
		
// The Renegade gets a version of the armor with 1.5x more protection, up to a max of 80%.
	RenegadeEquip:
		TNT1 A 0 A_GiveInventory("RLSoulshatterArmorRenegade",1)
		TNT1 A 0 A_Jump (256, "EquipFinish")
		Goto EquipFinish

//------------------------------------------------------------------------------
// Equip messages are grouped down here.
	PickupDisplayMessage:
// Picking up an armor, and you have room for it.
		"####" "#" 0 A_GiveInventory("RLUniqueItemFound",1, AAPTR_PLAYER1)
		TNT1 A 0 A_Print("Picked up the \cgSoulshatter Armor.", 2)
		Stop
	EquipFinish:
// Successfully wearing an armor.
		TNT1 A 0 A_Print("\cgSoulshatter Armor \c-equipped.", 2)
		Stop
		
	ArmorAlreadyEquipped:
// You are wearing armor, but you can still drop the armor you are manipulating.
// Check for armor modpack modes that are compatible with this armor.
// Comment out the incompatible jumps.
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItem",1,"ArmorAlreadyEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemBlue",1,"ArmorAlreadyEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemRed",1,"ArmorAlreadyEquippedArmorMod")
		TNT1 A 0 A_Jump (256, "ArmorAlreadyEquippedMessage")
		Goto ArmorAlreadyEquippedMessage
	NoArmorEquipped:
// You are free to either wear the armor or drop it.
// Check for armor modpack modes that are compatible with this armor.
// Comment out the incompatible jumps.
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItem",1,"NoArmorEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemBlue",1,"NoArmorEquippedArmorMod")
//		TNT1 A 0 A_JumpIfInventory("RLArmorModItemRed",1,"NoArmorEquippedArmorMod")
		TNT1 A 0 A_Jump (256, "NoArmorEquippedMessage")
		Goto NoArmorEquippedMessage
		
	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= Soulshatter Armor =", 2, "CONFONT")
		Fail
//------------------------------------------------------------------------------
// 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 RLSoulshatterArmorWorldSpawnPickup : RLSoulshatterArmorPickup 18074
{
    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 this armor.
		TNT1 A 0 A_JumpIfInventory("RLArmorInInventory",0,"NotPickup")
		TNT1 A 0 A_GiveInventory("RLSoulshatterArmorPickup",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 RLSoulshatterArmorPickupSpecial : RLSoulshatterArmorPickup
{
    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 this armor.
//		TNT1 A 0 A_JumpIf(CallACS("DRPGCheckTiem"), "PickupNonLimited")
		TNT1 A 0 A_JumpIfInventory("RLArmorInInventory",0,"NotPickup")
		TNT1 A 0 A_GiveInventory("RLSoulshatterArmorPickup",1)
		Stop
		
	PickupNonLimited:
		TNT1 A 0
// Check to see if you have the capacity to pickup this armor.
        TNT1 A 0 ACS_NamedExecuteWithResult("CheckCapacity") // Special Capacity checking function for armor
		TNT1 A 0 A_GiveInventory("RLSoulshatterArmorPickup",1)
		Stop
//------------------------------------------------------------------------------
	Use:
		Stop	
	}
}
		
Actor RLSoulshatterArmor : RLGenericArmor
{
  Armor.Savepercent 50
  Armor.Saveamount 99999
  DamageFactor "Melee", 0.60
  DamageFactor "Bullet", 1.00
  DamageFactor "Fire", 0.65
  DamageFactor "Plasma", 0.90
}
	
Actor RLSoulshatterArmorRenegade : RLSoulshatterArmor
{
  Armor.Savepercent 75
}

Actor RLSoulshatterArmorToken : RLPermanentInventory {}
Actor RLSoulshatterArmorBonus : RLPermanentInventory {}
Actor RLSoulshatterArmorUse : RLPermanentInventory {}

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