#library "NXCOMP" //NEXUS COMPATIBILITY
#include "zcommon.acs"

//Compatibility script file, this needs to be changed if:
//-You have changed weapons, it might need to be changed here as well
//-Adding new armors or changing current ones's code
//-Changing the runes such as Legendary Rune etc

//-----INTERMISSION MUSIC------

#define MUSMAGICNUM 65 //Increase or decrease these values if more or less monsters are added to the strings
#define MUSENRAGENUM 48
#define MUSNEMESISNUM 144
#define MUSSPOOKNUM 17
#define MUSBOSSNUM 99
#define MUSBIGNUM 94

Str MUSMAGIC[MUSMAGICNUM] =
{//The monsters strings... change if necessary for intermission music compatibility
"INFLegendaryImp", "INFLegendaryPhaseImp", "LegendaryCatharsi", "LegendarySoul2",
"LegendaryAnnihilatorImp", "INFLegendarySuperShotgunZombie", "INFLegendaryFiend", "INFLegendaryApparition",
"INFLegendaryLurker", "LegendaryNightmare", "LegendaryDesertHornet", "INFLegendaryNecromancer",
"BloodyFlandre", "Lamia", "Uroboros", "9",
"INFLegendaryTormentor", "INFLegendaryBabyDemolisher", "INFLegendaryBabySentient", "INFLegendaryRedeemer",
"EpicLegendaryBabyDemolisher", "INFLegendaryBehemoth", "INFLegendaryRevenant", "SanaeKochiyaDeathAnimation",
"INFLegendaryHellKnight", "INFLegendaryAfrit", "INFLegendaryArchon", "INFLegendaryCybruiser",
"INFLegendaryCyberNoble", "LegendaryBelphegor", "INFLegendaryArchVile", "CLLesserCardinalStandAlone",
"CLBabySentientStandAlone", "INFLegendaryCrusader", "INFLegendaryVessel", "INFLegendaryKrieger",
"LegendaryKaguya", "LegendaryHeroSoulNEO", "INFTrueLegendaryImp", "INFTrueLegendaryPhaseImp",

"TrueLegendaryCatharsi", "INFTrueLegendarySoul", "TrueLegendaryAnnihilatorImp", "EpicTrueLegendaryAnnihilatorImp",
"INFTrueLegendaryApparition", "INFTrueLegendaryLurker", "TrueLegendaryNightmare", "INFTrueLegendaryFiend",
"INFTrueLegendaryRedeemer", "INFTrueLegendaryNecromancer", "INFTrueLegendaryTormentor", "INFTrueLegendaryBabyDemolisher",
"INFAltTrueLegendaryBabySentient", "TLBSstandalone", "INFTrueLegendaryBehemoth", "INFTrueLegendaryHeroSoul",
"INFTrueLegendaryRevenant", "INFTrueLegendaryHellKnight", "INFTrueLegendaryAfrit", "INFTrueLegendaryArchon",
"INFTrueLegendaryCybruiser", "INFTrueLegendaryCyberNoble", "INFTrueLegendaryArchVile", "INFTrueLegendaryCrusader",
"INFTrueLegendaryVessel"
};

Str MUSENRAGE[MUSENRAGENUM] =
{
"INFEnragedLegendaryImp", "INFEnragedLegendaryImp2", "EnragedLegendarySoul",  "INFCerebralShadowBoss2",
"EnragedLegendaryPhaseImp", "EnragedLegendaryPhaseImp2", "FakeEnragedLegendaryPhaseImp", "EnragedLegendaryCyberImp",
"EnragedLegendaryCyberImp2", "EnragedLegendaryCyberImpAwakened", "INFEnragedLegendaryFiend", "INFEnragedLegendaryFiend2",
"INFEnragedLegendaryRedeemer", "INFCerebralShadowBoss", "INFMakaiSlut", "INFMakaiSlut2",
"INFEnragedLegendaryRedeemer2", "INFEnragedLegendaryNecromancer", "INFEnragedLegendaryNecromancer2", "INFEnragedLegendaryTormentor",
"INFEnragedLegendaryTormentor2", "INFEnragedLegendaryBabySentient", "INFEnragedLegendaryBabySentient2", "INFEnragedLegendaryBehemoth",
"INFEnragedLegendaryBehemoth2", "INFEnragedLegendaryRevenant", "INFEnragedLegendaryRevenant2", "INFEnragedLegendaryHellKnight",
"INFEnragedLegendaryHellKnight2", "INFEnragedLegendaryAfrit", "INFEnragedLegendaryAfrit2", "INFEnragedLegendaryArchon",
"INFEnragedLegendaryArchon2", "EnragedLegendaryBelphegor", "INFEnragedLegendaryBelphegor2", "INFEnragedLegendaryCybruiser",
"INFManipulatorStandalone", "INFManipulatorStandalone2", "INFLordAsmodeus", "INFLordAsmodeus2",
"INFEnragedLegendaryCybruiser2", "INFEnragedLegendarySummoner", "INFEnragedLegendarySummoner2", "NemesisBloodMage",
"NemesisBloodMage2", "Medeus", "Medeus2", "MedeusBoss"
};

