From d8fd1ec460d301a4aacb06c29c2adea072e65786 Mon Sep 17 00:00:00 2001 From: GinYuH Date: Thu, 15 Dec 2022 22:55:08 -0800 Subject: [PATCH] Calclone takes more advice from SCal --- Items/SummonItems/EyeofDesolation.cs | 62 ++++++++++++++++++++++++++++ NPCs/Calamitas/CalamitasClone.cs | 4 ++ NPCs/CalamityAI.cs | 48 +++++++++++++++++++++ Tiles/ArenaTile.cs | 5 ++- 4 files changed, 117 insertions(+), 2 deletions(-) diff --git a/Items/SummonItems/EyeofDesolation.cs b/Items/SummonItems/EyeofDesolation.cs index 3704ad307b..5a642c2a56 100644 --- a/Items/SummonItems/EyeofDesolation.cs +++ b/Items/SummonItems/EyeofDesolation.cs @@ -1,6 +1,9 @@ using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.Calamitas; +using Microsoft.Xna.Framework; +using System.Linq; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +14,15 @@ namespace CalamityMod.Items.SummonItems [LegacyName("BlightedEyeball")] public class EyeofDesolation : ModItem { + public Rectangle safeBox = default; + public int spawnX = 0; + public int spawnX2 = 0; + public int spawnXReset = 0; + public int spawnXReset2 = 0; + public int spawnXAdd = 200; + public int spawnY = 0; + public int spawnYReset = 0; + public int spawnYAdd = 0; public override void SetStaticDefaults() { SacrificeTotal = 1; @@ -51,9 +63,59 @@ namespace CalamityMod.Items.SummonItems else NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld) // move to zenith seed later + { + safeBox.X = spawnX = spawnXReset = (int)(player.Center.X - 1250f); + spawnX2 = spawnXReset2 = (int)(player.Center.X + 1250f); + safeBox.Y = spawnY = spawnYReset = (int)(player.Center.Y - 1250f); + safeBox.Width = 2500; + safeBox.Height = 2500; + spawnYAdd = 125; + + int num52 = (int)(safeBox.X + (float)(safeBox.Width / 2)) / 16; + int num53 = (int)(safeBox.Y + (float)(safeBox.Height / 2)) / 16; + int num54 = safeBox.Width / 2 / 16 + 1; + for (int num55 = num52 - num54; num55 <= num52 + num54; num55++) + { + for (int num56 = num53 - num54; num56 <= num53 + num54; num56++) + { + if (!WorldGen.InWorld(num55, num56, 2)) + continue; + + int xoffset = 0; + int yoffset = 0; + + if ((num55 == num52 - num54 || num55 == num52 + num54 || num56 == num53 - num54 || num56 == num53 + num54) && !Main.tile[num55 + xoffset, num56 + yoffset].HasTile) + { + Main.tile[num55 + xoffset, num56 + yoffset].TileType = (ushort)ModContent.TileType(); + Main.tile[num55 + xoffset, num56 + yoffset].Get().HasTile = true; + } + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, num55 + xoffset, num56 + yoffset, 1, TileChangeType.None); + } + else + { + WorldGen.SquareTileFrame(num55 + xoffset, num56 + yoffset, true); + } + } + } + } return true; } + public override void ModifyTooltips(List list) + { + Player player = Main.LocalPlayer; + TooltipLine line4 = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip3"); + TooltipLine line5 = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip4"); + + if (Main.getGoodWorld) + { + line4.Text = "Doing so will create a square arena of blocks, with you at its center\nNot consumable"; + } + } + public override void AddRecipes() { CreateRecipe(). diff --git a/NPCs/Calamitas/CalamitasClone.cs b/NPCs/Calamitas/CalamitasClone.cs index 130ba19283..491431f078 100644 --- a/NPCs/Calamitas/CalamitasClone.cs +++ b/NPCs/Calamitas/CalamitasClone.cs @@ -158,6 +158,10 @@ namespace CalamityMod.NPCs.Calamitas texture = ModContent.Request("CalamityMod/NPCs/Calamitas/CalamitasCloneGlow").Value; Color color = Color.Lerp(Color.White, Color.Red, 0.5f); + if (Main.getGoodWorld) // move to zenith seed later + { + color = Color.CornflowerBlue; + } if (CalamityConfig.Instance.Afterimages) { diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index eb202829d1..811bbd788e 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -1467,6 +1467,10 @@ namespace CalamityMod.NPCs { int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); + if (Main.getGoodWorld) // move to zenith seed later + { + type = ModContent.ProjectileType(); + } float gigaBlastFrequency = (Main.getGoodWorld ? 120f : expertMode ? 180f : 240f) - enrageScale * 15f; float projSpeed = bossRush ? 6.25f : 5f; if (calamityGlobalNPC.newAI[3] <= 300f) @@ -2012,6 +2016,28 @@ namespace CalamityMod.NPCs npc.velocity.X = num871 * num873; npc.velocity.Y = num872 * num873; npc.ai[1] = 2f; + + if (Main.getGoodWorld) // move to zenith seed later + { + SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, npc.Center); + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(ModContent.ProjectileType()); + if (bossRush) + damage /= 2; + int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 5f; + 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); + } + + for (int i = 0; i < 6; i++) + Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f); + } return; } @@ -2292,6 +2318,28 @@ namespace CalamityMod.NPCs npc.velocity.X = num871 * num873; npc.velocity.Y = num872 * num873; npc.ai[1] = 2f; + + if (Main.getGoodWorld) // move to zenith seed later + { + SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, npc.Center); + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(ModContent.ProjectileType()); + if (bossRush) + damage /= 2; + int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 5f; + 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); + } + + for (int i = 0; i < 6; i++) + Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f); + } return; } diff --git a/Tiles/ArenaTile.cs b/Tiles/ArenaTile.cs index cab04cb330..f4860fec01 100644 --- a/Tiles/ArenaTile.cs +++ b/Tiles/ArenaTile.cs @@ -1,4 +1,5 @@ -using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.SupremeCalamitas; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -34,7 +35,7 @@ namespace CalamityMod.Tiles { if (closer) { - if (!NPC.AnyNPCs(ModContent.NPCType()) && !SCalSky.RitualDramaProjectileIsPresent) + if (!NPC.AnyNPCs(ModContent.NPCType()) && !SCalSky.RitualDramaProjectileIsPresent && !(NPC.AnyNPCs(ModContent.NPCType()) && Main.getGoodWorld)) { WorldGen.KillTile(i, j, false, false, false); if (!Main.tile[i, j].HasTile && Main.netMode != NetmodeID.SinglePlayer)