From a72ff82b376eac5b046ffe7c014676c803684a91 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Mon, 31 Mar 2025 00:50:08 -0400 Subject: [PATCH 1/2] Vanity accessories now render while the game is paused The following accessories have some visual bugs with the shoulder that I cannot figure out: * Abandoned Wulfrum Helmet * Abyssal Diving Suit * Aquatic Heart * Ghost Bracelet * Golden Bomb * Ha-pu Fruit * Magic Scarf and Hat * Punch Card * Sharky Plush --- CalPlayer/CalamityPlayerDrawEffects.cs | 48 ++++++++++++++++++- .../Vanity/AbandonedWulfrumHelmet.cs | 23 +++++++++ Items/Accessories/Vanity/CrystalHeartVodka.cs | 20 +++++++- Items/Accessories/Vanity/GoldenBomb.cs | 19 +++++++- Items/Accessories/Vanity/HapuFruit.cs | 16 +++++++ Items/Accessories/Vanity/OracleHeadphones.cs | 20 +++++++- Items/Accessories/Vanity/SharkyPlush.cs | 20 +++++++- Items/Accessories/Vanity/XyksBlessingBlue.cs | 17 +++++++ .../Accessories/Vanity/XyksBlessingOrange.cs | 17 +++++++ ...ods.CalamityMod.Items.Weapons.Ranged.hjson | 10 ++-- 10 files changed, 200 insertions(+), 10 deletions(-) diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index eaaeda1189..11c960eb68 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -442,7 +442,7 @@ namespace CalamityMod.CalPlayer } #endregion Profaned Moonlight Dye Colors - #region Tanks/Backpacks + #region Vanity Accessories and Tanks/Backpacks public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) { if (drawInfo.shadow != 0f) @@ -451,6 +451,52 @@ namespace CalamityMod.CalPlayer Player drawPlayer = drawInfo.drawPlayer; Item item = drawPlayer.ActiveItem(); + // Vanity accessory effects, allows them to draw while the game is paused + if (drawPlayer.Calamity().ghostBracelet) + { + drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Legs); + drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Body); + drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Head); + } + else if ((drawPlayer.Calamity().snowmanPower || drawPlayer.Calamity().snowmanForce) && !drawPlayer.Calamity().snowmanHide) + { + drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "Popo", EquipType.Legs); + drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "Popo", EquipType.Body); + drawPlayer.head = EquipLoader.GetEquipSlot(Mod, snowmanNoseless ? "PopoNoseless" : "Popo", EquipType.Head); + drawPlayer.face = -1; + } + else if (drawPlayer.Calamity().punchCard) + { + drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Legs); + drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Body); + drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Head); + } + else if ((drawPlayer.Calamity().abyssalDivingSuitPower || drawPlayer.Calamity().abyssalDivingSuitForce) && !drawPlayer.Calamity().abyssalDivingSuitHide) + { + drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Legs); + drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Body); + drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Head); + drawPlayer.face = -1; + } + else if ((drawPlayer.Calamity().aquaticHeartPower || drawPlayer.Calamity().aquaticHeartForce) && !drawPlayer.Calamity().aquaticHeartHide) + { + drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Legs); + drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Body); + drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Head); + drawPlayer.face = -1; + } + // Need to set all of these so that certain vanity pieces like Capricorn Tail don't screw it up + if (drawPlayer.Calamity().ghostBracelet || ((drawPlayer.Calamity().snowmanPower || drawPlayer.Calamity().snowmanForce) && !drawPlayer.Calamity().snowmanHide) || + drawPlayer.Calamity().punchCard || ((drawPlayer.Calamity().abyssalDivingSuitPower || drawPlayer.Calamity().abyssalDivingSuitForce) && !drawPlayer.Calamity().abyssalDivingSuitHide) || + ((drawPlayer.Calamity().aquaticHeartPower || drawPlayer.Calamity().aquaticHeartForce) && !drawPlayer.Calamity().aquaticHeartHide)) + { + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.bodyGlowMask = -1; + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + } + if (!drawPlayer.frozen && (item.IsAir || item.type > ItemID.None) && !drawPlayer.dead && diff --git a/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs index 32ca98b5e7..ae04d03443 100644 --- a/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs +++ b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -104,5 +105,27 @@ namespace CalamityMod.Items.Accessories.Vanity Player.HideAccessories(); } } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (forceHelmetOn || transformationActive) + { + drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "WulfrumOldSetHead", EquipType.Head); + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + drawInfo.drawPlayer.face = -1; + } + + if (transformationActive) + { + drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "AbandonedWulfrumHelmet", EquipType.Legs); + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "AbandonedWulfrumHelmet", EquipType.Body); + drawInfo.bodyGlowMask = -1; + + drawInfo.drawPlayer.HideAccessories(); + } + } } } diff --git a/Items/Accessories/Vanity/CrystalHeartVodka.cs b/Items/Accessories/Vanity/CrystalHeartVodka.cs index ada7c260f7..4067719941 100644 --- a/Items/Accessories/Vanity/CrystalHeartVodka.cs +++ b/Items/Accessories/Vanity/CrystalHeartVodka.cs @@ -1,4 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -82,5 +84,21 @@ namespace CalamityMod.Items.Accessories.Vanity //Player.HideAccessories(); } } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (vanityEquipped) + { + drawInfo.drawPlayer.back = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Back); + drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Legs); + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Body); + drawInfo.bodyGlowMask = -1; + drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Head); + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + } + } } } diff --git a/Items/Accessories/Vanity/GoldenBomb.cs b/Items/Accessories/Vanity/GoldenBomb.cs index cef27a6ceb..dca2e3d2a2 100644 --- a/Items/Accessories/Vanity/GoldenBomb.cs +++ b/Items/Accessories/Vanity/GoldenBomb.cs @@ -1,4 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -76,5 +78,20 @@ namespace CalamityMod.Items.Accessories.Vanity Player.head = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Head); } } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (vanityEquipped) + { + drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Legs); + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Body); + drawInfo.bodyGlowMask = -1; + drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Head); + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + } + } } } diff --git a/Items/Accessories/Vanity/HapuFruit.cs b/Items/Accessories/Vanity/HapuFruit.cs index 65b1948303..0461d330f8 100644 --- a/Items/Accessories/Vanity/HapuFruit.cs +++ b/Items/Accessories/Vanity/HapuFruit.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -84,5 +85,20 @@ namespace CalamityMod.Items.Accessories.Vanity //Player.HideAccessories(); } } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (vanityEquipped) + { + drawInfo.drawPlayer.back = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Back); + drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Legs); + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Body); + drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Head); + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + } + } } } diff --git a/Items/Accessories/Vanity/OracleHeadphones.cs b/Items/Accessories/Vanity/OracleHeadphones.cs index 47645f8084..eb87fecceb 100644 --- a/Items/Accessories/Vanity/OracleHeadphones.cs +++ b/Items/Accessories/Vanity/OracleHeadphones.cs @@ -1,4 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -81,5 +83,21 @@ namespace CalamityMod.Items.Accessories.Vanity //Player.HideAccessories(); } } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (vanityEquipped) + { + drawInfo.drawPlayer.back = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Back); + drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Legs); + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Body); + drawInfo.bodyGlowMask = -1; + drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Head); + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + } + } } } diff --git a/Items/Accessories/Vanity/SharkyPlush.cs b/Items/Accessories/Vanity/SharkyPlush.cs index 77efd68e44..521c319e7a 100644 --- a/Items/Accessories/Vanity/SharkyPlush.cs +++ b/Items/Accessories/Vanity/SharkyPlush.cs @@ -1,5 +1,8 @@ -using System; +using Microsoft.Xna.Framework; +using System; using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Renderers; using Terraria.ID; using Terraria.ModLoader; @@ -78,5 +81,20 @@ namespace CalamityMod.Items.Accessories.Vanity Player.head = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Head); } } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (vanityEquipped) + { + drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Legs); + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Body); + drawInfo.bodyGlowMask = -1; + drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Head); + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + } + } } } diff --git a/Items/Accessories/Vanity/XyksBlessingBlue.cs b/Items/Accessories/Vanity/XyksBlessingBlue.cs index 520a9f3202..9a949d9667 100644 --- a/Items/Accessories/Vanity/XyksBlessingBlue.cs +++ b/Items/Accessories/Vanity/XyksBlessingBlue.cs @@ -1,6 +1,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -89,5 +91,20 @@ namespace CalamityMod.Items.Accessories.Vanity Player.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Head); } } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (vanityEquipped) + { + drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Legs); + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Body); + drawInfo.bodyGlowMask = -1; + drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Head); + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + } + } } } diff --git a/Items/Accessories/Vanity/XyksBlessingOrange.cs b/Items/Accessories/Vanity/XyksBlessingOrange.cs index b2908d3a7b..98ef8e6afa 100644 --- a/Items/Accessories/Vanity/XyksBlessingOrange.cs +++ b/Items/Accessories/Vanity/XyksBlessingOrange.cs @@ -1,6 +1,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -89,5 +91,20 @@ namespace CalamityMod.Items.Accessories.Vanity Player.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Head); } } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (vanityEquipped) + { + drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Legs); + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Body); + drawInfo.bodyGlowMask = -1; + drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Head); + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + } + } } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index d07e0ca3b1..c7ac384dca 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -82,11 +82,11 @@ Arbalest: { Archerfish: { DisplayName: Archerfish - Tooltip: - ''' - Converts musket balls into streams of water - 33% chance to save ammo - ''' + Tooltip: + ''' + Converts musket balls into streams of water + 33% chance to save ammo + ''' } ArcNovaDiffuser: { From 8b42e552dc9a8487b79be7b39886f4e30c453254 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Mon, 31 Mar 2025 00:49:47 -0500 Subject: [PATCH 2/2] 1 - Crabulon mushroom rain stomp and mushroom spam reduction. 2 - Cirrus workout outfit while content. --- .../Mods.CalamityMod.Projectiles.Boss.hjson | 1 + NPCs/Crabulon/Crabulon.cs | 145 ++++++++++++++++-- NPCs/TownNPCs/Cirrus.cs | 24 ++- NPCs/TownNPCs/Cirrus_Head_Alt.png | Bin 0 -> 631 bytes NPCs/TownNPCs/Cirrus_Workout.png | Bin 0 -> 5096 bytes Projectiles/Boss/MushBombGround.cs | 115 ++++++++++++++ 6 files changed, 273 insertions(+), 12 deletions(-) create mode 100644 NPCs/TownNPCs/Cirrus_Head_Alt.png create mode 100644 NPCs/TownNPCs/Cirrus_Workout.png create mode 100644 Projectiles/Boss/MushBombGround.cs diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index 9c5863d7c5..ca350858b2 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -104,6 +104,7 @@ MoltenBlast.DisplayName: Molten Blast MoltenBlob.DisplayName: Molten Blob MushBomb.DisplayName: Mushroom Shot MushBombFall.DisplayName: Falling Mushroom +MushBombGround.DisplayName: Mushroom Shot OldDukeGore.DisplayName: Sulphurous Gore OldDukeSummonDrop.DisplayName: Acid OldDukeToothBallSpike.DisplayName: Spike diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index 7553d4c638..f239be5713 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -36,6 +36,8 @@ namespace CalamityMod.NPCs.Crabulon { private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private bool stomping = false; + private const float TelegraphTimeBeforeBigJump = 20f; + private const float DelayBeforeBigJump = 50f; public static Asset AltTexture; public static Asset AttackTexture; @@ -146,16 +148,18 @@ namespace CalamityMod.NPCs.Crabulon bool phase3 = lifeRatio < 0.33f && expertMode; bool phase4 = lifeRatio < 0.15f && masterMode; + int despawnDistanceInTiles = 500; + // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); Player player = Main.player[NPC.target]; - if (!player.active || player.dead) + if (!player.active || player.dead || Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) / 16f > despawnDistanceInTiles) { NPC.TargetClosest(false); player = Main.player[NPC.target]; - if (!player.active || player.dead) + if (!player.active || player.dead || Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) / 16f > despawnDistanceInTiles) { NPC.noTileCollide = true; @@ -360,9 +364,9 @@ namespace CalamityMod.NPCs.Crabulon { NPC.noGravity = false; NPC.noTileCollide = false; - NPC.ai[0] = 2f; + NPC.ai[0] = (Main.rand.NextBool() && revenge && phase2) ? 4f : 2f; NPC.ai[1] = 0f; - NPC.netUpdate = true; + NPC.ForceNetUpdate(); } if (NPC.velocity.Y > 10f) @@ -506,7 +510,7 @@ namespace CalamityMod.NPCs.Crabulon } } } - else + else if (NPC.ai[0] == 3f) { if (NPC.velocity.Y == 0f) { @@ -529,7 +533,7 @@ namespace CalamityMod.NPCs.Crabulon destination *= projectileVelocity; // Less mushrooms in Death Mode phase 3 because otherwise it's an absolute shitshow. - Fabsol - int numProj = bossRush ? 48 : phase4 ? 21 : CalamityWorld.death ? (phase3 ? 14 : 28) : 20; + int numProj = bossRush ? 32 : phase4 ? 18 : CalamityWorld.death ? (phase3 ? 12 : 20) : 16; float rotation = MathHelper.ToRadians(90); for (int i = 0; i < numProj; i++) { @@ -554,7 +558,7 @@ namespace CalamityMod.NPCs.Crabulon destination *= projectileVelocity; // Less mushrooms in Death Mode phase 3 because otherwise it's an absolute shitshow. - Fabsol - int numProj = bossRush ? 30 : phase4 ? 12 : (phase3 && death) ? 8 : 12; + int numProj = bossRush ? 20 : phase4 ? 10 : (phase3 && death) ? 6 : 10; float rotation = MathHelper.ToRadians(60); for (int i = 0; i < numProj; i++) { @@ -698,6 +702,124 @@ namespace CalamityMod.NPCs.Crabulon } } } + else if (NPC.ai[0] == 4f) + { + NPC.ai[1] += 1f; + if (NPC.ai[1] >= DelayBeforeBigJump) + { + if ((NPC.ai[1] == DelayBeforeBigJump || NPC.velocity.Y != 0f) && NPC.ai[2] == 0f) + { + Vector2 center = NPC.Center; + if (!player.dead && player.active && Math.Abs(NPC.Center.X - player.Center.X) / 16f <= despawnDistanceInTiles) + center = player.Center; + + center.Y -= 384f; + center.X += Math.Abs(player.Center.X - NPC.Center.X) * ((player.Center.X - NPC.Center.X > 0f) ? 1 : -1); + if (NPC.velocity.Y == 0f) + { + NPC.ai[2] = 1f; + NPC.ai[3] = NPC.Bottom.Y; + NPC.noTileCollide = true; + NPC.velocity = center - NPC.Center; + NPC.velocity = NPC.velocity.SafeNormalize(Vector2.Zero); + NPC.velocity *= bossRush ? 24f : death ? 21f : 18f; + NPC.netUpdate = true; + } + else + NPC.velocity.Y *= 0.95f; + } + else + { + float mushroomFireRate = death ? 20f : 10f; + if (NPC.ai[1] % mushroomFireRate == 0f) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + SoundEngine.PlaySound(SoundID.Item42, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float yVelocity = death ? 4f : 2f; + if (death) + { + int numProj = 3; + Vector2 initialVelocity = (NPC.Center + Vector2.UnitY * 10f - NPC.Center).SafeNormalize(Vector2.UnitY); + float rotation = MathHelper.ToRadians(8); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = initialVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + } + } + else + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.UnitY * yVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + } + } + + // Impact and create lines of mushrooms that spread out along the ground (similar to an old Providence attack) + if (NPC.Bottom.Y >= NPC.ai[3] - NPC.height) + { + SoundEngine.PlaySound(SlamSound, NPC.Center); + + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.noTileCollide = false; + NPC.netUpdate = true; + + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float xVelocity = death ? 2f : 1f; + int numProj = 5; + Vector2 initialVelocity = Vector2.UnitX * xVelocity; + Vector2 initialSpawnLocation = NPC.Center + new Vector2(0f, 8f); + + for (int i = 0; i < numProj; i++) + Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation + new Vector2(Main.rand.Next(0, 81), Main.rand.Next(-20, 1)), initialVelocity - ((i / numProj) * initialVelocity), type, damage, 0f, Main.myPlayer); + + for (int i = 0; i < numProj; i++) + Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation - new Vector2(Main.rand.Next(0, 81), Main.rand.Next(-20, 1)), -(initialVelocity - ((i / numProj) * initialVelocity)), type, damage, 0f, Main.myPlayer); + } + + for (int j = (int)NPC.position.X - 20; j < (int)NPC.position.X + NPC.width + 40; j += 20) + { + for (int k = 0; k < 4; k++) + { + int stompDust = Dust.NewDust(new Vector2(NPC.position.X - 20f, NPC.position.Y + NPC.height), NPC.width + 20, 4, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); + Main.dust[stompDust].velocity *= 0.2f; + } + + // Destroy tiles with stomps in Zenith seed + if (Main.zenithWorld) + { + int x = j / 16; + int y = (int)(NPC.position.Y + NPC.height) / 16; + Tile groundTile = CalamityUtils.ParanoidTileRetrieval(x, y); + Tile walkTile = CalamityUtils.ParanoidTileRetrieval(x, y - 1); + if (!walkTile.HasTile && walkTile.LiquidAmount == 0 && groundTile != null && WorldGen.SolidTile(groundTile)) + { + walkTile.TileFrameY = 0; + walkTile.Get().Slope = SlopeType.Solid; + walkTile.Get().IsHalfBlock = false; + if (groundTile.TileType == TileID.MushroomGrass || groundTile.TileType == TileID.Mud) + { + walkTile.Get().HasTile = true; + walkTile.TileType = TileID.MushroomPlants; + walkTile.TileFrameX = (short)(Main.rand.Next(5) * 18); + + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendTileSquare(-1, x, y - 1, 1, TileChangeType.None); + } + } + } + } + } + } + } + } if (NPC.localAI[0] == 0f && NPC.life > 0) NPC.localAI[0] = NPC.lifeMax; @@ -796,7 +918,7 @@ namespace CalamityMod.NPCs.Crabulon { if (NPC.ai[0] > 1f) { - if (NPC.velocity.Y == 0f && NPC.ai[1] >= 0f && NPC.ai[0] == 2f) // Idle just before jump + if (NPC.velocity.Y == 0f && ((NPC.ai[1] >= 0f && NPC.ai[0] == 2f) || (NPC.ai[1] < (DelayBeforeBigJump - TelegraphTimeBeforeBigJump) && NPC.ai[0] == 4f && NPC.ai[2] == 0f))) // Idle just before jump { if (stomping) stomping = false; @@ -806,7 +928,7 @@ namespace CalamityMod.NPCs.Crabulon int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } - else if (NPC.velocity.Y <= 0f || NPC.ai[1] < 0f) // Prepare to jump and then jump + else if (NPC.velocity.Y <= 0f || (NPC.ai[1] < DelayBeforeBigJump && NPC.ai[0] == 4f && NPC.ai[2] == 0f) || NPC.ai[1] < 0f) // Prepare to jump and then jump { NPC.frameCounter += 1D; if (NPC.frameCounter > 12D) @@ -840,7 +962,7 @@ namespace CalamityMod.NPCs.Crabulon if (stomping) stomping = false; - NPC.frameCounter += 0.15f; + NPC.frameCounter += 0.15; NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; @@ -869,6 +991,7 @@ namespace CalamityMod.NPCs.Crabulon { Vector2 drawOrigin = new Vector2(textureIdle.Width / 2, textureIdle.Height / Main.npcFrameCount[Type] / 2); Vector2 drawPos = NPC.Center - screenPos + (Vector2.UnitX * textureIdle.Width * c * 1.6f); + // Jumping if (NPC.ai[0] > 2f && NPC.velocity.Y != 0f) { @@ -879,6 +1002,7 @@ namespace CalamityMod.NPCs.Crabulon spriteBatch.Draw(textureAttack, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); spriteBatch.Draw(glowAttack, drawPos, NPC.frame, glowColor, NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); } + // Walking else if (NPC.ai[0] == 1f) { @@ -889,6 +1013,7 @@ namespace CalamityMod.NPCs.Crabulon spriteBatch.Draw(textureWalk, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); spriteBatch.Draw(glowWalk, drawPos, NPC.frame, glowColor, NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); } + // Standing still else { diff --git a/NPCs/TownNPCs/Cirrus.cs b/NPCs/TownNPCs/Cirrus.cs index 4b0de8366a..f7a6fd143d 100644 --- a/NPCs/TownNPCs/Cirrus.cs +++ b/NPCs/TownNPCs/Cirrus.cs @@ -32,6 +32,7 @@ namespace CalamityMod.NPCs.TownNPCs public class Cirrus : ModNPC { public static Asset AltTexture; + public static Asset WorkoutTexture; public override void SetStaticDefaults() { @@ -65,6 +66,7 @@ namespace CalamityMod.NPCs.TownNPCs if (!Main.dedServ) { AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + WorkoutTexture = ModContent.Request(Texture + "_Workout", AssetRequestMode.AsyncLoad); } } @@ -95,6 +97,13 @@ namespace CalamityMod.NPCs.TownNPCs public override void FindFrame(int frameHeight) { + int wife = NPC.FindFirstNPC(NPCID.Stylist); + bool wifeIsAround = wife != -1; + bool beLessDrunk = wifeIsAround && NPC.downedMoonlord; + bool workoutOutfit = Main.dayTime && beLessDrunk; + if (workoutOutfit) + frameHeight = WorkoutTexture.Height() / Main.npcFrameCount[Type]; + int extraFrameAmt = (NPC.isLikeATownNPC ? NPCID.Sets.ExtraFramesCount[Type] : 0); if (NPC.velocity.Y == 0f) { @@ -711,6 +720,7 @@ namespace CalamityMod.NPCs.TownNPCs bool wifeIsAround = wife != -1; bool wifeIsHappy = wifeIsAround ? Main.ShopHelper.GetShoppingSettings(player, Main.npc[wife]).PriceAdjustment < 1D : false; bool beLessDrunk = wifeIsAround && worldIsSafer; + bool workoutOutfit = Main.dayTime && beLessDrunk; if (Main.bloodMoon) { @@ -750,7 +760,8 @@ namespace CalamityMod.NPCs.TownNPCs if (ChildSafety.Disabled) dialogue.Add(this.GetLocalization("Chat.Normal4Alt").Format(Main.npc[wife].GivenName)); - dialogue.Add(this.GetLocalizedValue("Chat.NewOutfit")); + if (workoutOutfit) + dialogue.Add(this.GetLocalizedValue("Chat.NewOutfit")); } int tavernKeep = NPC.FindFirstNPC(NPCID.DD2Bartender); @@ -924,8 +935,17 @@ namespace CalamityMod.NPCs.TownNPCs if (Main.LocalPlayer.Calamity().trippy) return false; + int wife = NPC.FindFirstNPC(NPCID.Stylist); + bool wifeIsAround = wife != -1; + bool beLessDrunk = wifeIsAround && NPC.downedMoonlord; + bool workoutOutfit = Main.dayTime && beLessDrunk; var something = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(BirthdayParty.PartyIsUp ? AltTexture.Value : TextureAssets.Npc[Type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, 6f), NPC.frame, drawColor, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); + + Rectangle frame = NPC.frame; + if (workoutOutfit && !BirthdayParty.PartyIsUp) + frame = new Rectangle(0, NPC.frame.Y, WorkoutTexture.Width(), WorkoutTexture.Height() / Main.npcFrameCount[Type]); + + spriteBatch.Draw(BirthdayParty.PartyIsUp ? AltTexture.Value : workoutOutfit ? WorkoutTexture.Value : TextureAssets.Npc[Type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, workoutOutfit ? 3f : 6f), frame, drawColor, NPC.rotation, frame.Size() / 2, NPC.scale, something, 0); return false; } diff --git a/NPCs/TownNPCs/Cirrus_Head_Alt.png b/NPCs/TownNPCs/Cirrus_Head_Alt.png new file mode 100644 index 0000000000000000000000000000000000000000..ceb019d692716ff49065fa0a9c432a515a11737a GIT binary patch literal 631 zcmeAS@N?(olHy`uVBq!ia0vp^N$cc0dZzK3s^i0$OeG~AO`7&(P)-30K;nn zI|B<)g@KW=0pkLQsURJ!3m_&<0kT1W31|)zSY?o<1&{^RWoTdkl0C#xf9T)HEtd?W({EViVVM+dwOQ>&QLeOaEVyW-*qxu_2ybLt?MyZ*D>e$ z#g(E98v17PZxRmLGxf04hlM{h9-T60(6SNuuVo`wEAaRvJ7cR5|4Gri`c7P}4VP|7 WS58+HW!8KP_P(d9pUXO@geCw{iNo*! literal 0 HcmV?d00001 diff --git a/NPCs/TownNPCs/Cirrus_Workout.png b/NPCs/TownNPCs/Cirrus_Workout.png new file mode 100644 index 0000000000000000000000000000000000000000..f657fe0c7cc360ca4c2c637fe9c6734db8e9e873 GIT binary patch literal 5096 zcmaJ_2|SeB`+sL)EE&UCreT64^Pz-5E(W`?A!x9+_mX+jdY zmdJ7|GuFB#*(a$8EsU*2Wy$a5*Zuwa-2d`^K4;GIo^zh(Jm-17&-b0PbZ3g33|0mJ z067P$of}x|0f59$QZTUf?6q_^SV4}tQFa1}{+D zWmd)d;kc1tr4-@j?7lkZ9}nQ-@p`f+L~> zjvfH$0U@jig0sB`emlX0V7k=RUJlN=eZb2h*ulX7kODgr02U$vK){wGSk%6^*G>(A zt&Ky$aT5p>K!NpMu!Nj}uZ@R-?bXL0EUWAPuKytv0PU8E0N~&ZiC1>36+6x;{8Hq*_*9Bh4GWnyf+`nE|bzQ0dr?`{B4G;**bd&KOUx}0+K85L>-O!Vgi{msqGcMC{X!^_Lf%@>XKHy+IySX?Z>04+;61IsEt5mWc)s7S)wdW6kr z8S|wUPvC`dG3M&`;sVElvvOZH3|}-l(>yxb)AK?5$(e$M;SqLxy!o9wOP>aomtV%m zFShLzNs%YHd?TZkubq>VpJ!YyXnCnipF{*bJ#wV{!oBz%>H_2i4Gmg~!?vFx(wz@o zU0g^R88mT+n8SKAHTCY@r%zL9Pa5x7+iu-H!SOFI=PDS`-7dCFax*B)A38@j1`~wbG(ByT~ z73qlhrI=Icv+S{O^x{H|{83BY9q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vJWtzJ%TW9DeA0;@rA7H61TEIZt3veg50H3i-gFdTAXg257QY9<5fBU0kbpAj z;q#=*Qth`7#v}VcSwbp!P@-Pa!CNpYkB>>}VS#-+2{4)Frau6qa_zqgN8XN8OR90O X-Rs>CS{z*c8_B`m+3t^>{=9zyfaJd# literal 0 HcmV?d00001 diff --git a/Projectiles/Boss/MushBombGround.cs b/Projectiles/Boss/MushBombGround.cs new file mode 100644 index 0000000000..39b4588c9d --- /dev/null +++ b/Projectiles/Boss/MushBombGround.cs @@ -0,0 +1,115 @@ +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class MushBombGround : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + public override string Texture => "CalamityMod/Projectiles/Boss/MushBomb"; + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = 14; + Projectile.height = 14; + Projectile.hostile = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + } + + public override void AI() + { + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 0.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 3) + Projectile.frame = 0; + + Lighting.AddLight(Projectile.Center, 0f, 0.15f, 0.3f); + + float xVelocityMultiplier = 1.05f; + float xVelocityLimit = BossRushEvent.BossRushActive ? 24f : 12f; + if (Math.Abs(Projectile.velocity.X) < xVelocityLimit) + { + Projectile.velocity.X *= xVelocityMultiplier; + if (Math.Abs(Projectile.velocity.X) > xVelocityLimit) + Projectile.velocity.X = xVelocityLimit; + } + } + + public override Color? GetAlpha(Color drawColor) => Main.zenithWorld ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha); + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; + int drawStart = height * Projectile.frame; + Vector2 origin = Projectile.Size / 2; + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + return false; + } + + public override void PostDraw(Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; + int drawStart = height * Projectile.frame; + Vector2 origin = Projectile.Size / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (Projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/MushBombGlow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 20; + Projectile.height = 20; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + for (int i = 0; i < 4; i++) + { + int shroomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); + Main.dust[shroomDust].velocity *= 1.5f; + if (Main.rand.NextBool()) + { + Main.dust[shroomDust].scale = 0.5f; + Main.dust[shroomDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int j = 0; j < 12; j++) + { + int shroomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 2f); + Main.dust[shroomDust2].noGravity = true; + Main.dust[shroomDust2].velocity *= 2f; + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); + } + } + } +}