Str MUSNEMESIS[MUSNEMESISNUM] =
{
"INFNemesisImp", "INFNemesisImp2", "NemesisSoul", "INFNemesisGeneralRoasterock2",
"NemesisRevolverZombie2", "NemesisCowboy", "NemesisCowboy2", "INFNemesisZombie",
"INFNemesisZombie2", "Chameleon", "Chameleon2", "NemesisBandit",
"INFNemesisAssaultCaptain2", "NemesisLieutenant", "NemesisLieutenant2", "NemesisPhaseImp",
"INFNemesisPhaseImp2", "INFNemesisSuperShotgunZombie", "INFNemesisSuperShotgunZombie2", "INFNemesisCommando",
"INFNemesisCommando2", "INFNemesisStealthTrooper", "INFNemesisStealthTrooper2", "NemesisGeneral",
"NemesisGeneral2", "INFNemesisRebelSoldier", "INFNemesisRebelSoldier2", "INFNemesisFiend",
"INFNemesisFiend2", "NemesisUberCommando", "NemesisUberCommando2", "NemesisGeneralRoasterock",
"INFNemesisSuicideBomber", "INFNemesisSuicideBomber2", "INFNemesisChainsawZombie", "INFNemesisChainsawZombie2",
"CursedImp", "CursedImp2", "CursedZombie", "CursedZombie2",

"CursedRevenant", "CursedRevenant2", "INFObliterator", "INFObliterator2",
"INFDementedCydestroyer", "INFDementedCydestroyer2", "INFAtomicSoul", "INFAtomicSoul2", 
"INFNemesisDefiler", "INFNemesisDefiler2", "NemesisBandit2", "INFNemesisAssaultCaptain",
"NemesisRedeemer", "NemesisRedeemer2", "INFNemesisTormentor", "INFNemesisTormentor2",
"INFNemesisBabySentient", "INFNemesisBabySentient2", "INFNemesisBehemoth", "INFNemesisBehemoth2",
"INFNemesisRevenant", "INFNemesisRevenant2", "NemesisSummonerRevenant", "NemesisSummonerRevenant2",
"INFNemesisHellKnight", "INFNemesisHellKnight2", "INFNemesisCyberNoble", "INFNemesisCyberNoble2",
"NemesisAssaultKnight", "NemesisAssaultKnight2", "CursedHellKnight", "CursedHellKnight2",
"NemesisBelphegor", "INFNemesisBelphegor2", "INFNemesisExile", "INFNemesisExile2",
"NemesisKrieger", "NemesisKrieger2", "CursedCyberNoble", "CursedCyberNoble2",

"INFInsanityClockworkCydestroyer", "INFInsanityClockworkCydestroyer2", "INFVexedNemesisImp", "INFVexedNemesisImp2", 
"INFVexedNemesisSoul", "INFVexedNemesisSoul2", "VexedNemesisLieutenant", "VexedNemesisLieutenant2",
"VexedNemesisRevolverZombie", "INFVexedNemesisRevolverZombie2", "VexedNemesisCowboy", "INFVexedNemesisCowboy2",
"INFVexedNemesisZombie", "INFVexedNemesisZombie2", "INFVexedNemesisAssaultCaptain", "INFVexedNemesisAssaultCaptain2",
"VexedNemesisPhaseImp", "INFVexedNemesisPhaseImp2", "INFVexedNemesisSuperShotgunZombie", "INFVexedNemesisSuperShotgunZombie2",
"INFVexedNemesisCommando", "INFVexedNemesisCommando2", "Marauder", "INFMarauder2",
"INFVexedNemesisStealthTrooper", "INFVexedNemesisStealthTrooper2", "VexedNemesisGeneral", "INFVexedNemesisGeneral2",
"INFVexedNemesisRebelSoldier", "INFVexedNemesisRebelSoldier2", "INFVexedNemesisFiend", "INFVexedNemesisFiend2",
"VexedNemesisUberCommando", "INFVexedNemesisUberCommando2", "VexedNemesisGeneralRoasterock", "INFVexedNemesisGeneralRoasterock2",
"INFVexedNemesisSuicideBomber", "INFVexedNemesisSuicideBomber2", "INFVexedNemesisChainsawZombie", "INFVexedNemesisChainsawZombie2",

"INFVexedNemesisRedeemer", "INFVexedNemesisRedeemer2", "INFVexedNemesisTormentor", "INFVexedNemesisTormentor2",
"INFVexedNemesisBabySentient", "INFVexedNemesisBabySentient2", "INFVexedNemesisGoliath", "INFVexedNemesisGoliath2",
"INFVexedNemesisRevenant", "INFVexedNemesisRevenant2", "INFVexedNemesisArchon", "INFVexedNemesisArchon2",
"INFVexedNemesisCydestroyer", "INFVexedNemesisCydestroyer2", "VexedNemesisAssaultDestroyer", "INFVexedNemesisAssaultDestroyer2",
"INFNemesisDoomSlayer2", "INFVexedNemesisDoomSlayer", "INFVexedNemesisDoomSlayer2", "INFNemesisDoomSlayer",

//INFINITY GODS Compatibility
"DarkVoidAssassin", "DarkVoidAssassinVoidSouls", "VoidKrieger", "DarkVoidBaron"
};

