From 4b1fe79f887f463a9c3f4f2978b18c4e7e360ad4 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Wed, 20 Oct 2021 00:27:48 -0500 Subject: [PATCH] 1 - Speedrun Timer. 2 - Draedon lines in exo mech AIs, currently commented out because the text doesn't exist yet. --- CalPlayer/CalamityPlayer.cs | 50 ++- CalPlayer/CalamityPlayerDrawEffects.cs | 295 +++++++++++++++++- CalamityConfig.cs | 22 ++ CalamityLists.cs | 64 ++++ CalamityNetcode.cs | 2 +- NPCs/AquaticScourge/AquaticScourgeHead.cs | 4 +- NPCs/AstrumAureus/AstrumAureus.cs | 4 +- NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs | 4 +- NPCs/BrimstoneElemental/BrimstoneElemental.cs | 4 +- NPCs/Bumblebirb/Bumblefuck.cs | 4 +- NPCs/Calamitas/CalamitasRun3.cs | 4 +- NPCs/CalamityGlobalNPC.cs | 20 ++ NPCs/CalamityGlobalNPCLoot.cs | 18 +- NPCs/CeaselessVoid/CeaselessVoid.cs | 2 + NPCs/Crabulon/CrabulonIdle.cs | 4 +- NPCs/Cryogen/Cryogen.cs | 4 +- NPCs/DesertScourge/DesertScourgeHead.cs | 4 +- NPCs/DevourerofGods/DevourerofGodsHeadS.cs | 4 +- NPCs/ExoMechs/Apollo/Apollo.cs | 52 ++- NPCs/ExoMechs/Ares/AresBody.cs | 54 +++- NPCs/ExoMechs/Thanatos/ThanatosHead.cs | 52 ++- NPCs/HiveMind/HiveMindP2.cs | 4 +- NPCs/Leviathan/Leviathan.cs | 4 +- NPCs/OldDuke/OldDuke.cs | 4 +- NPCs/Perforator/PerforatorHive.cs | 4 +- .../PlaguebringerGoliath.cs | 4 +- NPCs/Polterghast/Polterghast.cs | 4 +- .../ProfanedGuardians/ProfanedGuardianBoss.cs | 6 +- NPCs/Providence/Providence.cs | 4 +- NPCs/Ravager/RavagerBody.cs | 4 +- NPCs/Signus/Signus.cs | 2 + NPCs/SlimeGod/SlimeGodCore.cs | 4 +- NPCs/StormWeaver/StormWeaverHeadNaked.cs | 2 + NPCs/SupremeCalamitas/SupremeCalamitas.cs | 4 +- NPCs/Yharon/Yharon.cs | 2 + World/CalamityWorld.cs | 4 +- 36 files changed, 671 insertions(+), 56 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index a05844658d..a6ed7e8c2a 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -141,10 +141,16 @@ namespace CalamityMod.CalPlayer public DoGCartSegment[] DoGCartSegments = new DoGCartSegment[DoGCartMount.SegmentCount]; public float SmoothenedMinecartRotation; public float MusicMuffleFactor; - #endregion + #endregion - #region Tile Entity Trackers - public int CurrentlyViewedFactoryID = -1; + #region Speedrun Timer + public int speedrunTimer = 0; + public int bossTypeJustDowned = -1; + public int bossTypeJustDownedTime = 0; + #endregion + + #region Tile Entity Trackers + public int CurrentlyViewedFactoryID = -1; public int CurrentlyViewedChargerID = -1; public int CurrentlyViewedHologramID = -1; public string CurrentlyViewedHologramText; @@ -1098,7 +1104,7 @@ namespace CalamityMod.CalPlayer #endregion - #region SavingAndLoading + #region Saving And Loading public override void Initialize() { extraAccessoryML = false; @@ -1220,8 +1226,11 @@ namespace CalamityMod.CalPlayer { "itemTypeLastReforged", itemTypeLastReforged }, { "reforgeTierSafety", reforgeTierSafety }, { "moveSpeedStat", moveSpeedStat }, - { "defenseDamage", defenseDamage } - }; + { "defenseDamage", defenseDamage }, + { "speedrunTimer", speedrunTimer }, + { "bossTypeJustDowned", bossTypeJustDowned }, + { "bossTypeJustDownedTime", bossTypeJustDownedTime } + }; } public override void Load(TagCompound tag) @@ -1312,7 +1321,11 @@ namespace CalamityMod.CalPlayer moveSpeedStat = tag.GetInt("moveSpeedStat"); defenseDamage = tag.GetInt("defenseDamage"); - } + + speedrunTimer = tag.GetInt("speedrunTimer"); + bossTypeJustDowned = tag.GetInt("bossTypeJustDowned"); + bossTypeJustDownedTime = tag.GetInt("bossTypeJustDownedTime"); + } public override void LoadLegacy(BinaryReader reader) { @@ -1351,7 +1364,11 @@ namespace CalamityMod.CalPlayer defenseDamage = reader.ReadInt32(); - if (loadVersion == 0) + speedrunTimer = reader.ReadInt32(); + bossTypeJustDowned = reader.ReadInt32(); + bossTypeJustDownedTime = reader.ReadInt32(); + + if (loadVersion == 0) { BitsByte flags = reader.ReadByte(); extraAccessoryML = flags[0]; @@ -3888,10 +3905,17 @@ namespace CalamityMod.CalPlayer player.AddBuff(ModContent.BuffType(), 60, true); } } - #endregion + #endregion - #region PreUpdate - public override void PreUpdate() + #region Update Autopause + public override void UpdateAutopause() + { + speedrunTimer++; + } + #endregion + + #region PreUpdate + public override void PreUpdate() { tailFrameUp++; if (tailFrameUp == 8) @@ -3927,7 +3951,9 @@ namespace CalamityMod.CalPlayer GameShaders.Armor.GetSecondaryShader(player.dye[i].dye, player)?.UseColor(CalamityPlayerDrawEffects.GetCurrentMoonlightDyeColor()); } } - } + + speedrunTimer++; + } #endregion #region PreUpdateBuffs diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 93bf3b791d..6ed9ee68a4 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -5,7 +5,33 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.Polterghast; +using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.Signus; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.Yharon; using CalamityMod.Projectiles.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -18,8 +44,6 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using ProvidenceBoss = CalamityMod.NPCs.Providence.Providence; - namespace CalamityMod.CalPlayer { public class CalamityPlayerDrawEffects : ModPlayer @@ -723,8 +747,269 @@ namespace CalamityMod.CalPlayer { CalamityPlayer calamityPlayer = player.Calamity(); - // Dust modifications while high. - if (calamityPlayer.trippy) + if (Main.myPlayer == player.whoAmI && !Main.gameMenu) + { + if (CalamityConfig.Instance.SpeedrunTimer) + { + double fractionsOfSeconds = calamityPlayer.speedrunTimer / 60D; + fractionsOfSeconds -= Math.Truncate(fractionsOfSeconds); + fractionsOfSeconds *= 1000D; + int milliseconds = (int)Math.Truncate(fractionsOfSeconds); + int seconds = calamityPlayer.speedrunTimer / 60; + int minutes = calamityPlayer.speedrunTimer / 3600; + int hours = calamityPlayer.speedrunTimer / 216000; + + seconds -= minutes * 60; + minutes -= hours * 60; + + if (hours > 99) + { + seconds = minutes = 59; + hours = 99; + } + + string fractionsOfSecondsText = milliseconds > 99 ? milliseconds.ToString() : "0" + milliseconds.ToString(); + string secondsText = seconds > 9 ? seconds.ToString() : "0" + seconds.ToString(); + string minutesText = minutes > 9 ? minutes.ToString() : "0" + minutes.ToString(); + string hoursText = hours > 9 ? hours.ToString() : "0" + hours.ToString(); + + string text = hoursText + ":" + minutesText + ":" + secondsText + "." + fractionsOfSecondsText; + float scale = 2f; + float xOffset = CalamityConfig.Instance.SpeedrunTimerPosX; + float yOffset = CalamityConfig.Instance.SpeedrunTimerPosY; + + Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, text, Main.screenWidth / 2f - xOffset, yOffset, Color.White, Color.Black, default, scale); + + if (calamityPlayer.bossTypeJustDowned > -1) + { + fractionsOfSeconds = calamityPlayer.bossTypeJustDownedTime / 60D; + fractionsOfSeconds -= Math.Truncate(fractionsOfSeconds); + fractionsOfSeconds *= 1000D; + milliseconds = (int)Math.Truncate(fractionsOfSeconds); + seconds = calamityPlayer.bossTypeJustDownedTime / 60; + minutes = calamityPlayer.bossTypeJustDownedTime / 3600; + hours = calamityPlayer.bossTypeJustDownedTime / 216000; + + seconds -= minutes * 60; + minutes -= hours * 60; + + if (hours > 99) + { + seconds = minutes = 59; + hours = 99; + } + + fractionsOfSecondsText = milliseconds > 99 ? milliseconds.ToString() : "0" + milliseconds.ToString(); + secondsText = seconds > 9 ? seconds.ToString() : "0" + seconds.ToString(); + minutesText = minutes > 9 ? minutes.ToString() : "0" + minutes.ToString(); + hoursText = hours > 9 ? hours.ToString() : "0" + hours.ToString(); + + text = hoursText + ":" + minutesText + ":" + secondsText + "." + fractionsOfSecondsText; + scale = 1f; + yOffset += 44f; + + Texture2D texture = null; + switch (calamityPlayer.bossTypeJustDowned) + { + // King Slime + case 1: + texture = Main.npcHeadBossTexture[7]; + break; + + case 2: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + // Eye of Cthulhu + case 3: + texture = Main.npcHeadBossTexture[1]; + break; + + case 4: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + // Eater of Worlds + case 5: + texture = Main.npcHeadBossTexture[2]; + break; + + // Brain of Cthulhu + case 6: + texture = Main.npcHeadBossTexture[23]; + break; + + case 7: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + case 8: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + // Queen Bee + case 9: + texture = Main.npcHeadBossTexture[14]; + break; + + // Skeletron + case 10: + texture = Main.npcHeadBossTexture[19]; + break; + + case 11: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + // Wall of Flesh + case 12: + texture = Main.npcHeadBossTexture[22]; + break; + + case 13: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + // The Twins + case 14: + texture = Main.npcHeadBossTexture[21]; + break; + + case 15: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + // The Destroyer + case 16: + texture = Main.npcHeadBossTexture[25]; + break; + + case 17: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + // Skeletron Prime + case 18: + texture = Main.npcHeadBossTexture[18]; + break; + + case 19: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + // Plantera + case 20: + texture = Main.npcHeadBossTexture[12]; + break; + + case 21: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + case 22: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + // Golem + case 23: + texture = Main.npcHeadBossTexture[5]; + break; + + case 24: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + // Duke Fishron + case 25: + texture = Main.npcHeadBossTexture[4]; + break; + + case 26: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + // Lunatic Cultist + case 27: + texture = Main.npcHeadBossTexture[31]; + break; + + case 28: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + // Moon Lord + case 29: + texture = Main.npcHeadBossTexture[8]; + break; + + case 30: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + case 31: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + case 32: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + case 33: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + case 34: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + case 35: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + case 36: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + case 37: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + case 38: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + case 39: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + case 40: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + case 41: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + case 42: + texture = Main.npcHeadBossTexture[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]; + break; + + default: + break; + } + + xOffset -= 58f; + + if (texture != null) + Main.spriteBatch.Draw(texture, new Vector2(Main.screenWidth / 2f - xOffset - texture.Width - 4f, yOffset), null, Color.White, 0f, default, 1f, SpriteEffects.None, 0f); + + Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, text, Main.screenWidth / 2f - xOffset, yOffset, Color.White, Color.Black, default, scale); + } + } + } + + // Dust modifications while high. + if (calamityPlayer.trippy) { if (Main.myPlayer == player.whoAmI) { diff --git a/CalamityConfig.cs b/CalamityConfig.cs index 51c27677d8..a5fa22b41d 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -118,6 +118,28 @@ namespace CalamityMod [Tooltip("The Y position of the Charge Meter.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.")] public float ChargeMeterPosY { get; set; } + [Label("Speedrun Timer")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(false)] + [Tooltip("Enables a Speedrun Timer.")] + public bool SpeedrunTimer { get; set; } + + [Label("Speedrun Timer X Position")] + [BackgroundColor(192, 54, 64, 192)] + [SliderColor(224, 165, 56, 128)] + [Range(-800f, 800f)] + [DefaultValue(68f)] + [Tooltip("The X position of the Speedrun Timer.")] + public float SpeedrunTimerPosX { get; set; } + + [Label("Speedrun Timer Y Position")] + [BackgroundColor(192, 54, 64, 192)] + [SliderColor(224, 165, 56, 128)] + [Range(16f, 1000f)] + [DefaultValue(16f)] + [Tooltip("The Y position of the Speedrun Timer.")] + public float SpeedrunTimerPosY { get; set; } + [Header("General Gameplay Changes")] [Label("Early Hardmode Progression Rework")] diff --git a/CalamityLists.cs b/CalamityLists.cs index eef7fac556..bf830c9647 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -37,7 +37,9 @@ using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.HiveMind; @@ -47,6 +49,8 @@ using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.PlaguebringerGoliath; using CalamityMod.NPCs.PlagueEnemies; +using CalamityMod.NPCs.Polterghast; +using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.Signus; @@ -154,6 +158,8 @@ namespace CalamityMod public static List pierceResistList; public static List pierceResistExceptionList; + public static SortedDictionary bossTypes; + public static List legOverrideList; public static List kamiDebuffColorImmuneList; @@ -2768,6 +2774,61 @@ namespace CalamityMod ProjectileType() }; + bossTypes = new SortedDictionary() + { + { NPCID.KingSlime, 1 }, + { NPCType(), 2 }, + { NPCID.EyeofCthulhu, 3 }, + { NPCType(), 4 }, + { NPCID.EaterofWorldsHead, 5 }, + { NPCID.EaterofWorldsBody, 5 }, + { NPCID.EaterofWorldsTail, 5 }, + { NPCID.BrainofCthulhu, 6 }, + { NPCType(), 7 }, + { NPCType(), 8 }, + { NPCID.QueenBee, 9 }, + { NPCID.SkeletronHead, 10 }, + { NPCType(), 11 }, + { NPCType(), 11 }, + { NPCType(), 11 }, + { NPCID.WallofFlesh, 12 }, + { NPCType(), 13 }, + { NPCID.Retinazer, 14 }, + { NPCID.Spazmatism, 14 }, + { NPCType(), 15 }, + { NPCID.TheDestroyer, 16 }, + { NPCType(), 17 }, + { NPCID.SkeletronPrime, 18 }, + { NPCType(), 19 }, + { NPCID.Plantera, 20 }, + { NPCType(), 21 }, + { NPCType(), 21 }, + { NPCType(), 22 }, + { NPCID.Golem, 23 }, + { NPCType(), 24 }, + { NPCID.DukeFishron, 25 }, + { NPCType(), 26 }, + { NPCID.CultistBoss, 27 }, + { NPCType(), 28 }, + { NPCID.MoonLordCore, 29 }, + { NPCType(), 30 }, + { NPCType(), 31 }, + { NPCType(), 32 }, + { NPCType(), 33 }, + { NPCType(), 34 }, + { NPCType(), 35 }, + { NPCType(), 36 }, + { NPCType(), 37 }, + { NPCType(), 38 }, + { NPCType(), 39 }, + { NPCType(), 40 }, + { NPCType(), 41 }, + { NPCType(), 41 }, + { NPCType(), 41 }, + { NPCType(), 41 }, + { NPCType(), 42 } + }; + bossMinionList = new List() { NPCType(), @@ -2998,6 +3059,9 @@ namespace CalamityMod pierceResistList = null; pierceResistExceptionList = null; + bossTypes?.Clear(); + bossTypes = null; + legOverrideList = null; kamiDebuffColorImmuneList = null; diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index 3ddd3c05a5..64f1b013b6 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -400,5 +400,5 @@ namespace CalamityMod // Reforge syncs ItemTypeLastReforgedSync, // TODO -- there has to be a better way to do this, but I don't know what it is ReforgeTierSafetySync - } + } } diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index f633fd921e..938137f84f 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -172,7 +172,9 @@ namespace CalamityMod.NPCs.AquaticScourge public override void NPCLoot() { - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drops for Aquatic Scourge DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index c96b26ee26..e58d1ab3ac 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -319,7 +319,9 @@ namespace CalamityMod.NPCs.AstrumAureus public override void NPCLoot() { - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drop for Astrum Aureus DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs index 8a9db4814b..2eec48e262 100644 --- a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -229,7 +229,9 @@ namespace CalamityMod.NPCs.AstrumDeus otherWormHead.checkDead(); otherWormHead.netUpdate = true; } - } + } + + CalamityGlobalNPC.SetNewBossJustDowned(npc); DropHelper.DropBags(npc); diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 5028ba34db..6e2807aeff 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -146,7 +146,9 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void NPCLoot() { - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drop for Brimstone Elemental DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index 3ffcfe54aa..aad9d8deb9 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -407,7 +407,9 @@ namespace CalamityMod.NPCs.Bumblebirb public override void NPCLoot() { - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drop for Dragonfolly DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/Calamitas/CalamitasRun3.cs b/NPCs/Calamitas/CalamitasRun3.cs index d5047b4aee..2d5f4ac82f 100644 --- a/NPCs/Calamitas/CalamitasRun3.cs +++ b/NPCs/Calamitas/CalamitasRun3.cs @@ -151,7 +151,9 @@ namespace CalamityMod.NPCs.Calamitas public override void NPCLoot() { - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drop for Cal Clone DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 5a64d1546e..08dc5fd9d6 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -5095,6 +5095,26 @@ namespace CalamityMod.NPCs } #endregion + #region Speedrun Display + public static void SetNewBossJustDowned(NPC npc) + { + if (!GetDownedBossVariable(npc.type)) + { + CalamityLists.bossTypes.TryGetValue(npc.type, out int newBossTypeJustDowned); + + for (int i = 0; i < Main.maxPlayers; i++) + { + Player player = Main.player[i]; + if (!player.active) + continue; + + player.Calamity().bossTypeJustDowned = newBossTypeJustDowned; + player.Calamity().bossTypeJustDownedTime = player.Calamity().speedrunTimer; + } + } + } + #endregion + #region Player Counts public static bool AnyLivingPlayers() { diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 6ae4b5f5a6..0cfedd30e2 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -96,6 +96,7 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedSlimeKing); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Dryad }, NPC.downedSlimeKing); + CalamityGlobalNPC.SetNewBossJustDowned(npc); } else if (npc.type == NPCID.EyeofCthulhu) { @@ -105,6 +106,7 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedBoss1); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.Dryad }, NPC.downedBoss1); + CalamityGlobalNPC.SetNewBossJustDowned(npc); } else if ((npc.boss && (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail)) || npc.type == NPCID.BrainofCthulhu) { @@ -113,6 +115,7 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, WorldGen.crimson && !NPC.downedBoss2); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, WorldGen.crimson && !NPC.downedBoss2); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.ArmsDealer, NPCID.Dryad }, NPC.downedBoss2); + CalamityGlobalNPC.SetNewBossJustDowned(npc); } else if (npc.type == NPCID.QueenBee) { @@ -137,6 +140,7 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedQueenBee); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.ArmsDealer, NPCID.Dryad }, NPC.downedQueenBee); + CalamityGlobalNPC.SetNewBossJustDowned(npc); } else if (npc.type == NPCID.SkeletronHead) { @@ -147,6 +151,7 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedBoss3); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.Dryad }, NPC.downedBoss3); + CalamityGlobalNPC.SetNewBossJustDowned(npc); } else if (npc.type == NPCID.WallofFlesh) { @@ -193,6 +198,7 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !Main.hardMode); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !Main.hardMode); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.ArmsDealer, NPCID.Dryad, NPCID.Painter, NPCID.WitchDoctor, NPCID.Stylist, NPCID.DyeTrader, NPCID.Demolitionist, NPCID.PartyGirl, NPCID.Clothier, NPCID.SkeletonMerchant, ModContent.NPCType() }, Main.hardMode); + CalamityGlobalNPC.SetNewBossJustDowned(npc); // First kill text (this is not a loot function) if (!Main.hardMode) @@ -231,6 +237,7 @@ namespace CalamityMod.NPCs CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType() }, NPC.downedMechBossAny); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || NPC.downedMechBoss2 || !NPC.downedMechBoss3); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss2 || !CalamityConfig.Instance.SellVanillaSummons); + CalamityGlobalNPC.SetNewBossJustDowned(npc); if (!NPC.downedMechBoss2 && CalamityConfig.Instance.EarlyHardmodeProgressionRework) SpawnMechBossHardmodeOres(); @@ -251,6 +258,7 @@ namespace CalamityMod.NPCs CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType() }, NPC.downedMechBossAny); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss1 || !CalamityConfig.Instance.SellVanillaSummons); + CalamityGlobalNPC.SetNewBossJustDowned(npc); if (!NPC.downedMechBoss1 && CalamityConfig.Instance.EarlyHardmodeProgressionRework) SpawnMechBossHardmodeOres(); @@ -272,6 +280,7 @@ namespace CalamityMod.NPCs CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType() }, NPC.downedMechBossAny); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss3 || !CalamityConfig.Instance.SellVanillaSummons); + CalamityGlobalNPC.SetNewBossJustDowned(npc); if (!NPC.downedMechBoss3 && CalamityConfig.Instance.EarlyHardmodeProgressionRework) SpawnMechBossHardmodeOres(); @@ -308,6 +317,7 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedPlantBoss); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.WitchDoctor, NPCID.Truffle, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedPlantBoss); + CalamityGlobalNPC.SetNewBossJustDowned(npc); // Spawn Perennial Ore if Plantera has never been killed if (!NPC.downedPlantBoss) @@ -374,6 +384,7 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedGolemBoss); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.ArmsDealer, NPCID.Cyborg, NPCID.Steampunker, NPCID.Wizard, NPCID.WitchDoctor, NPCID.DD2Bartender, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedGolemBoss); + CalamityGlobalNPC.SetNewBossJustDowned(npc); // If Golem has never been killed, send a message about the Plague. if (!NPC.downedGolemBoss) @@ -427,6 +438,7 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedFishron); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, NPC.downedFishron || !CalamityConfig.Instance.SellVanillaSummons); + CalamityGlobalNPC.SetNewBossJustDowned(npc); } else if (npc.type == NPCID.CultistBoss) { @@ -436,6 +448,7 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedAncientCultist); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, Main.bloodMoon); + CalamityGlobalNPC.SetNewBossJustDowned(npc); // Deus text (this is not a loot function) if (!NPC.downedAncientCultist) @@ -482,6 +495,7 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedMoonlord); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, NPC.downedMoonlord); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Wizard }, NPC.downedMoonlord || !CalamityConfig.Instance.SellVanillaSummons); + CalamityGlobalNPC.SetNewBossJustDowned(npc); string key = "Mods.CalamityMod.MoonBossText"; Color messageColor = Color.Orange; @@ -1359,6 +1373,6 @@ namespace CalamityMod.NPCs } } } - #endregion - } + #endregion + } } diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 51309e5ddf..32f0e4c0a1 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -159,6 +159,8 @@ namespace CalamityMod.NPCs.CeaselessVoid bool fullStrength = !CalamityWorld.downedSentinel1 || CalamityWorld.DoGSecondStageCountdown <= 0; if (fullStrength) { + CalamityGlobalNPC.SetNewBossJustDowned(npc); + DropHelper.DropBags(npc); // Legendary drop for Ceaseless Void diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index 98f3bea9e3..265f5e1a32 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -665,7 +665,9 @@ namespace CalamityMod.NPCs.Crabulon public override void NPCLoot() { - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drop for Crabulon DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 1f89fb60ec..a847a75bc3 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -1089,7 +1089,9 @@ namespace CalamityMod.NPCs.Cryogen public override void NPCLoot() { - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drops for Cryogen DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 0deb863734..d0ffa72f1a 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -555,7 +555,9 @@ namespace CalamityMod.NPCs.DesertScourge public override void NPCLoot() { - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drop for Desert Scourge DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index 34b668db1a..a486fc0b17 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -1214,7 +1214,9 @@ namespace CalamityMod.NPCs.DevourerofGods // Stop the countdown -- if you kill DoG in less than 60 frames, this will stop another one from spawning. CalamityWorld.DoGSecondStageCountdown = 0; - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drops for DoG DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index b48189e7e5..f4197c141a 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -63,6 +63,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo set => npc.Calamity().newAI[1] = value; } + // Used for Draedon's text + public static readonly Color TextColor = new Color(155, 255, 255); + // Number of frames on the X and Y axis private const int maxFramesX = 10; private const int maxFramesY = 9; @@ -558,6 +561,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (Main.netMode != NetmodeID.MultiplayerClient) { + // Draedon text for the start of phase 2 + //CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase2Text1", TextColor); + // Spawn the fuckers NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); @@ -599,6 +605,13 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo chargeLocations[i] = default; npc.TargetClosest(); + + // Phase 6, when 1 mech goes berserk and the other one leaves + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Draedon text for the start of phase 6 + //CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase6Text1", TextColor); + } } } @@ -642,6 +655,16 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Never be passive if berserk SecondaryAIState = (float)SecondaryPhase.Nothing; + + // Phase 4, when 1 mech goes berserk and the other 2 leave + if (exoWormAlive && exoPrimeAlive) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Draedon text for the start of phase 4 + //CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase4Text1", TextColor); + } + } } break; @@ -667,6 +690,16 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo chargeLocations[i] = default; npc.TargetClosest(); + + // Phase 3, when all 3 mechs attack at the same time + if (exoWormAlive && exoPrimeAlive) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Draedon text for the start of phase 3 + //CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase3Text1", TextColor); + } + } } if (berserk) @@ -1382,19 +1415,30 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public override void NPCLoot() { // Check if the other exo mechs are alive - bool otherExoMechsAlive = false; + bool exoWormAlive = false; + bool exoPrimeAlive = false; if (CalamityGlobalNPC.draedonExoMechWorm != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) - otherExoMechsAlive = true; + exoWormAlive = true; } if (CalamityGlobalNPC.draedonExoMechPrime != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) - otherExoMechsAlive = true; + exoPrimeAlive = true; } - if (!otherExoMechsAlive) + // Phase 5, when 1 mech dies and the other 2 return to fight + if (exoWormAlive && exoPrimeAlive) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Draedon text for the start of phase 5 + //CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase5Text1", TextColor); + } + } + + if (!exoWormAlive && !exoPrimeAlive) AresBody.DropExoMechLoot(npc, (int)AresBody.MechType.ArtemisAndApollo); } diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index dae7da08f8..e5fee22b8f 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -72,6 +72,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares set => npc.localAI[1] = value; } + // Used for Draedon's text + public static readonly Color TextColor = new Color(155, 255, 255); + public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); // Spawn rate for enrage steam @@ -454,6 +457,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (Main.netMode != NetmodeID.MultiplayerClient) { + // Draedon text for the start of phase 2 + //CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase2Text1", TextColor); + // Spawn the fuckers NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); @@ -480,6 +486,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Reset everything SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; npc.TargetClosest(); + + // Phase 6, when 1 mech goes berserk and the other one leaves + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Draedon text for the start of phase 6 + //CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase6Text1", TextColor); + } } } @@ -504,6 +517,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Never be passive if berserk SecondaryAIState = (float)SecondaryPhase.Nothing; + + // Phase 4, when 1 mech goes berserk and the other 2 leave + if (exoWormAlive && exoTwinsAlive) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Draedon text for the start of phase 4 + //CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase4Text1", TextColor); + } + } } break; @@ -518,6 +541,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Return to normal phases if one or more mechs have been downed SecondaryAIState = totalOtherExoMechLifeRatio > 5f ? (float)SecondaryPhase.Nothing : (float)SecondaryPhase.Passive; npc.TargetClosest(); + + // Phase 3, when all 3 mechs attack at the same time + if (exoWormAlive && exoTwinsAlive) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Draedon text for the start of phase 3 + //CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase3Text1", TextColor); + } + } } if (berserk) @@ -798,20 +831,31 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void NPCLoot() { // Check if the other exo mechs are alive - bool otherExoMechsAlive = false; + bool exoWormAlive = false; + bool exoTwinsAlive = false; if (CalamityGlobalNPC.draedonExoMechWorm != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) - otherExoMechsAlive = true; + exoWormAlive = true; } if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) - otherExoMechsAlive = true; + exoTwinsAlive = true; + } + + // Phase 5, when 1 mech dies and the other 2 return to fight + if (exoWormAlive && exoTwinsAlive) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Draedon text for the start of phase 5 + //CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase5Text1", TextColor); + } } // Mark Exo Mechs as dead - if (!otherExoMechsAlive) + if (!exoWormAlive && !exoTwinsAlive) DropExoMechLoot(npc, (int)MechType.Ares); } @@ -854,6 +898,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares break; } + CalamityGlobalNPC.SetNewBossJustDowned(npc); + DropHelper.DropBags(npc); // All other drops are contained in the bag, so they only drop directly on Normal diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index c4426d8657..4738f52409 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -60,6 +60,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos set => npc.Calamity().newAI[1] = value; } + // Used for Draedon's text + public static readonly Color TextColor = new Color(155, 255, 255); + public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); // Timer to prevent Thanatos from dealing contact damage for a bit @@ -501,6 +504,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (Main.netMode != NetmodeID.MultiplayerClient) { + // Draedon text for the start of phase 2 + //CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase2Text1", TextColor); + // Spawn the fuckers NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); @@ -537,6 +543,13 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos calamityGlobalNPC.newAI[3] = 0f; chargeVelocityScalar = 0f; npc.TargetClosest(); + + // Phase 6, when 1 mech goes berserk and the other one leaves + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Draedon text for the start of phase 6 + //CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase6Text1", TextColor); + } } } @@ -575,6 +588,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Never be passive if berserk SecondaryAIState = (float)SecondaryPhase.Nothing; + + // Phase 4, when 1 mech goes berserk and the other 2 leave + if (exoTwinsAlive && exoPrimeAlive) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Draedon text for the start of phase 4 + //CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase4Text1", TextColor); + } + } } break; @@ -597,6 +620,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos calamityGlobalNPC.newAI[3] = 0f; chargeVelocityScalar = 0f; npc.TargetClosest(); + + // Phase 3, when all 3 mechs attack at the same time + if (exoPrimeAlive && exoTwinsAlive) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Draedon text for the start of phase 3 + //CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase3Text1", TextColor); + } + } } if (berserk) @@ -1067,19 +1100,30 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void NPCLoot() { // Check if the other exo mechs are alive - bool otherExoMechsAlive = false; + bool exoTwinsAlive = false; + bool exoPrimeAlive = false; if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) - otherExoMechsAlive = true; + exoTwinsAlive = true; } if (CalamityGlobalNPC.draedonExoMechPrime != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) - otherExoMechsAlive = true; + exoPrimeAlive = true; } - if (!otherExoMechsAlive) + // Phase 5, when 1 mech dies and the other 2 return to fight + if (exoTwinsAlive && exoPrimeAlive) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Draedon text for the start of phase 5 + //CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase5Text1", TextColor); + } + } + + if (!exoTwinsAlive && !exoPrimeAlive) AresBody.DropExoMechLoot(npc, (int)AresBody.MechType.Thanatos); } diff --git a/NPCs/HiveMind/HiveMindP2.cs b/NPCs/HiveMind/HiveMindP2.cs index 4b824a1762..bbdf739f27 100644 --- a/NPCs/HiveMind/HiveMindP2.cs +++ b/NPCs/HiveMind/HiveMindP2.cs @@ -759,7 +759,9 @@ namespace CalamityMod.NPCs.HiveMind public override void NPCLoot() { - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drop for Evil boss tier 2 DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index fa1c08064a..52270b2e0c 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -726,7 +726,9 @@ namespace CalamityMod.NPCs.Leviathan // This loot code is shared with Anahita. public static void DropSirenLeviLoot(NPC npc) { - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drop for Leviathan and Anahita DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 9459854e2b..c17cb309c9 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -370,7 +370,9 @@ namespace CalamityMod.NPCs.OldDuke public override void NPCLoot() { - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drop for Old Duke DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 999291e97e..2c8849a4d5 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -450,7 +450,9 @@ namespace CalamityMod.NPCs.Perforator public override void NPCLoot() { - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drop for Evil boss tier 2 DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index ea64fd0eba..9298a1f711 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -1215,7 +1215,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void NPCLoot() { - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drop for PBG DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 1f98d4a1ba..26241e62f1 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -975,7 +975,9 @@ namespace CalamityMod.NPCs.Polterghast public override void NPCLoot() { - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drop for Polterghast DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs index ad3f0d6531..b889b20b94 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs @@ -435,8 +435,10 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void NPCLoot() { - // Profaned Guardians have no actual drops and no treasure bag - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + // Profaned Guardians have no actual drops and no treasure bag + DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItem(npc, ModContent.ItemType()); diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 7677a9bb9f..70cf6178d3 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -1339,7 +1339,9 @@ namespace CalamityMod.NPCs.Providence public override void NPCLoot() { - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drop for Providence DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice || !hasTakenDaytimeDamage); diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 8d39a3bcfb..7e7830a60e 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -701,7 +701,9 @@ namespace CalamityMod.NPCs.Ravager public override void NPCLoot() { - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drop for Ravager DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 9c5fe321e7..5d55e3f7a3 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -765,6 +765,8 @@ namespace CalamityMod.NPCs.Signus bool fullStrength = !CalamityWorld.downedSentinel3 || CalamityWorld.DoGSecondStageCountdown <= 0; if (fullStrength) { + CalamityGlobalNPC.SetNewBossJustDowned(npc); + DropHelper.DropBags(npc); // Legendary drop for Signus diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index e1aa80fef9..22518eed29 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -657,7 +657,9 @@ namespace CalamityMod.NPCs.SlimeGod // This loot code is shared with every other Slime God component. public static void DropSlimeGodLoot(NPC npc) { - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedSlimeGod); diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index aef2f2945c..f3d159eb71 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -687,6 +687,8 @@ namespace CalamityMod.NPCs.StormWeaver bool fullStrength = !CalamityWorld.downedSentinel2 || CalamityWorld.DoGSecondStageCountdown <= 0; if (fullStrength) { + CalamityGlobalNPC.SetNewBossJustDowned(npc); + DropHelper.DropBags(npc); // Legendary drop for Storm Weaver diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index d9d481021c..895bb567a0 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -2734,7 +2734,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas Dust.QuickDustLine(npc.Center, initialRitualPosition, 500f, Color.Red); npc.Center = initialRitualPosition; - DropHelper.DropBags(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + + DropHelper.DropBags(npc); // Legendary drop for SCal DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 205f510b30..ad53a348f8 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -2876,6 +2876,8 @@ namespace CalamityMod.NPCs.Yharon { CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedYharon); + CalamityGlobalNPC.SetNewBossJustDowned(npc); + // Bags occur in either phase 1 or 2, as they don't contain phase 2 only drops DropHelper.DropBags(npc); diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index bb4dce395a..be65154640 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -666,7 +666,7 @@ namespace CalamityMod.World Reforges = reader.ReadInt32(); MoneyStolenByBandit = reader.ReadInt32(); - if (loadVersion == 0) + if (loadVersion == 0) { BitsByte flags = reader.ReadByte(); downedDesertScourge = flags[0]; @@ -1046,7 +1046,7 @@ namespace CalamityMod.World acidRainPoints = reader.ReadInt32(); Reforges = reader.ReadInt32(); MoneyStolenByBandit = reader.ReadInt32(); - DraedonSummonCountdown = reader.ReadInt32(); + DraedonSummonCountdown = reader.ReadInt32(); DraedonMechToSummon = (ExoMech)reader.ReadInt32(); DraedonSummonPosition = reader.ReadVector2(); SunkenSeaLabCenter = reader.ReadVector2();