diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index aa6e781dbc..4a6fc0cc03 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using System; using Terraria; @@ -46,7 +47,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - if (NPC.ai[3] > 0f) + if (NPC.ai[3] > 0f && Main.npc[(int)NPC.ai[3]].type == ModContent.NPCType()) { NPC.realLife = (int)NPC.ai[3]; } @@ -65,9 +66,33 @@ namespace CalamityMod.NPCs.NormalNPCs } if (flag) { - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); + if (!Main.getGoodWorld) // move to zenith seed later + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + } + else + { + // find a new npc to attatch to in gfb, it's not a bug, it's a feature:tm: + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC host = Main.npc[i]; + if (host.active && !host.friendly && !host.dontTakeDamage && host.type != ModContent.NPCType() && host.type != ModContent.NPCType() && host.type != ModContent.NPCType()) + { + NPC.ai[1] = host.whoAmI; + NPC.ai[3] = host.whoAmI; + break; + } + } + // if it goes through the loop withuot finding an npc to attatch to (aka, ai[1] never changes and the head is still dead) kill as normal + if (Main.npc[(int)NPC.ai[1]].life <= 0) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + } + } } if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -88,7 +113,7 @@ namespace CalamityMod.NPCs.NormalNPCs num6 *= num8; num7 *= num8; int num9 = 30; - int num10 = ProjectileID.SaucerScrap; + int num10 = Main.getGoodWorld ? ModContent.ProjectileType() : ProjectileID.SaucerScrap; // move to zenith seed later vector.X += num6 * 5f; vector.Y += num7 * 5f; Projectile.NewProjectile(NPC.GetSource_FromAI(), vector.X, vector.Y, num6, num7, num10, num9, 0f, Main.myPlayer, 0f, 0f); @@ -152,5 +177,24 @@ namespace CalamityMod.NPCs.NormalNPCs { return false; } + + public override void ModifyTypeName(ref string typeName) + { + // Move to zenith seed later + if (Main.getGoodWorld) + { + typeName = "Mechanized Serpent"; + } + } + + public override Color? GetAlpha(Color drawColor) + { + // Move to zenith seed later + // Every other body segment is pink while the rest are orange in gfb + Color baseColor = NPC.whoAmI % 2 == 0 ? Color.Orange : Color.Pink; + Color lightColor = baseColor * drawColor.A; + Color newColor = Main.getGoodWorld ? lightColor : new Color(255, 255, 255, drawColor.A); + return newColor * NPC.Opacity; + } } } diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index c7bc742647..fca106ef5b 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -8,6 +9,7 @@ using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using Terraria.GameContent.ItemDropRules; namespace CalamityMod.NPCs.NormalNPCs { @@ -188,7 +190,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.localAI[1] = 0f; } float num17 = death ? 13.5f : 10f; - if (Main.player[NPC.target].dead || (double)Main.player[NPC.target].position.Y < Main.rockLayer * 16.0) + if (Main.player[NPC.target].dead || (!Main.getGoodWorld && (double)Main.player[NPC.target].position.Y < Main.rockLayer * 16.0)) // move to zenith seed later { flag2 = false; NPC.velocity.Y = NPC.velocity.Y + 1f; @@ -458,6 +460,25 @@ namespace CalamityMod.NPCs.NormalNPCs npcLoot.Add(ModContent.ItemType(), 1, 2, 4); npcLoot.Add(ModContent.ItemType(), 1, 4, 8); npcLoot.Add(ModContent.ItemType(), 1, 4, 8); + npcLoot.AddIf(() => Main.getGoodWorld, ModContent.ItemType(), 1, 3, 6); // move to zenith seed later + npcLoot.AddIf(() => Main.getGoodWorld, ModContent.ItemType(), 10); + } + + public override void ModifyTypeName(ref string typeName) + { + // Move to zenith seed later + if (Main.getGoodWorld) + { + typeName = "Mechanized Serpent"; + } + } + + public override Color? GetAlpha(Color drawColor) + { + // Move to zenith seed later + Color lightColor = Color.Orange * drawColor.A; + Color newColor = Main.getGoodWorld ? lightColor : new Color(255, 255, 255, drawColor.A); + return newColor * NPC.Opacity; } } } diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs index ba6bd9c703..34422a849c 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.cs @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - if (NPC.ai[3] > 0f) + if (NPC.ai[3] > 0f && Main.npc[(int)NPC.ai[3]].type == ModContent.NPCType()) { NPC.realLife = (int)NPC.ai[3]; } @@ -63,7 +63,7 @@ namespace CalamityMod.NPCs.NormalNPCs { flag = true; } - if (flag) + if (flag && !Main.getGoodWorld) // move to zenith seed later { NPC.life = 0; NPC.HitEffect(0, 10.0); @@ -125,5 +125,22 @@ namespace CalamityMod.NPCs.NormalNPCs } } } + + public override void ModifyTypeName(ref string typeName) + { + // Move to zenith seed later + if (Main.getGoodWorld) + { + typeName = "Mechanized Serpent"; + } + } + + public override Color? GetAlpha(Color drawColor) + { + // Move to zenith seed later + Color lightColor = Color.Orange * drawColor.A; + Color newColor = Main.getGoodWorld ? lightColor : new Color(255, 255, 255, drawColor.A); + return newColor * NPC.Opacity; + } } } diff --git a/Systems/WorldMiscUpdateSystem.cs b/Systems/WorldMiscUpdateSystem.cs index a40f9ccc94..d87327885b 100644 --- a/Systems/WorldMiscUpdateSystem.cs +++ b/Systems/WorldMiscUpdateSystem.cs @@ -339,7 +339,8 @@ namespace CalamityMod.Systems #region Handle Armored Digger Random Spawns public static void TrySpawnArmoredDigger(Player player, CalamityPlayer modPlayer) { - if (player.ZoneRockLayerHeight && !player.ZoneUnderworldHeight && !player.ZoneDungeon && !player.ZoneJungle && !modPlayer.ZoneSunkenSea && !modPlayer.ZoneAbyss && !CalamityPlayer.areThereAnyDamnBosses) + bool gfbCondition = Main.getGoodWorld && (player.ZoneHallow || player.ZoneUnderworldHeight) && NPC.downedMoonlord; // move to zenith seed later + if ((gfbCondition || (player.ZoneRockLayerHeight && !player.ZoneUnderworldHeight && !player.ZoneJungle && !Main.getGoodWorld)) && !player.ZoneDungeon && !modPlayer.ZoneSunkenSea && !modPlayer.ZoneAbyss && !CalamityPlayer.areThereAnyDamnBosses) { if (NPC.downedPlantBoss && player.townNPCs < 3f) {