Str MUSBOSS[MUSBOSSNUM] =
{
"LegendaryHellSmith", "NemesisTerminator", "ArmamentArmedArmForm3", "ArmamentArmedArm2",
"INFCerebralCardihilator", "CerebralCardihilation", "ChaosStormCauser", "Hulk",
"INFHellfrostCardihilator", "INFHellFrostCyberdemon", "DarkInquisitor", "PhaseFoldingFan",
"CorruptedFan", "NewDarkInquisitor", "INFCorruptedCardinal", "INFCorruptedSentient",
"INFHellfrostSentient", "INFSacrosanctOverseer", "ElKing", "Nifara",
"INFLegendaryCyberdemon", "INFExos", "OMEGA_BARNEY", "INFSirUndead1",
"NewPhaseCyberdemon", "HellfrostAnnihilator", "INFInsaneWritheQueen", "ActuallyGoodLegendaryDemolisher",
"INFLegendarySentient", "PranksterLegendarySentient", "INFDeathLord", "BlueCardihilator",
"INFUtsuho", "INFTheLastPlague", "INFLegendaryAnnihilator", "ClockworkBanelord2",
"INFEnragedLegendaryCyberdemon", "INFEnragedLegendaryCyberdemon2", "EnragedLegendaryCardinal", "INFEnragedLegendaryCardinal2",

"INFEnragedLegendarySentient", "INFEnragedLegendarySentient2", "ArmamentArmedArm", "ArmamentArmedArmForm2",
"INFNemesisCyberdemon", "INFNemesisCyberdemon2", "SandStorm", "Sandstorm2",
"NemesisAnnihilator", "NemesisAnnihilator2", "TeleporterFastBFG10kCyberDemon", "TeleporterFastBFG10kCyberDemon2",
"INFNemesisSentient", "INFNemesisSentient2", "VexedNemesisDemolisher", "VexedNemesisDemolisher2",
"Jorg", "Jorg2", "HeavyLandCarrier", "HeavyLandCarrier2",
"Makron", "Maephisto2", "INFMaephisto2", "INFEnragedLegendaryCardihilator",
"INFEnragedLegendaryCardihilator2", "PhaseTerminator", "PhaseTerminator2", "ClockworkBanelord",
"INFArcradimus", "INFArcradimus2", "INFHellsMinister", "INFHellsMinister2",
"INFCyberdemonCommander2", "INFRMTerminator", "INFRMTerminator2", "INFDementedTerminator",
"INFDementedTerminator2", "INFMoloch", "INFEvaccanniaDOOM", "Hulk2",

"INFMoloch2", "INFLegendaryTerminator", "NemesisTerminator2", "INFLordOfInsanity2",
"INFEnragedLegendaryTerminator", "INFEnragedLegendaryTerminator2", "INFCorruption", "INFCorruption2",
"INFLordArchon", "INFLordArchon2", "INFLordOfInsanity",

//INFINITY GODS Compatibility
"VoidReaper", "TrueLegendaryCybruiserVoidPower", "TrueLegendaryArchonVoidPower", "TrueLegendaryDoomguyVoidPower",
"TrueLegendaryChainsawZombieVoidPower", "TrueLegendaryCrusaderVoidPower", "TrueLegendaryNecromancerVoidPower", "TrueLegendaryKriegerVoidPower"
};

Str MUSSPOOK[MUSSPOOKNUM] =
{
"INFVexedNemesisSoul", "INFVexedNemesisSoul2", "NaziPoltergeist", "NaziPoltergeist2",
"Exetior", "WeaverBonnie", "NexusBloodeye", "NexusCorrupt",
"JitterSkull", "Clowny", "HellFrostBite", "VexedNemesisExileFinal",
"TerrorZombie", "TerrorZombie2", "TerrorZombieRing", "SamaraDeathCall2",
"INFUndeadMakaiSlut"
};

