Files
CalamityModPublic/Scenes/BossBackgroundScenes/DrunkCrabBackgroundScene.cs
T
tomat 67bceff6e7 Initial dotnet format pass.
This commit formats the entire codebase according to `dotnet format` and its limited understanding of our provided `.editorconfig`.
2024-02-28 21:49:50 -08:00

49 lines
1.8 KiB
C#

using CalamityMod.NPCs;
using CalamityMod.NPCs.Crabulon;
using CalamityMod.NPCs.SupremeCalamitas;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Systems
{
public class DrunkCrabBackgroundScene : ModSceneEffect
{
public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh;
public override bool IsSceneEffectActive(Player player)
{
// Case 1: Zenith Seed Crabulon.
if (Main.zenithWorld && NPC.AnyNPCs(ModContent.NPCType<Crabulon>()))
return true;
// Case 2: Supreme Cirrus BH5.
bool cirrusSpecialAttack = false;
// Try to find Supreme Cirrus, if she exists. She might not.
try
{
// Is there an index reference to Supreme Calamitas/Cirrus available? Is it valid? I sure hope so. Thanks TML
if (CalamityGlobalNPC.SCal >= 0 && CalamityGlobalNPC.SCal < Main.maxNPCs && Main.npc[CalamityGlobalNPC.SCal].active)
{
NPC npc = Main.npc[CalamityGlobalNPC.SCal];
SupremeCalamitas supremeSomeone = npc.ModNPC<SupremeCalamitas>();
cirrusSpecialAttack = supremeSomeone is not null && supremeSomeone.cirrus && supremeSomeone.gettingTired5;
}
}
catch
{
if (Main.netMode == NetmodeID.SinglePlayer)
Main.NewText("Supreme Cirrus code attempted to crash the game. Did you do something weird?");
}
return cirrusSpecialAttack;
}
public override void SpecialVisuals(Player player, bool isActive)
{
player.ManageSpecialBiomeVisuals("CalamityMod:DrunkCrabulon", isActive);
}
}
}