diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 6375582b08..83b3a8e370 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -2206,15 +2206,18 @@ namespace CalamityMod.CalPlayer Player.AddCooldown(Starburst.ID, MaxStratusStarburst); } } - // Shields. Has to intentionally be above resetting accessories and armor or the shields would clear instantly - if (!roverDrive) - RoverDriveShieldDurability = 0; - if (!lunicCorpsSet) - LunicCorpsShieldDurability = 0; - if (!sponge) - SpongeShieldDurability = 0; - if (!pSoulArtifact) - pSoulShieldDurability = 0; + + if (Player.whoAmI == Main.myPlayer) + { + if (!roverDrive) + RoverDriveShieldDurability = 0; + if (!lunicCorpsSet) + LunicCorpsShieldDurability = 0; + if (!sponge) + SpongeShieldDurability = 0; + if (!pSoulArtifact) + pSoulShieldDurability = 0; + } pSoulShieldVisible = false; roverDrive = false; roverDriveShieldVisible = false; diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index faa0bd312e..865b153359 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -4,19 +4,14 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer.DrawLayers; -using CalamityMod.DataStructures; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.Particles; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems.Collections; using CalamityMod.Systems.Graphic.PixelationSystem; -using CalamityMod.Systems.Mechanic; using CalamityMod.Utilities.Daybreak; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -106,7 +101,8 @@ namespace CalamityMod.CalPlayer DevourerofGodsHead DoG = null; foreach (var item in Main.ActiveNPCs) { - if (item.type == ModContent.NPCType()) { + if (item.type == ModContent.NPCType()) + { DoG = item.ModNPC(); break; } @@ -155,37 +151,40 @@ namespace CalamityMod.CalPlayer var dis = Player.Distance(virtualTargetPos); if ((DoG.NPC.ai[3] < 3 || !DoG.Phase2Started) && DoG.NPC.Opacity > 0.5f && !DoG.Dying && !drawInfo.drawPlayer.isDisplayDollOrInanimate) { - string phase1IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss"; - string phase2IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_P2_Head_Boss"; - var tex = ModContent.Request((DoG.Phase2Started && DoG.NPC.localAI[2] < 300) ? phase2IconPath : phase1IconPath).Value; - - float baseRotation = DoG.NPC.rotation; - - if (calamityPlayer.trippy) + int headIconIndex = -1; + DoG.BossHeadSlot(ref headIconIndex); + if (headIconIndex > -1) { - Vector2 rotVec = baseRotation.ToRotationVector2(); - switch (i) + var tex = TextureAssets.NpcHeadBoss[headIconIndex].Value; + + float baseRotation = DoG.NPC.rotation; + + if (calamityPlayer.trippy) { - case 0: - rotVec.X *= -1; - rotVec.Y *= -1; - break; - case 1: - rotVec.Y *= -1; - break; - case 2: - break; - case 3: - rotVec.X *= -1; - break; + Vector2 rotVec = baseRotation.ToRotationVector2(); + switch (i) + { + case 0: + rotVec.X *= -1; + rotVec.Y *= -1; + break; + case 1: + rotVec.Y *= -1; + break; + case 2: + break; + case 3: + rotVec.X *= -1; + break; + } + baseRotation = rotVec.ToRotation(); } - baseRotation = rotVec.ToRotation(); + + float opacity = 0.9f * Math.Clamp(MathHelper.Lerp(0, 1, (dis - 600) / 300), 0, 1); + Color drawColor = calamityPlayer.trippy ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, (int)(255 * 0.9f)) : Color.White * 0.9f; + + Main.spriteBatch.Draw(tex, Player.Center + directionToTarget * 196 * Math.Min(dis / 2400f, 2) - Main.screenPosition, null, drawColor * opacity, baseRotation, tex.Size() / 2f, 1, SpriteEffects.None, 0); } - - float opacity = 0.9f * Math.Clamp(MathHelper.Lerp(0, 1, (dis - 600) / 300), 0, 1); - Color drawColor = calamityPlayer.trippy ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, (int)(255 * 0.9f)) : Color.White * 0.9f; - - Main.spriteBatch.Draw(tex, Player.Center + directionToTarget * 196 * Math.Min(dis / 2400f, 2) - Main.screenPosition, null, drawColor * opacity, baseRotation, tex.Size() / 2f, 1, SpriteEffects.None, 0); } } } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 37e1665bfb..d05a57dee0 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3729,11 +3729,11 @@ namespace CalamityMod.CalPlayer Player.velocity *= 0.98f; if (molluskHelmet) - Player.velocity.X *= 0.995f; + Player.velocity.X *= 0.996f; if (molluskChest) - Player.velocity.X *= 0.995f; + Player.velocity.X *= 0.996f; if (molluskLegs) - Player.velocity.X *= 0.995f; + Player.velocity.X *= 0.996f; if ((warped) && !Player.slowFall && !Player.mount.Active) { @@ -4505,6 +4505,9 @@ namespace CalamityMod.CalPlayer #region Energy Shields private void EnergyShields() { + if (Player.whoAmI != Main.myPlayer) + return; + // Because later tier shields are brighter, shields are handled from highest tier to lowest tier here. bool shieldAddedLight = false; diff --git a/Cooldowns/LunicCorpsShieldCooldowns.cs b/Cooldowns/LunicCorpsShieldCooldowns.cs index dbee30e4a1..f76d74cd33 100644 --- a/Cooldowns/LunicCorpsShieldCooldowns.cs +++ b/Cooldowns/LunicCorpsShieldCooldowns.cs @@ -92,11 +92,19 @@ namespace CalamityMod.Cooldowns public override SoundStyle? EndSound => LunicCorpsHelmet.ActivationSound; public override bool ShouldPlayEndSound => instance.player.Calamity().lunicCorpsSet; - public override void Tick() => instance.player.Calamity().playedLunicCorpsShieldSound = false; - // When the recharge period completes, grant 1 point of shielding immediately so the rest my refill normally. + public override void Tick() + { + if (instance.player.whoAmI == Main.myPlayer) + instance.player.Calamity().playedLunicCorpsShieldSound = false; + } + + // When the recharge period completes, grant 1 point of shielding immediately so the rest may refill normally. // The shield durability cooldown is added elsewhere, in Misc Effects. public override void OnCompleted() { + if (instance.player.whoAmI != Main.myPlayer) + return; + CalamityPlayer modPlayer = instance.player.Calamity(); if (modPlayer.LunicCorpsShieldDurability <= 0) modPlayer.LunicCorpsShieldDurability = 1; diff --git a/Cooldowns/ProfanedSoulShield.cs b/Cooldowns/ProfanedSoulShield.cs index c209dc63ad..c073f45bce 100644 --- a/Cooldowns/ProfanedSoulShield.cs +++ b/Cooldowns/ProfanedSoulShield.cs @@ -109,16 +109,23 @@ namespace CalamityMod.Cooldowns public override Color CooldownStartColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); public override Color CooldownEndColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); - public override void Tick() => instance.player.Calamity().playedProfanedSoulShieldSound = false; + public override void Tick() + { + if (instance.player.whoAmI == Main.myPlayer) + instance.player.Calamity().playedProfanedSoulShieldSound = false; + } public override SoundStyle? EndSound => Providence.BurnStartSound; public override bool ShouldPlayEndSound => instance.player.Calamity().pSoulArtifact; - // When the recharge period completes, grant 1 point of shielding immediately so the rest my refill normally. + // When the recharge period completes, grant 1 point of shielding immediately so the rest may refill normally. // The shield durability cooldown is added elsewhere, in Misc Effects. public override void OnCompleted() { + if (instance.player.whoAmI != Main.myPlayer) + return; + CalamityPlayer modPlayer = instance.player.Calamity(); if (modPlayer.pSoulShieldDurability <= 0) modPlayer.pSoulShieldDurability = 1; diff --git a/Cooldowns/SpongeCooldowns.cs b/Cooldowns/SpongeCooldowns.cs index b9429b1bac..f2820fdaae 100644 --- a/Cooldowns/SpongeCooldowns.cs +++ b/Cooldowns/SpongeCooldowns.cs @@ -92,11 +92,19 @@ namespace CalamityMod.Cooldowns public override SoundStyle? EndSound => TheSponge.ActivationSound; public override bool ShouldPlayEndSound => instance.player.Calamity().sponge; - public override void Tick() => instance.player.Calamity().playedSpongeShieldSound = false; - // When the recharge period completes, grant 1 point of shielding immediately so the rest my refill normally. + public override void Tick() + { + if (instance.player.whoAmI == Main.myPlayer) + instance.player.Calamity().playedSpongeShieldSound = false; + } + + // When the recharge period completes, grant 1 point of shielding immediately so the rest may refill normally. // The shield durability cooldown is added elsewhere, in Misc Effects. public override void OnCompleted() { + if (instance.player.whoAmI != Main.myPlayer) + return; + CalamityPlayer modPlayer = instance.player.Calamity(); if (modPlayer.SpongeShieldDurability <= 0) modPlayer.SpongeShieldDurability = 1; diff --git a/Cooldowns/WulfrumRoverDriveCooldowns.cs b/Cooldowns/WulfrumRoverDriveCooldowns.cs index 9df995f04a..c34f48f527 100644 --- a/Cooldowns/WulfrumRoverDriveCooldowns.cs +++ b/Cooldowns/WulfrumRoverDriveCooldowns.cs @@ -91,11 +91,18 @@ namespace CalamityMod.Cooldowns public override Color CooldownStartColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); public override Color CooldownEndColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); - public override void Tick() => instance.player.Calamity().playedRoverDriveShieldSound = false; + public override void Tick() + { + if (instance.player.whoAmI == Main.myPlayer) + instance.player.Calamity().playedRoverDriveShieldSound = false; + } // Rover Drive shields are recharged as a side effect of the cooldown completing client side public override void OnCompleted() { + if (instance.player.whoAmI != Main.myPlayer) + return; + CalamityPlayer modPlayer = instance.player.Calamity(); if (modPlayer.RoverDriveShieldDurability <= 0) modPlayer.RoverDriveShieldDurability = 1; diff --git a/Graphics/Metaballs/Metaball.cs b/Graphics/Metaballs/Metaball.cs index 521eaebab2..eec99c5832 100644 --- a/Graphics/Metaballs/Metaball.cs +++ b/Graphics/Metaballs/Metaball.cs @@ -146,7 +146,7 @@ namespace CalamityMod.Graphics.Metaballs // Load render targets. int layerCount = Layers.Count(); for (int i = 0; i < layerCount; i++) - LayerTargets.Add(ScreenspaceTargetPool.Shared.Rent(Main.instance.GraphicsDevice)); + LayerTargets.Add(ScreenspaceTargetPool.Shared.Rent(Main.instance.GraphicsDevice, (width, height) => (width + 4, height + 4))); }); } diff --git a/Graphics/Metaballs/MetaballManager.cs b/Graphics/Metaballs/MetaballManager.cs index a051f064c8..95be12e03f 100644 --- a/Graphics/Metaballs/MetaballManager.cs +++ b/Graphics/Metaballs/MetaballManager.cs @@ -75,7 +75,12 @@ namespace CalamityMod.Graphics.Metaballs { using (target.Scope(clearColor: Color.Transparent)) { + // -2,-2 is to account for the border appplying at screen edge. We need this to draw off-screen. + // We directly adjust screen position so that drawing in the metaball functions works as expected + var offset = new Vector2(-2, -2); + Main.screenPosition += offset; metaball.DrawInstances(); + Main.screenPosition -= offset; // Flush metaball contents to its render target and reset the sprite batch for the next iteration. Main.spriteBatch.End(); @@ -106,11 +111,17 @@ namespace CalamityMod.Graphics.Metaballs { for (int i = 0; i < metaball.LayerTargets.Count; i++) { + // -2,-2 is to account for the border appplying at screen edge. We need this to draw off-screen. + // We directly adjust screen position so that drawing in the metaball functions works as expected + var offset = new Vector2(-2, -2); + Main.screenPosition += offset; // Prepare shaders for the given layer target. metaball.PrepareShaderForTarget(i); + Main.screenPosition -= offset; // Draw the metaball's raw contents with the shader. - Main.spriteBatch.Draw(metaball.LayerTargets[i].Target, Vector2.Zero, Color.White); + Main.spriteBatch.Draw(metaball.LayerTargets[i].Target, offset, Color.White); + } } diff --git a/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs b/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs index 60479a2908..5d872cde5a 100644 --- a/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs @@ -62,6 +62,21 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers { public override bool InstancePerEntity => false; + + public override string IsArmorSet(Item head, Item body, Item legs) + { + if (head.ModItem is IDyeableShaderRenderer && head.ModItem.IsArmorSet(head, body, legs)) + return "DyeableShaderSet"; + + if (body.ModItem is IDyeableShaderRenderer && body.ModItem.IsArmorSet(head, body, legs)) + return "DyeableShaderSet"; + + if (legs.ModItem is IDyeableShaderRenderer && legs.ModItem.IsArmorSet(head, body, legs)) + return "DyeableShaderSet"; + + return ""; + } + public override void UpdateItemDye(Item item, Player player, int dye, bool hideVisual) { if (item.ModItem is not IDyeableShaderRenderer drawer) diff --git a/Items/Accessories/Vanity/GoldenBomb.cs b/Items/Accessories/Vanity/GoldenBomb.cs deleted file mode 100644 index 8f7360b95b..0000000000 --- a/Items/Accessories/Vanity/GoldenBomb.cs +++ /dev/null @@ -1,28 +0,0 @@ -using CalamityMod.Items.BaseItems; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Accessories.Vanity -{ - public class GoldenBomb : TransformationAccessory, ILocalizedModType - { - public new string LocalizationCategory => "Items.Accessories"; - public override (EquipType, string, string)[] EquipSlots => - [ - (EquipType.Head, "Mihaii", null), - (EquipType.Body, "Mihaii", null), - (EquipType.Legs, "Mihaii", null), - ]; - - public override void SetDefaults() - { - Item.width = 42; - Item.height = 38; - Item.accessory = true; - Item.rare = ItemRarityID.Blue; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; - Item.vanity = true; - Item.Calamity().devItem = true; - } - } -} diff --git a/Items/Accessories/Vanity/GoldenBomb.png b/Items/Accessories/Vanity/GoldenBomb.png deleted file mode 100644 index 32f5ee42a6..0000000000 Binary files a/Items/Accessories/Vanity/GoldenBomb.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Mihaii_Body.png b/Items/Accessories/Vanity/Mihaii_Body.png deleted file mode 100644 index 7685fe5642..0000000000 Binary files a/Items/Accessories/Vanity/Mihaii_Body.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Mihaii_Head.png b/Items/Accessories/Vanity/Mihaii_Head.png deleted file mode 100644 index 2178e192f4..0000000000 Binary files a/Items/Accessories/Vanity/Mihaii_Head.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Mihaii_Legs.png b/Items/Accessories/Vanity/Mihaii_Legs.png deleted file mode 100644 index 7ba85da711..0000000000 Binary files a/Items/Accessories/Vanity/Mihaii_Legs.png and /dev/null differ diff --git a/Items/Armor/Astral/AstralBreastplate.cs b/Items/Armor/Astral/AstralBreastplate.cs index 84468763e7..1e8a002664 100644 --- a/Items/Armor/Astral/AstralBreastplate.cs +++ b/Items/Armor/Astral/AstralBreastplate.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.Astral public static int MaxManaBoost = 80; public static float AmmoReduction = 0.75f; - public static float DamageBoost = 0.07f; + public static float DamageBoost = 0.1f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, DamageBoost.ToPercent(), (1f - AmmoReduction).ToPercent()); public override void SetDefaults() diff --git a/Items/Armor/Astral/AstralHelm.cs b/Items/Armor/Astral/AstralHelm.cs index eed2472dd0..39e9bb66d6 100644 --- a/Items/Armor/Astral/AstralHelm.cs +++ b/Items/Armor/Astral/AstralHelm.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Astral public new string LocalizationCategory => "Items.Armor.Hardmode"; public static float DamageBoost = 0.05f; - public static int CritBoost = 10; + public static int CritBoost = 15; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost); // Set Bonus diff --git a/Items/Armor/Astral/AstralLeggings.cs b/Items/Armor/Astral/AstralLeggings.cs index 16c64551ce..ec9a0d4f04 100644 --- a/Items/Armor/Astral/AstralLeggings.cs +++ b/Items/Armor/Astral/AstralLeggings.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Astral { public new string LocalizationCategory => "Items.Armor.Hardmode"; - public static float DamageBoost = 0.05f; + public static float DamageBoost = 0.1f; public static float MoveSpeedBoost = 0.15f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), MoveSpeedBoost.ToPercent()); diff --git a/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs b/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs index 8a6b1328d5..dc9d66908a 100644 --- a/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs @@ -51,7 +51,6 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings { "Altixal", "apotofkoolaid", - "AquaSG", "Atalya", "Ben-TK", "Big E", @@ -65,7 +64,6 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Dia", "Done", "dozezoze", - "Eddie Spaghetti", "ENNWAY", "Flowaria", "Fluffy", @@ -73,24 +71,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "HaguriHat", "jasper", "LordMetarex", - "Mercutio 'Merkalto' Takle", - "Mishiro Usui", + "math2", "Moonburn", - "Nycro", "Ozzatron", "Piky", "PokerFace", - "Poroboros", "Raesh", "Sagittariod", - "Spider Prov", "StipulateVenus", "Sunny", "_tofu", "Tomat", "Triangle", "TYESKI (Universe)", - "Uncle Danny", "Xyk", "YuH", // Former devs @@ -101,6 +94,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Alphi", "Altalyra", "Amadis", + "AquaSG", "AstroKnight", "Blast", "Blastitle", @@ -120,6 +114,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "DylanDoe21", "Earth", "EchoDuck", + "Eddie Spaghetti", "Ein", "enamoured", "Enreden", @@ -150,14 +145,17 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Lompl Allimath", "Lucille Karma", "MarieArk", + "Mercutio 'Merkalto' Takle", "Mihaii", "Minecat", + "Mishiro Usui", "Mrrp", "Nao", "Neverglide", "Nincity", "Niorin", "Nitro", + "Nycro", "NyctoDarkMatter", "PaleoStar", "Pbtopacio", @@ -166,6 +164,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Pinkie Poss", "Poly", "Popo", + "Poroboros", "President Waluigi", "Puff", "Purple Necromancer", @@ -180,6 +179,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "SixteenInMono", "Skeletony", "Sok", + "Spider Prov", "spooktacular", "Spoopyro", "Svante", @@ -192,6 +192,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Trivaxy", "Tobias", "Uberransy", + "Uncle Danny", "Vaikyia", "Vladimier", "Yatagarasu", diff --git a/Items/TreasureBags/MiscGrabBags/StarterBag.cs b/Items/TreasureBags/MiscGrabBags/StarterBag.cs index 4e1d2b5ad8..aba0fc2dd8 100644 --- a/Items/TreasureBags/MiscGrabBags/StarterBag.cs +++ b/Items/TreasureBags/MiscGrabBags/StarterBag.cs @@ -76,15 +76,6 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags }; itemLoot.AddIf(getsLadPet, ModContent.ItemType()); - // Mihaii dev item - // Name specific: "Mihaii" - static bool getsGoldenBomb(DropAttemptInfo info) - { - string playerName = info.player.name; - return playerName == "Mihaii"; - }; - itemLoot.AddIf(getsGoldenBomb, ModContent.ItemType()); - // HPU dev item // Name specific: "Heart Plus Up" static bool getsHapuFruit(DropAttemptInfo info) diff --git a/Items/Weapons/DraedonsArsenal/Vulcan.cs b/Items/Weapons/DraedonsArsenal/Vulcan.cs index 2e3e82cc90..34f1498955 100644 --- a/Items/Weapons/DraedonsArsenal/Vulcan.cs +++ b/Items/Weapons/DraedonsArsenal/Vulcan.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.height = 34; Item.DamageType = DamageClass.Magic; Item.mana = 9; - Item.damage = 40; + Item.damage = 31; Item.knockBack = 11f; Item.useAnimation = Item.useTime = 11; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/FrigidflashBolt.cs b/Items/Weapons/Magic/FrigidflashBolt.cs index 13423363d4..c88eaef054 100644 --- a/Items/Weapons/Magic/FrigidflashBolt.cs +++ b/Items/Weapons/Magic/FrigidflashBolt.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 38; Item.height = 42; - Item.damage = 79; + Item.damage = 95; Item.DamageType = DamageClass.Magic; Item.mana = 13; Item.useTime = 20; diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index 2d293f49c8..356a140f32 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.width = 112; Item.height = 112; Item.DamageType = DamageClass.Magic; - Item.damage = 5000; + Item.damage = 5100; Item.knockBack = 9.5f; Item.mana = 80; Item.useAnimation = Item.useTime = AftershotCooldownFrames; diff --git a/Items/Weapons/Magic/SHPC.cs b/Items/Weapons/Magic/SHPC.cs index a35ea032b6..f84d56f9d3 100644 --- a/Items/Weapons/Magic/SHPC.cs +++ b/Items/Weapons/Magic/SHPC.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Items.Weapons.Magic { public new string LocalizationCategory => "Items.Weapons.Magic"; public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/AnomalysNanogunMPFBShot"); - public static readonly SoundStyle VacuumStart = new SoundStyle("CalamityMod/Sounds/Item/SHPCVacuumStart") with { Volume = 0.75f }; - public static readonly SoundStyle VacuumLoop = new SoundStyle("CalamityMod/Sounds/Item/SHPCVacuumLoop") with { Volume = 0.75f }; - public static readonly SoundStyle VacuumEnd = new SoundStyle("CalamityMod/Sounds/Item/SHPCVacuumEnd") with { Volume = 0.75f }; + public static readonly SoundStyle VacuumStart = new SoundStyle("CalamityMod/Sounds/Item/SHPCVacuumStart") with { Volume = 0.5f }; + public static readonly SoundStyle VacuumLoop = new SoundStyle("CalamityMod/Sounds/Item/SHPCVacuumLoop") with { Volume = 0.5f }; + public static readonly SoundStyle VacuumEnd = new SoundStyle("CalamityMod/Sounds/Item/SHPCVacuumEnd") with { Volume = 0.5f }; public const int ShotsPerSoul = 50; public int storedSoulpower = 0; @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 124; Item.height = 52; - Item.damage = 97; + Item.damage = 117; Item.DamageType = DamageClass.Magic; Item.mana = 15; Item.useAnimation = Item.useTime = 60; diff --git a/Items/Weapons/Magic/VitriolicViper.cs b/Items/Weapons/Magic/VitriolicViper.cs index 56af4dc19c..a384441b9a 100644 --- a/Items/Weapons/Magic/VitriolicViper.cs +++ b/Items/Weapons/Magic/VitriolicViper.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 60; Item.height = 62; - Item.damage = 2893; + Item.damage = 2626; //Some kind of... brainstorm Item.DamageType = DamageClass.Magic; Item.mana = 45; Item.useAnimation = Item.useTime = 16; diff --git a/Items/Weapons/Magic/Volterion.cs b/Items/Weapons/Magic/Volterion.cs index 0d98315476..8ce8aee871 100644 --- a/Items/Weapons/Magic/Volterion.cs +++ b/Items/Weapons/Magic/Volterion.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 220; Item.height = 60; - Item.damage = 840; + Item.damage = 890; Item.DamageType = DamageClass.Magic; Item.mana = 50; Item.useAnimation = Item.useTime = 80; // 42 frames of firing animation diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index 7fb483872b..5dc6a6ce9f 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -46,6 +46,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void HoldItem(Player player) { player.Calamity().mouseWorldListener = true; + if (player.whoAmI != Main.myPlayer) + return; if (player.Calamity().mouseRight && !player.mouseInterface && player.Calamity().killModeCooldown == 0 && !Main.mapFullscreen && !Main.blockMouse) { SoundStyle buff = new("CalamityMod/Sounds/Item/DemonSwordKillMode"); diff --git a/Items/Weapons/Melee/EntropicClaymore.cs b/Items/Weapons/Melee/EntropicClaymore.cs index 8ade723dba..8316a87785 100644 --- a/Items/Weapons/Melee/EntropicClaymore.cs +++ b/Items/Weapons/Melee/EntropicClaymore.cs @@ -1,8 +1,9 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Enums; +using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -90,6 +91,7 @@ namespace CalamityMod.Items.Weapons.Melee GeneralParticleHandler.SpawnParticle(spark3); Particle spark2 = new SparkParticle(partPos, partVel, false, 24, partScale * 0.6f, Color.LightGreen); GeneralParticleHandler.SpawnParticle(spark2); + spark2.DrawLayer = GeneralDrawLayer.AfterEverything; } Vector2 dustVel2 = new Vector2(5 * swordDirection, -5).RotatedBy(swingRotation - 1.7f * swordDirection); diff --git a/Items/Weapons/Melee/ExaltedOathblade.cs b/Items/Weapons/Melee/ExaltedOathblade.cs index 583832586e..15f6113870 100644 --- a/Items/Weapons/Melee/ExaltedOathblade.cs +++ b/Items/Weapons/Melee/ExaltedOathblade.cs @@ -44,6 +44,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void HoldItem(Player player) { player.Calamity().mouseWorldListener = true; + if (player.whoAmI != Main.myPlayer) + return; if (player.Calamity().mouseRight && !player.mouseInterface && player.Calamity().killModeCooldown == 0 && !Main.mapFullscreen && !Main.blockMouse) { SoundStyle buff = new("CalamityMod/Sounds/Item/DemonSwordKillMode"); diff --git a/Items/Weapons/Melee/ForbiddenOathblade.cs b/Items/Weapons/Melee/ForbiddenOathblade.cs index aed26bb46f..8ee7e170fd 100644 --- a/Items/Weapons/Melee/ForbiddenOathblade.cs +++ b/Items/Weapons/Melee/ForbiddenOathblade.cs @@ -43,6 +43,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void HoldItem(Player player) { player.Calamity().mouseWorldListener = true; + if (player.whoAmI != Main.myPlayer) + return; if (player.Calamity().mouseRight && !player.mouseInterface && player.Calamity().killModeCooldown == 0 && !Main.mapFullscreen && !Main.blockMouse) { SoundStyle buff = new("CalamityMod/Sounds/Item/DemonSwordKillMode"); diff --git a/Items/Weapons/Melee/GreatswordofJudgement.cs b/Items/Weapons/Melee/GreatswordofJudgement.cs index 5b0b5fb1a8..81de0f4665 100644 --- a/Items/Weapons/Melee/GreatswordofJudgement.cs +++ b/Items/Weapons/Melee/GreatswordofJudgement.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 78; Item.height = 78; - Item.damage = 240; + Item.damage = 310; Item.DamageType = DamageClass.Melee; Item.useStyle = ItemUseStyleID.Swing; Item.useAnimation = Item.useTime = 20; diff --git a/Items/Weapons/Melee/InsidiousImpaler.cs b/Items/Weapons/Melee/InsidiousImpaler.cs index a47be30daa..8ccf621c19 100644 --- a/Items/Weapons/Melee/InsidiousImpaler.cs +++ b/Items/Weapons/Melee/InsidiousImpaler.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 66; Item.height = 70; - Item.damage = 300; + Item.damage = 250; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.useTurn = true; diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index b7a00a61d5..5b5a7708c9 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 90; Item.height = 134; - Item.damage = 2001; + Item.damage = 2200; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Melee/SeekingScorcher.cs b/Items/Weapons/Melee/SeekingScorcher.cs index c12e7a7fdf..8fb360e91a 100644 --- a/Items/Weapons/Melee/SeekingScorcher.cs +++ b/Items/Weapons/Melee/SeekingScorcher.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 86; Item.height = 64; - Item.damage = 1100; + Item.damage = 1170; Item.DamageType = DamageClass.MeleeNoSpeed; Item.useAnimation = Item.useTime = 55; Item.knockBack = 8.5f; diff --git a/Items/Weapons/Ranged/SurgeDriver.cs b/Items/Weapons/Ranged/SurgeDriver.cs index 702c3531da..11784019ce 100644 --- a/Items/Weapons/Ranged/SurgeDriver.cs +++ b/Items/Weapons/Ranged/SurgeDriver.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; diff --git a/Items/Weapons/Ranged/TheJailor.cs b/Items/Weapons/Ranged/TheJailor.cs index 11e6a60c75..fc33f30846 100644 --- a/Items/Weapons/Ranged/TheJailor.cs +++ b/Items/Weapons/Ranged/TheJailor.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; diff --git a/Items/Weapons/Rogue/DeepSeaDumbbell.cs b/Items/Weapons/Rogue/DeepSeaDumbbell.cs index b16f478362..d21034981c 100644 --- a/Items/Weapons/Rogue/DeepSeaDumbbell.cs +++ b/Items/Weapons/Rogue/DeepSeaDumbbell.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) => flexMult = 1f; public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) => flexMult = 1f; - public override float StealthDamageMultiplier => 0.4f; + public override float StealthDamageMultiplier => 0.9f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index b500c4ce7e..d1d6cfef1f 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -6,6 +6,7 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,6 +16,9 @@ namespace CalamityMod.Items.Weapons.Summon public class SarosPossession : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public static SoundStyle FiringSound => new SoundStyle("CalamityMod/Sounds/Item/Summon/SarosFiring") with { MaxInstances = 1 ,Volume = 0.3f, pitchVariance = 0.05f, pitch = 0.5f }; + public static SoundStyle SpawnSound => new SoundStyle("CalamityMod/Sounds/Item/Summon/SarosSpawn"); + public static SoundStyle LoopSound => SoundID.DD2_BetsyFlameBreath with { Volume = 0.2f }; public override void SetDefaults() { Item.width = 44; @@ -25,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1.15f; - Item.UseSound = SoundID.Item44; + Item.UseSound = null; Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; @@ -47,12 +51,16 @@ namespace CalamityMod.Items.Weapons.Summon var p = Main.projectile.First(x => x.active && x.type == type && x.owner == player.whoAmI); p.ai[0]++; p.netUpdate = true; + + SoundEngine.PlaySound(SpawnSound with { MaxInstances = 10, SoundLimitBehavior = SoundLimitBehavior.IgnoreNew, pitchVariance = 0.05f, }, player.Center); return false; } else { player.channel = false; } player.AddBuff(Item.buffType, 2); + + SoundEngine.PlaySound(SpawnSound with { MaxInstances = 10, SoundLimitBehavior = SoundLimitBehavior.IgnoreNew, pitchVariance = 0.05f, }, player.Center); return true; } diff --git a/Items/Weapons/Typeless/StratusSphere.cs b/Items/Weapons/Typeless/StratusSphere.cs index 3094b78dbd..5f57fda8ce 100644 --- a/Items/Weapons/Typeless/StratusSphere.cs +++ b/Items/Weapons/Typeless/StratusSphere.cs @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Weapons.Typeless public class StratusSphere : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Typeless"; - public static readonly SoundStyle CastSound = new("CalamityMod/Sounds/Item/StratusSphereCast"); - public static readonly SoundStyle LoopSound = new("CalamityMod/Sounds/Item/StratusSphereLoop"); + public static readonly SoundStyle CastSound = new SoundStyle("CalamityMod/Sounds/Item/StratusSphereCast") with { Volume = 0.75f }; public override void SetDefaults() { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index f608304648..53ae63432e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -2134,11 +2134,6 @@ GhostBracelet: { Tooltip: Wow.... It looks at me with its hollow eyes full of curiosity } -GoldenBomb: { - DisplayName: Golden Bomb - Tooltip: "'I AM THE BOMB'" -} - HapuFruit: { DisplayName: Ha-pu Fruit Tooltip: "'A fruit that calms your nerves (may have unintended side effects)'" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson index 154ba2a790..0ab28aaaf8 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson @@ -18,8 +18,8 @@ AqueousHunterDrone: { while holding any summon weapon to command the shrimp to launch a vertical missile barrage Vertical missiles aim towards your cursor and leave a lingering blast if they hit solid ground Each shrimp uses 4 minion slots - [c/1FBFF:'When pursuing the adherents of gods, Yharim believed no stone should be left unturned.] - [c/1FBFF:Weaponry for underwater contingencies was an unusually heavy focus, but no models ever saw deployment.'] + [c/1FFBFF:'When pursuing the adherents of gods, Yharim believed no stone should be left unturned.] + [c/1FFBFF:Weaponry for underwater contingencies was an unusually heavy focus, but no models ever saw deployment.'] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index b44759482d..9e975ddf0d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -29,7 +29,7 @@ AethersWhisper: { AlulaAustralis: { DisplayName: Alula Australis - Tooltip: Fires a beautiful aurora trailed by a star shower + Tooltip: Fires a beautiful aurora that inflicts [cbuff:CalamityMod/AstralInfectionDebuff] trailed by a star shower } AlphaDraconis: { @@ -122,12 +122,12 @@ ArtAttack: { AstralachneaStaff: { DisplayName: Astralachnea Staff - Tooltip: Fires a spread of homing astral spider fangs + Tooltip: Fires a spread of homing astral spider fangs that inflict [cbuff:CalamityMod/AstralInfectionDebuff] } AstralStaff: { DisplayName: Astral Staff - Tooltip: Summons a large crystal from the sky that has a large area of effect on impact + Tooltip: Summons a large crystal from the sky that has a large area of effect on impact and inflicts [cbuff:CalamityMod/AstralInfectionDebuff] } Atlantis: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index bc3b67604d..53678a71c7 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -113,12 +113,12 @@ ArkoftheElements: { AstralPike: { DisplayName: Astral Pike - Tooltip: Summons astral star swarms on hit + Tooltip: Summons astral star swarms on hit and inflicts [cbuff:CalamityMod/AstralInfectionDebuff] } AstralScythe: { DisplayName: Astral Scythe - Tooltip: Shoots a scythe ring that accelerates over time + Tooltip: Shoots a scythe ring that accelerates over time and inflicts [cbuff:CalamityMod/AstralInfectionDebuff] } Ataraxia: { @@ -903,7 +903,7 @@ Nadir: { Nebulash: { DisplayName: Nebulash - Tooltip: Fires a whip sword that emits particle explosions on hit + Tooltip: Fires a whip sword that emits particle explosions on hit and inflicts [cbuff:CalamityMod/AstralInfectionDebuff] } NeptunesBounty: { @@ -1352,7 +1352,7 @@ TheMicrowave: { Tooltip: ''' {$Common.YoyoStatsInfinite} - Fries nearby enemies with radiation + Fries nearby enemies with radiation and inflicts [cbuff:CalamityMod/AstralInfectionDebuff] 'Cooking, Astral Infection style' ''' } @@ -1393,7 +1393,7 @@ TitanArm: { DisplayName: Titan Arm Tooltip: ''' - Sends enemies straight to the stars at the speed of light + Sends enemies straight to the stars at the speed of light and inflicts [cbuff:CalamityMod/AstralInfectionDebuff] Slap Hand but better ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index d7ce9e9271..3a47a7ff0d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -120,7 +120,7 @@ ArterialAssault: { AstralBlaster: { DisplayName: Astral Blaster - Tooltip: Converts musket balls into homing astral rounds + Tooltip: Converts musket balls into homing astral rounds that inflict [cbuff:CalamityMod/AstralInfectionDebuff] } AstrealDefeat: { @@ -145,7 +145,7 @@ AuroraBlazer: { DisplayName: Aurora Blazer Tooltip: ''' - Spews a nebula stream which forms a star shaped pattern + Spews a nebula stream which forms a star shaped pattern and inflicts [cbuff:CalamityMod/AstralInfectionDebuff] Uses gel for ammo ''' } @@ -1231,7 +1231,7 @@ StarSputter: { DisplayName: Star Sputter Tooltip: ''' - Fires a chain of comets + Fires a chain of comets that inflict [cbuff:CalamityMod/AstralInfectionDebuff] Fires a bigger, more powerful comet every four rounds 'Look to the stars for a galaxy far, far away' ''' @@ -1239,7 +1239,7 @@ StarSputter: { StellarCannon: { DisplayName: Stellar Cannon - Tooltip: Launches an explosive astral crystal + Tooltip: Launches an explosive astral crystal that inflicts [cbuff:CalamityMod/AstralInfectionDebuff] } StormSurge: { @@ -1311,6 +1311,7 @@ TauCannon: { Charge level one fires a burst of bolts Charge level two fires a beam of energy that quickly fizzles out Charge level three fires a massive laser and creates astral portals around you + Inflicts [cbuff:CalamityMod/AstralInfectionDebuff] 'This weapon is very ethically questionable' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index dc4d0d4fb4..b7269813df 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -39,6 +39,7 @@ AuroradicalThrow: { Launches a star that splits after a short period of time Split stars home in on nearby enemies after a few seconds Stealth strikes summon a meteor upon enemy impact + Inflicts [cbuff:CalamityMod/AstralInfectionDebuff] ''' } @@ -557,6 +558,7 @@ HeavenfallenStardisk: { Throws a stardisk upwards which then launches itself towards your mouse cursor Explodes into a star of astral bolts on hit Stealth strikes rain astral energy bolts from the sky + Inflicts [cbuff:CalamityMod/AstralInfectionDebuff] ''' } @@ -668,6 +670,7 @@ LeonidProgenitor: { Throws a bombshell that explodes, summoning a meteor to impact the site Press to throw a spread of gravity affected comets that explode, leaving behind a star Stealth strikes lob a bombshell that additionally splits into comets on hit + Inflicts [cbuff:CalamityMod/AstralInfectionDebuff] ''' } @@ -867,7 +870,7 @@ RadiantStar: { DisplayName: Radiant Star Tooltip: ''' - Throws daggers that explode and split after a while + Throws daggers that explode and split after a while and inflict [cbuff:CalamityMod/AstralInfectionDebuff] Stealth strikes split more with a devastating explosion that sucks enemies in ''' } @@ -904,7 +907,7 @@ RegulusRiot: { DisplayName: Regulus Riot Tooltip: ''' - Fires a swift homing disk + Fires a swift homing disk that inflicts [cbuff:CalamityMod/AstralInfectionDebuff] Stealth strikes explode into energy stars ''' } @@ -1124,7 +1127,7 @@ StellarKnife: { DisplayName: Stellar Knife Tooltip: ''' - Throws knives that stop middair and then home into enemies + Throws knives that stop middair and then home into enemies, inflicting [cbuff:CalamityMod/AstralInfectionDebuff] Stealth strikes throw a volley of 10 knives in a spread 'ZA WARUDO' ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index dd5eeacc25..a66a4b829b 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -2,6 +2,7 @@ AbandonedSlimeStaff: { DisplayName: Abandoned Slime Staff Tooltip: ''' + Summons an astral slime that inflicts [cbuff:CalamityMod/AstralInfectionDebuff] Consumes all of the remaining minion slots on use Must be used from the hotbar Increased power and size based on the number of minion slots used @@ -756,7 +757,7 @@ StaffOfNecrosteocytes: { StarspawnHelixStaff: { DisplayName: Starspawn Helix Staff - Tooltip: Summons astral probes to protect you + Tooltip: Summons astral probes that inflict [cbuff:CalamityMod/AstralInfectionDebuff] } StellarTorusStaff: { diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson index 223363df0b..17f2153e75 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -255,7 +255,6 @@ SilvaCrystal.DisplayName: Silva Crystal SilvaCrystalExplosion.DisplayName: Silva Explosion SiriusBeam.DisplayName: Sirius Beam SiriusQuasar.DisplayName: Sirius Quasar -SiriusExplosion.DisplayName: Sirius Explosion SiriusMinion.DisplayName: Sirius SkeletalDragonChild.DisplayName: Skeletal Child SkeletalDragonMother.DisplayName: Skeletal Mother diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 150728ab41..57aa927d58 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -616,7 +616,6 @@ Lecherous: { Disenchant: Disenchant // Worldgen Tasks BetterUnderworld: Creating a smoother Underworld -BetterShimmer: Placing shimmer in a sane location UnderworldStructures: Remnants of an Azafurian and Demonic war UnderworldTreesAndGrass: Growing Underworld flora UnderworldGeyserTraps: Adding an Underworld minefield diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index fa87ef4718..8576c9b207 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -443,12 +443,12 @@ namespace CalamityMod.NPCs break; // Chaos Elemental - // Rod of Discord @ 0.5% Normal, 0.625% Expert+ (2.5 times higher chance than vanilla) + // Rod of Discord @ 1% Normal, 2% Expert+ case NPCID.ChaosElemental: // Remove the vanilla loot rule for Rod of Discord. npcLoot.RemoveWhere((rule) => rule is CommonDrop conditionalRule && conditionalRule.itemId == ItemID.RodofDiscord); // Define a replacement rule which has an increased chance. - npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.RodofDiscord, 200, 160)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.RodofDiscord, 100, 50)); break; // Illuminant Bat diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 0d16ebdf75..7f86830c90 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -370,6 +370,7 @@ namespace CalamityMod.NPCs "Kendra", // <@!237247188005158912> (lordmetarex) "Libby", // <@!338315261352476682> (tyeski) "Myles", // <@!658760860722004017> (apotofkoolaid) + "Luna", // <@!534132902095749120> (mizzultraviolet) ]; private static readonly string[] TownDogCorgiNames = null; private static readonly string[] TownDogDalmatianNames = null; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainIllusion.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainIllusion.cs index c188ec3d82..e92335cefe 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainIllusion.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainIllusion.cs @@ -54,7 +54,7 @@ public class BrainIllusion : ModNPC, ILocalizedModType NPC.npcSlots = 0f; NPC.netAlways = true; Music = MusicID.Boss3; - SceneEffectPriority = SceneEffectPriority.BiomeLow; + SceneEffectPriority = (SceneEffectPriority)(-1); } public override void OnSpawn(IEntitySource source) @@ -73,6 +73,15 @@ public class BrainIllusion : ModNPC, ILocalizedModType return; } NPC brain = Main.npc[NPC.crimsonBoss]; + + if (brain.AIOverride().AIState == BrainOfCthulhuAI.BrainAIState.DeathAnimation) + { + NPC.damage = 0; + NPC.Opacity -= 0.1f; + if (NPC.Opacity <= 0) + NPC.active = false; + } + Player target = Main.player[NPC.target]; NPC.GivenName = brain.GivenOrTypeName + $": {brain.life}/{brain.lifeMax}"; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs index b64fe756b0..36fcc3398c 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs @@ -40,6 +40,9 @@ public class BrainOfCthulhuAI : VanillaAIOverride public static SoundStyle Laugh = new SoundStyle("CalamityMod/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Laugh") with { PauseBehavior = PauseBehavior.PauseWithGame }; private static SoundStyle Growl = new SoundStyle("CalamityMod/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Growl", 2) with { PauseBehavior = PauseBehavior.PauseWithGame }; private static SoundStyle Death = new SoundStyle("CalamityMod/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Death_Roar") with { PauseBehavior = PauseBehavior.PauseWithGame }; + private static SoundStyle BloodShot = new SoundStyle("CalamityMod/Sounds/Custom/BrainOfCthulhu/BoC_Rev_BloodShot"); + private static SoundStyle BloodExplosion = new SoundStyle("CalamityMod/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Explosion", 2); + internal static bool SummonedViaItem = false; internal List BoCAfterImages = []; @@ -546,6 +549,9 @@ public class BrainOfCthulhuAI : VanillaAIOverride NPC.oldVelocity = NPC.velocity; Time++; + if(AIState != BrainAIState.DeathAnimation && NPC.lifeRegen < 0 && Math.Abs(NPC.lifeRegen) >= NPC.life) + TriggerDeathAnimation(); + return false; } @@ -1889,8 +1895,9 @@ public class BrainOfCthulhuAI : VanillaAIOverride } } - if (Main.netMode != NetmodeID.MultiplayerClient) - if (Time % BloodshotRate == 0) + if (Time % BloodshotRate == 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 dir = NPC.DirectionTo(Target.Center); @@ -1908,7 +1915,8 @@ public class BrainOfCthulhuAI : VanillaAIOverride Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, initialDir * BloodshotVelocity / 2.1f, ProjectileID.BloodNautilusShot, BloodShotDamage, 0.5f, ai0: dir.ToRotation() + MathHelper.TwoPi, ai1: initialDir.ToRotation()); } } - + SoundEngine.PlaySound(BloodShot with { PitchVariance = 0.5f }, NPC.Center); + } } } @@ -2065,11 +2073,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride if (AttackCounter <= SanguineTeleportCount) { - SoundStyle explosion = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileExplosion") - { - Volume = 0.5f - }; - SoundEngine.PlaySound(explosion, NPC.Center); + SoundEngine.PlaySound(BloodExplosion, NPC.Center); for (int i = 0; i < SanguineScytheCount; i++) { @@ -2250,10 +2254,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride if (Time == CrimsonEyeAttackIdleDuration) { - SoundStyle explosion = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileExplosion"); - explosion.Volume = 0.5f; - - SoundEngine.PlaySound(explosion, NPC.Center); + SoundEngine.PlaySound(BloodExplosion, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { float projCount = 10; @@ -2723,12 +2724,13 @@ public class BrainOfCthulhuAI : VanillaAIOverride NPC.Opacity = BringOpacityTo(NPC.Opacity, 1, 0.1f); (float angle, Vector2 offset, int time)[] bloodGushingData = [ - (MathHelper.Pi / 6f, new(18, 12), 90), + (MathHelper.Pi / 6f, new(18, 12), 60), (MathHelper.Pi, new(-30, -10), 150), - (-MathHelper.Pi / 4f, new(20, -40), 180), - (MathHelper.Pi + MathHelper.Pi / 4f, new(-20, -40), 200), - (MathHelper.Pi / 1.75f, new(-5, 22), 210) + (-MathHelper.Pi / 4f, new(20, -40), 210), + (MathHelper.Pi + MathHelper.Pi / 4f, new(-20, -40), 240), + (MathHelper.Pi / 1.75f, new(-5, 22), 260) ]; + float EndTime = 270f; for (int i = 0; i < bloodGushingData.Length; i++) { @@ -2736,7 +2738,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride { if (Time == bloodGushingData[i].time) { - if(i == 2) + if(i == 3) SoundEngine.PlaySound(Death, NPC.Center); Vector2 bloodDir = bloodGushingData[i].angle.ToRotationVector2(); @@ -2744,12 +2746,11 @@ public class BrainOfCthulhuAI : VanillaAIOverride GeneralParticleHandler.SpawnParticle(p2); NPC.velocity = bloodDir * -4f; - SoundStyle explosion = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileExplosion") + SoundStyle bleed = BloodShot with { - Volume = 0.5f, Pitch = i / (float)(bloodGushingData.Length - 1) }; - SoundEngine.PlaySound(explosion, NPC.Center); + SoundEngine.PlaySound(bleed, NPC.Center); Main.LocalPlayer.SetScreenshake(1f); } @@ -2763,10 +2764,10 @@ public class BrainOfCthulhuAI : VanillaAIOverride } - if (Time >= 215) + if (Time >= EndTime) { - SoundStyle explosion = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileExplosion"); - SoundEngine.PlaySound(explosion, NPC.Center); + SoundEngine.PlaySound(BloodExplosion, NPC.Center); + SoundEngine.PlaySound(BloodShot, NPC.Center); Main.LocalPlayer.SetScreenshake(2f); @@ -2790,8 +2791,9 @@ public class BrainOfCthulhuAI : VanillaAIOverride NPC.StrikeInstantKill(); } - float animationCompletion = Time / 215f; + float animationCompletion = Time / EndTime; NPC.frameCounter += 2 * animationCompletion; + BoCDrawOffset = Main.rand.NextVector2Circular(4, 4) * animationCompletion; if (Main.rand.NextFloat(0.5f, 1f) < animationCompletion) { @@ -2889,17 +2891,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride { if (AIState != BrainAIState.DeathAnimation && (NPC.life + 1) <= hit.Damage) { - NPC.life = 1; - NPC.BossBar = null; - NPC.dontTakeDamage = true; - - if (AIState == BrainAIState.Stunned) - TeleportTime = 0; - - AIState = BrainAIState.DeathAnimation; - ResetAttackValues(); - Time = 0; - NPC.netUpdate = true; + TriggerDeathAnimation(); return; } @@ -2910,6 +2902,30 @@ public class BrainOfCthulhuAI : VanillaAIOverride } } + private void TriggerDeathAnimation() + { + NPC.life = 1; + NPC.lifeRegen = 0; + NPC.BossBar = null; + NPC.dontTakeDamage = true; + + if (AIState == BrainAIState.Stunned || AIState == BrainAIState.IllusionTrick) + TeleportTime = 0; + + foreach (NPC n in Main.ActiveNPCs) + { + if (n.type != ModContent.NPCType()) + continue; + + n.ModNPC().BeenHit = true; + } + + AIState = BrainAIState.DeathAnimation; + ResetAttackValues(); + Time = 0; + NPC.netUpdate = true; + } + public override bool PreKill(Mod mod) => AIState == BrainAIState.DeathAnimation && !NPC.dontTakeDamage; public override void FindFrame(Mod mod, int frameHeight) @@ -3036,6 +3052,8 @@ public class BrainOfCthulhuAI : VanillaAIOverride { if (n.ModNPC is FalseBrain falseBrain) falseBrain.DrawSelf(spriteBatch, screenPos, Lighting.GetColor(n.Center.ToTileCoordinates())); + else if (AIState == BrainAIState.DeathAnimation) + drawBrain = true; else DrawBrainLikeFakes(spriteBatch, n); } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuSystem.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuSystem.cs index 813f3ad6d0..e2e80efb76 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuSystem.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuSystem.cs @@ -65,6 +65,12 @@ public class BrainOfCthulhuSystem : ModSystem if (Main.curMusic == MusicID.Boss3) Main.curMusic = previousMusic; } + + if (Main.newMusic == MusicID.Boss1) + Main.newMusic = previousMusic; + + if (Main.curMusic == MusicID.Boss1) + Main.curMusic = previousMusic; } private void StopOWBoss1FromStarting(On_Main.orig_UpdateAudio_DecideOnTOWMusic orig, Main self) @@ -404,7 +410,11 @@ public class BrainOfCthulhuSystem : ModSystem public override void PostUpdateEverything() { - if (Main.curMusic != MusicID.Boss3 && Main.curMusic != MusicID.OtherworldlyBoss1) + bool allowBossMusic = false; + if (NPC.crimsonBoss != -1 && Main.npc[NPC.crimsonBoss].active && Main.npc[NPC.crimsonBoss].TryGetAIOverride(out var brainAI) && brainAI.AIState > BrainOfCthulhuAI.BrainAIState.SurfaceSpawnAnimation) + allowBossMusic = true; + + if (((Main.curMusic != MusicID.Boss3 && Main.curMusic != MusicID.OtherworldlyBoss1) || allowBossMusic) && Main.curMusic != MusicID.Boss1) previousMusic = Main.curMusic; if (previousMusic == -1) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/FalseBrain.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/FalseBrain.cs index f3ab0e75fd..2e454be5c8 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/FalseBrain.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/FalseBrain.cs @@ -44,7 +44,7 @@ public class FalseBrain : ModNPC, ILocalizedModType NPC.netAlways = true; NPC.ShowNameOnHover = false; Music = MusicID.Boss3; - SceneEffectPriority = SceneEffectPriority.BiomeLow; + SceneEffectPriority = (SceneEffectPriority)(-1); NPC.localAI[0] = Main.rand.Next(6); diff --git a/Packets/Entities/ManaBurnSyncPacket.cs b/Packets/Entities/ManaBurnSyncPacket.cs new file mode 100644 index 0000000000..36aab620f5 --- /dev/null +++ b/Packets/Entities/ManaBurnSyncPacket.cs @@ -0,0 +1,35 @@ +using System.IO; +using Terraria; + +namespace CalamityMod.Packets.Entities +{ + internal sealed class ManaBurnSyncPacket : CalamityPacket + { + public static ManaBurnSyncPacket Instance { get; private set; } + + public static void Send(NPC npc, int toClient = -1, int ignoreClient = -1) + { + if (npc is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(npc); + packet.Write(npc.Calamity().manaBurn); + packet.Write(npc.Calamity().manaBurnPeak); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(BinaryReader packet, int sender) + { + var npc = packet.ReadNPC(); + var burn = packet.ReadSingle(); + var burnPeak = packet.ReadSingle(); + + if (npc is null) + return; + + npc.Calamity().manaBurn = burn; + npc.Calamity().manaBurnPeak = burnPeak; + } + } +} diff --git a/Packets/Players/SyncPlayerDrawParameterPacket.cs b/Packets/Players/SyncPlayerDrawParameterPacket.cs index 8b2324af6d..a4ad57c421 100644 --- a/Packets/Players/SyncPlayerDrawParameterPacket.cs +++ b/Packets/Players/SyncPlayerDrawParameterPacket.cs @@ -21,6 +21,11 @@ namespace CalamityMod.Packets packet.Write((Half)player.drawingParameters.ProfanedShieldCharge); // 2b packet.WriteRGB(player.drawingParameters.ProfanedShieldColor); // 3b packet.Write((Half)player.drawingParameters.SpongeShieldCharge); // 2b + + packet.Write((short)player.RoverDriveShieldDurability); + packet.Write((short)player.LunicCorpsShieldDurability); + packet.Write((short)player.pSoulShieldDurability); + packet.Write((short)player.SpongeShieldDurability); packet.Send(toClient, ignoreClient); } @@ -32,6 +37,10 @@ namespace CalamityMod.Packets var profanedCharge = (float)packet.ReadHalf(); var profanedColor = packet.ReadRGB(); var spongeCharge = (float)packet.ReadHalf(); + var roverDurability = packet.ReadInt16(); + var lunicDurability = packet.ReadInt16(); + var pSoulDurability = packet.ReadInt16(); + var spongeDurability = packet.ReadInt16(); if (player is null) return; @@ -41,6 +50,10 @@ namespace CalamityMod.Packets player.drawingParameters.ProfanedShieldCharge = profanedCharge; player.drawingParameters.ProfanedShieldColor = profanedColor; player.drawingParameters.SpongeShieldCharge = spongeCharge; + player.RoverDriveShieldDurability = roverDurability; + player.LunicCorpsShieldDurability = lunicDurability; + player.pSoulShieldDurability = pSoulDurability; + player.SpongeShieldDurability = spongeDurability; if (Main.dedServ) Send(player, ignoreClient: sender); diff --git a/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs b/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs index 84fc068a5f..886d0f4802 100644 --- a/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs @@ -197,27 +197,46 @@ namespace CalamityMod.Projectiles.BaseProjectiles // The center of the player, taking into account if they have a mount or not. Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - // The vector between the player and the mouse, used for pointing the holdout. - Vector2 ownerToMouse = Owner.Calamity().mouseWorld - armPosition; - // The direction this holdout's pointing at. float holdoutDirection = Projectile.velocity.ToRotation(); - // A range from -1 to 1 for when the holdout is pointing downards of upwards, respectively. - // Used for the offsets. - float proximityLookingUpwards = Vector2.Dot(ownerToMouse.SafeNormalize(Vector2.Zero), -Vector2.UnitY * Owner.gravDir); + // Only the owner should compute aiming from mouse position. + // Non-owner clients use the synced rotation/direction to avoid jitter. + if (Projectile.owner == Main.myPlayer) + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + // The vector between the player and the mouse, used for pointing the holdout. + Vector2 ownerToMouse = Owner.Calamity().mouseWorld - armPosition; - int direction = MathF.Sign(ownerToMouse.X); + // A range from -1 to 1 for when the holdout is pointing downards of upwards, respectively. + // Used for the offsets. + float proximityLookingUpwards = Vector2.Dot(ownerToMouse.SafeNormalize(Vector2.Zero), -Vector2.UnitY * Owner.gravDir); - Vector2 lengthOffset = Projectile.rotation.ToRotationVector2() * OffsetLengthFromArm; - Vector2 armOffset = new Vector2(Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetXUpwards : OffsetXDownwards) * direction, BaseOffsetY * Owner.gravDir + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetYUpwards : OffsetYDownwards) * Owner.gravDir); - Projectile.Center = armPosition + lengthOffset + armOffset; - Projectile.velocity = holdoutDirection.AngleTowards(ownerToMouse.ToRotation(), WeaponTurnSpeed).ToRotationVector2(); - Projectile.rotation = holdoutDirection; + int direction = MathF.Sign(ownerToMouse.X); - Projectile.spriteDirection = direction; - Owner.ChangeDir(direction); + Vector2 lengthOffset = Projectile.rotation.ToRotationVector2() * OffsetLengthFromArm; + Vector2 armOffset = new Vector2(Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetXUpwards : OffsetXDownwards) * direction, BaseOffsetY * Owner.gravDir + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetYUpwards : OffsetYDownwards) * Owner.gravDir); + Projectile.Center = armPosition + lengthOffset + armOffset; + Projectile.velocity = holdoutDirection.AngleTowards(ownerToMouse.ToRotation(), WeaponTurnSpeed).ToRotationVector2(); + Projectile.rotation = holdoutDirection; + + Projectile.spriteDirection = direction; + Owner.ChangeDir(direction); + } + else + { + Vector2 lengthOffset = Projectile.rotation.ToRotationVector2() * OffsetLengthFromArm; + float proximityLookingUpwards = Vector2.Dot(Projectile.velocity.SafeNormalize(Vector2.Zero), -Vector2.UnitY * Owner.gravDir); + int direction = Projectile.spriteDirection; + + Vector2 armOffset = new Vector2(Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetXUpwards : OffsetXDownwards) * direction, BaseOffsetY * Owner.gravDir + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetYUpwards : OffsetYDownwards) * Owner.gravDir); + Projectile.Center = armPosition + lengthOffset + armOffset; + Projectile.velocity = Projectile.rotation.ToRotationVector2(); + + Owner.ChangeDir(direction); + } + + int currentDirection = Projectile.spriteDirection; Owner.heldProj = Projectile.whoAmI; if (SetUsage) @@ -226,8 +245,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles // -Pi/2 because the arms rotation starts with arms pointing down. float armRotation = (Projectile.rotation - MathHelper.PiOver2) * Owner.gravDir + (Owner.gravDir == -1 ? MathHelper.Pi : 0f); - Owner.SetCompositeArmFront(true, FrontArmStretch, armRotation + ExtraFrontArmRotation * direction); - Owner.SetCompositeArmBack(true, BackArmStretch, armRotation + ExtraBackArmRotation * direction); + Owner.SetCompositeArmFront(true, FrontArmStretch, armRotation + ExtraFrontArmRotation * currentDirection); + Owner.SetCompositeArmBack(true, BackArmStretch, armRotation + ExtraBackArmRotation * currentDirection); if (KeepRefreshingLifetime) Projectile.timeLeft = 2; @@ -235,7 +254,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles if (OffsetLengthFromArm != MaxOffsetLengthFromArm) OffsetLengthFromArm = MathHelper.Lerp(OffsetLengthFromArm, MaxOffsetLengthFromArm, RecoilResolveSpeed); - Projectile.ForceNetUpdate(); + if (Projectile.owner == Main.myPlayer) + Projectile.ForceNetUpdate(); } /// @@ -251,12 +271,25 @@ namespace CalamityMod.Projectiles.BaseProjectiles { Texture2D texture = TextureAssets.Projectile[Type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); Vector2 rotationPoint = texture.Size() * 0.5f; - SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + float drawRotation = Projectile.rotation; - Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + SpriteEffects flipSprite = SpriteEffects.None; + if (Owner.gravDir == 1f) + { + if (Projectile.spriteDirection == -1) + flipSprite = SpriteEffects.FlipVertically; + } + else + { + rotationPoint.Y = texture.Height - rotationPoint.Y; + + if (Projectile.spriteDirection == 1) + flipSprite = SpriteEffects.FlipVertically; + } + + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale, flipSprite, 0); return false; } diff --git a/Projectiles/BaseProjectiles/BaseSpearProjectile.cs b/Projectiles/BaseProjectiles/BaseSpearProjectile.cs index 99815b550c..2a02d5f774 100644 --- a/Projectiles/BaseProjectiles/BaseSpearProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseSpearProjectile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.BaseProjectiles @@ -20,6 +21,31 @@ namespace CalamityMod.Projectiles.BaseProjectiles // Also, be careful with the move and reelback speed. If they're bad values, // the spear might end up detaching from or impaling the player. + private float GetSyncedItemAnimation(Player player) + { + float itemAnimation = player.itemAnimation; + + if (Main.netMode != NetmodeID.SinglePlayer && Main.myPlayer == Projectile.owner) + { + if (Projectile.ai[1] != itemAnimation) + { + Projectile.ai[1] = itemAnimation; + Projectile.netUpdate = true; + } + } + + if (Main.netMode == NetmodeID.SinglePlayer || Main.myPlayer == Projectile.owner) + return itemAnimation; + + if (Projectile.ai[1] > 0f) + Projectile.localAI[1] = 1f; + + if (Projectile.localAI[1] == 1f) + return Projectile.ai[1]; + + return Math.Max(1f, player.itemAnimationMax); + } + public virtual void Behavior() { if (SpearAiType == SpearType.TypicalSpear) @@ -29,6 +55,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles Player player = Main.player[Projectile.owner]; + float itemAnimationMax = Math.Max(1f, player.itemAnimationMax); + float syncedItemAnimation = GetSyncedItemAnimation(player); + // Adjust owner stats based on this projectile player.ChangeDir(Projectile.direction); player.heldProj = Projectile.whoAmI; @@ -47,7 +76,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Projectile.netUpdate = true; } // Reel back - if (player.itemAnimation < player.itemAnimationMax / 3) + if (syncedItemAnimation < itemAnimationMax / 3f) { Projectile.ai[0] -= ReelbackSpeed; @@ -67,7 +96,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles // If at the end of the animation, kill the projectile. //Checking if == 0 is too late, lets the projectile linger into chained item uses. - if (player.itemAnimation <= 1) + if (syncedItemAnimation <= 1f) Projectile.Kill(); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 + MathHelper.PiOver4; @@ -78,6 +107,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles { Player player = Main.player[Projectile.owner]; + float itemAnimationMax = Math.Max(1f, player.itemAnimationMax); + float syncedItemAnimation = GetSyncedItemAnimation(player); + Vector2 playerRelativePoint = player.RotatedRelativePoint(player.MountedCenter, true); Projectile.direction = player.direction; @@ -92,7 +124,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles if (!player.frozen) { // Pretty much the same as regular spears. - if (Main.player[Projectile.owner].itemAnimation < Main.player[Projectile.owner].itemAnimationMax / 3) + if (syncedItemAnimation < itemAnimationMax / 3f) { if (Projectile.localAI[0] == 0f && EffectBeforeReelback != null && Main.myPlayer == Projectile.owner) { @@ -113,7 +145,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles { Projectile.localAI[0] -= 1f; } - float inverseAnimationCompletion = 1f - (player.itemAnimation / (float)player.itemAnimationMax); + float inverseAnimationCompletion = 1f - (syncedItemAnimation / itemAnimationMax); float originalVelocityDirection = Projectile.velocity.ToRotation(); float originalVelocitySpeed = Projectile.velocity.Length(); diff --git a/Projectiles/Boss/HolyAura.cs b/Projectiles/Boss/HolyAura.cs index 3ceab6d0b0..aa0e2e6f81 100644 --- a/Projectiles/Boss/HolyAura.cs +++ b/Projectiles/Boss/HolyAura.cs @@ -31,7 +31,14 @@ namespace CalamityMod.Projectiles.Boss Projectile.timeLeft = 210; } - public override void AI() => Projectile.Center = Main.npc[CalamityGlobalNPC.holyBoss].Center; + public override void AI() + { + int provIndex = CalamityGlobalNPC.holyBoss; + if (provIndex < 0 || provIndex >= Main.maxNPCs || !Main.npc[provIndex].active) + return; + + Projectile.Center = Main.npc[provIndex].Center; + } public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 94f5dc0882..22012f3354 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -11,17 +11,18 @@ using CalamityMod.EntitySources; using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.ExtraTextures; +using CalamityMod.Graphics; using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo; -using CalamityMod.Items.Fishing.FishingRods; using CalamityMod.Items.Armor.Daedalus; using CalamityMod.Items.Armor.Reaver; +using CalamityMod.Items.Fishing.FishingRods; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.NPCs; using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses; -using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Packets.Entities; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Healing; @@ -54,7 +55,6 @@ using Terraria.Utilities; using Terraria.WorldBuilding; using static Terraria.ModLoader.ModContent; using NanotechProjectile = CalamityMod.Projectiles.Typeless.Nanotech; -using CalamityMod.Graphics; namespace CalamityMod.Projectiles { @@ -322,6 +322,7 @@ namespace CalamityMod.Projectiles void ApplyGrapeBeer() { + grapeBeer = true; conditionalHomingRange = 600; if (projectile.timeLeft > 300 * projectile.MaxUpdates) projectile.timeLeft = 300 * projectile.MaxUpdates; @@ -329,13 +330,13 @@ namespace CalamityMod.Projectiles projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = -1; } - if (source is EntitySource_ItemUse_WithAmmo {Item: Item item}) + if (source is EntitySource_ItemUse_WithAmmo { Item: Item item }) { if (source is EntitySource_Parent { Entity: Player player }) { if (player.Calamity().grapeBeer && (item.useAmmo == AmmoID.Bullet || item.useAmmo == AmmoID.Arrow || item.useAmmo == AmmoID.Dart || item.useAmmo == AmmoID.Rocket)) { - if (player.heldProj != projectile.whoAmI && projectile.aiStyle != ProjAIStyleID.HeldProjectile && projectile.damage > 0 && player.Calamity().grapeBeerTimer < 5) + if (player.heldProj != projectile.whoAmI && projectile.aiStyle != ProjAIStyleID.HeldProjectile && projectile.damage > 0 && player.Calamity().grapeBeerTimer < 5 && !CalamityProjectileSets.DoesNotGetHomingWithGrapeBeer[projectile.type]) ApplyGrapeBeer(); else grapeBeer = true; @@ -356,7 +357,7 @@ namespace CalamityMod.Projectiles //Grape Beer homing if (parent.Calamity().grapeBeer) { - if (Main.player[projectile.owner].heldProj != projectile.whoAmI && projectile.aiStyle != ProjAIStyleID.HeldProjectile && projectile.damage > 0 && Main.player[projectile.owner].Calamity().grapeBeerTimer < 5) + if (Main.player[projectile.owner].heldProj != projectile.whoAmI && projectile.aiStyle != ProjAIStyleID.HeldProjectile && projectile.damage > 0 && Main.player[projectile.owner].Calamity().grapeBeerTimer < 5 && !CalamityProjectileSets.DoesNotGetHomingWithGrapeBeer[projectile.type]) ApplyGrapeBeer(); else grapeBeer = true; @@ -4251,7 +4252,7 @@ namespace CalamityMod.Projectiles arcFlashCooldown--; if (arcFlashCooldown == 0) showArcFlash = true; - if (conditionalHomingRange > 0f) + if (conditionalHomingRange > 0f && Main.player[projectile.owner].heldProj != projectile.whoAmI && projectile.aiStyle != ProjAIStyleID.HeldProjectile) { CalamityUtils.HomeInOnNPC(projectile, !projectile.tileCollide, conditionalHomingRange, 12f, 20f,true); } @@ -4690,9 +4691,12 @@ namespace CalamityMod.Projectiles //Mana Burn if (Main.player[projectile.owner].statMana < 0) { - float burnRatio = (-Main.player[projectile.owner].statMana / 100) * ChaosStone.DamageMultPer100Mana; - target.Calamity().manaBurn += damageDone * burnRatio; - target.Calamity().playerManaBurnIntensity = -Main.player[projectile.owner].statMana / (float)Main.player[projectile.owner].statManaMax2; + var player = Main.player[projectile.owner]; + float burnRatio = (-player.statMana / 100) * ChaosStone.DamageMultPer100Mana; + target.Calamity().manaBurn += damageDone * burnRatio * (player.Calamity().oldFashioned ? OldFashioned.DamageBoostMultiplier : 1) * (player.Calamity().ivDrip ? IVDripOnTheRocks.DamageBoostMultiplier : 1); + target.Calamity().playerManaBurnIntensity = -player.statMana / (float)player.statManaMax2; + if (Main.netMode != NetmodeID.SinglePlayer) + ManaBurnSyncPacket.Send(target); } // Hyperius Overflow if (projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType() && target.Calamity().hyperiusMarked) diff --git a/Projectiles/Magic/CosmicTentacle.cs b/Projectiles/Magic/CosmicTentacle.cs index 82d268e778..f1edf2171f 100644 --- a/Projectiles/Magic/CosmicTentacle.cs +++ b/Projectiles/Magic/CosmicTentacle.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Dusts; +using CalamityMod.Enums; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; @@ -58,6 +59,7 @@ namespace CalamityMod.Projectiles.Magic GeneralParticleHandler.SpawnParticle(blastRing); Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor * 0.6f, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.48f * scaler, 0f, 4, true); GeneralParticleHandler.SpawnParticle(blastRing2); + blastRing2.DrawLayer = GeneralDrawLayer.AfterEverything; } Projectile.velocity *= 0.96f; if (time == 3) @@ -89,6 +91,7 @@ namespace CalamityMod.Projectiles.Magic GeneralParticleHandler.SpawnParticle(spark); Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark", false, 12, 0.035f * scaling, Color.LightGreen * 0.75f, new Vector2(1.7f - (1 - sharpScaling), 0.9f + (1 - sharpScaling) * 2)); GeneralParticleHandler.SpawnParticle(spark2); + spark2.DrawLayer = GeneralDrawLayer.AfterEverything; } if (Main.rand.NextBool(6)) { @@ -111,6 +114,7 @@ namespace CalamityMod.Projectiles.Magic { Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.36f, 0f, scalingTimerMax / 2, true); GeneralParticleHandler.SpawnParticle(blastRing2); + blastRing2.DrawLayer = GeneralDrawLayer.AfterEverything; } Projectile.velocity = Vector2.Zero; } diff --git a/Projectiles/Magic/FrigidflashBoltProjectile.cs b/Projectiles/Magic/FrigidflashBoltProjectile.cs index 19899c4f4f..db02bafc94 100644 --- a/Projectiles/Magic/FrigidflashBoltProjectile.cs +++ b/Projectiles/Magic/FrigidflashBoltProjectile.cs @@ -183,7 +183,7 @@ namespace CalamityMod.Projectiles.Magic target.AddBuff(BuffID.Frostburn2, 60); float minMult = 0.2f; - int hitsToMinMult = 4; + int hitsToMinMult = 3; float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); modifiers.SourceDamage *= damageMult; } diff --git a/Projectiles/Magic/HeliumFlashHoldout.cs b/Projectiles/Magic/HeliumFlashHoldout.cs index 338c58f4f1..bf3d5019cd 100644 --- a/Projectiles/Magic/HeliumFlashHoldout.cs +++ b/Projectiles/Magic/HeliumFlashHoldout.cs @@ -231,7 +231,7 @@ namespace CalamityMod.Projectiles.Magic Texture2D texture = TextureAssets.Projectile[Type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) - (Owner.gravDir == -1 ? MathHelper.PiOver2 * Owner.direction : 0f); Vector2 rotationPoint = texture.Size() * 0.5f; SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Magic/IonBlasterHoldout.cs b/Projectiles/Magic/IonBlasterHoldout.cs index 550d6ae5c8..53fa872562 100644 --- a/Projectiles/Magic/IonBlasterHoldout.cs +++ b/Projectiles/Magic/IonBlasterHoldout.cs @@ -287,7 +287,7 @@ namespace CalamityMod.Projectiles.Magic Texture2D texGlow = ModContent.Request("CalamityMod/Items/Weapons/Magic/IonBlasterGlow").Value; Texture2D tex2 = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) - (Owner.gravDir == -1 ? MathHelper.Pi * Owner.direction : 0f); SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; Vector2 shake = Main.rand.NextVector2Circular(2, 2) * manaPower; diff --git a/Projectiles/Magic/SHPL.cs b/Projectiles/Magic/SHPL.cs index 5581d24080..6e6d986e11 100644 --- a/Projectiles/Magic/SHPL.cs +++ b/Projectiles/Magic/SHPL.cs @@ -37,6 +37,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.scale = 1.85f; Projectile.friendly = true; Projectile.extraUpdates = 3; + Projectile.tileCollide = false; Projectile.timeLeft = 600; Projectile.penetrate = -1; Projectile.DamageType = DamageClass.Magic; @@ -51,6 +52,8 @@ namespace CalamityMod.Projectiles.Magic // naturally dissipate entirely before despawning. Of course, it's also coded so that the laser stops dealing damage // entirely once this is done to avoid hitting targets multiple times, so functionally the projectile remains the same // and this change should have little to no effect on gameplay. If it does, ping me about it. + // 2FEB2026: sunny: + // Due to Calclone's new border, lasers no longer have tile collision, so this part of the code is now only used for hitting targets. if (ShouldStopAndDie) { Projectile.velocity *= 0f; diff --git a/Projectiles/Magic/SHPV.cs b/Projectiles/Magic/SHPV.cs index a169b698cc..e89fb91356 100644 --- a/Projectiles/Magic/SHPV.cs +++ b/Projectiles/Magic/SHPV.cs @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(CommonCalamitySounds.ELRFireSound, Owner.Center); Vector2 laserPos = TipPosition + Vector2.UnitY.RotatedBy(Projectile.rotation) * Main.rand.NextFloat(-7f, 7f); Vector2 laserVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) * 20f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), laserPos, laserVel, ModContent.ProjectileType(), (int)(Projectile.damage * 1.35f), 3f, Projectile.owner, SoulColors[0]); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), laserPos, laserVel, ModContent.ProjectileType(), (int)(Projectile.damage * 1.4f), 3f, Projectile.owner, SoulColors[0]); if (ConsumeSoul) { diff --git a/Projectiles/Magic/VitriolicViperHoldout.cs b/Projectiles/Magic/VitriolicViperHoldout.cs index dd52647e69..ae04de7f52 100644 --- a/Projectiles/Magic/VitriolicViperHoldout.cs +++ b/Projectiles/Magic/VitriolicViperHoldout.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic if (SoundEngine.TryGetActiveSound(ChargeSlot, out var ChargeSound) && ChargeSound.IsPlaying) ChargeSound.Position = Projectile.Center; - chargePower = Utils.GetLerpValue(0, FirstChargeFrames, CurrentChargingFrames, true) * (FullCharge ? 1.3f : 1); + chargePower = Utils.GetLerpValue(0, FirstChargeFrames, CurrentChargingFrames, true) * (FullCharge ? 1.4f : 1); if (CurrentOverchargeFrames < FullyChargedFrames) overchargePower = MathHelper.Clamp(Utils.GetLerpValue(FullyChargedFrames * 2, 0, CurrentOverchargeFrames, true), 0.5f, 1); else @@ -222,7 +222,7 @@ namespace CalamityMod.Projectiles.Magic Texture2D texture = TextureAssets.Projectile[Type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) - (Owner.gravDir == -1 ? MathHelper.PiOver2 * Owner.direction : 0f); Vector2 rotationPoint = texture.Size() * 0.5f; SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Melee/BladecrestOathswordThrownBlade.cs b/Projectiles/Melee/BladecrestOathswordThrownBlade.cs index 93c9ac66e6..500a311afe 100644 --- a/Projectiles/Melee/BladecrestOathswordThrownBlade.cs +++ b/Projectiles/Melee/BladecrestOathswordThrownBlade.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; using static CalamityMod.CalamityUtils; @@ -48,6 +49,23 @@ namespace CalamityMod.Projectiles.Melee public int bounces = 0; public bool fadingOut => Projectile.timeLeft <= (Lifetime - fadeOutTime); + private Vector2 GetAimDirection() + { + if (Main.myPlayer == Projectile.owner) + { + Vector2 toMouse = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + float aimAngle = toMouse.ToRotation(); + if (Math.Abs(MathHelper.WrapAngle(aimAngle - Projectile.localAI[1])) > 0.02f) + { + Projectile.localAI[1] = aimAngle; + if (Projectile.timeLeft % 6 == 0) + Projectile.netUpdate = true; + } + return toMouse; + } + return Projectile.localAI[1].ToRotationVector2(); + } + public override void SetDefaults() { Projectile.width = 12; @@ -134,16 +152,19 @@ namespace CalamityMod.Projectiles.Melee CurrentState &= ~State.HitTarget; } + if ((CurrentState & State.Thrown) != 0 && (CurrentState & (State.StuckInGround | State.StuckInTarget)) == 0) + Projectile.extraUpdates = 1; + float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); Projectile.spriteDirection = Projectile.direction; Vector3 Light = Color.Firebrick.ToVector3(); Lighting.AddLight(Projectile.Center, Light * 0.5f); - if (Projectile.timeLeft == Lifetime) + if (Projectile.timeLeft == Lifetime && Main.myPlayer == Projectile.owner) { // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - Vector2 toMouse = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + Vector2 toMouse = GetAimDirection(); Projectile.velocity = toMouse * 14; Projectile.Center = Owner.MountedCenter + toMouse * 12f; Projectile.spriteDirection = Projectile.direction; @@ -151,6 +172,7 @@ namespace CalamityMod.Projectiles.Melee time = 0; Projectile.extraUpdates = 1; Projectile.tileCollide = true; + Projectile.netUpdate = true; } if (Projectile.velocity.X > 0) @@ -287,7 +309,8 @@ namespace CalamityMod.Projectiles.Melee public void throwAnimation() { - Owner.ChangeDir(MathF.Sign(Owner.Calamity().mouseWorld.X - Owner.Center.X)); + Vector2 aimDirection = GetAimDirection(); + Owner.ChangeDir(MathF.Sign(aimDirection.X)); float armRotation = ArmAnticipationMovement() * Owner.direction; @@ -358,6 +381,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; SoundStyle stuck = new("CalamityMod/Sounds/Item/DemonSwordImpact", 2); SoundEngine.PlaySound(stuck with { Volume = 0.75f, Pitch = Main.rand.NextFloat(0.2f, 0.3f), MaxInstances = 3 }, Projectile.Center); + Projectile.netUpdate = true; } public override bool? CanDamage() @@ -407,11 +431,22 @@ namespace CalamityMod.Projectiles.Melee public override void SendExtraAI(BinaryWriter writer) { writer.Write((byte)CurrentState); + writer.Write(Projectile.rotation); + writer.Write(Projectile.localAI[1]); + writer.Write(impalePos.X); + writer.Write(impalePos.Y); + writer.Write(stuckTimer); + writer.Write((short)bounces); } public override void ReceiveExtraAI(BinaryReader reader) { CurrentState = (State)reader.ReadByte(); + Projectile.rotation = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); + impalePos = new Vector2(reader.ReadSingle(), reader.ReadSingle()); + stuckTimer = reader.ReadInt32(); + bounces = reader.ReadInt16(); } } } diff --git a/Projectiles/Melee/DevilsDevastationHoldout.cs b/Projectiles/Melee/DevilsDevastationHoldout.cs index eb102a9471..4afc753248 100644 --- a/Projectiles/Melee/DevilsDevastationHoldout.cs +++ b/Projectiles/Melee/DevilsDevastationHoldout.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Cooldowns; using CalamityMod.Dusts; @@ -51,8 +52,10 @@ namespace CalamityMod.Projectiles.Melee public bool willDie = false; public bool hasLaunchedBlades = false; public bool swooshFade = false; + private int lastSwingId; public NPC lastHitTarget = null; + private int lastHitTargetIndex = -1; public int postSwingCooldownMax => (int)(useAnim * 0.65f); public override void SetDefaults() { @@ -77,11 +80,26 @@ namespace CalamityMod.Projectiles.Melee Projectile.knockBack = 0; Projectile.scale = 1.15f; Projectile.ai[1] = -1; + bool isOwner = Main.myPlayer == Projectile.owner; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - mousePos = Owner.Calamity().mouseWorld; - aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + if (isOwner) + { + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + Projectile.netUpdate = true; + } + else + { + Vector2 syncedDelta = Owner.Calamity().mouseWorldDeltaFromPlayer; + if (syncedDelta.LengthSquared() > 0.001f) + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65f; + else + aimVel = Vector2.UnitX * Owner.direction * 65f; + mousePos = Owner.Center - aimVel; + } useAnim = (int)(Owner.HeldItem.useAnimation / Owner.GetTotalAttackSpeed()); postSwingCooldown = postSwingCooldownMax / 2; + lastSwingId = (int)Projectile.ai[0]; if (mousePos.X < Owner.Center.X) Owner.direction = -1; else Owner.direction = 1; @@ -117,32 +135,66 @@ namespace CalamityMod.Projectiles.Melee } public override void UseStyle() { + bool isOwner = Main.myPlayer == Projectile.owner; bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD); - if (SoundEngine.TryGetActiveSound(SoundSlot, out var Sound) && Sound.IsPlaying && lastHitTarget != null) - Sound.Position = lastHitTarget.Center; + if (!isOwner) + { + Vector2 syncedDelta = Owner.Calamity().mouseWorldDeltaFromPlayer; + if (syncedDelta.LengthSquared() > 0.001f) + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65f; + } - if ((Main.mouseLeft || (hasKillMode && killModeCD.timeLeft == KillMode.cooldownMax + 1)) && holding && postSwingCooldown == 0) + if (lastHitTargetIndex >= 0) + { + NPC syncedTarget = Main.npc[lastHitTargetIndex]; + if (syncedTarget != null && syncedTarget.active && syncedTarget.life > 0) + lastHitTarget = syncedTarget; + } + + if (isOwner) + { + bool shouldStartSwing = (Main.mouseLeft || (hasKillMode && killModeCD.timeLeft == KillMode.cooldownMax + 1)) && holding && postSwingCooldown == 0; + if (shouldStartSwing) + { + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + Projectile.ai[0] += 1f; + Projectile.netUpdate = true; + } + } + + int swingId = (int)Projectile.ai[0]; + if (swingId != lastSwingId && holding && postSwingCooldown == 0) { Animation = (int)(useAnim * 0.7f); holding = false; - killModeCD.timeLeft = KillMode.cooldownMax; - Owner.Calamity().killModeCooldown = KillMode.cooldownMax - 1; + if (isOwner) + { + killModeCD.timeLeft = KillMode.cooldownMax; + Owner.Calamity().killModeCooldown = KillMode.cooldownMax - 1; + } swingCount++; + lastSwingId = swingId; } + + if (SoundEngine.TryGetActiveSound(SoundSlot, out var Sound) && Sound.IsPlaying && lastHitTarget != null) + Sound.Position = lastHitTarget.Center; if (postSwingCooldown > 0) postSwingCooldown--; else if (willDie) { - if (hasKillMode) - killModeCD.timeLeft = KillMode.cooldownMax; - Owner.Calamity().killModeCooldown = KillMode.cooldownMax; + if (isOwner) + { + if (hasKillMode) + killModeCD.timeLeft = KillMode.cooldownMax; + Owner.Calamity().killModeCooldown = KillMode.cooldownMax; + Owner.Calamity().demonSwordKillMode = false; + } DrawUnconditionally = false; Projectile.Kill(); - Owner.Calamity().demonSwordKillMode = false; return; } - if (killModeCD.timeLeft < KillMode.cooldownMax) + if (isOwner && killModeCD.timeLeft < KillMode.cooldownMax) { killModeCD.timeLeft = KillMode.cooldownMax; Owner.Calamity().killModeCooldown = KillMode.cooldownMax; @@ -159,7 +211,7 @@ namespace CalamityMod.Projectiles.Melee mousePos = Owner.Center - aimVel; else { - mousePos = Owner.Calamity().mouseWorld; + mousePos = isOwner ? Owner.Calamity().mouseWorld : (Owner.Center - aimVel); } if (CanHit && !swooshFade) @@ -177,8 +229,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.numHits = 0; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - mousePos = Owner.Calamity().mouseWorld; - aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + if (isOwner) + { + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + } + else + { + mousePos = Owner.Center - aimVel; + } CanHit = false; if (mousePos.X < Owner.Center.X) Owner.direction = -1; else Owner.direction = 1; @@ -187,8 +246,10 @@ namespace CalamityMod.Projectiles.Melee finalFlip = false; playSwingSound = true; hasLaunchedBlades = false; - if (!Owner.Calamity().demonSwordKillMode && postSwingCooldown == 0) + if (isOwner && !Owner.Calamity().demonSwordKillMode && postSwingCooldown == 0) { + if (!willDie) + Projectile.netUpdate = true; willDie = true; if (lastHitTarget != null) { @@ -234,7 +295,8 @@ namespace CalamityMod.Projectiles.Melee if (holding) { // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + if (isOwner) + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; CanHit = false; postSwing = false; RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.7f, useAnim, Animation, true)) * 0.35f)), 0.2f); @@ -256,7 +318,8 @@ namespace CalamityMod.Projectiles.Melee SoundStyle swing2 = new("CalamityMod/Sounds/Item/HeavySwing"); SoundEngine.PlaySound(swing2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(0.2f, 0.3f) }, Projectile.Center); playSwingSound = false; - Owner.Calamity().demonSwordKillMode = false; + if (isOwner) + Owner.Calamity().demonSwordKillMode = false; } if (time > (int)(timeMax * 0.2f) && time < (int)(timeMax * 0.9f)) CanHit = true; @@ -306,7 +369,12 @@ namespace CalamityMod.Projectiles.Melee Projectile.numHits -= 1; if (target != null && target.life > 0 && target.active) + { lastHitTarget = target; + lastHitTargetIndex = target.whoAmI; + if (Main.myPlayer == Projectile.owner) + Projectile.netUpdate = true; + } bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD); @@ -438,5 +506,24 @@ namespace CalamityMod.Projectiles.Melee public override void ResetStyle() { } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(willDie); + writer.Write7BitEncodedInt(useAnim); + writer.Write7BitEncodedInt(lastHitTargetIndex); + writer.Write7BitEncodedInt(postSwingCooldown); + writer.WriteVector2(aimVel); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + willDie = reader.ReadBoolean(); + useAnim = reader.Read7BitEncodedInt(); + lastHitTargetIndex = reader.Read7BitEncodedInt(); + postSwingCooldown = reader.Read7BitEncodedInt(); + aimVel = reader.ReadVector2(); + mousePos = Owner.Center - aimVel; + } } } diff --git a/Projectiles/Melee/DevilsDevastationThrownBlade.cs b/Projectiles/Melee/DevilsDevastationThrownBlade.cs index 7ca3127a95..2daec84626 100644 --- a/Projectiles/Melee/DevilsDevastationThrownBlade.cs +++ b/Projectiles/Melee/DevilsDevastationThrownBlade.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; @@ -44,6 +45,26 @@ namespace CalamityMod.Projectiles.Melee public int bounces = 0; public Vector2 tipPosition = Vector2.Zero; public bool fadingOut => Projectile.timeLeft <= (Lifetime - fadeOutTime); + private bool visualChargeInitialized = false; + private int visualChargeTimer = 0; + private int visualChargeTime = 0; + + private Vector2 GetAimDirection() + { + if (Main.myPlayer == Projectile.owner) + { + Vector2 toMouse = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + float aimAngle = toMouse.ToRotation(); + if (Math.Abs(MathHelper.WrapAngle(aimAngle - Projectile.localAI[1])) > 0.02f) + { + Projectile.localAI[1] = aimAngle; + if (Projectile.timeLeft % 6 == 0) + Projectile.netUpdate = true; + } + return toMouse; + } + return Projectile.localAI[1].ToRotationVector2(); + } public override void SetDefaults() { Projectile.width = 35; @@ -58,6 +79,16 @@ namespace CalamityMod.Projectiles.Melee Projectile.noEnchantmentVisuals = true; } + public override void OnSpawn(Terraria.DataStructures.IEntitySource source) + { + if (Main.myPlayer == Projectile.owner) + { + Vector2 toMouse = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + Projectile.localAI[1] = toMouse.ToRotation(); + Projectile.netUpdate = true; + } + } + public override bool ShouldUpdatePosition() { return (ChargeProgress >= 1 && !stuckInGround && !stuckInTarget); @@ -66,10 +97,25 @@ namespace CalamityMod.Projectiles.Melee //Swing animation keys public CurveSegment pullback = new CurveSegment(EasingType.PolyOut, 0f, 0f, MathHelper.PiOver4 * -1.2f, 2); public CurveSegment throwout = new CurveSegment(EasingType.PolyOut, 0.7f, MathHelper.PiOver4 * -1.2f, MathHelper.PiOver4 * 1.2f + MathHelper.PiOver2, 3); - internal float ArmAnticipationMovement() => PiecewiseAnimation(ChargeProgress, new CurveSegment[] { pullback, throwout }); + internal float ArmAnticipationMovement(float progress) => PiecewiseAnimation(progress, new CurveSegment[] { pullback, throwout }); public override void AI() { + bool isOwner = Main.myPlayer == Projectile.owner; + if (!visualChargeInitialized && !isOwner) + { + int fallbackCharge = (int)MathHelper.Clamp((Owner.HeldItem.useTime / 2.8f), 1, 100); + visualChargeTime = (int)(Projectile.localAI[2] > 0f ? Projectile.localAI[2] : fallbackCharge); + visualChargeTimer = visualChargeTime; + visualChargeInitialized = true; + } + + if (!thrown && ChargeProgress >= 1f) + thrown = true; + + if (thrown && !stuckInGround && !stuckInTarget && !exitedTarget) + Projectile.extraUpdates = 3; + float rate = (Main.GlobalTimeWrappedHourly + time * 3) * 2; List eColors = new List() { @@ -87,10 +133,10 @@ namespace CalamityMod.Projectiles.Melee Vector3 Light = Color.MediumOrchid.ToVector3(); Lighting.AddLight(Projectile.Center, Light * 0.85f); - if (Projectile.timeLeft == Lifetime) + if (Projectile.timeLeft == Lifetime && Main.myPlayer == Projectile.owner) { // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - Vector2 toMouse = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + Vector2 toMouse = GetAimDirection(); Projectile.velocity = toMouse * 14; Projectile.Center = Owner.MountedCenter + toMouse * 30f; Projectile.spriteDirection = Projectile.direction; @@ -129,7 +175,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity *= 0.01f; stabbedTarget.Calamity().demonSwordImpales--; stuckInTarget = false; - fadeOutEffect(); + FadeOutEffect(); } Projectile.Center = stabbedTarget.Center + impalePos; @@ -155,7 +201,7 @@ namespace CalamityMod.Projectiles.Melee } if (fadingOut) - fadeOutEffect(); + FadeOutEffect(); } if (!fadingOut && !stuckInTarget && !stuckInGround && ChargeProgress >= 1) { @@ -196,9 +242,16 @@ namespace CalamityMod.Projectiles.Melee } //Anticipation animation. Make the player look like they're holding the item - if (ChargeProgress < 1) + float chargeProgress = ChargeProgress; + bool canVisualCharge = !isOwner && Projectile.velocity.LengthSquared() < 0.01f && visualChargeTimer > 0; + if (canVisualCharge) { - throwAnimation(); + chargeProgress = 1f - (visualChargeTimer / (float)visualChargeTime); + visualChargeTimer--; + } + if (chargeProgress < 1f) + { + ThrowAnimation(chargeProgress); if (ChargeProgress >= 0.6f && time == 0) { SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordSwing", 2); @@ -210,7 +263,8 @@ namespace CalamityMod.Projectiles.Melee else time++; } - public void fadeOutEffect() + + public void FadeOutEffect() { Projectile.tileCollide = false; if (Projectile.timeLeft > Lifetime - fadeOutTime) @@ -229,11 +283,12 @@ namespace CalamityMod.Projectiles.Melee dust.velocity += Projectile.velocity; } } - public void throwAnimation() + public void ThrowAnimation(float chargeProgress) { - Owner.ChangeDir(MathF.Sign(Main.MouseWorld.X - Owner.Center.X)); + Vector2 aimDirection = GetAimDirection(); + Owner.ChangeDir(MathF.Sign(aimDirection.X)); - float armRotation = ArmAnticipationMovement() * Owner.direction; + float armRotation = ArmAnticipationMovement(chargeProgress) * Owner.direction; Owner.heldProj = Projectile.whoAmI; Projectile.spriteDirection = Owner.direction; @@ -362,25 +417,43 @@ namespace CalamityMod.Projectiles.Melee return false; } - /* public override void SendExtraAI(BinaryWriter writer) { - writer.Write(Projectile.timeLeft); - writer.Write(Projectile.rotation); - writer.Write(Projectile.localAI[2]); - writer.Write(Projectile.localAI[0]); + byte state = 0; + if (thrown) + state |= 1; + if (stuckInTarget) + state |= 2; + if (exitedTarget) + state |= 4; + if (stuckInGround) + state |= 8; - writer.WriteFlags(stuckInTarget, thrown); + writer.Write(state); + writer.Write(Projectile.rotation); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); + writer.Write(Projectile.localAI[2]); + writer.Write(impalePos.X); + writer.Write(impalePos.Y); + writer.Write(stuckTimer); + writer.Write((short)bounces); } public override void ReceiveExtraAI(BinaryReader reader) { - Projectile.timeLeft = reader.Read(); - Projectile.rotation = reader.ReadSingle(); - Projectile.localAI[2] = reader.ReadSingle(); - Projectile.localAI[0] = reader.ReadSingle(); + byte state = reader.ReadByte(); + thrown = (state & 1) != 0; + stuckInTarget = (state & 2) != 0; + exitedTarget = (state & 4) != 0; + stuckInGround = (state & 8) != 0; - reader.ReadFlags(out stuckInTarget, out thrown); + Projectile.rotation = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[2] = reader.ReadSingle(); + impalePos = new Vector2(reader.ReadSingle(), reader.ReadSingle()); + stuckTimer = reader.ReadInt32(); + bounces = reader.ReadInt16(); } - */ } } diff --git a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs index 0b2e97e920..53d71b3602 100644 --- a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs +++ b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Cooldowns; using CalamityMod.Dusts; @@ -46,6 +47,7 @@ namespace CalamityMod.Projectiles.Melee public bool willDie = false; public bool hasLaunchedBlades = false; public bool swooshFade = false; + private int lastSwingId; public int postSwingCooldownMax => (int)(useAnim * 0.65f); public override void SetDefaults() { @@ -62,11 +64,26 @@ namespace CalamityMod.Projectiles.Melee Projectile.knockBack = 0; Projectile.scale = 1.15f; Projectile.ai[1] = -1; + bool isOwner = Main.myPlayer == Projectile.owner; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - mousePos = Owner.Calamity().mouseWorld; - aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + if (isOwner) + { + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + Projectile.netUpdate = true; + } + else + { + Vector2 syncedDelta = Owner.Calamity().mouseWorldDeltaFromPlayer; + if (syncedDelta.LengthSquared() > 0.001f) + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65f; + else + aimVel = Vector2.UnitX * Owner.direction * 65f; + mousePos = Owner.Center - aimVel; + } useAnim = (int)(Owner.HeldItem.useAnimation / Owner.GetTotalAttackSpeed()); postSwingCooldown = postSwingCooldownMax / 2; + lastSwingId = (int)Projectile.ai[0]; if (mousePos.X < Owner.Center.X) Owner.direction = -1; else Owner.direction = 1; @@ -79,29 +96,56 @@ namespace CalamityMod.Projectiles.Melee } public override void UseStyle() { + bool isOwner = Main.myPlayer == Projectile.owner; bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD); - if ((Main.mouseLeft || (hasKillMode && killModeCD.timeLeft == KillMode.cooldownMax + 1)) && holding && postSwingCooldown == 0) + if (!isOwner) + { + Vector2 syncedDelta = Owner.Calamity().mouseWorldDeltaFromPlayer; + if (syncedDelta.LengthSquared() > 0.001f) + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65f; + } + + if (isOwner) + { + bool shouldStartSwing = (Main.mouseLeft || (hasKillMode && killModeCD.timeLeft == KillMode.cooldownMax + 1)) && holding && postSwingCooldown == 0; + if (shouldStartSwing) + { + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + Projectile.ai[0] += 1f; + Projectile.netUpdate = true; + } + } + + int swingId = (int)Projectile.ai[0]; + if (swingId != lastSwingId && holding && postSwingCooldown == 0) { Animation = (int)(useAnim * 0.7f); holding = false; - killModeCD.timeLeft = KillMode.cooldownMax; - Owner.Calamity().killModeCooldown = KillMode.cooldownMax - 1; + if (isOwner) + { + killModeCD.timeLeft = KillMode.cooldownMax; + Owner.Calamity().killModeCooldown = KillMode.cooldownMax - 1; + } swingCount++; + lastSwingId = swingId; } if (postSwingCooldown > 0) postSwingCooldown--; else if (willDie) { - if (hasKillMode) - killModeCD.timeLeft = KillMode.cooldownMax; - Owner.Calamity().killModeCooldown = KillMode.cooldownMax; + if (isOwner) + { + if (hasKillMode) + killModeCD.timeLeft = KillMode.cooldownMax; + Owner.Calamity().killModeCooldown = KillMode.cooldownMax; + Owner.Calamity().demonSwordKillMode = false; + } DrawUnconditionally = false; Projectile.Kill(); - Owner.Calamity().demonSwordKillMode = false; return; } - if (killModeCD.timeLeft < KillMode.cooldownMax) + if (isOwner && killModeCD.timeLeft < KillMode.cooldownMax) { killModeCD.timeLeft = KillMode.cooldownMax; Owner.Calamity().killModeCooldown = KillMode.cooldownMax; @@ -116,7 +160,7 @@ namespace CalamityMod.Projectiles.Melee mousePos = Owner.Center - aimVel; else { - mousePos = Owner.Calamity().mouseWorld; + mousePos = isOwner ? Owner.Calamity().mouseWorld : (Owner.Center - aimVel); } if (CanHit && !swooshFade) @@ -134,8 +178,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.numHits = 0; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - mousePos = Owner.Calamity().mouseWorld; - aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + if (isOwner) + { + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + } + else + { + mousePos = Owner.Center - aimVel; + } CanHit = false; if (mousePos.X < Owner.Center.X) Owner.direction = -1; else Owner.direction = 1; @@ -144,8 +195,10 @@ namespace CalamityMod.Projectiles.Melee finalFlip = false; playSwingSound = true; hasLaunchedBlades = false; - if (!Owner.Calamity().demonSwordKillMode && postSwingCooldown == 0) + if (isOwner && !Owner.Calamity().demonSwordKillMode && postSwingCooldown == 0) { + if (!willDie) + Projectile.netUpdate = true; willDie = true; } @@ -169,7 +222,8 @@ namespace CalamityMod.Projectiles.Melee if (holding) { // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + if (isOwner) + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; CanHit = false; postSwing = false; RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.7f, useAnim, Animation, true)) * 0.35f)), 0.2f); @@ -191,7 +245,8 @@ namespace CalamityMod.Projectiles.Melee SoundStyle swing2 = new("CalamityMod/Sounds/Item/HeavySwing"); SoundEngine.PlaySound(swing2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(0.4f, 0.5f) }, Projectile.Center); playSwingSound = false; - Owner.Calamity().demonSwordKillMode = false; + if (isOwner) + Owner.Calamity().demonSwordKillMode = false; } if (time > (int)(timeMax * 0.2f) && time < (int)(timeMax * 0.9f)) CanHit = true; @@ -335,5 +390,20 @@ namespace CalamityMod.Projectiles.Melee public override void ResetStyle() { } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(willDie); + writer.Write7BitEncodedInt(postSwingCooldown); + writer.WriteVector2(aimVel); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + willDie = reader.ReadBoolean(); + postSwingCooldown = reader.Read7BitEncodedInt(); + aimVel = reader.ReadVector2(); + mousePos = Owner.Center - aimVel; + } } } diff --git a/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs b/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs index 1834b8fb3d..3f80950563 100644 --- a/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs +++ b/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Packets.Entities; @@ -40,6 +41,26 @@ namespace CalamityMod.Projectiles.Melee public int bounces = 0; public Vector2 tipPosition = Vector2.Zero; public bool fadingOut => Projectile.timeLeft <= (Lifetime - fadeOutTime); + private bool visualChargeInitialized = false; + private int visualChargeTimer = 0; + private int visualChargeTime = 0; + + private Vector2 GetAimDirection() + { + if (Main.myPlayer == Projectile.owner) + { + Vector2 toMouse = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + float aimAngle = toMouse.ToRotation(); + if (Math.Abs(MathHelper.WrapAngle(aimAngle - Projectile.localAI[1])) > 0.02f) + { + Projectile.localAI[1] = aimAngle; + if (Projectile.timeLeft % 6 == 0) + Projectile.netUpdate = true; + } + return toMouse; + } + return Projectile.localAI[1].ToRotationVector2(); + } public override void SetDefaults() { Projectile.width = 12; @@ -54,6 +75,16 @@ namespace CalamityMod.Projectiles.Melee Projectile.noEnchantmentVisuals = true; } + public override void OnSpawn(Terraria.DataStructures.IEntitySource source) + { + if (Main.myPlayer == Projectile.owner) + { + Vector2 toMouse = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + Projectile.localAI[1] = toMouse.ToRotation(); + Projectile.netUpdate = true; + } + } + public override bool ShouldUpdatePosition() { return (ChargeProgress >= 1 && !stuckInGround && !stuckInTarget); @@ -62,20 +93,35 @@ namespace CalamityMod.Projectiles.Melee //Swing animation keys public CurveSegment pullback = new CurveSegment(EasingType.PolyOut, 0f, 0f, MathHelper.PiOver4 * -1.2f, 2); public CurveSegment throwout = new CurveSegment(EasingType.PolyOut, 0.7f, MathHelper.PiOver4 * -1.2f, MathHelper.PiOver4 * 1.2f + MathHelper.PiOver2, 3); - internal float ArmAnticipationMovement() => PiecewiseAnimation(ChargeProgress, new CurveSegment[] { pullback, throwout }); + internal float ArmAnticipationMovement(float progress) => PiecewiseAnimation(progress, new CurveSegment[] { pullback, throwout }); public override void AI() { + bool isOwner = Main.myPlayer == Projectile.owner; + if (!visualChargeInitialized && !isOwner) + { + int fallbackCharge = (int)MathHelper.Clamp((Owner.HeldItem.useTime / 2.8f), 1, 100); + visualChargeTime = (int)(Projectile.localAI[2] > 0f ? Projectile.localAI[2] : fallbackCharge); + visualChargeTimer = visualChargeTime; + visualChargeInitialized = true; + } + + if (!thrown && ChargeProgress >= 1f) + thrown = true; + + if (thrown && !stuckInGround && !stuckInTarget) + Projectile.extraUpdates = 1; + float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); Projectile.spriteDirection = Projectile.direction; Vector3 Light = Color.MediumOrchid.ToVector3(); Lighting.AddLight(Projectile.Center, Light * 0.5f); - if (Projectile.timeLeft == Lifetime) + if (Projectile.timeLeft == Lifetime && Main.myPlayer == Projectile.owner) { // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - Vector2 toMouse = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + Vector2 toMouse = GetAimDirection(); Projectile.velocity = toMouse * 14; Projectile.Center = Owner.MountedCenter + toMouse * 12f; Projectile.spriteDirection = Projectile.direction; @@ -115,7 +161,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity *= 0.01f; stabbedTarget.Calamity().demonSwordImpales--; stuckInTarget = false; - fadeOutEffect(); + FadeOutEffect(); } Projectile.Center = stabbedTarget.Center + impalePos; @@ -141,7 +187,7 @@ namespace CalamityMod.Projectiles.Melee } if (fadingOut) - fadeOutEffect(); + FadeOutEffect(); } if (!fadingOut && !stuckInTarget && !stuckInGround && ChargeProgress >= 1) { @@ -174,9 +220,16 @@ namespace CalamityMod.Projectiles.Melee } //Anticipation animation. Make the player look like they're holding the item - if (ChargeProgress < 1) + float chargeProgress = ChargeProgress; + bool canVisualCharge = !isOwner && Projectile.velocity.LengthSquared() < 0.01f && visualChargeTimer > 0; + if (canVisualCharge) { - throwAnimation(); + chargeProgress = 1f - (visualChargeTimer / (float)visualChargeTime); + visualChargeTimer--; + } + if (chargeProgress < 1f) + { + throwAnimation(chargeProgress); if (ChargeProgress >= 0.6f && time == 0) { SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordSwing", 2); @@ -188,7 +241,8 @@ namespace CalamityMod.Projectiles.Melee else time++; } - public void fadeOutEffect() + + public void FadeOutEffect() { Projectile.tileCollide = false; if (Projectile.timeLeft > Lifetime - fadeOutTime) @@ -207,11 +261,12 @@ namespace CalamityMod.Projectiles.Melee dust.velocity += Projectile.velocity; } } - public void throwAnimation() + public void throwAnimation(float chargeProgress) { - Owner.ChangeDir(MathF.Sign(Main.MouseWorld.X - Owner.Center.X)); + Vector2 aimDirection = GetAimDirection(); + Owner.ChangeDir(MathF.Sign(aimDirection.X)); - float armRotation = ArmAnticipationMovement() * Owner.direction; + float armRotation = ArmAnticipationMovement(chargeProgress) * Owner.direction; Owner.heldProj = Projectile.whoAmI; Projectile.spriteDirection = Owner.direction; @@ -296,7 +351,7 @@ namespace CalamityMod.Projectiles.Melee { if (bounces >= 2) { - impaleGround(oldVelocity); + ImpaleGround(oldVelocity); } else { @@ -318,12 +373,12 @@ namespace CalamityMod.Projectiles.Melee } else { - impaleGround(oldVelocity); + ImpaleGround(oldVelocity); } Projectile.netUpdate = true; return false; } - public void impaleGround(Vector2 oldVelocity) + public void ImpaleGround(Vector2 oldVelocity) { Projectile.velocity = oldVelocity; stuckInGround = true; @@ -331,6 +386,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; SoundStyle stuck = new("CalamityMod/Sounds/Item/DemonSwordImpact", 2); SoundEngine.PlaySound(stuck with { Volume = 0.75f, Pitch = Main.rand.NextFloat(0.2f, 0.3f), MaxInstances = 3 }, Projectile.Center); + Projectile.netUpdate = true; } public override bool? CanDamage() { @@ -357,25 +413,43 @@ namespace CalamityMod.Projectiles.Melee return false; } - /* public override void SendExtraAI(BinaryWriter writer) { - writer.Write(Projectile.timeLeft); - writer.Write(Projectile.rotation); - writer.Write(Projectile.localAI[2]); - writer.Write(Projectile.localAI[0]); + byte state = 0; + if (thrown) + state |= 1; + if (stuckInTarget) + state |= 2; + if (exitedTarget) + state |= 4; + if (stuckInGround) + state |= 8; - writer.WriteFlags(stuckInTarget, thrown); + writer.Write(state); + writer.Write(Projectile.rotation); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); + writer.Write(Projectile.localAI[2]); + writer.Write(impalePos.X); + writer.Write(impalePos.Y); + writer.Write(stuckTimer); + writer.Write((short)bounces); } public override void ReceiveExtraAI(BinaryReader reader) { - Projectile.timeLeft = reader.Read(); - Projectile.rotation = reader.ReadSingle(); - Projectile.localAI[2] = reader.ReadSingle(); - Projectile.localAI[0] = reader.ReadSingle(); + byte state = reader.ReadByte(); + thrown = (state & 1) != 0; + stuckInTarget = (state & 2) != 0; + exitedTarget = (state & 4) != 0; + stuckInGround = (state & 8) != 0; - reader.ReadFlags(out stuckInTarget, out thrown); + Projectile.rotation = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[2] = reader.ReadSingle(); + impalePos = new Vector2(reader.ReadSingle(), reader.ReadSingle()); + stuckTimer = reader.ReadInt32(); + bounces = reader.ReadInt16(); } - */ } } diff --git a/Projectiles/Melee/LightspeedDashHitbox.cs b/Projectiles/Melee/LightspeedDashHitbox.cs index 1f6dfd62a0..ed670bbccd 100644 --- a/Projectiles/Melee/LightspeedDashHitbox.cs +++ b/Projectiles/Melee/LightspeedDashHitbox.cs @@ -43,8 +43,8 @@ namespace CalamityMod.Projectiles.Melee var player = Main.player[Projectile.owner]; var modPlayer = player.Calamity(); - // Refund 20 energy if dash hits. Can get energy from multiple enemies. - modPlayer.elementalMastery += 20; + // Refund 30 energy if dash hits. Can get energy from multiple enemies. + modPlayer.elementalMastery += 30; modPlayer.elementalMastery = Math.Min(modPlayer.elementalMastery, Lightspeed.MaxEnergy); // On-hit cut FX diff --git a/Projectiles/Melee/PrismaticBreakerHoldout.cs b/Projectiles/Melee/PrismaticBreakerHoldout.cs index fb6c9c15e7..f9b63480d5 100644 --- a/Projectiles/Melee/PrismaticBreakerHoldout.cs +++ b/Projectiles/Melee/PrismaticBreakerHoldout.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee { Texture2D texture = TextureAssets.Projectile[Type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - float drawRotation = Projectile.rotation + (MathHelper.PiOver4 * Projectile.spriteDirection) + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + float drawRotation = Projectile.rotation + (MathHelper.PiOver4 * Projectile.spriteDirection) + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) - (Owner.gravDir == -1 ? MathHelper.PiOver2 * Owner.direction : 0f); Vector2 rotationPoint = texture.Size() * 0.5f; SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Melee/SaharaSlicersBolt.cs b/Projectiles/Melee/SaharaSlicersBolt.cs index 073c587c70..2fefaf7b63 100644 --- a/Projectiles/Melee/SaharaSlicersBolt.cs +++ b/Projectiles/Melee/SaharaSlicersBolt.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Melee // Setting the bolt's position on the player's back Projectile.rotation = (21.8f - (Projectile.ai[1] * 0.1f)) * -Owner.direction; - Vector2 BoltPos = Owner.MountedCenter + new Vector2((10 + Projectile.ai[1] * 2.5f) * -Owner.direction, 3f - Projectile.ai[1]); + Vector2 BoltPos = Owner.MountedCenter + new Vector2((10 + Projectile.ai[1] * 2.5f) * -Owner.direction, 3f - Projectile.ai[1] + Owner.gfxOffY); Projectile.Center = BoltPos; } diff --git a/Projectiles/Melee/Shortswords/GalileoGladiusThrown.cs b/Projectiles/Melee/Shortswords/GalileoGladiusThrown.cs index 5e612c0346..90b3e5f30a 100644 --- a/Projectiles/Melee/Shortswords/GalileoGladiusThrown.cs +++ b/Projectiles/Melee/Shortswords/GalileoGladiusThrown.cs @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords { for (var i = 0; i < 10; i++) GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center, (Projectile.rotation-MathHelper.PiOver4).ToRotationVector2().RotatedByRandom(0.4f) * -Main.rand.Next(10,20), false, 30, 2, new Color(69, 69, 200))); - Projectile.damage *= 20; + Projectile.damage = (int)(Projectile.damage*17.5f); Projectile.Damage(); Owner.Calamity().StratusStarburst -= 10; for (int i = 0; i < 3; i++) @@ -184,7 +184,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords Projectile.damage = Projectile.originalDamage; if (Owner.Calamity().AvaliableStarburst >= 20) { - Projectile.damage *= 30; + Projectile.damage *= 35; Owner.SetImmuneTimeForAllTypes(Owner.longInvince ? 40 : 20); Owner.Calamity().StratusStarburst -= 20; SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact, Owner.Center); diff --git a/Projectiles/Melee/SkytideDragoonHoldout.cs b/Projectiles/Melee/SkytideDragoonHoldout.cs index d1439e3957..946245b17b 100644 --- a/Projectiles/Melee/SkytideDragoonHoldout.cs +++ b/Projectiles/Melee/SkytideDragoonHoldout.cs @@ -221,7 +221,7 @@ namespace CalamityMod.Projectiles.Melee Owner.SetScreenshake(3f); SoundStyle sound = new("CalamityMod/Sounds/Item/SkytideBolt"); SoundEngine.PlaySound(sound with { Volume = 0.8f }, Projectile.Center); - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(0, -600), new Vector2(0, 10), ModContent.ProjectileType(), (int)(Projectile.damage * 9), Projectile.knockBack, Projectile.owner, 0, 0.5f); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(0, -600), new Vector2(0, 10), ModContent.ProjectileType(), (int)(Projectile.damage * 10), Projectile.knockBack, Projectile.owner, 0, 0.5f); proj.timeLeft = 45; swingCount = 0; attackPower = 6; @@ -233,7 +233,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = -0.2f }, Projectile.Center); SoundStyle fire2 = new("CalamityMod/Sounds/Item/AuricBulletHit"); SoundEngine.PlaySound(fire2 with { Volume = 0.5f, Pitch = 0.2f }, Projectile.Center); - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2, aimVel.SafeNormalize(Vector2.UnitX) * -10, ModContent.ProjectileType(), (int)(Projectile.damage * 9), Projectile.knockBack, Projectile.owner, 0, 1f); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2, aimVel.SafeNormalize(Vector2.UnitX) * -10, ModContent.ProjectileType(), (int)(Projectile.damage * 10), Projectile.knockBack, Projectile.owner, 0, 1f); swingCount = -1; attackPower = 0; } diff --git a/Projectiles/Ranged/BlissfulBombardierHoldout.cs b/Projectiles/Ranged/BlissfulBombardierHoldout.cs index 8bd3e4faf7..be1fd02fbb 100644 --- a/Projectiles/Ranged/BlissfulBombardierHoldout.cs +++ b/Projectiles/Ranged/BlissfulBombardierHoldout.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Dusts; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; @@ -155,7 +156,7 @@ namespace CalamityMod.Projectiles.Ranged // Spawns the projectile. if (Main.myPlayer == Projectile.owner) { - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootDirection * projSpeed * velocityMultiplier, ProjectileType(), damage, knockback, Projectile.owner, rocketType); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootDirection * projSpeed * velocityMultiplier, ProjectileType(), damage, knockback, Projectile.owner, rocketType); PostFireCooldown = Owner.itemAnimationMax; Owner.SetScreenshake(5f); } @@ -217,7 +218,7 @@ namespace CalamityMod.Projectiles.Ranged Texture2D texture2 = ModContent.Request("CalamityMod/Items/Weapons/Ranged/BlissfulBombardierGlow").Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Color drawColor = Projectile.GetAlpha(lightColor); - float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) - (Owner.gravDir == -1 ? MathHelper.Pi * Owner.direction : 0f); Vector2 rotationPoint = texture.Size() * 0.5f; SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Ranged/CondemnationHoldout.cs b/Projectiles/Ranged/CondemnationHoldout.cs index 1ac8222238..dbe8cfe5ff 100644 --- a/Projectiles/Ranged/CondemnationHoldout.cs +++ b/Projectiles/Ranged/CondemnationHoldout.cs @@ -170,13 +170,13 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { Texture2D texture = TextureAssets.Projectile[Type].Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, -3); + Vector2 drawPosition = Projectile.Center - Main.screenPosition; float randSize = Main.rand.NextFloat(0.9f, 1f); Color drawColor = Projectile.GetAlpha(lightColor); - float drawRotation = Projectile.rotation + (Projectile.direction == -1 ? MathHelper.Pi : 0f); + float drawRotation = Projectile.rotation + (Projectile.direction == -1 ? MathHelper.Pi : 0f) - (Owner.gravDir == -1 ? MathHelper.Pi * Owner.direction : 0f); Vector2 rotationPoint = texture.Size() * 0.5f; - SpriteEffects flipSprite = Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; if (homing) { diff --git a/Projectiles/Ranged/CosmicFire.cs b/Projectiles/Ranged/CosmicFire.cs index 6a11f73d6f..1b8c93bc9f 100644 --- a/Projectiles/Ranged/CosmicFire.cs +++ b/Projectiles/Ranged/CosmicFire.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Dusts; +using CalamityMod.Enums; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -60,6 +61,7 @@ namespace CalamityMod.Projectiles.Ranged GeneralParticleHandler.SpawnParticle(spark); Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark", false, 17, 0.027f, Color.LightGreen, new Vector2(0.6f, 1.3f), true, false); GeneralParticleHandler.SpawnParticle(spark2); + spark2.DrawLayer = GeneralDrawLayer.AfterEverything; } if (Time == 9f) diff --git a/Projectiles/Ranged/DeadSunExplosion.cs b/Projectiles/Ranged/DeadSunExplosion.cs index 040893cf7e..18d952eb85 100644 --- a/Projectiles/Ranged/DeadSunExplosion.cs +++ b/Projectiles/Ranged/DeadSunExplosion.cs @@ -1,5 +1,7 @@ using CalamityMod.Dusts; +using CalamityMod.Enums; using CalamityMod.Particles; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -32,6 +34,7 @@ namespace CalamityMod.Projectiles.Ranged { Particle explosion = new DetailedExplosion(Projectile.Center, Vector2.Zero, color1, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ExplosionRadius * 0.0065f + 0.1f, Main.rand.Next(15, 22)); GeneralParticleHandler.SpawnParticle(explosion); + explosion.DrawLayer = GeneralDrawLayer.AfterEverything; Particle explosion2 = new DetailedExplosion(Projectile.Center, Vector2.Zero, Color.Black, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ExplosionRadius * 0.0045f + 0.1f, Main.rand.Next(15, 22), false); GeneralParticleHandler.SpawnParticle(explosion2); Particle explosion3 = new DetailedExplosion(Projectile.Center, Vector2.Zero, Color.Black, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ExplosionRadius * 0.0030f + 0.1f, Main.rand.Next(15, 22), false); @@ -41,6 +44,7 @@ namespace CalamityMod.Projectiles.Ranged { Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, color1, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0, ExplosionRadius * 0.005f + 0.05f, 25); GeneralParticleHandler.SpawnParticle(blastRing); + blastRing.DrawLayer = GeneralDrawLayer.AfterEverything; } float numberOfDusts = ExplosionRadius * 0.1f + 10; diff --git a/Projectiles/Ranged/FetidEmesisHoldout.cs b/Projectiles/Ranged/FetidEmesisHoldout.cs index 2a7c4b353e..c712407bed 100644 --- a/Projectiles/Ranged/FetidEmesisHoldout.cs +++ b/Projectiles/Ranged/FetidEmesisHoldout.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Ranged public int maxFrames = 420; public int initialFireTime = 45; public float shineScale = 0; + private bool secondShot = true; public override void KillHoldoutLogic() { @@ -46,7 +47,7 @@ namespace CalamityMod.Projectiles.Ranged } revSpeed = Utils.Remap(revFrames, 0, maxFrames - 120, 1, 20, true); - if (shootingTimer >= initialFireTime && revFrames < maxFrames) + if (shootingTimer >= initialFireTime && revFrames < maxFrames && secondShot && Owner.whoAmI == Main.myPlayer) { Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _); @@ -55,7 +56,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19; - if (Main.myPlayer == Projectile.owner) + if (Owner.whoAmI == Main.myPlayer) { float spread = 0.045f * Utils.GetLerpValue(0, maxFrames, revFrames, true); Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, (shootVelocity).RotatedByRandom(spread), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner); @@ -69,14 +70,27 @@ namespace CalamityMod.Projectiles.Ranged OffsetLengthFromArm -= 5f; shineScale = 1; + secondShot = false; + } + if (shootingTimer >= 60 && revFrames < maxFrames) + { + Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _); + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19; + if (Owner.whoAmI == Main.myPlayer) + { + float spread = 0.045f * Utils.GetLerpValue(0, maxFrames, revFrames, true); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, (shootVelocity).RotatedByRandom(spread).RotatedByRandom(0.04f), bulletAMMO, Projectile.damage / 2, Projectile.knockBack, Projectile.owner); + Projectile.netUpdate = true; + } shootingTimer = 0; + secondShot = true; } shootingTimer += revSpeed; revFrames++; shineScale *= 0.77f; - if (revFrames >= maxFrames && !isTired || (Owner.Calamity().mouseRight && revFrames > 2 )) + if ((revFrames >= maxFrames && !isTired || (Owner.Calamity().mouseRight && revFrames > 2 )) && Owner.whoAmI == Main.myPlayer) { Owner.SetScreenshake(6.5f); OffsetLengthFromArm -= 35f; diff --git a/Projectiles/Ranged/HellbornHoldout.cs b/Projectiles/Ranged/HellbornHoldout.cs index 781335298d..e4380d6c83 100644 --- a/Projectiles/Ranged/HellbornHoldout.cs +++ b/Projectiles/Ranged/HellbornHoldout.cs @@ -231,7 +231,7 @@ namespace CalamityMod.Projectiles.Ranged Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/Hellborn").Value; Texture2D spinTexture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/Hellborn").Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) - (Owner.gravDir == -1 ? MathHelper.Pi * Owner.direction : 0f); Vector2 rotationPoint = texture.Size() * 0.5f; SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Ranged/M1GarandHoldout.cs b/Projectiles/Ranged/M1GarandHoldout.cs index 7a606842e0..e57d2c3d64 100644 --- a/Projectiles/Ranged/M1GarandHoldout.cs +++ b/Projectiles/Ranged/M1GarandHoldout.cs @@ -319,7 +319,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 origin = pingTexture.Size() * 0.5f; Vector2 pingDrawPosition; - Vector2 finalPosition = Owner.Center + new Vector2(40f * -Owner.direction, -40f); + Vector2 finalPosition = Owner.Center + new Vector2(40f * -Owner.direction, -40f * Owner.gravDir); float progress = (float)pingAnimationTimer / PingAnimationDuration; if (pingAnimationTimer < 15) @@ -374,7 +374,7 @@ namespace CalamityMod.Projectiles.Ranged // Calculate scale to display with all factors combined Vector2 finalPingScale = new Vector2(basePingDrawScale * stretchScaleX, basePingDrawScale * stretchScaleY); - Main.EntitySpriteDraw(pingTexture, pingDrawPosition, null, drawColor, Owner.direction == 1 ? -0.25f : 0.25f, origin, finalPingScale, SpriteEffects.None, 0f); + Main.EntitySpriteDraw(pingTexture, pingDrawPosition, null, drawColor, (Owner.direction == 1 ? -0.25f : 0.25f) + (Owner.gravDir == -1 ? MathHelper.Pi * Owner.direction : 0f), origin, finalPingScale, (Owner.gravDir == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None), 0f); } else { diff --git a/Projectiles/Ranged/NukeOfBliss.cs b/Projectiles/Ranged/NukeOfBliss.cs index 169a5e007f..5543e63a47 100644 --- a/Projectiles/Ranged/NukeOfBliss.cs +++ b/Projectiles/Ranged/NukeOfBliss.cs @@ -1,10 +1,13 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Particles; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using static CalamityMod.Projectiles.Ranged.BlissfulBombardierHoldout; @@ -133,6 +136,7 @@ namespace CalamityMod.Projectiles.Ranged { target.AddBuff(ModContent.BuffType(), 300); } + public override void OnKill(int timeLeft) { // Only do rocket effects for the owner client side diff --git a/Projectiles/Ranged/OpalStrikerHoldout.cs b/Projectiles/Ranged/OpalStrikerHoldout.cs index 54d701d687..029ceaba27 100644 --- a/Projectiles/Ranged/OpalStrikerHoldout.cs +++ b/Projectiles/Ranged/OpalStrikerHoldout.cs @@ -159,7 +159,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 10; i++) { Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * (3f + sine * 0.3f); - Main.EntitySpriteDraw(texture, drawPosition + drawOffset * chargeScale, null, Color.OrangeRed with { A = 0 } * Math.Min(chargeScale, 1) * 0.4f, drawRotation, rotationPoint, Projectile.scale, flipSprite, 0); + Main.EntitySpriteDraw(texture, drawPosition + drawOffset * chargeScale, null, Color.OrangeRed with { A = 0 } * Math.Min(chargeScale, 1) * 0.4f, drawRotation + (Owner.gravDir == -1 ? MathHelper.Pi : 0), rotationPoint, Projectile.scale, flipSprite, 0); } Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); @@ -168,8 +168,23 @@ namespace CalamityMod.Projectiles.Ranged Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + // Handle glow copies + SpriteEffects flipSpriteGlow = SpriteEffects.None; + if (Owner.gravDir == -1f) + { + if (Projectile.spriteDirection == -1) + flipSpriteGlow = SpriteEffects.FlipVertically; + } + else + { + rotationPoint.Y = texture.Height - rotationPoint.Y; + + if (Projectile.spriteDirection == 1) + flipSpriteGlow = SpriteEffects.FlipVertically; + } + for (int i = 0; i < 3; i++) - Main.EntitySpriteDraw(tex2.Value, GunTipPosition - Main.screenPosition, null, Color.Lerp(FullyCharged ? Color.OrangeRed : Color.Orange, Color.White, i * 0.25f) with { A = 0 } * 0.8f, Main.rand.NextFloat(-5, 5), tex2.Size() * 0.5f, new Vector2(1.35f, 1f) * Projectile.scale * chargeScale * (1 - 0.27f * i) * 0.3f * ((chargeScale >= 1 && CurrentChargingFrames <= OpalStriker.FullChargeFrames + 3) ? 1.75f : FullyCharged ? 1.4f : 1), SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex2.Value, GunTipPosition - Main.screenPosition, null, Color.Lerp(FullyCharged ? Color.OrangeRed : Color.Orange, Color.White, i * 0.25f) with { A = 0 } * 0.8f, Main.rand.NextFloat(-5, 5), tex2.Size() * 0.5f, new Vector2(1.35f, 1f) * Projectile.scale * chargeScale * (1 - 0.27f * i) * 0.3f * ((chargeScale >= 1 && CurrentChargingFrames <= OpalStriker.FullChargeFrames + 3) ? 1.75f : FullyCharged ? 1.4f : 1), flipSpriteGlow, 0); return false; } diff --git a/Projectiles/Ranged/SlagfireDouserHoldout.cs b/Projectiles/Ranged/SlagfireDouserHoldout.cs index 267b3b2fdf..7a5cba40cf 100644 --- a/Projectiles/Ranged/SlagfireDouserHoldout.cs +++ b/Projectiles/Ranged/SlagfireDouserHoldout.cs @@ -136,7 +136,6 @@ namespace CalamityMod.Projectiles.Ranged Vector2 pistilJiggleScale = new Vector2(1 - 0.25f * pistilPow, 1 + 0.5f * pistilPow); drawPosition.X += 25 * Owner.direction; - drawPosition.Y += -5f; Color drawColor = Projectile.GetAlpha(lightColor); float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); diff --git a/Projectiles/Ranged/SpectralstormCannonHoldout.cs b/Projectiles/Ranged/SpectralstormCannonHoldout.cs index 0c6b0ed23f..4e283e63df 100644 --- a/Projectiles/Ranged/SpectralstormCannonHoldout.cs +++ b/Projectiles/Ranged/SpectralstormCannonHoldout.cs @@ -183,21 +183,26 @@ namespace CalamityMod.Projectiles.Ranged { Texture2D texture = TextureAssets.Projectile[Type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) - (Owner.gravDir == -1 ? MathHelper.Pi * Owner.direction : 0f); Vector2 rotationPoint = texture.Size() * 0.5f; SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; Color tintColor = displayOverheat ? Color.Black : BuiltHeat >= WarningTime ? Color.Lerp(Color.LightSalmon, Color.White, MathF.Abs(MathF.Sin(Owner.miscCounter * MathHelper.Pi / 30f))) : Color.LightSalmon; float opacity = Utils.GetLerpValue(0, WarningTime, BuiltHeat, true); - Projectile.DrawBackglow(Color.HotPink * opacity, 4f, null, null, (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipVertically : SpriteEffects.None); + for (int i = 0; i < 16; i++) + { + Color auraColor = Color.HotPink * opacity * 0.6f; + Vector2 drawOffset = ((MathHelper.TwoPi * i / 16f).ToRotationVector2() * 5); + Main.EntitySpriteDraw(texture, drawPosition + drawOffset, null, auraColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + } CalamityUtils.EnterShaderRegion(Main.spriteBatch); GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity((displayOverheat ? 1f : opacity) * 0.45f); GameShaders.Misc["CalamityMod:BasicTint"].UseColor(tintColor); GameShaders.Misc["CalamityMod:BasicTint"].Apply(); - Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale, flipSprite); CalamityUtils.ExitShaderRegion(Main.spriteBatch); return false; } diff --git a/Projectiles/Ranged/StarfleetHoldout.cs b/Projectiles/Ranged/StarfleetHoldout.cs index c3b09dc367..7d354aefea 100644 --- a/Projectiles/Ranged/StarfleetHoldout.cs +++ b/Projectiles/Ranged/StarfleetHoldout.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; @@ -27,13 +28,14 @@ namespace CalamityMod.Projectiles.Ranged public int time = 0; public int lastUseTime = 0; - public int perfectLeniancy = 2; - public int goodLeniancy => perfectLeniancy + 6; + public static int perfectLeniancy = 2; + public static int goodLeniancy = perfectLeniancy + 6; + public static int starburstPerfectTime = 23; public ref float shootingCooldown => ref Projectile.ai[0]; public ref float starburstTimer => ref Projectile.ai[1]; public int extendedCooldown => (int)(lastUseTime * 1.2f); public int naildriverCooldown => (int)(lastUseTime * 1.5f); - public int starburstPerfectTime = 23; + public float recoilIntensity = 0; public int recoilTimerMax = 62; public Vector2 recoilDirection; @@ -55,6 +57,17 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.tileCollide = false; } + public override void SendExtraAIHoldout(BinaryWriter writer) + { + writer.Write(lastUseTime); + writer.Write(Projectile.spriteDirection); + } + + public override void ReceiveExtraAIHoldout(BinaryReader reader) + { + lastUseTime = reader.ReadInt32(); + Projectile.spriteDirection = reader.ReadInt32(); + } public override void HoldoutAI() { float rate = (time * 0.05f); @@ -84,10 +97,10 @@ namespace CalamityMod.Projectiles.Ranged return; } bool hasAmmo = Owner.PickAmmo(HeldItem, out _, out _, out _, out _, out _, true); - bool leftShootChecks = (Main.mouseLeft && !Main.mapFullscreen && !Owner.mouseInterface && shootingCooldown == 0) && hasAmmo; - bool rightShootChecks = Owner.Calamity().mouseRight && !Main.mapFullscreen && !Owner.mouseInterface && starburstCooldown == 0 && starburstTimer == 0; + bool leftShootChecks = Owner.whoAmI == Main.myPlayer && (Main.mouseLeft && !Main.mapFullscreen && !Owner.mouseInterface && shootingCooldown == 0) && hasAmmo; + bool rightShootChecks = Owner.whoAmI == Main.myPlayer && (Owner.Calamity().mouseRight && !Main.mapFullscreen && !Owner.mouseInterface && starburstCooldown == 0 && starburstTimer == 0); - if (Main.mouseLeft && !hasAmmo && OffsetLengthFromArm >= 24.5f) + if (Owner.whoAmI == Main.myPlayer && Main.mouseLeft && !hasAmmo && OffsetLengthFromArm >= 24.5f) { OffsetLengthFromArm -= 8; SoundStyle click = new("CalamityMod/Sounds/Item/DudFire"); @@ -97,6 +110,7 @@ namespace CalamityMod.Projectiles.Ranged FireShotgun(); if (rightShootChecks) { + Projectile.ForceNetUpdate(); SoundStyle test = new("CalamityMod/Sounds/Item/StarfleetStarburst"); SoundEngine.PlaySound(test with { Volume = 1f, Pitch = 0f }, Projectile.Center); starburstTimer++; @@ -149,6 +163,7 @@ namespace CalamityMod.Projectiles.Ranged } public void FireShotgun() { + Projectile.ForceNetUpdate(); // 50% chance to not consume ammo Owner.PickAmmo(HeldItem, out _, out _, out _, out _, out _, Main.rand.NextBool()); @@ -171,8 +186,9 @@ namespace CalamityMod.Projectiles.Ranged float randomVel = Main.rand.NextFloat(0.8f, 1f); float damageMult = ((naildriver || scattershot) ? 1.75f : 1f) / baseShotCount; float spread = (naildriver ? 0.06f : scattershot ? 0.9f : 0.25f); - Projectile shotgun = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, randomVel * Projectile.velocity.RotatedByRandom(spread) * 8, ModContent.ProjectileType(), (int)(Projectile.damage * damageMult), Projectile.knockBack, Projectile.owner, 0, 0, Main.rand.Next(0, 300 + 1)); - shotgun.extraUpdates = naildriver ? 9 : scattershot ? 7 : 3; + int starExtraUpdates = naildriver ? 9 : scattershot ? 7 : 3; + Projectile shotgun = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, randomVel * Projectile.velocity.RotatedByRandom(spread) * 8, ModContent.ProjectileType(), (int)(Projectile.damage * damageMult), Projectile.knockBack, Projectile.owner, 0, starExtraUpdates, Main.rand.Next(0, 300 + 1)); + shotgun.extraUpdates = starExtraUpdates; } } diff --git a/Projectiles/Ranged/StarfleetStar.cs b/Projectiles/Ranged/StarfleetStar.cs index 13c18cf074..d8f4488dcf 100644 --- a/Projectiles/Ranged/StarfleetStar.cs +++ b/Projectiles/Ranged/StarfleetStar.cs @@ -37,6 +37,9 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { + if (time == 0 && Projectile.ai[1] > 0) + Projectile.extraUpdates = (int)Projectile.ai[1]; + float rate = (Projectile.ai[2] * 0.05f); List eColors = new List() { diff --git a/Projectiles/Ranged/StarmadaHoldout.cs b/Projectiles/Ranged/StarmadaHoldout.cs index 41fc43d182..5a9631b513 100644 --- a/Projectiles/Ranged/StarmadaHoldout.cs +++ b/Projectiles/Ranged/StarmadaHoldout.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; @@ -28,14 +29,14 @@ namespace CalamityMod.Projectiles.Ranged public int time = 0; public int lastUseTime = 0; - public int perfectLeniancy = 2; + public static int perfectLeniancy = 2; + public static int goodLeniancy = perfectLeniancy + 6; + public static int starburstPerfectTime = 23; public float frontRecoil = 0; - public int goodLeniancy => perfectLeniancy + 6; public ref float shootingCooldown => ref Projectile.ai[0]; public ref float starburstTimer => ref Projectile.ai[1]; public int extendedCooldown => (int)(lastUseTime * 1.2f); public int perfectCooldown => (int)(lastUseTime * 1.5f); - public int starburstPerfectTime = 23; public float recoilIntensity = 0; public int recoilTimerMax = 62; public Vector2 recoilDirection; @@ -57,6 +58,19 @@ namespace CalamityMod.Projectiles.Ranged public bool naildriver => ((starburstTimer <= starburstPerfectTime + perfectLeniancy) && (starburstTimer >= starburstPerfectTime - perfectLeniancy)); // if within perfect frame window public bool scattershot => !naildriver && ((starburstTimer <= starburstPerfectTime + goodLeniancy) && (starburstTimer >= starburstPerfectTime - goodLeniancy)); // If within early or late frame window public override void KillHoldoutLogic() { } + public override void SendExtraAIHoldout(BinaryWriter writer) + { + writer.Write(lastUseTime); + writer.Write(gunPower); + writer.Write(lastGunPower); + } + + public override void ReceiveExtraAIHoldout(BinaryReader reader) + { + lastUseTime = reader.ReadInt32(); + gunPower = reader.ReadInt32(); + lastGunPower = reader.ReadInt32(); + } public override void SetDefaults() { base.SetDefaults(); @@ -97,10 +111,10 @@ namespace CalamityMod.Projectiles.Ranged return; } bool hasAmmo = Owner.PickAmmo(HeldItem, out _, out _, out _, out _, out _, true); - bool leftShootChecks = (Main.mouseLeft && !Main.mapFullscreen && !Owner.mouseInterface && shootingCooldown == 0) && hasAmmo; - bool rightShootChecks = Owner.Calamity().mouseRight && !Main.mapFullscreen && !Owner.mouseInterface && starburstCooldown == 0 && starburstTimer == 0; + bool leftShootChecks = Owner.whoAmI == Main.myPlayer && (Main.mouseLeft && !Main.mapFullscreen && !Owner.mouseInterface && shootingCooldown == 0) && hasAmmo; + bool rightShootChecks = Owner.whoAmI == Main.myPlayer && Owner.Calamity().mouseRight && !Main.mapFullscreen && !Owner.mouseInterface && starburstCooldown == 0 && starburstTimer == 0; - if (Main.mouseLeft && !hasAmmo && shake < 0.1f) + if (Owner.whoAmI == Main.myPlayer && Main.mouseLeft && !hasAmmo && shake < 0.1f) { shake = 0.8f; SoundStyle click = new("CalamityMod/Sounds/Item/DudFire"); @@ -111,6 +125,7 @@ namespace CalamityMod.Projectiles.Ranged FireShotgun(); if (rightShootChecks) { + Projectile.ForceNetUpdate(); SoundStyle blast1 = new("CalamityMod/Sounds/Item/StarfleetStarburst"); AudSlot1 = SoundEngine.PlaySound(blast1 with { Volume = 0.7f + gunPower * 0.1f, Pitch = 0f, MaxInstances = 8 }, Projectile.Center); SoundStyle blast2 = new("CalamityMod/Sounds/Item/StarfleetStarburst"); @@ -192,6 +207,7 @@ namespace CalamityMod.Projectiles.Ranged } public void FireShotgun() { + Projectile.ForceNetUpdate(); // 50% chance to not consume ammo Owner.PickAmmo(HeldItem, out _, out _, out _, out _, out _, Main.rand.NextBool()); @@ -255,8 +271,9 @@ namespace CalamityMod.Projectiles.Ranged float randomVel = Main.rand.NextFloat(0.8f, 1f); float damageMult = ((naildriver || scattershot) ? 1.75f : 1f) / baseShotCount; float spread = (i == 0 ? 0f : naildriver ? 0.06f : scattershot ? 0.9f : 0.25f) * MathHelper.Lerp(gunPower, 1, 0.75f); - Projectile shotgun = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, randomVel * Projectile.velocity.RotatedByRandom(spread) * 8, ProjectileType(), (int)(Projectile.damage * damageMult), Projectile.knockBack, Projectile.owner, 0, 0, Main.rand.Next(0, 300 + 1)); - shotgun.extraUpdates = naildriver ? 9 : scattershot ? 7 : 3; + int starExtraUpdates = naildriver ? 9 : scattershot ? 7 : 3; + Projectile shotgun = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, randomVel * Projectile.velocity.RotatedByRandom(spread) * 8, ProjectileType(), (int)(Projectile.damage * damageMult), Projectile.knockBack, Projectile.owner, 0, starExtraUpdates, Main.rand.Next(0, 300 + 1)); + shotgun.extraUpdates = starExtraUpdates; } } for (int i = 0; i < (int)(25 * gunPowerMult); i++) diff --git a/Projectiles/Ranged/StarmadaStar.cs b/Projectiles/Ranged/StarmadaStar.cs index 6bc3b5b7f9..248532712c 100644 --- a/Projectiles/Ranged/StarmadaStar.cs +++ b/Projectiles/Ranged/StarmadaStar.cs @@ -37,6 +37,10 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { + + if (time == 0 && Projectile.ai[1] > 0) + Projectile.extraUpdates = (int)Projectile.ai[1]; + float rate = (Projectile.ai[2] * 0.05f); List eColors = new List() { diff --git a/Projectiles/Ranged/TauCannonHoldout.cs b/Projectiles/Ranged/TauCannonHoldout.cs index 754264c5ea..08d108fb14 100644 --- a/Projectiles/Ranged/TauCannonHoldout.cs +++ b/Projectiles/Ranged/TauCannonHoldout.cs @@ -344,6 +344,10 @@ namespace CalamityMod.Projectiles.Ranged float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); Vector2 rotationPoint = texture.Size() * 0.5f; SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + if (Owner.gravDir == -1f) + { + flipSprite |= SpriteEffects.FlipVertically; + } if (Projectile.timeLeft > CoolingDownTime || KeepRefreshingLifetime == true) { diff --git a/Projectiles/Rogue/AntumbraShardProjectile.cs b/Projectiles/Rogue/AntumbraShardProjectile.cs index 18899e0bdf..bd944e8832 100644 --- a/Projectiles/Rogue/AntumbraShardProjectile.cs +++ b/Projectiles/Rogue/AntumbraShardProjectile.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Dusts; +using CalamityMod.Enums; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -109,6 +110,7 @@ namespace CalamityMod.Projectiles.Rogue GeneralParticleHandler.SpawnParticle(spark); Particle spark2 = new SparkParticle(Projectile.Center, -Projectile.velocity * randVel, false, lifetime, 0.9f, Color.LightGreen); GeneralParticleHandler.SpawnParticle(spark2); + spark2.DrawLayer = GeneralDrawLayer.AfterEverything; if (Main.rand.NextBool() && !Projectile.Calamity().stealthStrike) { Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB); @@ -126,10 +128,11 @@ namespace CalamityMod.Projectiles.Rogue GeneralParticleHandler.SpawnParticle(spark); Particle spark2 = new SparkParticle(placement, -Projectile.velocity * speed, false, 11, 0.5f, Color.LightGreen); GeneralParticleHandler.SpawnParticle(spark2); + spark2.DrawLayer = GeneralDrawLayer.AfterEverything; } if (closestTarget != null && Projectile.numHits < 1 && closestTarget.CanBeChasedBy(Projectile)) { - CalamityUtils.HomeInOnSelectedNPC(Projectile, chosenTarget, true, 0.95f, 16, 0.96f); + CalamityUtils.HomeInOnSelectedNPC(Projectile, Projectile.Center.ClosestNPCAt(2000), true, 0.95f, 16, 0.96f); } } } @@ -219,6 +222,7 @@ namespace CalamityMod.Projectiles.Rogue Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen * 0.85f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1f, 18); GeneralParticleHandler.SpawnParticle(bolt2); + bolt2.DrawLayer = GeneralDrawLayer.AfterEverything; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f * (storedVelocity.X > 0 ? 1 : -1)); } diff --git a/Projectiles/Rogue/DestructionBolt.cs b/Projectiles/Rogue/DestructionBolt.cs index 061624c956..d7f5e1c37c 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -1,4 +1,6 @@ -using CalamityMod.Particles; +using CalamityMod.Enums; +using CalamityMod.Graphics.Renderers; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -105,6 +107,7 @@ namespace CalamityMod.Projectiles.Rogue { Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen with { A = 0 }, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), Projectile.ai[1] * 0.5f, Projectile.ai[1] * 0.3f, 15, false); GeneralParticleHandler.SpawnParticle(blastRing); + blastRing.DrawLayer = GeneralDrawLayer.AfterEverything; } } else diff --git a/Projectiles/Rogue/DestructionStar.cs b/Projectiles/Rogue/DestructionStar.cs index cca15c79f5..0d25bf3cf0 100644 --- a/Projectiles/Rogue/DestructionStar.cs +++ b/Projectiles/Rogue/DestructionStar.cs @@ -1,4 +1,6 @@ using CalamityMod.Dusts; +using CalamityMod.Enums; +using CalamityMod.Graphics.Renderers; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -151,15 +153,15 @@ namespace CalamityMod.Projectiles.Rogue internal void Explode(bool big) { - - float sizeBonus = big ? Main.zenithWorld ? 6 : 2 : 1; float bigExplosionDamage = 3f; Player Owner = Main.player[Projectile.owner]; Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen with { A = 0 }, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.82f * sizeBonus, 11); GeneralParticleHandler.SpawnParticle(orb); + orb.DrawLayer = GeneralDrawLayer.AfterEverything; Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.74f * sizeBonus, 11); GeneralParticleHandler.SpawnParticle(orb2); + orb2.DrawLayer = GeneralDrawLayer.AfterEverything; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (big ? Main.zenithWorld ? bigExplosionDamage * 4f : bigExplosionDamage : Projectile.Calamity().stealthStrike ? 0.25f : 1f)), Projectile.knockBack * 1.5f, Projectile.owner); @@ -190,12 +192,15 @@ namespace CalamityMod.Projectiles.Rogue Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f * 1.3f * sizeBonus, 18); GeneralParticleHandler.SpawnParticle(bolt2); + bolt2.DrawLayer = GeneralDrawLayer.AfterEverything; Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * sizeBonus, 30); GeneralParticleHandler.SpawnParticle(bolt3); + bolt3.DrawLayer = GeneralDrawLayer.AfterEverything; Particle bolt4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen * 0.55f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * 1.35f * sizeBonus, 30); GeneralParticleHandler.SpawnParticle(bolt4); + bolt4.DrawLayer = GeneralDrawLayer.AfterEverything; for (int i = 0; i < 2; i++) { diff --git a/Projectiles/Rogue/VegaProjectile.cs b/Projectiles/Rogue/VegaProjectile.cs index 7d0b91d0cc..4f8ee1a0a2 100644 --- a/Projectiles/Rogue/VegaProjectile.cs +++ b/Projectiles/Rogue/VegaProjectile.cs @@ -58,6 +58,7 @@ namespace CalamityMod.Projectiles.Rogue item.usesIDStaticNPCImmunity = false; item.usesLocalNPCImmunity = true; item.localNPCHitCooldown = 10; + item.netUpdate = true; } } } @@ -81,7 +82,7 @@ namespace CalamityMod.Projectiles.Rogue { int projID = ModContent.ProjectileType(); Vector2 velocity = Vector2.Zero; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projID, projectileDamage, kb, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projID, (int)(projectileDamage * 0.8f), kb, Projectile.owner); } for (int i = 0; i < onHitCount; i++) { diff --git a/Projectiles/Summon/SarosAura.cs b/Projectiles/Summon/SarosAura.cs index fc6f87a998..2820b3535f 100644 --- a/Projectiles/Summon/SarosAura.cs +++ b/Projectiles/Summon/SarosAura.cs @@ -1,11 +1,13 @@ using System.IO; using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Utilities.Daybreak; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -58,7 +60,6 @@ namespace CalamityMod.Projectiles.Summon } while (minionSlotsAvaliable >= 1 && MinionSlotsToAdd > 0) { - Projectile.minionSlots++; minionSlotsAvaliable--; MinionSlotsToAdd--; @@ -116,6 +117,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 source = Projectile.Center; for (var i = 0; i < 3; i++) { + SoundEngine.PlaySound(SarosPossession.FiringSound, Projectile.Center); var velocity = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * shootSpeed; Projectile beam = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center - velocity, velocity, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner, 120, ai1: (Projectile.minionSlots - 1) / 9f); beam.DamageType = DamageClass.Summon; diff --git a/Projectiles/Summon/SarosEclipseBeam.cs b/Projectiles/Summon/SarosEclipseBeam.cs index f5678e6373..430ead2ec3 100644 --- a/Projectiles/Summon/SarosEclipseBeam.cs +++ b/Projectiles/Summon/SarosEclipseBeam.cs @@ -2,8 +2,10 @@ using System.Collections.Generic; using CalamityMod.Enums; using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -41,19 +43,19 @@ namespace CalamityMod.Projectiles.Summon Vector2 SarosPos => Owner.Center + Vector2.UnitY * (Owner.gfxOffY + Owner.gravDir * -24f); public override void OnSpawn(IEntitySource source) { - SoundEngine.PlaySound(SoundID.DD2_BetsyFlameBreath with { Volume = 0.5f, SoundLimitBehavior = SoundLimitBehavior.IgnoreNew }, Owner.Center); + SoundEngine.PlaySound(SarosPossession.SpawnSound with {pitch = -0.5f, MaxInstances = 5, SoundLimitBehavior = SoundLimitBehavior.IgnoreNew}, Owner.Center); Projectile.rotation = SarosPos.DirectionTo(Owner.Calamity().mouseWorld).ToRotation(); } public override void AI() { if (Owner.miscCounter % 10 == 0) - SoundEngine.PlaySound(SoundID.DD2_BetsyFlameBreath with {Volume = 0.1f }, Owner.Center); + SoundEngine.PlaySound(SoundID.DD2_BetsyFlameBreath with {Volume = 0.2f }, Owner.Center); Projectile.rotation = Projectile.rotation.AngleLerp(SarosPos.DirectionTo(Owner.Calamity().mouseWorld).ToRotation(), 0.1f); Projectile.Center = SarosPos + Projectile.rotation.ToRotationVector2() * Utils.Remap(Projectile.timeLeft,5,10,1600,0); if (Projectile.timeLeft == 5 && Owner.channel) Projectile.timeLeft++; Owner.Calamity().sarosEclipseBeamUsage += 2; - } + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -84,7 +86,7 @@ namespace CalamityMod.Projectiles.Summon public float FireWidthFunction(float completion, Vector2 vertexPos) { - return MathHelper.Min(Utils.Remap(completion, 0, 0.1f, 0, 96), Utils.Remap(completion, 0.9f, 1f, 96, 0)) * Utils.Remap(Projectile.timeLeft, 0, 5, 0, 1) * (0.75f+MathF.Pow(1 -(Owner.Calamity().sarosEclipseBeamUsage / 300f), 3)); + return MathHelper.Min(Utils.Remap(completion, 0, 0.1f, 0, 96), Utils.Remap(completion, 0.9f, 1f, 96, 0)) * Utils.Remap(Projectile.timeLeft, 0, 5, 0, 1) * (0.75f+MathF.Pow(1 -(Owner.Calamity().sarosEclipseBeamUsage / 300f), 3)) * (Projectile.timeLeft > 5 ? 1 - (Projectile.timeLeft - 5) / 5f : 1); } public Color FireColorFunction(float completion, Vector2 vertexPos) @@ -95,7 +97,7 @@ namespace CalamityMod.Projectiles.Summon public float FireCoreWidthFunction(float completion, Vector2 vertexPos) { - return MathHelper.Min(Utils.Remap(completion, 0, 0.1f, 0, 32), Utils.Remap(completion, 0.9f, 1f, 32, 0)) * Utils.Remap(Projectile.timeLeft, 0, 5, 0, 1) * (0.75f+MathF.Pow(1 - (Owner.Calamity().sarosEclipseBeamUsage / 300f), 3)); + return MathHelper.Min(Utils.Remap(completion, 0, 0.1f, 0, 32), Utils.Remap(completion, 0.9f, 1f, 32, 0)) * Utils.Remap(Projectile.timeLeft, 0, 5, 0, 1) * (0.75f+MathF.Pow(1 - (Owner.Calamity().sarosEclipseBeamUsage / 300f), 3)) * (Projectile.timeLeft > 5 ? 1-(Projectile.timeLeft-5)/5f : 1); } public Color FireCoreColorFunction(float completion, Vector2 vertexPos) diff --git a/Projectiles/Summon/SarosSunfire.cs b/Projectiles/Summon/SarosSunfire.cs index 908ee973bb..6391317e0e 100644 --- a/Projectiles/Summon/SarosSunfire.cs +++ b/Projectiles/Summon/SarosSunfire.cs @@ -1,7 +1,9 @@ using System; +using System.Collections.Generic; using System.Linq; using CalamityMod.Enums; using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -29,7 +31,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.width = 24; Projectile.height = 24; Projectile.friendly = true; - Projectile.timeLeft = 180; Projectile.DamageType = DamageClass.Summon; Projectile.MaxUpdates = 3; Projectile.tileCollide = false; @@ -37,11 +38,11 @@ namespace CalamityMod.Projectiles.Summon Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 24; Projectile.stopsDealingDamageAfterPenetrateHits = true; + Projectile.timeLeft = 120 * Projectile.MaxUpdates; } public override void OnSpawn(IEntitySource source) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } NPC target = null; @@ -50,7 +51,9 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.ai[0] > 1) { Projectile.ai[0]--; - Projectile.timeLeft = 120; + Projectile.timeLeft = 120 * Projectile.MaxUpdates; + + } if (target != null && Projectile.localNPCImmunity[target.whoAmI] <= 0 && target.active && !target.dontTakeDamage) @@ -69,7 +72,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.Zero) * 4; Projectile.timeLeft = (int)MathHelper.Min(8, Projectile.timeLeft); } - } + } NPC GetTargetInRange(float range) { var player = Main.player[Projectile.owner]; diff --git a/Projectiles/Summon/SiriusMinion.cs b/Projectiles/Summon/SiriusMinion.cs index b4872ba370..e41364e24c 100644 --- a/Projectiles/Summon/SiriusMinion.cs +++ b/Projectiles/Summon/SiriusMinion.cs @@ -112,7 +112,13 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = Owner.velocity * 0f; var SiriusPos = Projectile.Center + Projectile.velocity; - var SiriusScale = 0.055f + (0.001f * moddedOwner.AvaliableStarburst); + var value = 0f; + //Count the value of starbursts in Sirius firing animation + if (Projectile.ai[2] > 2) foreach (var item in starburstsToFire) + { + value += item.value; + } + var SiriusScale = 0.055f + (0.001f * (moddedOwner.AvaliableStarburst + value)); void SpawnStar(float SlotRequirement, Vector2 offset, float intensity, int flashOffset = 0, int flashMod = 100) { if (SlotRequirement > 0 && Projectile.minionSlots < SlotRequirement) @@ -228,7 +234,6 @@ namespace CalamityMod.Projectiles.Summon //Animate the starbursts in the animation foreach (var star in starburstsToFire) { - star.Center = Vector2.Lerp(star.Center, Projectile.Center + Projectile.velocity, Projectile.ai[2] / 15f); star.AICooldown = 2; } diff --git a/Projectiles/Typeless/StratusBlackHole.cs b/Projectiles/Typeless/StratusBlackHole.cs index faf207f8a7..9c42012307 100644 --- a/Projectiles/Typeless/StratusBlackHole.cs +++ b/Projectiles/Typeless/StratusBlackHole.cs @@ -17,8 +17,6 @@ namespace CalamityMod.Projectiles.Typeless { public new string LocalizationCategory => "Projectiles.Typeless"; - public SlotId LoopSoundSlot = SlotId.Invalid; - public override void SetStaticDefaults() { Main.projFrames[Type] = 6; @@ -72,24 +70,6 @@ namespace CalamityMod.Projectiles.Typeless player.Calamity().StratusStarburstResetTimer = (int)MathHelper.Max(player.Calamity().StratusStarburstResetTimer, 180); } } - - if (!SoundEngine.TryGetActiveSound(LoopSoundSlot, out var sound)) - LoopSoundSlot = SoundEngine.PlaySound(StratusSphere.LoopSound with { Volume = 1f }, Projectile.Center); - else - sound.Position = Projectile.Center; // Keep the sound consistently on the projectile - } - - - private void StopLoop() - { - if (SoundEngine.TryGetActiveSound(LoopSoundSlot, out var sound)) - sound.Stop(); - - LoopSoundSlot = SlotId.Invalid; - } - public override void OnKill(int timeLeft) - { - StopLoop(); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Scenes/MusicScenes/ProvidenceMusicScene.cs b/Scenes/MusicScenes/ProvidenceMusicScene.cs index 7cc9fdd909..33b94b0f75 100644 --- a/Scenes/MusicScenes/ProvidenceMusicScene.cs +++ b/Scenes/MusicScenes/ProvidenceMusicScene.cs @@ -1,5 +1,5 @@ -using CalamityMod.NPCs.Providence; -using CalamityMod.Projectiles.Boss; +using CalamityMod.NPCs; +using CalamityMod.NPCs.Providence; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,33 +11,24 @@ namespace CalamityMod.Systems public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic - { - get - { - for (int i = 0; i < Main.projectile.Length; i++) - { - Projectile proj = Main.projectile[i]; - if (proj.type == ModContent.ProjectileType() && proj.timeLeft > 35) - { - return MusicLoader.GetMusicSlot(Mod, "Sounds/Music/Silence"); - } - } - return CalamityMod.Instance.GetMusicFromMusicMod("Providence"); - } - } + public static int ProvidenceTrack => (int)CalamityMod.Instance.GetMusicFromMusicMod("Providence"); + public static int SilenceTrack => MusicLoader.GetMusicSlot(CalamityMod.Instance, "Sounds/Music/Silence"); + public override int? MusicModMusic => ProvidenceSpawnState() < 180f && ProvUtils.StandardAI() ? SilenceTrack : ProvidenceTrack; public override int VanillaMusic => MusicID.LunarBoss; public override int OtherworldMusic => MusicID.OtherworldlyLunarBoss; public override void SpecialVisuals(Player player, bool isActive) { - for (int i = 0; i < Main.projectile.Length; i++) - { - Projectile proj = Main.projectile[i]; - if (isActive && proj.type == ModContent.ProjectileType() && proj.timeLeft <= 35) - { - Main.musicFade[Main.curMusic] = 1f; - } - } + if (ProvidenceSpawnState() == 180f && ProvUtils.StandardAI()) + Main.musicFade[ProvidenceTrack] = 1f; + } + public static float ProvidenceSpawnState() + { + int provIndex = CalamityGlobalNPC.holyBoss; + if (provIndex < 0 || provIndex >= Main.maxNPCs || !Main.npc[provIndex].active) + return -1f; + + var prov = Main.npc[provIndex]; + return prov.Calamity().newAI[3]; } } } diff --git a/Sounds/Custom/BrainOfCthulhu/BoC_Rev_BloodShot.ogg b/Sounds/Custom/BrainOfCthulhu/BoC_Rev_BloodShot.ogg new file mode 100644 index 0000000000..bc2aad3652 Binary files /dev/null and b/Sounds/Custom/BrainOfCthulhu/BoC_Rev_BloodShot.ogg differ diff --git a/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Explosion1.ogg b/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Explosion1.ogg new file mode 100644 index 0000000000..5fc9d93db0 Binary files /dev/null and b/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Explosion1.ogg differ diff --git a/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Explosion2.ogg b/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Explosion2.ogg new file mode 100644 index 0000000000..063177325c Binary files /dev/null and b/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Explosion2.ogg differ diff --git a/Sounds/Custom/DifficultySelection/Death_Mode_Select.ogg b/Sounds/Custom/DifficultySelection/Death_Mode_Select.ogg index 5161a5f67b..fad096ce8d 100644 Binary files a/Sounds/Custom/DifficultySelection/Death_Mode_Select.ogg and b/Sounds/Custom/DifficultySelection/Death_Mode_Select.ogg differ diff --git a/Sounds/Custom/DifficultySelection/Legendary_Mode_Select.ogg b/Sounds/Custom/DifficultySelection/Legendary_Mode_Select.ogg index 8193cbc8ff..5a1b22cf4e 100644 Binary files a/Sounds/Custom/DifficultySelection/Legendary_Mode_Select.ogg and b/Sounds/Custom/DifficultySelection/Legendary_Mode_Select.ogg differ diff --git a/Sounds/Custom/DifficultySelection/Malice_Mode_Select.mp3 b/Sounds/Custom/DifficultySelection/Malice_Mode_Select.mp3 deleted file mode 100644 index d3e180bc17..0000000000 Binary files a/Sounds/Custom/DifficultySelection/Malice_Mode_Select.mp3 and /dev/null differ diff --git a/Sounds/Custom/DifficultySelection/Malice_Mode_Select.ogg b/Sounds/Custom/DifficultySelection/Malice_Mode_Select.ogg new file mode 100644 index 0000000000..ba0b09c5b9 Binary files /dev/null and b/Sounds/Custom/DifficultySelection/Malice_Mode_Select.ogg differ diff --git a/Sounds/Custom/DifficultySelection/Revengeance_Mode_Select.ogg b/Sounds/Custom/DifficultySelection/Revengeance_Mode_Select.ogg index 7ed7355a0e..52418e8589 100644 Binary files a/Sounds/Custom/DifficultySelection/Revengeance_Mode_Select.ogg and b/Sounds/Custom/DifficultySelection/Revengeance_Mode_Select.ogg differ diff --git a/Sounds/Item/StratusSphereLoop.ogg b/Sounds/Item/StratusSphereLoop.ogg deleted file mode 100644 index 6497b8ced8..0000000000 Binary files a/Sounds/Item/StratusSphereLoop.ogg and /dev/null differ diff --git a/Sounds/Item/Summon/SarosFiring.ogg b/Sounds/Item/Summon/SarosFiring.ogg new file mode 100644 index 0000000000..185efa9f97 Binary files /dev/null and b/Sounds/Item/Summon/SarosFiring.ogg differ diff --git a/Sounds/Item/Summon/SarosSpawn.ogg b/Sounds/Item/Summon/SarosSpawn.ogg new file mode 100644 index 0000000000..185efa9f97 Binary files /dev/null and b/Sounds/Item/Summon/SarosSpawn.ogg differ diff --git a/Systems/Collections/CalamityProjectileSets.cs b/Systems/Collections/CalamityProjectileSets.cs index 41e02e1020..f41a44c37b 100644 --- a/Systems/Collections/CalamityProjectileSets.cs +++ b/Systems/Collections/CalamityProjectileSets.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; @@ -69,6 +70,13 @@ namespace CalamityMod.Systems.Collections ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType()); + /// + /// If for a projectile type, then that projectile will be blacklisted from receiving the homing effect of Grape Beer.
+ /// Defaults to . + ///
+ public static bool[] DoesNotGetHomingWithGrapeBeer = Factory.CreateBoolSet(ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType()); + /// /// Determines what other projectiles this projectile will share ID-static immunity frames with. Defaults to -1, which means that it does not share immunity frames.
/// Each "set" of projectile which shares immunity frames is registered to point to the same ID reference, usually the first projectile in the set. If a projectile with this reference hits an NPC, all other projectiles with that reference also have their ID-static immunity cooldown set for that NPC. diff --git a/Systems/Collections/DonatorsNameList.cs b/Systems/Collections/DonatorsNameList.cs index 1313c0818f..2546638620 100644 --- a/Systems/Collections/DonatorsNameList.cs +++ b/Systems/Collections/DonatorsNameList.cs @@ -33,8 +33,10 @@ namespace CalamityMod.Systems.Collections "Aerosyn", "Aidan Spears", "Amandalias", + "Arcadia", "Arcxus", "Ariallis", + "asokasi", "Audrey Lynn Beemus", "awesomechapro", "Azariah", @@ -50,13 +52,22 @@ namespace CalamityMod.Systems.Collections "Carduelis", "Careless_imp", "Chin", + "ChristmadLaner", + "Chuck", "Cinder", + "Cosmoec Ark", + "Cosmore", + "Cracking cheese gromit", "CrazyGamer69", "Darthlego", + "DefinitlyResponsible", "Diamond Nife", + "Dizzetriya", "djsnj20", "DOGMA", "DogVTF", + "Dokuro vibes", + "Dos Champion", "drake093104", "Entrian", "Equinoxux", @@ -68,32 +79,59 @@ namespace CalamityMod.Systems.Collections "Halleyvetica", "Hamsting", "help", + "HeWhoShallNotBeBaned", + "Hunyre", + "Hyperthermia", + "Idan", "Iptktp9", "J.U.N.E.S", "Jace Ufret", "Jalapeno9", "Jankle", "JFL", + "JmWarrior", + "JMww2", + "JOSEPH BRACKEN", + "JustinTheLocalToaster", + "Kelta7", "Kiddorox", + "Lazy2ns", + "LecTrouble", + "Liam Healy", "Liam Rafle", "Magicoal", + "Mateo Sauvege", + "Mediocre King", + "Melongun", "Mint_loll", + "Misako Drevis", "MizzUltraViolet DamienTK", + "Moe", + "MrDizzyG", + "Natalie Webb", "Nature", "niceguysrage", "Nick H", "Nightinglade", "Nothin Purrsonal", "Nova Solarius", + "Nyavalcade", "NyxxyNightstar", "OakhamSam", + "OriasTheFloof", + "Oxytoxy365", + "Ozone-278", "PantySlack", "Patch357", + "Patrick Nevermore", "Phil Broome", + "PumpkinKing", "Qwertz", "Reece", + "RK", "roryoftheabyss", "RuskieThe3rd", + "Ryo Tadashi", "Sable", "SakuraWinterz", "Salted Warlock", @@ -101,6 +139,8 @@ namespace CalamityMod.Systems.Collections "Sharktank6", "SirChaos189", "SkeletonHunter96", + "SRMG267", + "tadict", "Taelishe", "Taylor Olligoci", // also an ex-dev. Listed as "Lilac Olligoci" on Patreon. There were two "Taylor"s on the old list "Tethox", @@ -110,15 +150,23 @@ namespace CalamityMod.Systems.Collections "The Wither", "Trinity Series", "Tsukara", + "Umbara", "Vanillin", + "VentCrab", + "Vergil Cyrus", "Vertigo", + "Vixcalibur", + "Vortex", "weisslerren", + "Willye", + "wt55030", "xAqult", "Xtra Trinity 3678", "Xtra", "Xzier_Tengal", "YashimaYamanata", "Zachtoplasm", + "Zecro", "ZoeyPlague", ]; @@ -162,7 +210,6 @@ namespace CalamityMod.Systems.Collections "anything5000", "Apotheosis", "apotofkoolaid", - "Arcadia", "Arche", "Archie", "Ari", diff --git a/Tiles/BaseTiles/BaseMonolith.cs b/Tiles/BaseTiles/BaseMonolith.cs index 50111964b9..e2f6da7c53 100644 --- a/Tiles/BaseTiles/BaseMonolith.cs +++ b/Tiles/BaseTiles/BaseMonolith.cs @@ -143,20 +143,17 @@ namespace CalamityMod.Tiles.BaseTiles // 02FEB2025: Ozzatron: code lifted from https://github.com/CalamityTeam/CalamityModPublic/pull/77 // transplanted into base monolith as part of manual cherry pick merge // - // Draws the Smart Cursor Highlight. Not 100% accurate, but its close enough + // Draws the Smart Cursor Highlight. Color highlightColor; var highlight = TextureAssets.HighlightMask[Type]; if (highlight != null && highlight.IsLoaded && Main.InSmartCursorHighlightArea(i, j, out var actuallySelected)) { - if (actuallySelected) - { - highlightColor = new Color(252, 252, 84); + int avgBrightness = (drawColor.R + drawColor.G + drawColor.B) / 3; + if (avgBrightness > 10) + { + highlightColor = Colors.GetSelectionGlowColor(actuallySelected, avgBrightness); + Main.spriteBatch.Draw(highlight.Value, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, rect, highlightColor, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } - else - { - highlightColor = new Color(125, 125, 125); - } - Main.spriteBatch.Draw(highlight.Value, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animateFrameOffset, 16, height), highlightColor, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); ; } return false; diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 0260b82767..5dfb13a294 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -308,13 +308,6 @@ namespace CalamityMod.Tiles if (WorldGen.altarCount > 1 && WorldGen.altarCount % 12 == 0) DropItem(i, j, ItemType(), quantity: 1, asStack: true, prefix: true); } - - // Drop Golden Bombs at a 0.33% chance from Pots - if (type == TileID.Pots) - { - if (Main.rand.NextBool(300)) - DropItem(i, j, ItemType(), quantity: 1, asStack: true); - } } private static void DropItem(int i, int j, int itemType, int quantity, bool asStack, Vector2 spreadMinMax = default, bool prefix = false) diff --git a/Tiles/DraedonStructures/PowerCellFactory.cs b/Tiles/DraedonStructures/PowerCellFactory.cs index 121125919f..0a700bb8aa 100644 --- a/Tiles/DraedonStructures/PowerCellFactory.cs +++ b/Tiles/DraedonStructures/PowerCellFactory.cs @@ -145,19 +145,16 @@ namespace CalamityMod.Tiles.DraedonStructures else if (t.IsHalfBlock) spriteBatch.Draw(tex, drawOffset + Vector2.UnitY * 8f, new Rectangle(frameXPos, frameYPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - // Draws the Smart Cursor Highlight. Not 100% accurate, but its close enough + // Draws the Smart Cursor Highlight. Color highlightColor; if (TileID.Sets.HasOutlines[Type] && Main.InSmartCursorHighlightArea(i, j, out var actuallySelected)) { - if (actuallySelected) + int avgBrightness = (drawColor.R + drawColor.G + drawColor.B) / 3; + if (avgBrightness > 10) { - highlightColor = new Color(252, 252, 84); + highlightColor = Colors.GetSelectionGlowColor(actuallySelected, avgBrightness); + spriteBatch.Draw(TextureAssets.HighlightMask[Type].Value, drawOffset, new Rectangle(frameXPos, frameYPos, 16, 16), highlightColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - else - { - highlightColor = new Color(125, 125, 125); - } - spriteBatch.Draw(TextureAssets.HighlightMask[Type].Value, drawOffset, new Rectangle(frameXPos, frameYPos, 16, 16), highlightColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } diff --git a/Tiles/DraedonSummoner/CodebreakerTile.cs b/Tiles/DraedonSummoner/CodebreakerTile.cs index 0daeccde33..989f02a7a6 100644 --- a/Tiles/DraedonSummoner/CodebreakerTile.cs +++ b/Tiles/DraedonSummoner/CodebreakerTile.cs @@ -234,19 +234,16 @@ namespace CalamityMod.Tiles.DraedonSummoner if (codebreakerTileEntity.ContainsDecryptionComputer && codebreakerTileEntity.ContainsSensorArray && !codebreakerTileEntity.ContainsAdvancedDisplay && codebreakerTileEntity.ContainsVoltageRegulationSystem) return false; - bool actuallySelected; + // Draws the appropriate Smart Cursor highlight sprite selected from above. Color highlightColor; - if (Main.InSmartCursorHighlightArea(i, j, out actuallySelected) && codebreakerTileEntity.ContainsDecryptionComputer) + if (Main.InSmartCursorHighlightArea(i, j, out var actuallySelected) && codebreakerTileEntity.ContainsDecryptionComputer) { - if (actuallySelected) + int avgBrightness = (drawColor.R + drawColor.G + drawColor.B) / 3; + if (avgBrightness > 10) { - highlightColor = new Color(252, 252, 84); + highlightColor = Colors.GetSelectionGlowColor(actuallySelected, avgBrightness); + spriteBatch.Draw(HighlightToUse, drawPosition, frame, highlightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } - else - { - highlightColor = new Color(125, 125, 125); - } - spriteBatch.Draw(HighlightToUse, drawPosition, frame, highlightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } } } diff --git a/Tiles/Furniture/Monoliths/AstralProjectorTile_Glow.png b/Tiles/Furniture/Monoliths/AstralProjectorTile_Glow.png index 32b525194d..c5a5c74e8e 100644 Binary files a/Tiles/Furniture/Monoliths/AstralProjectorTile_Glow.png and b/Tiles/Furniture/Monoliths/AstralProjectorTile_Glow.png differ diff --git a/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile_Highlight.png b/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile_Highlight.png index 39a2c06530..e590f7293e 100644 Binary files a/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile_Highlight.png and b/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile_Highlight.png differ diff --git a/Tiles/Furniture/Monoliths/BossRushMonolithTile_Highlight.png b/Tiles/Furniture/Monoliths/BossRushMonolithTile_Highlight.png index e93fcd6782..8fe157998e 100644 Binary files a/Tiles/Furniture/Monoliths/BossRushMonolithTile_Highlight.png and b/Tiles/Furniture/Monoliths/BossRushMonolithTile_Highlight.png differ diff --git a/Tiles/Furniture/Monoliths/DeepSeaAnchorTile_Highlight.png b/Tiles/Furniture/Monoliths/DeepSeaAnchorTile_Highlight.png index 2217a9872e..dee4eb5089 100644 Binary files a/Tiles/Furniture/Monoliths/DeepSeaAnchorTile_Highlight.png and b/Tiles/Furniture/Monoliths/DeepSeaAnchorTile_Highlight.png differ diff --git a/Tiles/Furniture/Monoliths/ExoObeliskTile_Highlight.png b/Tiles/Furniture/Monoliths/ExoObeliskTile_Highlight.png index f94d2cdc37..e08ee41620 100644 Binary files a/Tiles/Furniture/Monoliths/ExoObeliskTile_Highlight.png and b/Tiles/Furniture/Monoliths/ExoObeliskTile_Highlight.png differ diff --git a/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.cs b/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.cs index 0c4bfc8f76..0d16d5dedb 100644 --- a/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.cs +++ b/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.Furniture.Monoliths public override int AnimationFrameCount => 6; public override int AnimationDelay => 8; public override int CursorItemType => ModContent.ItemType(); - public override string HighlightTexture => "CalamityMod/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile_Highlight"; public override void SetStaticDefaults() { RegisterItemDrop(ModContent.ItemType()); diff --git a/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile_Highlight.png b/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile_Highlight.png new file mode 100644 index 0000000000..e590f7293e Binary files /dev/null and b/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile_Highlight.png differ diff --git a/UI/DialogueDisplay/DialogueDisplayUI.cs b/UI/DialogueDisplay/DialogueDisplayUI.cs index a30f45f2c4..31414b402b 100644 --- a/UI/DialogueDisplay/DialogueDisplayUI.cs +++ b/UI/DialogueDisplay/DialogueDisplayUI.cs @@ -683,16 +683,16 @@ namespace CalamityMod.UI.DialogueDisplay if (DialoguePage.Event != null && !DialoguePage.Event.IsOver) DialoguePage.Event.UpdateEvent(); - if (textIndex < Text.Length) + if (textIndex < Text.Length - 1) { int delay; int loopCounter = 0; + bool forcedPause = false; + do { if (TextTimer == 0) { - bool shouldApplyDelay = false; - if (!lockDelay) { char currentChar = Text[textIndex]; @@ -707,7 +707,7 @@ namespace CalamityMod.UI.DialogueDisplay data = value; } - shouldApplyDelay = IsStoppingPunctuation(currentChar, textIndex == 0 ? null : Text[textIndex - 1], textIndex == Text.Length - 1 ? null : Text[textIndex + 1]); + bool shouldApplyDelay = IsStoppingPunctuation(currentChar, textIndex == 0 ? null : Text[textIndex - 1], textIndex == Text.Length - 1 ? null : Text[textIndex + 1]); if (shouldApplyDelay) { @@ -722,19 +722,25 @@ namespace CalamityMod.UI.DialogueDisplay } if (Pauses.TryGetValue(textIndex, out float pause)) + { storedDelay = (int)(pause * 60); + forcedPause = true; + } } + else if(Pauses.ContainsKey(textIndex)) + forcedPause = true; int delayToUse = (IsPunctuation(Text[textIndex]) && textIndex > 0 && IsPunctuation(Text[textIndex - 1])) ? inPunctuationDelay : textDelay; - delay = ((Text[textIndex] == ' ' || Text[textIndex] == '\n') && storedDelay > 0 ? delayToUse + storedDelay : delayToUse); + bool shouldIncludeStored = Text[textIndex] == ' ' || Text[textIndex] == '\n' || forcedPause; + delay = (shouldIncludeStored && storedDelay > 0 ? delayToUse + storedDelay : delayToUse); if (loopCounter == 0) TextTimer++; if ((delay == 0 || (TextTimer + loopCounter) % delay == 0) && TextTimer >= 0) { - if (Text[textIndex] == ' ') + if (Text[textIndex] == ' ' || forcedPause) { storedDelay = 0; lockDelay = false;