Str MUSBIG[MUSBIGNUM] =
{
"INFMainyu", "INFMainyu2", "NemesisRemilia", "NemesisRemilia2",
"INFMagaReimu", "INFMagaReimu2", "INFHibachi", "INFHibachi2",
"TerrorShamanImp", "TerrorShamanImp2", "TerrorShamanImpRing", "INFTrueLegendaryCyberdemon",
"INFTrueLegendaryCardinal", "TrueLegendaryDemolisher", "INFTrueLegendarySentient", "INFTrueLegendaryTerminator",
"INFTrueLegendaryCyberdemonNormal", "INFNewOverlord", "INFNewOverlord2", "INFAbyssalSatyr",
"INFAbyssalSatyr2", "INFHellFireCyberdemon", "INFHellFireCyberdemon2", "INFHellsmith",
"INFHellsmith2", "BadTrueLegendaryAnnihilator", "BadTrueLegendaryAnnihilator2", "TrueLegendaryAnnihilator",
"TarmidhesHosavo", "TarmidhesHosavo2", "Pain", "Pain2",
"INFVexedNemesisCardinal", "VexedNemesisTerminator", "VexedNemesisCyberdemon", "INFVexedNemesisSentient",
"VexedNemesisHellsmith", "Mokou", "Mokou2", "INFCerebralCommander",

"INFCerebralCommander2", "INFActuallyGoodHeresiarch", "INFActuallyGoodHeresiarch2", "INFLegendaryRevival",
"INFLegendaryRevival2", "INFLegendaryRevival3", "INFNewNemesisCardinal2", "INFNemHellsmith",
"INFNemHellsmith2", "INFNewNemesisCardinal", "INFCyberSmith", "INFCyberSmith2", 
"INFNewCorruptedLegendaryCardinal2", "INFCorruptedLegendarySentient", "INFCorruptedLegendarySentient2", "INFNewCorruptedLegendaryCardinal", 
"INFNewHellfireSentient", "ZamasuCyberDemon", "ZamasuCyberDemon2", "INFNewHellfireSentient2", 
"INFHellfireAracnorbQueen", "INFHellFireCardinal", "INFCyberdemonCommander",

//INFINITY GODS Compatibility (someone here has been cooking with gas)
"DivineDoomguyBase", "INFDivineDoomguy", "DivineDoomguyBloodlusted", "INFVoidDemigod","VexedNemesisRemilia", 
"KaynBase", "INFKayn","PrimeKayn","INFPrimeKayn", "INFDivineHellsmith", "BloodGodCardinal","INFBloodGodHellsmith","TrueLegendaryHellSmith", 
"VoidCyberdemon", "INFGodKingDarius","INFDivineGodCardinal", "DarkVoidTerminator","ZamasuGodDoomguy","ZamasuGodCardinal","INFInsanityBloodDoomSlayer",
"DarkVoidGod","INFDarkVoidGod","PromisedGodDoomSlayer","INFPromisedGodDoomSlayer", "DivineTrueLegendaryCardinal", "TrueDarkLegendaryCyberdemon", "TrueDarkLegendaryTerminator"
,"TruePromisedGodDoomSlayer","BloodMoonGod","INFBloodMoonGod","WillOfInfinityGods"
};

//Cut boss
/*
"INFActuallyGoodLegendaryDoomguyPlusTrueForm", "ClassicLegendaryDoomguy", "INFTrueLegendaryDoomguy", "ActuallyBadEnragedLegendaryDoomguy",
"ActuallyBadEnragedLegendaryDoomguy2", "EnragedLegendaryDoomguy", "EnragedLegendaryDoomguy2", "INFHackroidZombie",
"INFHackroidZombie2", "INFHackroidAssaultCaptain", "INFHackroidAssaultCaptain2", "HackroidBeheadedKamikaze",
"HackroidBeheadedKamikaze2",
*/

//Information scripts
Script "CountMagicNum" (Void) { SetResultValue(MUSMAGICNUM); }
Script "CountEnragedNum" (Void) { SetResultValue(MUSENRAGENUM); }
Script "CountNemesisNum" (Void) { SetResultValue(MUSNEMESISNUM); }
Script "CountBossNum" (Void) { SetResultValue(MUSBOSSNUM); }
Script "CountSpookNum" (Void) { SetResultValue(MUSSPOOKNUM); }
Script "CountBigBossNum" (Void) { SetResultValue(MUSBIGNUM); }

Script "GetMagicBoss" (Int i) { If(StrIcmp(GetActorClass(0),MUSMAGIC[i]) == 0) SetResultValue(2); }
Script "GetEnragedBoss" (Int i) { If(StrIcmp(GetActorClass(0),MUSENRAGE[i]) == 0) SetResultValue(2); }
Script "GetNemesisBoss" (Int i) { If(StrIcmp(GetActorClass(0),MUSNEMESIS[i]) == 0) SetResultValue(2); }
Script "GetBossBoss" (Int i) { If(StrIcmp(GetActorClass(0),MUSBOSS[i]) == 0) SetResultValue(2); }
Script "GetSpookBoss" (Int i) { If(StrIcmp(GetActorClass(0),MUSSPOOK[i]) == 0) SetResultValue(2); }
Script "GetBigBossBoss" (Int i) { If(StrIcmp(GetActorClass(0),MUSBIG[i]) == 0) SetResultValue(2); }


//------MEDAL REWARDS------
//Upon getting 100 monster ability kills you get a random reward (for bosskills it's 10)

