From d149423dc2cfd49f27cf065eebb174491c86f5c6 Mon Sep 17 00:00:00 2001 From: GinYuH Date: Fri, 16 Dec 2022 22:35:42 -0800 Subject: [PATCH] Signus can now perform stealth strikes --- NPCs/Signus/Signus.cs | 85 +++++++++++++++++++++++++++++++-- Projectiles/Boss/EssenceDust.cs | 3 +- 2 files changed, 84 insertions(+), 4 deletions(-) diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 4ab7755152..9171ca4adf 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -34,6 +34,7 @@ namespace CalamityMod.NPCs.Signus private int spawnX = 750; private int spawnY = 120; private int lifeToAlpha = 0; + private int stealthTimer = 0; public override void SetStaticDefaults() { @@ -92,6 +93,7 @@ namespace CalamityMod.NPCs.Signus writer.Write(spawnX); writer.Write(spawnY); writer.Write(lifeToAlpha); + writer.Write(stealthTimer); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } @@ -101,6 +103,7 @@ namespace CalamityMod.NPCs.Signus spawnX = reader.ReadInt32(); spawnY = reader.ReadInt32(); lifeToAlpha = reader.ReadInt32(); + stealthTimer = reader.ReadInt32(); for (int i = 0; i < 4; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); } @@ -195,6 +198,30 @@ namespace CalamityMod.NPCs.Signus } } + // Zenith seed stealth strike stuff + int stealthSoundGate = 300; + int maxStealth = 360; + + if (Main.getGoodWorld) // move to zenith seed later + { + if (stealthTimer < maxStealth) + { + stealthTimer++; + } + if (stealthTimer == stealthSoundGate) + { + SoundEngine.PlaySound(CalPlayer.CalamityPlayer.RogueStealthSound, NPC.Center); + } + if (stealthTimer >= stealthSoundGate && stealthTimer < maxStealth) + { + NPC.alpha = 0; + NPC.knockBackResist = 0f; + NPC.rotation = NPC.rotation.AngleLerp(0f, 0.2f); + NPC.velocity = Vector2.Zero; + return; + } + } + if (NPC.ai[0] <= 2f) { NPC.rotation = NPC.velocity.X * 0.04f; @@ -353,6 +380,20 @@ namespace CalamityMod.NPCs.Signus if (Main.netMode == NetmodeID.Server) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); + if (stealthTimer >= maxStealth) + { + int num662 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + 950f), (int)player.position.Y, ModContent.NPCType()); + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num662, 0f, 0f, 0f, 0, 0, 0); + + int num663 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - 950f), (int)player.position.Y, ModContent.NPCType()); + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num663, 0f, 0f, 0f, 0, 0, 0); + + SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, NPC.Center); + stealthTimer = 0; + } + for (int num621 = 0; num621 < 5; num621++) { int num622 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); @@ -436,6 +477,17 @@ namespace CalamityMod.NPCs.Signus int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter.X, vectorCenter.Y, num1071, num1072, type, damage, 0f, Main.myPlayer, 0f, NPC.target + 1); + if (stealthTimer >= maxStealth) + { + SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, NPC.Center); + for (int i = 0; i < 4; i++) + { + Vector2 offset = new Vector2(Main.rand.Next(-5, 6), Main.rand.Next(-5, 6)); + damage *= 2; + Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter.X, vectorCenter.Y, num1071 + offset.X, num1072 + offset.Y, type, damage, 0f, Main.myPlayer, 0f, NPC.target + 1); + } + stealthTimer = 0; + } } } } @@ -507,6 +559,12 @@ namespace CalamityMod.NPCs.Signus } if (NPC.CountNPCS(ModContent.NPCType()) < totalLamps) { + bool buffed = false; + if (stealthTimer >= maxStealth) + { + SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, NPC.Center); + buffed = true; + } for (int x = 0; x < totalLamps; x++) { int type = ModContent.NPCType(); @@ -522,7 +580,7 @@ namespace CalamityMod.NPCs.Signus if (Main.netMode == NetmodeID.Server) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); - if (Main.getGoodWorld) // move to zenith seed later + if (buffed) { int num662 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + spawnX + spawnX / 2), (int)(player.position.Y + spawnY), ModContent.NPCType()); if (Main.netMode == NetmodeID.Server) @@ -535,6 +593,10 @@ namespace CalamityMod.NPCs.Signus spawnY -= 60; } + if (buffed) + { + stealthTimer = 0; + } spawnY = 120; } } @@ -614,6 +676,10 @@ namespace CalamityMod.NPCs.Signus { if (Main.netMode != NetmodeID.MultiplayerClient) { + if (stealthTimer >= maxStealth && NPC.ai[2] == 0) + { + SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, NPC.Center); + } NPC.ai[2] += 1f; if (phase2 && NPC.ai[2] % 3f == 0f) { @@ -627,7 +693,8 @@ namespace CalamityMod.NPCs.Signus velocity.Normalize(); velocity *= 1.05f; } - Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter, velocity, type, damage, 0f, Main.myPlayer); + int ai = stealthTimer >= maxStealth ? 69 : 0; + Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter, velocity, type, damage, 0f, Main.myPlayer, ai); } } @@ -638,6 +705,10 @@ namespace CalamityMod.NPCs.Signus calamityGlobalNPC.newAI[0] = 3f; NPC.ai[1] = 30f; NPC.ai[2] = 0f; + if (stealthTimer >= maxStealth) + { + stealthTimer = 0; + } NPC.velocity /= 2f; NPC.netUpdate = true; } @@ -653,6 +724,10 @@ namespace CalamityMod.NPCs.Signus } else if (calamityGlobalNPC.newAI[0] == 3f) // Slow down after charging and reset { + if (stealthTimer >= maxStealth) + { + stealthTimer = 0; + } NPC.ai[1] -= 1f; if (NPC.ai[1] <= 0f) { @@ -744,7 +819,11 @@ namespace CalamityMod.NPCs.Signus float scale = NPC.scale; float rotation = NPC.rotation; float offsetY = NPC.gfxOffY; - float transparency = Main.getGoodWorld ? 0.7f : 1f; + float transparency = 1; + if (stealthTimer >= 300) + { + transparency = (100 - (stealthTimer - 300)) * 0.01f; + } if (CalamityConfig.Instance.Afterimages) { diff --git a/Projectiles/Boss/EssenceDust.cs b/Projectiles/Boss/EssenceDust.cs index 7ac2b9d552..0ae4efa529 100644 --- a/Projectiles/Boss/EssenceDust.cs +++ b/Projectiles/Boss/EssenceDust.cs @@ -40,7 +40,8 @@ namespace CalamityMod.Projectiles.Boss { SoundEngine.PlaySound(SoundID.Item74, Projectile.position); Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 96; + int size = Projectile.ai[0] > 60 ? 192 : 96; + Projectile.width = Projectile.height = size; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 10; num621++)