diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index bb11e63297..fa67d3f1e5 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -296,8 +296,8 @@ namespace CalamityMod.Balancing // 35% resist to Sulphuric Acid Cannon's explosions. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.DevourerOfGods, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); - // 25% resist to Corinth Prime's grenades. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.DevourerOfGods, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + // 60% resist to Corinth Prime's grenades. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.DevourerOfGods, Do(new ProjectileResistBalancingRule(0.4f, ProjectileType())))); // 20% resist to Valediction's typhoons; will catch Nuclear Fury as well but that doesn't matter. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.DevourerOfGods, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); diff --git a/Balancing/BalancingConstants.cs b/Balancing/BalancingConstants.cs index ec3d67b330..e8d05be133 100644 --- a/Balancing/BalancingConstants.cs +++ b/Balancing/BalancingConstants.cs @@ -62,18 +62,18 @@ internal const int SolarFlareIFrames = 12; internal const float SolarFlareBaseDamage = 400f; - // Dodge cooldowns (in frames) - // TODO -- Some of these could be moved to the respective item files - internal static readonly int BeltDodgeCooldownMin = 1200; - internal static readonly int BeltDodgeCooldownMax = 5400; - internal static readonly int BrainDodgeCooldownMin = 1200; - internal static readonly int BrainDodgeCooldownMax = 5400; - internal static readonly int AmalgamDodgeCooldownMin = 1200; - internal static readonly int AmalgamDodgeCooldownMax = 5400; - internal static readonly int MirrorDodgeCooldownMin = 1200; - internal static readonly int MirrorDodgeCooldownMax = 5400; - internal static readonly int EvolutionReflectCooldownMin = 1200; - internal static readonly int EvolutionReflectCooldownMax = 5400; + /// + /// How long the dodge cooldown is at maximum damage + /// + internal static readonly int DodgeCooldownMax = 5400; // 90 seconds + /// + /// How much the dodge cooldown is reduced when at minimum damage + /// + internal static float DodgeCooldownDamageMult => 0.33f; // 30 seconds + /// + /// How much the dodge cooldown is reduced per stacked dodge. Each stack applies multiplicatively. + /// + internal static float DodgeCooldownMultPerStack => 0.85f; // -15% per stack, multiplicatively #endregion #region Damage diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 6375582b08..c495db6dc1 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -68,6 +68,7 @@ using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.Systems.Collections; using CalamityMod.Systems.Mechanic; +using CalamityMod.Utilities; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -193,7 +194,7 @@ namespace CalamityMod.CalPlayer DevourerofCods //Not a fishing minigame but uses the same code as the rest } public FishingMinigames SelectedFishingMinigame = FishingMinigames.None; - public bool countsAsAnyWet => (Player.armor[0].type == ItemID.FishBowl || Player.wetCount > 0 || Player.wet || Player.honeyWet || Player.lavaWet); + public bool countsAsAnyWet => (Player.armor[0].type == ItemID.FishBowl || (Main.raining && Player.Center.Y < Main.worldSurface * 16.0) || Player.dripping || Player.wetCount > 0 || Player.wet || Player.honeyWet || Player.lavaWet); /// /// How many Starbursts the player has @@ -948,6 +949,7 @@ namespace CalamityMod.CalPlayer public bool seraphTracers = false; public bool frostFlare = false; public bool evolution = false; + public bool procDodgeEffects = true; public bool nanotech = false; public bool deadshotBrooch = false; public bool shadowMinions = false; @@ -1141,6 +1143,22 @@ namespace CalamityMod.CalPlayer /// Used for spawning Quiver of Nihility's void fields. public bool voidField = false; public bool copyrightInfringementShield = false; + + /// + /// This is the maximum cooldown of general Dodge effects, in frames. Can be modified by equipment. + /// Defaults to 90 seconds, or 5400 frames. + /// + public int ConsumableDodgeCooldown = 0; + /// + /// A list of on dodge effects for every dodge the player has equipped. + /// Also used to determine the amount of dodges for cooldowns. + /// Returns the string for the dodge cooldown icon to use. + /// + public List> DodgeEffects = []; + /// + /// Used internally to disable Player.shadowDodge so we can use custom dodge ordering. + /// + bool storedShadowDodge = false; #endregion #region Armor Set @@ -2206,15 +2224,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; @@ -2476,7 +2497,10 @@ namespace CalamityMod.CalPlayer voidField = false; copyrightInfringementShield = false; - daedalusReflect = false; + ConsumableDodgeCooldown = BalancingConstants.DodgeCooldownMax; + DodgeEffects = []; + + daedalusReflect = false; daedalusSplit = false; daedalusAbsorb = false; daedalusShard = false; @@ -2732,6 +2756,11 @@ namespace CalamityMod.CalPlayer pinkCandle = false; yellowCandle = false; + + //Disable Lockon when not on gamepad to prevent it being left on forever by The Pointer + if (!Main.gamePad) + LockOnHelper.ForceUsability = false; + SelectedFishingMinigame = FishingMinigames.None; #region Minion Reset Effects @@ -2881,6 +2910,7 @@ namespace CalamityMod.CalPlayer abyssalDivingSuitPrevious = abyssalDivingSuit; abyssalDivingSuit = false; + aquaticHeartPrevious = aquaticHeart; aquaticHeart = false; profanedCrystalStatePrevious = pscState; @@ -3895,13 +3925,13 @@ namespace CalamityMod.CalPlayer d.velocity = Main.rand.NextVector2Unit() * spreadSpeed; Vector2 segmentTwoPos = Player.Center + segmentTwoStart + segmentTwoIncrement * interpolant; - d = Dust.CloneDust(d); + d = Dust.BetterCloneDust(d); d.position = segmentTwoPos; d.scale = Main.rand.NextFloat(1.2f, 1.8f); d.velocity = Main.rand.NextVector2Unit() * spreadSpeed; Vector2 segmentThreePos = Player.Center + segmentThreeStart + segmentThreeIncrement * interpolant; - d = Dust.CloneDust(d); + d = Dust.BetterCloneDust(d); d.position = segmentThreePos; d.scale = Main.rand.NextFloat(1.2f, 1.8f); d.velocity = Main.rand.NextVector2Unit() * spreadSpeed; @@ -4263,6 +4293,17 @@ namespace CalamityMod.CalPlayer if (Player.accRunSpeed < accRunSpeedMin) Player.accRunSpeed = accRunSpeedMin; + if (Player.blackBelt) + DodgeEffects.Add((Player, hit) => { + Player.NinjaDodge(); + return null; + }); + if (Player.brainOfConfusionItem != null && !Player.brainOfConfusionItem.IsAir) + DodgeEffects.Add((Player, hit) => { + Player.BrainOfConfusionDodge(); + return null; + }); + if (Player.Transformation().Type == ItemType()) { if (Player.whoAmI == Main.myPlayer && !snowmanNoseless) @@ -4439,7 +4480,7 @@ namespace CalamityMod.CalPlayer { Player.ClearBuff(BuffID.WindPushed); } - if (Player.statMana < 0) + if (Player.statMana < 0 && Player.Calamity().ChaosStone) { Player.AddBuff(BuffType(), 10); } @@ -4710,13 +4751,22 @@ namespace CalamityMod.CalPlayer { float baseRecoveryRate = Main.expertMode ? BalancingConstants.LifeStealRecoveryRate_Expert : BalancingConstants.LifeStealRecoveryRate_Classic; float lifeStealRecoveryRateReduction = Main.expertMode ? BalancingConstants.LifeStealRecoveryRateReduction_Expert : BalancingConstants.LifeStealRecoveryRateReduction_Classic; + float lifeStealCap = Main.expertMode ? BalancingConstants.LifeStealCap_Expert: BalancingConstants.LifeStealCap_Classic; float lifeStealRecoveryRate = baseRecoveryRate - lifeStealRecoveryRateReduction; - if (Player.lifeSteal < -lifeStealRecoveryRate) + + if (Player.lifeSteal < lifeStealCap) { - int duration = (int)Math.Ceiling(Math.Abs(Player.lifeSteal) / lifeStealRecoveryRate); - if (!Player.HasCooldown(LifeSteal.ID) || (cooldowns[LifeSteal.ID].duration < duration)) - Player.AddCooldown(LifeSteal.ID, duration); + + if (Player.Calamity().cooldowns.TryGetValue(LifeSteal.ID, out var cooldown)) + { + cooldown.timeLeft = (int)Math.Max(0,(lifeStealCap-Math.Abs(Player.lifeSteal))); + } + else + { + Player.AddCooldown(LifeSteal.ID, (int)lifeStealCap) + .timeLeft = (int)Math.Max(0, (lifeStealCap - Math.Abs(Player.lifeSteal))); + } } } if (moonshine) diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index faa0bd312e..62334b96d3 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); } } } @@ -381,7 +380,7 @@ namespace CalamityMod.CalPlayer else { // Mana Burn VFX disabled when hih - if (Player.statMana < 0) + if (Player.statMana < 0 && Player.Calamity().ChaosStone) { float compactness = Player.width * 0.6f; if (compactness < 10f) diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index f06c66819c..ccf037f590 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -46,6 +46,7 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems.Collections; using CalamityMod.UI; +using CalamityMod.Utilities; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -145,86 +146,7 @@ namespace CalamityMod.CalPlayer NetMessage.SendData(MessageID.Dodge, -1, -1, null, Player.whoAmI, 1f, 0f, 0f, 0, 0, 0); } - public void AbyssMirrorDodge(double dodgeDamageGateValuePercent, int dodgeDamageGateValue, int hitDamage, Player.HurtInfo info) - { - double maxCooldownDurationDamagePercent = 0.5; - int maxCooldownDurationDamageValue = (int)Math.Round(Player.statLifeMax2 * (maxCooldownDurationDamagePercent - dodgeDamageGateValuePercent)); - - // Just in case... - if (maxCooldownDurationDamageValue <= 0) - maxCooldownDurationDamageValue = 1; - - float cooldownDurationScalar = MathHelper.Clamp((hitDamage - dodgeDamageGateValue) / (float)maxCooldownDurationDamageValue, 0f, 1f); - - if (Player.whoAmI == Main.myPlayer && abyssalMirror && !eclipseMirror) - { - int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.MirrorDodgeCooldownMin, BalancingConstants.MirrorDodgeCooldownMax, cooldownDurationScalar); - Player.AddCooldown(GlobalDodge.ID, cooldownDuration, true, "abyssmirror"); - - // 17APR2024: Ozzatron: Abyssal Mirror is a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. - int abyssalMirrorDodgeIFrames = Player.ComputeDodgeIFrames(); - Player.GiveUniversalIFrames(abyssalMirrorDodgeIFrames, true); - - rogueStealth += 0.5f; - SoundEngine.PlaySound(SilvaArmor.ActivationSound, Player.Center); - - var source = Player.GetSource_Accessory_OnHurt(FindAccessory(), info.DamageSource); - for (int i = 0; i < 10; i++) - { - int damage = (int)Player.GetTotalDamage().ApplyTo(55); - - int lumenyl = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f), ModContent.ProjectileType(), damage, 0, Player.whoAmI); - Main.projectile[lumenyl].rotation = Main.rand.NextFloat(0, 360); - Main.projectile[lumenyl].frame = Main.rand.Next(0, 4); - if (lumenyl.WithinBounds(Main.maxProjectiles)) - Main.projectile[lumenyl].DamageType = DamageClass.Generic; - } - - // TODO -- Calamity dodges should probably not send a vanilla dodge packet considering that causes Tabi dust - if (Player.whoAmI == Main.myPlayer) - { - NetMessage.SendData(MessageID.Dodge, -1, -1, null, Player.whoAmI, 1f, 0f, 0f, 0, 0, 0); - } - } - } - - public void EclipseMirrorDodge(double dodgeDamageGateValuePercent, int dodgeDamageGateValue, int hitDamage, Player.HurtInfo info) - { - double maxCooldownDurationDamagePercent = 0.5; - int maxCooldownDurationDamageValue = (int)Math.Round(Player.statLifeMax2 * (maxCooldownDurationDamagePercent - dodgeDamageGateValuePercent)); - - // Just in case... - if (maxCooldownDurationDamageValue <= 0) - maxCooldownDurationDamageValue = 1; - - float cooldownDurationScalar = MathHelper.Clamp((hitDamage - dodgeDamageGateValue) / (float)maxCooldownDurationDamageValue, 0f, 1f); - - if (Player.whoAmI == Main.myPlayer && eclipseMirror) - { - int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.MirrorDodgeCooldownMin, BalancingConstants.MirrorDodgeCooldownMax, cooldownDurationScalar); - Player.AddCooldown(GlobalDodge.ID, cooldownDuration, true, "eclipsemirror"); - - // 17APR2024: Ozzatron: Eclipse Mirror is a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. - int eclipseMirrorDodgeIFrames = Player.ComputeDodgeIFrames(); - Player.GiveUniversalIFrames(eclipseMirrorDodgeIFrames, true); - - rogueStealth += 0.5f; - SoundEngine.PlaySound(SoundID.Item68, Player.Center); - - var source = Player.GetSource_Accessory_OnHurt(FindAccessory(), info.DamageSource); - int damage = (int)Player.GetTotalDamage().ApplyTo(2000); - - int eclipse = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0, Player.whoAmI); - if (eclipse.WithinBounds(Main.maxProjectiles)) - Main.projectile[eclipse].DamageType = DamageClass.Generic; - - // TODO -- Calamity dodges should probably not send a vanilla dodge packet considering that causes Tabi dust - if (Player.whoAmI == Main.myPlayer) - { - NetMessage.SendData(MessageID.Dodge, -1, -1, null, Player.whoAmI, 1f, 0f, 0f, 0, 0, 0); - } - } - } + #endregion #region Pre Kill @@ -938,16 +860,8 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(source, Player.Center + Vector2.UnitX.RotatedBy(MathHelper.TwoPi * (i / 10f)), Vector2.Zero, ModContent.ProjectileType(), mirrorDamage, 5, Main.myPlayer, 1); } } - - //Doze - This gives the same iframes as vanilla dodges, including accounting for cross necklace. - int evolutionIFrames = Player.ComputeDodgeIFrames(); - Player.GiveUniversalIFrames(evolutionIFrames, true); - - modifiers.Cancel(); projTypeJustHitBy = proj.type; - - int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.EvolutionReflectCooldownMin, BalancingConstants.EvolutionReflectCooldownMax, cooldownDurationScalar); - Player.AddCooldown(GlobalDodge.ID, cooldownDuration); + procDodgeEffects = true; //This tells the game to dodge in the Consumable Dodge step, which procs all generic dodge effects at once. return; } @@ -1513,6 +1427,10 @@ namespace CalamityMod.CalPlayer } } + //Here we store the Holy Protection bool so that we can have Holy Protection run in the right order among our dodges + storedShadowDodge = Player.shadowDodge; + Player.shadowDodge = false; + // If no other effects occurred, run vanilla code return base.FreeDodge(info); } @@ -1528,8 +1446,8 @@ namespace CalamityMod.CalPlayer int actualDamageTaken = chaliceOfTheBloodGod ? chaliceHitOriginalDamage : info.Damage; bool sufficientDamageForDodging = actualDamageTaken >= dodgeDamageGateValue; - if (!Player.HasCooldown(GlobalDodge.ID) && sufficientDamageForDodging) - { + //This is in a method here so the logic below can call it in multiple places + void GenericDodgeEffects() { double maxCooldownDurationDamagePercent = 0.5; int maxCooldownDurationDamageValue = (int)Math.Round(Player.statLifeMax2 * (maxCooldownDurationDamagePercent - dodgeDamageGateValuePercent)); @@ -1538,26 +1456,61 @@ namespace CalamityMod.CalPlayer maxCooldownDurationDamageValue = 1; float cooldownDurationScalar = MathHelper.Clamp((actualDamageTaken - dodgeDamageGateValue) / (float)maxCooldownDurationDamageValue, 0f, 1f); + //Every dodge after the first reduces the dodge cooldown by 15%, stacking multiplicatively + float cooldownMultiplier = 1; + if (DodgeEffects.Count > 1) + cooldownMultiplier = MathF.Pow(BalancingConstants.DodgeCooldownMultPerStack, DodgeEffects.Count - 1); - // Re-implementation of vanilla item Black Belt as a consumable dodge - if (Player.whoAmI == Main.myPlayer && Player.blackBelt) + string? IconToUse = null; + foreach (var dodge in DodgeEffects) { - Player.NinjaDodge(); - int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.BeltDodgeCooldownMin, BalancingConstants.BeltDodgeCooldownMax, cooldownDurationScalar); + string? str = dodge(Player, info); + if (str is not null) + IconToUse = str; + } + //This is set after DodgeEffects in case some dodge wants to modify ConsumableDodgeCooldown, and so custom dodge icons for mirror line work + int cooldownDuration = (int)MathHelper.Lerp(ConsumableDodgeCooldown * cooldownMultiplier * BalancingConstants.DodgeCooldownDamageMult, ConsumableDodgeCooldown * cooldownMultiplier, cooldownDurationScalar); + if (IconToUse is null) Player.AddCooldown(GlobalDodge.ID, cooldownDuration); - return true; - } + else + Player.AddCooldown(GlobalDodge.ID, cooldownDuration, true, IconToUse); + } - // Re-implementation of vanilla item Brain of Confusion as a consumable dodge - if (Player.whoAmI == Main.myPlayer && Player.brainOfConfusionItem != null && !Player.brainOfConfusionItem.IsAir) - { - Player.BrainOfConfusionDodge(); - int cooldownTime = amalgam ? - (int)MathHelper.Lerp(BalancingConstants.AmalgamDodgeCooldownMin, BalancingConstants.AmalgamDodgeCooldownMax, cooldownDurationScalar) : - (int)MathHelper.Lerp(BalancingConstants.BrainDodgeCooldownMin, BalancingConstants.BrainDodgeCooldownMax, cooldownDurationScalar); - Player.AddCooldown(GlobalDodge.ID, cooldownTime); - return true; - } + //Dodge activation order is as follows: + // 1. Evolution dodge (which also procs Generals) + // 2. Spectral Veil + // 3. Evasion/Counter Scarf + // 4. Hallowed Armor + // 5. General Dodge + + if (procDodgeEffects) + { + DodgeEffects.Add((_, _) => null); //This is to account for whatever procced the dodge when counting dodge cooldown stacking + GenericDodgeEffects(); + procDodgeEffects = false; + return true; + } + + if (spectralVeil && spectralVeilImmunity > 0) + { + SpectralVeilDodge(); + return true; + } + + if (HandleDashDodges()) + return true; + // Hallowed Armor dodge + if (storedShadowDodge) + { + Player.ShadowDodge(); + storedShadowDodge = false; + return true; + } + + if (!Player.HasCooldown(GlobalDodge.ID) && sufficientDamageForDodging && DodgeEffects.Count > 0) + { + GenericDodgeEffects(); + return true; } // @@ -1567,30 +1520,7 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI != Main.myPlayer || disableAllDodges) return false; - if (spectralVeil && spectralVeilImmunity > 0) - { - SpectralVeilDodge(); - return true; - } - // TODO -- drag all dodge code into a CalamityPlayer sub-file dedicated to dodging and nothing else - if (HandleDashDodges()) - return true; - - // Mirror evades do not work if the global dodge cooldown is active. This cooldown can be triggered by either mirror. - if (!Player.HasCooldown(GlobalDodge.ID) && actualDamageTaken >= dodgeDamageGateValue) - { - if (eclipseMirror) - { - EclipseMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, actualDamageTaken, info); - return true; - } - else if (abyssalMirror) - { - AbyssMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, actualDamageTaken, info); - return true; - } - } return base.ConsumableDodge(info); } @@ -2083,9 +2013,9 @@ namespace CalamityMod.CalPlayer d.velocity = dustVel; d.noGravity = true; d.scale *= Main.rand.NextFloat(1.1f, 1.4f); - Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.PiOver2); - Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi); - Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 1.5f); + Dust.BetterCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.PiOver2); + Dust.BetterCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi); + Dust.BetterCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 1.5f); } } diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 804df29da9..9d23c72e56 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -256,7 +256,7 @@ namespace CalamityMod.CalPlayer else witheredWeaponHoldTime = 0; - if (Player.statMana < 0) + if (Player.statMana < 0 && Player.Calamity().ChaosStone) { totalNegativeLifeRegen -= Player.statMana/100f * Items.Accessories.ChaosStone.LostRegenPer100Mana; } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 37e1665bfb..20dae2332e 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -68,6 +68,7 @@ using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.FurnitureAuric; using CalamityMod.Tiles.Ores; using CalamityMod.UI; +using CalamityMod.Utilities; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -1672,7 +1673,7 @@ namespace CalamityMod.CalPlayer holyDust.noGravity = true; holyDust.scale = 1f; holyDust.fadeIn = Main.rand.NextFloat() * 2f; - Dust dustClone = Dust.CloneDust(holyDust); + Dust dustClone = Dust.BetterCloneDust(holyDust); Dust extraDust = dustClone; extraDust.scale /= 2f; extraDust = dustClone; @@ -3554,19 +3555,8 @@ namespace CalamityMod.CalPlayer if (starBeamRye) { - Player.manaFlower = false; - Player.ClearBuff(ModContent.BuffType()); - if (!Player.manaSick) - { - Player.manaRegenCount -= Player.manaRegen; - Player.manaRegenDelay = 0; - Player.manaRegenCount += 20; // 20 mana per second, even while using an item - if (Player.HeldItem.mana > 0) - { - Player.GetDamage() += 0.5f + MathHelper.Max(0.1f,Player.HeldItem.mana / (float)Player.HeldItem.useTime); - } - Player.GetDamage() -= 0.5f; - } + Player.manaRegenCount += StarBeamRye.ManaRegenBoost; + Player.GetDamage() *= StarBeamRye.MagicDmgMult; } if (whiteWine) @@ -3729,11 +3719,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 +4495,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/CalamityKeybinds.cs b/CalamityKeybinds.cs index f50b60e5b4..235da907f4 100644 --- a/CalamityKeybinds.cs +++ b/CalamityKeybinds.cs @@ -21,6 +21,7 @@ namespace CalamityMod public static ModKeybind TransformerHotKey { get; private set; } public static ModKeybind SwitchGravityHotkey {get; private set;} public static ModKeybind ExpandDebuffInfo { get; private set; } + public static ModKeybind ThePointerLock {get; private set;} public override void Load() { @@ -42,6 +43,7 @@ namespace CalamityMod TransformerHotKey = KeybindLoader.RegisterKeybind(Mod, "TransformerHotKey", "K"); SwitchGravityHotkey = KeybindLoader.RegisterKeybind(Mod, "GravitySwapOverride", "T"); ExpandDebuffInfo = KeybindLoader.RegisterKeybind(Mod, "ExpandDebuffInfo", "LeftControl"); + ThePointerLock = KeybindLoader.RegisterKeybind(Mod, "ThePointerLock", "N"); } public override void Unload() diff --git a/Cooldowns/LifeSteal.cs b/Cooldowns/LifeSteal.cs index 560e78b220..d7126d4ae0 100644 --- a/Cooldowns/LifeSteal.cs +++ b/Cooldowns/LifeSteal.cs @@ -1,4 +1,9 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Balancing; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; using Terraria.Localization; namespace CalamityMod.Cooldowns @@ -6,11 +11,44 @@ namespace CalamityMod.Cooldowns public class LifeSteal : CooldownHandler { public static new string ID => "LifeSteal"; - public override bool ShouldDisplay => instance.player.lifeSteal < 0f; + + private float lifeStealCap => Main.expertMode ? BalancingConstants.LifeStealCap_Expert : BalancingConstants.LifeStealCap_Classic; + public override bool ShouldDisplay => instance.player.lifeSteal < lifeStealCap; public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); public override string Texture => "CalamityMod/Cooldowns/LifeSteal"; - public override Color OutlineColor => new Color(255, 142, 165); - public override Color CooldownStartColor => Color.Lerp(new Color(255, 216, 216), new Color(255, 117, 117), instance.Completion); - public override Color CooldownEndColor => Color.Lerp(new Color(255, 216, 216), new Color(255, 117, 117), instance.Completion); + + public override bool CanTickDown => false; + public override Color OutlineColor => instance.player!.lifeSteal < 0 + ? new Color(255, 142, 165) + : new Color(255, 142, 165); + public override Color CooldownStartColor => instance.player!.lifeSteal < 0 + ? new Color(145, 59, 59) + : new Color(255, 181, 181); + public override Color CooldownEndColor => CooldownStartColor; + private Color TextColor => Color.White; + private Color TextBorderColor => new Color(40, 0, 0); + public override void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawExpanded(spriteBatch, position, opacity, scale); + var value = instance.player.lifeSteal; + bool negate = value < 0; + var valueToMeasure = Math.Abs(value); + float Xoffset = valueToMeasure > 9 ? valueToMeasure > 99 ? -12.5f : -10f : -5; + if (negate) + Xoffset -= 8; + CalamityUtils.DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, (value).ToString("#"), position + new Vector2(Xoffset, 8) * scale, TextColor, TextBorderColor, scale); + } + + public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawCompact(spriteBatch, position, opacity, scale); + var value = instance.player.lifeSteal; + bool negate = value < 0; + var valueToMeasure = Math.Abs(value); + float Xoffset = valueToMeasure > 9 ? valueToMeasure > 99 ? -12.5f : -10f : -5; + if (negate) + Xoffset -= 8; + CalamityUtils.DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, (value).ToString("#"), position + new Vector2(Xoffset, 8) * scale, TextColor, TextBorderColor, scale); + } } } 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/AbyssalMirror.cs b/Items/Accessories/AbyssalMirror.cs index e4113351d0..0a71cbd439 100644 --- a/Items/Accessories/AbyssalMirror.cs +++ b/Items/Accessories/AbyssalMirror.cs @@ -1,6 +1,9 @@ using CalamityMod.CalPlayer; +using CalamityMod.Items.Armor.Silva; using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -33,6 +36,36 @@ namespace CalamityMod.Items.Accessories modPlayer.stealthGenMoving += MovingStealthRegenBoost; modPlayer.abyssalMirror = true; player.aggro -= AggroReduction; + modPlayer.DodgeEffects.Add(AbyssMirrorDodge); + } + + public string AbyssMirrorDodge(Player Player, Player.HurtInfo info) + { + // 17APR2024: Ozzatron: Abyssal Mirror is a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. + int abyssalMirrorDodgeIFrames = Player.ComputeDodgeIFrames(); + Player.GiveUniversalIFrames(abyssalMirrorDodgeIFrames, true); + + Player.Calamity().rogueStealth += 0.5f; + SoundEngine.PlaySound(SilvaArmor.ActivationSound, Player.Center); + + var source = Player.GetSource_Accessory(Player.Calamity().FindAccessory(ModContent.ItemType())); + for (int i = 0; i < 10; i++) + { + int damage = (int)Player.GetTotalDamage().ApplyTo(55); + + int lumenyl = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f), ModContent.ProjectileType(), damage, 0, Player.whoAmI); + Main.projectile[lumenyl].rotation = Main.rand.NextFloat(0, 360); + Main.projectile[lumenyl].frame = Main.rand.Next(0, 4); + if (lumenyl.WithinBounds(Main.maxProjectiles)) + Main.projectile[lumenyl].DamageType = DamageClass.Generic; + } + + // TODO -- Calamity dodges should probably not send a vanilla dodge packet considering that causes Tabi dust + if (Player.whoAmI == Main.myPlayer) + { + NetMessage.SendData(MessageID.Dodge, -1, -1, null, Player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + } + return "abyssmirror"; } public override void AddRecipes() diff --git a/Items/Accessories/AlchemicalDecanter.cs b/Items/Accessories/AlchemicalDecanter.cs index a463957cae..bea2f95e28 100644 --- a/Items/Accessories/AlchemicalDecanter.cs +++ b/Items/Accessories/AlchemicalDecanter.cs @@ -7,6 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { + [LegacyName("AlchemicalFlask")] public class AlchemicalDecanter : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; diff --git a/Items/Accessories/EclipseMirror.cs b/Items/Accessories/EclipseMirror.cs index 5c1f638a15..c9f19c4b3d 100644 --- a/Items/Accessories/EclipseMirror.cs +++ b/Items/Accessories/EclipseMirror.cs @@ -1,8 +1,14 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Balancing; +using CalamityMod.CalPlayer; +using CalamityMod.Cooldowns; using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -31,8 +37,32 @@ namespace CalamityMod.Items.Accessories player.GetCritChance() += 6; player.GetDamage() += 0.06f; player.aggro -= 700; + modPlayer.DodgeEffects.Add(EclipseMirrorDodge); } + public string EclipseMirrorDodge(Player Player, Player.HurtInfo info) + { + + // 17APR2024: Ozzatron: Eclipse Mirror is a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. + int eclipseMirrorDodgeIFrames = Player.ComputeDodgeIFrames(); + Player.GiveUniversalIFrames(eclipseMirrorDodgeIFrames, true); + + Player.Calamity().rogueStealth += 0.5f; + SoundEngine.PlaySound(SoundID.Item68, Player.Center); + + var source = Player.GetSource_Accessory(Player.Calamity().FindAccessory(ModContent.ItemType())); + int damage = (int)Player.GetTotalDamage().ApplyTo(2000); + + int eclipse = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0, Player.whoAmI); + if (eclipse.WithinBounds(Main.maxProjectiles)) + Main.projectile[eclipse].DamageType = DamageClass.Generic; + + // TODO -- Calamity dodges should probably not send a vanilla dodge packet considering that causes Tabi dust + NetMessage.SendData(MessageID.Dodge, -1, -1, null, Player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + return "eclipsemirror"; + } + + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/ScionsCurio.cs b/Items/Accessories/ScionsCurio.cs index 8cad959d1f..0a1d545869 100644 --- a/Items/Accessories/ScionsCurio.cs +++ b/Items/Accessories/ScionsCurio.cs @@ -8,6 +8,8 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Accessories { + [LegacyName("RustyMedallion")] + public class ScionsCurio : ModItem, ILocalizedModType { public static int postHitDamage = 45; diff --git a/Items/Accessories/ThePointer.cs b/Items/Accessories/ThePointer.cs new file mode 100644 index 0000000000..cbf05e1b17 --- /dev/null +++ b/Items/Accessories/ThePointer.cs @@ -0,0 +1,79 @@ +using System.Collections.Generic; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameInput; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class ThePointer : ModItem, ILocalizedModType + { + public static Asset ActiveTexture; + public new string LocalizationCategory => "Items.Accessories"; + public override void SetDefaults() + { + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.rare = ItemRarityID.Blue; + Item.accessory = true; + } + + public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.ThePointerLock); + + public override void UpdateAccessory(Player player, bool hideVisual) + { + LockOnHelper.ForceUsability = true; + if (CalamityKeybinds.ThePointerLock.JustPressed) + { + LockOnHelper.Toggle(); + if (LockOnHelper.AimedTarget != null) + { + Vector2 dir = player.DirectionTo(LockOnHelper.AimedTarget.Center); + int loops = (int)((player.Center.Distance(LockOnHelper.AimedTarget.Center)) / 30f) + 1; + for (var i = 1; i < loops; i++) + { + var pos = player.Center + dir * i * 30f; + if (i >= loops - 1) + pos = LockOnHelper.AimedTarget.Center - dir * 30f; + var x = new LineParticle(pos, dir, false, 10, 1, new Color(238, 2, 52)); + GeneralParticleHandler.SpawnParticle(x); + } + } + } + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + if (LockOnHelper.AimedTarget == null) + return true; + var tex = ActiveTexture ??= ModContent.Request("CalamityMod/Items/Accessories/ThePointer_Active"); + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + tex.Value, + position, + tex.Frame(), + drawColor, + itemColor, + tex.Size() * 0.5f, + 0.1f, + wantedScale: 0.75f); + return false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Glass). + AddRecipeGroup("AnyCopperBar", 2). + AddRecipeGroup("IronBar", 3). + AddIngredient(ItemID.ManaCrystal). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Accessories/ThePointer.png b/Items/Accessories/ThePointer.png new file mode 100644 index 0000000000..b6325d80d8 Binary files /dev/null and b/Items/Accessories/ThePointer.png differ diff --git a/Items/Accessories/ThePointer_Active.png b/Items/Accessories/ThePointer_Active.png new file mode 100644 index 0000000000..74259616a5 Binary files /dev/null and b/Items/Accessories/ThePointer_Active.png differ diff --git a/Items/Accessories/UnholyTonic.cs b/Items/Accessories/UnholyTonic.cs index 38c3be3023..bef8b0ba72 100644 --- a/Items/Accessories/UnholyTonic.cs +++ b/Items/Accessories/UnholyTonic.cs @@ -5,6 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { + [LegacyName("CorruptFlask")] public class UnholyTonic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; diff --git a/Items/Accessories/Vanity/BigE_Body.png b/Items/Accessories/Vanity/BigE_Body.png new file mode 100644 index 0000000000..0481014d4b Binary files /dev/null and b/Items/Accessories/Vanity/BigE_Body.png differ diff --git a/Items/Accessories/Vanity/BigE_Head.png b/Items/Accessories/Vanity/BigE_Head.png new file mode 100644 index 0000000000..e4098d1c64 Binary files /dev/null and b/Items/Accessories/Vanity/BigE_Head.png differ diff --git a/Items/Accessories/Vanity/BigE_Legs.png b/Items/Accessories/Vanity/BigE_Legs.png new file mode 100644 index 0000000000..fe9dd686ab Binary files /dev/null and b/Items/Accessories/Vanity/BigE_Legs.png differ diff --git a/Items/Accessories/Vanity/Charlotte_Body.png b/Items/Accessories/Vanity/Charlotte_Body.png new file mode 100644 index 0000000000..27919e7008 Binary files /dev/null and b/Items/Accessories/Vanity/Charlotte_Body.png differ diff --git a/Items/Accessories/Vanity/Charlotte_Head.png b/Items/Accessories/Vanity/Charlotte_Head.png new file mode 100644 index 0000000000..d0aa428649 Binary files /dev/null and b/Items/Accessories/Vanity/Charlotte_Head.png differ diff --git a/Items/Accessories/Vanity/Charlotte_Legs.png b/Items/Accessories/Vanity/Charlotte_Legs.png new file mode 100644 index 0000000000..300db9fe83 Binary files /dev/null and b/Items/Accessories/Vanity/Charlotte_Legs.png differ diff --git a/Items/Accessories/Vanity/GlimmeringRibbon.cs b/Items/Accessories/Vanity/GlimmeringRibbon.cs new file mode 100644 index 0000000000..81f20f7ec7 --- /dev/null +++ b/Items/Accessories/Vanity/GlimmeringRibbon.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Items.BaseItems; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories.Vanity +{ + internal class GlimmeringRibbon : TransformationAccessory, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + + public override (EquipType, string, string)[] EquipSlots => + [ + (EquipType.Head, "Charlotte", null), + (EquipType.Body, "Charlotte", null), + (EquipType.Legs, "Charlotte", null), + ]; + + public override void SetDefaults() + { + Item.width = 52; + Item.height = 46; + Item.accessory = true; + Item.vanity = true; + Item.rare = ItemRarityID.Blue; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.Calamity().devItem = true; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Silk, 10). + AddIngredient(ItemID.FallenStar, 3). + AddTile(TileID.Loom). + Register(); + } + } +} diff --git a/Items/Accessories/Vanity/GlimmeringRibbon.png b/Items/Accessories/Vanity/GlimmeringRibbon.png new file mode 100644 index 0000000000..f62ef7d2b7 Binary files /dev/null and b/Items/Accessories/Vanity/GlimmeringRibbon.png differ 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/LittleE.cs b/Items/Accessories/Vanity/LittleE.cs new file mode 100644 index 0000000000..5d0d6c9c25 --- /dev/null +++ b/Items/Accessories/Vanity/LittleE.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Items.BaseItems; +using Humanizer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories.Vanity +{ + public class LittleE : TransformationAccessory, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + + public override (EquipType, string, string)[] EquipSlots => + [ + (EquipType.Head, "BigE", null), + (EquipType.Body, "BigE", null), + (EquipType.Legs, "BigE", null), + ]; + + public override void SetStaticDefaults() + { + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 14)); + ItemID.Sets.AnimatesAsSoul[Type] = true; + ItemID.Sets.ShimmerTransformToItem[ItemID.AlphabetStatueE] = Type; + base.SetStaticDefaults(); + } + + public override void SetDefaults() + { + Item.width = 30; + Item.height = 32; + Item.accessory = true; + Item.vanity = true; + Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.Calamity().devItem = true; + } + + public override void ModifyTooltips(List tooltips) + { + string text = Language.GetTextValue("Mods.CalamityMod.Items.Accessories.LittleE.Tooltip").FormatWith(Main.LocalPlayer.name); + if (Item.social) + tooltips.Insert(1, new(CalamityMod.Instance, "Tooltip", text)); + else + tooltips[3].Text = text; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + var frame = Item.GetFrame(whoAmI); + var position = Item.Center - Main.screenPosition + Vector2.UnitY * 4; + var origin = frame.Size() / 2f; + spriteBatch.Draw(TextureAssets.Item[Type].Value, position, frame, lightColor, rotation, origin, scale, SpriteEffects.None, 0); + return false; + } + } +} diff --git a/Items/Accessories/Vanity/LittleE.png b/Items/Accessories/Vanity/LittleE.png new file mode 100644 index 0000000000..eda547514f Binary files /dev/null and b/Items/Accessories/Vanity/LittleE.png 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/Accessories/ViciousTonic.cs b/Items/Accessories/ViciousTonic.cs index 70908f43dd..6df1a140cd 100644 --- a/Items/Accessories/ViciousTonic.cs +++ b/Items/Accessories/ViciousTonic.cs @@ -5,6 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { + [LegacyName("CrimsonFlask")] public class ViciousTonic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; diff --git a/Items/Accessories/WarbanneroftheRighteous.cs b/Items/Accessories/WarbanneroftheRighteous.cs index 60899e5cd8..78fcb24d41 100644 --- a/Items/Accessories/WarbanneroftheRighteous.cs +++ b/Items/Accessories/WarbanneroftheRighteous.cs @@ -77,8 +77,8 @@ namespace CalamityMod.Items.Accessories if (Utils.Distance(nPC.Center, player.Center) < MaxDistance + generousHitboxWidth && (nPC.IsAnEnemy(true, true, false) || nPC.type == ModContent.NPCType()) && !nPC.dontTakeDamage) { - float minDamageMult = 0.35f; - int maxTargets = 25; + float minDamageMult = 0.10f; + int maxTargets = 7; float damageMult = Utils.Remap(targetCount, maxTargets, 1, minDamageMult, 1); // Handles giving the Warbanner Burn effect 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/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index 0d8d83a5e4..a3bf25dbd3 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using CalamityMod.Enums; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Fishing; using CalamityMod.Items.Materials; using CalamityMod.Items.PermanentBoosters; @@ -307,13 +308,22 @@ namespace CalamityMod.Items loot.Add(ModContent.ItemType(), 2, 2, 5); break; + case ItemID.OasisCrate: + loot.Add(ModContent.ItemType(), 8); + break; + + case ItemID.OasisCrateHard: + RemoveHardmodeOresFromBiomeCrates(loot); + loot.AddHardmodeOresToCrates(HardmodeCrateType.Biome); + loot.Add(ModContent.ItemType(), 8); + break; + case ItemID.CorruptFishingCrateHard: case ItemID.CrimsonFishingCrateHard: case ItemID.HallowedFishingCrateHard: case ItemID.DungeonFishingCrateHard: case ItemID.JungleFishingCrateHard: case ItemID.LavaCrateHard: - case ItemID.OasisCrateHard: case ItemID.OceanCrateHard: RemoveHardmodeOresFromBiomeCrates(loot); loot.AddHardmodeOresToCrates(HardmodeCrateType.Biome); diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 8f5805f853..30346a9b56 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -679,6 +679,19 @@ namespace CalamityMod.Items || item.type == ItemID.QueenSlimeCrystal || item.type == ItemID.MechanicalEye || item.type == ItemID.MechanicalWorm || item.type == ItemID.MechanicalSkull || item.type == ItemID.CelestialSigil) EditTooltipByNum(0, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.NotConsumable")); #endregion + // Brain of Confusion, Black Belt and Master Ninja Gear have guaranteed dodges with a fixed cooldown. + #region Guaranteed Dodge Tooltips + if (item.type == ItemID.BlackBelt) + EditTooltipByNum(0, (line) => line.Text = CalamityUtils.GetTextValue("Common.DodgeProvided") + "\n" + CalamityUtils.GetTextValue("Common.DodgeInformation")); + if (item.type == ItemID.MasterNinjaGear) + EditTooltipByNum(1, (line) => line.Text = CalamityUtils.GetTextValue("Common.DodgeProvided") + "\n" + CalamityUtils.GetTextValue("Common.DodgeInformation")); + if (item.type == ItemID.BrainOfConfusion) + { + EditTooltipByNum(0, (line) => line.Text = CalamityUtils.GetTextValue("Common.DodgeProvided")); + + EditTooltipByNum(2, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.DodgeInformation")); + } + #endregion // Whip tag is dynamically generated for all whips based on the SummonTagDebuffDict, so we'll remove the vanilla tag tootlips. #region Whip Tag removal @@ -706,13 +719,6 @@ namespace CalamityMod.Items #endregion #region Accessories - // Brain of Confusion, Black Belt and Master Ninja Gear have guaranteed dodges with a fixed cooldown. - if (item.type == ItemID.BlackBelt) - EditTooltipByNum(0, (line) => line.Text = CalamityUtils.GetText("Vanilla.DodgeInfo").Format(BalancingConstants.BeltDodgeCooldownMin / 60, BalancingConstants.BeltDodgeCooldownMax / 60)); - if (item.type == ItemID.MasterNinjaGear) - EditTooltipByNum(1, (line) => line.Text = CalamityUtils.GetText("Vanilla.DodgeInfo").Format(BalancingConstants.BeltDodgeCooldownMin / 60, BalancingConstants.BeltDodgeCooldownMax / 60)); - if (item.type == ItemID.BrainOfConfusion) - EditTooltipByNum(0, (line) => line.Text = CalamityUtils.GetText("Vanilla.DodgeInfo").Format(BalancingConstants.BrainDodgeCooldownMin / 60, BalancingConstants.BrainDodgeCooldownMax / 60)); // Nerfed Ancient Chisel and its upgrade. if (item.type == ItemID.AncientChisel) @@ -1488,7 +1494,7 @@ namespace CalamityMod.Items #region Enchanted Rarity Text Drawing public override bool PreDrawTooltipLine(Item item, DrawableTooltipLine line, ref int yOffset) { - if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType()) + if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType() && CalamityClientConfig.Instance.TextEffects) { Color rarityColor = Color.White; Vector2 basePosition = new Vector2(line.X, line.Y); @@ -1549,7 +1555,7 @@ namespace CalamityMod.Items return false; } - if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType()) + if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType() && CalamityClientConfig.Instance.TextEffects) { Color rarityColor = Color.White; Vector2 basePosition = new Vector2(line.X, line.Y); diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 23720f97f6..6c604ce7de 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -312,7 +312,7 @@ namespace CalamityMod.Items { ItemID.BonePickaxe, Do(UseTimeExact(6)) }, { ItemID.BorealWoodHammer, Do(HammerPower(25), UseTimeExact(11)) }, { ItemID.ButchersChainsaw, Do(TrueMeleeNoSpeed, UseTimeExact(3), TileBoostExact(+0)) }, - { ItemID.CactusPickaxe, Do(PickPower(34), UseTimeExact(9)) }, + { ItemID.CactusPickaxe, Do(UseTimeExact(9)) }, { ItemID.CnadyCanePickaxe, Do(UseTimeExact(9), TileBoostExact(+1)) }, // Candy Cane Pickaxe { ItemID.ChlorophyteChainsaw, Do(TrueMeleeNoSpeed, AxePower(120), UseTimeExact(3), DamageExact(112)) }, { ItemID.ChlorophyteDrill, Do(TrueMeleeNoSpeed, TileBoostExact(+2), DamageExact(43)) }, diff --git a/Items/Materials/AnodizedWulfrumMetal.cs b/Items/Materials/AnodizedWulfrumMetal.cs index 6dfcdf503f..2ba026b29c 100644 --- a/Items/Materials/AnodizedWulfrumMetal.cs +++ b/Items/Materials/AnodizedWulfrumMetal.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,7 +21,6 @@ namespace CalamityMod.Items.Materials Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(copper: 10); Item.rare = ItemRarityID.Blue; - Item.ammo = Item.type; } public override void AddRecipes() { @@ -29,6 +29,11 @@ namespace CalamityMod.Items.Materials AddIngredient(). AddTile(TileID.WorkBenches). Register(); + + CreateRecipe(). + AddIngredient(2). + DisableDecraft(). + Register(); } //Added to avoid making the recipes really repetitive and nonsensical. It also makes the new metal color make sense. Adds a bit of flavor to the Wulfrum Recipes //Uses Stormlion Manible because in order to anodize a metal you must use a current, the other option was a Power Cell but I feel Stormlion Mandible needed more uses diff --git a/Items/Materials/WulfrumMetalScrap.cs b/Items/Materials/WulfrumMetalScrap.cs index 16a60a5e7d..b9f3e2b0da 100644 --- a/Items/Materials/WulfrumMetalScrap.cs +++ b/Items/Materials/WulfrumMetalScrap.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Accessories; +using CalamityMod.Items.Placeables.FurnitureWulfrum; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -95,6 +96,14 @@ namespace CalamityMod.Items.Materials } } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(2). + DisableDecraft(). + Register(); + } + public override void Load() { Terraria.On_Item.CanFillEmptyAmmoSlot += AvoidDefaultingToAmmoSlot; diff --git a/Items/Placeables/Furniture/Monoliths/OldDukeMonolith.cs b/Items/Placeables/Furniture/Monoliths/EldenDiorama.cs similarity index 81% rename from Items/Placeables/Furniture/Monoliths/OldDukeMonolith.cs rename to Items/Placeables/Furniture/Monoliths/EldenDiorama.cs index 4d3d7874cd..8320c8b167 100644 --- a/Items/Placeables/Furniture/Monoliths/OldDukeMonolith.cs +++ b/Items/Placeables/Furniture/Monoliths/EldenDiorama.cs @@ -1,18 +1,20 @@ using CalamityMod.ForegroundDrawing.LoopingTextures; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.Monoliths; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Monoliths { - public class OldDukeMonolith : ModItem, ILocalizedModType + [LegacyName("OldDukeMonolith")] + public class EldenDiorama : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.buyPrice(gold: 25); // Sold by Archmage - Item.rare = ItemRarityID.Pink; + Item.value = Item.sellPrice(gold: 20); + Item.rare = ModContent.RarityType(); Item.accessory = true; Item.vanity = true; } diff --git a/Items/Placeables/Furniture/Monoliths/OldDukeMonolith.png b/Items/Placeables/Furniture/Monoliths/EldenDiorama.png similarity index 100% rename from Items/Placeables/Furniture/Monoliths/OldDukeMonolith.png rename to Items/Placeables/Furniture/Monoliths/EldenDiorama.png diff --git a/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs b/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs index 8a6b1328d5..f98612ef5b 100644 --- a/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs @@ -51,12 +51,11 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings { "Altixal", "apotofkoolaid", - "AquaSG", "Atalya", "Ben-TK", "Big E", + "carnymassacre", "CDMusic", - "Cei", "CongratsIsTrash", "Cooper", "CosmaticMango", @@ -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,12 +94,14 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Alphi", "Altalyra", "Amadis", + "AquaSG", "AstroKnight", "Blast", "Blastitle", "Blockaroz", "Boffin", "Bravioli", + "Cei", "Chetto", "Chill Dude", "Cobalion", @@ -120,6 +115,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "DylanDoe21", "Earth", "EchoDuck", + "Eddie Spaghetti", "Ein", "enamoured", "Enreden", @@ -150,14 +146,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 +165,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Pinkie Poss", "Poly", "Popo", + "Poroboros", "President Waluigi", "Puff", "Purple Necromancer", @@ -180,6 +180,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "SixteenInMono", "Skeletony", "Sok", + "Spider Prov", "spooktacular", "Spoopyro", "Svante", @@ -192,6 +193,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Trivaxy", "Tobias", "Uberransy", + "Uncle Danny", "Vaikyia", "Vladimier", "Yatagarasu", diff --git a/Items/Placeables/FurnitureAuric/AuricLandMine.cs b/Items/Placeables/FurnitureAuric/AuricLandMine.cs index eb3c2cd940..b448035714 100644 --- a/Items/Placeables/FurnitureAuric/AuricLandMine.cs +++ b/Items/Placeables/FurnitureAuric/AuricLandMine.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric public override void SetStaticDefaults() { + Item.ResearchUnlockCount = 5; // Did you know Land Mines can be placed on Weapon Racks? Yeah, me neither. ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; } diff --git a/Items/Placeables/FurnitureDriftwood/Driftwood.cs b/Items/Placeables/FurnitureDriftwood/Driftwood.cs index 0c707086a7..f041b00d8e 100644 --- a/Items/Placeables/FurnitureDriftwood/Driftwood.cs +++ b/Items/Placeables/FurnitureDriftwood/Driftwood.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureDriftwood public override void AddRecipes() { - CreateRecipe(4). + CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). DisableDecraft(). diff --git a/Items/Placeables/FurnitureStatigel/StaticRefiner.cs b/Items/Placeables/FurnitureStatigel/StaticRefiner.cs index 3cb6680fe6..5535d37822 100644 --- a/Items/Placeables/FurnitureStatigel/StaticRefiner.cs +++ b/Items/Placeables/FurnitureStatigel/StaticRefiner.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.sellPrice(gold: 2); + Item.value = Item.sellPrice(silver: 5); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPanels.cs b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPanels.cs index 2e81833872..b7b766c686 100644 --- a/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPanels.cs +++ b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPanels.cs @@ -21,11 +21,6 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddIngredient(). AddTile(TileID.HeavyWorkBench). Register(); - //CreateRecipe(). - // AddIngredient(4). - // AddTile(TileID.WorkBenches). - // DisableDecraft(). - // Register(); } } } diff --git a/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumTrim.cs b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumTrim.cs index 217e10347b..e763e16d37 100644 --- a/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumTrim.cs +++ b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumTrim.cs @@ -21,11 +21,6 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddIngredient(). AddTile(TileID.HeavyWorkBench). Register(); - //CreateRecipe(). - // AddIngredient(4). - // AddTile(TileID.WorkBenches). - // DisableDecraft(). - // Register(); } } } diff --git a/Items/Placeables/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.cs b/Items/Placeables/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.cs index 5e8ceacfb0..41f3468797 100644 --- a/Items/Placeables/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.cs +++ b/Items/Placeables/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; using Terraria.ID; using Terraria.ModLoader; @@ -21,11 +22,11 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddIngredient(). AddTile(TileID.HeavyWorkBench). Register(); - //CreateRecipe(). - // AddIngredient(4). - // AddTile(TileID.WorkBenches). - // DisableDecraft(). - // Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + DisableDecraft(). + Register(); } } } diff --git a/Items/Placeables/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.cs b/Items/Placeables/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.cs index efdd3e9678..dc17969494 100644 --- a/Items/Placeables/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.cs +++ b/Items/Placeables/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; using Terraria.ID; using Terraria.ModLoader; @@ -22,11 +23,11 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddIngredient(). AddTile(TileID.HeavyWorkBench). Register(); - //CreateRecipe(). - // AddIngredient(4). - // AddTile(TileID.WorkBenches). - // DisableDecraft(). - // Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + DisableDecraft(). + Register(); } } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumEnergyBarrier.cs b/Items/Placeables/FurnitureWulfrum/WulfrumEnergyBarrier.cs index d59706138c..82f3320f9d 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumEnergyBarrier.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumEnergyBarrier.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; using Terraria.ID; using Terraria.ModLoader; @@ -21,11 +22,11 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddIngredient(). AddTile(TileID.HeavyWorkBench). Register(); - //CreateRecipe(). - // AddIngredient(4). - // AddTile(TileID.WorkBenches). - // DisableDecraft(). - // Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + DisableDecraft(). + Register(); } } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumPanels.cs b/Items/Placeables/FurnitureWulfrum/WulfrumPanels.cs index d1a1221b0a..943812a0cb 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumPanels.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumPanels.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; using Terraria.ID; using Terraria.ModLoader; @@ -21,11 +22,11 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddIngredient(). AddTile(TileID.Furnaces). Register(); - //CreateRecipe(). - // AddIngredient(4). - // AddTile(TileID.WorkBenches). - // DisableDecraft(). - // Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + DisableDecraft(). + Register(); } } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumSheets.cs b/Items/Placeables/FurnitureWulfrum/WulfrumSheets.cs index b88c79d9c1..c55c15c43d 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumSheets.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumSheets.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; using Terraria.ID; using Terraria.ModLoader; @@ -21,11 +22,11 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddIngredient(). AddTile(TileID.Furnaces). Register(); - //CreateRecipe(). - // AddIngredient(4). - // AddTile(TileID.WorkBenches). - // DisableDecraft(). - // Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + DisableDecraft(). + Register(); } } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumSiding.cs b/Items/Placeables/FurnitureWulfrum/WulfrumSiding.cs index a10cbbc284..415a70b551 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumSiding.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumSiding.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; using Terraria.ID; using Terraria.ModLoader; @@ -22,11 +23,11 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddIngredient(). AddTile(TileID.Furnaces). Register(); - //CreateRecipe(). - // AddIngredient(4). - // AddTile(TileID.WorkBenches). - // DisableDecraft(). - // Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + DisableDecraft(). + Register(); } } } diff --git a/Items/Placeables/SunkenSea/OrangeCoral.cs b/Items/Placeables/SunkenSea/OrangeCoral.cs index 02ddc9fdfa..3b253027e8 100644 --- a/Items/Placeables/SunkenSea/OrangeCoral.cs +++ b/Items/Placeables/SunkenSea/OrangeCoral.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() diff --git a/Items/Placeables/Walls/DriftwoodWall.cs b/Items/Placeables/Walls/DriftwoodWall.cs index dad7d4bf22..a89f530907 100644 --- a/Items/Placeables/Walls/DriftwoodWall.cs +++ b/Items/Placeables/Walls/DriftwoodWall.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Walls public override void AddRecipes() { - CreateRecipe(). + CreateRecipe(4). AddIngredient(). AddTile(TileID.WorkBenches). Register(); diff --git a/Items/Potions/Alcohol/StarBeamRye.cs b/Items/Potions/Alcohol/StarBeamRye.cs index ffdfc3aca0..bbc2dc0f21 100644 --- a/Items/Potions/Alcohol/StarBeamRye.cs +++ b/Items/Potions/Alcohol/StarBeamRye.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Items.Potions.Alcohol { public new string LocalizationCategory => "Items.Potions"; - public static float MaxManaBoost = 0.5f; - public static float ManaRegenBoost = 2f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ManaRegenBoost.ToPercent(),(1-MaxManaBoost).ToPercent()); + public static float MagicDmgMult = 0.9f; + public static int ManaRegenBoost = 30; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MagicDmgMult); public override void SetStaticDefaults() { diff --git a/Items/Potions/Food/Barberry.cs b/Items/Potions/Food/Barberry.cs index f81b940201..f52921b691 100644 --- a/Items/Potions/Food/Barberry.cs +++ b/Items/Potions/Food/Barberry.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Potions.Food { Item.DefaultToFood(26, 32, BuffID.WellFed2, CalamityUtils.MinutesToFrames(5)); Item.value = Item.sellPrice(silver: 20); - Item.rare = ItemRarityID.Blue; + Item.rare = ItemRarityID.Green; } } } diff --git a/Items/Potions/Food/Cometfruit.cs b/Items/Potions/Food/Cometfruit.cs index 8b80cdc0d6..af0d7bc1af 100644 --- a/Items/Potions/Food/Cometfruit.cs +++ b/Items/Potions/Food/Cometfruit.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Potions.Food { Item.DefaultToFood(32, 32, BuffID.WellFed2, CalamityUtils.MinutesToFrames(5)); Item.value = Item.sellPrice(silver: 20); - Item.rare = ItemRarityID.Blue; + Item.rare = ItemRarityID.Green; } } } diff --git a/Items/Potions/Food/Lotus.cs b/Items/Potions/Food/Lotus.cs index ecabc71b53..3852ea70c9 100644 --- a/Items/Potions/Food/Lotus.cs +++ b/Items/Potions/Food/Lotus.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Potions.Food { Item.DefaultToFood(26, 32, BuffID.WellFed2, CalamityUtils.MinutesToFrames(5)); Item.value = Item.sellPrice(silver: 20); - Item.rare = ItemRarityID.Blue; + Item.rare = ItemRarityID.Green; } } } diff --git a/Items/Potions/Food/Mangosteen.cs b/Items/Potions/Food/Mangosteen.cs index 4c77a549b0..7da4511dd8 100644 --- a/Items/Potions/Food/Mangosteen.cs +++ b/Items/Potions/Food/Mangosteen.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Potions.Food { Item.DefaultToFood(30, 32, BuffID.WellFed2, CalamityUtils.MinutesToFrames(5)); Item.value = Item.sellPrice(silver: 20); - Item.rare = ItemRarityID.Blue; + Item.rare = ItemRarityID.Green; } } } diff --git a/Items/Tools/DriftwoodHammer.cs b/Items/Tools/DriftwoodHammer.cs index a49cc26b67..4db3883330 100644 --- a/Items/Tools/DriftwoodHammer.cs +++ b/Items/Tools/DriftwoodHammer.cs @@ -35,18 +35,14 @@ namespace CalamityMod.Items.Tools // The tool is mechanically faster when wet. public override float UseTimeMultiplier(Player player) { - bool surface = player.Center.Y < Main.worldSurface * 16.0; - bool GetEffects = ((Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet)); - if (GetEffects) + if (player.Calamity().countsAsAnyWet) return (float)FasterUseTime / NormalUseTime; return base.UseTimeMultiplier(player); } public override void MeleeEffects(Player player, Rectangle hitbox) { - bool surface = player.Center.Y < Main.worldSurface * 16.0; - bool GetEffects = ((Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet)); - if (GetEffects) + if (player.Calamity().countsAsAnyWet) Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.MagnetSphere); } diff --git a/Items/TreasureBags/LeviathanBag.cs b/Items/TreasureBags/LeviathanBag.cs index d567825dd0..d376adb253 100644 --- a/Items/TreasureBags/LeviathanBag.cs +++ b/Items/TreasureBags/LeviathanBag.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Items.TreasureBags // Vanity itemLoot.Add(ModContent.ItemType(), 7); itemLoot.Add(ModContent.ItemType(), 7); - itemLoot.Add(ModContent.ItemType(), 15); + itemLoot.Add(ModContent.ItemType(), 10); itemLoot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); } } diff --git a/Items/TreasureBags/MiscGrabBags/StarterBag.cs b/Items/TreasureBags/MiscGrabBags/StarterBag.cs index 4e1d2b5ad8..183622612b 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) @@ -132,6 +123,26 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags } itemLoot.AddIf(getsOracleHeadphones, ModContent.ItemType()); + + // Big E dev vanity + // Name specific: "Big E" in any form + static bool getsLittleE(DropAttemptInfo info) + { + string playerName = info.player.name.ToLower(); + return playerName is "big e" or "bige"; + } + + itemLoot.AddIf(getsLittleE, ModContent.ItemType()); + + // Sagittariod dev vanity + // Name specific: "Sagi" or "Sagittariod" (case insensitive + static bool getsShimmeringRibbon(DropAttemptInfo info) + { + string playerName = info.player.name.ToLower(); + return playerName is "sagi" or "sagittariod"; + } + + itemLoot.AddIf(getsShimmeringRibbon, ModContent.ItemType()); } } } diff --git a/Items/TreasureBags/OldDukeBag.cs b/Items/TreasureBags/OldDukeBag.cs index 13f3b10b35..4bcf2c05e5 100644 --- a/Items/TreasureBags/OldDukeBag.cs +++ b/Items/TreasureBags/OldDukeBag.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.Placeables.Furniture.Paintings; +using CalamityMod.Items.Placeables.Furniture.Monoliths; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -79,6 +80,7 @@ namespace CalamityMod.Items.TreasureBags // Vanity itemLoot.Add(ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 10); itemLoot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); } } 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/DeathValleyDuster.cs b/Items/Weapons/Magic/DeathValleyDuster.cs index 78a54eeab3..c0d2667ca8 100644 --- a/Items/Weapons/Magic/DeathValleyDuster.cs +++ b/Items/Weapons/Magic/DeathValleyDuster.cs @@ -1,9 +1,10 @@ using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; -using Terraria.Audio; -using Microsoft.Xna.Framework; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic @@ -12,6 +13,9 @@ namespace CalamityMod.Items.Weapons.Magic public class DeathValleyDuster : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public static int BuffDefenseBoost = PrimordialEarth.BuffDefenseBoost; + public static float BuffDamageBoost = PrimordialEarth.BuffDamageBoost; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(BuffDefenseBoost, BuffDamageBoost.ToPercent()); public override void SetDefaults() { Item.width = 36; 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/UnstableCastersGauntlet.cs b/Items/Weapons/Magic/UnstableCastersGauntlet.cs index 1aff49b38d..f83fcc004f 100644 --- a/Items/Weapons/Magic/UnstableCastersGauntlet.cs +++ b/Items/Weapons/Magic/UnstableCastersGauntlet.cs @@ -36,7 +36,6 @@ namespace CalamityMod.Items.Weapons.Magic public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - public override bool CanRightClick() => true; public override bool AltFunctionUse(Player player) => true; public override void HoldItem(Player player) 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/DeathsAscension.cs b/Items/Weapons/Melee/DeathsAscension.cs index b180aeca3d..4d1b2516d2 100644 --- a/Items/Weapons/Melee/DeathsAscension.cs +++ b/Items/Weapons/Melee/DeathsAscension.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 70; Item.height = 70; - Item.damage = 1200; + Item.damage = 900; Item.knockBack = 9f; Item.useAnimation = Item.useTime = 24; Item.DamageType = DamageClass.Melee; 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/DriftwoodSword.cs b/Items/Weapons/Melee/DriftwoodSword.cs index 3860343caf..ffda7cc8d6 100644 --- a/Items/Weapons/Melee/DriftwoodSword.cs +++ b/Items/Weapons/Melee/DriftwoodSword.cs @@ -28,13 +28,13 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { - if (IsPlayerInContactWithWater(player)) + if (player.Calamity().countsAsAnyWet) Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.MagnetSphere); } - public override float UseSpeedMultiplier(Player player) => IsPlayerInContactWithWater(player) ? 1.66f : 1f; + public override float UseSpeedMultiplier(Player player) => player.Calamity().countsAsAnyWet ? 1.66f : 1f; - public override void ModifyWeaponKnockback(Player player, ref StatModifier knockback) => knockback.Base += IsPlayerInContactWithWater(player) ? 1.5f : 0f; + public override void ModifyWeaponKnockback(Player player, ref StatModifier knockback) => knockback.Base += player.Calamity().countsAsAnyWet ? 1.5f : 0f; public override void AddRecipes() { @@ -43,11 +43,5 @@ namespace CalamityMod.Items.Weapons.Melee AddTile(TileID.WorkBenches). Register(); } - - private static bool IsPlayerInContactWithWater(Player player) - { - bool surface = player.Center.Y < Main.worldSurface * 16.0; - return (Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet); - } } } 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/GildedProboscis.cs b/Items/Weapons/Melee/GildedProboscis.cs index baa7683d14..6fdeb93033 100644 --- a/Items/Weapons/Melee/GildedProboscis.cs +++ b/Items/Weapons/Melee/GildedProboscis.cs @@ -4,6 +4,8 @@ using CalamityMod.Projectiles.Melee.Spears; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System.Collections.Generic; +using System.Linq; namespace CalamityMod.Items.Weapons.Melee { @@ -18,6 +20,13 @@ namespace CalamityMod.Items.Weapons.Melee base.SetStaticDefaults(); } public override bool SizeModifiers => false; + + public override void ModifyTooltips(List tooltips) + { + float cdmg = 2f + Main.LocalPlayer.Calamity().critDamage + Main.LocalPlayer.GetTotalCritChance(TrueMeleeNoSpeedDamageClass.Instance) * 0.02f; + tooltips.FirstOrDefault(x => x.Name == "CritChance")!.Text = CalamityUtils.GetText("Common.CritDamageTootip").Format(cdmg.ToPercent()); + + } public override void SetDefaults() { Item.width = 66; 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/HolyCollider.cs b/Items/Weapons/Melee/HolyCollider.cs index bb54a11859..481ff370dd 100644 --- a/Items/Weapons/Melee/HolyCollider.cs +++ b/Items/Weapons/Melee/HolyCollider.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 114; Item.height = 146; Item.damage = 3140; - Item.DamageType = DamageClass.Melee; + Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = 45; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 45; 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/Lightspeed.cs b/Items/Weapons/Melee/Lightspeed.cs index 97b6bc2f38..4c0551e7cb 100644 --- a/Items/Weapons/Melee/Lightspeed.cs +++ b/Items/Weapons/Melee/Lightspeed.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 74; Item.height = 94; Item.useStyle = ItemUseStyleID.Shoot; - Item.damage = 234; + Item.damage = 220; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 20; Item.shootSpeed = 10f; diff --git a/Items/Weapons/Melee/MirrorBlade.cs b/Items/Weapons/Melee/MirrorBlade.cs index bd822fed9e..3152bb7eb5 100644 --- a/Items/Weapons/Melee/MirrorBlade.cs +++ b/Items/Weapons/Melee/MirrorBlade.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 114; Item.height = 128; - Item.damage = 550; + Item.damage = 600; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = 40; Item.useTime = 40; diff --git a/Items/Weapons/Melee/MonolithSword.cs b/Items/Weapons/Melee/MonolithSword.cs index 911473b62a..a04e7b32fe 100644 --- a/Items/Weapons/Melee/MonolithSword.cs +++ b/Items/Weapons/Melee/MonolithSword.cs @@ -4,6 +4,7 @@ using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Melee public class MonolithSword : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static int ArmorPenetration = 15; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ArmorPenetration); + public override void SetDefaults() { Item.damage = 30; @@ -25,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTurn = true; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; - Item.ArmorPenetration = 15; + Item.ArmorPenetration = ArmorPenetration; } public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { 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/SausageMaker.cs b/Items/Weapons/Melee/SausageMaker.cs index 437408836f..a68101c08b 100644 --- a/Items/Weapons/Melee/SausageMaker.cs +++ b/Items/Weapons/Melee/SausageMaker.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 44; Item.height = 42; - Item.damage = 36; + Item.damage = 32; Item.DamageType = TrueMeleeDamageClass.Instance; Item.noMelee = true; Item.useTurn = 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/Melee/StellarStriker.cs b/Items/Weapons/Melee/StellarStriker.cs index caa4050981..9445abfed3 100644 --- a/Items/Weapons/Melee/StellarStriker.cs +++ b/Items/Weapons/Melee/StellarStriker.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 100; Item.height = 118; - Item.damage = 143; + Item.damage = 123; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 28; diff --git a/Items/Weapons/Melee/Tumbleweed.cs b/Items/Weapons/Melee/Tumbleweed.cs index 2a919c9a8b..ec82471f8a 100644 --- a/Items/Weapons/Melee/Tumbleweed.cs +++ b/Items/Weapons/Melee/Tumbleweed.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 44; Item.height = 36; - Item.damage = 63; + Item.damage = 78; Item.DamageType = DamageClass.MeleeNoSpeed; Item.useTime = 20; Item.useAnimation = 20; diff --git a/Items/Weapons/Melee/UrchinMace.cs b/Items/Weapons/Melee/UrchinMace.cs index ff90145473..b41bea3fbe 100644 --- a/Items/Weapons/Melee/UrchinMace.cs +++ b/Items/Weapons/Melee/UrchinMace.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 42; Item.height = 48; - Item.damage = 23; + Item.damage = 15; Item.channel = true; Item.noUseGraphic = true; Item.noMelee = true; diff --git a/Items/Weapons/Melee/Violence.cs b/Items/Weapons/Melee/Violence.cs index 84b8de2cdc..22c0b05054 100644 --- a/Items/Weapons/Melee/Violence.cs +++ b/Items/Weapons/Melee/Violence.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = Item.height = 142; - Item.damage = 435; + Item.damage = 485; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.useTurn = true; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Melee { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; player.itemAnimation = player.itemAnimationMax = player.itemTime = player.itemTimeMax = 60; - Projectile.NewProjectile(source, position, velocity*1.6666f, type, (int)(damage * 20), knockback, player.whoAmI, 0f, velocity.ToRotation(), 0); + Projectile.NewProjectile(source, position, velocity*1.6666f, type, (int)(damage * 15), knockback, player.whoAmI, 0f, velocity.ToRotation(), 0); } else Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, velocity.ToRotation(), 1); diff --git a/Items/Weapons/Ranged/DriftwoodBow.cs b/Items/Weapons/Ranged/DriftwoodBow.cs index 500a1cbc66..f25de79fa3 100644 --- a/Items/Weapons/Ranged/DriftwoodBow.cs +++ b/Items/Weapons/Ranged/DriftwoodBow.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { - if (IsPlayerInContactWithWater(player)) + if (player.Calamity().countsAsAnyWet) { velocity *= 1.3f; knockback += 1f; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Ranged } } - public override float UseSpeedMultiplier(Player player) => IsPlayerInContactWithWater(player) ? 1.2f : 1f; + public override float UseSpeedMultiplier(Player player) => player.Calamity().countsAsAnyWet ? 1.2f : 1f; public override void AddRecipes() { @@ -54,11 +54,5 @@ namespace CalamityMod.Items.Weapons.Ranged AddTile(TileID.WorkBenches). Register(); } - - private static bool IsPlayerInContactWithWater(Player player) - { - bool surface = player.Center.Y < Main.worldSurface * 16.0; - return (Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet); - } } } diff --git a/Items/Weapons/Ranged/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs index 97a65d7165..6e437428fa 100644 --- a/Items/Weapons/Ranged/FetidEmesis.cs +++ b/Items/Weapons/Ranged/FetidEmesis.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 76; Item.height = 46; - Item.damage = 224; + Item.damage = 214; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = 6; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/Hellborn.cs b/Items/Weapons/Ranged/Hellborn.cs index 4dd558e453..c4ef471c26 100644 --- a/Items/Weapons/Ranged/Hellborn.cs +++ b/Items/Weapons/Ranged/Hellborn.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 62; Item.height = 34; - Item.damage = 423; + Item.damage = 300; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Shoot; 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/TauCannon.cs b/Items/Weapons/Ranged/TauCannon.cs index 5028dacd09..8b3fae30d1 100644 --- a/Items/Weapons/Ranged/TauCannon.cs +++ b/Items/Weapons/Ranged/TauCannon.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.useStyle = ItemUseStyleID.Shoot; + Item.Calamity().donorItem = true; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; 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/ContaminatedBile.cs b/Items/Weapons/Rogue/ContaminatedBile.cs index 242728ea3f..1def6965f7 100644 --- a/Items/Weapons/Rogue/ContaminatedBile.cs +++ b/Items/Weapons/Rogue/ContaminatedBile.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = Item.height = 24; - Item.damage = 18; + Item.damage = 16; Item.useAnimation = Item.useTime = 40; Item.noMelee = true; Item.noUseGraphic = true; 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/Rogue/Glaive.cs b/Items/Weapons/Rogue/Glaive.cs index 3c10931c2e..9cbb1edc4a 100644 --- a/Items/Weapons/Rogue/Glaive.cs +++ b/Items/Weapons/Rogue/Glaive.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 34; Item.height = 32; - Item.damage = 25; + Item.damage = 22; Item.DamageType = RogueDamageClass.Instance; Item.autoReuse = true; Item.noMelee = true; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue } public override float StealthVelocityMultiplier => 1.3f; - public override float StealthDamageMultiplier => 0.5f; + public override float StealthDamageMultiplier => 0.6f; public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 6; 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/Rogue/Kylie.cs b/Items/Weapons/Rogue/Kylie.cs index f8848e07eb..6ed83a923b 100644 --- a/Items/Weapons/Rogue/Kylie.cs +++ b/Items/Weapons/Rogue/Kylie.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 34; Item.height = 50; - Item.damage = 15; + Item.damage = 12; Item.knockBack = 12; Item.DamageType = RogueDamageClass.Instance; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; diff --git a/Items/Weapons/Rogue/SporeKnife.cs b/Items/Weapons/Rogue/SporeKnife.cs index 5c05d20d3e..9a5b9bf81e 100644 --- a/Items/Weapons/Rogue/SporeKnife.cs +++ b/Items/Weapons/Rogue/SporeKnife.cs @@ -1,6 +1,7 @@ using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +9,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class SporeKnife : RogueWeapon { + public static readonly SoundStyle ThrowSound = new SoundStyle("CalamityMod/Sounds/Item/SporeKnifeThrow", 1, 2) with { PitchVariance = 0.2f, MaxInstances = 2 }; + public static readonly SoundStyle ImpactSound = new SoundStyle("CalamityMod/Sounds/Item/SporeKnifeImpact") with { PitchVariance = 0.25f, MaxInstances = 10 }; + public static readonly SoundStyle StealthImpactSound = new SoundStyle("CalamityMod/Sounds/Item/SporeKnifeStealthImpact"); + public static readonly SoundStyle ChompSound = new SoundStyle("CalamityMod/Sounds/Item/SporeKnifeChomp", 1, 3) with { PitchVariance = 0.25f, MaxInstances = 10 }; public override void SetDefaults() { Item.width = 12; @@ -32,6 +37,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { + SoundEngine.PlaySound(ThrowSound, position); int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/Vega.cs b/Items/Weapons/Rogue/Vega.cs index d44040ddb9..c4943e230d 100644 --- a/Items/Weapons/Rogue/Vega.cs +++ b/Items/Weapons/Rogue/Vega.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 82; Item.height = 82; - Item.damage = 531; + Item.damage = 500; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 20; @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.2f; + public override float StealthDamageMultiplier => 1f; public override void HoldItem(Player player) { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; 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.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 1ac9553158..8a6d3c9d39 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -86,7 +86,7 @@ ScrewdriverBuff: { StarBeamRyeBuff: { DisplayName: Star Beam Rye - Description: Increased magic damage, reduced mana regeneration + Description: Increased mana regeneration, reduced magic damage } TequilaBuff: { diff --git a/Localization/en-US/Mods.CalamityMod.Common.hjson b/Localization/en-US/Mods.CalamityMod.Common.hjson index f3363486be..186125b51b 100644 --- a/Localization/en-US/Mods.CalamityMod.Common.hjson +++ b/Localization/en-US/Mods.CalamityMod.Common.hjson @@ -4,6 +4,7 @@ RogueCrit: "{0}% increased rogue critical strike chance" RogueDamageCrit: "{0}% increased rogue damage and critical strike chance" RogueVelocity: "{0}% increased rogue velocity" RogueStealth: +{0} maximum stealth +CritDamageTootip: "{0}% critical strike damage" // Armor Set Bonus key states BothArmorSetBonusKeys: Press {0} or Double tap {1} NoArmorSetBonusKey: Press the Armor Set Bonus key @@ -15,7 +16,7 @@ AggroReduction: Enemies are less likely to target you KnockbackImmunity: Grants immunity to knockback AbyssLightLevel: Reduces the darkness intensity of the abyss AbyssFlashlight: Increases flashlight width in the abyss -AbyssGlow: Increases visibily range in the abyss +AbyssGlow: Increases visibility range in the abyss AbyssBreathLevel1: Slightly reduces breath loss in the abyss AbyssBreathLevel2: Moderately reduces breath loss in the abyss AbyssBreathLevel3: Greatly reduces breath loss in the abyss @@ -26,11 +27,12 @@ NotConsumable: Not consumable SummonTagDamageFlat: "{0} summon tag damage" SummonTagDamageMult: "{0}x summon tag damage" SummonTagCrit: "{0}% summon tag critical strike chance" +DodgeProvided: Grants or improves the ability to dodge attacks DodgeInformation: ''' - Attacks that deal less than 5% of your max life in damage will not be dodged - The dodge has a cooldown that ranges between 20 and 90 seconds depending on the dodged attack's damage - This cooldown is shared with all other dodges and reflects + [i/Terraria:BlackBelt] Attacks that deal less than 5% of your max life in damage will not be dodged + [i/Terraria:BlackBelt] This dodge has a maximum cooldown of 90 seconds, shortened depending on the dodged attack's damage + [i/Terraria:BlackBelt] Equipping multiple accessories that give this ability to dodge will reduce the cooldown by 15% each ''' ReflectInformation: ''' diff --git a/Localization/en-US/Mods.CalamityMod.Configs.hjson b/Localization/en-US/Mods.CalamityMod.Configs.hjson index 4083c303e5..36f44ed057 100644 --- a/Localization/en-US/Mods.CalamityMod.Configs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Configs.hjson @@ -93,7 +93,7 @@ CalamityClientConfig: { } DisableGravityScreenSwap: { - Label: Disable Gravity Screen Flip + Label: "[i:GravityGlobe] Disable Gravity Screen Flip" Tooltip: ''' Disables vanilla's screen-flipping from changing gravity, flipping the player instead. diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index f608304648..4363d3fd29 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -39,14 +39,11 @@ AbyssalMirror: { Tooltip: ''' Enemies are less likely to target you, even in the abyss - Generate stealth {0}% faster when standing still and {1}% faster while moving - Grants the ability to dodge attacks, releasing a cloud of lumenyl fluid which damages and stuns nearby enemies - ''' - HoldShiftTooltip: - ''' - {$Common.DodgeInformation} - Dodging an attack gives stealth + Generate stealth 25% faster when standing still and 12% faster while moving + {$Common.DodgeProvided} + Dodging an attack restores stealth and releases a cloud that damages and stuns nearby enemies ''' + HoldShiftTooltip: "{$Common.DodgeInformation}" FlavorTooltip: "'Light does not reach the depths of the ocean'" } @@ -90,7 +87,7 @@ AmalgamatedBrain: { ''' Taking damage confuses nearby enemies and spawns a dank creeper The dank creeper flies above you, exploding into several shaderain clouds - Grants the ability to dodge attacks + {$Common.DodgeProvided} After dodging, summon damage and crit chance are boosted by 10% ''' HoldShiftTooltip: "{$Common.DodgeInformation}" @@ -439,15 +436,6 @@ CorrosiveSpine: { ''' } -UnholyTonic: { - DisplayName: Unholy Tonic - Tooltip: - ''' - Increases damage reduction by 4% and defense by 6 while in the corruption - Grants immunity to Brain Rot - ''' -} - CounterScarf: { DisplayName: Counter Scarf Tooltip: @@ -466,15 +454,6 @@ CrawCarapace: { ''' } -ViciousTonic: { - DisplayName: Vicious Tonic - Tooltip: - ''' - Increases damage reduction by 4% and defense by 6 while in the crimson - Grants immunity to Burning Blood - ''' -} - CrownJewel: { DisplayName: Crown Jewel Tooltip: @@ -666,13 +645,10 @@ EclipseMirror: { Enemies are less likely to target you, even in the abyss Stealth generates 25% faster when standing still and is boosted while moving if not attacking Stealth strikes only expend 50% of your max stealth - Grants the ability to dodge attacks in a blast of darksun light, which inflicts extreme damage in a wide area - ''' - HoldShiftTooltip: - ''' - {$Common.DodgeInformation} - Dodging an attack grants a lot of stealth + {$Common.DodgeProvided} + Dodging an attack restores stealth and releases a burst of highly damaging darksun light ''' + HoldShiftTooltip: "{$Common.DodgeInformation}" FlavorTooltip: "'Its reflection shows naught but darkness'" } @@ -1731,9 +1707,10 @@ StatisNinjaBelt: { Tooltip: ''' Provides a high-speed dash - 10% increased movement speed, 32% increased jump speed, allows auto-jump, and negates fall damage + 10% increased movement speed, 32% increased jump speed and negates fall damage Increases movement acceleration and deceleration by 1.6x - Grants the ability to swim[TOGGLE] and dodge attacks + Allows the user to swim[TOGGLE] and auto jump + {$Common.DodgeProvided} [c/aaaaaa:Shift- this item in your inventory to toggle the] [i:ClimbingClaws] [c/aaaaaa:Climbing Claws] ''' ToggleEffect: ", climb walls," @@ -1745,10 +1722,10 @@ StatisVoidSash: { Tooltip: ''' Provides a high-speed dash - 20% increased movement speed, 32% increased jump speed, allows auto-jump, and negates fall damage + 20% increased movement speed, 32% increased jump speed, and negates fall damage Increases movement acceleration and deceleration by 1.85x - Grants the ability to swim[TOGGLE] and dodge attacks - Visual effects are reduced if visibility is disabled + Allows the user to swim[TOGGLE] and auto jump + {$Common.DodgeProvided} [c/aaaaaa:Shift- this item in your inventory to toggle the] [i:ClimbingClaws] [c/aaaaaa:Climbing Claws] ''' ToggleEffect: ", climb walls," @@ -1878,7 +1855,7 @@ TheAmalgam: { Most buffs last twice as long, and persist after dying Taking damage confuses nearby enemies and spawns a dank creeper The dank creeper flies above you, exploding into several shaderain clouds - Grants the ability to dodge attacks + {$Common.DodgeProvided} After dodging, summon damage and crit chance are boosted by 10% 'You have no idea how it's staying together' ''' @@ -1945,6 +1922,17 @@ TheFirstShadowflame: { ''' } +ThePointer: { + DisplayName: The Pointer + Tooltip: + ''' + Allows automatic targeting of enemies + Press [KEY] to cycle through targets near your mouse + After cycling through all close enemies, the next press will disable it + 'Great for cats!' + ''' +} + TheSponge: { DisplayName: The Sponge Tooltip: @@ -2001,6 +1989,15 @@ TrinketofChi: { ''' } +UnholyTonic: { + DisplayName: Unholy Tonic + Tooltip: + ''' + Increases damage reduction by 4% and defense by 6 while in the corruption + Grants immunity to Brain Rot + ''' +} + UnstableGraniteCore: { DisplayName: Unstable Granite Core Tooltip: @@ -2033,6 +2030,15 @@ VeneratedLocket: { ''' } +ViciousTonic: { + DisplayName: Vicious Tonic + Tooltip: + ''' + Increases damage reduction by 4% and defense by 6 while in the crimson + Grants immunity to Burning Blood + ''' +} + VitalJelly: { DisplayName: Vital Jelly Tooltip: 12% increased movement and jump speed @@ -2134,16 +2140,16 @@ 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)'" } +LittleE: { + DisplayName: Little E + Tooltip: "'That's a little version of me, {0}. I want you to have it.'" +} + LucisSight: { DisplayName: Luci's Sight Tooltip: "'Fashionable glasses? In Earthia's current economy?!'" @@ -2168,6 +2174,11 @@ SharkyPlush: { Tooltip: "[c/696969:'Look out, for the force without form...']" } +GlimmeringRibbon: { + DisplayName: Glimmering Ribbon + Tooltip: "'We are born colorless. It's the people we meet who give us color.'" +} + TheComb: { DisplayName: The Comb Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson index ff9a62221b..77b4512690 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson @@ -254,7 +254,7 @@ ThanatosMask: { } TheCommandersCap: { - DisplayName: The Commanders Cap + DisplayName: The Commander's Cap Tooltip: Part of The High-Flying Finery } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson index 519b616edc..a7e86c561e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson @@ -388,7 +388,7 @@ ScrapBobber: { Tooltip: ''' Provides a fishing minigame - Move in the indicated direction while fishing to catch items + Hold movement inputs in the indicated directions while fishing to catch items The rod empowers the longer you go without a mistake, speeding it up 'There's supposed to be a fish finder installed, but it only beeps when you point it at yourself...' ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index c38eae2506..732668034d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -809,6 +809,11 @@ DraconicIncense: { Tooltip: "'Ignite the air with dragonfire.'" } +EldenDiorama: { + DisplayName: Elden Diorama + Tooltip: "'Enshroud the sky with toxic torrents'" +} + ExoObelisk: { DisplayName: Exo Obelisk Tooltip: "'Energize the atmosphere with exo energy.'" @@ -824,8 +829,8 @@ KelpTorch: { Tooltip: Can be placed in water } -OldDukeMonolith: { - DisplayName: Elden Diorama +OtonilouStatue: { + DisplayName: Otonilou Memorial Tooltip: "" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index e429042221..0a1e84e98d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -341,10 +341,8 @@ StarBeamRye: { DisplayName: Star Beam Rye Tooltip: ''' - Disables natural mana regeneration - Mana regenerates at a fixed rate, even while using an item - Magic weapons deal increased damage based on how quickly they consume mana - This does not work while inflicted with Mana Sickness + Increases Mana regeneration, even while using an item + Magic weapons deal {0}x damage {$Common.AlcoholWarning} ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson index 64675769a1..75bc1378a2 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson @@ -3,21 +3,11 @@ AbyssalWarhammer: { Tooltip: "" } -AcidwoodAxe: { - DisplayName: Acidwood Axe - Tooltip: "" -} - AcidwoodHammer: { DisplayName: Acidwood Hammer Tooltip: "" } -AcidwoodPickaxe: { - DisplayName: Acidwood Pickaxe - Tooltip: "" -} - AerialHamaxe: { DisplayName: Aerial Hamaxe Tooltip: "" @@ -181,21 +171,11 @@ DisgustingMeat: { ''' } -DriftwoodAxe: { - DisplayName: Driftwood Axe - Tooltip: Improved efficiency while you are wet -} - DriftwoodHammer: { DisplayName: Driftwood Hammer Tooltip: Improved efficiency while you are wet } -DriftwoodPickaxe: { - DisplayName: Driftwood Pickaxe - Tooltip: Improved efficiency while you are wet -} - FellerofEvergreens: { DisplayName: Feller of Evergreens Tooltip: Occasionally drops extra fruits from shaking trees @@ -271,21 +251,11 @@ MomentumCapacitor: { ''' } -MonolithAxe: { - DisplayName: Monolith Axe - Tooltip: "" -} - MonolithHammer: { DisplayName: Monolith Hammer Tooltip: "" } -MonolithPickaxe: { - DisplayName: Monolith Pickaxe - Tooltip: "" -} - NormalityRelocator: { DisplayName: Normality Relocator Tooltip: 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..81ea619ba7 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: { @@ -239,7 +239,7 @@ DeathValleyDuster: { ''' Casts an enchanted blast of sand that passes through enemies and tiles Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the Sand's Wind Buff - The Sand's Wind Buff increases your defense by 10, damage by 12%, and greatly buffs mana regen + The {$Buffs.SandsWindBuff.DisplayName} buff increases your defense by {0}, damage by {1}%, and greatly buffs mana regen ''' } @@ -963,7 +963,7 @@ UnstableCastersGauntlet: { ''' HoldShiftTooltip: ''' - [c/DBD7CA:Ordo] sigils always land critical strikes and pierce infinitely + [c/DBD7CA:Ordo] sigils always land critical strikes [c/ABB6D4:Perdito] sigils ignore 25 points of enemy defense [c/E89B8E:Ignis] sigils inflict Daybroken [c/8ECBE8:Aqua] sigils inflict Crush Depth diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index bc3b67604d..bae7ba243a 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: { @@ -641,7 +641,7 @@ GildedProboscis: { The thrust begins weak, but becomes more powerful the longer it's held to dash forward with a mighty upstrike The distance you dash depends on if you are moving with or against the dash - Always critically strikes + Always critically strikes, with critical strike chance increasing critical strike damage ''' } @@ -863,7 +863,7 @@ MirrorBlade: { MonolithSword: { DisplayName: Monolith Sword - Tooltip: "" + Tooltip: "{$Common.ArmorPenetration}" } MonstrousKnives: { @@ -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..7bd2ed8f9a 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 ''' } @@ -196,7 +196,7 @@ BloodBoiler: { Tooltip: ''' Fires twin streams of bloodfire that returns to you - Retuning bloodfire reduces [cbuff:PotionSickness] if it struck an enemy + Returning bloodfire reduces [cbuff:PotionSickness] if it struck an enemy Uses your health as ammo 20% chance to save health ''' @@ -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..75a9314eb4 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: { @@ -833,8 +834,8 @@ VengefulSunStaff: { DisplayName: Vengeful Sun Staff Tooltip: ''' - Summons an eclipse spirit to protect you - Repeated summons increase its power + Summons a sun spirit to protect you + Repeated summons eclipse the spirit and increase its power ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson index 08fb7476d2..9a4e9142f1 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson @@ -80,7 +80,7 @@ StratusSphere: { Tooltip: ''' Launches a singularity which exerts influence on all entities in a large area around it - Influenced players gain Starbursts over time, while enemies instead take damage + Influenced players gain Starbursts over time and will consume Starbursts to fly when out of flight time to cause Starbursts to form a barrier, causing you to lose Starbursts instead of health Launching the singularity deactivates the barrier, and creating a barrier deactivates the singularity 'Channeling souls into stars, an inane concept' diff --git a/Localization/en-US/Mods.CalamityMod.Keybinds.hjson b/Localization/en-US/Mods.CalamityMod.Keybinds.hjson index 9235ed6df0..8c950f3fd4 100644 --- a/Localization/en-US/Mods.CalamityMod.Keybinds.hjson +++ b/Localization/en-US/Mods.CalamityMod.Keybinds.hjson @@ -15,3 +15,4 @@ SpectralVeilTeleport.DisplayName: Spectral Veil Teleport TransformerHotKey.DisplayName: Transformer Hot Key GravitySwapOverride.DisplayName: Gravity Swap Override ExpandDebuffInfo.DisplayName: See Debuff Information +ThePointerLock.DisplayName: The Pointer Lock On 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.Status.Death.hjson b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson index 3e976e6542..1e0d926ef4 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson @@ -17,6 +17,9 @@ BloodBoiler1: "{0} collapsed from severe anemia." BloodBoiler2: "{0} was unable to obtain a blood transfusion." BloodFireArrow1: "{0} fired one too many careless shots." BloodFireArrow2: "{0} had no blood left to give." +BrainIllusion1: "{0} couldn't see past the illusion." +BrainIllusion2: "{0} fell for the trick." +BrainIllusion3: "{0} needed to pay more attention." BrainRot1: "{0} ceased functioning." BrainRot2: "{0} lost the last of their neurons." BrainRot3: "{0} was everywhere at the end of time." diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 150728ab41..c912701a81 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -123,7 +123,7 @@ Cooldowns: { InkBomb: Ink Bomb Cooldown KillModeActive: Kill Mode Active KillModeCooldown: Kill Mode Cooldown - LifeSteal: Life Steal Cooldown + LifeSteal: Life Steal Remaining LionHeartShield: Energy Shell Cooldown M1GarandShots: Chambered Rounds MasterChefShieldDurability: MJOLNIR Shield Level @@ -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/Localization/en-US/Mods.CalamityMod.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson index dabf9366a9..cee11fbd9b 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson @@ -1,10 +1,8 @@ DashKey: Press {0} while facing a direction DodgeInfo: ''' - Grants the ability to dodge attacks - Attacks that deal less than 5% of your max life in damage will not be dodged - The dodge has a cooldown that ranges between {0} and {1} seconds depending on the dodged attack's damage - The cooldown is shared with all other dodges and reflects + {$Common.DodgeProvided} + {$Common.DodgeInformation} ''' AddedTooltip: { diff --git a/NPCs/BaseWormNPC.cs b/NPCs/BaseWormNPC.cs index 3535bd42d5..5d8c090d83 100644 --- a/NPCs/BaseWormNPC.cs +++ b/NPCs/BaseWormNPC.cs @@ -657,6 +657,10 @@ namespace CalamityMod.NPCs public override bool? CanBeHitByItem(Player player, Item item) { + if (!Main.npc.IndexInRange((int)NPC.ai[0])) + { + return base.CanBeHitByItem(player, item); + } var canhit = Main.npc[(int)NPC.ai[0]].ModNPC.CanBeHitByItem(player, item); if (canhit.HasValue && !canhit.Value) return false; @@ -665,6 +669,10 @@ namespace CalamityMod.NPCs public override bool? CanBeHitByProjectile(Projectile projectile) { + if (!Main.npc.IndexInRange((int)NPC.ai[0])) + { + return base.CanBeHitByProjectile(projectile); + } var canhit = Main.npc[(int)NPC.ai[0]].ModNPC.CanBeHitByProjectile(projectile); if (canhit.HasValue && !canhit.Value) return false; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 4601af0841..294fa7d10b 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -25,6 +25,7 @@ using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.Bumblebirb; using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Deconstructors; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.NPCs.DraedonLabThings; @@ -3168,10 +3169,13 @@ namespace CalamityMod.NPCs Vector2 startVel = (warbannerBurnDirection * velAdjust).RotatedByRandom(0.6f * warbannerBurnIntensity); Particle sparks = new VelChangingSpark(sparkPos, startVel, endVel, "CalamityMod/Particles/SmallBloom", Main.rand.Next(18, 22 + 1), Main.rand.NextFloat(0.1f, 0.25f) * sizeBonus, color * 0.75f, new Vector2(0.7f, 1), true, false, 0, false, 0.45f, 0.1f); GeneralParticleHandler.SpawnParticle(sparks); - Dust lust2 = Dust.NewDustPerfect(sparkPos, DustType(), startVel, Scale: Main.rand.NextFloat(0.7f, 1.1f) * sizeBonus); - lust2.noGravity = true; - lust2.color = color; - lust2.noLightEmittence = true; + if (Main.rand.NextBool()) + { + Dust lust2 = Dust.NewDustPerfect(sparkPos, DustType(), startVel, Scale: Main.rand.NextFloat(0.5f, 0.9f) * Math.Min(sizeBonus, 1.3f)); + lust2.noGravity = true; + lust2.color = color; + lust2.noLightEmittence = true; + } } } var player = Main.LocalPlayer; @@ -6010,7 +6014,8 @@ namespace CalamityMod.NPCs ]; // Insert the debuff info into the NPC's bestiary entry - bestiaryEntry.Info.Insert(0, new BestiaryDebuffInfo(elements)); + bool force = npc.type == ModContent.NPCType(); //Force Burrower to always show the debuff section + bestiaryEntry.Info.Insert(0, new BestiaryDebuffInfo(elements,force)); // Add the Astral Infection to the Enchanted Nightcrawler's entry as it spawns there now if (npc.type == NPCID.EnchantedNightcrawler) 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..fb11fc4903 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -185,6 +185,7 @@ namespace CalamityMod.NPCs "Curly", // <@!673092101780668416> (curly4830) "Cobalt", // <@!132962828922388481> (cobalt_44) "Dizzetriya", // <@!719818245665980517> (dizzykbity) + "Vodka", // <@!1172497470438248565> (ehhhhh0981) ]; private static readonly string[] MerchantNames = [ @@ -370,6 +371,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; @@ -1309,7 +1311,9 @@ namespace CalamityMod.NPCs if (type == NPCID.Painter) { - shop.AddWithCustomValue(ItemID.PainterPaintballGun, Item.buyPrice(gold: 15)); + shop.AddWithCustomValue(ItemID.PainterPaintballGun, Item.buyPrice(gold: 15)) + .Add(ItemType()) + .Add(ItemType()); } if (type == NPCID.Steampunker) diff --git a/NPCs/CalamityVanillaAIOverrideNPC.cs b/NPCs/CalamityVanillaAIOverrideNPC.cs index 80ec7028d6..956da45f09 100644 --- a/NPCs/CalamityVanillaAIOverrideNPC.cs +++ b/NPCs/CalamityVanillaAIOverrideNPC.cs @@ -1044,7 +1044,7 @@ public sealed partial class CalamityVanillaAIOverrideNPC : GlobalNPC public override void FindFrame(NPC npc, int frameHeight) { - if (!Enabled) + if (!Enabled || npc.IsABestiaryIconDummy) return; AIOverride?.FindFrame(Mod, frameHeight); @@ -1055,6 +1055,9 @@ public sealed partial class CalamityVanillaAIOverrideNPC : GlobalNPC if (!Enabled) base.PreDraw(npc, spriteBatch, screenPos, drawColor); + if(npc.IsABestiaryIconDummy) + return base.PreDraw(npc, spriteBatch, screenPos, drawColor); + bool result = true; if (!IsGlobalChangeBlacklisted(npc)) result &= GlobalPreDraw(npc, spriteBatch, screenPos, drawColor); result &= AIOverride?.PreDraw(Mod, spriteBatch, screenPos, drawColor) ?? true; diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 6526f0f174..352bf5c3c0 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.DevourerofGods [LongDistanceNetSync] public class DevourerofGodsHead : ModNPC { - public static Color SpecialMoveColor => Color.Lerp(Color.Fuchsia, Color.Cyan, MathHelper.SmoothStep(0, 1, (MathF.Sin(Main.GlobalTimeWrappedHourly * 2) + 1) * 0.5f)); + public static Color SpecialMoveColor => !CalamityClientConfig.Instance.TextEffects ? Color.Cyan : Color.Lerp(Color.Fuchsia, Color.Cyan, MathHelper.SmoothStep(0, 1, (MathF.Sin(Main.GlobalTimeWrappedHourly * 2) + 1) * 0.5f)); public static int phase1IconIndex; public static int phase2IconIndex; diff --git a/NPCs/NormalNPCs/KingSlimeJewelRuby.cs b/NPCs/NormalNPCs/KingSlimeJewelRuby.cs index 1352b941dd..6113878bd7 100644 --- a/NPCs/NormalNPCs/KingSlimeJewelRuby.cs +++ b/NPCs/NormalNPCs/KingSlimeJewelRuby.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.CalPlayer; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; @@ -11,6 +12,7 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.NPCs.NormalNPCs.IceClasper; namespace CalamityMod.NPCs.NormalNPCs { @@ -37,6 +39,9 @@ namespace CalamityMod.NPCs.NormalNPCs NPCID.Sets.NeedsExpertScaling[Type] = true; NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); + + NPCID.Sets.TrailingMode[NPC.type] = 7; + NPCID.Sets.TrailCacheLength[NPC.type] = 10; } public override void SetDefaults() @@ -177,7 +182,16 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.damage = 0; - NPC.velocity *= 0.94f; + // Slow down before dash, emit particles that home in toward the center + NPC.velocity *= 0.925f; + if (Main.rand.NextBool(3)) + { + Vector2 dustVel2 = (Vector2.UnitX).RotatedByRandom(100) * Main.rand.NextFloat(9.5f, 13f); + Dust dust2 = Dust.NewDustPerfect(NPC.Center + dustVel2.SafeNormalize(Vector2.UnitX) * 150, ModContent.DustType(), -dustVel2 * 1.15f, 0, default, Main.rand.NextFloat(0.9f, 1.2f)); + dust2.noGravity = true; + dust2.fadeIn = 0.66f; + dust2.color = new(0, 200, 0); + } NPC.ai[1] += 1f; @@ -210,8 +224,8 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.damage = NPC.defDamage; - float chargeSpeed = 22f; - NPC.velocity = NPC.SafeDirectionTo(Main.player[NPC.target].Center + Main.player[NPC.target].velocity * 10f, -Vector2.UnitY) * chargeSpeed; // Slightly predictive + float chargeSpeed = 28f; + NPC.velocity = NPC.SafeDirectionTo(Main.player[NPC.target].Center, -Vector2.UnitY) * chargeSpeed; NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; NPC.ai[0] = 2f; @@ -226,7 +240,6 @@ namespace CalamityMod.NPCs.NormalNPCs CustomSprite spriteParticle = new CustomSprite(NPC.Center - NPC.velocity, NPC.velocity * 0.8f, 10, "CalamityMod/NPCs/NormalNPCs/KingSlimeJewelEmerald", 1.2f, Color.DarkGreen.MultiplyRGBA(new Color(1f, 1f, 1f, 0f))); spriteParticle.Rotation = NPC.rotation; - GeneralParticleHandler.SpawnParticle(spriteParticle); NPC.ai[1] += 1f; @@ -479,12 +492,26 @@ namespace CalamityMod.NPCs.NormalNPCs float currentLightTelegraphDuration = emeraldMode ? EmeraldLightTelegraphDuration : RubyLightTelegraphDuration; float currentColorTelegraphGateValue = (emeraldMode ? EmeraldChargeGateValue_Death : BoltShootGateValue_Death) - currentLightTelegraphDuration; + Asset tex = ModContent.Request(emeraldMode ? "CalamityMod/NPCs/NormalNPCs/KingSlimeJewelEmerald" : Texture); + Asset tex2 = ModContent.Request("CalamityMod/NPCs/NormalNPCs/KingSlimeJewelFlash"); + if (emeraldMode) { if (NPC.ai[0] == 0f && NPC.ai[1] > currentColorTelegraphGateValue) { alph = MathHelper.Lerp(0f, 1f, (NPC.ai[1] - currentColorTelegraphGateValue) / currentLightTelegraphDuration); } + + if (NPC.ai[0] == 2f && CalamityClientConfig.Instance.Afterimages) + { + for (int i = 1; i < NPC.oldPos.Length; i++) + { + Vector2 trailDrawPos = NPC.oldPos[i] + NPC.Size * 0.5f - screenPos; + Color trailColor = Color.Lime * (1f - (float)i / NPC.oldPos.Length) * 0.3f; + spriteBatch.Draw(tex.Value, trailDrawPos, null, trailColor, NPC.rotation, tex.Size() * 0.5f, NPC.scale, SpriteEffects.None, 0f); + } + } + } else { @@ -492,9 +519,6 @@ namespace CalamityMod.NPCs.NormalNPCs alph = MathHelper.Lerp(0f, 1f, (NPC.ai[0] - currentColorTelegraphGateValue) / currentLightTelegraphDuration); } - Asset tex = ModContent.Request(emeraldMode ? "CalamityMod/NPCs/NormalNPCs/KingSlimeJewelEmerald" : Texture); - Asset tex2 = ModContent.Request("CalamityMod/NPCs/NormalNPCs/KingSlimeJewelFlash"); - Main.EntitySpriteDraw(tex.Value, NPC.Center - screenPos, tex.Frame(), Color.White, NPC.rotation, tex.Frame().Center(), 1f, SpriteEffects.None); Main.EntitySpriteDraw(tex2.Value, NPC.Center - screenPos, tex2.Frame(), Color.Lerp(col, flashCol, alph).MultiplyRGBA(new Color(alph, alph, alph, 0f)), NPC.rotation, tex2.Frame().Center(), alph * 1.2f, SpriteEffects.None); diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index ea70d84fb2..bacd9e74db 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -10,6 +10,7 @@ using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.Paintings; +using CalamityMod.Items.Placeables.Furniture.Monoliths; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; @@ -2103,6 +2104,7 @@ namespace CalamityMod.NPCs.OldDuke // Vanity normalOnly.Add(ModContent.ItemType(), 7); + normalOnly.Add(ModContent.ItemType(), 10); normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index caf07e873e..b5008992fa 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -15,6 +15,7 @@ using CalamityMod.Items.Weapons.Typeless; using CalamityMod.NPCs.Providence; using CalamityMod.Projectiles.Boss; using CalamityMod.UI.VanillaBossBars; +using CalamityMod.Utilities; using CalamityMod.Utilities.Daybreak; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -253,7 +254,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Main.dust[dust].noGravity = true; Main.dust[dust].scale = 1f; Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust2 = Dust.CloneDust(dust); + Dust dust2 = Dust.BetterCloneDust(dust); Dust dust3 = dust2; dust3.scale /= 2f; dust3 = dust2; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index 25c30d0215..fbc6c7121c 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -6,6 +6,7 @@ using CalamityMod.Events; using CalamityMod.Items.Tools; using CalamityMod.NPCs.Providence; using CalamityMod.Projectiles.Boss; +using CalamityMod.Utilities; using CalamityMod.Utilities.Daybreak; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -196,7 +197,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Main.dust[dust].noGravity = true; Main.dust[dust].scale = 1f; Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust2 = Dust.CloneDust(dust); + Dust dust2 = Dust.BetterCloneDust(dust); Dust dust3 = dust2; dust3.scale /= 2f; dust3 = dust2; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs index 5dd7eda2b6..5c6442fb1d 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs @@ -5,6 +5,7 @@ using CalamityMod.Events; using CalamityMod.Items.Tools; using CalamityMod.NPCs.Providence; using CalamityMod.Projectiles.Boss; +using CalamityMod.Utilities; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -375,7 +376,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Main.dust[dust].noGravity = true; Main.dust[dust].scale = 1f + k; Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust2 = Dust.CloneDust(dust); + Dust dust2 = Dust.BetterCloneDust(dust); Dust dust3 = dust2; dust3.scale /= 2f; dust3 = dust2; diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 172e2d814e..5005f77496 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -30,6 +30,7 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems.Graphic; using CalamityMod.Tiles.Ores; +using CalamityMod.Utilities; using CalamityMod.Utilities.Daybreak; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -707,7 +708,7 @@ namespace CalamityMod.NPCs.Providence Main.dust[dust].noGravity = true; Main.dust[dust].scale = 1f; Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust2 = Dust.CloneDust(dust); + Dust dust2 = Dust.BetterCloneDust(dust); Dust dust3 = dust2; dust3.scale /= 2f; dust3 = dust2; @@ -1353,7 +1354,7 @@ namespace CalamityMod.NPCs.Providence Main.dust[dust].noGravity = true; Main.dust[dust].scale = 3f; Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust2 = Dust.CloneDust(dust); + Dust dust2 = Dust.BetterCloneDust(dust); Dust dust3 = dust2; dust3.scale /= 2f; dust3 = dust2; @@ -1644,7 +1645,7 @@ namespace CalamityMod.NPCs.Providence Main.dust[dust].noGravity = true; Main.dust[dust].scale = 1f + i; Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust2 = Dust.CloneDust(dust); + Dust dust2 = Dust.BetterCloneDust(dust); Dust dust3 = dust2; dust3.scale /= 2f; dust3 = dust2; 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..5ff62a5b08 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs @@ -37,9 +37,12 @@ public class BrainOfCthulhuAI : VanillaAIOverride private static SoundStyle ShieldUp = new SoundStyle("CalamityMod/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Shield_Up") with { PauseBehavior = PauseBehavior.PauseWithGame }; private static SoundStyle IntroRoar = new SoundStyle("CalamityMod/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Roar") with { PauseBehavior = PauseBehavior.PauseWithGame }; private static SoundStyle Roar = new SoundStyle("CalamityMod/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Short_Roar") with { PauseBehavior = PauseBehavior.PauseWithGame}; - public static SoundStyle Laugh = new SoundStyle("CalamityMod/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Laugh") with { PauseBehavior = PauseBehavior.PauseWithGame }; + public static SoundStyle Laugh = new SoundStyle("CalamityMod/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Laugh") with { PauseBehavior = PauseBehavior.PauseWithGame, MaxInstances = 5 }; 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 = []; @@ -138,7 +141,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride #region Idle Period internal static int ChaseTime => 160; - internal static int MaxChases => 3; + internal static int ChaseAmount => 2; internal static int IdleTeleportDuration => CalamityWorld.death ? 36 : 44; internal static float ChaseMinSpeed => 3; internal static float ChaseMaxSpeed => CalamityWorld.death ? 18 : 15; @@ -147,7 +150,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride #endregion #region Bloodletting - internal static int BloodlettingDuration => 765; + internal static int BloodlettingDuration => 675; internal static Vector2 HoverDistance => new (420f, 270f); internal static float HoverEndHeight => 300f; internal static int IchorRate => CalamityWorld.death ? 9 : 10; @@ -371,7 +374,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride #region Despawn // Despawn check - if (!BossRushEvent.BossRushActive) + if (!BossRushEvent.BossRushActive && AIState != BrainAIState.DeathAnimation) { bool despawn = (Target.dead || !Target.ZoneCrimson); if (despawn) @@ -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; } @@ -1074,7 +1080,10 @@ public class BrainOfCthulhuAI : VanillaAIOverride int spawnTime = GetBrainOfCthuluCreepersCountRevDeath() / 2 * creeperRate; if (Time == StunDuration) + { AttackCounter = GetBrainOfCthuluCreepersCountRevDeath() - 1; + SoundEngine.PlaySound(Roar, NPC.Center); + } NPC.knockBackResist = 0f; NPC.dontTakeDamage = true; @@ -1639,9 +1648,6 @@ public class BrainOfCthulhuAI : VanillaAIOverride private void Phase2Idle() { - //goes from 3 at full health to 1 at low health - int chases = (int)Math.Ceiling(MaxChases * (NPC.life / (float)NPC.lifeMax)); - NPC.rotation = NPC.velocity.X / 6f * MathHelper.Pi / 8f; if (Time == ChaseTime - 5) @@ -1715,7 +1721,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride AttackFlag = false; #region Attack Selection - if (AttackCounter >= chases) //Pick attack + if (AttackCounter >= ChaseAmount) //Pick attack { NPC.rotation = 0; ResetAttackValues(); @@ -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,7 +2902,29 @@ public class BrainOfCthulhuAI : VanillaAIOverride } } - public override bool PreKill(Mod mod) => AIState == BrainAIState.DeathAnimation && !NPC.dontTakeDamage; + 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 void FindFrame(Mod mod, int frameHeight) { @@ -3036,6 +3050,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..65d889e6d2 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) @@ -224,6 +230,8 @@ public class BrainOfCthulhuSystem : ModSystem public override void PostUpdateNPCs() { + if (VerletTendrils is null) + return; if (!NPC.AnyNPCs(NPCID.BrainofCthulhu)) BrainOfCthulhuAI.SummonedViaItem = false; @@ -404,7 +412,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..c0e5090a4b 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/FalseBrain.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/FalseBrain.cs @@ -9,6 +9,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -44,14 +45,11 @@ 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); - if(BrainOfCthulhuSystem.IsBrainOfCthulhuTextureVanilla) - NPC.localAI[1] = 1 + Main.rand.NextFloat(-0.25f, 0.25f); - else - NPC.localAI[1] = 1 + (Main.rand.NextFloat(0.25f, 0.75f) * (Main.rand.NextBool() ? -1 : 1)); + NPC.localAI[1] = 1 + Main.rand.NextFloat(-0.25f, 0.25f); } private int Variant => (int)NPC.localAI[0]; private float Angle => NPC.ai[0]; @@ -142,16 +140,20 @@ public class FalseBrain : ModNPC, ILocalizedModType fool.AddBuff(BuffID.Darkness, 900); fool.AddBuff(BuffID.Bleeding, 900); fool.AddBuff(BuffID.Confused, 60); - int timeToAdd = 600; + int timeToAdd = 300; int bbIndex = fool.buffType.ToList().IndexOf(ModContent.BuffType()); if (bbIndex != -1) { timeToAdd /= 2; timeToAdd += fool.buffTime[bbIndex]; } + + if (timeToAdd > 3600) + timeToAdd = 3600; + fool.AddBuff(ModContent.BuffType(), timeToAdd); - fool.Calamity().adrenaline = 0; + fool.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BrainIllusion" + Main.rand.Next(1, 3 + 1)).ToNetworkText(fool.name)), 50, NPC.Center.X > fool.Center.X ? -1 : 1, cooldownCounter: 0, dodgeable: false, scalingArmorPenetration: 1f); NPC.dontTakeDamage = true; } @@ -182,33 +184,7 @@ public class FalseBrain : ModNPC, ILocalizedModType else { tex = TextureAssets.Npc[NPCID.BrainofCthulhu].Value; - frame = tex.Frame(1, 8, 0, 4 + (int)NPC.frameCounter); - - switch(Variant) - { - case 0: - scaleAddition = new(-0.125f, 0.25f); - break; - case 1: - scaleAddition = new(0.25f, -0.125f); - break; - case 2: - drawColor = Color.Lerp(drawColor, Color.Red.MultiplyRGB(drawColor), 0.5f); - break; - case 3: - drawColor = Color.Lerp(drawColor, Color.Orange.MultiplyRGB(drawColor), 0.5f); - break; - case 4: - drawColor = Color.Lerp(drawColor, Color.Yellow.MultiplyRGB(drawColor), 0.5f); - break; - case 5: - scaleAddition = new(0.1625f, 0.1625f); - break; - case 6: - scaleAddition = new(-0.1625f, -0.1625f); - break; - - } + frame = tex.Frame(1, 8, 0, (int)NPC.frameCounter); } if (SpawnTime > 0) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs index 426c1fad95..b553015d05 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Events; using CalamityMod.World; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -1253,7 +1254,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.dust[despawnRainbowDust].scale = 0.35f; if (despawnRainbowDust != 6000) { - Dust dust = Dust.CloneDust(despawnRainbowDust); + Dust dust = Dust.BetterCloneDust(despawnRainbowDust); dust.scale /= 2f; dust.fadeIn *= 0.85f; dust.color = new Color(255, 255, 255, 255); @@ -1317,7 +1318,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.dust[dust].scale = 0.35f; if (dust != Main.maxDust) { - Dust dust2 = Dust.CloneDust(dust); + Dust dust2 = Dust.BetterCloneDust(dust); dust2.scale /= 2f; dust2.fadeIn *= 0.85f; dust2.color = new Color(255, 255, 255, 255); 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/BrainOfCthulhu/TelekineticBlast.cs b/Projectiles/Boss/BrainOfCthulhu/TelekineticBlast.cs index 9289e9b070..779b55153e 100644 --- a/Projectiles/Boss/BrainOfCthulhu/TelekineticBlast.cs +++ b/Projectiles/Boss/BrainOfCthulhu/TelekineticBlast.cs @@ -52,12 +52,17 @@ public class TelekineticBlast : ModProjectile, ILocalizedModType target.AddBuff(BuffID.Darkness, (int)Math.Round(900 * debuffMultiplier)); target.AddBuff(BuffID.Bleeding, (int)Math.Round(900 * debuffMultiplier)); target.AddBuff(BuffID.Confused, (int)Math.Round(60 * debuffMultiplier)); - int timeToAdd = (int)Math.Round(600 * debuffMultiplier); + int timeToAdd = (int)Math.Round(300 * debuffMultiplier); int bbIndex = target.buffType.ToList().IndexOf(ModContent.BuffType()); if (bbIndex != -1) timeToAdd += target.buffTime[bbIndex]; + if (timeToAdd > 3600) + timeToAdd = 3600; + target.AddBuff(ModContent.BuffType(), timeToAdd); + target.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BrainIllusion" + Main.rand.Next(1, 3 + 1)).ToNetworkText(target.name)), 100, Main.npc[NPC.crimsonBoss].Center.X > target.Center.X ? -1 : 1, cooldownCounter: 0, dodgeable: false, scalingArmorPenetration: 1f); + target.Calamity().adrenaline = 0; Projectile.active = false; } diff --git a/Projectiles/Boss/BrainOfCthulhu/TelekineticEnemyGrab.cs b/Projectiles/Boss/BrainOfCthulhu/TelekineticEnemyGrab.cs index 6f4a311073..8e6996e16b 100644 --- a/Projectiles/Boss/BrainOfCthulhu/TelekineticEnemyGrab.cs +++ b/Projectiles/Boss/BrainOfCthulhu/TelekineticEnemyGrab.cs @@ -22,7 +22,7 @@ public class TelekineticEnemyGrab : ModProjectile, ILocalizedModType public new string LocalizationCategory => "Projectiles.Boss"; public override string Texture => "CalamityMod/Particles/BloomRing"; - BezierCurve curve; + BezierCurve curve = null; int throwSign = 0; Vector2 throwPos = Vector2.Zero; Vector2 holdPos; @@ -331,55 +331,58 @@ public class TelekineticEnemyGrab : ModProjectile, ILocalizedModType if (Time < 15) glowOpacity = Time / 15f; - Main.spriteBatch.End(out var snapshot); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, null, Main.GameViewMatrix.TransformationMatrix); - - Texture2D ring = TextureAssets.Projectile[Type].Value; - - List points = curve.GetPoints(pCount); - for (int i = 1; i < pCount; i++) + if (curve != null) { - float scale1 = MathHelper.Lerp(0.1f, 1f, i / (float)(pCount - 1)); - float scale2 = MathHelper.Lerp(0.1f, 1f, (i + 1) / (float)(pCount - 1)); - float scale = MathHelper.Lerp(scale1, scale2, wrappedTime); + Main.spriteBatch.End(out var snapshot); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, null, Main.GameViewMatrix.TransformationMatrix); - float rot1 = (points[i] - points[i - 1]).ToRotation(); + Texture2D ring = TextureAssets.Projectile[Type].Value; - float rot2; - if (i == pCount - 1) - rot2 = points[i].ToRotation(); - else - rot2 = (points[i + 1] - points[i]).ToRotation(); + List points = curve.GetPoints(pCount); + for (int i = 1; i < pCount; i++) + { + float scale1 = MathHelper.Lerp(0.1f, 1f, i / (float)(pCount - 1)); + float scale2 = MathHelper.Lerp(0.1f, 1f, (i + 1) / (float)(pCount - 1)); + float scale = MathHelper.Lerp(scale1, scale2, wrappedTime); - float rot; - if (i == pCount - 1) - rot = rot1; - else - rot = rot1.AngleLerp(rot2, wrappedTime); + float rot1 = (points[i] - points[i - 1]).ToRotation(); - Vector2 pos; - if (i == pCount - 1) - pos = Vector2.Lerp(points[i], points[i] + rot.ToRotationVector2() * Vector2.Distance(points[^1], points[^2]), wrappedTime); - else - pos = Vector2.Lerp(points[i], points[i + 1], wrappedTime); + float rot2; + if (i == pCount - 1) + rot2 = points[i].ToRotation(); + else + rot2 = (points[i + 1] - points[i]).ToRotation(); - Color color; - if (evenRed) - color = (i % 2 == 0 ? Color.Red : Color.Magenta) * 0.666f; - else - color = (i % 2 == 0 ? Color.Magenta : Color.Red) * 0.666f; + float rot; + if (i == pCount - 1) + rot = rot1; + else + rot = rot1.AngleLerp(rot2, wrappedTime); - if (i == pCount - 1) - color *= 1 - wrappedTime; - else if (i == 1) - color *= wrappedTime; + Vector2 pos; + if (i == pCount - 1) + pos = Vector2.Lerp(points[i], points[i] + rot.ToRotationVector2() * Vector2.Distance(points[^1], points[^2]), wrappedTime); + else + pos = Vector2.Lerp(points[i], points[i + 1], wrappedTime); - Main.spriteBatch.Draw(ring, pos + Projectile.velocity - Main.screenPosition, null, color * glowOpacity, rot, ring.Size() * 0.5f, new Vector2(0.5f, 1f) * scale, 0, 0); + Color color; + if (evenRed) + color = (i % 2 == 0 ? Color.Red : Color.Magenta) * 0.666f; + else + color = (i % 2 == 0 ? Color.Magenta : Color.Red) * 0.666f; + + if (i == pCount - 1) + color *= 1 - wrappedTime; + else if (i == 1) + color *= wrappedTime; + + Main.spriteBatch.Draw(ring, pos + Projectile.velocity - Main.screenPosition, null, color * glowOpacity, rot, ring.Size() * 0.5f, new Vector2(0.5f, 1f) * scale, 0, 0); + } + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(snapshot); } - Main.spriteBatch.End(); - Main.spriteBatch.Begin(snapshot); - Vector2[] offsets = [Vector2.UnitX * 2, Vector2.UnitX * -2, Vector2.UnitY * 2, Vector2.UnitY * -2]; for (int i = 0; i < 4; i++) Main.EntitySpriteDraw(EnemyGlowTextures[enemyID], Projectile.Center - Main.screenPosition + offsets[i].RotatedBy(Projectile.rotation), frame, Color.Lerp(Color.Red, Color.Magenta, ((float)Math.Sin((Main.GlobalTimeWrappedHourly * 5f)) / 2f + 0.5f)) * glowOpacity, Projectile.rotation, frame.Size() * 0.5f, 1f, 0); 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/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs index 4f99f0d4d1..107de5a8a7 100644 --- a/Projectiles/Boss/ProvidenceCrystalShard.cs +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -2,6 +2,7 @@ using System.IO; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Utilities; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -156,7 +157,7 @@ namespace CalamityMod.Projectiles.Boss holyDust.fadeIn = fadeIn; holyDust.scale = dustScale; holyDust.noLight = true; - Dust holyDust2 = Dust.CloneDust(holyDust); + Dust holyDust2 = Dust.BetterCloneDust(holyDust); Dust dust = holyDust2; dust.scale *= 0.65f; dust = holyDust2; @@ -182,7 +183,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[killDust].noGravity = true; Main.dust[killDust].scale = 2f; Main.dust[killDust].fadeIn = Main.rand.NextFloat() * 2f; - Dust killDustClone = Dust.CloneDust(killDust); + Dust killDustClone = Dust.BetterCloneDust(killDust); Dust dust = killDustClone; dust.scale /= 2f; dust = killDustClone; @@ -199,7 +200,7 @@ namespace CalamityMod.Projectiles.Boss dust.noGravity = true; dust.scale = Main.rand.NextFloat() * 1f; dust.fadeIn = Main.rand.NextFloat() * 2f; - Dust killDustClone2 = Dust.CloneDust(killDust2); + Dust killDustClone2 = Dust.BetterCloneDust(killDust2); dust = killDustClone2; dust.scale /= 2f; dust = killDustClone2; diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 94f5dc0882..1dbb096249 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); } @@ -4688,11 +4689,14 @@ namespace CalamityMod.Projectiles if (BloodstoneOrbValue > 0) Projectile.NewProjectile(projectile.GetSource_OnHit(target), projectile.Center, projectile.velocity.SafeNormalize(Vector2.Zero) * Math.Min(((projectile.velocity.Length() * projectile.MaxUpdates) / 4f), 4f) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), BloodstoneOrbValue, 0f, Main.player[projectile.owner].whoAmI); //Mana Burn - if (Main.player[projectile.owner].statMana < 0) + if (Main.player[projectile.owner].statMana < 0 && Main.player[projectile.owner].Calamity().ChaosStone) { - 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/DraedonsArsenal/CountermeasureMittHoldout.cs b/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.cs index 6ab5de6adc..1afbee1b94 100644 --- a/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.cs +++ b/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.cs @@ -154,6 +154,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (hitTimer > 0) hitTimer--; + if (Owner.dead) + { + EndSounds(); + Projectile.Kill(); + return; + } + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, (alteredRotation + MathHelper.PiOver2 * -Projectile.direction) + (Owner.direction == -1 ? MathHelper.Pi : 0)); Vector2 handPos = Owner.GetBackHandPosition(CompositeArmStretchAmount.None, Owner.compositeBackArm.rotation) + (Owner.compositeBackArm.rotation + MathHelper.PiOver2).ToRotationVector2() * 4; diff --git a/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs b/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs index c5979fa23a..2349a8ebe1 100644 --- a/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs +++ b/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs @@ -55,6 +55,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool? CanDamage() => (flung ? null : false); public override void AI() { + if (Owner.dead && !flung) + { + Projectile.Kill(); + return; + } if (Owner.HeldItem.type != ModContent.ItemType()) { Projectile.Kill(); diff --git a/Projectiles/DraedonsArsenal/VulcanHoldout.cs b/Projectiles/DraedonsArsenal/VulcanHoldout.cs index 25b30502fa..d86259fbd3 100644 --- a/Projectiles/DraedonsArsenal/VulcanHoldout.cs +++ b/Projectiles/DraedonsArsenal/VulcanHoldout.cs @@ -46,6 +46,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } public override void HoldoutAI() { + if (Owner.dead) + { + Projectile.Kill(); + return; + } + if (flashVis1 > 0) flashVis1 -= 0.2f; if (flashVis1 < 0) flashVis1 = 0; if (flashVis2 > 0) flashVis2 -= 0.2f; if (flashVis2 < 0) flashVis2 = 0; diff --git a/Projectiles/Magic/AstralStarMagic.cs b/Projectiles/Magic/AstralStarMagic.cs index ed9be83c10..3efca1160f 100644 --- a/Projectiles/Magic/AstralStarMagic.cs +++ b/Projectiles/Magic/AstralStarMagic.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -64,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[dust].scale = 0.7f; if (dust != Main.maxDust) { - Dust dust2 = Dust.CloneDust(dust); + Dust dust2 = Dust.BetterCloneDust(dust); dust2.scale /= 2f; dust2.fadeIn *= 0.85f; dust2.color = new Color(255, 255, 255, 255); @@ -98,7 +99,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[dust].scale = 0.7f; if (dust != Main.maxDust) { - Dust dust2 = Dust.CloneDust(dust); + Dust dust2 = Dust.BetterCloneDust(dust); dust2.scale /= 2f; dust2.fadeIn *= 0.85f; dust2.color = new Color(255, 255, 255, 255); @@ -148,7 +149,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[dust].scale = 1.4f; if (dust != Main.maxDust) { - Dust dust2 = Dust.CloneDust(dust); + Dust dust2 = Dust.BetterCloneDust(dust); dust2.scale /= 2f; dust2.fadeIn *= 0.85f; dust2.color = new Color(255, 255, 255, 255); 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/DarkSparkBeam.cs b/Projectiles/Magic/DarkSparkBeam.cs index fe351407b1..fe2f9529ce 100644 --- a/Projectiles/Magic/DarkSparkBeam.cs +++ b/Projectiles/Magic/DarkSparkBeam.cs @@ -1,6 +1,7 @@ using System; using System.IO; using CalamityMod.NPCs; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -143,7 +144,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[rainbowDust].noGravity = true; if (Projectile.scale != 1.4f) { - Dust rainbowClone = Dust.CloneDust(rainbowDust); + Dust rainbowClone = Dust.BetterCloneDust(rainbowDust); rainbowClone.color = color; rainbowClone.scale /= 2f; rainbowClone.noGravity = true; 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/RainbowRocket.cs b/Projectiles/Magic/RainbowRocket.cs index 14c9e803b6..7913e55a19 100644 --- a/Projectiles/Magic/RainbowRocket.cs +++ b/Projectiles/Magic/RainbowRocket.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.DataStructures; using CalamityMod.Graphics.Primitives; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -417,7 +418,7 @@ namespace CalamityMod.Projectiles.Magic dust.color = Color.SkyBlue; dust.fadeIn = 1.5f; - dust = Dust.CloneDust(dust); + dust = Dust.BetterCloneDust(dust); dust.position = center + bezierCurve.Evaluate(i / (float)evaluationPoints).RotatedBy(offsetAngle) * new Vector2(-1f, 1f); } } @@ -649,7 +650,7 @@ namespace CalamityMod.Projectiles.Magic dust.scale = 1.4f; dust.noGravity = true; - dust = Dust.CloneDust(dust); + dust = Dust.BetterCloneDust(dust); dust.position = center + bezierCurve.Evaluate(i / (float)evaluationPoints) * new Vector2(1f, -1f) + new Vector2(30f, -12f); } } @@ -691,7 +692,7 @@ namespace CalamityMod.Projectiles.Magic dust.color = Color.Purple; dust.fadeIn = 1.5f; - dust = Dust.CloneDust(dust); + dust = Dust.BetterCloneDust(dust); dust.velocity = dust.velocity.RotatedBy(MathHelper.PiOver4); dust.color = Color.White; } 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/ValkyrieRayBeam.cs b/Projectiles/Magic/ValkyrieRayBeam.cs index f028615069..61bf80969b 100644 --- a/Projectiles/Magic/ValkyrieRayBeam.cs +++ b/Projectiles/Magic/ValkyrieRayBeam.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -195,7 +196,7 @@ namespace CalamityMod.Projectiles.Magic // If the beam isn't at max scale, then make additional smaller dust. if (Projectile.scale != MaxBeamScale) { - Dust smallDust = Dust.CloneDust(d); + Dust smallDust = Dust.BetterCloneDust(d); smallDust.scale /= 2f; } } 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/Magic/YharimsCrystalBeam.cs b/Projectiles/Magic/YharimsCrystalBeam.cs index 2f72ac129f..ea5730ca5b 100644 --- a/Projectiles/Magic/YharimsCrystalBeam.cs +++ b/Projectiles/Magic/YharimsCrystalBeam.cs @@ -2,6 +2,7 @@ using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -275,7 +276,7 @@ namespace CalamityMod.Projectiles.Magic // If the beam isn't at max scale, then make additional smaller dust. if (Projectile.scale != MaxBeamScale) { - Dust smallDust = Dust.CloneDust(d); + Dust smallDust = Dust.BetterCloneDust(d); smallDust.scale /= 2f; } } diff --git a/Projectiles/Melee/BasherHoldout.cs b/Projectiles/Melee/BasherHoldout.cs index af058d0bcc..ff82182a62 100644 --- a/Projectiles/Melee/BasherHoldout.cs +++ b/Projectiles/Melee/BasherHoldout.cs @@ -221,7 +221,7 @@ namespace CalamityMod.Projectiles.Melee float minMult = 0.3f; int hitsToMinMult = 5; float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= damageMult * (Owner.Calamity().mouseRight ? 2.5f : 1); + modifiers.SourceDamage *= damageMult * (Owner.Calamity().mouseRight ? 2f : 1); } public override bool PreDraw(ref Color lightColor) { 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/FallenPaladinsHammerProj.cs b/Projectiles/Melee/FallenPaladinsHammerProj.cs index 67390506e9..e3d760c629 100644 --- a/Projectiles/Melee/FallenPaladinsHammerProj.cs +++ b/Projectiles/Melee/FallenPaladinsHammerProj.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -123,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee fire.noGravity = true; fire.scale = Main.rand.NextFloat(0.7f, 1.2f) + EmpoweredHammer * 0.4f; - fire = Dust.CloneDust(fire); + fire = Dust.BetterCloneDust(fire); fire.velocity = Main.rand.NextVector2Circular(3f, 3f); fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f); } @@ -146,7 +147,7 @@ namespace CalamityMod.Projectiles.Melee fire.noGravity = true; fire.scale = Main.rand.NextFloat(0.7f, 1.2f) + EmpoweredHammer * 0.4f; - fire = Dust.CloneDust(fire); + fire = Dust.BetterCloneDust(fire); fire.velocity = Main.rand.NextVector2Circular(3f, 3f); fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f); } 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/GalaxySmasherHammer.cs b/Projectiles/Melee/GalaxySmasherHammer.cs index 5a66ea8800..d3e0cfb994 100644 --- a/Projectiles/Melee/GalaxySmasherHammer.cs +++ b/Projectiles/Melee/GalaxySmasherHammer.cs @@ -5,6 +5,7 @@ using CalamityMod.Dusts; using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -166,7 +167,7 @@ namespace CalamityMod.Projectiles.Melee fire.noGravity = true; fire.scale = Main.rand.NextFloat(0.2f, 0.6f) * EmpoweredHammer; - fire = Dust.CloneDust(fire); + fire = Dust.BetterCloneDust(fire); fire.velocity = Main.rand.NextVector2Circular(3f, 3f); fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.04f); } diff --git a/Projectiles/Melee/GemTechYellowShard.cs b/Projectiles/Melee/GemTechYellowShard.cs index a48970bd9c..da5b7d4cd5 100644 --- a/Projectiles/Melee/GemTechYellowShard.cs +++ b/Projectiles/Melee/GemTechYellowShard.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using CalamityMod.Utilities; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -48,8 +49,8 @@ namespace CalamityMod.Projectiles.Melee crystalShard.color = Color.Yellow; crystalShard.noGravity = true; - Dust.CloneDust(crystalShard).velocity = initialVelocity.RotatedBy(MathHelper.Pi * 0.666f) * i / 4f; - Dust.CloneDust(crystalShard).velocity = initialVelocity.RotatedBy(MathHelper.Pi * -0.666f) * i / 4f; + Dust.BetterCloneDust(crystalShard).velocity = initialVelocity.RotatedBy(MathHelper.Pi * 0.666f) * i / 4f; + Dust.BetterCloneDust(crystalShard).velocity = initialVelocity.RotatedBy(MathHelper.Pi * -0.666f) * i / 4f; } Projectile.localAI[0] = 1f; } diff --git a/Projectiles/Melee/LightspeedDashHitbox.cs b/Projectiles/Melee/LightspeedDashHitbox.cs index 1f6dfd62a0..198524c45c 100644 --- a/Projectiles/Melee/LightspeedDashHitbox.cs +++ b/Projectiles/Melee/LightspeedDashHitbox.cs @@ -1,7 +1,8 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using CalamityMod.Sounds; -using System; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -43,8 +44,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 @@ -66,6 +67,8 @@ namespace CalamityMod.Projectiles.Melee Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.4f, 0.9f), Color.OrangeRed, 50, 2, 2.5f, hueShift: 0.06f); GeneralParticleHandler.SpawnParticle(energyLeak); } + + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Melee/LightspeedM1Hitbox.cs b/Projectiles/Melee/LightspeedM1Hitbox.cs index 1a8c420304..cf1c27cfa3 100644 --- a/Projectiles/Melee/LightspeedM1Hitbox.cs +++ b/Projectiles/Melee/LightspeedM1Hitbox.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs; using CalamityMod.Particles; @@ -62,6 +63,8 @@ namespace CalamityMod.Projectiles.Melee Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.25f, 0.5f), Color.OrangeRed, 22, 2, 2.5f, hueShift: 0.06f); GeneralParticleHandler.SpawnParticle(energyLeak); } + + target.AddBuff(ModContent.BuffType(), 60); } } } diff --git a/Projectiles/Melee/LucreciaDNATrailCreator.cs b/Projectiles/Melee/LucreciaDNATrailCreator.cs index a8ffa98c27..09f3bb6b96 100644 --- a/Projectiles/Melee/LucreciaDNATrailCreator.cs +++ b/Projectiles/Melee/LucreciaDNATrailCreator.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.extraUpdates = 12; Projectile.timeLeft = 2400; - Projectile.minion = true; // Scuffed but it prevents the projectile from being culled in a few situations + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.alpha = 255; } diff --git a/Projectiles/Melee/LuxorsGiftMelee.cs b/Projectiles/Melee/LuxorsGiftMelee.cs index 1d1770c2a9..a7a9baedcf 100644 --- a/Projectiles/Melee/LuxorsGiftMelee.cs +++ b/Projectiles/Melee/LuxorsGiftMelee.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(spark); } - if (Collision.SolidCollision(Projectile.Center, 9, 9)) + if (Collision.SolidCollision(Projectile.Center, 9, 9) && Projectile.timeLeft <= 150) Projectile.velocity *= 0.91f; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) diff --git a/Projectiles/Melee/PrismRay.cs b/Projectiles/Melee/PrismRay.cs index e1638f5750..d5a055a2f1 100644 --- a/Projectiles/Melee/PrismRay.cs +++ b/Projectiles/Melee/PrismRay.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -84,7 +85,7 @@ namespace CalamityMod.Projectiles.Melee risingMagic.scale = Main.rand.NextFloat(0.6f, 1.2f); risingMagic.noLight = true; - risingMagic = Dust.CloneDust(risingMagic); + risingMagic = Dust.BetterCloneDust(risingMagic); risingMagic.scale *= 0.65f; risingMagic.fadeIn *= 0.65f; risingMagic.color = new Color(255, 255, 255, 255); @@ -183,7 +184,7 @@ namespace CalamityMod.Projectiles.Melee explosionDust.scale = 1.1f; explosionDust.fadeIn = Main.rand.NextFloat(1.4f, 2.4f); - explosionDust = Dust.CloneDust(explosionDust); + explosionDust = Dust.BetterCloneDust(explosionDust); explosionDust.scale /= 2f; explosionDust.fadeIn /= 2f; explosionDust.color = new Color(255, 255, 255, 255); @@ -198,7 +199,7 @@ namespace CalamityMod.Projectiles.Melee explosionDust.scale = Main.rand.NextFloat(); explosionDust.fadeIn = Main.rand.NextFloat(1.4f, 2.4f); - explosionDust = Dust.CloneDust(explosionDust); + explosionDust = Dust.BetterCloneDust(explosionDust); explosionDust.scale /= 2f; explosionDust.fadeIn /= 2f; explosionDust.color = new Color(255, 255, 255, 255); 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..83f946ec7a 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*15f); 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 = (int)(Projectile.damage* 30f); 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/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index b4c31c6166..b61bd6042b 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -262,14 +262,13 @@ namespace CalamityMod.Projectiles.Melee.Spears target.AddBuff(ModContent.BuffType(), 900); Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ProjectileID.VampireHeal, (int)Math.Round(hit.Damage * 0.0015)); if (Projectile.damage > 1) - Projectile.damage = (int)(Projectile.damage * 0.85f); + Projectile.damage = (int)(Projectile.damage * 0.925f); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { modifiers.SetCrit(); - - float critDamage = Math.Min(Main.player[Projectile.owner].GetTotalCritChance(Projectile.DamageType) * 0.01f, 1f); - modifiers.SourceDamage *= 1 + critDamage; + float critDamage = Main.player[Projectile.owner].GetTotalCritChance(Projectile.DamageType) * 0.02f; + modifiers.CritDamage += critDamage; } } } diff --git a/Projectiles/Melee/StellarContemptHammer.cs b/Projectiles/Melee/StellarContemptHammer.cs index 680985e763..77226c9bd1 100644 --- a/Projectiles/Melee/StellarContemptHammer.cs +++ b/Projectiles/Melee/StellarContemptHammer.cs @@ -3,6 +3,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -147,7 +148,7 @@ namespace CalamityMod.Projectiles.Melee fire.noGravity = true; fire.scale = Main.rand.NextFloat(0.2f, 0.6f) * EmpoweredHammer; - fire = Dust.CloneDust(fire); + fire = Dust.BetterCloneDust(fire); fire.velocity = Main.rand.NextVector2Circular(3f, 3f); fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.04f); fire.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; diff --git a/Projectiles/Ranged/AdamAcceleratorBeam.cs b/Projectiles/Ranged/AdamAcceleratorBeam.cs index f8c1737c54..275fa2515b 100644 --- a/Projectiles/Ranged/AdamAcceleratorBeam.cs +++ b/Projectiles/Ranged/AdamAcceleratorBeam.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs; +using CalamityMod.Utilities; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -237,7 +238,7 @@ namespace CalamityMod.Projectiles.Ranged // If the beam isn't at max scale, then make additional smaller dust. if (Projectile.scale != MaxBeamScale) { - Dust smallDust = Dust.CloneDust(d); + Dust smallDust = Dust.BetterCloneDust(d); smallDust.scale /= 2f; } } 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/CondemnationArrow.cs b/Projectiles/Ranged/CondemnationArrow.cs index 519e27b5e3..054797008e 100644 --- a/Projectiles/Ranged/CondemnationArrow.cs +++ b/Projectiles/Ranged/CondemnationArrow.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Projectiles.Ranged { @@ -84,7 +85,7 @@ namespace CalamityMod.Projectiles.Ranged fire.color = Color.Lerp(Color.White, Color.Purple, Main.rand.NextFloat()); fire.scale = Main.rand.NextFloat(1f, 1.1f); - fire = Dust.CloneDust(fire); + fire = Dust.BetterCloneDust(fire); fire.velocity = Main.rand.NextVector2Circular(3f, 3f); fire.velocity += Projectile.velocity * 0.6f; } 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/FreedomStarBeam.cs b/Projectiles/Ranged/FreedomStarBeam.cs index ed2c586152..75221266a8 100644 --- a/Projectiles/Ranged/FreedomStarBeam.cs +++ b/Projectiles/Ranged/FreedomStarBeam.cs @@ -9,6 +9,7 @@ using Terraria.GameContent.Shaders; using Terraria.Graphics.Effects; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Projectiles.Ranged { @@ -262,7 +263,7 @@ namespace CalamityMod.Projectiles.Ranged // If the beam isn't at max scale, then make additional smaller dust. if (Projectile.scale != MaxBeamScale) { - Dust smallDust = Dust.CloneDust(d); + Dust smallDust = Dust.BetterCloneDust(d); smallDust.scale /= 2f; } } diff --git a/Projectiles/Ranged/GodSlayerSlugProj.cs b/Projectiles/Ranged/GodSlayerSlugProj.cs index 3f492ffb36..a1b4f86475 100644 --- a/Projectiles/Ranged/GodSlayerSlugProj.cs +++ b/Projectiles/Ranged/GodSlayerSlugProj.cs @@ -1,6 +1,7 @@ using System.IO; using CalamityMod.Dusts; using CalamityMod.Particles; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -8,6 +9,7 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using System.Linq; namespace CalamityMod.Projectiles.Ranged { @@ -194,8 +196,8 @@ namespace CalamityMod.Projectiles.Ranged d.fadeIn = 1.5f; d.scale *= Main.rand.NextFloat(1.4f, 1.9f) - lerp * 0.5f; d.color = Color.Lerp(Color.Cyan, Color.Magenta, lerp); - Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 2f / 3f); - Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 4f / 3f); + Dust.BetterCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 2f / 3f); + Dust.BetterCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 4f / 3f); } } @@ -243,9 +245,9 @@ namespace CalamityMod.Projectiles.Ranged d.scale *= Main.rand.NextFloat(1.8f, 2.2f) * (1 - speed / 7); d.color = color; d.fadeIn = 1; - Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.PiOver2); - Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi); - Dust.CloneDust(d).velocity = dustVel.RotatedBy(-MathHelper.PiOver2); + Dust.BetterCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.PiOver2); + Dust.BetterCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi); + Dust.BetterCloneDust(d).velocity = dustVel.RotatedBy(-MathHelper.PiOver2); } } } 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/LuxorsGiftRanged.cs b/Projectiles/Ranged/LuxorsGiftRanged.cs index a19a9fa41c..83e08f12ba 100644 --- a/Projectiles/Ranged/LuxorsGiftRanged.cs +++ b/Projectiles/Ranged/LuxorsGiftRanged.cs @@ -29,6 +29,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; Projectile.extraUpdates = 5; + Projectile.tileCollide = false; } public override void AI() { @@ -49,6 +50,8 @@ namespace CalamityMod.Projectiles.Ranged dust.noLightEmittence = true; } } + if (!Collision.SolidCollision(Projectile.Center, 35, 35) || Projectile.timeLeft < 200) + Projectile.tileCollide = true; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { 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/SepticSkewerHarpoon.cs b/Projectiles/Ranged/SepticSkewerHarpoon.cs index 1306b8f225..313c2bdfee 100644 --- a/Projectiles/Ranged/SepticSkewerHarpoon.cs +++ b/Projectiles/Ranged/SepticSkewerHarpoon.cs @@ -1,12 +1,13 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using CalamityMod.DataStructures; using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -46,7 +47,7 @@ namespace CalamityMod.Projectiles.Ranged public bool strongEnemy = false; public bool normalHit = false; - public bool pullCheckValid => ((chosenTarget != null && chosenTarget.life < Projectile.damage * 28f && !calledToPull && chosenTarget.realLife == -1 && !normalHit) || Main.zenithWorld); + public bool pullCheckValid => ((chosenTarget != null && chosenTarget.life < Projectile.damage * 20f && !calledToPull && chosenTarget.realLife == -1 && !normalHit && (CalamityPlayer.areThereAnyDamnBosses ? chosenTarget.life <= chosenTarget.lifeMax / 4 : true)) || Main.zenithWorld); public override void SetStaticDefaults() { ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; 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/BlazingStarProj.cs b/Projectiles/Rogue/BlazingStarProj.cs index 30035fff76..fbf4344802 100644 --- a/Projectiles/Rogue/BlazingStarProj.cs +++ b/Projectiles/Rogue/BlazingStarProj.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 16; Projectile.friendly = true; Projectile.tileCollide = true; - Projectile.penetrate = 10; + Projectile.penetrate = 6; Projectile.MaxUpdates = 3; Projectile.timeLeft = Lifetime; DrawOffsetX = -10; @@ -88,6 +88,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + Projectile.damage = (int)(Projectile.damage * 0.9f); if (Projectile.Calamity().stealthStrike) { if (!hasHit) 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/DoomsdayDeviceProjectile.cs b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs index 265b3e9638..ebdf68342e 100644 --- a/Projectiles/Rogue/DoomsdayDeviceProjectile.cs +++ b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs @@ -55,6 +55,11 @@ namespace CalamityMod.Projectiles.Rogue public override bool? CanDamage() => (flung && tileHits == 0 ? null : false); public override void AI() { + if (Owner.dead && !flung) + { + Projectile.Kill(); + return; + } // The main color shifting float rate = (Main.GlobalTimeWrappedHourly * 6); List eColors = new List() diff --git a/Projectiles/Rogue/ExorcismProj.cs b/Projectiles/Rogue/ExorcismProj.cs index 86e4795ad8..80d124066f 100644 --- a/Projectiles/Rogue/ExorcismProj.cs +++ b/Projectiles/Rogue/ExorcismProj.cs @@ -55,6 +55,11 @@ namespace CalamityMod.Projectiles.Rogue public override bool? CanDamage() => ((flung && !inSky && !hitTiles && impaleDist == Vector2.Zero) ? null : false); public override void AI() { + if (Owner.dead && !flung) + { + Projectile.Kill(); + return; + } if (stealth && Projectile.ai[2] != 5) // Multiplayer Syncing? { Projectile.ai[2] = 5; @@ -426,6 +431,7 @@ namespace CalamityMod.Projectiles.Rogue Color glowColor = Color.Lerp(mainColor, Color.Khaki, glowUp - 1); Texture2D tex = TextureAssets.Projectile[Type].Value; Asset glowBlade = ModContent.Request("CalamityMod/Particles/GlowBlade"); + Asset glowBottom = ModContent.Request("CalamityMod/Particles/SquareRotated"); Asset woosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); if (hitTiles || falling || stealth) @@ -453,6 +459,9 @@ namespace CalamityMod.Projectiles.Rogue for (int y = 0; y < 2; y++) Main.EntitySpriteDraw(glowBlade.Value, fxPos - Main.screenPosition, null, (y != 0 ? Color.White : mainColor) with { A = 0 } * (0.3f * glowUp), fxVel.ToRotation() + MathHelper.PiOver2, glowBlade.Size() / 2f, new Vector2(0.4f * (y != 0 ? 0.65f : 1f), 1f * throwCompletion * glowUp * (i == 0 ? 1.5f : 1)) * Projectile.scale * 0.04f, SpriteEffects.None, 0); + float softGlowUp = (float)Math.Pow(glowUp, 0.15f); + for (int y = 0; y < 3; y++) + Main.EntitySpriteDraw(glowBottom.Value, fxPos - Main.screenPosition - fxVel * 0.55f, null, (y != 0 ? Color.White : mainColor) with { A = 0 } * (0.1f * glowUp), fxVel.ToRotation() + MathHelper.PiOver2, glowBottom.Size() / 2f, new Vector2(1f * (y != 0 ? 0.65f : 1f) * softGlowUp, 1.7f * throwCompletion * softGlowUp * (i == 0 ? 1.5f : 1)) * Projectile.scale * (y == 2 ? 0.3f : 0.25f), SpriteEffects.None, 0); } } diff --git a/Projectiles/Rogue/GlaiveProj.cs b/Projectiles/Rogue/GlaiveProj.cs index d7d71f3de2..e03f378a24 100644 --- a/Projectiles/Rogue/GlaiveProj.cs +++ b/Projectiles/Rogue/GlaiveProj.cs @@ -86,6 +86,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + Projectile.damage = (int)(Projectile.damage * 0.9f); if (Projectile.Calamity().stealthStrike) { if (!hasHit) diff --git a/Projectiles/Rogue/LuxorsGiftRogue.cs b/Projectiles/Rogue/LuxorsGiftRogue.cs index be8ef36f5a..d938e15468 100644 --- a/Projectiles/Rogue/LuxorsGiftRogue.cs +++ b/Projectiles/Rogue/LuxorsGiftRogue.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; Projectile.extraUpdates = 3; + Projectile.tileCollide = false; } public override void AI() { @@ -50,6 +51,8 @@ namespace CalamityMod.Projectiles.Rogue dust.color = Color.Magenta; dust.noLightEmittence = true; } + if (!Collision.SolidCollision(Projectile.Center, 35, 35) || Projectile.timeLeft <= 500) + Projectile.tileCollide = true; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { diff --git a/Projectiles/Rogue/RadiationRain.cs b/Projectiles/Rogue/RadiationRain.cs index 72de92480f..5938658b73 100644 --- a/Projectiles/Rogue/RadiationRain.cs +++ b/Projectiles/Rogue/RadiationRain.cs @@ -1,9 +1,10 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Enums; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Particles; namespace CalamityMod.Projectiles.Rogue { @@ -45,14 +46,17 @@ namespace CalamityMod.Projectiles.Rogue GeneralParticleHandler.SpawnParticle(orb); Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Chartreuse, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.8f, 0.4f, 18); GeneralParticleHandler.SpawnParticle(orb3); + orb3.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), 0.4f, 0.2f, 18); GeneralParticleHandler.SpawnParticle(orb2); + orb2.DrawLayer = GeneralDrawLayer.AfterEverything; for (int i = 0; i < 2; i++) { int dir = (i == 0 ? 1 : -1); Particle pulse3 = new GlowSparkParticle(Projectile.Center + new Vector2(20 * dir, 0), new Vector2(10 * dir, 0), false, 12, 0.087f, Color.Chartreuse, new Vector2(1.7f, 0.8f), true, true, 0.8f); GeneralParticleHandler.SpawnParticle(pulse3); + pulse3.DrawLayer = GeneralDrawLayer.AfterEverything; } for (int i = 0; i < 3; i++) diff --git a/Projectiles/Rogue/SporeKnifeBud.cs b/Projectiles/Rogue/SporeKnifeBud.cs index fab64ac627..ef8f5aef50 100644 --- a/Projectiles/Rogue/SporeKnifeBud.cs +++ b/Projectiles/Rogue/SporeKnifeBud.cs @@ -1,6 +1,8 @@ -using CalamityMod.Particles; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -23,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.width = 12; Projectile.height = 12; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; + Projectile.DamageType = RogueDamageClass.Instance; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; @@ -60,6 +62,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + SoundEngine.PlaySound(SporeKnife.ChompSound, Projectile.Center); Sticky = true; target.AddBuff(BuffID.Poisoned, 60); for (int i = 0; i < 3; i++) diff --git a/Projectiles/Rogue/SporeKnifeProj.cs b/Projectiles/Rogue/SporeKnifeProj.cs index d40c4525c7..5fb9197332 100644 --- a/Projectiles/Rogue/SporeKnifeProj.cs +++ b/Projectiles/Rogue/SporeKnifeProj.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -52,7 +53,10 @@ namespace CalamityMod.Projectiles.Rogue public override void OnKill(int timeLeft) { #region Visuals and Sound - SoundEngine.PlaySound(SoundID.Grass with { Pitch = -0.5f, PitchVariance = 0.4f }, Projectile.Center); + if (Projectile.Calamity().stealthStrike) + SoundEngine.PlaySound(SporeKnife.StealthImpactSound, Projectile.Center); + else + SoundEngine.PlaySound(SporeKnife.ImpactSound, Projectile.Center); for (int i = 0; i < 18; i++) { diff --git a/Projectiles/Rogue/TheAtomSplitterProjectile.cs b/Projectiles/Rogue/TheAtomSplitterProjectile.cs index 3c3c9d3e62..2c842ca889 100644 --- a/Projectiles/Rogue/TheAtomSplitterProjectile.cs +++ b/Projectiles/Rogue/TheAtomSplitterProjectile.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -99,7 +100,7 @@ namespace CalamityMod.Projectiles.Rogue prismaticEnergy.color = dustColor; prismaticEnergy.noGravity = true; - prismaticEnergy = Dust.CloneDust(prismaticEnergy); + prismaticEnergy = Dust.BetterCloneDust(prismaticEnergy); prismaticEnergy.scale *= 0.6f; } } @@ -151,9 +152,9 @@ namespace CalamityMod.Projectiles.Rogue explosionDust.scale = 1.1f; explosionDust.fadeIn = Main.rand.NextFloat(1.4f, 2.4f); - Dust.CloneDust(explosionDust).velocity *= Main.rand.NextFloat(0.8f); + Dust.BetterCloneDust(explosionDust).velocity *= Main.rand.NextFloat(0.8f); - explosionDust = Dust.CloneDust(explosionDust); + explosionDust = Dust.BetterCloneDust(explosionDust); explosionDust.scale /= 2f; explosionDust.fadeIn /= 2f; explosionDust.color = new Color(255, 255, 255, 255); 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/Rogue/WhitewaterAura.cs b/Projectiles/Rogue/WhitewaterAura.cs index e47fa8cfe1..466840dfc2 100644 --- a/Projectiles/Rogue/WhitewaterAura.cs +++ b/Projectiles/Rogue/WhitewaterAura.cs @@ -76,10 +76,13 @@ namespace CalamityMod.Projectiles.Rogue Texture2D tex = ModContent.Request("CalamityMod/Particles/HighResFoggyCircleHardEdge").Value; Texture2D tex2 = ModContent.Request("CalamityMod/Particles/SoftRoundExplosion").Value; Color drawColor2 = Color.LightBlue; + float rotMult = CalamityClientConfig.Instance.Photosensitivity ? 0f : 1f; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, drawColor2 with { A = 0 }, 0, tex.Size() / 2f, 0.2f * fade * areaScale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor2 with { A = 0 } * 0.3f, Projectile.rotation, tex2.Size() / 2f, 0.2f * fade * areaScale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor2 with { A = 0 } * 0.3f, -Projectile.rotation, tex2.Size() / 2f, 0.2f * fade * areaScale, SpriteEffects.None, 0); + float opacityMult = CalamityClientConfig.Instance.Photosensitivity ? 0.33f : 1f; + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, drawColor2 with { A = 0 } * opacityMult, 0, tex.Size() / 2f, 0.2f * fade * areaScale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor2 with { A = 0 } * 0.3f * opacityMult, Projectile.rotation * rotMult, tex2.Size() / 2f, 0.2f * fade * areaScale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor2 with { A = 0 } * 0.3f * opacityMult, -Projectile.rotation * rotMult, tex2.Size() / 2f, 0.2f * fade * areaScale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Summon/BrittleStarMinion.cs b/Projectiles/Summon/BrittleStarMinion.cs index 31eedec90e..59a7afc0be 100644 --- a/Projectiles/Summon/BrittleStarMinion.cs +++ b/Projectiles/Summon/BrittleStarMinion.cs @@ -27,6 +27,14 @@ namespace CalamityMod.Projectiles.Summon public int ReformingTimer = 25; public bool Reforming = false; public int Time = 0; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + base.SetStaticDefaults(); + } + public override void SetDefaults() { Projectile.width = 30; diff --git a/Projectiles/Summon/Dreadmine.cs b/Projectiles/Summon/Dreadmine.cs index cf476b8845..0f45d5e234 100644 --- a/Projectiles/Summon/Dreadmine.cs +++ b/Projectiles/Summon/Dreadmine.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.alpha = 255; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 3600; + Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Summon; } @@ -66,18 +66,10 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity.X = Projectile.velocity.X - 0.002f * yflag; Projectile.velocity.Y = Projectile.velocity.Y - 0.002f * xflag; } - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 5400f) + Projectile.ai[2] += 1f; + if (Projectile.ai[2] > 5400f) { Projectile.ai[1] = 1f; - if (Projectile.ai[0] < 5500f) - { - return; - } - if (Projectile.owner == Main.myPlayer) - { - Projectile.Kill(); - } } else { @@ -110,7 +102,7 @@ namespace CalamityMod.Projectiles.Summon { playerDist *= 1.7f; } - Projectile.ai[0] += playerDist; + Projectile.ai[2] += playerDist; if (Projectile.alpha > 0) { Projectile.alpha -= 25; diff --git a/Projectiles/Summon/DreadmineTurret.cs b/Projectiles/Summon/DreadmineTurret.cs index c0ef740d36..1a1cc0a54e 100644 --- a/Projectiles/Summon/DreadmineTurret.cs +++ b/Projectiles/Summon/DreadmineTurret.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - Projectile.width = 26; - Projectile.height = 26; + Projectile.width = 46; + Projectile.height = 80; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.sentry = true; @@ -47,71 +47,33 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[0] = 0f; Projectile.netUpdate = true; } - if (Main.rand.NextBool(15)) + if (Projectile.ai[0] % 15 == 0) { int mineAmt = 0; foreach (Projectile p in Main.ActiveProjectiles) { - if (p.owner == Main.myPlayer && p.type == ModContent.ProjectileType()) + if (p.owner == Main.myPlayer && p.type == ModContent.ProjectileType() && p.ai[0] == Projectile.whoAmI) { mineAmt++; } } - if (Main.rand.Next(15) >= mineAmt && mineAmt < 10) - { - int spawnVariance = 24; - int moreSpawnVariance = 90; - for (int j = 0; j < 50; j++) + for (float i = 0; i < 5; i++) + if (Main.myPlayer == Projectile.owner && mineAmt < 25) { - int randSpawn = Main.rand.Next(200 - j * 2, 400 + j * 2); + int dreadmineWidth = 58; Vector2 center = Projectile.Center; - center.X += (float)Main.rand.Next(-randSpawn, randSpawn + 1); - center.Y += (float)Main.rand.Next(-randSpawn, randSpawn + 1); - if (!Collision.SolidCollision(center, spawnVariance, spawnVariance)) + center += new Vector2(256 * Main.rand.NextFloat() + 64, 0).RotatedByRandom(MathHelper.TwoPi); // This determines the offset of the mine at a random distance between 64 and 320 pixels away. The lower bound is set so mines don't spawn on top of the turret itself, and also helps even out distribution a little. + if (!Collision.SolidCollision(center - Projectile.Size / 2f, dreadmineWidth, dreadmineWidth)) { - center.X += (float)(spawnVariance / 2); - center.Y += (float)(spawnVariance / 2); - if (Collision.CanHit(new Vector2(Projectile.Center.X, Projectile.position.Y), 1, 1, center, 1, 1) || - Collision.CanHit(new Vector2(Projectile.Center.X, Projectile.position.Y - 50f), 1, 1, center, 1, 1)) - { - int tileX = (int)center.X / 16; - int tileY = (int)center.Y / 16; - bool canSpawnMine = false; - if (Main.rand.NextBool(3) && Main.tile[tileX, tileY] != null && Main.tile[tileX, tileY].WallType > WallID.None) - { - canSpawnMine = true; - } - else - { - center.X -= (float)(moreSpawnVariance / 2); - center.Y -= (float)(moreSpawnVariance / 2); - if (Collision.SolidCollision(center, moreSpawnVariance, moreSpawnVariance)) - { - center.X += (float)(moreSpawnVariance / 2); - center.Y += (float)(moreSpawnVariance / 2); - canSpawnMine = true; - } - } - if (canSpawnMine) - { - for (int k = 0; k < Main.maxProjectiles; k++) - { - if (Main.projectile[k].active && Main.projectile[k].owner == Main.myPlayer && - Main.projectile[k].type == ModContent.ProjectileType() && (center - Main.projectile[k].Center).Length() < 48f) - { - canSpawnMine = false; - break; - } - } - if (canSpawnMine && Main.myPlayer == Projectile.owner) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } - } - } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner,Projectile.whoAmI); + mineAmt++; + i -= 0.75f; // This will cause it to run more loops when mines fail, but still eventually get up to the cap of 5 mines per activation even if no spots to spawn can be found. } } - } + else + { + break; + } } } diff --git a/Projectiles/Summon/EnchantedKnifeSummon.cs b/Projectiles/Summon/EnchantedKnifeSummon.cs index 3537ae9712..9aa3853d86 100644 --- a/Projectiles/Summon/EnchantedKnifeSummon.cs +++ b/Projectiles/Summon/EnchantedKnifeSummon.cs @@ -50,6 +50,12 @@ namespace CalamityMod.Projectiles.Summon private bool HasSpawned; + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + } + public override void SetDefaults() { base.SetDefaults(); diff --git a/Projectiles/Summon/HomingGammaBullet.cs b/Projectiles/Summon/HomingGammaBullet.cs index 55cbf798a7..1ae12d7254 100644 --- a/Projectiles/Summon/HomingGammaBullet.cs +++ b/Projectiles/Summon/HomingGammaBullet.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -131,7 +132,7 @@ namespace CalamityMod.Projectiles.Summon sulphuricAcid.noGravity = true; sulphuricAcid.velocity *= 1.8f; - sulphuricAcid = Dust.CloneDust(sulphuricAcid); + sulphuricAcid = Dust.BetterCloneDust(sulphuricAcid); sulphuricAcid.velocity *= -1f; } } diff --git a/Projectiles/Summon/IceClasperMinion.cs b/Projectiles/Summon/IceClasperMinion.cs index d99434a91f..07093de895 100644 --- a/Projectiles/Summon/IceClasperMinion.cs +++ b/Projectiles/Summon/IceClasperMinion.cs @@ -34,6 +34,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; base.SetStaticDefaults(); Main.projFrames[Type] = 6; } diff --git a/Projectiles/Summon/MiniGuardianHealer.cs b/Projectiles/Summon/MiniGuardianHealer.cs index 53397e2946..66154032ff 100644 --- a/Projectiles/Summon/MiniGuardianHealer.cs +++ b/Projectiles/Summon/MiniGuardianHealer.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.Summon.Whips; using CalamityMod.CalPlayer; using CalamityMod.Items.Accessories; using CalamityMod.NPCs.Providence; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -149,7 +150,7 @@ namespace CalamityMod.Projectiles.Summon Main.dust[dust].noGravity = true; Main.dust[dust].scale = 1f + k; Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust2 = Dust.CloneDust(dust); + Dust dust2 = Dust.BetterCloneDust(dust); Dust dust3 = dust2; dust3.scale /= 2f; dust3 = dust2; diff --git a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs index 5c3722b6de..98904657fc 100644 --- a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs +++ b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs @@ -6,6 +6,7 @@ using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -1164,7 +1165,7 @@ namespace CalamityMod.Projectiles.Summon dust26.fadeIn = fadeIn; dust26.scale = num981; dust26.noLight = true; - Dust dust27 = Dust.CloneDust(dust26); + Dust dust27 = Dust.BetterCloneDust(dust26); Dust dust = dust27; dust.scale *= 0.65f; dust = dust27; @@ -1210,7 +1211,7 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num71].noGravity = true; Main.dust[num71].scale = 2f; Main.dust[num71].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust11 = Dust.CloneDust(num71); + Dust dust11 = Dust.BetterCloneDust(num71); Dust dust = dust11; dust.scale /= 2f; dust = dust11; @@ -1228,7 +1229,7 @@ namespace CalamityMod.Projectiles.Summon dust.noGravity = true; dust.scale = Main.rand.NextFloat() * 1f; dust.fadeIn = Main.rand.NextFloat() * 2f; - Dust dust12 = Dust.CloneDust(num74); + Dust dust12 = Dust.BetterCloneDust(num74); dust = dust12; dust.scale /= 2f; dust = dust12; 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/SilvaCrystalExplosion.cs b/Projectiles/Summon/SilvaCrystalExplosion.cs index b118833432..ce1204a35e 100644 --- a/Projectiles/Summon/SilvaCrystalExplosion.cs +++ b/Projectiles/Summon/SilvaCrystalExplosion.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Utilities; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -86,7 +87,7 @@ namespace CalamityMod.Projectiles.Summon rainbowDust.fadeIn = fadeIn; rainbowDust.noLight = true; - Dust rainbowDust2 = Dust.CloneDust(rainbowDust); + Dust rainbowDust2 = Dust.BetterCloneDust(rainbowDust); rainbowDust2.scale *= 0.65f; rainbowDust2.fadeIn *= 0.65f; rainbowDust2.color = new Color(255, 255, 255, 255); @@ -114,7 +115,7 @@ namespace CalamityMod.Projectiles.Summon dustID.noGravity = true; dustID.fadeIn = Main.rand.NextFloat() * 2f; - Dust dustCloning = Dust.CloneDust(dustID); + Dust dustCloning = Dust.BetterCloneDust(dustID); dustCloning.scale /= 2f; dustCloning.fadeIn /= 2f; dustCloning.color = Color.White; @@ -125,7 +126,7 @@ namespace CalamityMod.Projectiles.Summon dustID.noGravity = true; dustID.fadeIn = Main.rand.NextFloat() * 2f; - Dust dustCloning2 = Dust.CloneDust(dustID); + Dust dustCloning2 = Dust.BetterCloneDust(dustID); dustCloning2.scale /= 2f; dustCloning2.fadeIn /= 2f; dustCloning2.color = Color.White; 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/Summon/VengefulSunSpiritMinion.cs b/Projectiles/Summon/VengefulSunSpiritMinion.cs index 61676b14c0..531def854b 100644 --- a/Projectiles/Summon/VengefulSunSpiritMinion.cs +++ b/Projectiles/Summon/VengefulSunSpiritMinion.cs @@ -152,7 +152,7 @@ namespace CalamityMod.Projectiles.Summon var whiteTex = GetWhiteTex(); var ciTex = CalamityUtils.GetTextureEfficient(ref circle, "CalamityMod/ExtraTextures/GreyscaleOpenCircleButBigger").Value; - float completion = (Projectile.minionSlots-1) / 9f; + float completion = (Projectile.minionSlots-1) / 6f; var color = Color.Lerp(Color.Yellow, Color.DarkOrange, completion); if (completion >= 1) color = Color.LightBlue; diff --git a/Projectiles/Typeless/PuddleSplash.cs b/Projectiles/Typeless/PuddleSplash.cs index 992b40eea4..0d8dff4a2c 100644 --- a/Projectiles/Typeless/PuddleSplash.cs +++ b/Projectiles/Typeless/PuddleSplash.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; Projectile.timeLeft = 25; } diff --git a/Projectiles/Typeless/StratusBlackHole.cs b/Projectiles/Typeless/StratusBlackHole.cs index faf207f8a7..032903d270 100644 --- a/Projectiles/Typeless/StratusBlackHole.cs +++ b/Projectiles/Typeless/StratusBlackHole.cs @@ -1,13 +1,10 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Weapons.Typeless; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Systems.Graphic.PixelationSystem; using CalamityMod.Systems.Mechanic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using ReLogic.Utilities; using Terraria; -using Terraria.Audio; using Terraria.Graphics.Shaders; using Terraria.ModLoader; @@ -17,8 +14,6 @@ namespace CalamityMod.Projectiles.Typeless { public new string LocalizationCategory => "Projectiles.Typeless"; - public SlotId LoopSoundSlot = SlotId.Invalid; - public override void SetStaticDefaults() { Main.projFrames[Type] = 6; @@ -64,36 +59,48 @@ namespace CalamityMod.Projectiles.Typeless } foreach (var player in Main.ActivePlayers) { - if (player.Distance(Projectile.Center) <= 600 && player.miscCounter % 30 == 15) + if (player.Distance(Projectile.Center) <= 600) { - player.Calamity().StratusStarburst++; - if (player.Calamity().StratusStarburst <= CalamityPlayer.MaxStratusStarburst) - player.Calamity().StarburstEntities.Add(new StarburstEntity(Projectile.Center)); - player.Calamity().StratusStarburstResetTimer = (int)MathHelper.Max(player.Calamity().StratusStarburstResetTimer, 180); + if (player.miscCounter % 30 == 15) + { + player.Calamity().StratusStarburst++; + if (player.Calamity().StratusStarburst <= CalamityPlayer.MaxStratusStarburst) + player.Calamity().StarburstEntities.Add(new StarburstEntity(Projectile.Center)); + player.Calamity().StratusStarburstResetTimer = (int)MathHelper.Max(player.Calamity().StratusStarburstResetTimer, 180); + } + if (player.wingsLogic > 0) + { + if (player.wingTime <= 0 && player.Calamity().AvaliableStarburst > 0) + { + player.Calamity().StratusStarburst--; + player.wingTime += 5; + } + } + else if (player.rocketBoots > 0) + { + if (player.rocketTime <= 0 && player.Calamity().AvaliableStarburst > 0) + { + player.Calamity().StratusStarburst--; + player.rocketTime += 1; + } + } + else + { + var activeJumps = player.extraJumps.Where(x => x.Enabled).Count(); + if (activeJumps > 0 && !player.AnyExtraJumpUsable() && player.Calamity().AvaliableStarburst >= 5 * activeJumps && !player.gravControl2) + { + player.Calamity().StratusStarburst -= 5 * activeJumps; + player.RefreshDoubleJumps(); + } + } } } - - 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) { + if (Projectile.timeLeft > (CalamityUtils.MinutesToFrames(10) - 45) * Projectile.MaxUpdates) + return false; return targetHitbox.IntersectsConeFastInaccurate(Projectile.Center, 600, 0, MathHelper.TwoPi); } static Texture2D _TransparentBloomTex; @@ -180,7 +187,7 @@ namespace CalamityMod.Projectiles.Typeless { Vector2 drawPosition = mproj.Projectile.Center - Main.screenPosition; - + #region Singularity var telegraphBase = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; diff --git a/Rarities/ColorTool.cs b/Rarities/ColorTool.cs index ca16bd0a20..77b3166b5a 100644 --- a/Rarities/ColorTool.cs +++ b/Rarities/ColorTool.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Rarities public override bool PreDrawTooltipLine(Item Item, DrawableTooltipLine line, ref int yOffset) { - if (line.Mod == "Terraria" && line.Name == "ItemName") + if (line.Mod == "Terraria" && line.Name == "ItemName" && CalamityClientConfig.Instance.TextEffects) { if (Item.rare == RarityCosmicPurple) { 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/Skies/DoGSky.cs b/Skies/DoGSky.cs index 74600d010d..f32181cccb 100644 --- a/Skies/DoGSky.cs +++ b/Skies/DoGSky.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using CalamityMod.Effects; +using CalamityMod.Events; using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.Systems.Graphic; @@ -222,7 +223,7 @@ namespace CalamityMod.Skies public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) { - if (Main.gameMenu || !CalamityClientConfig.Instance.FancyBackgroundVisuals) + if (Main.gameMenu || !CalamityClientConfig.Instance.FancyBackgroundVisuals || BossRushEvent.BossRushActive) return; spriteBatch.End(); 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/Custom/Scare.ogg b/Sounds/Custom/Scare.ogg index 577e74dd10..6a393bae5a 100644 Binary files a/Sounds/Custom/Scare.ogg and b/Sounds/Custom/Scare.ogg differ diff --git a/Sounds/Item/SporeKnifeChomp1.ogg b/Sounds/Item/SporeKnifeChomp1.ogg new file mode 100644 index 0000000000..d059a2fc39 Binary files /dev/null and b/Sounds/Item/SporeKnifeChomp1.ogg differ diff --git a/Sounds/Item/SporeKnifeChomp2.ogg b/Sounds/Item/SporeKnifeChomp2.ogg new file mode 100644 index 0000000000..eef81f2c28 Binary files /dev/null and b/Sounds/Item/SporeKnifeChomp2.ogg differ diff --git a/Sounds/Item/SporeKnifeChomp3.ogg b/Sounds/Item/SporeKnifeChomp3.ogg new file mode 100644 index 0000000000..2db776c3c7 Binary files /dev/null and b/Sounds/Item/SporeKnifeChomp3.ogg differ diff --git a/Sounds/Item/SporeKnifeImpact.ogg b/Sounds/Item/SporeKnifeImpact.ogg new file mode 100644 index 0000000000..88e0831463 Binary files /dev/null and b/Sounds/Item/SporeKnifeImpact.ogg differ diff --git a/Sounds/Item/SporeKnifeStealthImpact.ogg b/Sounds/Item/SporeKnifeStealthImpact.ogg new file mode 100644 index 0000000000..6ad4d8ae99 Binary files /dev/null and b/Sounds/Item/SporeKnifeStealthImpact.ogg differ diff --git a/Sounds/Item/SporeKnifeThrow1.ogg b/Sounds/Item/SporeKnifeThrow1.ogg new file mode 100644 index 0000000000..75ad363b6d Binary files /dev/null and b/Sounds/Item/SporeKnifeThrow1.ogg differ diff --git a/Sounds/Item/SporeKnifeThrow2.ogg b/Sounds/Item/SporeKnifeThrow2.ogg new file mode 100644 index 0000000000..57cd0246ac Binary files /dev/null and b/Sounds/Item/SporeKnifeThrow2.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..740bf59a91 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(), 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/Abyss/SulphurousSand.cs b/Tiles/Abyss/SulphurousSand.cs index 4a5f1aa3da..e8ca086808 100644 --- a/Tiles/Abyss/SulphurousSand.cs +++ b/Tiles/Abyss/SulphurousSand.cs @@ -58,10 +58,24 @@ namespace CalamityMod.Tiles.Abyss { if (!Main.tile[i, tileLocationY].HasTile) { - if (!CalamityPlayer.areThereAnyDamnBosses && Main.tile[i, tileLocationY].LiquidAmount == 255 && Main.tile[i, tileLocationY - 1].LiquidAmount == 255 && - Main.tile[i, tileLocationY - 2].LiquidAmount == 255 && !Main.tile[i, tileLocationY - 2].HasTile && Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && !CalamityPlayer.areThereAnyDamnBosses) { - Projectile.NewProjectile(new EntitySource_WorldEvent(), (float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, -0.1f, ModContent.ProjectileType(), 0, 2f, Main.myPlayer); + bool nearby = false; + Vector2 tileWorldPos = new Vector2(i, tileLocationY).ToWorldCoordinates(); + foreach (Player player in Main.ActivePlayers) + { + + if (!player.dead && !player.ghost && player.DistanceSQ(tileWorldPos) < 4000000f) // Don't spawn Acid Bubbles if no players are nearby + { + nearby = true; + break; + } + } + if (nearby && Main.tile[i, tileLocationY].LiquidAmount == 255 && Main.tile[i, tileLocationY - 1].LiquidAmount == 255 && + Main.tile[i, tileLocationY - 2].LiquidAmount == 255 && !Main.tile[i, tileLocationY - 2].HasTile) + { + Projectile.NewProjectile(new EntitySource_WorldEvent(), (float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, -0.1f, ModContent.ProjectileType(), 0, 2f, Main.myPlayer); + } } if (i < 250 || i > Main.maxTilesX - 250) 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/OldDukeMonolithTile.cs b/Tiles/Furniture/Monoliths/OldDukeMonolithTile.cs index 9ca6163623..2057b7ebb1 100644 --- a/Tiles/Furniture/Monoliths/OldDukeMonolithTile.cs +++ b/Tiles/Furniture/Monoliths/OldDukeMonolithTile.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Tiles.Furniture.Monoliths public override int TileHeight => 8; public override int AnimationFrameCount => 24; public override int AnimationDelay => 6; - public override int CursorItemType => ModContent.ItemType(); + public override int CursorItemType => ModContent.ItemType(); public static Asset Numbers; public override void SetStaticDefaults() @@ -45,9 +45,9 @@ namespace CalamityMod.Tiles.Furniture.Monoliths TileObjectData.newTile.CoordinateHeights = [16, 16, 16, 16, 16, 16, 16, 16]; TileObjectData.addTile(Type); - AddMapEntry(new Color(54, 54, 54)); + AddMapEntry(new Color(99, 133, 48)); - DustType = DustID.TerraBlade; + DustType = DustID.ToxicBubble; } public override void NearbyEffects(int i, int j, bool closer, bool monolithEnabled, Player localPlayer) 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/DebuffSystem/BestiaryDebuffInfo.cs b/UI/DebuffSystem/BestiaryDebuffInfo.cs index 30f3f2c546..a517c49aac 100644 --- a/UI/DebuffSystem/BestiaryDebuffInfo.cs +++ b/UI/DebuffSystem/BestiaryDebuffInfo.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System.Linq; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent.Bestiary; @@ -12,10 +13,12 @@ namespace CalamityMod.UI.DebuffSystem public class BestiaryDebuffInfo : IBestiaryInfoElement, IBestiaryPrioritizedElement, ICategorizedBestiaryInfoElement { public string[] elements; + public bool force = false; - public BestiaryDebuffInfo(string[] elements) + public BestiaryDebuffInfo(string[] elements, bool force = false) { this.elements = elements; + this.force = force; } // Below base stats (damage/defense/etc) @@ -26,7 +29,7 @@ namespace CalamityMod.UI.DebuffSystem public UIElement ProvideUIElement(BestiaryUICollectionInfo info) { // Don't show debuff info until stats are unlocked - if (info.UnlockState < BestiaryEntryUnlockState.CanShowStats_2) + if (info.UnlockState < BestiaryEntryUnlockState.CanShowStats_2 && !force) { return null; } diff --git a/UI/DialogueDisplay/DialogueDisplayUI.cs b/UI/DialogueDisplay/DialogueDisplayUI.cs index a30f45f2c4..8f8afb9413 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; @@ -799,7 +805,7 @@ namespace CalamityMod.UI.DialogueDisplay for (int j = 0; j < colors.Length; j++) colors[j] = DialogueDisplaySystem.GetColorFromHex(textColors.hexcodes[j]); - color = CalamityUtils.MulticolorLerp((Main.GlobalTimeWrappedHourly * textColors.gradiantSpeed) + (i * textColors.IndexOffset), colors); + color = !CalamityClientConfig.Instance.TextEffects ? colors[0] : CalamityUtils.MulticolorLerp((Main.GlobalTimeWrappedHourly * textColors.gradiantSpeed) + (i * textColors.IndexOffset), colors); } else color = BaseColor; @@ -811,7 +817,7 @@ namespace CalamityMod.UI.DialogueDisplay for (int j = 0; j < colors.Length; j++) colors[j] = DialogueDisplaySystem.GetColorFromHex(borderColors.hexcodes[j]); - borderColor = CalamityUtils.MulticolorLerp((Main.GlobalTimeWrappedHourly * borderColors.gradiantSpeed) + (i * borderColors.IndexOffset), colors); + borderColor = !CalamityClientConfig.Instance.TextEffects ? colors[0] : CalamityUtils.MulticolorLerp((Main.GlobalTimeWrappedHourly * borderColors.gradiantSpeed) + (i * borderColors.IndexOffset), colors); } else borderColor = BaseBorderColor; @@ -839,17 +845,18 @@ namespace CalamityMod.UI.DialogueDisplay if (!ScreenLocked) drawPos -= Main.screenPosition; - foreach (var l in TextEffects.Where(v => v.Key == i)) - foreach ((TextEffect Effect, float[] args) in l.Value) - { - drawPos = Effect.ModifyPos(drawPos, CharacterData[i], args); + if(CalamityClientConfig.Instance.TextEffects) + foreach (var l in TextEffects.Where(v => v.Key == i)) + foreach ((TextEffect Effect, float[] args) in l.Value) + { + drawPos = Effect.ModifyPos(drawPos, CharacterData[i], args); - rotation = Effect.ModifyRot(rotation, CharacterData[i], args); + rotation = Effect.ModifyRot(rotation, CharacterData[i], args); - color = Effect.ModifyColor(color, CharacterData[i], args); + color = Effect.ModifyColor(color, CharacterData[i], args); - scale = Effect.ModifyScale(scale, CharacterData[i], args); - } + scale = Effect.ModifyScale(scale, CharacterData[i], args); + } SpriteCharacterData spriteData = Font.Value.SpriteCharacters[c]; Vector2 origin = spriteData.Glyph.Size() * 0.5f; diff --git a/UI/DialogueDisplay/DisplayEffects/BossText.cs b/UI/DialogueDisplay/DisplayEffects/BossText.cs index 1085ad8e35..1557c65bf9 100644 --- a/UI/DialogueDisplay/DisplayEffects/BossText.cs +++ b/UI/DialogueDisplay/DisplayEffects/BossText.cs @@ -9,6 +9,8 @@ namespace CalamityMod.UI.DialogueDisplay.DisplayEffects { public override bool FadeWhenTooFar => false; + public override float TimeToAppear => 20; + public override bool DespawnWithAttachedNPC => false; public override Vector2 TextOffsetFromStart(Vector2 startPos, Vector2 textSize) @@ -19,6 +21,24 @@ namespace CalamityMod.UI.DialogueDisplay.DisplayEffects return newPos; } + float OffsetAppearTime(float time, float ratio) => MathHelper.Clamp((time - (ratio * TimeToAppear / 6f)) / (TimeToAppear / 6f), 0f, 1f); + + public override Vector2 AppearPositioning(Vector2 startPos, Vector2 goalPos, float time, DialogueCharacterData charData) + { + Vector2 toBoss = (goalPos - startPos).SafeNormalize(-Vector2.UnitX); + return Vector2.Lerp(goalPos - (new Vector2(-1, -1) * 24 * charData.Scale), goalPos, CalamityUtils.SineOutEasing(time / TimeToAppear, 1)); + } + + public override float AppearOpacity(float goalOpacity, float time, DialogueCharacterData charData) + { + return CalamityUtils.SineOutEasing(time / TimeToAppear, 1); + } + + public override Vector2 AppearScale(Vector2 goalScale, float time, DialogueCharacterData charData) + { + return Vector2.Lerp(goalScale * 0.75f, goalScale, CalamityUtils.ExpOutEasing(time / TimeToAppear, 1)); + } + float OffsetDisappearTime(float time, float ratio) => MathHelper.Clamp((time - (ratio * TimeToDisappear / 2f)) / (TimeToDisappear / 2f), 0f, 1f); public override Vector2 DisappearPositioning(Vector2 startPos, float time, DialogueCharacterData charData) => Vector2.Lerp(startPos, startPos + (Vector2.unitXVector * 12 * charData.Scale), CalamityUtils.SineOutEasing(OffsetDisappearTime(time, charData.CompletionRatio), 1)); diff --git a/UI/DraedonSummoning/ExoMechSelectionUI.cs b/UI/DraedonSummoning/ExoMechSelectionUI.cs index 2ffc7b2b12..ea36d072d3 100644 --- a/UI/DraedonSummoning/ExoMechSelectionUI.cs +++ b/UI/DraedonSummoning/ExoMechSelectionUI.cs @@ -53,6 +53,7 @@ namespace CalamityMod.UI.DraedonSummoning public static bool HandleInteractionWithButton(Vector2 drawPosition, ExoMech exoMech) { float iconScale; + float uiScale = Main.UIScale; string description; Texture2D iconMechTexture; SoundStyle hoverSound; @@ -81,7 +82,7 @@ namespace CalamityMod.UI.DraedonSummoning } // Check for mouse collision/clicks. - Rectangle clickArea = Utils.CenteredRectangle(drawPosition, iconMechTexture.Size() * iconScale * 0.9f); + Rectangle clickArea = Utils.CenteredRectangle(drawPosition, iconMechTexture.Size() * iconScale * uiScale * 0.9f); // Check if the mouse is hovering over the contact button area. bool hoveringOverIcon = MouseScreenArea.Intersects(clickArea); @@ -115,14 +116,14 @@ namespace CalamityMod.UI.DraedonSummoning iconScale = MathHelper.Clamp(iconScale - 0.05f, 1f, 1.2f); // Draw the icon with the new scale. - Main.spriteBatch.Draw(iconMechTexture, drawPosition, null, Color.White, 0f, iconMechTexture.Size() * 0.5f, iconScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(iconMechTexture, drawPosition, null, Color.White, 0f, iconMechTexture.Size() * 0.5f, iconScale * uiScale, SpriteEffects.None, 0f); // Draw the descrption if hovering over the icon. if (hoveringOverIcon) { - drawPosition.X -= FontAssets.MouseText.Value.MeasureString(description).X * 0.5f; - drawPosition.Y += 36f; - Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.MouseText.Value, description, drawPosition.X, drawPosition.Y, HoverTextColor, Color.Black, Vector2.Zero, 1f); + drawPosition.X -= FontAssets.MouseText.Value.MeasureString(description).X * 0.5f * uiScale; + drawPosition.Y += 36f * uiScale; + Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.MouseText.Value, description, drawPosition.X, drawPosition.Y, HoverTextColor, Color.Black, Vector2.Zero, uiScale); } // And update to reflect the new scale. diff --git a/UI/ResourceSets/CalamityResourceOverlay.cs b/UI/ResourceSets/CalamityResourceOverlay.cs index 2bf13689b0..96b8443c8f 100644 --- a/UI/ResourceSets/CalamityResourceOverlay.cs +++ b/UI/ResourceSets/CalamityResourceOverlay.cs @@ -50,7 +50,7 @@ namespace CalamityMod.UI.ResourceSets public static CalamityUIResourceSet GetManaTextureSet() { CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); - if (Main.LocalPlayer.statMana < 0) + if (Main.LocalPlayer.statMana < 0 && Main.LocalPlayer.Calamity().ChaosStone) return CalamityUIResourceSets.MPManaBurn; if (modPlayer.pHeart) return CalamityUIResourceSets.MPPhantomHeart; @@ -196,7 +196,7 @@ namespace CalamityMod.UI.ResourceSets } } // This is where Mana Burn is drawn - else if (Player.statMana < 0) + else if (Player.statMana < 0 && Player.Calamity().ChaosStone) { var manaSet = GetManaTextureSet(); var mana = -Player.statMana; diff --git a/Utilities/DustExtensions.cs b/Utilities/DustExtensions.cs new file mode 100644 index 0000000000..93df499dfb --- /dev/null +++ b/Utilities/DustExtensions.cs @@ -0,0 +1,48 @@ +using System; +using Terraria; + +namespace CalamityMod.Utilities +{ + internal static class DustExtensions + { + extension(Dust dust) + { + [Obsolete("DO NOT USE. It is an unsafe fix to an even more unsafe vanilla method.")] + public static Dust BetterCloneDust(Dust rf) + { + if (rf.dustIndex == Main.maxDustToDraw) + { + return new Dust(); + } + + int num = Dust.NewDust(rf.position, 0, 0, rf.type); + if (!Main.dust.IndexInRange(num)) + { + return new Dust(); + } + Dust obj = Main.dust[num]; + obj.position = rf.position; + obj.velocity = rf.velocity; + obj.fadeIn = rf.fadeIn; + obj.noGravity = rf.noGravity; + obj.scale = rf.scale; + obj.rotation = rf.rotation; + obj.noLight = rf.noLight; + obj.active = rf.active; + obj.type = rf.type; + obj.color = rf.color; + obj.alpha = rf.alpha; + obj.frame = rf.frame; + obj.shader = rf.shader; + obj.customData = rf.customData; + return obj; + } + + [Obsolete("DO NOT USE. It is an unsafe fix to an even more unsafe vanilla method.")] + public static Dust BetterCloneDust(int dustIndex) + { + return BetterCloneDust(Main.dust[dustIndex]); + } + } + } +}