Function void ShowMedalText (int mode)
{
SetFont("BIGFONT");
LocalAmbientSound("medals/reward",127);
LocalAmbientSound("medals/reward",127);
FadeRange(0,0,0,0,255,192,0,0.5,0.3);
FadeRange(255,192,0,0.5,0,0,0,0,0.3);
If(mode == 1) HudMessage(s:"\c[z3]10 BOSS KILLS REACHED! REWARD TIME!\c-";HUDMSG_FADEINOUT,4877+PlayerNumber(),CR_UNTRANSLATED,0.5,0.7,9.0,0.3,0.5);
Else HudMessage(s:"\c[z3]100 ABILITY KILLS REACHED! REWARD TIME!\c-";HUDMSG_FADEINOUT,4877+PlayerNumber(),CR_UNTRANSLATED,0.5,0.7,9.0,0.3,0.5);
}

//Kill Rewards
#define PRESNUM 9
#define CARDNUM 5
#define SUICIDENUM 4
#define BACKUPNUM 18

Str PRESENTS[PRESNUM] =
{ 
"NemesisPresentItem", "EnragedLegendaryPresentItem", "LegendaryPresentItem", "PhasePresentItem",
"DarkPresentItem", "GreenRedPresentItem", "WhiteRedPresentItem", "RedWhitePresentItem",
"RedGreenPresentItem" };

Str CARDS[CARDNUM] = { "AceofSpades", "AceofHearts", "AceofClubs", "AceofDiamonds", "JokerCard" };

Str SUICIDE[SUICIDENUM] = { "PlanC", "PlanN", "SuicideKing", "AncientRecall" };

Str BACKUP[BACKUPNUM] = 
{ 
"MarineSquadBeacon", "MarineDBFGBeacon", "MarineMedicBeacon", "MarineDispensersBeacon",
"TaskForceBeacon", "SentryBox", "SentryBox2", "SentryBox3",
"DemonTechSentryBox", "ExplosiveDemonTechSentryBox", "PhaseDemonTechSentryBox", "SuperChargedDemonTechSentryBox",
"TurretBox", "TurretBox2", "TurretBox3", "SentryBox4",
"SentryBox5", "TurretBox4" };


Script "RandomKillReward" (void)
{
Delay(Random(10,35));
Int itemtype = Random(1,6);
Int amount, chance;
ShowMedalText(0);
Delay(35);
SetFont("CONFONT");
If(itemtype == 1) //Presents
{
  amount = Random(5,10);
  HudMessage(s:"You have recieved some xmas presents!";HUDMSG_FADEINOUT|HUDMSG_LOG,4878+PlayerNumber(),CR_WHITE,0.5,0.75,7.2,1.0,0.5);
  For(int x; x < amount; x++) GiveInventory(PRESENTS[Random(0,PRESNUM-1)],1);
  }
If(itemtype == 2) //Super Crate
{
  HudMessage(s:"You have recieved a Super Crate!";HUDMSG_FADEINOUT|HUDMSG_LOG,4878+PlayerNumber(),CR_WHITE,0.5,0.75,7.2,1.0,0.5);
  GiveInventory("SuperCrate",1);
  }
If(itemtype == 3) //Playing cards
{
  amount = Random(3,5);
  HudMessage(s:"You have recieved some playing cards!";HUDMSG_FADEINOUT|HUDMSG_LOG,4878+PlayerNumber(),CR_WHITE,0.5,0.75,7.2,1.0,0.5);
  For(int y; y < amount; y++)
  {
    chance = Random(1,100);
	If(chance <= 80) GiveInventory(CARDS[Random(0,CARDNUM-1)],1);
	Else GiveInventory(SUICIDE[Random(0,SUICIDENUM-1)],1);
	}
  }
If(itemtype == 4) //Dice Of Resets
{
  amount = Random(2,3);
  HudMessage(s:"You have recieved some dice of resets!";HUDMSG_FADEINOUT|HUDMSG_LOG,4878+PlayerNumber(),CR_WHITE,0.5,0.75,7.2,1.0,0.5);
  GiveInventory("DiceOfReset",amount);
  }
If(itemtype == 5) //Demonic Power Rune
{
  If(!CheckInventory("DemonicPowerRuneItem")) 
  { 
    HudMessage(s:"You have recieved an inventory demonic power rune!";HUDMSG_FADEINOUT|HUDMSG_LOG,4878+PlayerNumber(),CR_WHITE,0.5,0.75,7.2,1.0,0.5); 
	GiveInventory("DemonicPowerRuneItem",1);
	}
  Else
  {
    HudMessage(s:"You have recieved a Super Crate!";HUDMSG_FADEINOUT|HUDMSG_LOG,4878+PlayerNumber(),CR_WHITE,0.5,0.75,7.2,1.0,0.5);
	GiveInventory("SuperCrate",1);
	}
  }
If(itemtype == 6) //Turrets and Marine Beacons
{
  amount = Random(5,10);
  HudMessage(s:"You have recieved some random ass turrets and marine beacons!";HUDMSG_FADEINOUT|HUDMSG_LOG,4878+PlayerNumber(),CR_WHITE,0.5,0.75,7.2,1.0,0.5);
  For(int z; z < amount; z++) GiveInventory(BACKUP[Random(0,BACKUPNUM-1)],1);
  }
}

