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: { 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 0000000000..ceb019d692 Binary files /dev/null and b/NPCs/TownNPCs/Cirrus_Head_Alt.png differ diff --git a/NPCs/TownNPCs/Cirrus_Workout.png b/NPCs/TownNPCs/Cirrus_Workout.png new file mode 100644 index 0000000000..f657fe0c7c Binary files /dev/null and b/NPCs/TownNPCs/Cirrus_Workout.png differ 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); + } + } + } +}