From d547fe1d18f1d34603b48e23558c63ebdf26ca02 Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Thu, 18 Nov 2021 00:05:25 -0500 Subject: [PATCH] polter's map icon now rotates --- NPCs/Polterghast/PolterPhantom.cs | 9 +++++++++ NPCs/Polterghast/Polterghast.cs | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index bf5d196850..6b1700c3b2 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -46,6 +46,15 @@ namespace CalamityMod.NPCs.Polterghast npc.DeathSound = SoundID.NPCDeath39; } + public override void BossHeadRotation(ref float rotation) + { + bool polterHasTarget = CalamityGlobalNPC.ghostBoss.WithinBounds(Main.maxNPCs) && Main.npc[CalamityGlobalNPC.ghostBoss].active && Main.npc[CalamityGlobalNPC.ghostBoss].HasValidTarget; + if (polterHasTarget && npc.Calamity().newAI[3] == 0f) + rotation = (Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center - npc.Center).ToRotation() + MathHelper.PiOver2; + else + rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; + } + public override void SendExtraAI(BinaryWriter writer) { writer.Write(despawnTimer); diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 8d8d2377de..46bd3b7440 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -96,6 +96,14 @@ namespace CalamityMod.NPCs.Polterghast index = phase1IconIndex; } + public override void BossHeadRotation(ref float rotation) + { + if (npc.HasValidTarget && npc.Calamity().newAI[3] == 0f) + rotation = (Main.player[npc.TranslatedTargetIndex].Center - npc.Center).ToRotation() + MathHelper.PiOver2; + else + rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; + } + public override void SendExtraAI(BinaryWriter writer) { writer.Write(despawnTimer);