//Boss Kill Rewards
Script "RandomBossReward" (void)
{
Delay(Random(10,35));
Int itemtype = Random(1,2);
Int amount;
ShowMedalText(1);
Delay(30);
SetFont("CONFONT");
If(itemtype == 1) //If multiplayer with lives... get an extra life. If not you get salvation spheres or a legendary demon heart
{
  If( (GameType() != GAME_SINGLE_PLAYER) && GetCvar("Survival") == 1 )
  {
    SetPlayerLivesLeft(PlayerNumber(),GetPlayerLivesLeft(PlayerNumber())+1);
	LocalAmbientSound("DoomGuyDoll/Pickup",127);
	Int lives = GetPlayerLivesLeft(PlayerNumber())+1;
    HudMessage(s:"You have recieved an extra life! You now have ",d:lives, s:" lives left";HUDMSG_FADEINOUT|HUDMSG_LOG,4878+PlayerNumber(),CR_WHITE,0.5,0.75,7.2,1.0,0.5);
	}
  Else If(!CheckInventory("SalvationSphereNEO") && !CheckInventory("LegendarySalvationsphereNEO"))
  {
    HudMessage(s:"You have recieved a salvation sphere!";HUDMSG_FADEINOUT|HUDMSG_LOG,4878+PlayerNumber(),CR_WHITE,0.5,0.75,7.2,1.0,0.5);
	LocalAmbientSound("Powerup/Salvation",127);
	GiveInventory("SalvationsphereNEO",1);
	}
  Else If(!CheckInventory("LegendarySalvationsphereNEO"))
  {
    HudMessage(s:"You have recieved a legendary salvation sphere!";HUDMSG_FADEINOUT|HUDMSG_LOG,4878+PlayerNumber(),CR_WHITE,0.5,0.75,7.2,1.0,0.5);
	LocalAmbientSound("LSalvS/Pickup",127);
	GiveInventory("LegendarySalvationSphereNEO",1);
	}
  Else If(!CheckInventory("HeartToken"))
  {
    HudMessage(s:"You have recieved a legendary demon heart!";HUDMSG_FADEINOUT|HUDMSG_LOG,4878+PlayerNumber(),CR_WHITE,0.5,0.75,7.2,1.0,0.5);
	LocalAmbientSound("LegDemonHeart/Pickup",127);
	GiveInventory("LegendaryDemonHeart",1);
	}
  Else
  {
    HudMessage(s:"You have recieved a Super Crate!";HUDMSG_FADEINOUT|HUDMSG_LOG,4878+PlayerNumber(),CR_WHITE,0.5,0.75,7.2,1.0,0.5);
	GiveInventory("SuperCrate",1);
	}
  }
If(itemtype == 2) //Friendly legendaries spawn around you to fight
{
  HudMessage(s:"A pack of friendly legendaries appear! They are here to help fight for you!";HUDMSG_FADEINOUT|HUDMSG_LOG,4878+PlayerNumber(),CR_WHITE,0.5,0.75,7.2,1.0,0.5);
  amount = Random(4,8);
  Delay(20);
  For(int x; x < amount; x++) { GiveInventory("LegendaryFriendlyPowerSpawner",1); Delay(10); }
  }
}

//----HD WEAPON MANAGER-----

//This is for the HD weapon switch function

//HD Weapon Manager
#define HDWEAPONS 19

str hdweapon[HDWEAPONS] = //Change weapon here in case if weapon is replaced (DO NOT ADD more weapons to the string)
{ "BFG9500Dowon", "PoweredBFG9500Dowon", "BFG10KDowon", "PoweredBFG10kDowon",
"FreezerBFGDowon", "DemonTechBFG10KDowon", "PoweredDemonTechBFG10kDowon", "DemonTechDevastatorDowon",
"Revolver", "INFLegendaryBFG", "INFLegendaryLightMachineGun", "Deathwalker",
"GladiatorWeapon", "INFLegendaryBFG10K", "INFFantasyStaff", "INFExplosiveMinigun",
"INFEnragedLMG", "INFNemesisDarkMachineGun", "INFMelee" };

Script "hdweaponfunc" (Int i) { If(StrIcmp(GetWeapon(), hdweapon[i]) == 0) SetResultValue(TRUE); Else SetResultValue(FALSE); }




//-----------ARMOR----------

//Here you can add/change armors so things like Armor Regenerator or Synergy demonic power skill recognizes their max capacity

#define ALLARMORTYPES 41 //Increase this if more armor is added

