From d907d86828f3810958ec3cab50e4e199f37fb463 Mon Sep 17 00:00:00 2001 From: GinYuH Date: Tue, 20 Dec 2022 02:31:19 -0800 Subject: [PATCH] Astrum Aureus returns to slime --- NPCs/AstrumAureus/AstrumAureus.cs | 26 ++++++++-- NPCs/AstrumAureus/AureusSpawn.cs | 3 +- NPCs/CalamityAI.cs | 83 ++++++++++++++++++++++++++++++- 3 files changed, 106 insertions(+), 6 deletions(-) diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 76858ddb95..c66eed516e 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -38,6 +38,8 @@ namespace CalamityMod.NPCs.AstrumAureus public static readonly SoundStyle StompSound = new("CalamityMod/Sounds/Custom/LegStomp"); private bool stomping = false; + public int slimeProjCounter = 0; + public int slimePhase = 0; public override void SetStaticDefaults() { @@ -82,6 +84,8 @@ namespace CalamityMod.NPCs.AstrumAureus if (Main.getGoodWorld) NPC.scale *= 0.8f; + if (Main.getGoodWorld) // move to zenith seed later + NPC.scale *= 1.5; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -98,6 +102,8 @@ namespace CalamityMod.NPCs.AstrumAureus { writer.Write(stomping); writer.Write(NPC.alpha); + writer.Write(slimePhase); + writer.Write(slimeProjCounter); writer.Write(NPC.localAI[2]); writer.Write(NPC.localAI[3]); for (int i = 0; i < 4; i++) @@ -108,6 +114,8 @@ namespace CalamityMod.NPCs.AstrumAureus { stomping = reader.ReadBoolean(); NPC.alpha = reader.ReadInt32(); + slimePhase = reader.ReadInt32(); + slimeProjCounter = reader.ReadInt32(); NPC.localAI[2] = reader.ReadSingle(); NPC.localAI[3] = reader.ReadSingle(); for (int i = 0; i < 4; i++) @@ -213,13 +221,16 @@ namespace CalamityMod.NPCs.AstrumAureus public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + float lifeRatio = NPC.life / (float)NPC.lifeMax; + bool slimePhaseHP = lifeRatio <= 0.1f || (lifeRatio > 0.6f && lifeRatio <= 0.7f); + Texture2D NPCTexture = TextureAssets.Npc[NPC.type].Value; Texture2D GlowMaskTexture = TextureAssets.Npc[NPC.type].Value; SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - if (NPC.ai[0] == 0f) + if (NPC.ai[0] == 0f || (slimePhaseHP && Main.getGoodWorld)) // move to zenith seed later { NPCTexture = TextureAssets.Npc[NPC.type].Value; GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusGlow").Value; @@ -272,6 +283,10 @@ namespace CalamityMod.NPCs.AstrumAureus float rotation = NPC.rotation; float offsetY = NPC.gfxOffY; Color color36 = Color.White; + if (Main.getGoodWorld && slimePhaseHP) // move to zenith seed later + { + color36 = slimePhase == 0 ? Color.Yellow : Color.Violet; + } float amount9 = 0.5f; int num153 = 7; if (NPC.ai[0] == 3f || NPC.ai[0] == 4f) @@ -295,12 +310,17 @@ namespace CalamityMod.NPCs.AstrumAureus Vector2 vector43 = NPC.Center - screenPos; vector43 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; vector43 += vector11 * scale + new Vector2(0f, 4f + offsetY); - spriteBatch.Draw(NPCTexture, vector43, frame, NPC.GetAlpha(drawColor), rotation, vector11, scale, spriteEffects, 0f); + Color toUse = Main.getGoodWorld && slimePhaseHP ? color36 : drawColor; + spriteBatch.Draw(NPCTexture, vector43, frame, NPC.GetAlpha(toUse), rotation, vector11, scale, spriteEffects, 0f); - if (NPC.ai[0] != 1) //draw only if not recharging + if (NPC.ai[0] != 1 || (slimePhaseHP && Main.getGoodWorld)) //draw only if not recharging { Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.Gold); Color color40 = Color.Lerp(Color.White, color, 0.5f); + if (Main.getGoodWorld && slimePhaseHP) // move to zenith seed later + { + color40 = slimePhase == 0 ? Color.Violet : Color.Yellow; + } if (CalamityConfig.Instance.Afterimages) { diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 947ffae56f..8cc1c43848 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -361,8 +361,9 @@ namespace CalamityMod.NPCs.AstrumAureus public override void OnHitPlayer(Player player, int damage, bool crit) { + int debuffType = Main.getGoodWorld ? ModContent.BuffType() : ModContent.BuffType(); // move to zenith seed later if (damage > 0) - player.AddBuff(ModContent.BuffType(), 180, true); + player.AddBuff(debuffType, 180, true); } public override bool CheckDead() diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index eea58e217e..9426e941ec 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -2498,6 +2498,63 @@ namespace CalamityMod.NPCs else if (npc.timeLeft < 1800) npc.timeLeft = 1800; + bool geldonPhase1 = lifeRatio > 0.6f && lifeRatio <= 0.7f; + bool geldonPhase2 = lifeRatio <= 0.1f; + if (Main.getGoodWorld && (geldonPhase1 || geldonPhase2)) // "turn into a slime". move to zenith seed later + { + AstrumAureus.AstrumAureus astrumAureus = npc.ModNPC(); + astrumAureus.slimeProjCounter++; + if (astrumAureus.slimeProjCounter % 180 == 0) + { + SoundEngine.PlaySound(SoundID.Item33, npc.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (astrumAureus.slimePhase == 1) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 10f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); + } + astrumAureus.slimePhase = 0; + } + else + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float num1070 = 7f; + float num1071 = player.Center.X - npc.Center.X; + float num1072 = player.Center.Y - npc.Center.Y; + float num1073 = (float)Math.Sqrt(num1071 * num1071 + num1072 * num1072); + num1073 = num1070 / num1073; + num1071 *= num1073; + num1072 *= num1073; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, num1071, num1072, type, damage, 0f, Main.myPlayer); + for (int i = 0; i < 4; i++) + { + Vector2 offset = new Vector2(Main.rand.Next(-6, 7), Main.rand.Next(-6, 7)); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, num1071 + offset.X, num1072 + offset.Y, type, damage, 0f, Main.myPlayer); + } + astrumAureus.slimePhase = 1; + } + } + } + CalamityGlobalAI.BuffedMimicAI(npc, mod); + npc.noGravity = false; + npc.noTileCollide = false; + return; + } + else + { + npc.noGravity = true; + } + // Emit light when not Idle if (npc.ai[0] != 1f) Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.3f, 0.5f, 0f); @@ -2810,7 +2867,15 @@ namespace CalamityMod.NPCs if (npc.velocity.Y == 0f) { // Play stomp sound. Gotta specify the filepath to avoid confusion between the namespace and npc - SoundEngine.PlaySound(NPCs.AstrumAureus.AstrumAureus.StompSound, npc.position); + SoundStyle soundToPlay = Main.getGoodWorld ? NPCs.ExoMechs.Ares.AresGaussNuke.NukeExplosionSound : NPCs.AstrumAureus.AstrumAureus.StompSound; // move to zenith seed later + SoundEngine.PlaySound(soundToPlay, npc.position); + + if (Main.getGoodWorld) // move to zenith seed later + { + float screenShakePower = 16 * Utils.GetLerpValue(1300f, 0f, npc.Distance(Main.LocalPlayer.Center), true); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; + } // Stomp and jump again, if stomped twice then reset and set AI to next phase (Teleport or Idle) npc.TargetClosest(); @@ -2854,7 +2919,21 @@ namespace CalamityMod.NPCs SoundEngine.PlaySound(SoundID.Item33, npc.position); if (Main.netMode != NetmodeID.MultiplayerClient) { - if (calamityGlobalNPC.newAI[2] == 0f) + if (Main.getGoodWorld) // move to zenith seed later + { + int type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 10f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); + } + } + else if (calamityGlobalNPC.newAI[2] == 0f) { calamityGlobalNPC.newAI[2] = 1f;