public override void EditSpawnPool(IDictionary <int, float> pool, NPCSpawnInfo spawnInfo) { if (Main.gameMenu) { return; } if (!DynamicInvasionsMod.Config.Enabled) { return; } var myworld = ModContent.GetInstance <DynamicInvasionsWorld>(); if (myworld.Logic.HasInvasionFinishedArriving() && WorldHelpers.IsAboveWorldSurface(spawnInfo.player.position)) { myworld.Logic.EditSpawnPool(pool, spawnInfo); } }
public override void EditSpawnRate(Player player, ref int spawnRate, ref int maxSpawns) { if (Main.gameMenu) { return; } if (!DynamicInvasionsMod.Config.Enabled) { return; } var myworld = ModContent.GetInstance <DynamicInvasionsWorld>(); if (myworld.Logic.HasInvasionFinishedArriving() && WorldHelpers.IsAboveWorldSurface(player.position)) { spawnRate = DynamicInvasionsMod.Config.InvasionSpawnRate; maxSpawns = DynamicInvasionsMod.Config.InvasionSpawnMax; } }
public override bool CheckDead(NPC npc) { if (Main.gameMenu) { return(base.CheckDead(npc)); } if (!DynamicInvasionsMod.Config.Enabled) { return(base.CheckDead(npc)); } var modworld = ModContent.GetInstance <DynamicInvasionsWorld>(); if (modworld.Logic.HasInvasionFinishedArriving() && WorldHelpers.IsAboveWorldSurface(npc.position)) { if (npc.life <= 0) { modworld.Logic.InvaderKilled(npc); } } return(base.CheckDead(npc)); }
//////////////// public static bool AreSpamProjectileLikelyToExist() { var config = UPMod.Instance.Config; bool unclutBoss = config.UnclutterDuringBosses; bool unclutEclip = config.UnclutterDuringEclipses; bool unclutInvas = config.UnclutterDuringInvasions; bool unclutLunar = config.UnclutterDuringLunarApocalypse; bool isBossActive = UPNpc.IsAnyBossActive(); if (unclutBoss && !isBossActive) // No boss active? { if (!WorldHelpers.IsAboveWorldSurface(Main.LocalPlayer.position)) // Not above world surface? { return(false); } } return((unclutBoss && isBossActive) || (unclutEclip && Main.eclipse) || (unclutInvas && Main.invasionType != 0) || (unclutInvas && Main.pumpkinMoon) || (unclutInvas && Main.snowMoon) || (unclutLunar && NPC.LunarApocalypseIsUp)); }
public override bool PreNPCLoot(NPC npc) { if (Main.gameMenu) { return(base.PreNPCLoot(npc)); } if (!DynamicInvasionsMod.Config.Enabled) { return(base.PreNPCLoot(npc)); } var myworld = ModContent.GetInstance <DynamicInvasionsWorld>(); bool hasInvasionArrived = myworld.Logic.HasInvasionFinishedArriving(); bool isAboveSurface = WorldHelpers.IsAboveWorldSurface(npc.position); if (hasInvasionArrived && isAboveSurface) { float chancePercent = DynamicInvasionsMod.Config.InvaderLootDropPercentChance; return(Main.rand.NextFloat() < chancePercent); } return(base.PreNPCLoot(npc)); }