str armortypes[ALLARMORTYPES] = //Change or add armors here
{
"StartingArmor",
"ModdedGreenArmor",
"ModdedGreenArmor2",
"ModdedBlueArmor",
"ModdedBlueArmor2",
"RedArmor",
"RedArmor2",
"PhaseArmor3",
"CrystalArmor",
"LegendaryArmor",
"CFLegendaryArmor",
"HellfireArmor",
"InfinityHellfireArmor",
"EnragedLegendaryArmor",
"VengefulNemesisArmor",
"TrueLegendaryArmor",
"NemesisArmor",
"CFNemesisArmor",
"NemesisArmorQuiet",
"HackroidArmor",

//INFINITY GODS Compatibility
"ReforcedLegendaryArmor",
"ReforcedEnragedLegendaryArmor",
"UpgradedNemesisArmor",
"VexedNemesisArmor",
"UpgradedVexedNemesisArmor",
"TrueDarkLegendaryArmor",
"UpgradedHellArmor",
"CommanderArmor",
"UpgradedTrueLegendaryArmor",
"CorruptedArmor",
"DarkArmor",
"DarkVoidArmor",
"TrueDarkEnragedLegendaryArmor",
"ZamasuArmor",
"DivineArmor",
"DarkDivineArmor",
"ZamasuGodArmorTear1",
"ZamasuGodArmorTear2",
"ZamasuGodArmorTear3",
"ZamasuGodArmorTear4",
"ZamasuGodArmorTear5"
};

int armorcapacity[ALLARMORTYPES] = { //Max capacity for the armor, same order as above
50, 100, 100, 200, 200, 250, 250, 400, 480, 500,
500, 666, 666, 750, 900, 1000, 1200, 1200, 1200, 1700, 

//INFINITY GODS Compatibility
850, 975, 1850, 1500, 2000, 1350, 1666, 1400, 1750, 675, 600, 1800, 1650, 2333, 2500, 2500, 3000, 3250, 3500, 3750, 4000
};

Script "armorfunc" (Int i) { If(GetArmorType(armortypes[i],PlayerNumber())) SetResultValue(TRUE); Else SetResultValue(FALSE); }

Script "GetPlayerArmor" (Int i) { SetResultValue(armortypes[i]); }

Script "GetPlayerCapacity" (Int i) { SetResultValue(armorcapacity[i]); }

Script "CountArmorTypes" (void) { SetResultValue(ALLARMORTYPES); }

Script "FetchPlayerArmor" (void) //Test function that tells what armor the player is wearing
{
int armor = GetArmorInfo(ARMORINFO_CLASSNAME); //Integer???
Print(s:armor);
}




//------SAMARA WHEN SHE DIES AND DROP THE RUNS------

//This is important if you want the proper runes back after being taken from her (spoiler alert)
//New runes added does not have any effect on this script... so don't worry

Script "SamaraDropRunes" (void)
{
Int i;
While (i < CheckInventory("SamaraGotVitality")) { DropItem(0,"VitalityRune",1,255); i++; }
i = 0;
While (i < CheckInventory("SamaraGotAgility")) { DropItem(0,"AgilityRune",1,255); i++; }
i = 0;
While (i < CheckInventory("SamaraGotLegendary")) { DropItem(0,"LegendaryRune2",1,255); i++; }
i = 0;
While (i < CheckInventory("SamaraGotTrueLegendary")) { DropItem(0,"TrueLegendaryRune",1,255); i++; }
i = 0;
While (i < CheckInventory("SamaraGotTrueLegendary2")) { DropItem(0,"TrueLegendaryRune2",1,255); i++; }
i = 0;
While (i < CheckInventory("SamaraGotVoid")) { DropItem(0,"VoidRune",1,255); i++; }
i = 0;
While (i < CheckInventory("SamaraGotEnraged")) { DropItem(0,"EnragedLegendaryRune",1,255); i++; }
i = 0;
While (i < CheckInventory("SamaraGotTerminator")) { DropItem(0,"TerminatorItemIt",1,255); i++; }
i = 0;
While (i < CheckInventory("SamaraGotTerminator2")) { DropItem(0,"TerminatorItemIt",1,255); DropItem(0,"TerminatorItemIt",1,255); i++; }
i = 0;
While (i < CheckInventory("SamaraGotNemesis")) { DropItem(0,"NexusNemesisRune",1,255); i++; }
i = 0;
While (i < CheckInventory("SamaraGotSpread")) { DropItem(0,"NexusSpreadRune",1,255); i++; }
i = 0;
While (i < CheckInventory("SamaraGotStrength")) { DropItem(0,"NexusStrengthRune",1,255); i++; }
i = 0;
While (i < CheckInventory("SamaraGotHighJump")) { DropItem(0,"NexusHighJumpRune",1,255); i++; }
i = 0;
While (i < CheckInventory("SamaraGotResistance")) { DropItem(0,"NexusResistanceRune",1,255); i++; }
}




//------HALLOWEEN------

//Halloween ghoul spawner
str SamaraGhoul[20] = {
"BNDWeak", "EyesoreNoDrops", "SjasStronger", "CreeperGhoul", "Choke", "SoulHarvester", "MioHonda",
"Misty", "Emtalic", "Jugulum", "JitterSkullWeak", "CorruptWeak", "BloodeyeWeak", "WeaverBonnieWeak",
"ClownyWeak", "ExetiorWeak", "ImpostorGhoul", "Noise", "Sin-GenjitsuWeak", "HellFrostBiteWeak" };

Script "SamaraSpawnGhoul" (void)
{
int x = GetActorX(0);
int y = GetActorY(0);
int z = GetActorZ(0);
int angle = (GetActorAngle(0)*255)>>16;
SpawnForced(SamaraGhoul[Random(0,19)],x,y,z,783,angle);
}




