From bc6fb68cfa00e6de23a1317ab10f4dcae95dedcf Mon Sep 17 00:00:00 2001 From: GinYuH <> Date: Thu, 5 Jan 2023 03:36:28 -0800 Subject: [PATCH] banished GSS to the astral desert --- Items/SummonItems/ProfanedShard.cs | 14 ++++++++ Items/SummonItems/SandstormsCore.cs | 19 +++++++++- NPCs/CalamityGlobalNPCLoot.cs | 4 ++- NPCs/GreatSandShark/GreatSandShark.cs | 50 ++++++++++++++++++++++++--- 4 files changed, 80 insertions(+), 7 deletions(-) diff --git a/Items/SummonItems/ProfanedShard.cs b/Items/SummonItems/ProfanedShard.cs index 4a98cc6669..7a18bb8e23 100644 --- a/Items/SummonItems/ProfanedShard.cs +++ b/Items/SummonItems/ProfanedShard.cs @@ -53,6 +53,20 @@ namespace CalamityMod.Items.SummonItems return true; } + public override void ModifyTooltips(List list) + { + Player player = Main.LocalPlayer; + TooltipLine line1 = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1"); + + if (Main.getGoodWorld) + { + line1.Text = "Summons the Profaned Guardians when used in the Hallow or Underworld\n"; + } + else + { + line1.Text = "Summons the Profaned Guardians when used in the Hallow or Underworld during daytime\n"; + } + } public override void AddRecipes() { diff --git a/Items/SummonItems/SandstormsCore.cs b/Items/SummonItems/SandstormsCore.cs index 106199527e..c9fe8cea60 100644 --- a/Items/SummonItems/SandstormsCore.cs +++ b/Items/SummonItems/SandstormsCore.cs @@ -1,5 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.NPCs.GreatSandShark; +using System.Linq; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -36,7 +38,7 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return player.ZoneDesert && !NPC.AnyNPCs(ModContent.NPCType()); + return player.ZoneDesert && !(Main.getGoodWorld && !player.Calamity().ZoneAstral) && !NPC.AnyNPCs(ModContent.NPCType()); // move to zenith seed later } public override bool? UseItem(Player player) @@ -50,6 +52,21 @@ namespace CalamityMod.Items.SummonItems return true; } + public override void ModifyTooltips(List list) + { + Player player = Main.LocalPlayer; + TooltipLine line0 = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); + + if (Main.getGoodWorld) + { + line0.Text = "Summons the Great Sand Shark when used in the astral desert\n"; + } + else + { + line0.Text = "Summons the Great Sand Shark when used in the desert\n"; + } + } + public override void AddRecipes() { CreateRecipe(). diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 7e45654fc9..9d2be91daf 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -12,6 +12,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.AcidRain; +using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Tiles.Ores; @@ -1952,7 +1953,8 @@ namespace CalamityMod.NPCs } } - if (NPC.downedPlantBoss && (npc.type == NPCID.SandShark || npc.type == NPCID.SandsharkHallow || npc.type == NPCID.SandsharkCorrupt || npc.type == NPCID.SandsharkCrimson) && !NPC.AnyNPCs(ModContent.NPCType())) + bool normalShark = npc.type == NPCID.SandShark || npc.type == NPCID.SandsharkHallow || npc.type == NPCID.SandsharkCorrupt || npc.type == NPCID.SandsharkCrimson; + if (NPC.downedPlantBoss && (normalShark || (npc.type == ModContent.NPCType() && Main.getGoodWorld)) && !NPC.AnyNPCs(ModContent.NPCType())) { CalamityMod.sharkKillCount++; if (CalamityMod.sharkKillCount == 4) diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index 505f393248..f2093d684d 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -1,7 +1,9 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.NPCs.Astral; using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -62,9 +64,17 @@ namespace CalamityMod.NPCs.GreatSandShark NPC.DeathSound = SoundID.NPCDeath1; NPC.timeLeft = NPC.activeTime * 30; NPC.rarity = 2; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToWater = true; + if (Main.getGoodWorld) // move to zenith seed later + { + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; + } + else + { + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; + } } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -85,6 +95,7 @@ namespace CalamityMod.NPCs.GreatSandShark writer.Write(NPC.localAI[1]); writer.Write(NPC.localAI[2]); writer.Write(NPC.localAI[3]); + writer.Write(NPC.Calamity().newAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -94,6 +105,7 @@ namespace CalamityMod.NPCs.GreatSandShark NPC.localAI[1] = reader.ReadSingle(); NPC.localAI[2] = reader.ReadSingle(); NPC.localAI[3] = reader.ReadSingle(); + NPC.Calamity().newAI[0] = reader.ReadSingle(); } public override void AI() @@ -322,7 +334,8 @@ namespace CalamityMod.NPCs.GreatSandShark if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) { - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 50, NPCID.SandShark, 0, 0f, 0f, 0f, 0f, 255); + int npcType = Main.getGoodWorld ? ModContent.NPCType() : NPCID.SandShark; // move to zenith seed later + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 50, npcType, 0, 0f, 0f, 0f, 0f, 255); SoundEngine.PlaySound(RoarSound, NPC.position); } } @@ -435,9 +448,10 @@ namespace CalamityMod.NPCs.GreatSandShark Main.dust[num624].velocity.X *= 2f; } int spawnX = (int)(NPC.width / 2); + int projType = Main.getGoodWorld ? ModContent.ProjectileType() : ModContent.ProjectileType(); for (int sand = 0; sand < 5; sand++) Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X + (float)Main.rand.Next(-spawnX, spawnX), NPC.Center.Y, - (float)Main.rand.Next(-3, 4), (float)Main.rand.Next(-12, -6), ModContent.ProjectileType(), 40, 0f, Main.myPlayer); + (float)Main.rand.Next(-3, 4), (float)Main.rand.Next(-12, -6), projType, 40, 0f, Main.myPlayer); } NPC.ai[2] = -30f; @@ -533,6 +547,26 @@ namespace CalamityMod.NPCs.GreatSandShark NPC.rotation = NPC.velocity.Y * NPC.direction * 0.1f; NPC.rotation = MathHelper.Clamp(NPC.rotation, -0.1f, 0.1f); } + + if (Main.getGoodWorld) // move to zenith seed later + { + NPC.Calamity().newAI[0]++; + if (NPC.Calamity().newAI[0] >= 120) + { + SoundEngine.PlaySound(SoundID.Item105, Main.player[NPC.target].Center); + for (int i = 0; i < 5; i++) + { + float speedX = 2f + (float)Main.rand.Next(-8, 5); + float speedY = 2f + (float)Main.rand.Next(1, 6); + int p = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, Main.player[NPC.target].Center.Y - 800, speedX, speedY, ModContent.ProjectileType(), 40, 0, Main.myPlayer); + if (p.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[p].timeLeft = 180; + } + } + NPC.Calamity().newAI[0] = 0; + } + } } public override void FindFrame(int frameHeight) @@ -556,6 +590,11 @@ namespace CalamityMod.NPCs.GreatSandShark } Color color24 = NPC.GetAlpha(drawColor); Color color25 = Lighting.GetColor((int)((double)NPC.position.X + (double)NPC.width * 0.5) / 16, (int)(((double)NPC.position.Y + (double)NPC.height * 0.5) / 16.0)); + if (Main.getGoodWorld) // move to zenith seed later + { + color24 = Color.Silver; + color25 = Color.Orange; + } Texture2D texture2D3 = TextureAssets.Npc[NPC.type].Value; int num156 = TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type]; int y3 = num156 * (int)NPC.frameCounter; @@ -589,6 +628,7 @@ namespace CalamityMod.NPCs.GreatSandShark } var something = NPC.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; spriteBatch.Draw(texture2D3, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame, color24, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); + return false; }