//------BEACON WEAPONS------

//Weapons dropped by supply beacons

str litebacon[9] = { //Change here in case if weapon is replaced or add weapon
" Combat Shotgun ", "AssaultShotgun2", "INFDoubleBarrelShotgun", " Assault Rifle ",
"MP40Dual", "Minigun3", "INFRocketLauncher", "INFGrenadeLauncher",
" Plasma Rifle " };

str fullbacon[13] = { 
"Submachine gun", "INFQuadBarrelShotgun", "INFExplosiveMinigun", "INFFreezerRifle",
"BFG10KDowon", "INFDemonTechRifle", "PlasmaShotgun2", "ExplosiveNailgun2",
"BFG9500Dowon", " Plasma Rifle ", "INFM79-GGL", "Enforcer",
"Burst Rifle" };

str randombacon[24] = { 
"INFQuadBarrelShotgun", "INFExplosiveMinigun", "INFFreezerRifle", "BFG10KDowon",
"INFDemonTechRifle", "PlasmaShotgun2", "ExplosiveNailgun2", "BFG9500Dowon",
" Plasma Rifle ", "INFM79-GGL", "INFExplosiveShotgun", "Flak Cannon ",
"INFExplosiveSSG", "ExplosiveRifle3", "INFHomingRocketLauncher", "RapidRocketlauncherNEO",
"Railgun3", "INFTechRipper", "NewNewDemonTechBallista", "BFG15K ",
"DemonTechBFG10KDowon", "Submachine gun", "Enforcer", "Burst Rifle" };

Script "FullBeaconWeaponSupply" (void) 
{ 
 SpawnForced(fullbacon[Random(0,12)],GetActorX(0),GetActorY(0),GetActorZ(0),997);
 delay(1);
}

Script "LiteBeaconWeaponSupply" (void) 
{ 
 SpawnForced(litebacon[Random(0,8)],GetActorX(0),GetActorY(0),GetActorZ(0),996);
 delay(1);
}

Script "RandomBeaconWeaponSupply" (void) 
{ 
 SpawnForced(randombacon[Random(0,23)],GetActorX(0),GetActorY(0),GetActorZ(0),995);
 delay(1);
}




//------START WEAPONS-------

//Script for the starting weapon option

str startweapons[9][2] = { //Change weapon here in case if weapon is replaced or add weapon
{ "Submachine gun", "\c[r5]Submachine gun\c-" },
{ " Combat Shotgun ", "\c[r5]Combat Shotgun\c-" },
{ "AssaultShotgun2", "\c[r5]Assault Shotgun\c-" },
{ "INFDoubleBarrelShotgun", "\c[r5]Double Barrel Shotgun\c-" },
{ "MP40Dual", "\c[r5]MP-40\c-" },
{ "Minigun3", "\c[m3]Minigun\c-" },
{ " Assault Rifle ", "\c[r5]Assault Rifle\c-" },
{ "Enforcer", "\c[j6]Enforcer\c-" },
{ "Burst Rifle", "\c[i6]Burst Rifle\c-" },
};

script "StartWeapon" (void)
{
Int rnum = Random(0,8);

GiveInventory(" Chainsaw ", 1); //Also the chainsaw
GiveInventory("NexStartWeaponCheck",1);
GiveInventory(startweapons[rnum][0],1);
Delay(Random(15,20));
LocalAmbientSound("armorregen/message",127);
HudMessage(s:"You have been given a free starting weapon: ",s:startweapons[rnum][1];HUDMSG_TYPEON|HUDMSG_LOG,6901+PlayerNumber(),CR_UNTRANSLATED,0.5,0.8,5.0,0.005);
}




//------PLASMA HANDGUN------

//Plasma Handgun giver on start depending on settings for it

Script "GivePlasmaHandgun" ENTER //Change plasma handguns here
{
If(GetCVar("lcadjb_PlasmaNerf")== 0) 
{ 
  GiveInventory("INFPlasmaPistol",1);
  TakeInventory("INFPlasmaPistolRE",1);
  TakeInventory("INFPlasmaPistolINF",1);
  }
If(GetCvar("lcadjb_PlasmaNerf")== 1) 
{
  GiveInventory("INFPlasmaPistolRE",1);
  TakeInventory("INFPlasmaPistol",1);
  TakeInventory("INFPlasmaPistolINF",1);
  }
If(GetCvar("lcadjb_PlasmaNerf")== 2) 
{
  GiveInventory("INFPlasmaPistolINF",1);
  TakeInventory("INFPlasmaPistol",1);
  TakeInventory("INFPlasmaPistolRE",1);
  }
If(GetCvar("lcadjb_PlasmaNerf")== 3) 
{
  SetCVar("lcadjb_PlasmaNerf",0);
  GiveInventory("INFPlasmaPistol",1);
  TakeInventory("INFPlasmaPistolRE",1);
  TakeInventory("INFPlasmaPistolINF",1);
  }
}