diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 8a2f94afa2..218e42d8f1 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -62,6 +62,10 @@ namespace CalamityMod.Balancing UniversalBalancingChanges = new List() { + // Nerf Crystal bullet shards by 45% + // Currently crystal bullet projectiles deal 50% of the bullet's damage which is absurd in vanilla, this nerfs them to 27.5% + Do(new ProjectileResistBalancingRule(0.55f, ProjectileID.CrystalShard)), + // Nerf Luminite Arrow trails by 50%. Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.MoonlordArrowTrail)), @@ -76,6 +80,7 @@ namespace CalamityMod.Balancing // Nerf Spectre Mask set bonus projectiles by 30%. Do(new ProjectileSpecificRequirementBalancingRule(0.7f, SpectreMaskSetBonusFilter)), + }; NPCSpecificBalancingChanges = new List(); @@ -107,9 +112,6 @@ namespace CalamityMod.Balancing // 40% resist to Sky Glaze. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.EaterofWorldsIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); - - // 30% resist to Jester Arrows. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.EaterofWorldsIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileID.JestersArrow)))); #endregion #region The Perforators @@ -127,7 +129,7 @@ namespace CalamityMod.Balancing NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(ResistTrueMelee(0.5f)))); // 50% resist to Adamantite Throwing Axe's lightning. - // Twisting Thunder and Gael's greatsword use this projectile too, but they are far beyond progression, so who cares! + // Twisting Thunder and Gael's Greatsword use this projectile too, but they are far beyond progression, so who cares! NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CultistBossLightningOrbArc)))); // 50% resist to Dormant Brimseeker. @@ -153,13 +155,22 @@ namespace CalamityMod.Balancing // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(ResistTrueMelee(0.5f)))); - // 50% resist to Dormant Brimseeker. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Adamantite Throwing Axe's lightning. // See Aquatic Scourge comment. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CultistBossLightningOrbArc)))); + // 50% resist to Dormant Brimseeker. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + + // 50% resist to Aftershock Rocks. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + + // 50% resist to Avalanche Ice Bombs. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + + // 50% resist to Avalanche Frost Shards. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + // 45% resist to Mounted Scanner. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); @@ -177,8 +188,8 @@ namespace CalamityMod.Balancing #endregion #region Astrum Aureus - // 35% resist to The Ballista's greatarrows. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + // 30% resist to The Ballista's greatarrows. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); #endregion #region Ravager @@ -188,14 +199,17 @@ namespace CalamityMod.Balancing // 50% resist to Aegis Blade's explosions because the true melee resist ain't enough. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 40% resist to Flying Dragon. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileID.DD2SquireSonicBoom)))); + // 35% resist to Flying Dragon. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2SquireSonicBoom)))); + + // 30% resist to Aurora Blazer. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 30% resist to Flak Kraken. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); - // 30% resist to Aurora Blazer. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + // 25% resist to Lucrecia. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); #endregion #region Duke Fishron @@ -264,6 +278,9 @@ namespace CalamityMod.Balancing #region Providence // 80% resist to Hell's Sun. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.2f, ProjectileType()))); + + // 35% resist to Elemental Lance. This thing desperately needs a rework. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType()))); #endregion #region Ceaseless Void: Dark Energies @@ -380,7 +397,7 @@ namespace CalamityMod.Balancing NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Vehemence's skulls. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Yharim's Crystal. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); @@ -394,21 +411,21 @@ namespace CalamityMod.Balancing // 35% resist to The Anomaly's Nanogun bomb explosions. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); - // 30% resist to Ultima. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + // 35% resist to Prismatic Breaker's laser beam. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); // 30% resist to Eclipse's Fall. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); - // 30% resist to Prismatic Breaker's laser beam. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); - // 30% resist to Pulse Rifle. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 30% resist to Sirius. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + // 30% resist to Ultima's rays. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + // 30% resist to Dragon Scales and The Wand's tornadoes. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType())))); diff --git a/Balancing/BalancingConstants.cs b/Balancing/BalancingConstants.cs index ebdce6c769..f4a4d58dac 100644 --- a/Balancing/BalancingConstants.cs +++ b/Balancing/BalancingConstants.cs @@ -33,12 +33,18 @@ // Dodge cooldowns (in frames) // TODO -- Some of these could be moved to the respective item files - internal static readonly int BeltDodgeCooldown = 5400; - internal static readonly int BrainDodgeCooldown = 5400; - internal static readonly int AmalgamDodgeCooldown = 5400; - internal static readonly int MirrorDodgeCooldown = 5400; - internal static readonly int DaedalusReflectCooldown = 5400; - internal static readonly int EvolutionReflectCooldown = 5400; + internal static readonly int BeltDodgeCooldownMin = 900; + internal static readonly int BeltDodgeCooldownMax = 5400; + internal static readonly int BrainDodgeCooldownMin = 900; + internal static readonly int BrainDodgeCooldownMax = 5400; + internal static readonly int AmalgamDodgeCooldownMin = 900; + internal static readonly int AmalgamDodgeCooldownMax = 5400; + internal static readonly int MirrorDodgeCooldownMin = 900; + internal static readonly int MirrorDodgeCooldownMax = 5400; + internal static readonly int DaedalusReflectCooldownMin = 900; + internal static readonly int DaedalusReflectCooldownMax = 5400; + internal static readonly int EvolutionReflectCooldownMin = 900; + internal static readonly int EvolutionReflectCooldownMax = 5400; #endregion #region Damage @@ -79,6 +85,54 @@ // nothing here yet #endregion + #region Life Steal + // Life steal accessories require a more strict cooldown due to their ease of use and global application + internal static readonly float LifeStealAccessoryCooldownMultiplier = 3f; + + // Life steal cooldown multipliers used for armor set bonuses + internal static readonly float LifeStealSetBonusCooldownMultiplier = 2f; + internal static readonly float LifeStealReaverTankCooldownMultiplier = 4f; + + // The range was buffed in vanilla from 1200 to 3000 in 1.4.4, and I agree with that decision + internal static readonly float LifeStealRange = 3000f; + + // Life steal caps (aka, how much life steal the player is allowed before it goes on cooldown) + internal static readonly float LifeStealCap_Classic = 60f; + internal static readonly float LifeStealCap_Expert = 50f; + internal static readonly float LifeStealCap_Revengeance = 40f; + internal static readonly float LifeStealCap_Death = 30f; + + // Master nerfs the life steal cap by 10, resulting in 40 in non-Rev Master, 30 in Rev Master, and 20 in Death Master + internal static readonly float LifeStealCapReduction_Master = 10f; + + // The base life steal cooldowns from vanilla + internal static readonly float LifeStealRecoveryRate_Classic = 0.6f; + internal static readonly float LifeStealRecoveryRate_Expert = 0.5f; + + // The calculations below show the time (in frames) for 10 life steal cooldown to recover in each difficulty + // Classic: 10 / 0.2 = 50 + // Expert: 10 / 0.15 = 66.667 + // Revengeance: 10 / 0.125 = 80 + // Death: 10 / 0.1 = 100 + // Master: 10 / 0.1 = 100 + // Revengeance Master: 10 / 0.075 = 133.333 + // Death Master: 10 / 0.05 = 200 + // Nerfs the life steal recovery rate in Classic from 0.6/s to 0.2/s + internal static readonly float LifeStealRecoveryRateReduction_Classic = 0.4f; + + // Nerfs the life steal recovery rate in Expert from 0.5/s to 0.15/s + internal static readonly float LifeStealRecoveryRateReduction_Expert = 0.35f; + + // Nerfs the life steal recovery rate in Revengeance from 0.5/s to 0.125/s + internal static readonly float LifeStealRecoveryRateReduction_Revengeance = 0.375f; + + // Nerfs the life steal recovery rate in Death from 0.5/s to 0.1/s + internal static readonly float LifeStealRecoveryRateReduction_Death = 0.4f; + + // Nerfs the life steal recovery rate in Master by 0.05/s, resulting in 0.1/s in non-Rev Master, 0.075/s in Rev Master, and 0.05/s in Death Master + internal static readonly float LifeStealRecoveryRateReduction_Master = 0.05f; + #endregion + #region Rogue Base Stats // If stealth is too weak, increase this number. If stealth is too strong, decrease this number. // This value is intentionally not readonly. @@ -143,10 +197,16 @@ internal static readonly int RageFadeTime = CalamityUtils.SecondsToFrames(30); internal static readonly float DefaultRageDamageBoost = 0.35f; // +35% - internal static readonly float AdrenalineDamageBoost = 2f; // +200% - internal static readonly float AdrenalineDamagePerBooster = 0.15f; // +15% + internal static readonly float AdrenalineDamageBoost = 1.5f; // +150% + internal static readonly float AdrenalineDamagePerBooster = 0.2f; // +20% internal static readonly float FullAdrenalineDR = 0.5f; // 50% internal static readonly float AdrenalineDRPerBooster = 0.05f; // +5% per booster + + internal static readonly int AdrenalinePauseAfterDamage = CalamityUtils.SecondsToFrames(1); + internal static readonly float MinimumAdrenalineLoss = 0.1f; // No matter how small a hit, you will always lose at least 10% current Adrenaline + internal static readonly float AdrenalineFalloffTinyHitHealthRatio = 0.05f; // Hits for 5% max HP or less result in less Adrenaline loss + + internal static readonly float TrueMeleeRipperReductionFactor = 0.5f; // True melee benefits less from rippers to prevent excessive melting. #endregion // TODO -- NPC classification is not done consistently with predictable thresholds. diff --git a/BiomeManagers/AbovegroundAstralDesertBiome.cs b/BiomeManagers/AbovegroundAstralDesertBiome.cs index d027aea409..1dbe2ad000 100644 --- a/BiomeManagers/AbovegroundAstralDesertBiome.cs +++ b/BiomeManagers/AbovegroundAstralDesertBiome.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Systems; using Terraria; +using Terraria.GameContent.Events; using Terraria.Graphics.Effects; using Terraria.ID; using Terraria.ModLoader; @@ -12,7 +13,7 @@ namespace CalamityMod.BiomeManagers public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/AstralWater"); public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find("CalamityMod/AstralDesertSurfaceBGStyle"); public override int BiomeTorchItemType => ModContent.ItemType(); - public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; + public override SceneEffectPriority Priority => Sandstorm.Happening ? SceneEffectPriority.Environment : SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/AstralDesertIcon"; // Could use its own unique background public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; diff --git a/Buffs/DamageOverTime/BurningBlood.png b/Buffs/DamageOverTime/BurningBlood.png index 908f334063..0c10087577 100644 Binary files a/Buffs/DamageOverTime/BurningBlood.png and b/Buffs/DamageOverTime/BurningBlood.png differ diff --git a/Buffs/DamageOverTime/CrushDepth.png b/Buffs/DamageOverTime/CrushDepth.png index 8a03a35601..2f8caad4f7 100644 Binary files a/Buffs/DamageOverTime/CrushDepth.png and b/Buffs/DamageOverTime/CrushDepth.png differ diff --git a/Buffs/DamageOverTime/Plague.png b/Buffs/DamageOverTime/Plague.png index 16de187484..c9c78b18aa 100644 Binary files a/Buffs/DamageOverTime/Plague.png and b/Buffs/DamageOverTime/Plague.png differ diff --git a/Buffs/DamageOverTime/RiptideDebuff.png b/Buffs/DamageOverTime/RiptideDebuff.png index e61eb2a105..b7397c5c44 100644 Binary files a/Buffs/DamageOverTime/RiptideDebuff.png and b/Buffs/DamageOverTime/RiptideDebuff.png differ diff --git a/Buffs/DamageOverTime/VulnerabilityHex.cs b/Buffs/DamageOverTime/VulnerabilityHex.cs index 16e988a44d..6ea2f5c298 100644 --- a/Buffs/DamageOverTime/VulnerabilityHex.cs +++ b/Buffs/DamageOverTime/VulnerabilityHex.cs @@ -1,7 +1,12 @@ using CalamityMod.NPCs; +using CalamityMod.Particles; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using ReLogic.Utilities; +using CalamityMod.Dusts; namespace CalamityMod.Buffs.DamageOverTime { @@ -46,5 +51,22 @@ namespace CalamityMod.Buffs.DamageOverTime npc.DelBuff(buffIndex); buffIndex--; } + internal static void DrawEffects(PlayerDrawSet drawInfo) + { + Player Player = drawInfo.drawPlayer; + + if (Main.rand.NextBool()) + { + VoidSparkParticle spark2 = new VoidSparkParticle(Player.Calamity().RandomDebuffVisualSpot, new Vector2(0, Main.rand.NextFloat(-6f, -10f)), false, Main.rand.Next(18, 27), Main.rand.NextFloat(0.015f, 0.045f), Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.65f)); + GeneralParticleHandler.SpawnParticle(spark2); + } + + Dust dust = Dust.NewDustPerfect(Player.Calamity().RandomDebuffVisualSpot, Main.rand.NextBool() ? 261 :(int)CalamityDusts.Brimstone); + dust.scale = Main.rand.NextFloat(0.4f, 0.5f); + dust.velocity = new Vector2(0, Main.rand.NextFloat(-0.5f, -2.5f)).RotatedByRandom(0.6f); + if (dust.type == 261) + dust.color = Color.Lerp(Color.Red, Color.Magenta, 0.65f); + + } } } diff --git a/Buffs/StatBuffs/RageMode.png b/Buffs/StatBuffs/RageMode.png index d9a80f785b..f4ce650e26 100644 Binary files a/Buffs/StatBuffs/RageMode.png and b/Buffs/StatBuffs/RageMode.png differ diff --git a/Buffs/StatDebuffs/ArmorCrunch.cs b/Buffs/StatDebuffs/ArmorCrunch.cs index 76bac57e11..d01829fdb0 100644 --- a/Buffs/StatDebuffs/ArmorCrunch.cs +++ b/Buffs/StatDebuffs/ArmorCrunch.cs @@ -7,9 +7,9 @@ namespace CalamityMod.Buffs.StatDebuffs public class ArmorCrunch : ModBuff { public static int DefenseReduction = 15; - public static float MultiplicativeDamageReductionPlayer = 0.33f; - //20% dr reduction - public static float MultiplicativeDamageReductionEnemy = 0.80f; + public static float MultiplicativeDamageReductionPlayer = 0.5f; + // 15% DR reduction + public static float MultiplicativeDamageReductionEnemy = 0.85f; public override void SetStaticDefaults() { diff --git a/Buffs/StatDebuffs/Crumbling.cs b/Buffs/StatDebuffs/Crumbling.cs index 684217e449..2173cf756b 100644 --- a/Buffs/StatDebuffs/Crumbling.cs +++ b/Buffs/StatDebuffs/Crumbling.cs @@ -7,9 +7,9 @@ namespace CalamityMod.Buffs.StatDebuffs public class Crumbling : ModBuff { public static int DefenseReduction = 10; - public static float MultiplicativeDamageReductionPlayer = 0.55f; - //12% dr reduction - public static float MultiplicativeDamageReductionEnemy = 0.9f; + public static float MultiplicativeDamageReductionPlayer = 0.7f; + // 8% DR reduction + public static float MultiplicativeDamageReductionEnemy = 0.92f; public override void SetStaticDefaults() { diff --git a/Buffs/StatDebuffs/DoGExtremeGravity.png b/Buffs/StatDebuffs/DoGExtremeGravity.png index 43a2f353d7..b9de9c3774 100644 Binary files a/Buffs/StatDebuffs/DoGExtremeGravity.png and b/Buffs/StatDebuffs/DoGExtremeGravity.png differ diff --git a/Buffs/StatDebuffs/GalvanicCorrosion.png b/Buffs/StatDebuffs/GalvanicCorrosion.png index 97136a54fe..aa5182d8fb 100644 Binary files a/Buffs/StatDebuffs/GalvanicCorrosion.png and b/Buffs/StatDebuffs/GalvanicCorrosion.png differ diff --git a/Buffs/StatDebuffs/TemporalSadness.png b/Buffs/StatDebuffs/TemporalSadness.png index 2997431ce1..d3109f21fe 100644 Binary files a/Buffs/StatDebuffs/TemporalSadness.png and b/Buffs/StatDebuffs/TemporalSadness.png differ diff --git a/Buffs/StatDebuffs/Warped.png b/Buffs/StatDebuffs/Warped.png index d17c7e236f..b2b033b09a 100644 Binary files a/Buffs/StatDebuffs/Warped.png and b/Buffs/StatDebuffs/Warped.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index d33529c275..4e98779649 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -355,6 +355,7 @@ namespace CalamityMod.CalPlayer public bool AdrenalineTrail = false; public float adrenaline = 0f; public float adrenalineMax = 100f; // 0 to 100% by default + public int adrenalinePauseTimer = 0; public int AdrenalineDuration = CalamityUtils.SecondsToFrames(5); public int AdrenalineChargeTime = CalamityUtils.SecondsToFrames(30); public int AdrenalineFadeTime = CalamityUtils.SecondsToFrames(2); @@ -493,7 +494,6 @@ namespace CalamityMod.CalPlayer public bool laudanum = false; public bool heartOfDarkness = false; public bool draedonsHeart = false; - public int nanomachinesLockoutTimer = 0; public bool vexation = false; public bool dodgeScarf = false; public bool evasionScarf = false; @@ -577,6 +577,7 @@ namespace CalamityMod.CalPlayer public bool chaliceOfTheBloodGod = false; public double chaliceBleedoutBuffer = 0D; public double chaliceDamagePointPartialProgress = 0D; + public int chaliceHitOriginalDamage = 0; public bool elementalHeart = false; public bool crownJewel = false; public bool infectedJewel = false; @@ -723,7 +724,6 @@ namespace CalamityMod.CalPlayer public bool tarragonCloak = false; public int tarraDefenseTime = 600; public bool tarraMage = false; - public int tarraMageHealCooldown = 0; public int tarraCrits = 0; public bool tarraRanged = false; public int tarraRangedCooldown = 0; @@ -963,6 +963,7 @@ namespace CalamityMod.CalPlayer public double pinkCandleHealFraction = 0D; public bool yellowCandle = false; public bool trippy = false; + public int trippyLevel = 1; public bool amidiasBlessing = false; public bool bloodfinBoost = false; public int bloodfinTimer = 30; @@ -1178,6 +1179,7 @@ namespace CalamityMod.CalPlayer #region Draedon Summoning public bool AbleToSelectExoMech = false; public bool HasTalkedAtCodebreaker = false; + public bool HasCraftedDraedonsForge = false; public List SeenDraedonDialogs = new(); #endregion Draedon Summoning @@ -1312,6 +1314,7 @@ namespace CalamityMod.CalPlayer boost.AddWithCondition("newCalamitasInventory", newCalamitasInventory); boost.AddWithCondition("GivenBrimstoneLocus", GivenBrimstoneLocus); boost.AddWithCondition("HasTalkedAtCodebreaker", HasTalkedAtCodebreaker); + boost.AddWithCondition("HasCraftedDraedonsForge", HasCraftedDraedonsForge); // Calculate the new total time of all sessions at the instant of this player save. TimeSpan newSessionTotal = previousSessionTotal.Add(CalamityMod.SpeedrunTimer.Elapsed); @@ -1402,6 +1405,7 @@ namespace CalamityMod.CalPlayer newCalamitasInventory = boost.Contains("newCalamitasInventory"); GivenBrimstoneLocus = boost.Contains("GivenBrimstoneLocus"); HasTalkedAtCodebreaker = boost.Contains("HasTalkedAtCodebreaker"); + HasCraftedDraedonsForge = boost.Contains("HasCraftedDraedonsForge"); // Load rage if it's there, which it will be for any players saved with 1.5. // Older players have "stress" instead, which will be ignored. This is intentional. @@ -2279,7 +2283,6 @@ namespace CalamityMod.CalPlayer silvaMageCooldown = 0; bloodflareMageCooldown = 0; tarraRangedCooldown = 0; - tarraMageHealCooldown = 0; hideOfDeusMeleeBoostTimer = 0; externalAbyssLight = 0; externalColdImmunity = externalHeatImmunity = false; @@ -2401,7 +2404,7 @@ namespace CalamityMod.CalPlayer soaring = false; bounding = false; shadow = false; - nanomachinesLockoutTimer = 0; + adrenalinePauseTimer = 0; photosynthesis = false; astralInjection = false; gravityNormalizer = false; @@ -2450,6 +2453,7 @@ namespace CalamityMod.CalPlayer pinkCandleHealFraction = 0D; yellowCandle = false; trippy = false; + trippyLevel = 1; amidiasBlessing = false; bloodfinBoost = false; bloodfinTimer = 0; @@ -2611,6 +2615,7 @@ namespace CalamityMod.CalPlayer chaliceBleedoutBuffer = 0D; chaliceDamagePointPartialProgress = 0D; + chaliceHitOriginalDamage = 0; if (BossRushEvent.BossRushActive) { @@ -2733,6 +2738,8 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(source, new Vector2((int)(Player.Center.X + (Math.Sin(projIndex * start) * 300)), (int)(Player.Center.Y + (Math.Cos(projIndex * start) * 300))), Vector2.Zero, ModContent.ProjectileType(), damage, proj.knockBack / 10f, Player.whoAmI, Main.rand.Next(180), projIndex * start); Player.statLife += 2; Player.HealEffect(2); + if (Player.statLife > Player.statLifeMax2) + Player.statLife = Player.statLifeMax2; } } if (CalamityKeybinds.SandCloakHotkey.JustPressed && sandCloak && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.1f && @@ -2857,7 +2864,7 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(BloodflareHeadRanged.ActivationSound, Player.Center); for (int d = 0; d < 64; d++) { - int dust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Polterplasm, 0f, 0f, 0, default, 1f); + int dust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Necroplasm, 0f, 0f, 0, default, 1f); Main.dust[dust].velocity *= 3f; Main.dust[dust].scale *= 1.15f; } @@ -2867,7 +2874,7 @@ namespace CalamityMod.CalPlayer Vector2 source = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center; Vector2 dustVel = source - Player.Center; - int phanto = Dust.NewDust(source + dustVel, 0, 0, (int)CalamityDusts.Polterplasm, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, default, 1.4f); + int phanto = Dust.NewDust(source + dustVel, 0, 0, (int)CalamityDusts.Necroplasm, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, default, 1.4f); Main.dust[phanto].noGravity = true; Main.dust[phanto].noLight = true; Main.dust[phanto].velocity = dustVel; @@ -3579,17 +3586,27 @@ namespace CalamityMod.CalPlayer } } - // Add a cooldown display for the vanilla lifesteal cooldown, which is active when negative - if (Player.whoAmI == Main.myPlayer && Player.lifeSteal < 0f) + // Add a cooldown display for the vanilla lifesteal cooldown, which is active when negative. + if (Player.whoAmI == Main.myPlayer) { - float duration = Player.lifeSteal; - float baseCooldown = Main.expertMode ? 0.5f : 0.6f; - float lifeStealNerf = BossRushEvent.BossRushActive ? 0.3f : CalamityWorld.death ? 0.25f : CalamityWorld.revenge ? 0.2f : Main.expertMode ? 0.15f : 0.1f; - duration /= baseCooldown - lifeStealNerf; - duration *= -1f; + float baseRecoveryRate = Main.expertMode ? BalancingConstants.LifeStealRecoveryRate_Expert : BalancingConstants.LifeStealRecoveryRate_Classic; - if (!Player.HasCooldown(LifeSteal.ID) || (cooldowns[LifeSteal.ID].duration < (int)duration)) - Player.AddCooldown(LifeSteal.ID, (int)duration); + float lifeStealRecoveryRateReduction = + CalamityWorld.death ? BalancingConstants.LifeStealRecoveryRateReduction_Death : + CalamityWorld.revenge ? BalancingConstants.LifeStealRecoveryRateReduction_Revengeance : + Main.expertMode ? BalancingConstants.LifeStealRecoveryRateReduction_Expert : + BalancingConstants.LifeStealRecoveryRateReduction_Classic; + + if (Main.masterMode) + lifeStealRecoveryRateReduction += BalancingConstants.LifeStealRecoveryRateReduction_Master; + + float lifeStealRecoveryRate = baseRecoveryRate - lifeStealRecoveryRateReduction; + if (Player.lifeSteal < -lifeStealRecoveryRate) + { + 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); + } } ForceVariousEffects(); @@ -3601,7 +3618,7 @@ namespace CalamityMod.CalPlayer { // True melee damage from various vanilla equipment placed here. - // Titan Glove and ALL upgrades + // Titan Glove and ALL upgrades. if (Player.kbGlove) Player.GetDamage() += 0.1f; @@ -3611,11 +3628,9 @@ namespace CalamityMod.CalPlayer if (gSabatonTempJumpSpeed > 0) { gSabatonTempJumpSpeed--; - //Only give temporary jump speed if Gravistar Sabaton is equipped, but still decrement the time so that you can't store it for later + // Only give temporary jump speed if Gravistar Sabaton is equipped, but still decrement the time so that you can't store it for later. if (gSabaton && Player.whoAmI == Main.myPlayer) - { Player.jumpSpeedBoost += 2f; - } } } #endregion @@ -3649,7 +3664,6 @@ namespace CalamityMod.CalPlayer (silvaSet ? 0.05f : 0f) + (blueCandle ? 0.05f : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + - ((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f) + (hasteLevel * 0.05f); float runSpeedMult = 1f + @@ -3664,7 +3678,6 @@ namespace CalamityMod.CalPlayer (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + (silvaSet ? 0.05f : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + - ((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f) + (hasteLevel * 0.05f); if ((Player.slippy || Player.slippy2) && Player.iceSkate) @@ -4041,9 +4054,9 @@ namespace CalamityMod.CalPlayer int d = (int)Player.GetTotalDamage().ApplyTo(RustyMedallion.AcidDropBaseDamage); d = Player.ApplyArmorAccDamageBonusesTo(d); - Vector2 startingPosition = Main.MouseWorld - Vector2.UnitY.RotatedByRandom(0.4f) * 1250f; - Vector2 directionToMouse = (Main.MouseWorld - startingPosition).SafeNormalize(Vector2.UnitY).RotatedByRandom(0.1f); - int drop = Projectile.NewProjectile(source, startingPosition, directionToMouse * 15f, ModContent.ProjectileType(), d, 0f, Player.whoAmI); + Vector2 startingPosition = Main.MouseWorld - Vector2.UnitY.RotatedByRandom(0.3f) * 1250f; + Vector2 directionToMouse = (Main.MouseWorld - startingPosition).SafeNormalize(Vector2.UnitX); + int drop = Projectile.NewProjectile(source, startingPosition, directionToMouse * 15f, ModContent.ProjectileType(), d, 0f, Player.whoAmI, 3); if (drop.WithinBounds(Main.maxProjectiles)) { Main.projectile[drop].penetrate = 2; @@ -4669,7 +4682,7 @@ namespace CalamityMod.CalPlayer return rogueStealth >= rogueStealthMax * consumptionMult; } - internal void ConsumeStealthByAttacking() + public void ConsumeStealthByAttacking() { stealthStrikeThisFrame = true; stealthAcceleration = 1f; // Reset acceleration when you attack diff --git a/CalPlayer/CalamityPlayerDashEffects.cs b/CalPlayer/CalamityPlayerDashEffects.cs index 53d464d449..072d6a1070 100644 --- a/CalPlayer/CalamityPlayerDashEffects.cs +++ b/CalPlayer/CalamityPlayerDashEffects.cs @@ -127,6 +127,8 @@ namespace CalamityMod.CalPlayer dashDelayToApply = BalancingConstants.UniversalShieldSlamCooldown; else if (UsedDash.CollisionType == DashCollisionType.ShieldBonk) dashDelayToApply = BalancingConstants.UniversalShieldBonkCooldown; + if (DashID == "Deep Diver") + dashDelayToApply = 23; float dashSpeed = 12f; float dashSpeedDecelerationFactor = 0.985f; diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 91da6b2abe..a70034cdad 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -62,7 +62,7 @@ namespace CalamityMod.CalPlayer Rectangle screenArea = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 50, Main.screenWidth + 1000, Main.screenHeight + 100); int dustDrawn = 0; float maxShroomDust = Main.maxDustToDraw / 2; - Color shroomColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + Color shroomColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); for (int i = 0; i < Main.maxDustToDraw; i++) { Dust dust = Main.dust[i]; @@ -104,6 +104,10 @@ namespace CalamityMod.CalPlayer } } } + else // This is such a stupid way to reset this but you can't just put it in ResetEffects + { + calamityPlayer.trippyLevel = 1; + } // TODO -- rogue stealth visuals are an utter catastrophe and should be fully destroyed on next stealth rework if (calamityPlayer.rogueStealth > 0f && calamityPlayer.rogueStealthMax > 0f && Player.townNPCs < 3f && CalamityConfig.Instance.StealthInvisibility) @@ -291,6 +295,9 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.vaporfied && drawInfo.shadow == 0f) Vaporfied.DrawEffects(drawInfo); + + if (calamityPlayer.vHex && drawInfo.shadow == 0f) + VulnerabilityHex.DrawEffects(drawInfo); #endregion if (calamityPlayer.PinkJellyRegen && drawInfo.shadow == 0f) diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index 1b4da5946c..b43276306b 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -443,7 +443,7 @@ namespace CalamityMod.CalPlayer } } - if (Player.FindBuffIndex(BuffID.Gills) > -1 && DownedBossSystem.downedCalamitasClone && (attempt.legendary || (attempt.veryrare && Main.rand.NextBool()))) + if (Player.FindBuffIndex(BuffID.Gills) > -1 && DownedBossSystem.downedLeviathan && (attempt.legendary || (attempt.veryrare && Main.rand.NextBool()))) { itemDrop = ModContent.ItemType(); } diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 6b7aada88a..42aea35021 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -135,11 +135,21 @@ namespace CalamityMod.CalPlayer NetMessage.SendData(MessageID.Dodge, -1, -1, null, Player.whoAmI, 1f, 0f, 0f, 0, 0, 0); } - public void AbyssMirrorDodge() + public void AbyssMirrorDodge(double dodgeDamageGateValuePercent, int dodgeDamageGateValue, int hitDamage) { + 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) { - Player.AddCooldown(GlobalDodge.ID, BalancingConstants.MirrorDodgeCooldown, true, "abyssmirror"); + int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.MirrorDodgeCooldownMin, BalancingConstants.MirrorDodgeCooldownMax, cooldownDurationScalar); + Player.AddCooldown(GlobalDodge.ID, cooldownDuration, true, "abyssmirror"); // TODO -- why is this here? Player.noKnockback = true; @@ -169,11 +179,21 @@ namespace CalamityMod.CalPlayer } } - public void EclipseMirrorDodge() + public void EclipseMirrorDodge(double dodgeDamageGateValuePercent, int dodgeDamageGateValue, int hitDamage) { + 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) { - Player.AddCooldown(GlobalDodge.ID, BalancingConstants.MirrorDodgeCooldown, true, "eclipsemirror"); + int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.MirrorDodgeCooldownMin, BalancingConstants.MirrorDodgeCooldownMax, cooldownDurationScalar); + Player.AddCooldown(GlobalDodge.ID, cooldownDuration, true, "eclipsemirror"); // TODO -- why is this here? Player.noKnockback = true; @@ -628,6 +648,7 @@ namespace CalamityMod.CalPlayer Item heldItem = Player.ActiveItem(); bool wearingForbiddenSet = Player.armor[0].type == ItemID.AncientBattleArmorHat && Player.armor[1].type == ItemID.AncientBattleArmorShirt && Player.armor[2].type == ItemID.AncientBattleArmorPants; + bool forbiddenWithMagicWeapon = wearingForbiddenSet && heldItem.CountsAsClass(); bool gemTechBlueGem = GemTechSet && GemTechState.IsBlueGemActive; @@ -742,9 +763,8 @@ namespace CalamityMod.CalPlayer if (transformer) { - if (npc.type == NPCID.BlueJellyfish || npc.type == NPCID.PinkJellyfish || npc.type == NPCID.GreenJellyfish || - npc.type == NPCID.FungoFish || npc.type == NPCID.BloodJelly || npc.type == NPCID.AngryNimbus || npc.type == NPCID.GigaZapper || - npc.type == NPCID.MartianTurret || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) + if (npc.type == NPCID.BlueJellyfish || npc.type == NPCID.PinkJellyfish || npc.type == NPCID.GreenJellyfish || npc.type == NPCID.FungoFish || + npc.type == NPCID.BloodJelly || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) contactDamageReduction += 0.5; } @@ -872,9 +892,21 @@ namespace CalamityMod.CalPlayer // This should probably be changed so that when the evolution reflects it gives you 1 frame of guaranteed free dodging everything. if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) { + double dodgeDamageGateValuePercent = 0.05; + int dodgeDamageGateValue = (int)Math.Round(Player.statLifeMax2 * dodgeDamageGateValuePercent); + // Reflects count as dodges. They share the timer and can be disabled by Armageddon right click. - if (!disableAllDodges && !Player.HasCooldown(GlobalDodge.ID)) + if (!disableAllDodges && !Player.HasCooldown(GlobalDodge.ID) && proj.damage >= dodgeDamageGateValue) { + 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((proj.damage - dodgeDamageGateValue) / (float)maxCooldownDurationDamageValue, 0f, 1f); + // The Evolution if (evolution) { @@ -889,7 +921,9 @@ namespace CalamityMod.CalPlayer evolutionLifeRegenCounter = 300; projTypeJustHitBy = proj.type; - Player.AddCooldown(GlobalDodge.ID, BalancingConstants.EvolutionReflectCooldown); + int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.EvolutionReflectCooldownMin, BalancingConstants.EvolutionReflectCooldownMax, cooldownDurationScalar); + Player.AddCooldown(GlobalDodge.ID, cooldownDuration); + return; } } @@ -1283,27 +1317,44 @@ namespace CalamityMod.CalPlayer } else if (proj.type == ProjectileID.FrostBeam && !Player.frozen && !gState) { - Player.AddBuff(ModContent.BuffType(), 120); + Player.AddBuff(ModContent.BuffType(), 60); } - else if (proj.type == ProjectileID.DeathLaser || proj.type == ProjectileID.RocketSkeleton) + else if (proj.type == ProjectileID.DeathLaser || proj.type == ProjectileID.RocketSkeleton || proj.type == ProjectileID.BombSkeletronPrime) { - Player.AddBuff(BuffID.OnFire, 240); + Player.AddBuff(BuffID.OnFire, 180); } else if (proj.type == ProjectileID.Skull) { - Player.AddBuff(BuffID.Weak, 300); + Player.AddBuff(BuffID.Weak, 180); } - else if (proj.type == ProjectileID.CursedFlameHostile) + else if (proj.type == ProjectileID.CursedFlameHostile || proj.type == ProjectileID.EyeFire) { - Player.AddBuff(BuffID.CursedInferno, 120); + // Guaranteed Cursed Inferno for 1 second (vanilla also has a 68.75% chance of Cursed Inferno for 2 to 3 seconds) + Player.AddBuff(BuffID.CursedInferno, 60); + } + else if (proj.type == ProjectileID.Stinger || proj.type == ProjectileID.QueenBeeStinger) + { + // 66.6% chance of Poison for 3 seconds, 1 guaranteed second of Poison otherwise (vanilla also has a 33.3% chance of Poison for 10 seconds) + if (Main.rand.Next(3) > 0) + Player.AddBuff(BuffID.Poisoned, 180); + else + Player.AddBuff(BuffID.Poisoned, 60); + } + else if (proj.type == ProjectileID.PoisonSeedPlantera) + { + // 75% chance of Poison for 3 to 5 seconds, guaranteed Poison for 2 seconds (vanilla also has a 50% chance of Poison for 3 to 7 seconds) + if (Main.rand.Next(4) > 0) + Player.AddBuff(BuffID.Poisoned, Main.rand.Next(180, 301)); + else + Player.AddBuff(BuffID.Poisoned, 120); } else if (proj.type == ProjectileID.ThornBall) { - Player.AddBuff(BuffID.Poisoned, 480); + Player.AddBuff(BuffID.Poisoned, 300); } else if (proj.type == ProjectileID.CultistBossIceMist) { - Player.AddBuff(BuffID.Frozen, 90); + Player.AddBuff(BuffID.Frozen, 60); Player.AddBuff(BuffID.Chilled, 180); } else if (proj.type == ProjectileID.CultistBossLightningOrbArc) @@ -1320,35 +1371,35 @@ namespace CalamityMod.CalPlayer } else if (proj.type == ProjectileID.PhantasmalBolt || proj.type == ProjectileID.PhantasmalEye) { - Player.AddBuff(ModContent.BuffType(), 120); + Player.AddBuff(ModContent.BuffType(), 60); } else if (proj.type == ProjectileID.PhantasmalSphere) { - Player.AddBuff(ModContent.BuffType(), 240); + Player.AddBuff(ModContent.BuffType(), 120); } else if (proj.type == ProjectileID.PhantasmalDeathray) { - Player.AddBuff(ModContent.BuffType(), 400); + Player.AddBuff(ModContent.BuffType(), 300); } else if (proj.type == ProjectileID.FairyQueenLance || proj.type == ProjectileID.HallowBossRainbowStreak || proj.type == ProjectileID.HallowBossSplitShotCore) { - Player.AddBuff(Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(), 120); + Player.AddBuff(Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(), 60); } else if (proj.type == ProjectileID.HallowBossLastingRainbow) { - Player.AddBuff(Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(), 160); + Player.AddBuff(Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(), 120); } else if (proj.type == ProjectileID.FairyQueenSunDance) { - Player.AddBuff(Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(), 200); + Player.AddBuff(Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(), 180); } else if (proj.type == ProjectileID.BloodNautilusShot) { - Player.AddBuff(ModContent.BuffType(), 240); + Player.AddBuff(ModContent.BuffType(), 120); } else if (proj.type == ProjectileID.BloodShot) { - Player.AddBuff(ModContent.BuffType(), 180); + Player.AddBuff(ModContent.BuffType(), 60); } else if (proj.type == ProjectileID.RuneBlast && Main.zenithWorld) { @@ -1373,9 +1424,21 @@ namespace CalamityMod.CalPlayer } } + double dodgeDamageGateValuePercent = 0.05; + int dodgeDamageGateValue = (int)Math.Round(Player.statLifeMax2 * dodgeDamageGateValuePercent); + // Reflects count as dodges. They share the timer and can be disabled by global dodge disabling effects. - if (!disableAllDodges && !Player.HasCooldown(GlobalDodge.ID)) + if (!disableAllDodges && !Player.HasCooldown(GlobalDodge.ID) && proj.damage >= dodgeDamageGateValue) { + 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((proj.damage - dodgeDamageGateValue) / (float)maxCooldownDurationDamageValue, 0f, 1f); + if (daedalusReflect && !evolution) { proj.hostile = false; @@ -1383,7 +1446,9 @@ namespace CalamityMod.CalPlayer proj.velocity *= -1f; proj.penetrate = 1; Player.GiveIFrames(20, false); - Player.AddCooldown(GlobalDodge.ID, BalancingConstants.DaedalusReflectCooldown); + + int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.DaedalusReflectCooldownMin, BalancingConstants.DaedalusReflectCooldownMax, cooldownDurationScalar); + Player.AddCooldown(GlobalDodge.ID, cooldownDuration); } } } @@ -1402,21 +1467,14 @@ namespace CalamityMod.CalPlayer if (info.Damage < 1 /* || (godSlayerDamage && info.Damage <= 80) */) return true; - // If this hit was marked to be completely ignored due to shield absorption, then ignore it. + // If this hit was marked to be completely ignored due to shield absorption, then process Adrenaline changes and ignore it. if (freeDodgeFromShieldAbsorption) { freeDodgeFromShieldAbsorption = false; // 20FEB2024: Ozzatron: Hits fully absorbed by shields remove half of your current Adrenaline. - if (AdrenalineEnabled) - { - // Draedon's Heart instead pauses for half the usual duration. - if (draedonsHeart) - nanomachinesLockoutTimer += DraedonsHeart.NanomachinePauseAfterShieldDamage; - else if (adrenaline >= 0f) - adrenaline /= 2f; - } - + // If using Draedon's Heart, it pauses for half the typical duration. + LoseAdrenalineOnHurt(info, true); return true; } @@ -1456,13 +1514,26 @@ namespace CalamityMod.CalPlayer public override bool ConsumableDodge(Player.HurtInfo info) { // Vanilla dodges are gated behind the global dodge cooldown - if (!Player.HasCooldown(GlobalDodge.ID)) + // The dodges will only trigger if the player has taken greater than or equal to 5% of their max HP in damage + double dodgeDamageGateValuePercent = 0.05; + int dodgeDamageGateValue = (int)Math.Round(Player.statLifeMax2 * dodgeDamageGateValuePercent); + if (!Player.HasCooldown(GlobalDodge.ID) && info.Damage >= dodgeDamageGateValue) { + 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((info.Damage - dodgeDamageGateValue) / (float)maxCooldownDurationDamageValue, 0f, 1f); + // Re-implementation of vanilla item Black Belt as a consumable dodge if (Player.whoAmI == Main.myPlayer && Player.blackBelt) { Player.NinjaDodge(); - Player.AddCooldown(GlobalDodge.ID, BalancingConstants.BeltDodgeCooldown); + int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.BeltDodgeCooldownMin, BalancingConstants.BeltDodgeCooldownMax, cooldownDurationScalar); + Player.AddCooldown(GlobalDodge.ID, cooldownDuration); return true; } @@ -1470,7 +1541,9 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer && Player.brainOfConfusionItem != null && !Player.brainOfConfusionItem.IsAir) { Player.BrainOfConfusionDodge(); - int cooldownTime = amalgam ? BalancingConstants.AmalgamDodgeCooldown : BalancingConstants.BrainDodgeCooldown; + 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; } @@ -1494,16 +1567,16 @@ namespace CalamityMod.CalPlayer 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)) + if (!Player.HasCooldown(GlobalDodge.ID) && info.Damage >= dodgeDamageGateValue) { if (eclipseMirror) { - EclipseMirrorDodge(); + EclipseMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, info.Damage); return true; } else if (abyssalMirror) { - AbyssMirrorDodge(); + AbyssMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, info.Damage); return true; } } @@ -1901,6 +1974,7 @@ namespace CalamityMod.CalPlayer { int bleedoutToApply = info.Damage - ChaliceOfTheBloodGod.MinAllowedDamage; chaliceBleedoutBuffer += bleedoutToApply; + chaliceHitOriginalDamage = info.Damage; info.Damage = ChaliceOfTheBloodGod.MinAllowedDamage; // Defense damage is applied here. @@ -2053,21 +2127,7 @@ namespace CalamityMod.CalPlayer // Lose adrenaline on hit, unless using Draedon's Heart. if (AdrenalineEnabled) { - // Being hit for zero from Paladin's Shield damage share does not cancel Adrenaline. - // Adrenaline is not lost when hit if using Draedon's Heart. - // Adrenaline is not lost when an empowered parry is performed with blazing core (reduces damage to 1, but not 0) - if (!draedonsHeart && !blazingCoreEmpoweredParry && !adrenalineModeActive && hurtInfo.Damage > 0) - { - if (adrenaline >= adrenalineMax) - { - SoundEngine.PlaySound(AdrenalineHurtSound, Player.Center); - } - adrenaline = 0f; - } - - // If using Draedon's Heart and not actively healing with Nanomachines, pause generation briefly. - if (draedonsHeart && !adrenalineModeActive) - nanomachinesLockoutTimer += DraedonsHeart.NanomachinePauseAfterDamage; + LoseAdrenalineOnHurt(hurtInfo, false); } if (evilSmasherBoost > 0) @@ -2191,8 +2251,7 @@ namespace CalamityMod.CalPlayer if (tarraMelee) { - if (Main.rand.NextBool(4)) - Player.AddBuff(ModContent.BuffType(), 120); + Player.AddBuff(ModContent.BuffType(), 120); } else if (xerocSet) { @@ -2201,8 +2260,7 @@ namespace CalamityMod.CalPlayer } else if (reaverDefense) { - if (Main.rand.NextBool(4)) - Player.AddBuff(ModContent.BuffType(), 180); + Player.AddBuff(ModContent.BuffType(), 180); } if ((fBarrier || (aquaticHeart && NPC.downedBoss3)) && !areThereAnyDamnBosses) @@ -2838,7 +2896,13 @@ namespace CalamityMod.CalPlayer // Play a sound from taking defense damage. if (hurtSoundTimer == 0 && Main.myPlayer == Player.whoAmI) { - SoundEngine.PlaySound(DefenseDamageSound with { Volume = DefenseDamageSound.Volume * 0.75f }, Player.Center); + double maxVolumeDefenseDamageScalar = Main.masterMode ? 0.7 : CalamityWorld.death ? 0.6 : CalamityWorld.revenge ? 0.55 : Main.expertMode ? 0.5 : 0.4; + float maxVolumeDefenseDamage = (float)Math.Round(Player.statDefense * maxVolumeDefenseDamageScalar); + float minVolume = 0.5f; + float maxVolume = 1f; + float lerpAmount = MathHelper.Clamp(defenseDamage / maxVolumeDefenseDamage, 0f, 1f); + float defenseDamageSoundVolumeMultiplier = MathHelper.Lerp(minVolume, maxVolume, lerpAmount); + SoundEngine.PlaySound(DefenseDamageSound with { Volume = DefenseDamageSound.Volume * defenseDamageSoundVolumeMultiplier }, Player.Center); hurtSoundTimer = 30; } @@ -2849,5 +2913,72 @@ namespace CalamityMod.CalPlayer CombatText.NewText(location, messageColor, Language.GetTextValue(text)); } #endregion + + #region Adrenaline Loss Function + /// + /// Causes the player to lose Adrenaline based on an incoming hit. The behavior differs based on energy shields or Draedon's Heart. + /// + /// The incoming damage event to the player. + /// Whether or not the hit was fully absorbed by one or more energy shields. Tends to halve Adrenaline loss. + private void LoseAdrenalineOnHurt(Player.HurtInfo hurtInfo, bool fullyAbsorbedByShield = false) + { + // Being hit for zero from Paladin's Shield damage share has no effects on Adrenaline, regardless of all other circumstances. + // Likewise, being struck while Adrenaline is actively burning has no effects on Adrenaline. + if (hurtInfo.Damage <= 0 || adrenalineModeActive) + return; + + // Draedon's Heart pauses for half the usual duration on a shield hit. + // Otherwise, nothing happens here because no Adrenaline is actually lost. + if (draedonsHeart) + { + int pauseTime = fullyAbsorbedByShield ? DraedonsHeart.NanomachinePauseAfterShieldDamage : DraedonsHeart.NanomachinePauseAfterDamage; + adrenalinePauseTimer += pauseTime; + } + + // Standard Adrenaline behavior + else + { + // Regular Adrenaline pauses on any hit, even if you lose all Adrenaline. + adrenalinePauseTimer += BalancingConstants.AdrenalinePauseAfterDamage; + + // Play a sound if Adrenaline was lost from full (this means Adrenaline DR helped mitigate the hit). + // If this occurs, since Adrenaline DR helped mitigate the hit's damage, we can't allow the amount of Adrenaline lost to actually be reduced. + bool hitAtFullAdrenaline = adrenaline >= adrenalineMax; + if (hitAtFullAdrenaline) + { + SoundEngine.PlaySound(AdrenalineHurtSound, Player.Center); + adrenaline = 0f; + return; + } + + // 19MAR2024: Ozzatron: Chalice makes you lose adrenaline based on the damage you would have suffered in total. + int damageToUse = hurtInfo.Damage; + if (chaliceOfTheBloodGod && chaliceHitOriginalDamage > 0) + { + damageToUse = chaliceHitOriginalDamage; + // Maybe at some point in the future, tracking this value will be useful elsewhere. Until then, it's only used here, so it is reset here. + chaliceHitOriginalDamage = 0; + } + + // Calculate the amount of Adrenaline to lose. This is done in 3 steps: + // 1. Find out how much %HP the player lost (or was absorbed by a shield). + // 2. Use an inverse lerp to calculate the Adrenaline loss scaling down for very small hits (5% HP or less). + // 3. Re-scale the lerp result into a % of Adrenaline loss from 10% (min loss) to 100%. + float damageMaxHPRatio = (float)damageToUse / Player.statLifeMax2; + float smallHitAdrenalineLossRatio = (float)Utils.GetLerpValue(0f, BalancingConstants.AdrenalineFalloffTinyHitHealthRatio, damageMaxHPRatio, true); + float adrenalineLossFraction = MathHelper.Lerp(BalancingConstants.MinimumAdrenalineLoss, 1f, smallHitAdrenalineLossRatio); + float adrenalineToLose = adrenaline * adrenalineLossFraction; + + // If the hit was fully absorbed by a shield, then lose half that much instead. + if (fullyAbsorbedByShield) + adrenalineToLose /= 2f; + + // Actually subtract Adrenaline. + adrenaline -= adrenalineToLose; + if (adrenaline < 0f) + adrenaline = 0f; + } + } + #endregion } } diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 6f604a47b6..95cdfea9a2 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -103,7 +103,7 @@ namespace CalamityMod.CalPlayer ApplyDoTDebuff(bFlames, abaddon ? 10 : 30, purity); ApplyDoTDebuff(nightwither, reducedNightwitherDamage ? 20 : 40, purity); ApplyDoTDebuff(hFlames, reducedHolyFlamesDamage ? 20 : 40, purity); - ApplyDoTDebuff(vHex, 30); + ApplyDoTDebuff(vHex, 35); ApplyDoTDebuff(cDepth, 18, purity); ApplyDoTDebuff(astralInfection, 24, infectedJewel || purity); ApplyDoTDebuff(pFlames, 30, purity); diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index d31b03f937..99f928f701 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -7,6 +7,7 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer.Dashes; using CalamityMod.Cooldowns; using CalamityMod.CustomRecipes; using CalamityMod.DataStructures; @@ -364,11 +365,6 @@ namespace CalamityMod.CalPlayer { if (CalamityWorld.revenge) { - // Adjusts the life steal cap in rev/death - float lifeStealCap = BossRushEvent.BossRushActive ? 30f : CalamityWorld.death ? 45f : 60f; - if (Player.lifeSteal > lifeStealCap) - Player.lifeSteal = lifeStealCap; - if (Player.whoAmI == Main.myPlayer) { // Hallowed Armor nerf @@ -608,7 +604,7 @@ namespace CalamityMod.CalPlayer // Apply the adrenaline change and cap adrenaline in both directions. // Changes are only applied if the Adrenaline mechanic is available. - if (AdrenalineEnabled && nanomachinesLockoutTimer == 0) + if (AdrenalineEnabled && adrenalinePauseTimer == 0) { adrenaline += adrenalineDiff; if (adrenaline < 0f) @@ -629,8 +625,8 @@ namespace CalamityMod.CalPlayer playFullAdrenalineSound = true; } - if (nanomachinesLockoutTimer > 0) - nanomachinesLockoutTimer--; + if (adrenalinePauseTimer > 0) + adrenalinePauseTimer--; #endregion } #endregion @@ -891,14 +887,37 @@ namespace CalamityMod.CalPlayer } } - // Life Steal nerf - // Reduces Normal Mode life steal recovery rate from 0.6/s to 0.5/s - // Reduces Expert Mode life steal recovery rate from 0.5/s to 0.35/s - // Revengeance Mode recovery rate is 0.3/s - // Death Mode recovery rate is 0.25/s - // Boss Rush recovery rate is 0.2/s - float lifeStealCooldown = BossRushEvent.BossRushActive ? 0.3f : CalamityWorld.death ? 0.25f : CalamityWorld.revenge ? 0.2f : Main.expertMode ? 0.15f : 0.1f; - Player.lifeSteal -= lifeStealCooldown; + // Life Steal nerf in difficulties above Expert + // Reduces the max possible life steal before the cooldown occurs (this mostly just nerfs how much life steal the player can get in bursts) + // Master Mode nerfs this by an additional 10 + float lifeStealCap = + CalamityWorld.death ? BalancingConstants.LifeStealCap_Death : + CalamityWorld.revenge ? BalancingConstants.LifeStealCap_Revengeance : + Main.expertMode ? BalancingConstants.LifeStealCap_Expert : + BalancingConstants.LifeStealCap_Classic; + + if (Main.masterMode) + lifeStealCap -= BalancingConstants.LifeStealCapReduction_Master; + + if (Player.lifeSteal > lifeStealCap) + Player.lifeSteal = lifeStealCap; + + // Normal Mode life steal recovery rate is 0.2/s + // Expert Mode life steal recovery rate is 0.15/s + // Revengeance Mode life steal recovery rate is 0.125/s + // Death Mode life steal recovery rate is 0.1/s + // Master Mode life steal recovery rate is nerfed by an additional 0.05/s + float lifeStealRecoveryRateReduction = + CalamityWorld.death ? BalancingConstants.LifeStealRecoveryRateReduction_Death : + CalamityWorld.revenge ? BalancingConstants.LifeStealRecoveryRateReduction_Revengeance : + Main.expertMode ? BalancingConstants.LifeStealRecoveryRateReduction_Expert : + BalancingConstants.LifeStealRecoveryRateReduction_Classic; + + if (Main.masterMode) + lifeStealRecoveryRateReduction += BalancingConstants.LifeStealRecoveryRateReduction_Master; + + if (Player.lifeSteal < lifeStealCap) + Player.lifeSteal -= lifeStealRecoveryRateReduction; // Bool for drawing boss health bar small text or not if (Main.myPlayer == Player.whoAmI) @@ -973,14 +992,12 @@ namespace CalamityMod.CalPlayer if (Player.IsUnderwater()) { if (Main.myPlayer == Player.whoAmI) - { Player.AddBuff(ModContent.BuffType(), 2, false); - } } } if (iCantBreathe) { - if (Player.breath > 0) + if (Player.breath > 0 && Player.miscCounter % 2 == 0) Player.breath--; } } @@ -1177,6 +1194,8 @@ namespace CalamityMod.CalPlayer { Player.statLife += 15; Player.HealEffect(15); + if (Player.statLife > Player.statLifeMax2) + Player.statLife = Player.statLifeMax2; if (profanedCrystal) { @@ -1366,8 +1385,6 @@ namespace CalamityMod.CalPlayer bloodflareMageCooldown--; if (silvaMageCooldown > 0) silvaMageCooldown--; - if (tarraMageHealCooldown > 0) - tarraMageHealCooldown--; if (scuttlerCooldown > 0) scuttlerCooldown--; if (rogueCrownCooldown > 0) @@ -1709,9 +1726,7 @@ namespace CalamityMod.CalPlayer // Raider Talisman bonus if (raiderTalisman && !StealthStrikeAvailable()) - { Player.GetCritChance() += raiderCritBonus; - } if (kamiBoost) Player.GetDamage() += 0.15f; @@ -1719,6 +1734,10 @@ namespace CalamityMod.CalPlayer if (avertorBonus) Player.GetDamage() += 0.1f; + // Reduce Ichor debuff defense reduction from -15 to -10 + if (Player.ichor) + Player.statDefense += 5; + // Fairy Boots bonus if (fairyBoots) { @@ -2497,7 +2516,7 @@ namespace CalamityMod.CalPlayer if (rRage) { - Player.GetDamage() += 0.3f; + Player.GetDamage() += 0.1f; Player.statDefense += 5; } @@ -2554,10 +2573,8 @@ namespace CalamityMod.CalPlayer if (aeroStone && !Player.slowFall && Player.wingTime < Player.wingTimeMax) { - if (!Player.controlJump && Player.miscCounter % 5 == 0) - { + if (!Player.controlJump && Player.miscCounter % 4 == 0) Player.wingTime += 1; - } } if (gShell) @@ -2619,6 +2636,8 @@ namespace CalamityMod.CalPlayer { Player.statLife += 1; Player.HealEffect(1, false); + if (Player.statLife > Player.statLifeMax2) + Player.statLife = Player.statLifeMax2; // Produce an implosion of blood themed dust so it's obvious an effect is occurring for (int i = 0; i < 3; ++i) @@ -2640,6 +2659,11 @@ namespace CalamityMod.CalPlayer if (CalamityMod.Instance.overhaul is null && CalamityConfig.Instance.FasterBaseSpeed) Player.moveSpeed += BalancingConstants.DefaultMoveSpeedBoost; + // Reduce how slow Chilled makes the player, because it's cancerous right now + // The moveSpeed multiplier for Chilled in vanilla is 0.75, so we just multiply by 1.166667 here to make it 0.875, effectively cutting the reduction in half + if (Player.chilled) + Player.moveSpeed *= 1f + (1f / 6f); + if (cirrusDress) Player.moveSpeed -= 0.2f; @@ -2814,7 +2838,7 @@ namespace CalamityMod.CalPlayer // Reaver Tank set nuke flight time if (reaverDefense) - flightTimeMult -= 0.2f; + flightTimeMult -= 0.3f; // Increase wing time if (Player.wingTimeMax > 0) @@ -2822,7 +2846,6 @@ namespace CalamityMod.CalPlayer if (vHex) { - Player.blind = true; Player.statDefense -= 20; if (Player.wingTimeMax < 0) @@ -3058,13 +3081,6 @@ namespace CalamityMod.CalPlayer } } - if (deepDiver && Player.IsUnderwater()) - { - Player.GetDamage() += 0.15f; - Player.statDefense += 15; - Player.moveSpeed += 0.15f; - } - if (abyssalDivingSuit && !Player.IsUnderwater()) { float moveSpeedLoss = (3 - abyssalDivingSuitPlateHits) * 0.2f; @@ -4177,7 +4193,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc is null || !npc.active) + if (npc is null || !npc.active || npc.type != ModContent.NPCType()) return; bool holdingsol = ((Player.HeldItem.type >= ItemID.GreenSolution && Player.HeldItem.type <= ItemID.RedSolution) || (Player.HeldItem.type >= ItemID.SandSolution && Player.HeldItem.type <= ItemID.DirtSolution) || Player.HeldItem.type == ModContent.ItemType()); diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 97ce4281bb..be1b3c1933 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; @@ -88,7 +89,7 @@ namespace CalamityMod.CalPlayer break; case ItemID.PalladiumSword: - if (!target.canGhostHeal || Player.moonLeech) + if (Player.moonLeech) return; Player.lifeRegenTime += 2; break; @@ -110,10 +111,17 @@ namespace CalamityMod.CalPlayer break; case ItemID.CandyCaneSword: - if (!target.canGhostHeal || Player.moonLeech) + + if (Player.moonLeech || Player.lifeSteal <= 0f || target.lifeMax <= 5) return; - Player.statLife += 2; - Player.HealEffect(2); + + int heal = 2; + Player.lifeSteal -= heal; + Player.statLife += heal; + Player.HealEffect(heal); + if (Player.statLife > Player.statLifeMax2) + Player.statLife = Player.statLifeMax2; + break; case ItemID.DeathSickle: @@ -210,7 +218,7 @@ namespace CalamityMod.CalPlayer break; case ProjectileID.PalladiumPike: - if (!target.canGhostHeal || Player.moonLeech) + if (Player.moonLeech) return; Player.lifeRegenTime += 2; break; @@ -232,10 +240,17 @@ namespace CalamityMod.CalPlayer break; case ProjectileID.FruitcakeChakram: - if (!target.canGhostHeal || Player.moonLeech) + + if (Player.moonLeech || Main.player[Main.myPlayer].lifeSteal <= 0f || target.lifeMax <= 5) return; - Player.statLife += 2; - Player.HealEffect(2); + + int heal = 2; + Main.player[Main.myPlayer].lifeSteal -= heal; + Player.statLife += heal; + Player.HealEffect(heal); + if (Player.statLife > Player.statLifeMax2) + Player.statLife = Player.statLifeMax2; + break; case ProjectileID.ObsidianSwordfish: @@ -1126,35 +1141,7 @@ namespace CalamityMod.CalPlayer { CalamityGlobalProjectile modProj = proj.Calamity(); - // Spectre Damage set and Nebula set work on enemies which are "immune to lifesteal" - if (!target.canGhostHeal) - { - if (Player.ghostHurt) - { - proj.ghostHurt(damage, target.Center, target); - } - - if (Player.setNebula && Player.nebulaCD == 0 && Main.rand.NextBool(3)) - { - Player.nebulaCD = 30; - int boosterType = Utils.SelectRandom(Main.rand, new int[] - { - ItemID.NebulaPickup1, - ItemID.NebulaPickup2, - ItemID.NebulaPickup3 - }); - var source = Player.GetSource_Misc("1"); - int nebulaBooster = Item.NewItem(source, target.Center, target.Size, boosterType, 1, false, 0, false, false); - Main.item[nebulaBooster].velocity.Y = Main.rand.Next(-20, 1) * 0.2f; - Main.item[nebulaBooster].velocity.X = Main.rand.Next(10, 31) * 0.2f * proj.direction; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(MessageID.SyncItem, -1, -1, null, nebulaBooster, 0f, 0f, 0f, 0, 0, 0); - } - } - } - - if (bloodflareSet && !target.IsAnEnemy(false) && !Player.moonLeech) + if (bloodflareSet && !target.IsAnEnemy(false) && !Player.moonLeech && target.lifeMax > 5) { if ((target.life < target.lifeMax * 0.5) && bloodflareHeartTimer <= 0) { @@ -1163,17 +1150,18 @@ namespace CalamityMod.CalPlayer } } - if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill) + if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill && target.lifeMax > 5) { target.Calamity().gladiatorOnKill = false; Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center.X, target.Center.Y, target.velocity.X / 2, target.velocity.Y / 2, ModContent.ProjectileType(), 0, 0f); } - if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && !Player.moonLeech) + if (Main.player[Main.myPlayer].lifeSteal > 0f && !Player.moonLeech && target.lifeMax > 5) { // Increases the degree to which Spectre Healing set contributes to the lifesteal cap if (Player.ghostHeal && proj.CountsAsClass()) { + // This doesn't use Math.Round because it doesn't in vanilla float cooldownMult = 0.2f; cooldownMult -= proj.numHits * 0.05f; if (cooldownMult < 0f) @@ -1183,202 +1171,83 @@ namespace CalamityMod.CalPlayer Main.player[Main.myPlayer].lifeSteal -= cooldown; } - // Increases the degree to which Vampire Knives contribute to the lifesteal cap - if (proj.type == ProjectileID.VampireKnife) - { - float cooldown = damage * 0.075f; - if (cooldown < 0f) - cooldown = 0f; - - Main.player[Main.myPlayer].lifeSteal -= cooldown; - } - - // Increases the degree to which Bloodfire Arrows contribute to the lifesteal cap - if (proj.type == ModContent.ProjectileType()) - { - float cooldown = 6; - if (cooldown < 0f) - cooldown = 0f; - - Main.player[Main.myPlayer].lifeSteal -= cooldown; - } - if (vampiricTalisman && proj.CountsAsClass() && crit) { - float heal = MathHelper.Clamp(damage * 0.011f, 0f, 5f); - if ((int)heal > 0) - { - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileID.VampireHeal, 1200f, 3f); - float cooldown = heal * 2f; - Main.player[Main.myPlayer].lifeSteal -= cooldown; - } + int heal = (int)Math.Round(damage * 0.015); + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(1f, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange, BalancingConstants.LifeStealAccessoryCooldownMultiplier); } if (bloodyGlove && proj.CountsAsClass() && modProj.stealthStrike) - { - float cooldown = 20; - Player.statLife += 2; - Player.HealEffect(2); - Main.player[Main.myPlayer].lifeSteal -= cooldown; - } + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, 2, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange, BalancingConstants.LifeStealAccessoryCooldownMultiplier); if (target.IsAnEnemy(false)) { - if (bloodflareThrowing && proj.CountsAsClass() && crit && Main.rand.NextBool()) - { - float projHitMult = 0.03f; - projHitMult -= proj.numHits * 0.015f; - if (projHitMult < 0f) - projHitMult = 0f; - - float cooldownMult = damage * projHitMult; - if (cooldownMult < 0f) - cooldownMult = 0f; - - if (Player.lifeSteal > 0f) - { - Player.statLife += 1; - Player.HealEffect(1); - Player.lifeSteal -= cooldownMult * 2f; - } - } + if (bloodflareThrowing && proj.CountsAsClass() && crit) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, 2, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); if (bloodflareMelee && proj.IsTrueMelee()) - { - int healAmount = Main.rand.Next(2) + 1; - Player.statLife += healAmount; - Player.HealEffect(healAmount); - } + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, 2, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); } - bool otherHealTypes = auricSet || silvaSet || tarraMage || ataxiaMage; - if (proj.CountsAsClass() && Player.ActiveItem().CountsAsClass()) { - if (manaOverloader && otherHealTypes) + if (manaOverloader) { - if (Main.rand.NextBool()) - { - float healMult = 0.2f; - healMult -= proj.numHits * 0.05f; - float heal = damage * healMult * (Player.statMana / (float)Player.statManaMax2); - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); - } + double healMult = 0.2; + healMult -= proj.numHits * healMult * 0.25; + int heal = (int)Math.Round(damage * healMult * (Player.statMana / (double)Player.statManaMax2)); + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealAccessoryCooldownMultiplier); } } if (silvaSet) { - float healMult = 0.03f; - healMult -= proj.numHits * 0.015f; - float heal = damage * healMult; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); + double healMult = 0.1; + healMult -= proj.numHits * healMult * 0.5; + int heal = (int)Math.Round(damage * healMult); + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); } else if (proj.CountsAsClass() && Player.ActiveItem().CountsAsClass()) { - if (manaOverloader) - { - float healMult = 0.2f; - healMult -= proj.numHits * 0.05f; - float heal = damage * healMult * (Player.statMana / (float)Player.statManaMax2); - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); - } - if (tarraMage) { - if (tarraMageHealCooldown <= 0) - { - tarraMageHealCooldown = 90; - - float healMult = 0.1f; - healMult -= proj.numHits * 0.05f; - float heal = damage * healMult; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - return; - - Main.player[Main.myPlayer].lifeSteal -= heal * 6f; - - int healAmount = (int)heal; - Player.statLife += healAmount; - Player.HealEffect(healAmount); - - if (Player.statLife > Player.statLifeMax2) - Player.statLife = Player.statLifeMax2; - } + double healMult = 0.1; + healMult -= proj.numHits * healMult * 0.5; + int heal = (int)Math.Round(damage * healMult); + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); } else if (ataxiaMage) { - float healMult = 0.1f; - healMult -= proj.numHits * 0.05f; - float heal = damage * healMult; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); + double healMult = 0.1; + healMult -= proj.numHits * healMult * 0.5; + int heal = (int)Math.Round(damage * healMult); + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); } } if (reaverDefense) { - float healMult = 0.2f; - healMult -= proj.numHits * 0.05f; - float heal = damage * healMult; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - if (Main.rand.Next(10) > 0) - heal = 0; - - if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); + double healMult = 0.1; + healMult -= proj.numHits * healMult * 0.5; + int heal = (int)Math.Round(damage * healMult); + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealReaverTankCooldownMultiplier); } if (proj.CountsAsClass()) { if (xerocSet && xerocDmg <= 0 && Player.ownedProjectileCounts[ProjectileType()] < 3 && Player.ownedProjectileCounts[ProjectileType()] < 3) { - float healMult = 0.06f; - healMult -= proj.numHits * 0.015f; - float heal = damage * healMult; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); + double healMult = 0.1; + healMult -= proj.numHits * healMult * 0.5; + int heal = (int)Math.Round(damage * healMult); + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); } } } @@ -1386,7 +1255,7 @@ namespace CalamityMod.CalPlayer public void ItemLifesteal(NPC target, Item item, int damage) { - if (bloodflareSet && target.IsAnEnemy(false)) + if (bloodflareSet && target.IsAnEnemy(false) && target.lifeMax > 5) { if ((target.life < target.lifeMax * 0.5) && bloodflareHeartTimer <= 0) { @@ -1395,37 +1264,14 @@ namespace CalamityMod.CalPlayer } } - if (target.IsAnEnemy(false) && target.canGhostHeal && !Player.moonLeech) + if (bloodflareMelee && item.CountsAsClass() && target.lifeMax > 5) { - if (bloodflareMelee && item.CountsAsClass()) + if (target.IsAnEnemy(false) && Main.player[Main.myPlayer].lifeSteal > 0f && !Player.moonLeech) { - int healAmount = Main.rand.Next(2) + 1; - Player.statLife += healAmount; - Player.HealEffect(healAmount); - } - } - - if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill) - { - target.Calamity().gladiatorOnKill = false; - Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center.X, target.Center.Y, target.velocity.X / 2, target.velocity.Y / 2, ModContent.ProjectileType(), 0, 0f); - } - - if (reaverDefense) - { - if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && !Player.moonLeech) - { - float healMult = 0.2f; - float heal = damage * healMult; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - if (Main.rand.Next(10) > 0) - heal = 0; - - if ((int)heal > 0 && !Main.player[Main.myPlayer].moonLeech) + int heal = 4; + if (!Main.player[Main.myPlayer].moonLeech) { - Main.player[Main.myPlayer].lifeSteal -= heal * 3f; + Main.player[Main.myPlayer].lifeSteal -= heal * BalancingConstants.LifeStealSetBonusCooldownMultiplier; float lowestHealthCheck = 0f; int healTarget = Player.whoAmI; @@ -1435,7 +1281,46 @@ namespace CalamityMod.CalPlayer if (otherPlayer.active && !otherPlayer.dead && ((!Player.hostile && !otherPlayer.hostile) || Player.team == otherPlayer.team)) { float playerDist = Vector2.Distance(target.Center, otherPlayer.Center); - if (playerDist < 1200f && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck) + if (playerDist < BalancingConstants.LifeStealRange && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck) + { + lowestHealthCheck = otherPlayer.statLifeMax2 - otherPlayer.statLife; + healTarget = i; + } + } + } + + // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list + var source = Player.GetSource_FromThis(ReaverHeadTank.HealOrbEntitySourceContext); + Projectile.NewProjectile(source, target.Center, Vector2.Zero, ProjectileID.VampireHeal, 0, 0f, Player.whoAmI, healTarget, heal); + } + } + } + + if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill && target.lifeMax > 5) + { + target.Calamity().gladiatorOnKill = false; + Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ModContent.ProjectileType(), 0, 0f); + } + + if (reaverDefense) + { + if (Main.player[Main.myPlayer].lifeSteal > 0f && !Player.moonLeech && target.lifeMax > 5) + { + double healMult = 0.1; + int heal = (int)Math.Round(damage * healMult); + if (heal > 0 && !Main.player[Main.myPlayer].moonLeech) + { + Main.player[Main.myPlayer].lifeSteal -= heal * BalancingConstants.LifeStealReaverTankCooldownMultiplier; + + float lowestHealthCheck = 0f; + int healTarget = Player.whoAmI; + for (int i = 0; i < Main.maxPlayers; i++) + { + Player otherPlayer = Main.player[i]; + if (otherPlayer.active && !otherPlayer.dead && ((!Player.hostile && !otherPlayer.hostile) || Player.team == otherPlayer.team)) + { + float playerDist = Vector2.Distance(target.Center, otherPlayer.Center); + if (playerDist < BalancingConstants.LifeStealRange && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck) { lowestHealthCheck = otherPlayer.statLifeMax2 - otherPlayer.statLife; healTarget = i; diff --git a/CalPlayer/Dashes/AsgardsValorDash.cs b/CalPlayer/Dashes/AsgardsValorDash.cs index 78ede1e952..499d16ebcb 100644 --- a/CalPlayer/Dashes/AsgardsValorDash.cs +++ b/CalPlayer/Dashes/AsgardsValorDash.cs @@ -93,7 +93,7 @@ namespace CalamityMod.CalPlayer.Dashes dust.noGravity = false; dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); } - SoundEngine.PlaySound(SoundID.Item62 with { Volume = 0.6f, PitchVariance = 0.3f }, npc.position); + SoundEngine.PlaySound(SoundID.Item62 with { Volume = 0.6f, PitchVariance = 0.3f }, npc.Center); } } } diff --git a/CalPlayer/Dashes/DeepDiverDash.cs b/CalPlayer/Dashes/DeepDiverDash.cs index b969f11e13..6ec6a025e8 100644 --- a/CalPlayer/Dashes/DeepDiverDash.cs +++ b/CalPlayer/Dashes/DeepDiverDash.cs @@ -1,8 +1,14 @@ -using CalamityMod.Enums; +using System; +using CalamityMod.Enums; +using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.Graphics.Shaders; using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Particles; +using Terraria.Audio; namespace CalamityMod.CalPlayer.Dashes { @@ -10,42 +16,94 @@ namespace CalamityMod.CalPlayer.Dashes { public static new string ID => "Deep Diver"; - public override DashCollisionType CollisionType => DashCollisionType.NoCollision; + public override DashCollisionType CollisionType => DashCollisionType.ShieldSlam; public override bool IsOmnidirectional => false; - public override float CalculateDashSpeed(Player player) => 25.9f; + public override float CalculateDashSpeed(Player player) => 20f; + public int Time = 0; public override void OnDashEffects(Player player) { - for (int d = 0; d < 60; d++) + Time = 0; + for (int m = 0; m < 3; m++) { - Dust iceDashDust = Dust.NewDustDirect(player.position, player.width, player.height, DustID.Water, 0f, 0f, 100, default, 1.25f); - iceDashDust.position += Main.rand.NextVector2Square(-5f, 5f); - iceDashDust.velocity *= 0.2f; - iceDashDust.scale *= Main.rand.NextFloat(1f, 1.2f); - iceDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); - iceDashDust.noGravity = true; - iceDashDust.fadeIn = 0.5f; + PointParticle spark = new PointParticle(player.Center - player.velocity, -player.velocity * (0.08f * m), false, 25, 4f - (0.5f * m), (Main.rand.NextBool() ? Color.Aqua : Color.DodgerBlue) * 0.4f); + GeneralParticleHandler.SpawnParticle(spark); } } public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { - for (int m = 0; m < 24; m++) + Time++; + for (int m = 0; m < 5; m++) { - Dust iceDashDust = Dust.NewDustDirect(player.position + Vector2.UnitY * 4f, player.width, player.height - 8, DustID.Water, 0f, 0f, 100, default, 1.25f); - iceDashDust.position += Main.rand.NextVector2Square(-5f, 5f); - iceDashDust.velocity *= 0.2f; - iceDashDust.scale *= Main.rand.NextFloat(1f, 1.2f); - iceDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); - iceDashDust.noGravity = true; - if (Main.rand.NextBool()) - iceDashDust.fadeIn = 0.5f; + Vector2 dustVel3 = -player.velocity.RotatedBy(Main.rand.NextFloat(-0.3f, 0.3f)) * Main.rand.NextFloat(0.03f, 0.2f); + Dust dust = Dust.NewDustPerfect(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.7f), Main.rand.NextBool(7) ? 278 : 80, dustVel3); + if (dust.type == 278) + { + dust.scale = 1.2f; + dust.velocity = Vector2.Zero; + dust.noGravity = false; + dust.color = Main.rand.NextBool() ? Color.Aqua : Color.DodgerBlue; + } + else + { + dust.scale = Main.rand.NextFloat(0.6f, 1.8f); + dust.alpha = 125; + dust.noGravity = true; + } + dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + } + if (Time % 2 == 0) + { + Vector2 dustVel = -player.velocity.RotatedBy(0.05f + MathHelper.Clamp(Time * 0.03f, 0, 0.55f)) * 0.75f; + Vector2 dustVel2 = -player.velocity.RotatedBy(-0.05f - MathHelper.Clamp(Time * 0.03f, 0, 0.55f)) * 0.75f; + + PointParticle spark = new PointParticle(player.Center + new Vector2(0, -15 * player.direction) + dustVel, dustVel, false, 8, 1.4f, (Main.rand.NextBool() ? Color.Aqua : Color.DodgerBlue) * 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + PointParticle spark2 = new PointParticle(player.Center + new Vector2(0, 15 * player.direction) + dustVel2, dustVel2, false, 8, 1.4f, (Main.rand.NextBool() ? Color.Aqua : Color.DodgerBlue) * 0.5f); + GeneralParticleHandler.SpawnParticle(spark2); } + player.velocity.X *= 0.967f; + // Dash at a faster speed than the default value. - dashSpeed = 18f; + dashSpeed = 25f; + } + + public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) + { + SoundStyle hit = new("CalamityMod/Sounds/NPCHit/PerfSmallHit3"); + SoundEngine.PlaySound(hit with { Pitch = 0.7f, Volume = 0.4f }, player.Center); + for (int i = 0; i <= 6; i++) + { + Dust dust = Dust.NewDustPerfect(player.Center, Main.rand.NextBool() ? 278 : 132, player.velocity.RotatedByRandom(0.7f) * Main.rand.NextFloat(0.5f, 1f) + new Vector2(0, -3f)); + if (dust.type == 278) + { + dust.scale = 1.2f; + dust.color = Main.rand.NextBool() ? Color.Aqua : Color.DodgerBlue; + } + else + { + dust.scale = 0.9f; + } + dust.noGravity = false; + dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + } + + // Define hit context variables. + int hitDirection = player.direction; + if (player.velocity.X != 0f) + hitDirection = Math.Sign(player.velocity.X); + hitContext.HitDirection = hitDirection; + hitContext.PlayerImmunityFrames = DeepDiver.ShieldSlamIFrames; + + // Define damage parameters. + int dashDamage = DeepDiver.ShieldSlamDamage; + hitContext.damageClass = DamageClass.Melee; + hitContext.BaseDamage = player.ApplyArmorAccDamageBonusesTo(dashDamage); + hitContext.BaseKnockback = DeepDiver.ShieldSlamKnockback; } } } diff --git a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs new file mode 100644 index 0000000000..cd0b42f630 --- /dev/null +++ b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs @@ -0,0 +1,263 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Items.SummonItems; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.UI; + +namespace CalamityMod.CalPlayer.DrawLayers +{ + public class HeldItemGlowMaskLayer : PlayerDrawLayer + { + public override Position GetDefaultPosition() => new AfterParent(PlayerDrawLayers.HeldItem); + + protected override void Draw(ref PlayerDrawSet drawInfo) + { + Player drawPlayer = drawInfo.drawPlayer; + List existingDrawData = drawInfo.DrawDataCache; + + if (drawPlayer.JustDroppedAnItem) + return; + + Item heldItem = drawInfo.heldItem; + int itemType = heldItem.type; + + if (itemType < ItemID.Count) + return; + + // This is ugly and I don't give a fuck. + // If you want it to look better, do it yourself. + Texture2D glowMask = default; + if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/IridescentExcaliburGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/AbyssShocker_mask").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/ApotheosisGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/DeathhailStaffGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/FatesRevealGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/EssenceFlayerGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/ExcelsusGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/TerrorBladeGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/TheEnforcerGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/AuralisGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/AuroraBlazerGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/CleansingBlazeGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/CosmicBolterGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/DeathwindGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Summon/EtherealSubjugatorGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/GreatswordofJudgementGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/OrderbringerGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/MajesticGuardGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/GrandGuardianGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/SummonItems/NecroplasmicBeaconGlow").Value; + + if (glowMask == default) + return; + + if (drawPlayer.heldProj >= 0 && drawInfo.shadow == 0f && !drawInfo.heldProjOverHand) + drawInfo.projectileDrawPosition = existingDrawData.Count; + + float adjustedItemScale = drawPlayer.GetAdjustedItemScale(heldItem); + //Main.instance.LoadItem(num); + Vector2 position = new Vector2((int)(drawInfo.ItemLocation.X - Main.screenPosition.X), (int)(drawInfo.ItemLocation.Y - Main.screenPosition.Y)); + Rectangle itemDrawFrame = drawPlayer.GetItemDrawFrame(itemType); + drawInfo.itemColor = Lighting.GetColor((int)((double)drawInfo.Position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawInfo.Position.Y + (double)drawPlayer.height * 0.5) / 16D)); + + if (drawPlayer.shroomiteStealth && heldItem.CountsAsClass()) + { + float stealth = drawPlayer.stealth; + if ((double)stealth < 0.03) + stealth = 0.03f; + + float stealthColorScale = (1f + stealth * 10f) / 11f; + drawInfo.itemColor = new Color((byte)((float)(int)drawInfo.itemColor.R * stealth), (byte)((float)(int)drawInfo.itemColor.G * stealth), (byte)((float)(int)drawInfo.itemColor.B * stealthColorScale), (byte)((float)(int)drawInfo.itemColor.A * stealth)); + } + + if (drawPlayer.setVortex && heldItem.CountsAsClass()) + { + float stealth = drawPlayer.stealth; + if ((double)stealth < 0.03) + stealth = 0.03f; + + drawInfo.itemColor = drawInfo.itemColor.MultiplyRGBA(new Color(Vector4.Lerp(Vector4.One, new Vector4(0f, 0.12f, 0.16f, 0f), 1f - stealth))); + } + + bool inUse = drawPlayer.itemAnimation > 0 && heldItem.useStyle != 0; + bool visuallyHeld = heldItem.holdStyle != 0 && !drawPlayer.pulley; + if (!drawPlayer.CanVisuallyHoldItem(heldItem)) + visuallyHeld = false; + + if (drawInfo.shadow != 0f || drawPlayer.frozen || !(inUse || visuallyHeld) || itemType <= 0 || drawPlayer.dead || heldItem.noUseGraphic || (drawPlayer.wet && heldItem.noWet) || (drawPlayer.happyFunTorchTime && drawPlayer.inventory[drawPlayer.selectedItem].createTile == TileID.Torches && drawPlayer.itemAnimation == 0)) + return; + + Color color = new Color(250, 250, 250, heldItem.alpha); + Vector2 originOffset = Vector2.Zero; + + // Use to adjust glow mask draw offset and color. + switch (itemType) + { + default: + break; + + // Keeping these commented here as examples. + /*case ItemID.TheBreaker: + case ItemID.TentacleSpike: + case ItemID.LucyTheAxe: + originOffset = new Vector2(4f, -4f) * drawPlayer.Directions; + break; + + case ItemID.BreakerBlade: + case ItemID.FleshGrinder: + case ItemID.SpectrePickaxe: + case ItemID.HamBat: + case ItemID.BatBat: + originOffset = new Vector2(6f, -6f) * drawPlayer.Directions; + break; + + case ItemID.LightsBane: + { + float amount = Utils.Remap(drawInfo.itemColor.ToVector3().Length() / 1.731f, 0.3f, 0.5f, 1f, 0f); + color = Color.Lerp(Color.Transparent, new Color(255, 255, 255, 127) * 0.7f, amount); + break; + } + + case ItemID.MeteorHamaxe: + originOffset = new Vector2(4f, -6f) * drawPlayer.Directions; + break; + + case ItemID.DyeTradersScimitar: + originOffset = new Vector2(2f, -2f) * drawPlayer.Directions; + break;*/ + } + + if (itemType == ModContent.ItemType()) + { + color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, heldItem.alpha); + } + + Vector2 origin = new Vector2((float)itemDrawFrame.Width * 0.5f - (float)itemDrawFrame.Width * 0.5f * (float)drawPlayer.direction, itemDrawFrame.Height); + if (heldItem.useStyle == ItemUseStyleID.DrinkLiquid && drawPlayer.itemAnimation > 0) + { + Vector2 vector2 = new Vector2(0.5f, 0.4f); + origin = itemDrawFrame.Size() * vector2; + } + + if (drawPlayer.gravDir == -1f) + origin.Y = (float)itemDrawFrame.Height - origin.Y; + + origin += originOffset; + float itemRotation = drawPlayer.itemRotation; + + if (heldItem.useStyle == ItemUseStyleID.GolfPlay) + { + ref float xPos = ref position.X; + float xOffset = xPos; + xPos = xOffset - 0f; + itemRotation -= MathHelper.PiOver2 * (float)drawPlayer.direction; + origin.Y = 2f; + origin.X += 2 * drawPlayer.direction; + } + + ItemSlot.GetItemLight(ref drawInfo.itemColor, heldItem); + DrawData item; + + if (heldItem.useStyle == ItemUseStyleID.Shoot) + { + if (Item.staff[itemType]) + { + float staffRotation = drawPlayer.itemRotation + MathHelper.PiOver4 * (float)drawPlayer.direction; + float staffXOffset = 0f; + float staffYOffset = 0f; + Vector2 staffOrigin = new Vector2(0f, itemDrawFrame.Height); + + if (drawPlayer.gravDir == -1f) + { + if (drawPlayer.direction == -1) + { + staffRotation += MathHelper.PiOver2; + staffOrigin = new Vector2(itemDrawFrame.Width, 0f); + staffXOffset -= (float)itemDrawFrame.Width; + } + else + { + staffRotation -= MathHelper.PiOver2; + staffOrigin = Vector2.Zero; + } + } + + // Extra patch context. + else if (drawPlayer.direction == -1) + { + staffOrigin = new Vector2(itemDrawFrame.Width, itemDrawFrame.Height); + staffXOffset -= (float)itemDrawFrame.Width; + } + + ItemLoader.HoldoutOrigin(drawPlayer, ref staffOrigin); + + item = new DrawData(glowMask, new Vector2((int)(drawInfo.ItemLocation.X - Main.screenPosition.X + staffOrigin.X + staffXOffset), (int)(drawInfo.ItemLocation.Y - Main.screenPosition.Y + staffYOffset)), itemDrawFrame, color, staffRotation, staffOrigin, adjustedItemScale, drawInfo.itemEffect); + existingDrawData.Add(item); + + return; + } + + int xOffset = 10; + Vector2 offset = new Vector2(itemDrawFrame.Width / 2, itemDrawFrame.Height / 2); + Vector2 directionalOffset = Main.DrawPlayerItemPos(drawPlayer.gravDir, itemType); + xOffset = (int)directionalOffset.X; + offset.Y = directionalOffset.Y; + Vector2 drawOrigin = new Vector2(-xOffset, itemDrawFrame.Height / 2); + if (drawPlayer.direction == -1) + drawOrigin = new Vector2(itemDrawFrame.Width + xOffset, itemDrawFrame.Height / 2); + + item = new DrawData(glowMask, new Vector2((int)(drawInfo.ItemLocation.X - Main.screenPosition.X + offset.X), (int)(drawInfo.ItemLocation.Y - Main.screenPosition.Y + offset.Y)), itemDrawFrame, new Color(250, 250, 250, heldItem.alpha), drawPlayer.itemRotation, drawOrigin, adjustedItemScale, drawInfo.itemEffect); + existingDrawData.Add(item); + + return; + } + + if (drawPlayer.gravDir == -1f) + { + item = new DrawData(glowMask, position, itemDrawFrame, new Color(250, 250, 250, heldItem.alpha), itemRotation, origin, adjustedItemScale, drawInfo.itemEffect); + existingDrawData.Add(item); + + return; + } + + item = new DrawData(glowMask, position, itemDrawFrame, color, itemRotation, origin, adjustedItemScale, drawInfo.itemEffect); + existingDrawData.Add(item); + } + } +} diff --git a/CalamityConfig.cs b/CalamityConfig.cs index cb84a621a3..80585fc519 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -35,13 +35,13 @@ namespace CalamityMod [DefaultValue(true)] public bool Afterimages { get; set; } - private const int MinParticleLimit = 100; - private const int MaxParticleLimit = 2000; + private const int MinParticleLimit = 500; + private const int MaxParticleLimit = 10000; [BackgroundColor(192, 54, 64, 192)] [SliderColor(224, 165, 56, 128)] [Range(MinParticleLimit, MaxParticleLimit)] - [DefaultValue(500)] + [DefaultValue(5000)] public int ParticleLimit { get; set; } [BackgroundColor(192, 54, 64, 192)] diff --git a/CalamityLists.cs b/CalamityLists.cs index 01a26ecd5f..c00c19e251 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -101,7 +101,6 @@ namespace CalamityMod public static List revengeanceProjectileBuffList25Percent; public static List revengeanceProjectileBuffList20Percent; public static List revengeanceProjectileBuffList15Percent; - public static List revengeanceLifeStealExceptionList; public static List noRageWormSegmentList; public static List needsDebuffIconDisplayList; public static List scopedWeaponList; @@ -1510,36 +1509,6 @@ namespace CalamityMod ProjectileType() }; - revengeanceLifeStealExceptionList = new List() - { - NPCID.Probe, - NPCID.CultistDragonHead, - NPCID.CultistDragonBody1, - NPCID.CultistDragonBody2, - NPCID.CultistDragonBody3, - NPCID.CultistDragonBody4, - NPCID.CultistDragonTail, - NPCID.AncientCultistSquidhead, - NPCID.AncientLight, - NPCID.Sharkron, - NPCID.Sharkron2, - NPCID.PlanterasTentacle, - NPCType(), - NPCID.Spore, - NPCID.TheHungryII, - NPCID.LeechHead, - NPCID.LeechBody, - NPCID.LeechTail, - NPCID.QueenSlimeMinionBlue, - NPCID.QueenSlimeMinionPink, - NPCID.QueenSlimeMinionPurple, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.MoonLordCore - }; - noRageWormSegmentList = new List() { NPCType(), @@ -2297,6 +2266,22 @@ namespace CalamityMod ZeroContactDamageNPCList = new List { + NPCID.Harpy, + NPCID.Salamander, + NPCID.Salamander2, + NPCID.Salamander3, + NPCID.Salamander4, + NPCID.Salamander5, + NPCID.Salamander6, + NPCID.Salamander7, + NPCID.Salamander8, + NPCID.Salamander9, + NPCID.GiantCursedSkull, + NPCID.FungiBulb, + NPCID.GiantFungiBulb, + NPCID.IcyMerman, + NPCID.AngryNimbus, + NPCID.SandElemental, NPCID.DarkCaster, NPCID.FireImp, NPCID.Tim, @@ -2338,6 +2323,7 @@ namespace CalamityMod NPCID.ElfArcher, NPCID.NebulaBrain, NPCID.NebulaSoldier, + NPCID.StardustCellSmall, NPCID.StardustJellyfishBig, NPCID.StardustSoldier, NPCID.StardustSpiderBig, @@ -2361,6 +2347,21 @@ namespace CalamityMod NPCID.DD2DarkMageT3, NPCID.DD2OgreT2, NPCID.DD2OgreT3, + NPCID.DD2GoblinBomberT1, + NPCID.DD2GoblinBomberT2, + NPCID.DD2GoblinBomberT3, + NPCID.DD2JavelinstT1, + NPCID.DD2JavelinstT2, + NPCID.DD2JavelinstT3, + NPCID.DD2KoboldWalkerT2, + NPCID.DD2KoboldWalkerT3, + NPCID.DD2DrakinT2, + NPCID.DD2DrakinT3, + NPCID.DD2KoboldFlyerT2, + NPCID.DD2KoboldFlyerT3, + NPCID.DD2WitherBeastT2, + NPCID.DD2WitherBeastT3, + NPCID.DD2LightningBugT3, NPCID.MourningWood, NPCID.Pumpking, NPCID.Everscream, @@ -2431,27 +2432,20 @@ namespace CalamityMod NPCID.Derpling, NPCID.Herpling, NPCID.DiggerHead, - NPCID.DiggerBody, - NPCID.DiggerTail, NPCID.DesertGhoul, NPCID.DesertGhoulCorruption, NPCID.DesertGhoulCrimson, NPCID.DesertGhoulHallow, NPCID.DuneSplicerHead, - NPCID.DuneSplicerBody, - NPCID.DuneSplicerTail, NPCID.EnchantedSword, NPCID.FloatyGross, NPCID.GiantBat, NPCID.GiantFlyingFox, - NPCID.GiantFungiBulb, NPCID.FungiSpore, NPCID.GiantTortoise, NPCID.IceTortoise, NPCID.HoppinJack, NPCID.Mimic, - NPCID.IchorSticker, - NPCID.IcyMerman, NPCID.IlluminantBat, NPCID.IlluminantSlime, NPCID.JungleCreeper, @@ -2480,12 +2474,8 @@ namespace CalamityMod NPCID.Werewolf, NPCID.Wolf, NPCID.SeekerHead, - NPCID.SeekerBody, - NPCID.SeekerTail, NPCID.Wraith, NPCID.ChatteringTeethBomb, - NPCID.Clown, - NPCID.AngryNimbus, NPCID.IceGolem, NPCID.RainbowSlime, NPCID.SandShark, @@ -2506,8 +2496,6 @@ namespace CalamityMod NPCID.HellArmoredBonesSpikeShield, NPCID.HellArmoredBonesSword, NPCID.MisterStabby, - NPCID.SnowBalla, - NPCID.SnowmanGangsta, NPCID.Butcher, NPCID.CreatureFromTheDeep, NPCID.DeadlySphere, @@ -2544,8 +2532,6 @@ namespace CalamityMod NPCID.ZombieElfBeard, NPCID.ZombieElfGirl, NPCID.BloodEelHead, - NPCID.BloodEelBody, - NPCID.BloodEelTail, NPCID.GoblinShark, NPCID.EyeballFlyingFish, NPCID.ZombieMerman @@ -2795,7 +2781,6 @@ namespace CalamityMod revengeanceProjectileBuffList25Percent = null; revengeanceProjectileBuffList20Percent = null; revengeanceProjectileBuffList15Percent = null; - revengeanceLifeStealExceptionList = null; noRageWormSegmentList = null; needsDebuffIconDisplayList = null; scopedWeaponList = null; diff --git a/CalamityMod.cs b/CalamityMod.cs index 9e05a06d3c..0471d47842 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -108,18 +108,22 @@ namespace CalamityMod public static Texture2D SulphurSeaSkyFront; public static Texture2D SulphurSeaSurface; + //Destroyer glowmasks + public static Asset[] DestroyerGlowmasks = new Asset[3]; + // DR data structure public static SortedDictionary DRValues; // Boss Kill Time data structure public static SortedDictionary bossKillTimes; - // Life steal cap - public const int lifeStealCap = 10; - // Speedrun timer internal static Stopwatch SpeedrunTimer = new Stopwatch(); + // External flag to disable non-Revengeance boss AI edits + // This can be edited by other mods using reflection to prevent compatibility issues + public static bool ExternalFlag_DisableNonRevBossAI = false; + internal static CalamityMod Instance; // TODO -- Mod references should be contained in a ModSystem (example name "ModLoadedChecker") @@ -285,6 +289,11 @@ namespace CalamityMod SulphurSeaSkyFront = ModContent.Request("CalamityMod/Skies/SulphurSeaSkyFront", AssetRequestMode.ImmediateLoad).Value; SulphurSeaSurface = ModContent.Request("CalamityMod/Skies/SulphurSeaSurface", AssetRequestMode.ImmediateLoad).Value; + //Destroyer glowmasks + DestroyerGlowmasks[0] = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerHeadGlow", AssetRequestMode.AsyncLoad); + DestroyerGlowmasks[1] = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow", AssetRequestMode.AsyncLoad); + DestroyerGlowmasks[2] = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow", AssetRequestMode.AsyncLoad); + // TODO -- Sky shaders should probably be loaded in a ModSystem Filters.Scene["CalamityMod:DevourerofGodsHead"] = new Filter(new DoGScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:DevourerofGodsHead"] = new DoGSky(); @@ -301,7 +310,7 @@ namespace CalamityMod Filters.Scene["CalamityMod:Leviathan"] = new Filter(new LevScreenShaderData("FilterMiniTower").UseColor(0f, 0f, 0.5f).UseOpacity(0.5f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:Leviathan"] = new LevSky(); - Filters.Scene["CalamityMod:SupremeCalamitas"] = new Filter(new SCalScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.65f), EffectPriority.VeryHigh); + Filters.Scene["CalamityMod:SupremeCalamitas"] = new Filter(new SCalScreenShaderData("FilterMiniTower").UseColor(Color.Transparent).UseOpacity(0f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:SupremeCalamitas"] = new SCalSky(); Filters.Scene["CalamityMod:Signus"] = new Filter(new SignusScreenShaderData("FilterMiniTower").UseColor(0.35f, 0.1f, 0.55f).UseOpacity(0.35f), EffectPriority.VeryHigh); diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index 0741bbf23a..a75cbdfe5c 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -52,6 +52,19 @@ namespace CalamityMod // Syncs for specific bosses or entities // + case CalamityModMessageType.SyncDestroyerLaserColor: + byte npcIdx3 = reader.ReadByte(); + int laserColor = reader.ReadInt32(); + + // If the NPC in question isn't valid, don't do anything. + NPC npc3 = Main.npc[npcIdx3]; + if (!npc3.active) + break; + + CalamityGlobalNPC cgn3 = npc3.Calamity(); + cgn3.destroyerLaserColor = laserColor; + break; + // This code has been edited to fail gracefully when trying to provide data for an invalid NPC. case CalamityModMessageType.SyncCalamityNPCAIArray: // Read the entire packet regardless of anything @@ -72,6 +85,7 @@ namespace CalamityMod cgn.newAI[2] = ai2; cgn.newAI[3] = ai3; break; + case CalamityModMessageType.SyncVanillaNPCLocalAIArray: // Read the entire packet regardless of anything byte npcIdx2 = reader.ReadByte(); @@ -90,6 +104,7 @@ namespace CalamityMod npc2.localAI[2] = localAI2; npc2.localAI[3] = localAI3; break; + case CalamityModMessageType.SpawnSuperDummy: int x = reader.ReadInt32(); int y = reader.ReadInt32(); @@ -97,16 +112,19 @@ namespace CalamityMod if (Main.netMode != NetmodeID.MultiplayerClient) NPC.NewNPC(new EntitySource_WorldEvent(), x, y, ModContent.NPCType()); break; + case CalamityModMessageType.DeleteAllSuperDummies: if (Main.netMode != NetmodeID.MultiplayerClient) SuperDummy.DeleteDummies(); break; + case CalamityModMessageType.SyncAndroombaSolution: int index = reader.ReadInt32(); int solType = reader.ReadInt32(); if (Main.netMode != NetmodeID.MultiplayerClient) AndroombaFriendly.SwapSolution(index, solType); break; + case CalamityModMessageType.SyncAndroombaAI: { int idx = reader.ReadInt32(); @@ -115,6 +133,7 @@ namespace CalamityMod AndroombaFriendly.ChangeAI(idx, phase); } break; + case CalamityModMessageType.SyncSlabCrabAI: { int idx = reader.ReadInt32(); @@ -123,18 +142,22 @@ namespace CalamityMod AndroombaFriendly.ChangeAI(idx, phase); } break; + case CalamityModMessageType.ServersideSpawnOldDuke: byte playerIndex2 = reader.ReadByte(); CalamityUtils.SpawnOldDuke(playerIndex2); break; + case CalamityModMessageType.ArmoredDiggerCountdownSync: int countdown5 = reader.ReadInt32(); CalamityWorld.ArmoredDiggerSpawnCooldown = countdown5; break; + case CalamityModMessageType.ProvidenceDyeConditionSync: byte npcIndex3 = reader.ReadByte(); (Main.npc[npcIndex3].ModNPC as Providence).hasTakenDaytimeDamage = reader.ReadBoolean(); break; + case CalamityModMessageType.PSCChallengeSync: byte npcIndex4 = reader.ReadByte(); (Main.npc[npcIndex4].ModNPC as Providence).challenge = reader.ReadBoolean(); @@ -156,6 +179,7 @@ namespace CalamityMod NetMessage.SendData(MessageID.SyncNPC, -1, player, null, spawnedNPC); } break; + case CalamityModMessageType.SyncNPCMotionDataToServer: int npcIndex = reader.ReadInt32(); Vector2 center = reader.ReadVector2(); @@ -348,6 +372,7 @@ namespace CalamityMod SyncCooldownDictionary, // Syncs for specific bosses or entities + SyncDestroyerLaserColor, SyncCalamityNPCAIArray, SyncVanillaNPCLocalAIArray, SpawnSuperDummy, diff --git a/DataStructures/NPCStats.cs b/DataStructures/NPCStats.cs index 276fe80735..faf618f58e 100644 --- a/DataStructures/NPCStats.cs +++ b/DataStructures/NPCStats.cs @@ -182,8 +182,6 @@ namespace CalamityMod { NPCID.BrainofCthulhu, 0.9 }, - { NPCID.Deerclops, 1 }, - { ModContent.NPCType(), 0.9 }, { ModContent.NPCType(), 0.9 }, @@ -198,8 +196,6 @@ namespace CalamityMod { NPCID.WallofFlesh, 1.5 }, { NPCID.WallofFleshEye, 1.5 }, - { NPCID.QueenSlimeBoss, 1 }, - { ModContent.NPCType(), 1.15 }, { NPCID.Spazmatism, 0.85 }, @@ -298,51 +294,51 @@ namespace CalamityMod EnemyStats.ContactDamageValues = new SortedDictionary { - { NPCID.KingSlime, new int[] { 40, 64, 80, 88, 96 } }, + { NPCID.KingSlime, new int[] { 40, 64, 80, 96, 120 } }, - { ModContent.NPCType(), new int[] { 45, 66, 88, 99, 132 } }, - { ModContent.NPCType(), new int[] { 24, 32, 40, 44, 60 } }, - { ModContent.NPCType(), new int[] { 18, 24, 30, 32, 42 } }, - { ModContent.NPCType(), new int[] { 30, 44, 60, 70, 90 } }, - { ModContent.NPCType(), new int[] { 21, 28, 32, 36, 45 } }, - { ModContent.NPCType(), new int[] { 12, 16, 20, 24, 30 } }, + { ModContent.NPCType(), new int[] { 45, 66, 88, 110, 132 } }, + { ModContent.NPCType(), new int[] { 24, 32, 40, 48, 72 } }, + { ModContent.NPCType(), new int[] { 18, 24, 30, 36, 54 } }, + { ModContent.NPCType(), new int[] { 30, 44, 60, 76, 90 } }, + { ModContent.NPCType(), new int[] { 21, 28, 32, 36, 63 } }, + { ModContent.NPCType(), new int[] { 12, 16, 20, 24, 36 } }, { NPCID.EyeofCthulhu, new int[] { 24, // 36 in phase 2 30, // 45 in phase 2 40, // 48 in phase 2, 56 in phase 3 - 44, // 53 in phase 2, 62 in phase 3 - 50 } }, // Vanilla: 75 in phase 2; Rev+: 60 in phase 2, 70 in phase 3 - { NPCID.ServantofCthulhu, new int[] { 18, 24, 30, 34, 42 } }, + 50, // 60 in phase 2, 70 in phase 3 + 72 } }, // Vanilla: 108 in phase 2; Rev+: 86 in phase 2, 101 in phase 3 + { NPCID.ServantofCthulhu, new int[] { 18, 24, 30, 36, 54 } }, - { ModContent.NPCType(), new int[] { 40, 64, 80, 88, 120 } }, - { ModContent.NPCType(), new int[] { 25, 50, 62, 70, 75 } }, + { ModContent.NPCType(), new int[] { 40, 64, 80, 96, 120 } }, + { ModContent.NPCType(), new int[] { 25, 50, 62, 74, 75 } }, - { NPCID.EaterofWorldsHead, new int[] { 38, 55, 77, 88, 132 } }, + { NPCID.EaterofWorldsHead, new int[] { 38, 55, 77, 99, 132 } }, { NPCID.EaterofWorldsBody, new int[] { 18, 24, 32, 40, 60 } }, - { NPCID.EaterofWorldsTail, new int[] { 12, 16, 24, 32, 42 } }, + { NPCID.EaterofWorldsTail, new int[] { 12, 16, 24, 32, 36 } }, { NPCID.VileSpitEaterOfWorlds, new int[] { -1, 64, 64, 64, 96 } }, - { NPCID.BrainofCthulhu, new int[] { 36, 54, 81, 99, 135 } }, - { NPCID.Creeper, new int[] { 24, 36, 66, 80, 108 } }, + { NPCID.BrainofCthulhu, new int[] { 36, 54, 81, 108, 135 } }, + { NPCID.Creeper, new int[] { 24, 36, 66, 96, 120 } }, - { ModContent.NPCType(), new int[] { 42, 63, 81, 90, 135 } }, - { ModContent.NPCType(), new int[] { 30, 50, 62, 68, 90 } }, + { ModContent.NPCType(), new int[] { 42, 63, 81, 99, 135 } }, + { ModContent.NPCType(), new int[] { 30, 50, 62, 74, 90 } }, { ModContent.NPCType(), new int[] { 36, 54, 63, 72, 108 } }, - { ModContent.NPCType(), new int[] { 54, 90, 108, 118, 150 } }, - { ModContent.NPCType(), new int[] { 28, 48, 56, 60, 75 } }, - { ModContent.NPCType(), new int[] { 22, 36, 42, 46, 60 } }, - { ModContent.NPCType(), new int[] { 42, 70, 84, 92, 126 } }, - { ModContent.NPCType(), new int[] { 24, 42, 50, 54, 69 } }, - { ModContent.NPCType(), new int[] { 18, 28, 34, 38, 54 } }, - { ModContent.NPCType(), new int[] { 36, 60, 72, 80, 102 } }, - { ModContent.NPCType(), new int[] { 20, 36, 42, 46, 60 } }, - { ModContent.NPCType(), new int[] { 14, 20, 26, 30, 45 } }, + { ModContent.NPCType(), new int[] { 54, 90, 108, 126, 162 } }, + { ModContent.NPCType(), new int[] { 28, 48, 56, 64, 84 } }, + { ModContent.NPCType(), new int[] { 22, 36, 42, 48, 66 } }, + { ModContent.NPCType(), new int[] { 42, 70, 84, 98, 126 } }, + { ModContent.NPCType(), new int[] { 24, 42, 50, 58, 72 } }, + { ModContent.NPCType(), new int[] { 18, 28, 34, 40, 54 } }, + { ModContent.NPCType(), new int[] { 36, 60, 72, 84, 108 } }, + { ModContent.NPCType(), new int[] { 20, 36, 42, 48, 60 } }, + { ModContent.NPCType(), new int[] { 14, 20, 26, 32, 42 } }, - { NPCID.QueenBee, new int[] { 36, 54, 81, 99, 135 } }, - { NPCID.Bee, new int[] { 20, 24, 48, 60, 72 } }, - { NPCID.BeeSmall, new int[] { 15, 18, 30, 44, 54 } }, + { NPCID.QueenBee, new int[] { 36, 54, 81, 108, 135 } }, + { NPCID.Bee, new int[] { 20, 24, 48, 72, 90 } }, + { NPCID.BeeSmall, new int[] { 15, 18, 36, 54, 72 } }, { NPCID.SkeletronHead, new int[] { 42, // 55 while spinning @@ -350,38 +346,40 @@ namespace CalamityMod 88, // 114 while spinning 99, // 128 while spinning 132 } }, // 171 while spinning - { NPCID.SkeletronHand, new int[] { 32, 44, 77, 88, 110 } }, - { NPCID.ChaosBall, new int[] { -1, -1, -1, 40, 60 } }, + { NPCID.SkeletronHand, new int[] { 32, 44, 77, 110, 132 } }, - { NPCID.Deerclops, new int[] { 20, 40, 50, 60, 80 } }, + { NPCID.Deerclops, new int[] { 20, 40, 50, 60, 81 } }, - { ModContent.NPCType(), new int[] { 48, 80, 96, 104, 135 } }, - { ModContent.NPCType(), new int[] { 54, 90, 108, 118, 150 } }, - { ModContent.NPCType(), new int[] { 48, 80, 96, 104, 135 } }, - { ModContent.NPCType(), new int[] { 60, 100, 120, 130, 171 } }, - { ModContent.NPCType(), new int[] { 54, 90, 108, 118, 150 } }, - { ModContent.NPCType(), new int[] { 36, 60, 72, 78, 99 } }, - { ModContent.NPCType(), new int[] { 24, 40, 48, 52, 66 } }, - { ModContent.NPCType(), new int[] { 42, 70, 84, 92, 120 } }, - { ModContent.NPCType(), new int[] { 30, 50, 60, 66, 84 } }, + { ModContent.NPCType(), new int[] { 48, 80, 96, 112, 144 } }, + { ModContent.NPCType(), new int[] { 54, 90, 108, 126, 162 } }, + { ModContent.NPCType(), new int[] { 48, 80, 96, 112, 144 } }, + { ModContent.NPCType(), new int[] { 60, 100, 120, 140, 180 } }, + { ModContent.NPCType(), new int[] { 54, 90, 108, 126, 162 } }, + { ModContent.NPCType(), new int[] { 36, 60, 72, 84, 108 } }, + { ModContent.NPCType(), new int[] { 24, 40, 48, 56, 72 } }, + { ModContent.NPCType(), new int[] { 42, 70, 84, 98, 126 } }, + { ModContent.NPCType(), new int[] { 30, 50, 60, 70, 90 } }, - { NPCID.WallofFlesh, new int[] { 100, 150, 180, 195, 225 } }, - { NPCID.WallofFleshEye, new int[] { 100, 150, 180, 195, 225 } }, + { NPCID.WallofFlesh, new int[] { 100, 150, 180, 210, 270 } }, + { NPCID.WallofFleshEye, new int[] { 100, 150, 180, 210, 270 } }, { NPCID.TheHungry, new int[] { 30, // Ranges from 30 to 75 depending on WoF life 60, // Ranges from 60 to 150 depending on WoF life 60, // Ranges from 60 to 150 depending on WoF life 60, // Ranges from 60 to 150 depending on WoF life 90 } }, // Ranges from 90 to 225 depending on WoF life - { NPCID.TheHungryII, new int[] { 30, 60, 74, 80, 90 } }, - { NPCID.LeechHead, new int[] { 26, 52, 62, 68, 78 } }, - { NPCID.LeechBody, new int[] { 22, 44, 52, 56, 66 } }, - { NPCID.LeechTail, new int[] { 18, 36, 42, 44, 54 } }, + { NPCID.TheHungryII, new int[] { 30, 60, 74, 88, 108 } }, + { NPCID.LeechHead, new int[] { 26, 52, 62, 72, 90 } }, + { NPCID.LeechBody, new int[] { 22, 44, 52, 60, 78 } }, + { NPCID.LeechTail, new int[] { 18, 36, 42, 48, 66 } }, - { NPCID.QueenSlimeBoss, new int[] { 80, 120, 150, 170, 240 } }, + { NPCID.QueenSlimeBoss, new int[] { 80, 120, 150, 180, 240 } }, + { NPCID.QueenSlimeMinionBlue, new int[] { 60, 80, 100, 120, 180 } }, + { NPCID.QueenSlimeMinionPink, new int[] { 60, 80, 100, 120, 180 } }, + { NPCID.QueenSlimeMinionPurple, new int[] { 70, 100, 120, 140, 210 } }, { ModContent.NPCType(), new int[] { 90, 138, 161, 184, 276 } }, - { ModContent.NPCType(), new int[] { 80, 120, 138, 158, 216 } }, + { ModContent.NPCType(), new int[] { 80, 120, 138, 156, 240 } }, { NPCID.Spazmatism, new int[] { 70, // 105 in phase 2 @@ -396,16 +394,16 @@ namespace CalamityMod 119, // 178 in phase 2 153 } }, // 229 in phase 2 - { ModContent.NPCType(), new int[] { 110, 176, 187, 198, 264 } }, - { ModContent.NPCType(), new int[] { 75, 112, 136, 144, 180 } }, - { ModContent.NPCType(), new int[] { 70, 104, 112, 136, 168 } }, - { ModContent.NPCType(), new int[] { 65, 96, 104, 112, 156 } }, + { ModContent.NPCType(), new int[] { 110, 176, 187, 198, 330 } }, + { ModContent.NPCType(), new int[] { 75, 112, 136, 160, 216 } }, + { ModContent.NPCType(), new int[] { 70, 104, 112, 120, 192 } }, + { ModContent.NPCType(), new int[] { 65, 96, 104, 112, 168 } }, { NPCID.TheDestroyer, new int[] { 140, 280, 300, 320, 420 } }, - { NPCID.TheDestroyerBody, new int[] { 70, 102, 136, 153, 204 } }, - { NPCID.TheDestroyerTail, new int[] { 45, 68, 102, 136, 153 } }, + { NPCID.TheDestroyerBody, new int[] { 70, 102, 136, 170, 255 } }, + { NPCID.TheDestroyerTail, new int[] { 45, 68, 102, 136, 204 } }, - { ModContent.NPCType(), new int[] { 75, 112, 136, 144, 180 } }, + { ModContent.NPCType(), new int[] { 75, 112, 136, 160, 216 } }, { NPCID.SkeletronPrime, new int[] { 50, // 100 while spinning @@ -419,431 +417,435 @@ namespace CalamityMod 102, // 204 while spinning 119, // 238 while spinning 153 } }, // 306 while spinning - { NPCID.PrimeVice, new int[] { 70, 102, 136, 153, 204 } }, - { NPCID.PrimeSaw, new int[] { 70, 102, 136, 153, 204 } }, + { NPCID.PrimeVice, new int[] { 70, 102, 136, 170, 255 } }, + { NPCID.PrimeSaw, new int[] { 70, 102, 136, 170, 255 } }, { NPCID.PrimeCannon, new int[] { 30, 51, 68, 85, 102 } }, { NPCID.PrimeLaser, new int[] { 30, 51, 68, 85, 102 } }, - { ModContent.NPCType(), new int[] { 95, 144, 168, 176, 240 } }, - { ModContent.NPCType(), new int[] { 80, 120, 138, 148, 198 } }, - { ModContent.NPCType(), new int[] { 85, 130, 150, 162, 216 } }, + { ModContent.NPCType(), new int[] { 95, 144, 168, 192, 276 } }, + { ModContent.NPCType(), new int[] { 80, 120, 138, 156, 240 } }, + { ModContent.NPCType(), new int[] { 85, 130, 150, 170, 255 } }, { NPCID.Plantera, new int[] { 70, // 98 in phase 2 100, // 140 in phase 2 138, // 193 in phase 2 - 161, // 225 in phase 2 - 207 } }, // 150 in phase 1 and 210 in phase 2; Rev and Death: 289 in phase 2 - { NPCID.PlanterasTentacle, new int[] { 90, 138, 161, 207, 276 } }, - { ModContent.NPCType(), new int[] { 90, 138, 161, 207, 276 } }, - { NPCID.Spore, new int[] { 90, 140, 160, 170, 210 } }, + 176, // 246 in phase 2 + 207 } }, // 290 in phase 2 + { NPCID.PlanterasTentacle, new int[] { 90, 138, 161, 184, 276 } }, + { ModContent.NPCType(), new int[] { 90, 138, 161, 184, 276 } }, + { NPCID.Spore, new int[] { 90, 140, 160, 180, 270 } }, { NPCID.HallowBoss, new int[] { 80, // 120 during charge 110, // 165 during charge - 143, // 214 during charge - 154, // 231 during charge - 198 } }, // 297 during charge + 143, // 215 during charge + 176, // 264 during charge + 231 } }, // 347 during charge - { ModContent.NPCType(), new int[] { 140, 216, 240, 252, 324 } }, + { ModContent.NPCType(), new int[] { 140, 216, 240, 264, 414 } }, { ModContent.NPCType(), new int[] { 75, // 113 during charge 112, // 168 during charge 136, // 204 during charge - 144, // 216 during charge - 192 } }, // 288 during charge - { ModContent.NPCType(), new int[] { 70, 110, 126, 136, 165 } }, - { NPCID.DetonatingBubble, new int[] { 100, 150, 180, 195, 225 } }, - { ModContent.NPCType(), new int[] { 90, 140, 160, 170, 210 } }, + 160, // 240 during charge + 216 } }, // 324 during charge + { ModContent.NPCType(), new int[] { 70, 110, 126, 142, 210 } }, + { NPCID.DetonatingBubble, new int[] { 100, 150, 180, 210, 270 } }, + { ModContent.NPCType(), new int[] { 90, 140, 160, 180, 270 } }, - { ModContent.NPCType(), new int[] { 145, 220, 242, 253, 330 } }, - { ModContent.NPCType(), new int[] { 75, 112, 128, 138, 180 } }, + { ModContent.NPCType(), new int[] { 145, 220, 242, 264, 429 } }, + { ModContent.NPCType(), new int[] { 75, 112, 128, 144, 225 } }, - { NPCID.Golem, new int[] { 95, 144, 176, 192, 240 } }, - { NPCID.GolemHead, new int[] { 85, 128, 144, 160, 192 } }, - { NPCID.GolemFistLeft, new int[] { 75, 112, 144, 160, 180 } }, - { NPCID.GolemFistRight, new int[] { 75, 112, 144, 160, 180 } }, + { NPCID.Golem, new int[] { 95, 144, 176, 208, 264 } }, + { NPCID.GolemHead, new int[] { 85, 128, 144, 160, 228 } }, + { NPCID.GolemFistLeft, new int[] { 75, 112, 144, 176, 240 } }, + { NPCID.GolemFistRight, new int[] { 75, 112, 144, 176, 240 } }, - { ModContent.NPCType(), new int[] { 120, 180, 216, 234, 297 } }, - { ModContent.NPCType(), new int[] { 120, 180, 210, 224, 270 } }, - { ModContent.NPCType(), new int[] { 130, 200, 240, 260, 330 } }, + { ModContent.NPCType(), new int[] { 120, 180, 216, 252, 351 } }, + { ModContent.NPCType(), new int[] { 120, 180, 210, 240, 360 } }, + { ModContent.NPCType(), new int[] { 130, 200, 240, 280, 390 } }, { NPCID.DukeFishron, new int[] { 100, // 120 in phase 2 - 140, // 201 in phase 2, 184 in phase 3 - 168, // 241 in phase 2, 221 in phase 3 - 182, // 262 in phase 2, 240 in phase 3 - 210 } }, // 302 in phase 2, 277 in phase 3 - { NPCID.Sharkron, new int[] { 100, 150, 180, 195, 225 } }, - { NPCID.Sharkron2, new int[] { 120, 180, 210, 225, 270 } }, + 140, // 202 in phase 2, 185 in phase 3 + 168, // 242 in phase 2, 222 in phase 3 + 196, // 282 in phase 2, 259 in phase 3 + 252 } }, // 363 in phase 2, 333 in phase 3 + { NPCID.Sharkron, new int[] { 100, 150, 180, 210, 270 } }, + { NPCID.Sharkron2, new int[] { 120, 180, 210, 240, 315 } }, - { ModContent.NPCType(), new int[] { 130, 192, 224, 232, 288 } }, - { ModContent.NPCType(), new int[] { 105, 160, 180, 200, 240 } }, - { ModContent.NPCType(), new int[] { 105, 160, 180, 200, 240 } }, - { ModContent.NPCType(), new int[] { 130, 192, 224, 232, 288 } }, - { ModContent.NPCType(), new int[] { 105, 160, 192, 200, 216 } }, + { ModContent.NPCType(), new int[] { 130, 192, 224, 256, 384 } }, + { ModContent.NPCType(), new int[] { 105, 160, 180, 200, 315 } }, + { ModContent.NPCType(), new int[] { 105, 160, 180, 200, 315 } }, + { ModContent.NPCType(), new int[] { 130, 192, 224, 256, 390 } }, + { ModContent.NPCType(), new int[] { 105, 160, 192, 224, 315 } }, - { NPCID.CultistDragonHead, new int[] { 120, 180, 210, 225, 270 } }, - { NPCID.CultistDragonBody1, new int[] { 60, 90, 105, 120, 135 } }, - { NPCID.CultistDragonBody2, new int[] { 60, 90, 105, 120, 135 } }, - { NPCID.CultistDragonBody3, new int[] { 60, 90, 105, 120, 135 } }, - { NPCID.CultistDragonBody4, new int[] { 60, 90, 105, 120, 135 } }, - { NPCID.CultistDragonTail, new int[] { 60, 90, 105, 120, 135 } }, - { NPCID.AncientCultistSquidhead, new int[] { 120, 180, 210, 225, 270 } }, - { NPCID.AncientLight, new int[] { 120, 180, 210, 225, 270 } }, + { NPCID.CultistDragonHead, new int[] { 120, 180, 210, 240, 360 } }, + { NPCID.CultistDragonBody1, new int[] { 60, 90, 105, 120, 180 } }, + { NPCID.CultistDragonBody2, new int[] { 60, 90, 105, 120, 180 } }, + { NPCID.CultistDragonBody3, new int[] { 60, 90, 105, 120, 180 } }, + { NPCID.CultistDragonBody4, new int[] { 60, 90, 105, 120, 180 } }, + { NPCID.CultistDragonTail, new int[] { 60, 90, 105, 120, 180 } }, + { NPCID.AncientCultistSquidhead, new int[] { 120, 180, 210, 240, 360 } }, + { NPCID.AncientLight, new int[] { 120, 180, 210, 240, 360 } }, - { ModContent.NPCType(), new int[] { 160, 240, 268, 280, 360 } }, - { ModContent.NPCType(), new int[] { 105, 160, 192, 200, 240 } }, - { ModContent.NPCType(), new int[] { 85, 128, 160, 168, 192 } }, + { ModContent.NPCType(), new int[] { 160, 240, 268, 296, 480 } }, + { ModContent.NPCType(), new int[] { 105, 160, 192, 224, 312 } }, + { ModContent.NPCType(), new int[] { 85, 128, 160, 192, 252 } }, - { ModContent.NPCType(), new int[] { 150, 224, 256, 280, 336 } }, - { ModContent.NPCType(), new int[] { 160, 240, 264, 278, 336 } }, - { ModContent.NPCType(), new int[] { 100, 200, 220, 232, 270 } }, + { ModContent.NPCType(), new int[] { 150, 224, 256, 288, 444 } }, + { ModContent.NPCType(), new int[] { 160, 240, 264, 288, 405 } }, + { ModContent.NPCType(), new int[] { 100, 200, 220, 240, 300 } }, - { ModContent.NPCType(), new int[] { 170, 256, 288, 304, 384 } }, - { ModContent.NPCType(), new int[] { 145, 220, 242, 256, 330 } }, + { ModContent.NPCType(), new int[] { 170, 256, 288, 320, 504 } }, + { ModContent.NPCType(), new int[] { 145, 220, 242, 264, 435 } }, - { ModContent.NPCType(), new int[] { 120, 240, 264, 278, 336 } }, - { ModContent.NPCType(), new int[] { 100, 200, 220, 232, 270 } }, - { ModContent.NPCType(), new int[] { 100, 200, 220, 232, 270 } }, + { ModContent.NPCType(), new int[] { 120, 240, 264, 278, 360 } }, + { ModContent.NPCType(), new int[] { 100, 200, 220, 232, 300 } }, + { ModContent.NPCType(), new int[] { 100, 200, 220, 232, 300 } }, - { ModContent.NPCType(), new int[] { 240, 360, 396, 418, 540 } }, - { ModContent.NPCType(), new int[] { 175, 260, 288, 304, 390 } }, + { ModContent.NPCType(), new int[] { 240, 360, 396, 432, 720 } }, + { ModContent.NPCType(), new int[] { 175, 260, 288, 316, 525 } }, - { ModContent.NPCType(), new int[] { 240, 360, 396, 418, 540 } }, - { ModContent.NPCType(), new int[] { 125, 192, 224, 250, 330 } }, - { ModContent.NPCType(), new int[] { 105, 160, 192, 210, 270 } }, + { ModContent.NPCType(), new int[] { 240, 360, 396, 432, 720 } }, + { ModContent.NPCType(), new int[] { 125, 192, 224, 256, 372 } }, + { ModContent.NPCType(), new int[] { 105, 160, 192, 224, 312 } }, - { ModContent.NPCType(), new int[] { 210, 315, 351, 369, 459 } }, - { ModContent.NPCType(), new int[] { 175, 260, 288, 304, 390 } }, - { ModContent.NPCType(), new int[] { 190, 280, 300, 320, 390 } }, + { ModContent.NPCType(), new int[] { 210, 315, 351, 387, 621 } }, + { ModContent.NPCType(), new int[] { 175, 260, 288, 316, 525 } }, + { ModContent.NPCType(), new int[] { 190, 280, 300, 320, 570 } }, { ModContent.NPCType(), new int[] { 160, // 192 in phase 2, 224 in phase 3 240, // 288 in phase 2, 336 in phase 3 - 264, // 316 in phase 2, 369 in phase 3 - 280, // 336 in phase 2, 392 in phase 3 - 384 } }, // 460 in phase 2, 537 in phase 3 - { ModContent.NPCType(), new int[] { 224, 336, 360, 392, 528 } }, + 264, // 317 in phase 2, 370 in phase 3 + 288, // 346 in phase 2, 403 in phase 3 + 480 } }, // 576 in phase 2, 672 in phase 3 + { ModContent.NPCType(), new int[] { 224, 336, 370, 403, 672 } }, { ModContent.NPCType(), new int[] { 192, // 211 in phase 2, 230 in phase 3 - 288, // 316 in phase 2, 345 in phase 3 - 324, // 356 in phase 2, 388 in phase 3 - 342, // 376 in phase 2, 410 in phase 3 - 432 } }, // 475 in phase 2, 518 in phase 3 - { ModContent.NPCType(), new int[] { 192, 288, 328, 344, 432 } }, - { ModContent.NPCType(), new int[] { 192, 288, 328, 344, 432 } }, + 288, // 317 in phase 2, 346 in phase 3 + 324, // 356 in phase 2, 389 in phase 3 + 360, // 396 in phase 2, 432 in phase 3 + 567 } }, // 624 in phase 2, 680 in phase 3 + { ModContent.NPCType(), new int[] { 192, 288, 328, 368, 576 } }, + { ModContent.NPCType(), new int[] { 192, 288, 328, 368, 576 } }, - { ModContent.NPCType(), new int[] { 470, 700, 750, 780, 880 } }, - { ModContent.NPCType(), new int[] { 250, 374, 425, 442, 561 } }, - { ModContent.NPCType(), new int[] { 204, 306, 340, 357, 459 } }, - { ModContent.NPCType(), new int[] { 240, 360, 396, 420, 510 } }, - { ModContent.NPCType(), new int[] { 175, 260, 290, 320, 420 } }, - { ModContent.NPCType(), new int[] { 135, 200, 230, 260, 330 } }, + { ModContent.NPCType(), new int[] { 470, 700, 750, 800, 1410 } }, + { ModContent.NPCType(), new int[] { 250, 374, 425, 476, 714 } }, + { ModContent.NPCType(), new int[] { 204, 306, 340, 374, 612 } }, + { ModContent.NPCType(), new int[] { 240, 360, 396, 432, 720 } }, + { ModContent.NPCType(), new int[] { 175, 260, 290, 320, 525 } }, + { ModContent.NPCType(), new int[] { 135, 200, 230, 260, 405 } }, - { ModContent.NPCType(), new int[] { 300, 448, 480, 512, 624 } }, + { ModContent.NPCType(), new int[] { 300, 448, 480, 512, 900 } }, - { ModContent.NPCType(), new int[] { 340, 512, 544, 560, 696 } }, + { ModContent.NPCType(), new int[] { 340, 512, 544, 576, 1020 } }, - { ModContent.NPCType(), new int[] { 340, 512, 544, 560, 696 } }, - { ModContent.NPCType(), new int[] { 320, 480, 512, 528, 660 } }, + { ModContent.NPCType(), new int[] { 340, 512, 544, 576, 1020 } }, + { ModContent.NPCType(), new int[] { 320, 480, 512, 544, 960 } }, - { ModContent.NPCType(), new int[] { 375, 560, 592, 608, 756 } }, - { ModContent.NPCType(), new int[] { 320, 480, 512, 528, 660 } }, - { ModContent.NPCType(), new int[] { 320, 480, 512, 528, 660 } }, - { ModContent.NPCType(), new int[] { 270, 400, 424, 440, 552 } }, + { ModContent.NPCType(), new int[] { 375, 560, 592, 624, 1116 } }, + { ModContent.NPCType(), new int[] { 320, 480, 512, 544, 960 } }, + { ModContent.NPCType(), new int[] { 320, 480, 512, 544, 960 } }, + { ModContent.NPCType(), new int[] { 270, 400, 424, 448, 804 } }, - { ModContent.NPCType(), new int[] { 535, 800, 850, 880, 1000 } } + { ModContent.NPCType(), new int[] { 535, 800, 850, 900, 1596 } } }; EnemyStats.ProjectileDamageValues = new SortedDictionary, int[]> { - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 0, 0, 44, 48, 66 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 36, 44, 52, 84 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 44, 60, 68, 90 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 44, 60, 68, 90 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 44, 60, 76, 108 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 44, 60, 76, 108 } }, - { new Tuple(NPCID.EyeofCthulhu, ProjectileID.BloodNautilusShot), new int[] { 0, 0, 60, 68, 90 } }, + { new Tuple(NPCID.EyeofCthulhu, ProjectileID.BloodNautilusShot), new int[] { 26, 44, 60, 76, 108 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 68, 90 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 68, 90 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 72, 96 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 72, 96 } }, - { new Tuple(NPCID.EaterofWorldsHead, ProjectileID.CursedFlameHostile), new int[] { 0, 0, 60, 68, 90 } }, - { new Tuple(NPCID.EaterofWorldsHead, ModContent.ProjectileType()), new int[] { 0, 0, 0, 48, 66 } }, + { new Tuple(NPCID.EaterofWorldsHead, ProjectileID.CursedFlameHostile), new int[] { 26, 44, 60, 76, 108 } }, + { new Tuple(NPCID.EaterofWorldsHead, ModContent.ProjectileType()), new int[] { 26, 36, 44, 52, 84 } }, - { new Tuple(NPCID.BrainofCthulhu, ProjectileID.BloodNautilusShot), new int[] { 0, 0, 68, 76, 102 } }, - { new Tuple(NPCID.BrainofCthulhu, ProjectileID.BloodShot), new int[] { 0, 0, 60, 68, 90 } }, - { new Tuple(NPCID.Creeper, ProjectileID.BloodShot), new int[] { 0, 0, 60, 68, 90 } }, + { new Tuple(NPCID.BrainofCthulhu, ProjectileID.BloodNautilusShot), new int[] { 36, 56, 68, 80, 114 } }, + { new Tuple(NPCID.BrainofCthulhu, ProjectileID.BloodShot), new int[] { 26, 44, 60, 76, 108 } }, + { new Tuple(NPCID.Creeper, ProjectileID.BloodShot), new int[] { 26, 44, 60, 76, 108 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 30, 48, 60, 68, 90 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 30, 48, 60, 68, 90 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 114 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 114 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 114 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 30, 48, 60, 72, 96 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 30, 48, 60, 72, 96 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 22, 36, 44, 48, 66 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 114 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 114 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 114 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 114 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 114 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 114 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 22, 36, 44, 52, 84 } }, - { new Tuple(NPCID.QueenBee, ProjectileID.QueenBeeStinger), new int[] { 22, 44, 64, 72, 96 } }, + { new Tuple(NPCID.QueenBee, ProjectileID.QueenBeeStinger), new int[] { 22, 44, 64, 84, 120 } }, - { new Tuple(NPCID.SkeletronHead, ProjectileID.Skull), new int[] { 46, 68, 84, 92, 126 } }, - { new Tuple(NPCID.SkeletronHead, ProjectileID.Shadowflames), new int[] { 0, 0, 88, 96, 132 } }, - { new Tuple(NPCID.SkeletronHand, ProjectileID.Skull), new int[] { 0, 0, 68, 76, 102 } }, + { new Tuple(NPCID.SkeletronHead, ProjectileID.Skull), new int[] { 46, 72, 84, 96, 138 } }, + { new Tuple(NPCID.SkeletronHead, ProjectileID.Shadowflames), new int[] { 36, 72, 88, 104, 150 } }, + { new Tuple(NPCID.SkeletronHand, ProjectileID.Skull), new int[] { 36, 56, 68, 80, 114 } }, - { new Tuple(NPCID.Deerclops, ProjectileID.DeerclopsIceSpike), new int[] { 26, 52, 76, 84, 114 } }, - { new Tuple(NPCID.Deerclops, ProjectileID.DeerclopsRangedProjectile), new int[] { 36, 72, 88, 96, 132 } }, - { new Tuple(NPCID.Deerclops, ProjectileID.InsanityShadowHostile), new int[] { 20, 40, 60, 68, 90 } }, + { new Tuple(NPCID.Deerclops, ProjectileID.DeerclopsIceSpike), new int[] { 26, 52, 76, 100, 138 } }, + { new Tuple(NPCID.Deerclops, ProjectileID.DeerclopsRangedProjectile), new int[] { 36, 72, 88, 104, 150 } }, + { new Tuple(NPCID.Deerclops, ProjectileID.InsanityShadowHostile), new int[] { 20, 40, 60, 80, 114 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 42, 68, 84, 92, 126 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 84, 114 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 42, 68, 84, 92, 126 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 84, 114 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 84, 114 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 34, 52, 68, 74, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 24, 48, 60, 68, 90 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 42, 68, 84, 100, 138 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 92, 126 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 42, 68, 84, 100, 138 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 92, 126 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 92, 126 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 34, 52, 68, 80, 114 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 114 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 24, 48, 60, 72, 96 } }, - { new Tuple(NPCID.WallofFleshEye, ProjectileID.EyeLaser), new int[] { 26, 52, 68, 76, 102 } }, - { new Tuple(NPCID.WallofFleshEye, ProjectileID.DeathLaser), new int[] { 0, 0, 88, 96, 132 } }, - { new Tuple(NPCID.WallofFlesh, ProjectileID.DemonSickle), new int[] { 0, 0, 112, 124, 168 } }, + { new Tuple(NPCID.WallofFleshEye, ProjectileID.EyeLaser), new int[] { 26, 52, 68, 80, 114 } }, + { new Tuple(NPCID.WallofFleshEye, ProjectileID.DeathLaser), new int[] { 36, 72, 88, 104, 150 } }, + { new Tuple(NPCID.WallofFlesh, ProjectileID.DemonSickle), new int[] { 52, 92, 112, 132, 168 } }, + { new Tuple(NPCID.WallofFlesh, ProjectileID.Fireball), new int[] { 36, 72, 88, 104, 150 } }, { new Tuple(NPCID.QueenSlimeBoss, ProjectileID.QueenSlimeGelAttack), new int[] { 60, 120, 136, 152, 210 } }, - { new Tuple(NPCID.QueenSlimeBoss, ProjectileID.QueenSlimeSmash), new int[] { 80, 160, 188, 200, 270 } }, - { new Tuple(NPCID.QueenSlimeBoss, ProjectileID.QueenSlimeMinionBlueSpike), new int[] { 0, 0, 112, 124, 168 } }, + { new Tuple(NPCID.QueenSlimeBoss, ProjectileID.QueenSlimeSmash), new int[] { 80, 160, 188, 216, 270 } }, + { new Tuple(NPCID.QueenSlimeBoss, ProjectileID.QueenSlimeMinionBlueSpike), new int[] { 52, 92, 112, 132, 168 } }, + { new Tuple(NPCID.QueenSlimeMinionBlue, ProjectileID.QueenSlimeMinionBlueSpike), new int[] { 52, 92, 112, 132, 168 } }, + { new Tuple(NPCID.QueenSlimeMinionPink, ProjectileID.QueenSlimeMinionPinkBall), new int[] { 52, 92, 112, 132, 168 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 52, 92, 112, 124, 168 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 52, 92, 112, 132, 168 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 120, 136, 152, 210 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 100, 120, 132, 180 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 52, 92, 112, 124, 168 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 100, 120, 140, 180 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 52, 92, 112, 132, 168 } }, - { new Tuple(NPCID.Retinazer, ProjectileID.EyeLaser), new int[] { 40, 76, 116, 128, 174 } }, + { new Tuple(NPCID.Retinazer, ProjectileID.EyeLaser), new int[] { 40, 92, 116, 140, 174 } }, { new Tuple(NPCID.Retinazer, ProjectileID.DeathLaser), new int[] { 50, // 38 in rapid fire - 92, // 69 in rapid fire - 124, // 93 in rapid fire - 136, // 102 in rapid fire - 186 } }, // 139 in rapid fire; 138 in non-rev master mode, 102 in rapid fire in non-rev master mode + 108, // 81 in rapid fire + 132, // 99 in rapid fire + 156, // 117 in rapid fire + 186 } }, // 139 in rapid fire { new Tuple(NPCID.Retinazer, ModContent.ProjectileType()), new int[] { 70, 120, 136, 152, 210 } }, - { new Tuple(NPCID.Spazmatism, ProjectileID.CursedFlameHostile), new int[] { 50, 88, 120, 132, 180 } }, - { new Tuple(NPCID.Spazmatism, ProjectileID.EyeFire), new int[] { 60, 108, 128, 140, 192 } }, - { new Tuple(NPCID.Spazmatism, ModContent.ProjectileType()), new int[] { 70, 120, 148, 160, 222 } }, - { new Tuple(NPCID.Spazmatism, ModContent.ProjectileType()), new int[] { 60, 100, 128, 140, 192 } }, + { new Tuple(NPCID.Spazmatism, ProjectileID.CursedFlameHostile), new int[] { 50, 100, 120, 140, 180 } }, + { new Tuple(NPCID.Spazmatism, ProjectileID.EyeFire), new int[] { 60, 120, 148, 176, 222 } }, + { new Tuple(NPCID.Spazmatism, ModContent.ProjectileType()), new int[] { 70, 120, 148, 176, 222 } }, + { new Tuple(NPCID.Spazmatism, ModContent.ProjectileType()), new int[] { 60, 100, 128, 156, 192 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 100, 120, 132, 180 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 100, 120, 140, 180 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 120, 136, 152, 210 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 66, 112, 128, 140, 192 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 240 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 66, 112, 128, 144, 198 } }, - { new Tuple(NPCID.TheDestroyer, ProjectileID.DeathLaser), new int[] { 0, 0, 0, 152, 210 } }, - { new Tuple(NPCID.TheDestroyerBody, ProjectileID.DeathLaser), new int[] { 44, 72, 116, 128, 174 } }, - { new Tuple(NPCID.TheDestroyerBody, ModContent.ProjectileType()), new int[] { 46, 76, 128, 140, 186 } }, - { new Tuple(NPCID.TheDestroyerBody, ModContent.ProjectileType()), new int[] { 48, 80, 136, 152, 210 } }, - { new Tuple(NPCID.TheDestroyerBody, ProjectileID.EyeLaser), new int[] { 40, 68, 100, 112, 144 } }, - { new Tuple(NPCID.Probe, ProjectileID.PinkLaser), new int[] { 50, 88, 100, 112, 144 } }, + { new Tuple(NPCID.TheDestroyer, ProjectileID.DeathLaser), new int[] { 44, 96, 116, 136, 174 } }, + { new Tuple(NPCID.TheDestroyer, ModContent.ProjectileType()), new int[] { 46, 108, 128, 148, 192 } }, + { new Tuple(NPCID.TheDestroyer, ModContent.ProjectileType()), new int[] { 48, 116, 136, 156, 210 } }, + { new Tuple(NPCID.TheDestroyerBody, ProjectileID.DeathLaser), new int[] { 44, 96, 116, 136, 174 } }, + { new Tuple(NPCID.TheDestroyerBody, ModContent.ProjectileType()), new int[] { 46, 108, 128, 148, 192 } }, + { new Tuple(NPCID.TheDestroyerBody, ModContent.ProjectileType()), new int[] { 48, 116, 136, 156, 210 } }, + { new Tuple(NPCID.Probe, ProjectileID.PinkLaser), new int[] { 50, 88, 100, 112, 162 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 140, 192 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 200, 240, 252, 342 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 140, 192 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 240 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 144, 210 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 240 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 200, 240, 280, 360 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 240 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 144, 210 } }, - { new Tuple(NPCID.SkeletronPrime, ProjectileID.Skull), new int[] { 50, 100, 124, 136, 186 } }, - { new Tuple(NPCID.SkeletronPrime, ProjectileID.DeathLaser), new int[] { 50, 100, 124, 136, 186 } }, - { new Tuple(NPCID.SkeletronPrime, ProjectileID.RocketSkeleton), new int[] { 60, 120, 148, 160, 222 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.Skull), new int[] { 50, 100, 124, 136, 186 } }, + { new Tuple(NPCID.SkeletronPrime, ProjectileID.Skull), new int[] { 50, 108, 124, 140, 186 } }, + { new Tuple(NPCID.SkeletronPrime, ProjectileID.DeathLaser), new int[] { 50, 108, 124, 140, 186 } }, + { new Tuple(NPCID.SkeletronPrime, ProjectileID.RocketSkeleton), new int[] { 60, 120, 148, 176, 222 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.Skull), new int[] { 50, 108, 124, 140, 186 } }, { new Tuple(ModContent.NPCType(), ProjectileID.BombSkeletronPrime), new int[] { 80, 160, 180, 200, 240 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.FrostBeam), new int[] { 50, 100, 124, 136, 186 } }, - { new Tuple(NPCID.PrimeCannon, ProjectileID.RocketSkeleton), new int[] { 60, 120, 148, 160, 222 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.FrostBeam), new int[] { 50, 108, 124, 140, 186 } }, + { new Tuple(NPCID.PrimeCannon, ProjectileID.RocketSkeleton), new int[] { 60, 120, 148, 176, 222 } }, { new Tuple(NPCID.PrimeCannon, ProjectileID.BombSkeletronPrime), new int[] { 80, 160, 0, 0, 240 } }, - { new Tuple(NPCID.PrimeLaser, ProjectileID.DeathLaser), new int[] { 50, 100, 124, 136, 186 } }, + { new Tuple(NPCID.PrimeLaser, ProjectileID.DeathLaser), new int[] { 50, 108, 124, 140, 186 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 140, 192 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 140, 192 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 140, 192 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 240 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 240 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 240 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 240 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 144, 210 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 240 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 144, 210 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 144, 210 } }, - { new Tuple(NPCID.Plantera, ProjectileID.SeedPlantera), new int[] { 44, 76, 128, 140, 186 } }, - { new Tuple(NPCID.Plantera, ProjectileID.PoisonSeedPlantera), new int[] { 54, 96, 136, 152, 210 } }, - { new Tuple(NPCID.Plantera, ProjectileID.ThornBall), new int[] { 62, 108, 160, 176, 234 } }, - { new Tuple(NPCID.Plantera, ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(NPCID.Plantera, ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, + { new Tuple(NPCID.Plantera, ProjectileID.SeedPlantera), new int[] { 52, 96, 128, 160, 210 } }, + { new Tuple(NPCID.Plantera, ProjectileID.PoisonSeedPlantera), new int[] { 62, 116, 144, 172, 222 } }, + { new Tuple(NPCID.Plantera, ProjectileID.ThornBall), new int[] { 72, 132, 160, 188, 240 } }, + { new Tuple(NPCID.Plantera, ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 240 } }, + { new Tuple(NPCID.Plantera, ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 240 } }, - { new Tuple(NPCID.HallowBoss, ProjectileID.HallowBossRainbowStreak), new int[] { 100, 140, 160, 176, 234 } }, - { new Tuple(NPCID.HallowBoss, ProjectileID.FairyQueenSunDance), new int[] { 120, 160, 184, 200, 270 } }, - { new Tuple(NPCID.HallowBoss, ProjectileID.HallowBossLastingRainbow), new int[] { 100, 140, 160, 176, 234 } }, - { new Tuple(NPCID.HallowBoss, ProjectileID.FairyQueenLance), new int[] { 130, 120, 140, 176, 234 } }, + { new Tuple(NPCID.HallowBoss, ProjectileID.HallowBossRainbowStreak), new int[] { 100, 152, 172, 192, 300 } }, + { new Tuple(NPCID.HallowBoss, ProjectileID.FairyQueenSunDance), new int[] { 120, 180, 204, 228, 360 } }, + { new Tuple(NPCID.HallowBoss, ProjectileID.HallowBossLastingRainbow), new int[] { 100, 152, 172, 192, 300 } }, + { new Tuple(NPCID.HallowBoss, ProjectileID.FairyQueenLance), new int[] { 130, 196, 216, 236, 390 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 172, 208, 228, 300 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 84, 148, 172, 188, 252 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 200, 270 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 172, 208, 244, 300 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 240 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 84, 148, 172, 196, 252 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 212, 264 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 200, 270 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 172, 208, 228, 300 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 200, 270 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 212, 264 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 172, 208, 244, 300 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 212, 264 } }, - { new Tuple(NPCID.Golem, ProjectileID.Fireball), new int[] { 58, 116, 160, 176, 234 } }, - { new Tuple(NPCID.Golem, ProjectileID.EyeBeam), new int[] { 56, 112, 172, 188, 252 } }, - { new Tuple(NPCID.GolemHead, ProjectileID.Fireball), new int[] { 48, 94, 160, 176, 234 } }, - { new Tuple(NPCID.GolemHead, ProjectileID.EyeBeam), new int[] { 56, 112, 172, 188, 252 } }, - { new Tuple(NPCID.GolemHeadFree, ProjectileID.Fireball), new int[] { 48, 94, 160, 176, 234 } }, - { new Tuple(NPCID.GolemHeadFree, ProjectileID.EyeBeam), new int[] { 56, 112, 172, 188, 252 } }, - { new Tuple(NPCID.GolemHeadFree, ProjectileID.InfernoHostileBolt), new int[] { 64, 128, 184, 200, 270 } }, + { new Tuple(NPCID.Golem, ProjectileID.Fireball), new int[] { 72, 132, 160, 188, 234 } }, + { new Tuple(NPCID.Golem, ProjectileID.EyeBeam), new int[] { 80, 140, 172, 204, 246 } }, + { new Tuple(NPCID.GolemHead, ProjectileID.Fireball), new int[] { 60, 120, 160, 200, 240 } }, + { new Tuple(NPCID.GolemHead, ProjectileID.EyeBeam), new int[] { 80, 140, 172, 204, 246 } }, + { new Tuple(NPCID.GolemHeadFree, ProjectileID.Fireball), new int[] { 60, 120, 160, 200, 240 } }, + { new Tuple(NPCID.GolemHeadFree, ProjectileID.EyeBeam), new int[] { 80, 140, 172, 204, 246 } }, + { new Tuple(NPCID.GolemHeadFree, ProjectileID.InfernoHostileBolt), new int[] { 88, 156, 184, 212, 264 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 200, 270 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 200, 270 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 240, 330 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 212, 264 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 212, 264 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 248, 360 } }, - { new Tuple(NPCID.DukeFishron, ProjectileID.Sharknado), new int[] { 80, 100, 184, 200, 270 } }, - { new Tuple(NPCID.DukeFishron, ProjectileID.Cthulunado), new int[] { 160, 200, 232, 248, 348 } }, + { new Tuple(NPCID.DukeFishron, ProjectileID.Sharknado), new int[] { 80, 100, 150, 200, 240 } }, + { new Tuple(NPCID.DukeFishron, ProjectileID.Cthulunado), new int[] { 160, 200, 232, 264, 480 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 224, 312 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 224, 312 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 144, 172, 188, 258 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 224, 312 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 144, 172, 188, 258 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 236, 360 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 236, 360 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 144, 172, 200, 270 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 236, 360 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 144, 172, 200, 270 } }, - { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossFireBall), new int[] { 60, 80, 184, 200, 270 } }, - { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossIceMist), new int[] { 70, 100, 208, 224, 312 } }, - { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossLightningOrb), new int[] { 90, 120, 220, 240, 330 } }, - { new Tuple(NPCID.CultistBossClone, ProjectileID.CultistBossFireBallClone), new int[] { 36, 72, 172, 188, 258 } }, - { new Tuple(NPCID.AncientDoom, ProjectileID.AncientDoomProjectile), new int[] { 60, 180, 184, 200, 270 } }, + { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossFireBall), new int[] { 88, 156, 184, 212, 264 } }, + { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossIceMist), new int[] { 120, 180, 208, 236, 360 } }, + { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossLightningOrb), new int[] { 120, 192, 220, 248, 360 } }, + { new Tuple(NPCID.CultistBossClone, ProjectileID.CultistBossFireBallClone), new int[] { 90, 144, 172, 200, 270 } }, + { new Tuple(NPCID.AncientDoom, ProjectileID.AncientDoomProjectile), new int[] { 88, 156, 184, 212, 264 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 152, 176, 188, 264 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 224, 312 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 172, 192, 204, 288 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 152, 176, 200, 270 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 236, 360 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 172, 192, 212, 300 } }, - { new Tuple(NPCID.MoonLordHead, ProjectileID.PhantasmalDeathray), new int[] { 150, 300, 380, 420, 570 } }, - { new Tuple(NPCID.MoonLordHead, ProjectileID.PhantasmalBolt), new int[] { 60, 120, 160, 176, 240 } }, - { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalEye), new int[] { 60, 120, 160, 176, 240 } }, - { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalSphere), new int[] { 80, 160, 260, 284, 390 } }, - { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalBolt), new int[] { 60, 120, 160, 176, 240 } }, - { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalBolt), new int[] { 70, 140, 180, 200, 270 } }, - { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalEye), new int[] { 70, 140, 180, 200, 270 } }, - { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalSphere), new int[] { 88, 176, 260, 284, 390 } }, - { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalDeathray), new int[] { 100, 200, 260, 284, 390 } }, + { new Tuple(NPCID.MoonLordHead, ProjectileID.PhantasmalDeathray), new int[] { 200, 300, 380, 460, 600 } }, + { new Tuple(NPCID.MoonLordHead, ProjectileID.PhantasmalBolt), new int[] { 90, 120, 160, 200, 270 } }, + { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalEye), new int[] { 90, 120, 160, 200, 270 } }, + { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalSphere), new int[] { 120, 160, 220, 280, 360 } }, + { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalBolt), new int[] { 90, 120, 160, 200, 270 } }, + { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalBolt), new int[] { 100, 140, 180, 220, 300 } }, + { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalEye), new int[] { 100, 140, 180, 220, 300 } }, + { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalSphere), new int[] { 132, 176, 220, 264, 396 } }, + { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalDeathray), new int[] { 150, 200, 260, 320, 450 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 330 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 330 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 320, 352, 370, 528 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 198, 284 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 378 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 198, 284 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 330 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 360 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 360 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 320, 352, 370, 480 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 198, 315 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 198, 315 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 360 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 35, 50, 50, 0, 0 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 300, 332, 356, 498 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 300, 332, 356, 600 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 300, 432 } }, // Split holy fire does: 113, 198, 216, 225, 324 - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 330 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 330 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 300, 450 } }, // Split holy fire does: 113, 198, 216, 225, 338 + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 360 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 360 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 420 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 35, 50, 50, 0, 0 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 378 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 198, 284 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 378 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 198, 284 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 378 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 378 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 400, 440, 464, 660 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 198, 315 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 198, 315 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 400, 440, 464, 600 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 420 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrbArc), new int[] { 150, 264, 288, 300, 432 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.FrostWave), new int[] { 150, 264, 288, 300, 432 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 276, 304, 320, 456 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrb), new int[] { 150, 264, 288, 300, 432 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrbArc), new int[] { 150, 264, 288, 300, 450 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.FrostWave), new int[] { 150, 264, 288, 300, 450 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 276, 304, 320, 480 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 420 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrb), new int[] { 150, 264, 288, 300, 450 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 300, 432 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 300, 432 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 276, 304, 320, 456 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 462 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 300, 432 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 300, 450 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 300, 450 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 276, 304, 320, 480 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 510 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 300, 450 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 462 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 400, 440, 464, 660 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 462 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 364, 492 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 462 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 510 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 420, 460, 484, 840 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 510 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 364, 540 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 510 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 364, 492 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 340, 376, 396, 564 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 364, 492 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 364, 540 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 340, 376, 396, 600 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 364, 540 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 520, 548, 564, 822 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 444, 600 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 444, 600 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 444, 600 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 444, 600 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 520, 548, 564, 900 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 444, 660 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 750 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 750 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 750 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 444, 660 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 444, 660 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 444, 660 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 750 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 726 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 726 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 544, 780 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 592, 624, 656, 918 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 726 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 726 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 726 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 726 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 840 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 840 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 544, 900 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 592, 624, 656, 1050 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 840 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 750 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 840 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 750 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 750 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 840 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 750 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 840 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 750 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 544, 780 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 726 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 544, 900 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 840 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 592, 624, 656, 918 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 592, 624, 656, 1050 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 544, 780 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 544, 780 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 608, 640, 658, 960 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 544, 900 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 544, 900 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 608, 640, 658, 1200 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossIceMist), new int[] { 400, 600, 632, 648, 948 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrbArc), new int[] { 500, 752, 788, 808, 1182 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.AncientDoomProjectile), new int[] { 400, 600, 632, 648, 948 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossFireBallClone), new int[] { 400, 600, 632, 648, 948 } } + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossIceMist), new int[] { 400, 600, 632, 648, 1200 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrbArc), new int[] { 500, 752, 788, 808, 1500 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.AncientDoomProjectile), new int[] { 400, 600, 632, 648, 1200 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossFireBallClone), new int[] { 400, 600, 632, 648, 1200 } } }; } diff --git a/Dusts/CalamityDusts.cs b/Dusts/CalamityDusts.cs index 702f83fc3c..190d8a9916 100644 --- a/Dusts/CalamityDusts.cs +++ b/Dusts/CalamityDusts.cs @@ -9,7 +9,7 @@ SulfurousSeaAcid = 75, Brimstone = 235, Ectoplasm = 180, - Polterplasm = 60, + Necroplasm = 60, Plague = 46, ProfanedFire = 244, Nightwither = 185, diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index 47c10cb3e8..c98734482d 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -179,6 +179,7 @@ namespace CalamityMod.Effects #region Aqua's Shaders internal static Effect CircularGradientWithEdge; internal static Effect WavyOpacity; + internal static Effect HellBall; #endregion // @@ -397,6 +398,8 @@ namespace CalamityMod.Effects RegisterMiscShader(CircularGradientWithEdge, "CircularGradientWithEdgePass", "CircularGradientWithEdge"); WavyOpacity = LoadShader("WavyOpacity"); RegisterMiscShader(WavyOpacity, "WavyOpacityPass", "WavyOpacity"); + HellBall = LoadShader("HellBall"); + RegisterScreenShader(HellBall, "HellBallPass", "HellBall"); #endregion #region Loading Amber's Shaders diff --git a/Effects/Dyes/PolterplasmDyeShader.fx b/Effects/Dyes/NecroplasmicDyeShader.fx similarity index 100% rename from Effects/Dyes/PolterplasmDyeShader.fx rename to Effects/Dyes/NecroplasmicDyeShader.fx diff --git a/Effects/Dyes/PolterplasmDyeShader.xnb b/Effects/Dyes/NecroplasmicDyeShader.xnb similarity index 100% rename from Effects/Dyes/PolterplasmDyeShader.xnb rename to Effects/Dyes/NecroplasmicDyeShader.xnb diff --git a/Effects/HellBall.fx b/Effects/HellBall.fx new file mode 100644 index 0000000000..66eccc5134 --- /dev/null +++ b/Effects/HellBall.fx @@ -0,0 +1,53 @@ +float time; +float blowUpPower; //The power the blow up effect is set as. Ideally betwen 0 and 1 +float blowUpSize; //The strenght of the expansion caused by the blow up effect +float3 shieldColor; +float shieldOpacity; +float3 shieldEdgeColor; +float shieldEdgeBlendStrenght; +float noiseScale; +float resolution; + +texture sampleTexture; +sampler2D Texture1Sampler = sampler_state { texture = ; magfilter = LINEAR; minfilter = LINEAR; mipfilter = LINEAR; AddressU = wrap; AddressV = wrap; }; + +float4 main(float2 uv : TEXCOORD) : COLOR +{ + //Pixelate? + //uv.x -= uv.x % (1 / resolution); + //uv.y -= uv.y % (1 / resolution); + + //Crop in a circle + float distanceFromCenter = length(uv - float2(0.5, 0.5)) * 2; + if (distanceFromCenter > 1) + return float4(0, 0, 0, 0); + + //"Blow up" the noise map so it looks circular. + float blownUpUVX = pow((abs(uv.x - 0.5)) * 2, blowUpPower); + float blownUpUVY = pow((abs(uv.y - 0.5)) * 2, blowUpPower); + float2 blownUpUV = float2(-blownUpUVY * blowUpSize * 0.5 + uv.x * (1 + blownUpUVY * blowUpSize), -blownUpUVX * blowUpSize * 0.5 + uv.y * (1 + blownUpUVX * blowUpSize)); + + //Rescale + blownUpUV *= noiseScale; + //Scroll effect + blownUpUV.y = (blownUpUV.y + time) % 1; + + //Get the noise color + float4 noiseColor = tex2D(Texture1Sampler, blownUpUV); + + //Apply a layers of fake fresnel + noiseColor += pow(distanceFromCenter, 6); // + pow(distanceFromCenter, 3) * 0.6; <- Brings us over into ps 3.0 territory if we have pixelation on. + //Fade the edges + if (distanceFromCenter > 0.95) + noiseColor *= (1 - ((distanceFromCenter - 0.95) / 0.05)); + + return noiseColor * float4(lerp(shieldColor, shieldEdgeColor, pow(distanceFromCenter, shieldEdgeBlendStrenght)), shieldOpacity); +} + +technique Technique1 +{ + pass HellBallPass + { + PixelShader = compile ps_2_0 main(); + } +} \ No newline at end of file diff --git a/Effects/HellBall.xnb b/Effects/HellBall.xnb new file mode 100644 index 0000000000..28ed20114e Binary files /dev/null and b/Effects/HellBall.xnb differ diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index e578ffac62..f9d9776e39 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -490,9 +490,9 @@ namespace CalamityMod.Events int tier = CurrentTier; if (CalamityMod.Instance.musicMod != null) { - // Boss Rush music for tiers 4 and 5 don't exist - if (tier > 3) - tier = 3; + // Boss Rush music for tier 5 doesn't exist + if (tier > 4) + tier = 4; return CalamityMod.Instance.GetMusicFromMusicMod($"BossRushTier{tier}") ?? 0; } diff --git a/ExtraTextures/LineFade.png b/ExtraTextures/LineFade.png new file mode 100644 index 0000000000..2fbccf4dac Binary files /dev/null and b/ExtraTextures/LineFade.png differ diff --git a/ExtraTextures/ScreamyFace.png b/ExtraTextures/ScreamyFace.png new file mode 100644 index 0000000000..712955d4f7 Binary files /dev/null and b/ExtraTextures/ScreamyFace.png differ diff --git a/ExtraTextures/SoulVortex.png b/ExtraTextures/SoulVortex.png new file mode 100644 index 0000000000..3450a057bd Binary files /dev/null and b/ExtraTextures/SoulVortex.png differ diff --git a/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow.png b/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow.png new file mode 100644 index 0000000000..3e2235cd1d Binary files /dev/null and b/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow.png differ diff --git a/ExtraTextures/VanillaBossGlowmasks/DestroyerHeadGlow.png b/ExtraTextures/VanillaBossGlowmasks/DestroyerHeadGlow.png new file mode 100644 index 0000000000..4530739af2 Binary files /dev/null and b/ExtraTextures/VanillaBossGlowmasks/DestroyerHeadGlow.png differ diff --git a/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow.png b/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow.png new file mode 100644 index 0000000000..2fcbcceb81 Binary files /dev/null and b/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow.png differ diff --git a/ExtraTextures/VanillaBossGlowmasks/SkeletronPrimeHeadGlow.png b/ExtraTextures/VanillaBossGlowmasks/SkeletronPrimeHeadGlow.png new file mode 100644 index 0000000000..a988d2bbdc Binary files /dev/null and b/ExtraTextures/VanillaBossGlowmasks/SkeletronPrimeHeadGlow.png differ diff --git a/ExtraTextures/VanillaBuffs/BetsysCurse.png b/ExtraTextures/VanillaBuffs/BetsysCurse.png new file mode 100644 index 0000000000..975456cdf9 Binary files /dev/null and b/ExtraTextures/VanillaBuffs/BetsysCurse.png differ diff --git a/ExtraTextures/VanillaBuffs/Celled.png b/ExtraTextures/VanillaBuffs/Celled.png new file mode 100644 index 0000000000..1c5cf64505 Binary files /dev/null and b/ExtraTextures/VanillaBuffs/Celled.png differ diff --git a/ExtraTextures/VanillaBuffs/Daybroken.png b/ExtraTextures/VanillaBuffs/Daybroken.png new file mode 100644 index 0000000000..75a39b21ca Binary files /dev/null and b/ExtraTextures/VanillaBuffs/Daybroken.png differ diff --git a/ExtraTextures/VanillaBuffs/DryadsBane.png b/ExtraTextures/VanillaBuffs/DryadsBane.png new file mode 100644 index 0000000000..0f5d6b84c7 Binary files /dev/null and b/ExtraTextures/VanillaBuffs/DryadsBane.png differ diff --git a/ExtraTextures/VanillaBuffs/Frostbite.png b/ExtraTextures/VanillaBuffs/Frostbite.png new file mode 100644 index 0000000000..901a3795b8 Binary files /dev/null and b/ExtraTextures/VanillaBuffs/Frostbite.png differ diff --git a/ExtraTextures/VanillaBuffs/Hellfire.png b/ExtraTextures/VanillaBuffs/Hellfire.png new file mode 100644 index 0000000000..c392c1b234 Binary files /dev/null and b/ExtraTextures/VanillaBuffs/Hellfire.png differ diff --git a/ExtraTextures/VanillaBuffs/Oiled.png b/ExtraTextures/VanillaBuffs/Oiled.png new file mode 100644 index 0000000000..89cff3505e Binary files /dev/null and b/ExtraTextures/VanillaBuffs/Oiled.png differ diff --git a/Gores/EmptyAnimosityShell.png b/Gores/EmptyAnimosityShell.png new file mode 100644 index 0000000000..79237b2015 Binary files /dev/null and b/Gores/EmptyAnimosityShell.png differ diff --git a/Gores/EmptyAnimosityShell2.png b/Gores/EmptyAnimosityShell2.png new file mode 100644 index 0000000000..cd36f17ad8 Binary files /dev/null and b/Gores/EmptyAnimosityShell2.png differ diff --git a/ILEditing/BalancingILChanges.cs b/ILEditing/BalancingILChanges.cs index 16ef86440d..7a4baf00bf 100644 --- a/ILEditing/BalancingILChanges.cs +++ b/ILEditing/BalancingILChanges.cs @@ -45,7 +45,7 @@ namespace CalamityMod.ILEditing private static void NerfSoaringInsigniaRunAcceleration(ILContext il) { - // Nerf the run acceleration boost from 2x to 1.1x. + // Nerf the run acceleration boost from 1.75x to 1.1x. var cursor = new ILCursor(il); if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdfld("empressBrooch"))) { @@ -109,6 +109,7 @@ namespace CalamityMod.ILEditing cursor.Emit(OpCodes.Ldc_R4, 0.5f); // Decrease to 0.5f. // Find the Frog Leg jump speed bonus and reduce it to 1.2f. + // I don't know if this fucking does anything anymore, but I'm leaving it in just in case. if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(2.4f))) { LogFailure("Jump Height Boost Fixes", "Could not locate Frog Leg jump speed boost value."); @@ -348,34 +349,6 @@ namespace CalamityMod.ILEditing } #endregion - #region Chlorophyte Bullet Speed Nerfs - private static void AdjustChlorophyteBullets(ILContext il) - { - // Reduce dust from 10 to 5 and homing range. - var cursor = new ILCursor(il); - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(ProjectileID.ChlorophyteBullet))) - { - LogFailure("Chlorophyte Bullet AI", "Could not locate the bullet ID."); - return; - } - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(10))) // The number of dust spawned by the bullet. - { - LogFailure("Chlorophyte Bullet AI", "Could not locate the dust quantity."); - return; - } - cursor.Remove(); - cursor.Emit(OpCodes.Ldc_I4_5); // Decrease dust to 5. - - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(300f))) // The 300 unit distance required to home in. - { - LogFailure("Chlorophyte Bullet AI", "Could not locate the homing range."); - return; - } - cursor.Remove(); - cursor.Emit(OpCodes.Ldc_R4, 150f); // Reduce homing range by 50%. - } - #endregion - #region Terrarian Projectile Limitation for Extra Updates private static void LimitTerrarianProjectiles(ILContext il) { diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index cf53fdf790..f118b46064 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -93,7 +93,6 @@ namespace CalamityMod.ILEditing // Damage and health balance On_Main.DamageVar_float_int_float += AdjustDamageVariance; IL_NPC.ScaleStats_ApplyExpertTweaks += RemoveExpertHardmodeScaling; - IL_Projectile.AI_001 += AdjustChlorophyteBullets; IL_Projectile.AI_099_2 += LimitTerrarianProjectiles; IL_Player.UpdateBuffs += NerfSharpeningStation; IL_Player.UpdateBuffs += NerfBeetleScaleMail; @@ -154,6 +153,9 @@ namespace CalamityMod.ILEditing // Fix vanilla not accounting for spritebatch modification in held projectile drawing On_PlayerDrawLayers.DrawHeldProj += FixHeldProjectileBlendState; + // Fix vanilla not accounting for multiple bobbers when fishing with truffle worm + IL_Player.ItemCheck_CheckFishingBobbers += FixTruffleWormFishing; + //Additional detours that are in their own item files given they are only relevant to these specific items: //Rover drive detours on Player.DrawInfernoRings to draw its shield //Wulfrum armor hooks on Player.KeyDoubleTap and DrawPendingMouseText to activate its set bonus and spoof the mouse text to display the stats of the activated weapon if shift is held diff --git a/ILEditing/VanillaBugfixingILChanges.cs b/ILEditing/VanillaBugfixingILChanges.cs index fa0e9ed2f6..bfd88a5bb7 100644 --- a/ILEditing/VanillaBugfixingILChanges.cs +++ b/ILEditing/VanillaBugfixingILChanges.cs @@ -6,6 +6,7 @@ using MonoMod.Cil; using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Renderers; +using Terraria.ID; namespace CalamityMod.ILEditing { @@ -69,5 +70,52 @@ namespace CalamityMod.ILEditing } } #endregion + + #region Fix Vanilla Not Accounting For Multiple Bobbers When Fishing With Truffle Worm + private void FixTruffleWormFishing(ILContext il) + { + var cursor = new ILCursor(il); + + // Initialize a flag variable whether truffle worm was used. + il.Method.Body.Variables.Add(new VariableDefinition(il.Module.TypeSystem.Boolean)); + byte truffleWormUsed = (byte) (il.Method.Body.Variables.Count - 1); + cursor.Emit(OpCodes.Ldc_I4_0); + cursor.Emit(OpCodes.Stloc_S, truffleWormUsed); + + // Move after beq.s, which is before Player.ItemCheck_CheckFishingBobber_PickAndConsumeBait gets called + if (!cursor.TryGotoNext(MoveType.After, i => i.Match(OpCodes.Beq_S))) + { + LogFailure("FixTruffleWormFishing", "Could not locate beq.s before Player.ItemCheck_CheckFishingBobber_PickAndConsumeBait."); + return; + } + + // Skip if truffle worm was already used. + var loopEnd = il.DefineLabel(); + cursor.Emit(OpCodes.Ldloc_S, truffleWormUsed); + cursor.Emit(OpCodes.Brtrue_S, loopEnd); + + // Find the call to Player.ItemCheck_CheckFishingBobber_PickAndConsumeBait. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall("ItemCheck_CheckFishingBobber_PickAndConsumeBait"))) + { + LogFailure("FixTruffleWormFishing", "Could not locate the call to Player.ItemCheck_CheckFishingBobber_PickAndConsumeBait."); + return; + } + + // Retrive baitTypeUsed, compare with truffle worm, and save it. + cursor.Emit(OpCodes.Ldloc_S, (byte)4); + cursor.Emit(OpCodes.Ldc_I4, ItemID.TruffleWorm); + cursor.Emit(OpCodes.Ceq); + cursor.Emit(OpCodes.Stloc_S, truffleWormUsed); + + // Move before next ldloc.0, which is the end of the loop + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdloc0())) + { + LogFailure("FixTruffleWormFishing", "Could not find the end of the loop."); + return; + } + + cursor.MarkLabel(loopEnd); + } + #endregion } } diff --git a/Items/Accessories/AeroStone.cs b/Items/Accessories/AeroStone.cs index b9ce0441a1..e2185e9649 100644 --- a/Items/Accessories/AeroStone.cs +++ b/Items/Accessories/AeroStone.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Accessories public class AeroStone : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(4, 8)); @@ -21,16 +22,15 @@ namespace CalamityMod.Items.Accessories { Item.width = 40; Item.height = 50; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; - Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().aeroStone = true; - player.wingTimeMax += 25; - + player.wingTimeMax += 50; } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) diff --git a/Items/Accessories/DeepDiver.cs b/Items/Accessories/DeepDiver.cs index f20914135a..63e789b5da 100644 --- a/Items/Accessories/DeepDiver.cs +++ b/Items/Accessories/DeepDiver.cs @@ -3,31 +3,44 @@ using CalamityMod.CalPlayer.Dashes; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.CalPlayer.Dashes; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; namespace CalamityMod.Items.Accessories { public class DeepDiver : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public const int ShieldSlamDamage = 35; + public const float ShieldSlamKnockback = 0.2f; + public const int ShieldSlamIFrames = 16; public override void SetDefaults() { Item.width = 24; Item.height = 28; Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 8; Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - if (player.IsUnderwater()) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.deepDiver = true; - modPlayer.DashID = DeepDiverDash.ID; - player.dashType = 0; - } + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.deepDiver = true; + modPlayer.DashID = DeepDiverDash.ID; + player.dashType = 0; + player.ignoreWater = true; // Mobility in water + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(25). + AddIngredient(5). + AddRecipeGroup("AnyCobaltBar", 10). + AddTile(TileID.Anvils). + Register(); } } } diff --git a/Items/Accessories/EldritchSoulArtifact.cs b/Items/Accessories/EldritchSoulArtifact.cs index 5590819a0e..d665e34d14 100644 --- a/Items/Accessories/EldritchSoulArtifact.cs +++ b/Items/Accessories/EldritchSoulArtifact.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(25). AddIngredient(25). - AddIngredient(5). + AddIngredient(5). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Accessories/GiantShell.cs b/Items/Accessories/GiantShell.cs index 9212793e68..897a547e0c 100644 --- a/Items/Accessories/GiantShell.cs +++ b/Items/Accessories/GiantShell.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 30; Item.height = 28; - Item.defense = 10; + Item.defense = 6; Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index eaade947b6..934958d8c4 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.autoJump = true; - player.jumpSpeedBoost += 0.3f; + player.jumpSpeedBoost += 1.6f; player.extraFall += 35; player.blackBelt = true; player.dashType = 1; @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(ItemID.MasterNinjaGear). AddIngredient(ItemID.FrogFlipper). AddIngredient(50). - AddIngredient(5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(ItemID.BlackBelt). AddIngredient(ItemID.FrogGear). AddIngredient(50). - AddIngredient(5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Accessories/StatisVoidSash.cs b/Items/Accessories/StatisVoidSash.cs index 534419c12e..5bd17fc655 100644 --- a/Items/Accessories/StatisVoidSash.cs +++ b/Items/Accessories/StatisVoidSash.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); player.autoJump = true; - player.jumpSpeedBoost += 0.6f; + player.jumpSpeedBoost += 1.6f; player.noFallDmg = true; player.blackBelt = true; modPlayer.DashID = StatisVoidSashDash.ID; diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index e191f1cba1..b91234729f 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(). AddIngredient(5). AddIngredient(10). - AddIngredient(15). + AddIngredient(15). AddIngredient(15). AddIngredient(5). AddIngredient(4). diff --git a/Items/Accessories/Wings/MOAB.cs b/Items/Accessories/Wings/MOAB.cs index 0e7cffe52d..116f3e82db 100644 --- a/Items/Accessories/Wings/MOAB.cs +++ b/Items/Accessories/Wings/MOAB.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Items.Accessories.Wings player.jumpBoost = true; player.autoJump = true; player.noFallDmg = true; - player.jumpSpeedBoost += 0.5f; + player.jumpSpeedBoost += 1.6f; player.luck += 0.05f; } diff --git a/Items/Ammo/BubonicRound.cs b/Items/Ammo/BubonicRound.cs index e10b2cb38a..d9953922fc 100644 --- a/Items/Ammo/BubonicRound.cs +++ b/Items/Ammo/BubonicRound.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 8; Item.height = 8; - Item.damage = 18; + Item.damage = 16; Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; diff --git a/Items/Ammo/CinderArrow.cs b/Items/Ammo/CinderArrow.cs index 9e88ef59e3..ed7a209e33 100644 --- a/Items/Ammo/CinderArrow.cs +++ b/Items/Ammo/CinderArrow.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 22; Item.height = 36; - Item.damage = 11; + Item.damage = 12; Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; diff --git a/Items/Ammo/HailstormBullet.cs b/Items/Ammo/HailstormBullet.cs index b0a7543ff9..0c36e71d85 100644 --- a/Items/Ammo/HailstormBullet.cs +++ b/Items/Ammo/HailstormBullet.cs @@ -17,12 +17,12 @@ namespace CalamityMod.Items.Ammo { Item.width = 14; Item.height = 20; - Item.damage = 13; + Item.damage = 12; Item.DamageType = DamageClass.Ranged; Item.consumable = true; Item.knockBack = 2f; Item.value = Item.buyPrice(0, 0, 0, 80); - Item.rare = ItemRarityID.LightPurple; + Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 0.3f; Item.ammo = AmmoID.Bullet; diff --git a/Items/Ammo/HallowPointRound.cs b/Items/Ammo/HallowPointRound.cs index d4b451bd26..56d140b143 100644 --- a/Items/Ammo/HallowPointRound.cs +++ b/Items/Ammo/HallowPointRound.cs @@ -7,8 +7,11 @@ namespace CalamityMod.Items.Ammo { public class HallowPointRound : ModItem, ILocalizedModType { - public static int BaseDamage = 18; public new string LocalizationCategory => "Items.Ammo"; + + public static int BaseDamage = 12; + public static int BonusDamageOnHit = 6; // 12 + 6 = 18 + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; diff --git a/Items/Ammo/HyperiusBullet.cs b/Items/Ammo/HyperiusBullet.cs index 1c93f34544..39653cceb2 100644 --- a/Items/Ammo/HyperiusBullet.cs +++ b/Items/Ammo/HyperiusBullet.cs @@ -9,6 +9,9 @@ namespace CalamityMod.Items.Ammo public class HyperiusBullet : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Ammo"; + + public static int SplitBulletBonusDamage = 10; + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; @@ -18,13 +21,13 @@ namespace CalamityMod.Items.Ammo { Item.width = 24; Item.height = 30; - Item.damage = 19; + Item.damage = 13; Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 1.5f; Item.value = Item.sellPrice(copper: 16); - Item.rare = ItemRarityID.Cyan; + Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; Item.ammo = AmmoID.Bullet; diff --git a/Items/Ammo/IcicleArrow.cs b/Items/Ammo/IcicleArrow.cs index a8db64ee07..208b718d7d 100644 --- a/Items/Ammo/IcicleArrow.cs +++ b/Items/Ammo/IcicleArrow.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Ammo Item.consumable = true; Item.knockBack = 2.5f; Item.value = Item.buyPrice(0, 0, 0, 80); - Item.rare = ItemRarityID.LightPurple; + Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 0.2f; Item.ammo = AmmoID.Arrow; diff --git a/Items/Ammo/VanquisherArrow.cs b/Items/Ammo/VanquisherArrow.cs index 14898c178e..3b55ab5e88 100644 --- a/Items/Ammo/VanquisherArrow.cs +++ b/Items/Ammo/VanquisherArrow.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 22; Item.height = 46; - Item.damage = 32; + Item.damage = 30; Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; diff --git a/Items/Ammo/VeriumBullet.cs b/Items/Ammo/VeriumBullet.cs index b32d0e881d..9650a1d480 100644 --- a/Items/Ammo/VeriumBullet.cs +++ b/Items/Ammo/VeriumBullet.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 8; Item.height = 8; - Item.damage = 7; + Item.damage = 6; Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; diff --git a/Items/Armor/Reaver/ReaverHeadTank.cs b/Items/Armor/Reaver/ReaverHeadTank.cs index 2970ae04c9..77d56d0339 100644 --- a/Items/Armor/Reaver/ReaverHeadTank.cs +++ b/Items/Armor/Reaver/ReaverHeadTank.cs @@ -38,14 +38,14 @@ namespace CalamityMod.Items.Armor.Reaver { var modPlayer = player.Calamity(); player.thorns += 0.33f; - player.moveSpeed -= 0.2f; + player.moveSpeed -= 0.3f; player.statDefense += 10; player.lifeRegen += 3; player.aggro += 600; modPlayer.reaverDefense = true; modPlayer.wearingRogueArmor = true; player.setBonus = this.GetLocalizedValue("SetBonus"); - //Reaver Rage provides 30% damage to offset the helm "bonus", 5 def, and 5% melee speed. + // Reaver Rage provides 10% damage, 5 def, and 5% melee speed. } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Tarragon/TarragonHeadMelee.cs b/Items/Armor/Tarragon/TarragonHeadMelee.cs index 4a7205df73..685fa7c3dc 100644 --- a/Items/Armor/Tarragon/TarragonHeadMelee.cs +++ b/Items/Armor/Tarragon/TarragonHeadMelee.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Armor.Tarragon public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; + player.GetDamage() += 0.12f; player.GetCritChance() += 10; player.endurance += 0.1f; } diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 07dbb32d91..67f7ef1f85 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -200,6 +200,10 @@ namespace CalamityMod.Items break; } + // Allow Beam Sword to change direction when it fires, because vanilla disables it for some reason. + if (item.type == ItemID.BeamSword) + item.ChangePlayerDirectionOnShoot = true; + // Apply Calamity Global Item Tweaks. SetDefaults_ApplyTweaks(item); @@ -1027,7 +1031,7 @@ namespace CalamityMod.Items } else if (set == "SpectreHealing") { - player.GetDamage() += 0.2f; + player.GetDamage() += 0.4f; player.setBonus = CalamityUtils.GetTextValue("Vanilla.Armor.SetBonus.SpectreHealing"); } else if (set == "SolarFlare") @@ -1569,11 +1573,11 @@ namespace CalamityMod.Items /* Prehardmode = 2 * Hardmode = 3 * Post-Moon Lord = 4 - * Post-DoG = 6 + * Post-DoG = 5 */ if (DownedBossSystem.downedDoG) - player.statDefense += 4; + player.statDefense += 3; else if (NPC.downedMoonlord) player.statDefense += 2; else if (Main.hardMode) @@ -1584,34 +1588,34 @@ namespace CalamityMod.Items if (item.prefix == PrefixID.Armored) { /* Prehardmode = 3 - * Hardmode = 5 - * Post-Moon Lord = 6 - * Post-DoG = 8 + * Hardmode = 4 + * Post-Moon Lord = 5 + * Post-DoG = 6 */ if (DownedBossSystem.downedDoG) - player.statDefense += 5; - else if (NPC.downedMoonlord) player.statDefense += 3; - else if (Main.hardMode) + else if (NPC.downedMoonlord) player.statDefense += 2; + else if (Main.hardMode) + player.statDefense += 1; player.endurance += 0.0075f; } if (item.prefix == PrefixID.Warding) { /* Prehardmode = 4 - * Hardmode = 6 - * Post-Moon Lord = 8 - * Post-DoG = 10 + * Hardmode = 5 + * Post-Moon Lord = 6 + * Post-DoG = 7 */ if (DownedBossSystem.downedDoG) - player.statDefense += 6; + player.statDefense += 3; else if (NPC.downedMoonlord) - player.statDefense += 4; - else if (Main.hardMode) player.statDefense += 2; + else if (Main.hardMode) + player.statDefense += 1; player.endurance += 0.01f; } diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index ab370010a9..e58a5be843 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -132,6 +132,7 @@ namespace CalamityMod.Items case ItemID.QueenSlimeBossBag: loot.Add(ItemID.SoulofLight, 1, 15, 20); // 100% 15-20 Soul of Light + loot.Add(ItemID.PinkGel, 1, 15, 20); // 100% 15-20 Pink Gel loot.AddRevBagAccessories(); loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); break; @@ -309,7 +310,7 @@ namespace CalamityMod.Items case ItemID.DungeonFishingCrate: case ItemID.DungeonFishingCrateHard: loot.AddIf(() => NPC.downedPlantBoss, ItemID.Ectoplasm, 10, 1, 5); // 10% 1-5 Ectoplasm - loot.AddIf(() => DownedBossSystem.downedPolterghast, ModContent.ItemType(), 10, 1, 5); // 10% 1-5 Polterplasm + loot.AddIf(() => DownedBossSystem.downedPolterghast, ModContent.ItemType(), 10, 1, 5); // 10% 1-5 Necroplasm break; case ItemID.JungleFishingCrate: diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index a4741f3604..cb4709ba7e 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -405,14 +405,18 @@ namespace CalamityMod.Items // Brain of Confusion, Black Belt and Master Ninja Gear have guaranteed dodges with a fixed cooldown. #region Guaranteed Dodge Tooltips string beltDodgeLine = "Grants the ability to dodge attacks\n" + - $"The dodge has a {BalancingConstants.BeltDodgeCooldown / 60} second cooldown which is shared with all other dodges and reflects"; + "Attacks that deal less than 5% of your max life in damage will not be dodged\n" + + $"The dodge has a cooldown that ranges between {BalancingConstants.BeltDodgeCooldownMin / 60 } and {BalancingConstants.BeltDodgeCooldownMax / 60} seconds depending on the dodged attack's damage\n" + + "The cooldown is shared with all other dodges and reflects"; if (item.type == ItemID.BlackBelt) EditTooltipByNum(0, (line) => line.Text = beltDodgeLine); if (item.type == ItemID.MasterNinjaGear) EditTooltipByNum(1, (line) => line.Text = beltDodgeLine); string brainDodgeLine = "Grants the ability to dodge attacks\n" + - $"The dodge has a {BalancingConstants.BrainDodgeCooldown / 60} second cooldown which is shared with all other dodges and reflects"; + "Attacks that deal less than 5% of your max life in damage will not be dodged\n" + + $"The dodge has a cooldown that ranges between {BalancingConstants.BrainDodgeCooldownMin / 60} and {BalancingConstants.BrainDodgeCooldownMax / 60} seconds depending on the dodged attack's damage\n" + + "The cooldown is shared with all other dodges and reflects"; if (item.type == ItemID.BrainOfConfusion) EditTooltipByNum(0, (line) => line.Text = brainDodgeLine); #endregion @@ -568,9 +572,13 @@ namespace CalamityMod.Items if (item.type == ItemID.FrozenShield) EditTooltipByNum(1, (line) => line.Text = "Puts a shell around the owner when below 50% life that reduces damage by 15%"); - // Ale and Sake rebalance. + // Ale and Sake rebalance and Alcohol Poisoning. if (item.type == ItemID.Ale || item.type == ItemID.Sake) - EditTooltipByNum(0, (line) => line.Text = "Increases melee damage by 10% and reduces defense by 5%"); + { + EditTooltipByNum(0, (line) => line.Text = "Increases melee damage by 10% and reduces defense by 5%\n" + + "Counts as an alcohol for Alcohol Poisoning\n" + + "Drinking more than 3 different alcohols might not end well with your liver"); + } // Hellfire Treads buff. if (item.type == ItemID.HellfireTreads) diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 8359967f6c..ae14e8d561 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -37,33 +37,31 @@ namespace CalamityMod.Items #region CATEGORY 1: Weapon Balancing { ItemID.AdamantiteGlaive, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(65), ShootSpeedRatio(1.25f)) }, { ItemID.AdamantiteRepeater, Do(PointBlank, UseExact(14)) }, - { ItemID.AdamantiteSword, Do(UseTurn, ScaleRatio(1.45f), DamageExact(77)) }, + { ItemID.AdamantiteSword, Do(UseTurn, DamageExact(77)) }, { ItemID.AmberStaff, Do(UseTimeExact(15), UseAnimationExact(45), ReuseDelayExact(15)) }, { ItemID.AmethystStaff, Do(ManaExact(2)) }, { ItemID.Anchor, Do(DamageExact(107), UseExact(30)) }, { ItemID.AntlionClaw, Do(UseExact(14)) }, // Mandible Blade { ItemID.Bananarang, Do(DamageExact(76), UseExact(14)) }, { ItemID.BatScepter, Do(DamageExact(56)) }, - { ItemID.BeamSword, Do(UseMeleeSpeed, UseTurn, DamageExact(180), UseAnimationExact(60), ShootSpeedExact(23f)) }, + { ItemID.BeamSword, Do(UseMeleeSpeed, DamageExact(142), UseAnimationExact(45), ShootSpeedExact(23f), KnockbackExact(8)) }, { ItemID.BeeGun, Do(DamageExact(10), ManaExact(4)) }, { ItemID.BeesKnees, Do(PointBlank, DamageExact(18), UseExact(38)) }, - { ItemID.Bladetongue, Do(UseTurn, UseRatio(0.8f), DamageExact(120), ScaleRatio(1.75f)) }, + { ItemID.Bladetongue, Do(UseTurn, UseRatio(0.8f), DamageExact(120)) }, { ItemID.BlizzardStaff, Do(DamageExact(41), ManaExact(7)) }, { ItemID.BloodyMachete, Do(AutoReuse, DamageExact(24)) }, { ItemID.Blowgun, Do(PointBlank, DamageExact(40)) }, { ItemID.BluePhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.BluePhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.BluePhasesaber, Do(DamageExact(60)) }, { ItemID.BookofSkulls, Do(ManaExact(12), ShootSpeedExact(5.5f)) }, { ItemID.BookStaff, Do(ManaExact(14)) }, // Tome of Infinite Wisdom { ItemID.Boomstick, Do(PointBlank, DamageExact(11)) }, - { ItemID.BreakerBlade, Do(AutoReuse, UseTurn, ScaleRatio(1.4f), DamageExact(97)) }, + { ItemID.BreakerBlade, Do(AutoReuse, UseTurn, DamageExact(97)) }, { ItemID.CandyCornRifle, Do(PointBlank, DamageExact(66)) }, { ItemID.Cascade, Do(AutoReuse, DamageExact(30)) }, { ItemID.ChainGuillotines, Do(DamageExact(100)) }, { ItemID.ChainGun, Do(PointBlank, DamageExact(35)) }, { ItemID.ChainKnife, Do(AutoReuse, DamageRatio(1.34f)) }, // Uses ratios due to remix seed - // Charged Blaster Cannon is now an earlier Last Prism-like, so it will probably need careful balance attention. - // { ItemID.ChargedBlasterCannon, Do(DamageRatio(1.33f)) }, { ItemID.ChlorophyteClaymore, Do(UseMeleeSpeed) }, { ItemID.ChlorophytePartisan, Do(AutoReuse, UseMeleeSpeed, UseRatio(0.8f), DamageExact(70)) }, { ItemID.ChlorophyteSaber, Do(UseMeleeSpeed, DamageExact(80), UseExact(10)) }, @@ -72,7 +70,7 @@ namespace CalamityMod.Items { ItemID.ClockworkAssaultRifle, Do(PointBlank, DamageExact(21)) }, { ItemID.CobaltNaginata, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(90)) }, { ItemID.CobaltRepeater, Do(PointBlank, UseExact(18)) }, - { ItemID.CobaltSword, Do(UseTurn, ScaleRatio(1.4f), DamageExact(80)) }, + { ItemID.CobaltSword, Do(UseTurn, DamageExact(80)) }, { ItemID.Code2, Do(AutoReuse, DamageExact(43)) }, { ItemID.CorruptYoyo, Do(AutoReuse, DamageExact(20)) }, // Malaise { ItemID.CrimsonYoyo, Do(AutoReuse, DamageExact(20)) }, // Artery @@ -80,7 +78,7 @@ namespace CalamityMod.Items { ItemID.CrystalDart, Do(DamageExact(20)) }, { ItemID.CrystalSerpent, Do(DamageExact(45)) }, { ItemID.CrystalStorm, Do(DamageExact(40)) }, - { ItemID.CursedArrow, Do(DamageExact(15)) }, + { ItemID.CursedArrow, Do(DamageExact(14)) }, { ItemID.CursedDart, Do(DamageExact(25)) }, { ItemID.Cutlass, Do(UseRatio(0.9f), DamageExact(90)) }, { ItemID.DaedalusStormbow, Do(DamageExact(30)) }, @@ -101,12 +99,12 @@ namespace CalamityMod.Items { ItemID.EmpressBlade, Do(AutoReuse, DamageExact(60), UseExact(20)) }, // Terraprisma { ItemID.EnchantedBoomerang, Do(DamageExact(24)) }, { ItemID.EnchantedSword, Do(UseMeleeSpeed, DamageExact(30), ShootSpeedExact(15f)) }, - { ItemID.Excalibur, Do(TrueMelee, ScaleRatio(1.2f), UseRatio(0.8f), DamageExact(125), UseAnimationExact(45)) }, + { ItemID.Excalibur, Do(TrueMelee, UseRatio(0.8f), DamageExact(125), UseAnimationExact(45)) }, { ItemID.FairyQueenMagicItem, Do(DamageExact(54)) }, // Nightglow { ItemID.FairyQueenRangedItem, Do(PointBlank, DamageExact(42))}, //Eventide { ItemID.FalconBlade, Do(UseTurn, UseExact(15)) }, - // Unsure what to do with Celebration. Should it be treated as a serious weapon or not? Currently not changing it from vanilla. - // { ItemID.FireworksLauncher, Do(DamageRatio(2f)) }, // Celebration + // For now, I think I will balance Celebration like a serious weapon. -CIT + { ItemID.FireworksLauncher, Do(DamageExact(50), UseExact(25)) }, // Celebration { ItemID.Flairon, Do(DamageExact(73)) }, { ItemID.Flamarang, Do(DamageExact(40)) }, { ItemID.Flamelash, Do(DamageExact(40)) }, @@ -122,8 +120,8 @@ namespace CalamityMod.Items { ItemID.GolemFist, Do(DamageExact(150)) }, { ItemID.Gradient, Do(AutoReuse, DamageExact(39)) }, { ItemID.GreenPhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.GreenPhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, - { ItemID.GrenadeLauncher, Do(DamageExact(90)) }, + { ItemID.GreenPhasesaber, Do(DamageExact(60)) }, + { ItemID.GrenadeLauncher, Do(DamageExact(112)) }, { ItemID.Gungnir, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(92), ShootSpeedRatio(1.25f)) }, { ItemID.HallowedRepeater, Do(PointBlank, UseExact(12)) }, { ItemID.Handgun, Do(PointBlank, UseExact(22), DamageExact(36)) }, @@ -141,8 +139,7 @@ namespace CalamityMod.Items { ItemID.InfernoFork, Do(DamageExact(84)) }, { ItemID.InfluxWaver, Do(UseMeleeSpeed, DamageExact(80), UseExact(25)) }, { ItemID.IronShortsword, Do(AutoReuse, TrueMelee, DamageExact(10)) }, - { ItemID.JestersArrow, Do(DamageExact(6)) }, - { ItemID.Keybrand, Do(UseTurn, ScaleRatio(1.5f)) }, // Uses ratios due to remix seed + { ItemID.Keybrand, Do(UseTurn) }, { ItemID.Kraken, Do(AutoReuse, DamageExact(85)) }, { ItemID.KOCannon, Do(DamageRatio(2.65f)) }, // Uses ratios due to remix seed { ItemID.LaserRifle, Do(DamageExact(46), UseExact(10), ManaExact(4)) }, @@ -170,20 +167,20 @@ namespace CalamityMod.Items { ItemID.Musket, Do(PointBlank, DamageExact(22)) }, { ItemID.MythrilHalberd, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(95), ShootSpeedRatio(1.25f)) }, { ItemID.MythrilRepeater, Do(PointBlank, UseExact(16)) }, - { ItemID.MythrilSword, Do(UseTurn, ScaleRatio(1.45f), DamageExact(100)) }, + { ItemID.MythrilSword, Do(UseTurn, DamageExact(100)) }, { ItemID.NettleBurst, Do(ManaExact(10), DamageExact(70)) }, { ItemID.NightsEdge, Do(TrueMelee, DamageExact(45)) }, { ItemID.NorthPole, Do(AutoReuse, UseMeleeSpeed) }, { ItemID.OrangePhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.OrangePhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.OrangePhasesaber, Do(DamageExact(60)) }, { ItemID.OrichalcumHalberd, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(98), ShootSpeedRatio(1.25f)) }, { ItemID.OrichalcumRepeater, Do(PointBlank, DamageExact(48)) }, - { ItemID.OrichalcumSword, Do(UseTurn, ScaleRatio(1.45f), DamageExact(82)) }, + { ItemID.OrichalcumSword, Do(UseTurn, DamageExact(82)) }, { ItemID.PainterPaintballGun, Do(PointBlank, DamageExact(8)) }, { ItemID.PaladinsHammer, Do(DamageExact(100), ShootSpeedExact(23)) }, { ItemID.PalladiumPike, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(96)) }, { ItemID.PalladiumRepeater, Do(PointBlank, DamageExact(45)) }, - { ItemID.PalladiumSword, Do(UseTurn, ScaleRatio(1.4f), DamageExact(100)) }, + { ItemID.PalladiumSword, Do(UseTurn, DamageExact(100)) }, { ItemID.PearlwoodBow, Do(AutoReuse, PointBlank, DamageExact(20), UseDelta(+8), ShootSpeedDelta(+3.4f), KnockbackDelta(+1f)) }, { ItemID.PearlwoodSword, Do(UseTurn, DamageExact(45)) }, { ItemID.PewMaticHorn, Do(DamageExact(24)) }, @@ -195,9 +192,9 @@ namespace CalamityMod.Items { ItemID.PoisonStaff, Do(DamageExact(57)) }, { ItemID.PossessedHatchet, Do(DamageExact(135)) }, { ItemID.PsychoKnife, Do(UseTurn, UseExact(11), DamageExact(255)) }, - { ItemID.PurpleClubberfish, Do(UseTurn, ScaleRatio(1.2f), KnockbackExact(10f)) }, + { ItemID.PurpleClubberfish, Do(UseTurn, KnockbackExact(10f)) }, { ItemID.PurplePhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.PurplePhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.PurplePhasesaber, Do(DamageExact(60)) }, { ItemID.PygmyStaff, Do(AutoReuse, UseExact(20), DamageExact(70)) }, { ItemID.QuadBarrelShotgun, Do(PointBlank, DamageExact(11)) }, { ItemID.RainbowRod, Do(DamageExact(35), ManaExact(15)) }, @@ -207,9 +204,10 @@ namespace CalamityMod.Items { ItemID.RazorbladeTyphoon, Do(DamageExact(103)) }, { ItemID.Razorpine, Do(DamageExact(40)) }, { ItemID.RedPhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.RedPhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.RedPhasesaber, Do(DamageExact(60)) }, { ItemID.RedRyder, Do(PointBlank, DamageExact(24)) }, - { ItemID.RedsYoyo, Do(AutoReuse, DamageExact(48)) }, // Red's throw and valkyrie's yoyo are the same weapon + { ItemID.RedsYoyo, Do(AutoReuse, DamageExact(48)) }, // Red's Throw and Valkyrie Yoyo have the same stats + { ItemID.RocketLauncher, Do(DamageExact(70)) }, { ItemID.Sandgun, Do(PointBlank, DamageExact(22), UseExact(20)) }, { ItemID.SapphireStaff, Do(DamageExact(25)) }, { ItemID.SDMG, Do(PointBlank, DamageExact(80)) }, @@ -224,7 +222,7 @@ namespace CalamityMod.Items { ItemID.SilverBullet, Do(DamageExact(8)) }, { ItemID.SilverShortsword, Do(AutoReuse, TrueMelee, DamageExact(14)) }, { ItemID.SkyFracture, Do(DamageExact(54), ShootSpeedExact(30f)) }, - { ItemID.SlapHand, Do(UseTurn, ScaleRatio(1.5f), DamageExact(120)) }, + { ItemID.SlapHand, Do(UseTurn, DamageExact(120)) }, { ItemID.Smolstar, Do(DamageExact(9), AutoReuse, UseExact(25)) }, // Blade Staff { ItemID.SolarEruption, Do(DamageExact(157)) }, { ItemID.SoulDrain, Do(DamageExact(38)) }, // Life Drain @@ -240,7 +238,7 @@ namespace CalamityMod.Items { ItemID.Stynger, Do(DamageExact(75)) }, { ItemID.Swordfish, Do(AutoReuse, TrueMelee, DamageExact(24)) }, { ItemID.TacticalShotgun, Do(PointBlank, DamageExact(34)) }, - { ItemID.TaxCollectorsStickOfDoom, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), UseRatio(0.8f), DamageExact(70)) }, // Classy Cane + { ItemID.TaxCollectorsStickOfDoom, Do(AutoReuse, UseTurn, UseRatio(0.8f), DamageExact(70)) }, // Classy Cane { ItemID.TendonBow, Do(PointBlank, DamageExact(17), AutoReuse) }, { ItemID.TerraBlade, Do(DamageExact(122)) }, // Vanilla damage 190. After fixing iframes so yoyo and shots can hit simultaneously, @@ -252,32 +250,32 @@ namespace CalamityMod.Items { ItemID.ThunderSpear, Do(AutoReuse, UseMeleeSpeed) }, // Storm Spear { ItemID.ThunderStaff, Do(DamageExact(18)) }, //Thunder Zapper { ItemID.TitaniumRepeater, Do(PointBlank, DamageExact(52)) }, - { ItemID.TitaniumSword, Do(UseTurn, ScaleRatio(1.45f), DamageExact(77)) }, + { ItemID.TitaniumSword, Do(UseTurn, DamageExact(77)) }, { ItemID.TitaniumTrident, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(72), ShootSpeedRatio(1.25f)) }, { ItemID.TopazStaff, Do(ManaExact(2)) }, { ItemID.Toxikarp, Do(UseTimeExact(7), UseAnimationExact(14)) }, { ItemID.Trident, Do(AutoReuse, TrueMelee, DamageExact(20)) }, { ItemID.Trimarang, Do(DamageExact(24)) }, { ItemID.TrueExcalibur, Do(TrueMelee, DamageExact(107)) }, - { ItemID.TrueNightsEdge, Do(DamageExact(105), ScaleRatio(1.2f)) }, + { ItemID.TrueNightsEdge, Do(DamageExact(105)) }, { ItemID.Tsunami, Do(PointBlank, DamageExact(49)) }, { ItemID.TungstenBullet, Do(DamageExact(8)) }, { ItemID.TungstenShortsword, Do(AutoReuse, TrueMelee, DamageExact(15)) }, { ItemID.UnholyArrow, Do(DamageExact(11)) }, { ItemID.UnholyTrident, Do(ManaRatio(0.78f), DamageRatio(0.91f)) }, // Uses ratios due to remix seed { ItemID.VampireKnives, Do(DamageExact(38)) }, - { ItemID.ValkyrieYoyo, Do(AutoReuse, DamageExact(48)) }, // Red's Throw and Valkyrie Yoyo are the same weapon basically + { ItemID.ValkyrieYoyo, Do(AutoReuse, DamageExact(48)) }, // Red's Throw and Valkyrie Yoyo have the same stats { ItemID.VenomStaff, Do(DamageExact(55)) }, { ItemID.WaspGun, Do(UseExact(11), DamageExact(58)) }, { ItemID.WaterBolt, Do(DamageExact(23)) }, { ItemID.WhitePhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.WhitePhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.WhitePhasesaber, Do(DamageExact(60)) }, { ItemID.WoodenBoomerang, Do(DamageExact(16), Value(Item.sellPrice(copper: 20))) }, { ItemID.Yelets, Do(AutoReuse, DamageExact(53)) }, { ItemID.YellowPhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.YellowPhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.YellowPhasesaber, Do(DamageExact(60)) }, { ItemID.Zenith, Do(DamageExact(210)) }, - { ItemID.ZombieArm, Do(AutoReuse, UseTurn, ScaleRatio(1.25f), KnockbackExact(12f)) }, + { ItemID.ZombieArm, Do(AutoReuse, UseTurn, KnockbackExact(12f)) }, #endregion #region CATEGORY 2: Defense Balancing diff --git a/Items/DraedonMisc/AuricQuantumCoolingCell.cs b/Items/DraedonMisc/AuricQuantumCoolingCell.cs index 8f759936ce..65bd24df8e 100644 --- a/Items/DraedonMisc/AuricQuantumCoolingCell.cs +++ b/Items/DraedonMisc/AuricQuantumCoolingCell.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Items.DraedonMisc public override void AddRecipes() { CreateRecipe(). - AddIngredient(2). + AddIngredient(5). AddIngredient(8). AddIngredient(8). AddIngredient(40). diff --git a/Items/Dyes/PolterplasmDye.cs b/Items/Dyes/NecroplasmicDye.cs similarity index 85% rename from Items/Dyes/PolterplasmDye.cs rename to Items/Dyes/NecroplasmicDye.cs index 99866db31f..fcec182ae5 100644 --- a/Items/Dyes/PolterplasmDye.cs +++ b/Items/Dyes/NecroplasmicDye.cs @@ -10,9 +10,9 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Dyes { [LegacyName("PhantoplasmDye")] - public class PolterplasmDye : BaseDye + public class NecroplasmicDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/PolterplasmDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/NecroplasmicDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). UseColor(new Color(245, 143, 182)).UseSecondaryColor(new Color(119, 238, 255)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Dyes { CreateRecipe(2). AddIngredient(ItemID.BottledWater, 2). - AddIngredient(3). + AddIngredient(3). AddTile(TileID.DyeVat). Register(); } diff --git a/Items/Dyes/PolterplasmDye.png b/Items/Dyes/NecroplasmicDye.png similarity index 100% rename from Items/Dyes/PolterplasmDye.png rename to Items/Dyes/NecroplasmicDye.png diff --git a/Items/Fishing/SulphurCatches/HydrothermalCrate.cs b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs index e2054e0d6c..52dad8a28b 100644 --- a/Items/Fishing/SulphurCatches/HydrothermalCrate.cs +++ b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches { // The contents of this crate depend massively on progression, so it uses a large number of LeadingConditionRules. var tier1AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedSlimeGod || Main.hardMode); - var tier2AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitasClone); + var tier2AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedLeviathan); var scoriaAvailable = itemLoot.DefineConditionalDropSet(() => NPC.downedGolemBoss); var tier1AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedEoCAcidRain); var tier2AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAquaticScourgeAcidRain); diff --git a/Items/Materials/AscendantSpiritEssence.cs b/Items/Materials/AscendantSpiritEssence.cs index 3e7c1415f8..1182826311 100644 --- a/Items/Materials/AscendantSpiritEssence.cs +++ b/Items/Materials/AscendantSpiritEssence.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { CreateRecipe(). - AddIngredient(2). + AddIngredient(2). AddIngredient(5). AddIngredient(5). AddIngredient(2). diff --git a/Items/Materials/BloodstoneCore.cs b/Items/Materials/BloodstoneCore.cs index 62c0ecca8c..4dd5376703 100644 --- a/Items/Materials/BloodstoneCore.cs +++ b/Items/Materials/BloodstoneCore.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Materials CreateRecipe(2). AddIngredient(5). AddIngredient(). - AddIngredient(). + AddIngredient(). AddTile(TileID.AdamantiteForge). Register(); } diff --git a/Items/Materials/MiracleMatter.png b/Items/Materials/MiracleMatter.png index a313570748..4ffb2ac9ca 100644 Binary files a/Items/Materials/MiracleMatter.png and b/Items/Materials/MiracleMatter.png differ diff --git a/Items/Materials/Polterplasm.cs b/Items/Materials/Necroplasm.cs similarity index 94% rename from Items/Materials/Polterplasm.cs rename to Items/Materials/Necroplasm.cs index ccfbebc373..95dceb3057 100644 --- a/Items/Materials/Polterplasm.cs +++ b/Items/Materials/Necroplasm.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { [LegacyName("Phantoplasm")] - public class Polterplasm : ModItem, ILocalizedModType + public class Necroplasm : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Materials"; diff --git a/Items/Materials/Polterplasm.png b/Items/Materials/Necroplasm.png similarity index 100% rename from Items/Materials/Polterplasm.png rename to Items/Materials/Necroplasm.png diff --git a/Items/PermanentBoosters/PhantomHeart.cs b/Items/PermanentBoosters/PhantomHeart.cs index 8fb1a82f8d..f5e37440dc 100644 --- a/Items/PermanentBoosters/PhantomHeart.cs +++ b/Items/PermanentBoosters/PhantomHeart.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Items.PermanentBoosters { CreateRecipe(). AddIngredient(5). - AddIngredient(25). + AddIngredient(25). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Placeables/Banners/CrystalCrawlerBanner.png b/Items/Placeables/Banners/CrystalCrawlerBanner.png index a5b7b0b99c..26dde78749 100644 Binary files a/Items/Placeables/Banners/CrystalCrawlerBanner.png and b/Items/Placeables/Banners/CrystalCrawlerBanner.png differ diff --git a/Items/Placeables/Banners/InfernalCongealmentBanner.png b/Items/Placeables/Banners/InfernalCongealmentBanner.png index cd27ab325c..bcfc7f2aa7 100644 Binary files a/Items/Placeables/Banners/InfernalCongealmentBanner.png and b/Items/Placeables/Banners/InfernalCongealmentBanner.png differ diff --git a/Items/Placeables/Furniture/CirrusCouch.cs b/Items/Placeables/Furniture/CirrusCouch.cs new file mode 100644 index 0000000000..a7c10b5b24 --- /dev/null +++ b/Items/Placeables/Furniture/CirrusCouch.cs @@ -0,0 +1,25 @@ +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class CirrusCouch : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.width = 28; + Item.height = 20; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Furniture/CirrusCouch.png b/Items/Placeables/Furniture/CirrusCouch.png new file mode 100644 index 0000000000..3d0e1a4ba3 Binary files /dev/null and b/Items/Placeables/Furniture/CirrusCouch.png differ diff --git a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs index 229205fecf..60d8f1eb10 100644 --- a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs +++ b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs @@ -9,6 +9,20 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public class DraedonsForge : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Terraria.On_Recipe.ConsumeForCraft += DraeforgeUnlockDetour; + } + + private static bool DraeforgeUnlockDetour(On_Recipe.orig_ConsumeForCraft orig, Recipe self, Item item, Item requiredItem, ref int stackRequired) + { + if (self.HasTile(ModContent.TileType())) + { + Main.LocalPlayer.Calamity().HasCraftedDraedonsForge = true; + } + return orig(self, item, requiredItem, ref stackRequired); + } + public override void SetDefaults() { Item.width = 58; diff --git a/Items/Placeables/FurnitureAuric/ActivatedAuricPanel.cs b/Items/Placeables/FurnitureAuric/ActivatedAuricPanel.cs index 33ff232472..b989ac4973 100644 --- a/Items/Placeables/FurnitureAuric/ActivatedAuricPanel.cs +++ b/Items/Placeables/FurnitureAuric/ActivatedAuricPanel.cs @@ -8,6 +8,10 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric public class ActivatedAuricPanel : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } public override void SetDefaults() { Item.width = 12; diff --git a/Items/Placeables/FurnitureAuric/AuricAbsorber.cs b/Items/Placeables/FurnitureAuric/AuricAbsorber.cs index 52165ecb32..c6747122ed 100644 --- a/Items/Placeables/FurnitureAuric/AuricAbsorber.cs +++ b/Items/Placeables/FurnitureAuric/AuricAbsorber.cs @@ -9,6 +9,10 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric public class AuricAbsorber : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } public override void SetDefaults() { Item.width = 12; diff --git a/Items/Placeables/FurnitureAuric/AuricPanel.cs b/Items/Placeables/FurnitureAuric/AuricPanel.cs index 2c09b77c04..eb62611375 100644 --- a/Items/Placeables/FurnitureAuric/AuricPanel.cs +++ b/Items/Placeables/FurnitureAuric/AuricPanel.cs @@ -8,6 +8,10 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric public class AuricPanel : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } public override void SetDefaults() { Item.width = 12; diff --git a/Items/Placeables/FurnitureAuric/AuricRepulserPanel.cs b/Items/Placeables/FurnitureAuric/AuricRepulserPanel.cs index fa09ac45ac..5c702a42a9 100644 --- a/Items/Placeables/FurnitureAuric/AuricRepulserPanel.cs +++ b/Items/Placeables/FurnitureAuric/AuricRepulserPanel.cs @@ -8,6 +8,10 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric public class AuricRepulserPanel : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } public override void SetDefaults() { Item.width = 12; diff --git a/Items/Placeables/FurnitureAuric/ExoAuricPanel.cs b/Items/Placeables/FurnitureAuric/ExoAuricPanel.cs index 4223a1bd92..3def8fb771 100644 --- a/Items/Placeables/FurnitureAuric/ExoAuricPanel.cs +++ b/Items/Placeables/FurnitureAuric/ExoAuricPanel.cs @@ -8,6 +8,10 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric public class ExoAuricPanel : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } public override void SetDefaults() { Item.width = 12; diff --git a/Items/Placeables/FurnitureExo/ExoPlating.cs b/Items/Placeables/FurnitureExo/ExoPlating.cs index c92c32ff40..a0a28d30e3 100644 --- a/Items/Placeables/FurnitureExo/ExoPlating.cs +++ b/Items/Placeables/FurnitureExo/ExoPlating.cs @@ -11,6 +11,10 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public class ExoPlating : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } public override void SetDefaults() { Item.width = 12; diff --git a/Items/Placeables/FurnitureProfaned/ProfanedRock.cs b/Items/Placeables/FurnitureProfaned/ProfanedRock.cs index 2000669240..9c63f0a11b 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedRock.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedRock.cs @@ -7,6 +7,10 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public class ProfanedRock : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } public override void SetDefaults() { Item.width = 12; diff --git a/Items/Potions/Alcohol/OddMushroom.cs b/Items/Potions/Alcohol/OddMushroom.cs index 6bb6eab159..6ef47a0421 100644 --- a/Items/Potions/Alcohol/OddMushroom.cs +++ b/Items/Potions/Alcohol/OddMushroom.cs @@ -29,5 +29,11 @@ namespace CalamityMod.Items.Potions.Alcohol Item.buffTime = CalamityUtils.SecondsToFrames(3600f); Item.value = Item.buyPrice(0, 50, 0, 0); } + + public override void OnConsumeItem(Player player) + { + if (player.Calamity().trippyLevel < 3) + player.Calamity().trippyLevel++; + } } } diff --git a/Items/Potions/SupremeManaPotion.cs b/Items/Potions/SupremeManaPotion.cs index 581ee3f289..859ab69b80 100644 --- a/Items/Potions/SupremeManaPotion.cs +++ b/Items/Potions/SupremeManaPotion.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Potions { CreateRecipe(15). AddIngredient(ItemID.SuperManaPotion, 15). - AddIngredient(). + AddIngredient(). AddTile(TileID.Bottles). Register() .DisableDecraft(); diff --git a/Items/SummonItems/CosmicWorm.cs b/Items/SummonItems/CosmicWorm.cs index 5915674d50..e5e38178b3 100644 --- a/Items/SummonItems/CosmicWorm.cs +++ b/Items/SummonItems/CosmicWorm.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Items.SummonItems CreateRecipe(). AddIngredient(ItemID.LunarBar, 40). AddIngredient(10). - AddIngredient(40). + AddIngredient(40). AddTile(TileID.LunarCraftingStation). Register() .DisableDecraft(); diff --git a/Items/SummonItems/NecroplasmicBeacon.cs b/Items/SummonItems/NecroplasmicBeacon.cs index ce75ee6df2..6cb20ea800 100644 --- a/Items/SummonItems/NecroplasmicBeacon.cs +++ b/Items/SummonItems/NecroplasmicBeacon.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.SummonItems public class NecroplasmicBeacon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.SummonItems"; + public override void SetStaticDefaults() { ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil @@ -60,7 +61,7 @@ namespace CalamityMod.Items.SummonItems { CreateRecipe(). AddRecipeGroup("Wood", 25). - AddIngredient(50). + AddIngredient(50). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Tools/ClimateChange/AridArtifact.cs b/Items/Tools/ClimateChange/AridArtifact.cs index a962991a3b..759f43754d 100644 --- a/Items/Tools/ClimateChange/AridArtifact.cs +++ b/Items/Tools/ClimateChange/AridArtifact.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Tools.ClimateChange public override bool CanUseItem(Player player) { - return DownedBossSystem.downedDesertScourge; + return DownedBossSystem.downedDesertScourge || Main.hardMode; } // this is extremely ugly and has to be fully qualified because we add an item called Sandstorm diff --git a/Items/Tools/Grax.cs b/Items/Tools/Grax.cs index e908f0edfc..0435f907e0 100644 --- a/Items/Tools/Grax.cs +++ b/Items/Tools/Grax.cs @@ -29,8 +29,6 @@ namespace CalamityMod.Items.Tools Item.hammer = HammerPower; Item.axe = AxePower; Item.tileBoost += 5; - - Item.scale = 1.5f; Item.DamageType = DamageClass.Melee; Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; diff --git a/Items/TreasureBags/AquaticScourgeBag.cs b/Items/TreasureBags/AquaticScourgeBag.cs index 9a3001901e..052a8aaabd 100644 --- a/Items/TreasureBags/AquaticScourgeBag.cs +++ b/Items/TreasureBags/AquaticScourgeBag.cs @@ -74,7 +74,6 @@ namespace CalamityMod.Items.TreasureBags // Equipment itemLoot.Add(ModContent.ItemType()); - itemLoot.Add(ModContent.ItemType(), 10); itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); itemLoot.AddRevBagAccessories(); diff --git a/Items/TreasureBags/DesertScourgeBag.cs b/Items/TreasureBags/DesertScourgeBag.cs index 97a6454ec5..4f734a549f 100644 --- a/Items/TreasureBags/DesertScourgeBag.cs +++ b/Items/TreasureBags/DesertScourgeBag.cs @@ -77,7 +77,6 @@ namespace CalamityMod.Items.TreasureBags // Equipment itemLoot.Add(ModContent.ItemType()); - itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); itemLoot.AddRevBagAccessories(); diff --git a/Items/TreasureBags/PolterghastBag.cs b/Items/TreasureBags/PolterghastBag.cs index 90621647b7..f1516c5f3c 100644 --- a/Items/TreasureBags/PolterghastBag.cs +++ b/Items/TreasureBags/PolterghastBag.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Items.TreasureBags // Materials itemLoot.Add(ModContent.ItemType(), 1, 10, 20); - itemLoot.Add(ModContent.ItemType(), 1, 40, 50); + itemLoot.Add(ModContent.ItemType(), 1, 40, 50); // Weapons itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] diff --git a/Items/VanillaArmorChanges/ChlorophyteArmorSetChange.cs b/Items/VanillaArmorChanges/ChlorophyteArmorSetChange.cs index 6748ee267d..478e6ceca6 100644 --- a/Items/VanillaArmorChanges/ChlorophyteArmorSetChange.cs +++ b/Items/VanillaArmorChanges/ChlorophyteArmorSetChange.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Chlorophyte"; - public const int AmountToHealPerPulse = 10; + public const int AmountToHealPerPulse = 5; public const int PulseReleaseRate = 300; diff --git a/Items/Weapons/DraedonsArsenal/GaussDagger.cs b/Items/Weapons/DraedonsArsenal/GaussDagger.cs index 31edf55081..229f8e88da 100644 --- a/Items/Weapons/DraedonsArsenal/GaussDagger.cs +++ b/Items/Weapons/DraedonsArsenal/GaussDagger.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.height = 26; Item.damage = 25; Item.DamageType = DamageClass.Melee; - Item.scale = 1.5f; Item.useTime = 24; Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Magic/Biofusillade.cs b/Items/Weapons/Magic/Biofusillade.cs index 04c80e4ab9..be2a25b28a 100644 --- a/Items/Weapons/Magic/Biofusillade.cs +++ b/Items/Weapons/Magic/Biofusillade.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 28; Item.height = 30; - Item.damage = 107; + Item.damage = 118; Item.DamageType = DamageClass.Magic; Item.mana = 4; Item.useTime = 3; diff --git a/Items/Weapons/Magic/ClothiersWrath.cs b/Items/Weapons/Magic/ClothiersWrath.cs index e82a433956..c2c373370e 100644 --- a/Items/Weapons/Magic/ClothiersWrath.cs +++ b/Items/Weapons/Magic/ClothiersWrath.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 28; Item.height = 30; - Item.damage = 80; + Item.damage = 36; Item.DamageType = DamageClass.Magic; Item.mana = 15; Item.useTime = 22; diff --git a/Items/Weapons/Magic/DeathValleyDuster.cs b/Items/Weapons/Magic/DeathValleyDuster.cs index 224d4f86a6..e9e5cde0a1 100644 --- a/Items/Weapons/Magic/DeathValleyDuster.cs +++ b/Items/Weapons/Magic/DeathValleyDuster.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 36; Item.height = 40; - Item.damage = 87; + Item.damage = 83; Item.DamageType = DamageClass.Magic; Item.mana = 9; Item.useTime = 25; diff --git a/Items/Weapons/Magic/Fabstaff.cs b/Items/Weapons/Magic/Fabstaff.cs index c249712ba1..c225c88afd 100644 --- a/Items/Weapons/Magic/Fabstaff.cs +++ b/Items/Weapons/Magic/Fabstaff.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.RainbowRod). - AddIngredient(10). + AddIngredient(10). AddIngredient(5). AddTile(). Register(); diff --git a/Items/Weapons/Magic/ShadecrystalBarrage.cs b/Items/Weapons/Magic/ShadecrystalBarrage.cs index bc1eee8d5b..bb8e51f3cd 100644 --- a/Items/Weapons/Magic/ShadecrystalBarrage.cs +++ b/Items/Weapons/Magic/ShadecrystalBarrage.cs @@ -12,34 +12,42 @@ namespace CalamityMod.Items.Weapons.Magic public class ShadecrystalBarrage : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + + internal const float ShootSpeed = 2f; + public override void SetDefaults() { Item.width = 28; Item.height = 30; - Item.damage = 25; + Item.damage = 24; Item.DamageType = DamageClass.Magic; - Item.mana = 4; - Item.useTime = 6; - Item.useAnimation = 6; + Item.mana = 10; + Item.useTime = 7; + Item.useAnimation = 14; + Item.reuseDelay = 49; + Item.useLimitPerAnimation = 3; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 5.5f; + Item.knockBack = 5f; Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item9; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.shootSpeed = ShootSpeed; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int projAmt = Main.rand.Next(1, 3); - for (int index = 0; index < projAmt; ++index) + int projAmt = 6; + float maxSpread = ShootSpeed * 0.25f; + Vector2 cachedVelocity = velocity; + Vector2 newPosition = position + velocity.SafeNormalize(Vector2.UnitY) * 20f; + for (int index = 0; index < projAmt; index++) { - float SpeedX = velocity.X + Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); + velocity += new Vector2(Main.rand.NextFloat(-maxSpread, maxSpread), Main.rand.NextFloat(-maxSpread, maxSpread)); + Projectile.NewProjectile(source, newPosition, velocity, type, damage, knockback, player.whoAmI, 0f, MathHelper.Lerp(1.04f, 1.09f, index / (float)(projAmt - 1))); + velocity = cachedVelocity; } return false; } diff --git a/Items/Weapons/Magic/SkyGlaze.cs b/Items/Weapons/Magic/SkyGlaze.cs index b018d02c42..446da2556d 100644 --- a/Items/Weapons/Magic/SkyGlaze.cs +++ b/Items/Weapons/Magic/SkyGlaze.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 52; Item.height = 74; - Item.damage = 10; + Item.damage = 8; Item.DamageType = DamageClass.Magic; Item.mana = 8; Item.useTime = 25; diff --git a/Items/Weapons/Magic/StaffofBlushie.cs b/Items/Weapons/Magic/StaffofBlushie.cs index 16dbfa42f5..54872d4ed7 100644 --- a/Items/Weapons/Magic/StaffofBlushie.cs +++ b/Items/Weapons/Magic/StaffofBlushie.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.SapphireStaff). - AddIngredient(10). + AddIngredient(10). AddIngredient(5). AddTile(). Register(); diff --git a/Items/Weapons/Magic/StarShower.cs b/Items/Weapons/Magic/StarShower.cs index f76b60f8e4..e900725209 100644 --- a/Items/Weapons/Magic/StarShower.cs +++ b/Items/Weapons/Magic/StarShower.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -11,11 +12,14 @@ namespace CalamityMod.Items.Weapons.Magic public class StarShower : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + + internal const float ShootSpeed = 28f; + public override void SetDefaults() { Item.width = 38; Item.height = 40; - Item.damage = 57; + Item.damage = 60; Item.DamageType = DamageClass.Magic; Item.mana = 15; Item.rare = ItemRarityID.Cyan; @@ -28,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = SoundID.Item105; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = ShootSpeed; } // Terraria seems to really dislike high crit values in SetDefaults @@ -36,29 +40,18 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float starSpeed = Item.shootSpeed; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - float mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (player.gravDir == -1f) + Vector2 destination = Main.MouseWorld; + position = destination - Vector2.UnitY * (Main.MouseWorld.Y - Main.screenPosition.Y + 80f); + Vector2 cachedPosition = position; + float maxRandomOffset = 16f; + int totalProjectiles = 5; + for (int i = 0; i < totalProjectiles; i++) { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - } - float randXOffset = mouseXDist; - float randYOffset = mouseYDist; - randXOffset += (float)Main.rand.Next(-1, 2) * 0.5f; - randYOffset += (float)Main.rand.Next(-1, 2) * 0.5f; - realPlayerPos += new Vector2(randXOffset, randYOffset); - for (int i = 0; i < 5; i++) - { - float speedX4 = 2f + (float)Main.rand.Next(-8, 5); - float speedY5 = 15f + (float)Main.rand.Next(1, 6); - int star = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, damage, knockback, player.whoAmI, 0f, 0f); + position.X += MathHelper.Lerp(-160f, 160f, i / (float)(totalProjectiles - 1)); + position += Main.rand.NextVector2Circular(maxRandomOffset, maxRandomOffset); + velocity = (Main.MouseWorld - position).SafeNormalize(Vector2.UnitY) * ShootSpeed * Main.rand.NextFloat(0.9f, 1.1f); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + position = cachedPosition; } return false; } diff --git a/Items/Weapons/Magic/Viscera.cs b/Items/Weapons/Magic/Viscera.cs index 9142ff11fc..10696984a3 100644 --- a/Items/Weapons/Magic/Viscera.cs +++ b/Items/Weapons/Magic/Viscera.cs @@ -1,8 +1,11 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -16,26 +19,43 @@ namespace CalamityMod.Items.Weapons.Magic Item.staff[Item.type] = true; } + public const int BoomLifetime = 40; + public int Counter = 0; + public override void SetDefaults() { Item.width = 50; Item.height = 52; - Item.damage = 100; + Item.damage = 229; Item.DamageType = DamageClass.Magic; - Item.mana = 15; - Item.useTime = 14; - Item.useAnimation = 14; + Item.mana = 18; + Item.useTime = 7; + Item.useAnimation = 22; + Item.reuseDelay = 40; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 6f; + Item.knockBack = 5f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Counter++; + SoundStyle fire = new("CalamityMod/Sounds/Item/MagnaCannonShot"); + SoundEngine.PlaySound(fire with { Volume = 0.2f, Pitch = 0.95f }, position); + position = position + velocity.RotatedBy(-0.75f * player.direction) * 1.8f; + + Projectile.NewProjectile(source, position, velocity.RotatedByRandom(0.025f), type, (int)(damage * (1 + (Counter - 1) * 0.2)), knockback, player.whoAmI, 0f, Counter == 4 ? 1 : 0); + if (Counter >= 4) + Counter = 0; + + return false; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/WintersFury.cs b/Items/Weapons/Magic/WintersFury.cs index d4e6208375..8c1a8c58d7 100644 --- a/Items/Weapons/Magic/WintersFury.cs +++ b/Items/Weapons/Magic/WintersFury.cs @@ -30,11 +30,11 @@ namespace CalamityMod.Items.Weapons.Magic Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item9; - Item.scale = 0.9f; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (!Main.rand.NextBool(4)) diff --git a/Items/Weapons/Melee/AegisBlade.cs b/Items/Weapons/Melee/AegisBlade.cs index 1ca4dd98d6..f177d07fa5 100644 --- a/Items/Weapons/Melee/AegisBlade.cs +++ b/Items/Weapons/Melee/AegisBlade.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 72; Item.height = 72; - Item.scale = 1.2f; Item.damage = 152; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 16; diff --git a/Items/Weapons/Melee/Aftershock.cs b/Items/Weapons/Melee/Aftershock.cs index b9e2a5bc1e..11eee11eda 100644 --- a/Items/Weapons/Melee/Aftershock.cs +++ b/Items/Weapons/Melee/Aftershock.cs @@ -11,125 +11,45 @@ namespace CalamityMod.Items.Weapons.Melee public class Aftershock : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + internal const float ShootSpeed = 12f; + public override void SetDefaults() { Item.width = 54; Item.height = 58; Item.damage = 65; Item.DamageType = DamageClass.Melee; - Item.scale = 1.75f; Item.useTime = 28; Item.useAnimation = 28; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 7.5f; + Item.knockBack = 9f; Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.shootSpeed = 12f; + Item.shootSpeed = ShootSpeed; } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - var source = player.GetSource_ItemUse(Item); target.AddBuff(ModContent.BuffType(), 300); - float rockSpeed = Item.shootSpeed; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = (float)Main.mouseX - Main.screenPosition.X - realPlayerPos.X; - float mouseYDist = (float)Main.mouseY - Main.screenPosition.Y - realPlayerPos.Y; - if (player.gravDir == -1f) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = rockSpeed; - } - else - { - mouseDistance = rockSpeed / mouseDistance; - } - - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)100; - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = rockSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX4 = mouseXDist; - float speedY5 = mouseYDist + (float)Main.rand.Next(-10, 11) * 0.02f; + Vector2 destination = target.Center; + Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f)) + (Vector2.UnitX * Main.rand.Next(-160, 161)); + Vector2 velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed * Main.rand.NextFloat(0.9f, 1.1f); int rockDamage = player.CalcIntDamage(Item.damage); - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), rockDamage, hit.Knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); + Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity, ModContent.ProjectileType(), rockDamage, hit.Knockback, player.whoAmI, 0f, (float)Main.rand.Next(10), target.Center.Y); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { - var source = player.GetSource_ItemUse(Item); target.AddBuff(ModContent.BuffType(), 300); - float rockSpeed = Item.shootSpeed; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = (float)Main.mouseX - Main.screenPosition.X - realPlayerPos.X; - float mouseYDist = (float)Main.mouseY - Main.screenPosition.Y - realPlayerPos.Y; - if (player.gravDir == -1f) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = rockSpeed; - } - else - { - mouseDistance = rockSpeed / mouseDistance; - } - - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)100; - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = rockSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX4 = mouseXDist; - float speedY5 = mouseYDist + (float)Main.rand.Next(-10, 11) * 0.02f; + Vector2 destination = target.Center; + Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f)) + (Vector2.UnitX * Main.rand.Next(-160, 161)); + Vector2 velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed * Main.rand.NextFloat(0.9f, 1.1f); int rockDamage = player.CalcIntDamage(Item.damage); - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), rockDamage, Item.knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Sand); - } + Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity, ModContent.ProjectileType(), rockDamage, Item.knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10), target.Center.Y); } } } diff --git a/Items/Weapons/Melee/AstralBlade.cs b/Items/Weapons/Melee/AstralBlade.cs index 7c474f3bfb..fb197a95f6 100644 --- a/Items/Weapons/Melee/AstralBlade.cs +++ b/Items/Weapons/Melee/AstralBlade.cs @@ -16,14 +16,13 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 80; Item.height = 80; - Item.damage = 85; + Item.damage = 125; Item.DamageType = DamageClass.Melee; - Item.scale = 1.5f; Item.useTime = 12; Item.useAnimation = 12; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 4f; + Item.knockBack = 6f; Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item1; @@ -33,15 +32,9 @@ namespace CalamityMod.Items.Weapons.Melee // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 25; - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 300); - } + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 300); - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 300); - } + public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) => target.AddBuff(ModContent.BuffType(), 300); public override void MeleeEffects(Player player, Rectangle hitbox) { @@ -49,9 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee { Dust d = CalamityUtils.MeleeDustHelper(player, Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType(), 0.7f, 55, 110, -0.07f, 0.07f); if (d != null) - { d.customData = 0.03f; - } } } @@ -62,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Melee return; float lifeRatio = MathHelper.Clamp(target.life / (float)target.lifeMax, 0f, 1f); - float multiplier = MathHelper.Lerp(1f, 2f, lifeRatio); + float multiplier = MathHelper.Lerp(1f, 1.25f, lifeRatio); modifiers.SourceDamage *= multiplier; modifiers.Knockback *= multiplier; @@ -70,21 +61,19 @@ namespace CalamityMod.Items.Weapons.Melee if (Main.rand.NextBool((int)MathHelper.Clamp((Item.crit + player.GetCritChance()) * multiplier, 0f, 99f), 100)) modifiers.SetCrit(); - if (multiplier > 1.5f) + SoundEngine.PlaySound(SoundID.Item105, player.Center); + + bool blue = Main.rand.NextBool(); + float angleStart = Main.rand.NextFloat(0f, MathHelper.TwoPi); + float var = 0.05f + (1.25f - multiplier); + for (float angle = 0f; angle < MathHelper.TwoPi; angle += var) { - SoundEngine.PlaySound(SoundID.Item105, player.Center); - bool blue = Main.rand.NextBool(); - float angleStart = Main.rand.NextFloat(0f, MathHelper.TwoPi); - float var = 0.05f + (2f - multiplier); - for (float angle = 0f; angle < MathHelper.TwoPi; angle += var) - { - blue = !blue; - Vector2 velocity = angle.ToRotationVector2() * (2f + (float)(Math.Sin(angleStart + angle * 3f) + 1) * 2.5f) * Main.rand.NextFloat(0.95f, 1.05f); - Dust d = Dust.NewDustPerfect(target.Center, blue ? ModContent.DustType() : ModContent.DustType(), velocity); - d.customData = 0.025f; - d.scale = multiplier - 0.75f; - d.noLight = false; - } + blue = !blue; + Vector2 velocity = angle.ToRotationVector2() * (2f + (float)(Math.Sin(angleStart + angle * 3f) + 1) * 2.5f) * Main.rand.NextFloat(0.95f, 1.05f); + Dust d = Dust.NewDustPerfect(target.Center, blue ? ModContent.DustType() : ModContent.DustType(), velocity); + d.customData = 0.025f; + d.scale = multiplier; + d.noLight = false; } } diff --git a/Items/Weapons/Melee/Avalanche.cs b/Items/Weapons/Melee/Avalanche.cs index 51711fcaf3..cdb892af1a 100644 --- a/Items/Weapons/Melee/Avalanche.cs +++ b/Items/Weapons/Melee/Avalanche.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 64; Item.height = 64; - Item.scale = 1.5f; Item.damage = 100; Item.DamageType = DamageClass.Melee; Item.useAnimation = 35; @@ -43,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee for (int k = 0; k < totalProjectiles; k++) { Vector2 projRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(source, target.Center, projRotation, type, bombDamage, hit.Knockback, Main.myPlayer); + Projectile.NewProjectile(source, target.Center, projRotation, type, bombDamage, hit.Knockback * 0.5f, Main.myPlayer); } } diff --git a/Items/Weapons/Melee/BalefulHarvester.cs b/Items/Weapons/Melee/BalefulHarvester.cs index 485cfe5275..e402c60293 100644 --- a/Items/Weapons/Melee/BalefulHarvester.cs +++ b/Items/Weapons/Melee/BalefulHarvester.cs @@ -9,12 +9,12 @@ namespace CalamityMod.Items.Weapons.Melee public class BalefulHarvester : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { Item.width = 74; Item.height = 86; - Item.damage = 90; - Item.scale = 1.5f; + Item.damage = 135; Item.DamageType = DamageClass.Melee; Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Swing; @@ -26,17 +26,18 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.Rarity10BuyPrice; Item.rare = ItemRarityID.Red; } + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ProjectileID.FlamingJack; - CalamityPlayer.HorsemansBladeOnHit(player, target.whoAmI, (int)(Item.damage * 1.5f), Item.knockBack, 0, type); + CalamityPlayer.HorsemansBladeOnHit(player, target.whoAmI, (int)(Item.damage * 0.8f), Item.knockBack * 0.5f, 0, type); target.AddBuff(BuffID.OnFire3, 300); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ProjectileID.FlamingJack; - CalamityPlayer.HorsemansBladeOnHit(player, -1, (int)(Item.damage * 1.5f), Item.knockBack, 0, type); + CalamityPlayer.HorsemansBladeOnHit(player, -1, (int)(Item.damage * 0.8f), Item.knockBack * 0.5f, 0, type); target.AddBuff(BuffID.OnFire3, 300); } diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index a0cc632ece..8250374d65 100644 --- a/Items/Weapons/Melee/Basher.cs +++ b/Items/Weapons/Melee/Basher.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 56; Item.height = 60; Item.damage = 41; - Item.scale = 1.15f; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 40; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Melee/BlightedCleaver.cs b/Items/Weapons/Melee/BlightedCleaver.cs index 42615548b9..e11a064398 100644 --- a/Items/Weapons/Melee/BlightedCleaver.cs +++ b/Items/Weapons/Melee/BlightedCleaver.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,43 +12,78 @@ namespace CalamityMod.Items.Weapons.Melee public class BlightedCleaver : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { Item.width = 88; Item.height = 88; - Item.damage = 64; + Item.damage = 86; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 26; + Item.useAnimation = Item.useTime = 28; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 26; Item.useTurn = true; - Item.knockBack = 5.5f; + Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; + Item.shootsEveryUse = true; Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 16f; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + float adjustedItemScale = player.GetAdjustedItemScale(Item); + Projectile.NewProjectile(source, player.MountedCenter, velocity, type, (int)(damage * 0.75), knockback * 0.5f, player.whoAmI, (float)player.direction * player.gravDir, 32f, adjustedItemScale); + NetMessage.SendData(MessageID.PlayerControls, -1, -1, null, player.whoAmI); + return false; } public override void MeleeEffects(Player player, Rectangle hitbox) { - if (Main.rand.NextBool(5)) + if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.RuneWizard); + int dustType = DustID.Venom; + switch (Main.rand.Next(5)) + { + default: + case 0: + case 1: + break; + + case 2: + dustType = DustID.RedTorch; + break; + + case 3: + dustType = DustID.CrimsonTorch; + break; + + case 4: + dustType = DustID.GreenFairy; + break; + } + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustType, 0f, 0f, 100, default, Main.rand.NextFloat(1.8f, 2.4f)); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + if (dustType == DustID.Venom) + Main.dust[dust].fadeIn = 1.5f; } } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { player.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(BuffID.Venom, 150); + target.AddBuff(BuffID.Venom, 240); + target.AddBuff(BuffID.OnFire3, 240); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { player.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(BuffID.Venom, 150); + target.AddBuff(BuffID.Venom, 240); + target.AddBuff(BuffID.OnFire3, 240); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/BrimstoneSword.cs b/Items/Weapons/Melee/BrimstoneSword.cs index bcbd6f85c6..89f84a06bc 100644 --- a/Items/Weapons/Melee/BrimstoneSword.cs +++ b/Items/Weapons/Melee/BrimstoneSword.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = Item.height = 52; Item.damage = 70; Item.DamageType = DamageClass.Melee; - Item.scale = 1.5f; Item.useAnimation = Item.useTime = 28; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Melee/Carnage.cs b/Items/Weapons/Melee/Carnage.cs index 3f2ebaa946..656aca236b 100644 --- a/Items/Weapons/Melee/Carnage.cs +++ b/Items/Weapons/Melee/Carnage.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.useTurn = true; - Item.scale = 1.25f; Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; } diff --git a/Items/Weapons/Melee/CometQuasher.cs b/Items/Weapons/Melee/CometQuasher.cs index a31d62dcba..21c2480660 100644 --- a/Items/Weapons/Melee/CometQuasher.cs +++ b/Items/Weapons/Melee/CometQuasher.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Dusts; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -10,12 +11,16 @@ namespace CalamityMod.Items.Weapons.Melee public class CometQuasher : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + internal const float ShootSpeed = 9f; + + internal const int TotalMeteors = 2; + public override void SetDefaults() { Item.width = 46; Item.height = 62; - Item.scale = 1.5f; - Item.damage = 141; + Item.damage = 134; Item.DamageType = DamageClass.Melee; Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Swing; @@ -26,104 +31,50 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; - Item.shootSpeed = 9f; + Item.shootSpeed = ShootSpeed; } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - var source = player.GetSource_ItemUse(Item); - float cometSpeed = Item.shootSpeed; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - float mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (player.gravDir == -1f) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = cometSpeed; - } - else - { - mouseDistance = cometSpeed / mouseDistance; - } + Vector2 destination = target.Center; + Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f)); + Vector2 cachedPosition = position; - for (int i = 0; i < 2; i++) + Vector2 velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed; + Vector2 cachedVelocity = velocity; + + int meteorDamage = player.CalcIntDamage((int)(Item.damage * 0.5)); + float meteorKnockback = Item.knockBack * 0.5f; + for (int i = 0; i < TotalMeteors; i++) { - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)(100 * i); - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X + (float)Main.rand.Next(-40, 41) * 0.03f; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = cometSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float cometSpawnXOffset = mouseXDist; - float cometSpawnYOffset = mouseYDist + (float)Main.rand.Next(-40, 41) * 0.02f; - int proj = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, cometSpawnXOffset * 0.75f, cometSpawnYOffset * 0.75f, ModContent.ProjectileType(), (int)(Item.damage * 0.5f), Item.knockBack, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); + position += Vector2.UnitX * Main.rand.Next(-320, 321); + velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed * Main.rand.NextFloat(0.9f, 1.1f); + int proj = Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity, ModContent.ProjectileType(), meteorDamage, meteorKnockback, player.whoAmI, 0f, 0.5f + Main.rand.NextFloat() * 0.3f, target.Center.Y); Main.projectile[proj].Calamity().lineColor = Main.rand.Next(3); + position = cachedPosition; + velocity = cachedVelocity; } } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { - var source = player.GetSource_ItemUse(Item); - float cometSpeed = Item.shootSpeed; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - float mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (player.gravDir == -1f) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = cometSpeed; - } - else - { - mouseDistance = cometSpeed / mouseDistance; - } + Vector2 destination = target.Center; + Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f)); + Vector2 cachedPosition = position; - for (int i = 0; i < 2; i++) + Vector2 velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed; + Vector2 cachedVelocity = velocity; + + int meteorDamage = player.CalcIntDamage((int)(Item.damage * 0.5)); + float meteorKnockback = Item.knockBack * 0.5f; + for (int i = 0; i < TotalMeteors; i++) { - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)(100 * i); - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X + (float)Main.rand.Next(-40, 41) * 0.03f; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = cometSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float cometSpawnXOffset = mouseXDist; - float cometSpawnYOffset = mouseYDist + (float)Main.rand.Next(-40, 41) * 0.02f; - int proj = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, cometSpawnXOffset * 0.75f, cometSpawnYOffset * 0.75f, ModContent.ProjectileType(), (int)(Item.damage * 0.5f), Item.knockBack, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); + position += Vector2.UnitX * Main.rand.Next(-320, 321); + velocity *= Main.rand.NextFloat(0.9f, 1.1f); + int proj = Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity, ModContent.ProjectileType(), meteorDamage, meteorKnockback, player.whoAmI, 0f, 0.5f + Main.rand.NextFloat() * 0.3f, target.Center.Y); Main.projectile[proj].Calamity().lineColor = Main.rand.Next(3); + position = cachedPosition; + velocity = cachedVelocity; } } @@ -131,7 +82,8 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(3)) { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Torch); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool() ? DustID.Torch : (int)CalamityDusts.Ectoplasm, 0f, 0f, 0, default, Main.rand.NextFloat(1.5f, 2.5f)); + Main.dust[dust].noGravity = true; } } diff --git a/Items/Weapons/Melee/DarklightGreatsword.cs b/Items/Weapons/Melee/DarklightGreatsword.cs index b5b10c65bc..f1aad0e4bf 100644 --- a/Items/Weapons/Melee/DarklightGreatsword.cs +++ b/Items/Weapons/Melee/DarklightGreatsword.cs @@ -11,6 +11,19 @@ namespace CalamityMod.Items.Weapons.Melee public class DarklightGreatsword : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + internal const float ShootSpeed = 2f; + + internal const float ProjectileDamageMultiplier = 0.8f; + + internal const float TrueMeleeSlashProjectileDamageMultiplier = 0.8f; + + internal const float SlashProjectileDamageMultiplier = 0.4125f; // Makes them do 33% damage since main projectile does 80% damage + + internal const int SlashProjectileLimit = 4; + + internal const int SlashCreationRate = 18; + public override void SetDefaults() { Item.width = 92; @@ -20,37 +33,43 @@ namespace CalamityMod.Items.Weapons.Melee Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; - Item.knockBack = 5; + Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 25f; + Item.shootSpeed = ShootSpeed; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - type = Main.rand.NextBool() ? type : ModContent.ProjectileType(); - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, (int)(damage * 0.8), knockback, player.whoAmI); - return false; - } + Vector2 offset = new Vector2(Item.width * 0.25f * -player.direction, Item.height * 0.25f); + if (player.gravDir == 1f) + position -= offset; + else + position += offset; - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.WaterCandle); + velocity = (Main.MouseWorld - position).SafeNormalize(Vector2.UnitY) * ShootSpeed; + type = Main.rand.NextBool() ? type : ModContent.ProjectileType(); + Projectile.NewProjectile(source, position, velocity, type, (int)(damage * ProjectileDamageMultiplier), knockback * ProjectileDamageMultiplier, player.whoAmI); + return false; } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.Frostburn2, 180); + target.AddBuff(Main.rand.NextBool() ? BuffID.Frostburn2 : BuffID.OnFire3, 240); + int slashCreatorID = ModContent.ProjectileType(); + int slashDamage = (int)(player.CalcIntDamage(Item.damage) * TrueMeleeSlashProjectileDamageMultiplier); + float slashKnockback = Item.knockBack * TrueMeleeSlashProjectileDamageMultiplier; + if (player.ownedProjectileCounts[slashCreatorID] < SlashProjectileLimit) + { + Projectile.NewProjectile(player.GetSource_ItemUse(Item), target.Center, Vector2.Zero, slashCreatorID, slashDamage, slashKnockback, player.whoAmI, target.whoAmI, player.itemRotation, Main.rand.Next(2)); + player.ownedProjectileCounts[slashCreatorID]++; + } } - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(BuffID.Frostburn2, 180); - } + public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) => target.AddBuff(Main.rand.NextBool() ? BuffID.Frostburn2 : BuffID.OnFire3, 240); public override void AddRecipes() { diff --git a/Items/Weapons/Melee/DefiledGreatsword.cs b/Items/Weapons/Melee/DefiledGreatsword.cs index 1bb5f0206e..402654d4b3 100644 --- a/Items/Weapons/Melee/DefiledGreatsword.cs +++ b/Items/Weapons/Melee/DefiledGreatsword.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee public class DefiledGreatsword : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { Item.width = 102; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 18; Item.useTurn = true; - Item.knockBack = 7.5f; + Item.knockBack = 9f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity12BuyPrice; diff --git a/Items/Weapons/Melee/Earth.cs b/Items/Weapons/Melee/Earth.cs index 155b6a046e..8ca2099e40 100644 --- a/Items/Weapons/Melee/Earth.cs +++ b/Items/Weapons/Melee/Earth.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 92; Item.height = 104; - Item.scale = 1.5f; Item.damage = 170; Item.DamageType = DamageClass.Melee; Item.useAnimation = 16; @@ -85,12 +84,15 @@ namespace CalamityMod.Items.Weapons.Melee if (target.Calamity().miscDefenseLoss < target.defense) target.Calamity().miscDefenseLoss += 1; - if (!target.canGhostHeal || player.moonLeech) + if (player.moonLeech || player.lifeSteal <= 0f || target.lifeMax <= 5) return; - int heal = Main.rand.Next(1, 69); + int heal = Main.rand.Next(1, 70); + player.lifeSteal -= heal; player.statLife += heal; player.HealEffect(heal); + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) @@ -141,12 +143,15 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), earthDamage, Item.knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); } - if (player.moonLeech) + if (player.moonLeech || player.lifeSteal <= 0f) return; - int heal = Main.rand.Next(1, 69); + int heal = Main.rand.Next(1, 70); + player.lifeSteal -= heal; player.statLife += heal; player.HealEffect(heal); + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/EssenceFlayer.cs b/Items/Weapons/Melee/EssenceFlayer.cs index 5e7c55a483..790801310d 100644 --- a/Items/Weapons/Melee/EssenceFlayer.cs +++ b/Items/Weapons/Melee/EssenceFlayer.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee public class EssenceFlayer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { Item.width = 100; @@ -43,6 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee if (Main.rand.NextBool(3)) { int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.ShadowbeamStaff); + Main.dust[dust].velocity *= 0f; } } diff --git a/Items/Weapons/Melee/EvilSmasher.cs b/Items/Weapons/Melee/EvilSmasher.cs index a19b3fe756..c4addba714 100644 --- a/Items/Weapons/Melee/EvilSmasher.cs +++ b/Items/Weapons/Melee/EvilSmasher.cs @@ -11,7 +11,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 64; Item.height = 66; - Item.scale = 2f; Item.damage = 120; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 38; diff --git a/Items/Weapons/Melee/ExaltedOathblade.cs b/Items/Weapons/Melee/ExaltedOathblade.cs index e89b2d8a86..5f5732f244 100644 --- a/Items/Weapons/Melee/ExaltedOathblade.cs +++ b/Items/Weapons/Melee/ExaltedOathblade.cs @@ -15,6 +15,9 @@ namespace CalamityMod.Items.Weapons.Melee public class ExaltedOathblade : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + internal const float ShootSpeed = 3f; + public override void SetDefaults() { Item.width = 88; @@ -31,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 3f; + Item.shootSpeed = ShootSpeed; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -40,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee for (int i = -index; i <= index; i += index) { Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(source, position, perturbedSpeed, type, damage / 2, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, perturbedSpeed, type, damage / 2, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Melee/Exoblade.cs b/Items/Weapons/Melee/Exoblade.cs index ae333b095c..e950df77b2 100644 --- a/Items/Weapons/Melee/Exoblade.cs +++ b/Items/Weapons/Melee/Exoblade.cs @@ -24,10 +24,9 @@ namespace CalamityMod.Items.Weapons.Melee public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Item/ExobladeDash") { Volume = 0.6f }; public static readonly SoundStyle DashHitSound = new("CalamityMod/Sounds/Item/ExobladeDashImpact") { Volume = 0.85f }; - public static int BeamNoHomeTime = 24; - public static float NotTrueMeleeDamagePenalty = 0.46f; + public static float NotTrueMeleeDamagePenalty = 0.35f; public static float ExplosionDamageFactor = 1.8f; @@ -50,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Melee public static int DashTime = 49; public static int BaseUseTime = 49; - public static int BeamsPerSwing = 3; + public static int BeamsPerSwing = 4; public override void SetDefaults() { diff --git a/Items/Weapons/Melee/Exoblade.png b/Items/Weapons/Melee/Exoblade.png index fcadbc5b37..ea819cc632 100644 Binary files a/Items/Weapons/Melee/Exoblade.png and b/Items/Weapons/Melee/Exoblade.png differ diff --git a/Items/Weapons/Melee/Floodtide.cs b/Items/Weapons/Melee/Floodtide.cs index 180fa7111b..dc281c7952 100644 --- a/Items/Weapons/Melee/Floodtide.cs +++ b/Items/Weapons/Melee/Floodtide.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 80; Item.height = 92; - Item.damage = 75; + Item.damage = 91; Item.DamageType = DamageClass.Melee; Item.useTime = 21; Item.useAnimation = 21; diff --git a/Items/Weapons/Melee/ForbiddenOathblade.cs b/Items/Weapons/Melee/ForbiddenOathblade.cs index 38ef21ca10..d30e2d07eb 100644 --- a/Items/Weapons/Melee/ForbiddenOathblade.cs +++ b/Items/Weapons/Melee/ForbiddenOathblade.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 74; Item.height = 74; - Item.scale = 1.5f; Item.damage = 110; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 55; diff --git a/Items/Weapons/Melee/GrandGuardian.cs b/Items/Weapons/Melee/GrandGuardian.cs index 01aec5f549..ec95d4853e 100644 --- a/Items/Weapons/Melee/GrandGuardian.cs +++ b/Items/Weapons/Melee/GrandGuardian.cs @@ -1,6 +1,7 @@ using CalamityMod.Projectiles.Healing; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +11,13 @@ namespace CalamityMod.Items.Weapons.Melee public class GrandGuardian : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + internal const int TotalHealOrbs = 3; + + internal const int HealPerOrb = 3; + + internal const int TotalHealed = TotalHealOrbs * HealPerOrb; + public override void SetDefaults() { Item.width = 130; @@ -28,9 +36,14 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 12f; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/GrandGuardianGlow").Value); + } + public override void UseStyle(Player player, Rectangle heldItemFrame) { - player.itemLocation += new Vector2(-32f * player.direction, 12f * player.gravDir).RotatedBy(player.itemRotation); + player.itemLocation += new Vector2(-12f * player.direction, 2f * player.gravDir).RotatedBy(player.itemRotation); } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) @@ -38,13 +51,20 @@ namespace CalamityMod.Items.Weapons.Melee if (target.Calamity().miscDefenseLoss < target.defense) target.Calamity().miscDefenseLoss += 1; - if (target.Calamity().miscDefenseLoss >= target.defense && target.canGhostHeal && !player.moonLeech) - { - player.statLife += 4; - player.HealEffect(4); - } - OnHitEffects(player, target.Center, target.life, target.lifeMax, Item.knockBack, Item.damage); + + if (target.Calamity().miscDefenseLoss >= target.defense) + { + if (player.moonLeech || player.lifeSteal <= 0f || target.lifeMax <= 5) + return; + + int heal = 6; + player.lifeSteal -= heal; + player.statLife += heal; + player.HealEffect(heal); + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; + } } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) @@ -65,31 +85,27 @@ namespace CalamityMod.Items.Weapons.Melee if (targetLife <= (targetMaxLife * 0.5f) && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3) { - float randomSpeedX = Main.rand.Next(6, 13); - float randomSpeedY = Main.rand.Next(6, 13); + float randomSpeedX = Main.rand.NextFloat(6f, 12f); + float randomSpeedY = Main.rand.NextFloat(6f, 12f); Projectile.NewProjectile(source, targetPos.X, targetPos.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), rainBoltDamage, knockback, player.whoAmI); Projectile.NewProjectile(source, targetPos.X, targetPos.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), rainBoltDamage, knockback, player.whoAmI); Projectile.NewProjectile(source, targetPos.X, targetPos.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), rainBoltDamage, knockback, player.whoAmI); } - if (targetLife <= 0 && !player.moonLeech && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3) + + if (player.moonLeech || player.lifeSteal <= 0f) + return; + + if (targetLife <= 0 && !player.moonLeech && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3 && targetMaxLife > 5) { - float randomSpeedX = Main.rand.Next(3, 7); - float randomSpeedY = Main.rand.Next(3, 7); + player.lifeSteal -= TotalHealed; + float randomSpeedX = Main.rand.NextFloat(3f, 4.5f); + float randomSpeedY = Main.rand.NextFloat(3f, 4.5f); Projectile.NewProjectile(source, targetPos.X, targetPos.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); Projectile.NewProjectile(source, targetPos.X, targetPos.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); Projectile.NewProjectile(source, targetPos.X, targetPos.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); } } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[dust].noGravity = true; - } - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/GrandGuardian.png b/Items/Weapons/Melee/GrandGuardian.png index fc6194f528..804a2b30f9 100644 Binary files a/Items/Weapons/Melee/GrandGuardian.png and b/Items/Weapons/Melee/GrandGuardian.png differ diff --git a/Items/Weapons/Melee/GrandGuardianGlow.png b/Items/Weapons/Melee/GrandGuardianGlow.png new file mode 100644 index 0000000000..7b6f39623c Binary files /dev/null and b/Items/Weapons/Melee/GrandGuardianGlow.png differ diff --git a/Items/Weapons/Melee/GreatswordofJudgementGlow.png b/Items/Weapons/Melee/GreatswordofJudgementGlow.png new file mode 100644 index 0000000000..fde78a59ec Binary files /dev/null and b/Items/Weapons/Melee/GreatswordofJudgementGlow.png differ diff --git a/Items/Weapons/Melee/Greentide.cs b/Items/Weapons/Melee/Greentide.cs index 4c79d66794..c105558f9e 100644 --- a/Items/Weapons/Melee/Greentide.cs +++ b/Items/Weapons/Melee/Greentide.cs @@ -10,146 +10,143 @@ namespace CalamityMod.Items.Weapons.Melee public class Greentide : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + internal const float ShootSpeed = 32f; + + internal const float TeethSpread = 960f; + + internal const float HalvedTeethSpread = TeethSpread * 0.5f; + + internal const int TotalRows = 2; + + internal const int TotalTeeth = 5; + public override void SetDefaults() { Item.width = 62; Item.height = 62; - Item.damage = 95; + Item.damage = 87; // IS THAT THE BITE OF '87 Item.DamageType = DamageClass.Melee; - Item.scale = 1.5f; - Item.useTime = 24; - Item.useAnimation = 24; + Item.useTime = 31; + Item.useAnimation = 31; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 7; + Item.knockBack = 7f; Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.shootSpeed = 18f; + Item.shootSpeed = ShootSpeed; } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - var source = player.GetSource_ItemUse(Item); - int i = Main.myPlayer; - float projSpeed = Item.shootSpeed; - float playerKnockback = hit.Knockback; - playerKnockback = player.GetWeaponKnockback(Item, playerKnockback); - player.itemTime = Item.useTime; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = (float)Main.mouseX - Main.screenPosition.X - realPlayerPos.X; - float mouseYDist = (float)Main.mouseY - Main.screenPosition.Y - realPlayerPos.Y; - if (player.gravDir == -1f) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = projSpeed; - } - else - { - mouseDistance = projSpeed / mouseDistance; - } + Vector2 destination = target.Center; - for (int j = 0; j < 3; j++) + Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f)); + Vector2 cachedPosition = position; + Vector2 secondPosition = cachedPosition + (Vector2.UnitY * (Main.screenHeight + 160f)); + Vector2 secondCachedPosition = secondPosition; + + Vector2 velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed; + Vector2 cachedVelocity = velocity; + Vector2 secondVelocity = (destination - secondPosition).SafeNormalize(Vector2.UnitY) * ShootSpeed; + Vector2 secondCachedVelocity = secondVelocity; + + int teethDamage = player.CalcIntDamage((int)(Item.damage * 0.5)); + float teethKnockback = Item.knockBack * 0.2f; + bool evenNumberOfProjectiles = TotalTeeth % 2 == 0; + float amountToAdd = evenNumberOfProjectiles ? 0.5f : 0f; + int centralProjectile = TotalTeeth / 2; + int otherCentralProjectile = centralProjectile - 1; + float teethXVelocityReduction = 0.9f; + float minVelocityAdjustment = 0.8f; + float maxVelocityAdjustment = 1f; + float velocityAdjustment = minVelocityAdjustment; + for (int i = 0; i < TotalRows; i++) { - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)(100 * j); - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) + bool topTeeth = i == 0; + for (int j = 0; j < TotalTeeth; j++) { - mouseYDist *= -1f; + velocityAdjustment = ((j == centralProjectile || j == otherCentralProjectile) && evenNumberOfProjectiles) ? minVelocityAdjustment : MathHelper.Lerp(minVelocityAdjustment, maxVelocityAdjustment, Math.Abs((j + amountToAdd) - centralProjectile) / (float)centralProjectile); + if (topTeeth) + { + position.X += MathHelper.Lerp(-HalvedTeethSpread, HalvedTeethSpread, j / (float)(TotalTeeth - 1)); + velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(position, target, ShootSpeed, 1) * velocityAdjustment; + velocity.X *= teethXVelocityReduction; + Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity, ModContent.ProjectileType(), teethDamage, teethKnockback, player.whoAmI, 0f, i, target.Center.Y); + position = cachedPosition; + velocity = cachedVelocity; + } + else + { + secondPosition.X += MathHelper.Lerp(-HalvedTeethSpread, HalvedTeethSpread, j / (float)(TotalTeeth - 1)); + secondVelocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(secondPosition, target, ShootSpeed, 1) * velocityAdjustment; + secondVelocity.X *= teethXVelocityReduction; + Projectile.NewProjectile(player.GetSource_ItemUse(Item), secondPosition, secondVelocity, ModContent.ProjectileType(), teethDamage, teethKnockback, player.whoAmI, 0f, i, target.Center.Y); + secondPosition = secondCachedPosition; + secondVelocity = secondCachedVelocity; + } } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = projSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX4 = mouseXDist; - float speedY5 = mouseYDist + (float)Main.rand.Next(-180, 181) * 0.02f; - int greenWaterDamage = player.CalcIntDamage(Item.damage); - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), greenWaterDamage, playerKnockback, i, 0f, (float)Main.rand.Next(10)); } } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { - var source = player.GetSource_ItemUse(Item); - int i = Main.myPlayer; - float projSpeed = Item.shootSpeed; - float playerKnockback = Item.knockBack; - playerKnockback = player.GetWeaponKnockback(Item, playerKnockback); - player.itemTime = Item.useTime; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = (float)Main.mouseX - Main.screenPosition.X - realPlayerPos.X; - float mouseYDist = (float)Main.mouseY - Main.screenPosition.Y - realPlayerPos.Y; - if (player.gravDir == -1f) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = projSpeed; - } - else - { - mouseDistance = projSpeed / mouseDistance; - } + Vector2 destination = target.Center; - for (int j = 0; j < 4; j++) + Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f)); + Vector2 cachedPosition = position; + Vector2 secondPosition = cachedPosition + (Vector2.UnitY * (Main.screenHeight + 160f)); + Vector2 secondCachedPosition = secondPosition; + + Vector2 velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed; + Vector2 cachedVelocity = velocity; + Vector2 secondVelocity = (destination - secondPosition).SafeNormalize(Vector2.UnitY) * ShootSpeed; + Vector2 secondCachedVelocity = secondVelocity; + + int teethDamage = player.CalcIntDamage((int)(Item.damage * 0.5)); + float teethKnockback = Item.knockBack * 0.2f; + bool evenNumberOfProjectiles = TotalTeeth % 2 == 0; + float amountToAdd = evenNumberOfProjectiles ? 0.5f : 0f; + int centralProjectile = TotalTeeth / 2; + int otherCentralProjectile = centralProjectile - 1; + float teethXVelocityReduction = 0.9f; + float minVelocityAdjustment = 0.8f; + float maxVelocityAdjustment = 1f; + float velocityAdjustment = minVelocityAdjustment; + for (int i = 0; i < TotalRows; i++) { - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)(100 * j); - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) + bool topTeeth = i == 0; + for (int j = 0; j < TotalTeeth; j++) { - mouseYDist *= -1f; + velocityAdjustment = ((j == centralProjectile || j == otherCentralProjectile) && evenNumberOfProjectiles) ? minVelocityAdjustment : MathHelper.Lerp(minVelocityAdjustment, maxVelocityAdjustment, Math.Abs((j + amountToAdd) - centralProjectile) / (float)centralProjectile); + if (topTeeth) + { + position.X += MathHelper.Lerp(-HalvedTeethSpread, HalvedTeethSpread, j / (float)(TotalTeeth - 1)); + velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(position, target, ShootSpeed, 1) * velocityAdjustment; + velocity.X *= teethXVelocityReduction; + Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity, ModContent.ProjectileType(), teethDamage, teethKnockback, player.whoAmI, 0f, i, target.Center.Y); + position = cachedPosition; + velocity = cachedVelocity; + } + else + { + secondPosition.X += MathHelper.Lerp(-HalvedTeethSpread, HalvedTeethSpread, j / (float)(TotalTeeth - 1)); + secondVelocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(secondPosition, target, ShootSpeed, 1) * velocityAdjustment; + secondVelocity.X *= teethXVelocityReduction; + Projectile.NewProjectile(player.GetSource_ItemUse(Item), secondPosition, secondVelocity, ModContent.ProjectileType(), teethDamage, teethKnockback, player.whoAmI, 0f, i, target.Center.Y); + secondPosition = secondCachedPosition; + secondVelocity = secondCachedVelocity; + } } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = projSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX4 = mouseXDist; - float speedY5 = mouseYDist + (float)Main.rand.Next(-180, 181) * 0.02f; - int greenWaterDamage = player.CalcIntDamage(Item.damage); - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), greenWaterDamage, playerKnockback, i, 0f, (float)Main.rand.Next(10)); } } public override void MeleeEffects(Player player, Rectangle hitbox) { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 33; - } - else - { - randomDust = 89; - } if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, randomDust); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool() ? 33 : 89); } } } diff --git a/Items/Weapons/Melee/Hellkite.cs b/Items/Weapons/Melee/Hellkite.cs index 8c65d6baa9..4eb4fbed99 100644 --- a/Items/Weapons/Melee/Hellkite.cs +++ b/Items/Weapons/Melee/Hellkite.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 84; Item.height = 84; - Item.scale = 1f; Item.damage = 180; Item.DamageType = DamageClass.Melee; Item.useTime = Item.useAnimation = 30; diff --git a/Items/Weapons/Melee/HolyCollider.cs b/Items/Weapons/Melee/HolyCollider.cs index a2b297703f..e47ddf751f 100644 --- a/Items/Weapons/Melee/HolyCollider.cs +++ b/Items/Weapons/Melee/HolyCollider.cs @@ -1,4 +1,5 @@ -using System; +using Microsoft.Xna.Framework; +using System; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Terraria; @@ -15,7 +16,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 94; Item.height = 80; - Item.scale = 1.5f; Item.damage = 270; Item.DamageType = DamageClass.Melee; Item.useAnimation = 22; @@ -31,6 +31,11 @@ namespace CalamityMod.Items.Weapons.Melee Item.rare = ModContent.RarityType(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation += new Vector2(5f * player.direction, 13f * player.gravDir).RotatedBy(player.itemRotation); + } + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { var source = player.GetSource_ItemUse(Item); diff --git a/Items/Weapons/Melee/HolyCollider.png b/Items/Weapons/Melee/HolyCollider.png index 5c4c4d5698..713bd1e425 100644 Binary files a/Items/Weapons/Melee/HolyCollider.png and b/Items/Weapons/Melee/HolyCollider.png differ diff --git a/Items/Weapons/Melee/IridescentExcalibur.cs b/Items/Weapons/Melee/IridescentExcalibur.cs index c1c7e8c7d6..8ec44a3f79 100644 --- a/Items/Weapons/Melee/IridescentExcalibur.cs +++ b/Items/Weapons/Melee/IridescentExcalibur.cs @@ -1,9 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -15,9 +18,16 @@ namespace CalamityMod.Items.Weapons.Melee public class IridescentExcalibur : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - private static int BaseDamage = 2000; + + private static int BaseDamage = 3000; + + private int MaxBeamTypes = 12; + private int BeamType = 0; - private const int alpha = 50; + + private const int Alpha = 100; + + private const float ShootSpeed = 16f; public override void SetStaticDefaults() { @@ -29,9 +39,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 112; Item.height = 112; Item.damage = BaseDamage; - Item.useAnimation = 14; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 14; Item.useTurn = true; Item.DamageType = DamageClass.Melee; Item.knockBack = 8f; @@ -39,19 +48,31 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity16BuyPrice; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 6f; + Item.shootSpeed = ShootSpeed; Item.rare = ModContent.RarityType(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation += new Vector2(-12f * player.direction, 2f * player.gravDir).RotatedBy(player.itemRotation); + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/IridescentExcaliburGlow").Value); + } + // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 10; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, (float)BeamType, 0f); + int proj = Projectile.NewProjectile(source, position, velocity, type, (int)Math.Round(damage * 0.5), knockback * 0.5f, player.whoAmI, (float)BeamType); + if (BeamType == 7) + Main.projectile[proj].penetrate = 3; BeamType++; - if (BeamType > 11) + if (BeamType >= MaxBeamTypes) BeamType = 0; return false; @@ -69,7 +90,7 @@ namespace CalamityMod.Items.Weapons.Melee else { Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = ShootSpeed; } return base.CanUseItem(player); @@ -89,77 +110,73 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { - if (Main.rand.NextBool(4)) + if (Main.rand.NextBool()) { - Color color = new Color(255, 0, 0, alpha); - switch (BeamType) + Color rainbowColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Alpha); + Color color = Color.White; + int dustChoice = player.altFunctionUse == 2 ? Main.rand.Next(12) : BeamType; + switch (dustChoice) { case 0: // Red + color = new Color(255, 0, 0, Alpha); break; case 1: // Orange - color = new Color(255, 128, 0, alpha); + color = new Color(255, 128, 0, Alpha); break; case 2: // Yellow - color = new Color(255, 255, 0, alpha); + color = new Color(255, 255, 0, Alpha); break; case 3: // Lime - color = new Color(128, 255, 0, alpha); + color = new Color(128, 255, 0, Alpha); break; case 4: // Green - color = new Color(0, 255, 0, alpha); + color = new Color(0, 255, 0, Alpha); break; case 5: // Turquoise - color = new Color(0, 255, 128, alpha); + color = new Color(0, 255, 128, Alpha); break; case 6: // Cyan - color = new Color(0, 255, 255, alpha); + color = new Color(0, 255, 255, Alpha); break; case 7: // Light Blue - color = new Color(0, 128, 255, alpha); + color = new Color(0, 128, 255, Alpha); break; case 8: // Blue - color = new Color(0, 0, 255, alpha); + color = new Color(0, 0, 255, Alpha); break; case 9: // Purple - color = new Color(128, 0, 255, alpha); + color = new Color(128, 0, 255, Alpha); break; case 10: // Fuschia - color = new Color(255, 0, 255, alpha); + color = new Color(255, 0, 255, Alpha); break; case 11: // Hot Pink - color = new Color(255, 0, 128, alpha); + color = new Color(255, 0, 128, Alpha); break; default: break; } - Dust swingDust = Main.dust[Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.RainbowMk2, 0f, 0f, alpha, color, 1.2f)]; - swingDust.noGravity = true; + Dust rainbow = Main.dust[Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.RainbowMk2)]; + rainbow.velocity *= 0f; + rainbow.color = Color.Lerp(rainbowColor, color, (float)Math.Sqrt((MathF.Cos(Main.GlobalTimeWrappedHourly / 60f) + 1f) * 0.5f)); + rainbow.color.A = 100; + rainbow.scale = Main.rand.NextFloat(1.2f, 1.6f); + rainbow.fadeIn = Main.rand.NextFloat(0.4f, 1f); + rainbow.noGravity = true; } } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 600); - - if (!target.canGhostHeal || player.moonLeech) - return; - - int healAmount = Main.rand.Next(3) + 10; - player.statLife += healAmount; - player.HealEffect(healAmount); + target.AddBuff(ModContent.BuffType(), 60); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { target.AddBuff(ModContent.BuffType(), 600); - - if (player.moonLeech) - return; - - int healAmount = Main.rand.Next(3) + 10; - player.statLife += healAmount; - player.HealEffect(healAmount); + target.AddBuff(ModContent.BuffType(), 60); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/IridescentExcaliburGlow.png b/Items/Weapons/Melee/IridescentExcaliburGlow.png new file mode 100644 index 0000000000..e122aef76b Binary files /dev/null and b/Items/Weapons/Melee/IridescentExcaliburGlow.png differ diff --git a/Items/Weapons/Melee/LifehuntScythe.cs b/Items/Weapons/Melee/LifehuntScythe.cs index b08c609830..2a7112e848 100644 --- a/Items/Weapons/Melee/LifehuntScythe.cs +++ b/Items/Weapons/Melee/LifehuntScythe.cs @@ -39,20 +39,28 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - if (!target.canGhostHeal || player.moonLeech) + if (player.moonLeech || player.lifeSteal <= 0f || target.lifeMax <= 5) return; - player.statLife += 5; - player.HealEffect(5); + int heal = 5; + player.lifeSteal -= heal; + player.statLife += heal; + player.HealEffect(heal); + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { - if (player.moonLeech) + if (player.moonLeech || player.lifeSteal <= 0f) return; - player.statLife += 5; - player.HealEffect(5); + int heal = 5; + player.lifeSteal -= heal; + player.statLife += heal; + player.HealEffect(heal); + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/LionHeart.cs b/Items/Weapons/Melee/LionHeart.cs index 8b865b3f51..d20a765175 100644 --- a/Items/Weapons/Melee/LionHeart.cs +++ b/Items/Weapons/Melee/LionHeart.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.damage = 323; Item.knockBack = 5.5f; - Item.scale = 1.5f; Item.useStyle = ItemUseStyleID.Swing; Item.useAnimation = 15; Item.useTime = 15; diff --git a/Items/Weapons/Melee/MajesticGuard.cs b/Items/Weapons/Melee/MajesticGuard.cs index e34384d53d..45ecf47f3b 100644 --- a/Items/Weapons/Melee/MajesticGuard.cs +++ b/Items/Weapons/Melee/MajesticGuard.cs @@ -1,4 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,11 +9,11 @@ namespace CalamityMod.Items.Weapons.Melee public class MajesticGuard : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { Item.width = 100; Item.height = 100; - Item.scale = 1.5f; Item.damage = 70; Item.DamageType = DamageClass.Melee; Item.useAnimation = 22; @@ -25,19 +27,27 @@ namespace CalamityMod.Items.Weapons.Melee Item.rare = ItemRarityID.Pink; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/MajesticGuardGlow").Value); + } + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { if (target.Calamity().miscDefenseLoss < target.defense) target.Calamity().miscDefenseLoss += 1; - // Healing effect does not trigger versus dummies - if (player.moonLeech) - return; - - if (target.Calamity().miscDefenseLoss >= target.defense && target.canGhostHeal) + if (target.Calamity().miscDefenseLoss >= target.defense) { - player.statLife += 3; - player.HealEffect(3); + if (player.moonLeech || player.lifeSteal <= 0f || target.lifeMax <= 5) + return; + + int heal = 3; + player.lifeSteal -= heal; + player.statLife += heal; + player.HealEffect(heal); + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; } } diff --git a/Items/Weapons/Melee/MajesticGuardGlow.png b/Items/Weapons/Melee/MajesticGuardGlow.png new file mode 100644 index 0000000000..61542093d6 Binary files /dev/null and b/Items/Weapons/Melee/MajesticGuardGlow.png differ diff --git a/Items/Weapons/Melee/MonstrousKnives.cs b/Items/Weapons/Melee/MonstrousKnives.cs index dfb6f8152e..36d7fc83df 100644 --- a/Items/Weapons/Melee/MonstrousKnives.cs +++ b/Items/Weapons/Melee/MonstrousKnives.cs @@ -43,6 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee { yDist = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - playerPos.Y; } + Vector2 vector = new Vector2(xDist, yDist); float speedMult = vector.Length(); if ((float.IsNaN(xDist) && float.IsNaN(yDist)) || (xDist == 0f && yDist == 0f)) @@ -55,25 +56,11 @@ namespace CalamityMod.Items.Weapons.Melee { speedMult = speed / speedMult; } + xDist *= speedMult; yDist *= speedMult; - int knifeAmt = 3; - if (Main.rand.NextBool()) - { - knifeAmt++; - } - if (Main.rand.NextBool(4)) - { - knifeAmt++; - } - if (Main.rand.NextBool(8)) - { - knifeAmt++; - } - if (Main.rand.NextBool(16)) - { - knifeAmt++; - } + + int knifeAmt = Main.rand.Next(4, 7); for (int i = 0; i < knifeAmt; i++) { float xVec = xDist; @@ -87,8 +74,9 @@ namespace CalamityMod.Items.Weapons.Melee xVec *= speedMult; yVec *= speedMult; directionToShoot = new Vector2(xVec, yVec); - Projectile.NewProjectile(source, playerPos, directionToShoot, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, playerPos, directionToShoot, type, damage, knockback, player.whoAmI); } + return false; } diff --git a/Items/Weapons/Melee/OrderbringerGlow.png b/Items/Weapons/Melee/OrderbringerGlow.png new file mode 100644 index 0000000000..8c6448103a Binary files /dev/null and b/Items/Weapons/Melee/OrderbringerGlow.png differ diff --git a/Items/Weapons/Melee/SeashineSword.cs b/Items/Weapons/Melee/SeashineSword.cs index fe7846627e..b163aa43fe 100644 --- a/Items/Weapons/Melee/SeashineSword.cs +++ b/Items/Weapons/Melee/SeashineSword.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Weapons.Melee public class SeashineSword : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { Item.CloneDefaults(ItemID.EnchantedSword); @@ -20,15 +21,11 @@ namespace CalamityMod.Items.Weapons.Melee Item.damage = 25; Item.DamageType = DamageClass.Melee; Item.value = CalamityGlobalItem.Rarity2BuyPrice; - Item.knockBack = 2; - Item.shootSpeed = 11; + Item.knockBack = 4f; + Item.shootSpeed = 12f; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item1; - } - - public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { - type = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/SoulEdge.cs b/Items/Weapons/Melee/SoulEdge.cs deleted file mode 100644 index bff0b53d47..0000000000 --- a/Items/Weapons/Melee/SoulEdge.cs +++ /dev/null @@ -1,63 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Rarities; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class SoulEdge : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Melee"; - public static readonly SoundStyle ProjectileDeathSound = SoundID.NPCDeath39 with { Volume = 0.5f }; - - public override void SetDefaults() - { - Item.width = 88; - Item.height = 88; - Item.damage = 210; - Item.DamageType = DamageClass.Melee; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 23; - Item.useAnimation = 23; - Item.useTurn = true; - Item.knockBack = 5.5f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; - - Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.rare = ModContent.RarityType(); - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - int numShots = 2; - for (int i = 0; i < numShots; ++i) - { - float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; - float ai1 = Main.rand.NextFloat() + 0.5f; - // TODO -- unchecked type addition math assumes we can guarantee load order - // this is extremely unsafe and if TML optimizes autoloading or asset loading it could fail - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, Main.rand.Next(type, type + 3), damage, knockback, player.whoAmI, 0.0f, ai1); - } - return false; - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 300); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 300); - } - } -} diff --git a/Items/Weapons/Melee/StellarStriker.cs b/Items/Weapons/Melee/StellarStriker.cs index 781b089410..355ea81026 100644 --- a/Items/Weapons/Melee/StellarStriker.cs +++ b/Items/Weapons/Melee/StellarStriker.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 90; Item.height = 100; - Item.scale = 1.6f; Item.damage = 450; Item.DamageType = DamageClass.Melee; Item.useAnimation = 25; diff --git a/Items/Weapons/Melee/TaintedBlade.cs b/Items/Weapons/Melee/TaintedBlade.cs index bdf18819d7..859d4e197c 100644 --- a/Items/Weapons/Melee/TaintedBlade.cs +++ b/Items/Weapons/Melee/TaintedBlade.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 46; Item.height = 46; Item.damage = 60; - Item.scale = 1.4f; Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useAnimation = 27; @@ -30,9 +29,11 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { - if (Main.rand.NextBool(5)) + if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.GreenFairy); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.GreenFairy, 0f, 0f, 100, default, Main.rand.NextFloat(1.5f, 2f)); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; } } diff --git a/Items/Weapons/Melee/TeardropCleaver.cs b/Items/Weapons/Melee/TeardropCleaver.cs index 977207ce44..5d1363b80c 100644 --- a/Items/Weapons/Melee/TeardropCleaver.cs +++ b/Items/Weapons/Melee/TeardropCleaver.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 5.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.scale = 1.1f; Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; } diff --git a/Items/Weapons/Melee/Terratomere.cs b/Items/Weapons/Melee/Terratomere.cs index ef3a255f8e..49a3407ab2 100644 --- a/Items/Weapons/Melee/Terratomere.cs +++ b/Items/Weapons/Melee/Terratomere.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Items.Weapons.Melee public class Terratomere : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - public const int SwingTime = 83; + public const int SwingTime = 54; - public const int SlashLifetime = 27; + public const int SlashLifetime = 135; public const int SmallSlashCreationRate = 9; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 60; Item.height = 66; - Item.damage = 370; + Item.damage = 145; Item.DamageType = DamageClass.Melee; Item.useAnimation = 21; Item.useTime = 21; diff --git a/Items/Weapons/Melee/TheDarkMaster.cs b/Items/Weapons/Melee/TheDarkMaster.cs index bf66cfdbe6..b72fd7aa9f 100644 --- a/Items/Weapons/Melee/TheDarkMaster.cs +++ b/Items/Weapons/Melee/TheDarkMaster.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Melee // only fire beams at max health if (player.statLife >= (player.statLifeMax2 * 0.75f)) { - SoundEngine.PlaySound(SoundID.Item71, player.position); + SoundEngine.PlaySound(SoundID.Item71, player.Center); // increase the beam's damage by the player's additional health starting from the vanilla maximum amount with just life crystals int baseMaxHealth = 400; int bonusHealth = player.statLifeMax2 - baseMaxHealth; @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Melee // still play the sound if the clones are out since they always fire beams else if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) { - SoundEngine.PlaySound(SoundID.Item71, player.position); + SoundEngine.PlaySound(SoundID.Item71, player.Center); } } else diff --git a/Items/Weapons/Melee/TheEnforcer.cs b/Items/Weapons/Melee/TheEnforcer.cs index 152ea92cb6..b027454e91 100644 --- a/Items/Weapons/Melee/TheEnforcer.cs +++ b/Items/Weapons/Melee/TheEnforcer.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 100; Item.height = 100; - Item.scale = 1.5f; Item.damage = 890; Item.DamageType = DamageClass.Melee; Item.useAnimation = 17; diff --git a/Items/Weapons/Melee/TheLastMourning.cs b/Items/Weapons/Melee/TheLastMourning.cs index 9a7680bbf6..fd454b75a5 100644 --- a/Items/Weapons/Melee/TheLastMourning.cs +++ b/Items/Weapons/Melee/TheLastMourning.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 94; Item.height = 94; - Item.scale = 1.5f; Item.DamageType = DamageClass.Melee; Item.damage = 360; Item.knockBack = 8.5f; diff --git a/Items/Weapons/Melee/TheMutilator.cs b/Items/Weapons/Melee/TheMutilator.cs index 6e363cc47f..8cdf99cdb0 100644 --- a/Items/Weapons/Melee/TheMutilator.cs +++ b/Items/Weapons/Melee/TheMutilator.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 90; Item.height = 90; - Item.scale = 1.5f; Item.damage = 483; Item.DamageType = DamageClass.Melee; Item.useAnimation = 18; @@ -34,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - if (target.life <= (target.lifeMax * 0.2f) && target.canGhostHeal) + if (target.life <= (target.lifeMax * 0.2f)) { if (!CalamityPlayer.areThereAnyDamnBosses || Main.rand.NextBool()) { diff --git a/Items/Weapons/Melee/TheObliterator.cs b/Items/Weapons/Melee/TheObliterator.cs index 356878287a..3dce956e41 100644 --- a/Items/Weapons/Melee/TheObliterator.cs +++ b/Items/Weapons/Melee/TheObliterator.cs @@ -1,5 +1,7 @@ -using CalamityMod.Projectiles.Melee.Yoyos; +using System.Collections.Generic; +using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -38,5 +40,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.rare = ModContent.RarityType(); } + public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); } } diff --git a/Items/Weapons/Melee/TitanArm.cs b/Items/Weapons/Melee/TitanArm.cs index ded9a8c852..22615f87ee 100644 --- a/Items/Weapons/Melee/TitanArm.cs +++ b/Items/Weapons/Melee/TitanArm.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 46; Item.height = 58; Item.damage = 69; - Item.scale = 1.75f; Item.knockBack = 80f; //This number doesn't mean anything, but it's not 9001f because that caused bugs. Item.useAnimation = Item.useTime = 12; Item.DamageType = DamageClass.Melee; diff --git a/Items/Weapons/Melee/TrueArkoftheAncients.cs b/Items/Weapons/Melee/TrueArkoftheAncients.cs index 9360bfe353..41fbdf6495 100644 --- a/Items/Weapons/Melee/TrueArkoftheAncients.cs +++ b/Items/Weapons/Melee/TrueArkoftheAncients.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public float Combo = 1f; public float Charge = 0f; - public static float chargeDamageMultiplier = 1.45f; //Extra damage from charge - public static float beamDamageMultiplier = 0.8f; //Damage multiplier for the charged shots (remember it applies ontop of the charge damage multiplied - public static float glassStarDamageMultiplier = 0.4f; //Damage multiplier for the glass stars it shoots (Shoots 3x glass stars when not charged, shoots 2x glass stars + one beam when charged) + public static float chargeDamageMultiplier = 1.25f; //Extra damage from charge + public static float beamDamageMultiplier = 1f; //Damage multiplier for the charged shots (remember it applies ontop of the charge damage multiplied + public static float glassStarDamageMultiplier = 0.6f; //Damage multiplier for the glass stars it shoots (Shoots 3x glass stars when not charged, shoots 2x glass stars + one beam when charged) public static float blastDamageMultiplier = 0.5f; //Damage multiplier applied ontop of the charge damage multiplier mutliplied by the amount of charges consumed. So if you consume 5 charges, the blast will get multiplied by 5 times the damage multiplier public static float blastFalloffSpeed = 0.1f; //How much the blast damage falls off as you hit more and more targets @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = Item.height = 72; - Item.damage = 188; + Item.damage = 194; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noUseGraphic = true; Item.noMelee = true; diff --git a/Items/Weapons/Melee/TrueCausticEdge.cs b/Items/Weapons/Melee/TrueCausticEdge.cs index 783e0a6f9f..a1422ff7ce 100644 --- a/Items/Weapons/Melee/TrueCausticEdge.cs +++ b/Items/Weapons/Melee/TrueCausticEdge.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Weapons.Melee public class TrueCausticEdge : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { Item.width = 64; @@ -21,28 +22,37 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 28; Item.useTurn = true; - Item.knockBack = 5.75f; + Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.shootSpeed = 12f; } - public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => damage = (int)(damage * 0.75); + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) + { + damage = (int)(damage * 0.75); + knockback *= 0.5f; + } public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.GreenFairy); + int dustType = Main.rand.NextBool() ? DustID.GreenFairy : DustID.Venom; + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustType, 0f, 0f, 100, default, Main.rand.NextFloat(1.8f, 2.4f)); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + if (dustType == DustID.Venom) + Main.dust[dust].fadeIn = 1.5f; } } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 150); + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 180); - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) => target.AddBuff(BuffID.Venom, 150); + public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) => target.AddBuff(BuffID.Venom, 180); public override void AddRecipes() { diff --git a/Items/Weapons/Melee/UltimusCleaver.cs b/Items/Weapons/Melee/UltimusCleaver.cs index 634bdbd8a8..4b04a43483 100644 --- a/Items/Weapons/Melee/UltimusCleaver.cs +++ b/Items/Weapons/Melee/UltimusCleaver.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.rare = ItemRarityID.Yellow; - Item.scale = 1.5f; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Melee/VoidEdge.cs b/Items/Weapons/Melee/VoidEdge.cs new file mode 100644 index 0000000000..f9e5e1e038 --- /dev/null +++ b/Items/Weapons/Melee/VoidEdge.cs @@ -0,0 +1,110 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + [LegacyName("SoulEdge")] + public class VoidEdge : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static readonly SoundStyle ProjectileDeathSound = SoundID.Item100 with { Volume = 0.5f }; + + internal const int TotalProjectilesPerSwing = 3; + + internal const int ProjectileSpreadOutTime = 20; + + internal const float ShootSpeed = 10f; + + internal const float SmallSoulStatMultiplier = 0.8f; + + internal const float MediumSoulStatMultiplier = 0.9f; + + public override void SetDefaults() + { + Item.width = 88; + Item.height = 88; + Item.damage = 210; + Item.DamageType = DamageClass.Melee; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 24; + Item.useAnimation = 24; + Item.useTurn = true; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = ShootSpeed; + + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.rare = ModContent.RarityType(); + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + int numShots = TotalProjectilesPerSwing; + for (int i = 0; i < numShots; i++) + { + velocity = velocity.RotatedByRandom(0.35) * Main.rand.NextFloat(0.9f, 1.1f); + float ai1 = MathHelper.Lerp(0.75f, 1.25f, Main.rand.NextFloat()); + switch (i) + { + default: + case 0: + break; + + case 1: + type = ModContent.ProjectileType(); + knockback *= MediumSoulStatMultiplier; + break; + + case 2: + type = ModContent.ProjectileType(); + knockback *= SmallSoulStatMultiplier; + break; + } + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, ai1); + Main.projectile[proj].netUpdate = true; + } + return false; + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool()) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 66, 0f, 0f, 0, Color.Plum, Main.rand.NextFloat(0.65f, 1.2f)); + Main.dust[dust].noGravity = true; + } + } + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/PhantomSpirit"); + SoundEngine.PlaySound(sound with { Volume = 0.65f, PitchVariance = 0.3f, Pitch = -0.5f }, target.Center); + for (int i = 0; i <= 30; i++) + { + Dust dust = Dust.NewDustPerfect(target.Center, 66, new Vector2(0, -18).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 1.9f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.7f, 1.6f); + Dust dust2 = Dust.NewDustPerfect(target.Center, 66, new Vector2(0, -7).RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.1f, 1.9f)); + dust2.noGravity = true; + dust2.scale = Main.rand.NextFloat(0.7f, 1.6f); + } + + float ai1 = MathHelper.Lerp(0.75f, 1.25f, Main.rand.NextFloat()); + int soulDamage = (int)(damageDone / 3); + Vector2 velocity = new Vector2(0f, -14f).RotatedByRandom(0.65f) * Main.rand.NextFloat(0.9f, 1.1f); + Projectile.NewProjectile(player.GetSource_ItemUse(Item), target.Center + new Vector2(0, 1300f), velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.9f, 1.1f), ModContent.ProjectileType(), soulDamage, 0f, player.whoAmI, 0f, ai1); + Projectile.NewProjectile(player.GetSource_ItemUse(Item), target.Center + new Vector2(0, 1300f), velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.9f, 1.1f), ModContent.ProjectileType(), soulDamage, 0f, player.whoAmI, 0f, ai1); + Projectile.NewProjectile(player.GetSource_ItemUse(Item), target.Center + new Vector2(0, 1300f), velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.9f, 1.1f), ModContent.ProjectileType(), soulDamage, 0f, player.whoAmI, 0f, ai1); + } + } +} diff --git a/Items/Weapons/Melee/SoulEdge.png b/Items/Weapons/Melee/VoidEdge.png similarity index 100% rename from Items/Weapons/Melee/SoulEdge.png rename to Items/Weapons/Melee/VoidEdge.png diff --git a/Items/Weapons/Melee/WindBlade.cs b/Items/Weapons/Melee/WindBlade.cs index 959b4f0bf2..c4de2e3ca4 100644 --- a/Items/Weapons/Melee/WindBlade.cs +++ b/Items/Weapons/Melee/WindBlade.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 20; Item.useTurn = true; - Item.knockBack = 5; + Item.knockBack = 5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity3BuyPrice; @@ -32,16 +32,14 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage / 2, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, type, damage / 2, knockback, player.whoAmI); return false; } public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.BlueTorch); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.BlueTorch); } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index c3740d3a71..86ef655e99 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 62; Item.height = 90; - Item.damage = 165; + Item.damage = 78; Item.DamageType = DamageClass.Ranged; Item.useTime = 15; Item.useAnimation = 30; @@ -69,7 +69,7 @@ namespace CalamityMod.Items.Weapons.Ranged newType = ModContent.ProjectileType(); break; } - int proj = Projectile.NewProjectile(spawnSource, source.X + offset.X, source.Y + offset.Y, velocity.X, velocity.Y, newType, damage, knockback, player.whoAmI); + int proj = Projectile.NewProjectile(spawnSource, source.X + offset.X, source.Y + offset.Y, velocity.X, velocity.Y, newType, (int)(damage * 2.3f), knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].arrow = true; diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index a1102dab50..3f40d3f7bf 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class Animosity : ModItem, ILocalizedModType { public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.25f }; - // Very cool sound and it would be a shame for it to not be used elsewhere, would be even better if a new sound is made in the future + // Very cool sound and it would be a shame for it to not be used elsewhere, would be even better if a new sound is made in the future, but for now this is good enough public float SniperDmgMult = 8f; - public float SniperCritMult = Main.zenithWorld ? 7f : 1.2f; + public float SniperCritMult = Main.zenithWorld ? 7f : 1.35f; public float SniperVelocityMult = 2f; public new string LocalizationCategory => "Items.Weapons.Ranged"; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 70; Item.height = 18; - Item.damage = 47; + Item.damage = 45; Item.DamageType = DamageClass.Ranged; Item.width = 70; Item.height = 18; @@ -114,12 +114,6 @@ namespace CalamityMod.Items.Weapons.Ranged //The dmg mult has to be applied here otherwise the left click gets it instead (for one shot), and the crit needs to be applied down here too cuz otherwise it never affects the weapon int p = Projectile.NewProjectile(source, nuzzlePos, velocity * SniperVelocityMult, ModContent.ProjectileType(), (int)(damage * SniperDmgMult), knockback, player.whoAmI); Main.projectile[p].CritChance = (int)(Main.projectile[p].CritChance * SniperCritMult); //To support crit mults with decimals - if (Main.netMode != NetmodeID.Server) - { - // TO DO: Replace with actual bullet shells or used casings - Gore.NewGore(source, position, velocity.RotatedBy(2f * -player.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find("Polt5").Type); - } - } else { @@ -182,6 +176,12 @@ namespace CalamityMod.Items.Weapons.Ranged } } } + //shell + if (Main.netMode != NetmodeID.Server) + { + string goreType = Main.rand.NextBool() ? "EmptyAnimosityShell" : "EmptyAnimosityShell2"; + Gore.NewGore(source, position, velocity.RotatedBy(2f * -player.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find(goreType).Type); + } return false; } #endregion diff --git a/Items/Weapons/Ranged/ArterialAssault.cs b/Items/Weapons/Ranged/ArterialAssault.cs index 27ac16ee45..1cd0c68d7c 100644 --- a/Items/Weapons/Ranged/ArterialAssault.cs +++ b/Items/Weapons/Ranged/ArterialAssault.cs @@ -79,7 +79,6 @@ namespace CalamityMod.Items.Weapons.Ranged int shotArrow = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, damage, knockback, player.whoAmI); Main.projectile[shotArrow].noDropItem = true; Main.projectile[shotArrow].tileCollide = false; - Main.projectile[shotArrow].timeLeft = (int)(Main.projectile[shotArrow].timeLeft * Main.projectile[shotArrow].MaxUpdates * 0.75f); CalamityGlobalProjectile cgp = Main.projectile[shotArrow].Calamity(); cgp.allProjectilesHome = true; return false; diff --git a/Items/Weapons/Ranged/BrimstoneFury.cs b/Items/Weapons/Ranged/BrimstoneFury.cs index df2cbca3a0..7f09cdd428 100644 --- a/Items/Weapons/Ranged/BrimstoneFury.cs +++ b/Items/Weapons/Ranged/BrimstoneFury.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 30; Item.height = 58; - Item.damage = 25; + Item.damage = 21; Item.DamageType = DamageClass.Ranged; Item.useTime = 22; Item.useAnimation = 22; diff --git a/Items/Weapons/Ranged/Helstorm.cs b/Items/Weapons/Ranged/Helstorm.cs index aecd64e902..219390e9f5 100644 --- a/Items/Weapons/Ranged/Helstorm.cs +++ b/Items/Weapons/Ranged/Helstorm.cs @@ -14,12 +14,12 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 50; Item.height = 24; - Item.damage = 31; + Item.damage = 33; Item.DamageType = DamageClass.Ranged; - Item.useTime = 7; - Item.useAnimation = 7; + Item.useTime = 9; + Item.useAnimation = 9; Item.useStyle = ItemUseStyleID.Shoot; - Item.knockBack = 2.5f; + Item.knockBack = 2f; Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item11; diff --git a/Items/Weapons/Ranged/Infinity.cs b/Items/Weapons/Ranged/Infinity.cs index c1ef8cab1a..0a3822976f 100644 --- a/Items/Weapons/Ranged/Infinity.cs +++ b/Items/Weapons/Ranged/Infinity.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 56; Item.height = 24; - Item.damage = 120; + Item.damage = 110; Item.DamageType = DamageClass.Ranged; Item.useTime = 2; Item.useAnimation = 12; diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index eae946f146..39095f90ad 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 72; Item.height = 32; - Item.damage = 36; + Item.damage = 37; Item.DamageType = DamageClass.Ranged; Item.useTime = 6; Item.useAnimation = 6; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Ranged // Fire either the bullet or the water jet, depending on cadence. int projectileToFire = fireWater ? Item.shoot : type; - Projectile.NewProjectile(source, newPos, newVel, projectileToFire, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, newPos, newVel, projectileToFire, (int)(damage * 0.8f), knockback, player.whoAmI); // Always fires a close range water blast. // It goes in the same direction as the main shot but has a minor velocity variation to be less monotonous. diff --git a/Items/Weapons/Ranged/Phangasm.cs b/Items/Weapons/Ranged/Phangasm.cs index 6ef586e578..5f4e9d8ac4 100644 --- a/Items/Weapons/Ranged/Phangasm.cs +++ b/Items/Weapons/Ranged/Phangasm.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 48; Item.height = 82; - Item.damage = 82; + Item.damage = 87; Item.useTime = 12; Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(ItemID.Phantasm). AddIngredient(8). - AddIngredient(20). + AddIngredient(20). AddIngredient(20). AddTile(). Register(); diff --git a/Items/Weapons/Ranged/Pumpler.cs b/Items/Weapons/Ranged/Pumpler.cs index 9c65c3178d..d8c742135b 100644 --- a/Items/Weapons/Ranged/Pumpler.cs +++ b/Items/Weapons/Ranged/Pumpler.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 72; Item.height = 34; - Item.damage = 24; + Item.damage = 26; Item.DamageType = DamageClass.Ranged; Item.useTime = 30; Item.useAnimation = 30; diff --git a/Items/Weapons/Ranged/Seadragon.cs b/Items/Weapons/Ranged/Seadragon.cs index 954ebe9dc9..100044db41 100644 --- a/Items/Weapons/Ranged/Seadragon.cs +++ b/Items/Weapons/Ranged/Seadragon.cs @@ -97,7 +97,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(). - AddIngredient(9). + AddIngredient(9). AddIngredient(3). AddIngredient(10). AddTile(TileID.LunarCraftingStation). diff --git a/Items/Weapons/Ranged/Shredder.cs b/Items/Weapons/Ranged/Shredder.cs index 59b9c09957..ee0c61e05f 100644 --- a/Items/Weapons/Ranged/Shredder.cs +++ b/Items/Weapons/Ranged/Shredder.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 56; Item.height = 24; - Item.damage = 30; + Item.damage = 31; Item.DamageType = DamageClass.Ranged; Item.useTime = 4; Item.useAnimation = 24; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = SoundID.Item31; Item.autoReuse = true; Item.shoot = ProjectileID.Bullet; - Item.shootSpeed = 12f; + Item.shootSpeed = 9f; Item.useAmmo = AmmoID.Bullet; Item.Calamity().canFirePointBlankShots = true; } @@ -48,26 +48,29 @@ namespace CalamityMod.Items.Weapons.Ranged int bulletAmt = 4; if (player.altFunctionUse == 2) { - for (int index = 0; index < bulletAmt; ++index) + velocity *= 2f; + Vector2 newPosition = position + velocity.SafeNormalize(Vector2.UnitY) * 50f; + Vector2 cachedVelocity = velocity; + for (int index = 0; index < bulletAmt; index++) { - float SpeedX = velocity.X + Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-30, 31) * 0.05f; - int shot = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); + velocity += new Vector2(Main.rand.Next(-30, 31) * 0.05f, Main.rand.Next(-30, 31) * 0.05f); + int shot = Projectile.NewProjectile(source, newPosition, velocity, type, damage, knockback, player.whoAmI); Main.projectile[shot].timeLeft = 180; + velocity = cachedVelocity; } - return false; } else { - for (int index = 0; index < bulletAmt; ++index) + Vector2 newPosition = position + velocity.SafeNormalize(Vector2.UnitY) * 50f; + Vector2 cachedVelocity = velocity; + for (int index = 0; index < bulletAmt; index++) { - float SpeedX = velocity.X + Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-30, 31) * 0.05f; - int shot = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - Main.projectile[shot].timeLeft = 180; + velocity += new Vector2(Main.rand.Next(-30, 31) * 0.05f, Main.rand.Next(-30, 31) * 0.05f); + Projectile.NewProjectile(source, newPosition, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + velocity = cachedVelocity; } - return false; } + return false; } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/StellarCannon.cs b/Items/Weapons/Ranged/StellarCannon.cs index 687fd244a2..2b0b81bf28 100644 --- a/Items/Weapons/Ranged/StellarCannon.cs +++ b/Items/Weapons/Ranged/StellarCannon.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 50; Item.height = 30; - Item.damage = 175; + Item.damage = 182; Item.DamageType = DamageClass.Ranged; Item.useTime = 40; Item.useAnimation = 40; @@ -30,9 +30,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = SoundID.Item92; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 2f; + Item.shootSpeed = 3f; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16; + public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); diff --git a/Items/Weapons/Ranged/TheHive.cs b/Items/Weapons/Ranged/TheHive.cs index 081c1b9961..3a753245b7 100644 --- a/Items/Weapons/Ranged/TheHive.cs +++ b/Items/Weapons/Ranged/TheHive.cs @@ -1,52 +1,63 @@ using CalamityMod.Projectiles.Ranged; 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 Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Ranged { public class TheHive : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public static int OriginalUseTime = 34; + public override void SetDefaults() { - Item.width = 62; - Item.height = 30; - Item.damage = 60; + Item.damage = 323; Item.DamageType = DamageClass.Ranged; - Item.useTime = 34; - Item.useAnimation = 34; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; + Item.useTime = Item.useAnimation = OriginalUseTime; + Item.shoot = ProjectileType(); + Item.shootSpeed = 13f; Item.knockBack = 3.5f; + + Item.width = 66; + Item.height = 30; + Item.noMelee = true; + Item.autoReuse = true; + Item.channel = true; + Item.noUseGraphic = true; + Item.useAmmo = AmmoID.Rocket; Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; - Item.UseSound = SoundID.Item61; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 13f; - Item.useAmmo = AmmoID.Rocket; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.9f, PitchVariance = 0.1f }; } - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; - // Figure out which rocket is used - public int RocketType; - public override void OnConsumeAmmo(Item ammo, Player player) => RocketType = ammo.type; + // Spawning the holdout won't consume ammo. + public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] != 0; + + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int rocket = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }); - Projectile.NewProjectile(source, position, velocity, rocket, damage, knockback, player.whoAmI, RocketType); + Item.channel = true; + + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI); + + // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + return false; } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) => Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Request(Texture + "_Glow").Value); } } diff --git a/Items/Weapons/Ranged/TheHive_Glow.png b/Items/Weapons/Ranged/TheHive_Glow.png new file mode 100644 index 0000000000..a1b2898a18 Binary files /dev/null and b/Items/Weapons/Ranged/TheHive_Glow.png differ diff --git a/Items/Weapons/Rogue/Apoctolith.cs b/Items/Weapons/Rogue/Apoctolith.cs index 0717f4e31a..9f54c2c43e 100644 --- a/Items/Weapons/Rogue/Apoctolith.cs +++ b/Items/Weapons/Rogue/Apoctolith.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 66; Item.height = 64; - Item.damage = 220; + Item.damage = 228; Item.shootSpeed = 18f; Item.shoot = ModContent.ProjectileType(); - Item.useTime = 30; - Item.useAnimation = 30; + Item.useTime = 26; + Item.useAnimation = 26; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 10f; Item.value = CalamityGlobalItem.Rarity7BuyPrice; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 20; - public override float StealthDamageMultiplier => 1.25f; + public override float StealthDamageMultiplier => 1.3f; 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/BallisticPoisonBomb.cs b/Items/Weapons/Rogue/BallisticPoisonBomb.cs index b4bba3bf78..3a025b0eec 100644 --- a/Items/Weapons/Rogue/BallisticPoisonBomb.cs +++ b/Items/Weapons/Rogue/BallisticPoisonBomb.cs @@ -33,20 +33,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike - { - int spread = 5; - for (int i = 0; i < 3; i++) - { - Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3, 4), velocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().stealthStrike = true; - spread -= Main.rand.Next(2, 6); - } - return false; - } - return true; + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; } public override void AddRecipes() diff --git a/Items/Weapons/Rogue/Lionfish.cs b/Items/Weapons/Rogue/Lionfish.cs index 80a966dd0f..7ef415c25b 100644 --- a/Items/Weapons/Rogue/Lionfish.cs +++ b/Items/Weapons/Rogue/Lionfish.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Melee; +using System; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -16,9 +18,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 45; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 22; + Item.useTime = Item.useAnimation = 26; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 22; Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -36,6 +37,16 @@ namespace CalamityMod.Items.Weapons.Rogue int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; + + for (int s = 0; s < 5; s++) + { + Vector2 spikeVel = velocity; + spikeVel *= Main.rand.NextFloat(0.85f, 1.25f); + spikeVel = spikeVel.RotatedBy((Main.rand.NextDouble() - 0.5) * Math.PI * 0.25, default); + int spike = Projectile.NewProjectile(source, position, spikeVel, ModContent.ProjectileType(), (int)(damage * 0.5), (int)(knockback * 0.5f), player.whoAmI, -10f, 1f); + if (spike.WithinBounds(Main.maxProjectiles)) + Main.projectile[spike].DamageType = RogueDamageClass.Instance; + } return false; } return true; diff --git a/Items/Weapons/Rogue/SpentFuelContainer.cs b/Items/Weapons/Rogue/SpentFuelContainer.cs index 1e6e050470..041c7e5d28 100644 --- a/Items/Weapons/Rogue/SpentFuelContainer.cs +++ b/Items/Weapons/Rogue/SpentFuelContainer.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 22; Item.height = 24; - Item.damage = 50; - Item.useAnimation = 35; - Item.useTime = 35; + Item.damage = 80; + Item.useAnimation = 50; + Item.useTime = 50; Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; @@ -29,6 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 15f; Item.DamageType = RogueDamageClass.Instance; } + public override float StealthDamageMultiplier => 0.5f; 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/TimeBolt.cs b/Items/Weapons/Rogue/TimeBolt.cs index 008124f228..312444fdc0 100644 --- a/Items/Weapons/Rogue/TimeBolt.cs +++ b/Items/Weapons/Rogue/TimeBolt.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Rogue AddIngredient(). AddIngredient(ItemID.FastClock). AddIngredient(5). - AddIngredient(20). + AddIngredient(20). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index a09109ff03..1ec1d1ca43 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -37,11 +37,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - CalamityPlayer modPlayer = player.Calamity(); - bool hasSummonerSet = modPlayer.WearingPostMLSummonerSet; - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, (int)(damage * (hasSummonerSet ? 1 : 0.66)), knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = (int)(Item.damage * (hasSummonerSet ? 1f : 0.66f)); + Main.projectile[p].originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/DankStaff.cs b/Items/Weapons/Summon/DankStaff.cs index 810f912605..d5e20a6c3e 100644 --- a/Items/Weapons/Summon/DankStaff.cs +++ b/Items/Weapons/Summon/DankStaff.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 9; Item.mana = 10; Item.useTime = Item.useAnimation = 30; - Item.scale = 0.85f; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2.25f; diff --git a/Items/Weapons/Summon/ResurrectionButterfly.cs b/Items/Weapons/Summon/ResurrectionButterfly.cs index 2adc64d807..d787d89c73 100644 --- a/Items/Weapons/Summon/ResurrectionButterfly.cs +++ b/Items/Weapons/Summon/ResurrectionButterfly.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 46; Item.height = 46; - Item.damage = 67; + Item.damage = 66; // clueless Item.mana = 10; Item.useTime = Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Summon/ScabRipper.cs b/Items/Weapons/Summon/ScabRipper.cs index f5f2735c6f..ace9bb2c60 100644 --- a/Items/Weapons/Summon/ScabRipper.cs +++ b/Items/Weapons/Summon/ScabRipper.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 16; Item.mana = 10; Item.useTime = Item.useAnimation = 30; - Item.useStyle = ItemUseStyleID.Swing; + Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 0.5f; Item.value = CalamityGlobalItem.Rarity2BuyPrice; @@ -27,6 +27,9 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; + + // This doesn't do anything, it's just so the item is held like a staff. + Item.shootSpeed = 1f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Summon/ScabRipper.png b/Items/Weapons/Summon/ScabRipper.png index db01a65a8b..5cb86ddac8 100644 Binary files a/Items/Weapons/Summon/ScabRipper.png and b/Items/Weapons/Summon/ScabRipper.png differ diff --git a/Items/Weapons/Summon/StaffOfNecrosteocytes.png b/Items/Weapons/Summon/StaffOfNecrosteocytes.png index d58f69168d..61665dc8d3 100644 Binary files a/Items/Weapons/Summon/StaffOfNecrosteocytes.png and b/Items/Weapons/Summon/StaffOfNecrosteocytes.png differ diff --git a/Items/Weapons/Summon/StarspawnHelixStaff.cs b/Items/Weapons/Summon/StarspawnHelixStaff.cs index c05cfc4806..239b6eba42 100644 --- a/Items/Weapons/Summon/StarspawnHelixStaff.cs +++ b/Items/Weapons/Summon/StarspawnHelixStaff.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 54; Item.height = 52; - Item.damage = 75; + Item.damage = 103; Item.knockBack = 1.25f; Item.mana = 10; diff --git a/Items/Weapons/Summon/StormjawStaff.cs b/Items/Weapons/Summon/StormjawStaff.cs index 9c0441788b..b43d49fbea 100644 --- a/Items/Weapons/Summon/StormjawStaff.cs +++ b/Items/Weapons/Summon/StormjawStaff.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 11; Item.mana = 10; Item.useTime = Item.useAnimation = 35; - Item.scale = 0.75f; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Summon/VileFeeder.png b/Items/Weapons/Summon/VileFeeder.png index b4a7f8446b..5f1a4cc500 100644 Binary files a/Items/Weapons/Summon/VileFeeder.png and b/Items/Weapons/Summon/VileFeeder.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Configs.hjson b/Localization/en-US/Mods.CalamityMod.Configs.hjson index 99b3e029a3..9ec4f652a4 100644 --- a/Localization/en-US/Mods.CalamityMod.Configs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Configs.hjson @@ -136,8 +136,8 @@ CalamityConfig: { ''' Demon Altars no longer spawn ores and crimson/corruption blocks when broken. Wall of Flesh spawns Cobalt and Palladium ore on first kill. - The first mech boss you fight has 20% less HP and damage and spawns Mythril and Orichalcum ore on first kill. - The second mech boss you fight has 10% less HP and damage and spawns Adamantite and Titanium ore on first kill. + The first mech boss you fight has 20% (10% in Expert and Master) less HP and damage and spawns Mythril and Orichalcum ore on first kill. + The second mech boss you fight has 10% (5% in Expert and Master) less HP and damage and spawns Adamantite and Titanium ore on first kill. The third mech boss spawns Hallowed Ore on first kill. ''' } @@ -260,7 +260,7 @@ CalamityConfig: { Sets the maximum of particle effects that can exist at once. Particles are separate from dust and gores. Turn down to improve performance. - [c/F05A5A:Turning this below 300 may cause some things to not display correctly.] + [c/F05A5A:Turning this below 1000 may cause some things to not display correctly.] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson index 6f6971675e..815a1743ee 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson @@ -83,7 +83,7 @@ MOAB: { Acceleration multiplier: 1.0 Good vertical speed Flight time: 75 - 10% increased jump speed and allows constant jumping + 32% increased jump speed and allows constant jumping Grants the player cloud, blizzard, and sandstorm mid-air jumps 'The Mother Of All Balloons' ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index ecb1c70f07..31d7529e1a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -60,7 +60,9 @@ AbyssalMirror: { Significantly reduces enemy aggression, even in the abyss Stealth generates 25% faster when standing still and 12% faster while moving Grants the ability to evade attacks, releasing a cloud of lumenyl fluid which damages and stuns nearby enemies - Evading an attack grants a lot of stealth but has a 90 second cooldown + Attacks that deal less than 5% of your max life in damage will not be evaded + The evade has a cooldown that ranges between 15 and 90 seconds depending on the evaded attack's damage + Evading an attack grants a lot of stealth This cooldown is shared with all other dodges and reflects 'Light does not reach the depths of the ocean' ''' @@ -81,7 +83,7 @@ AeroStone: { DisplayName: Aero Stone Tooltip: ''' - Provides an additional 25 flight time + Provides an additional 50 flight time You slowly recover flight time while in the air if you are not flying or gliding 'One of the ancient relics' ''' @@ -122,7 +124,9 @@ AmalgamatedBrain: { 10% increased damage Shade rains down when you are hit Grants the ability to dodge attacks - The dodge has a 90 second cooldown which is shared with all other dodges and reflects + Attacks that deal less than 5% of your max life in damage will not be dodged + The dodge has a cooldown that ranges between 15 and 90 seconds depending on the dodged attack's damage + This cooldown is shared with all other dodges and reflects Temporarily increases critical strike chance and summon damage after a dodge You will confuse nearby enemies when you are struck ''' @@ -517,8 +521,9 @@ DeepDiver: { DisplayName: Deep Diver Tooltip: ''' - 15% increased damage, movement speed and +15 defense while underwater - While underwater you gain the ability to dash great distances + Allows the ability to do a short ram dash + This dash can slam through enemies without taking damage and can be used quickly in succession + Provides greatly improved water mobility ''' } @@ -606,7 +611,9 @@ EclipseMirror: { Mobile stealth generation accelerates while not attacking Stealth strikes only expend 50% of your max stealth Grants the ability to evade attacks in a blast of darksun light, which inflicts extreme damage in a wide area - Evading an attack grants full stealth but has a 90 second cooldown + Attacks that deal less than 5% of your max life in damage will not be evaded + The evade has a cooldown that ranges between 15 and 90 seconds depending on the evaded attack's damage + Evading an attack grants full stealth This cooldown is shared with all other dodges and reflects 'Its reflection shows naught but darkness' ''' @@ -1630,11 +1637,12 @@ StatisNinjaBelt: { DisplayName: Statis' Ninja Belt Tooltip: ''' - 6% increased jump speed and allows constant jumping + 32% increased jump speed and allows constant jumping Grants the ability to swim Increased fall damage resistance by 35 blocks Can climb walls, dash, and dodge attacks - The dodge has a 90 second cooldown + Attacks that deal less than 5% of your max life in damage will not be dodged + The dodge has a cooldown that ranges between 15 and 90 seconds depending on the dodged attack's damage This cooldown is shared with all other dodges and reflects ''' } @@ -1643,10 +1651,11 @@ StatisVoidSash: { DisplayName: Statis' Void Sash Tooltip: ''' - 12% increased jump speed and allows constant jumping + 32% increased jump speed and allows constant jumping Grants immunity to fall damage Can climb walls, dash, and dodge attacks - The dodge has a 90 second cooldown + Attacks that deal less than 5% of your max life in damage will not be dodged + The dodge has a cooldown that ranges between 15 and 90 seconds depending on the dodged attack's damage This cooldown is shared with all other dodges and reflects Dashes leave homing scythes in your wake ''' @@ -1771,7 +1780,9 @@ TheAmalgam: { 15% increased damage Shade rains down when you are hit Grants the ability to dodge attacks - The dodge has a 90 second cooldown which is shared with all other dodges and reflects + Attacks that deal less than 5% of your max life in damage will not be dodged + The dodge has a cooldown that ranges between 15 and 90 seconds depending on the dodged attack's damage + This cooldown is shared with all other dodges and reflects Temporarily increases critical strike chance and summon damage after a dodge Nearby enemies receive a variety of sickness-related debuffs when you are hit ''' @@ -1825,7 +1836,9 @@ TheEvolution: { ''' You reflect projectiles when they hit you Reflected projectiles deal no damage to you - This reflect has a 90 second cooldown which is shared with all other dodges and reflects + Projectiles that deal less than 5% of your max life in damage will not be reflected + The reflect has a cooldown that ranges between 15 and 90 seconds depending on the reflected projectile's damage + This cooldown is shared with all other dodges and reflects After reflecting something, grants +1 HP/s life regen and accelerated life regen for 5 seconds If the same enemy projectile type hits you again you will resist its damage by 15% ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson index 8ba39ee140..a0371e4ade 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson @@ -41,7 +41,7 @@ BubonicRound: { Tooltip: ''' Spreads the plague on hit - Ignores 20% of enemy defense + Ignores 10% of enemy defense ''' } @@ -76,7 +76,11 @@ GodSlayerSlug: { HallowPointRound: { DisplayName: Hallow-Point Round - Tooltip: "" + Tooltip: + ''' + Gallant light deals 6 bonus damage on hit + This effect does not occur if the bullets are converted by special guns + ''' } HolyFireBullet: { @@ -166,7 +170,6 @@ VanquisherArrow: { ''' Powerful arrows forged with cosmic steel Pierces through tiles and homes in on enemies - Creates a large explosion upon expiration ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson index 391c40f022..acaa9dcab4 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson @@ -66,6 +66,7 @@ CirrusDress: { ''' 5% increased magic damage and critical strike chance 20% decreased movement speed and increases maximum fall speed to 61 mph + Allows for drinking 5 alcohols before your liver is poisoned [c/B00BA5:'Here, this should help you drink a lot more than usual!'] 'You feel thick...' ''' @@ -104,7 +105,9 @@ DaedalusHeadMelee: { Enemies are more likely to target you You reflect projectiles back at enemies Reflected projectiles deal 50% less damage to you - This reflect has a 90 second cooldown which is shared with all other dodges and reflects + Projectiles that deal less than 5% of your max life in damage will not be reflected + The reflect has a cooldown that ranges between 15 and 90 seconds depending on the reflected projectile's damage + This cooldown is shared with all other dodges and reflects ''' } @@ -494,10 +497,10 @@ ReaverHeadTank: { +10 defense and +1.5 HP/s life regen Enemies are more likely to target you Reduces the life regen lost from damage over time debuffs by 20% - All attacks have a small chance to steal life and speed up the rate of life regen - 20% decreased movement speed and flight time + All attacks steal life and speed up the rate of life regen + 30% decreased movement speed and flight time Enemy damage is reflected and summons a thorn spike - Reaver Rage has a 25% chance to activate when you are damaged + Reaver Rage activates when you are damaged ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson index 263883d1c9..06272e4042 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson @@ -140,7 +140,7 @@ BloodflareHeadRogue: { +120 maximum stealth Being over 80% life boosts your defense by 30 and rogue crit by 5% Being below 80% life boosts your rogue damage by 10% - Rogue critical strikes have a 50% chance to heal you + Rogue critical strikes heal you ''' } @@ -520,14 +520,14 @@ TarragonHeadMelee: { DisplayName: Tarragon Helm Tooltip: ''' - 10% increased melee damage and critical strike chance + 12% increased melee damage and critical strike chance 10% increased damage reduction ''' SetBonus: ''' 15% increased melee speed Enemies are more likely to target you - You have a 25% chance to gain a life regen buff when you take damage + You gain a life regen buff when you take damage Press {0} to cloak yourself in life energy that heavily reduces enemy contact damage for 10 seconds This has a 30 second cooldown ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Dyes.hjson b/Localization/en-US/Mods.CalamityMod.Items.Dyes.hjson index 927ac0801d..904a71bbe9 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Dyes.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Dyes.hjson @@ -113,13 +113,13 @@ WingTimeHairDye: { Tooltip: "" } -NightmareDye: { - DisplayName: Nightmare Dye +NecroplasmicDye: { + DisplayName: Necroplasmic Dye Tooltip: "" } -PolterplasmDye: { - DisplayName: Polterplasm Dye +NightmareDye: { + DisplayName: Nightmare Dye Tooltip: "" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson b/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson index b08c49fe33..90e1bb38a2 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson @@ -371,9 +371,9 @@ LoreHiveMind: { Lore: ''' Some semblance of a God's mind may survive death, much like the twitches of a crushed insect. - What little remains attempts to convene and coalesce in worship. A desperate attempt that it's power may yet be restored. How pitiful. + What little remains attempts to convene and coalesce in worship. A desperate attempt that its power may yet be restored. How pitiful. Fortunately for us, the futility of this effort is unmatched. The biomass obeys; even though nothing is accomplished. - Far from all divine power flows from faith. A god is forged of its own strength, followers then may choose to worship them. + Divine power is known to be rooted in faith. Gods are forged of their own strength, and the mindless spread of corruption is its own foul reverence. ''' } @@ -536,7 +536,7 @@ LoreQueenSlime: { DisplayName: Queen Slime Lore: ''' - Having fled after your battle, it seems the Slime God fashion a new guardian from the unleashed essences. + Having fled after your battle, it seems the Slime God fashioned a new guardian from the unleashed essences. Ensnared in the absorption process of its newfound power… it could not flee again. Or perhaps it was overcome by desperation for survival. A glorious hunt, a fine foe. Now you know that you must chase them to the ends of Terraria. diff --git a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson index 81cb1f11c3..3832adc9b4 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson @@ -232,6 +232,11 @@ MysteriousCircuitry: { Tooltip: "" } +Necroplasm: { + DisplayName: Necroplasm + Tooltip: It churns and seethes with ghastly malice +} + NightmareFuel: { DisplayName: Nightmare Fuel Tooltip: May drain your sanity @@ -247,11 +252,6 @@ PerennialBar: { Tooltip: "" } -Polterplasm: { - DisplayName: Polterplasm - Tooltip: It churns and seethes with ghastly malice -} - PlagueCellCanister: { DisplayName: Plague Cell Canister Tooltip: "" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index c066cdb09a..33d8d3ce0a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson @@ -107,7 +107,7 @@ Ectoheart: { DisplayName: Ectoheart Tooltip: ''' - Permanently increases Adrenaline Mode damage by 15% and damage reduction by 5% + Permanently increases Adrenaline Mode damage by 20% and damage reduction by 5% Revengeance drop ''' } @@ -126,7 +126,7 @@ ElectrolyteGelPack: { DisplayName: Electrolyte Gel Pack Tooltip: ''' - Permanently increases Adrenaline Mode damage by 15% and damage reduction by 5% + Permanently increases Adrenaline Mode damage by 20% and damage reduction by 5% Revengeance drop ''' } @@ -190,7 +190,7 @@ StarlightFuelCell: { DisplayName: Starlight Fuel Cell Tooltip: ''' - Permanently increases Adrenaline Mode damage by 15% and damage reduction by 5% + Permanently increases Adrenaline Mode damage by 20% and damage reduction by 5% Revengeance drop ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 61ed6fc57d..c7df946292 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -343,6 +343,11 @@ BabyGhostBellJar: { Tooltip: "" } +CirrusCouch: { + DisplayName: Cirrus Courch + Tooltip: This shouldn't exist... +} + AquaticScourgeRelic: { DisplayName: Aquatic Scourge Relic Tooltip: A glimpse into what could have been... diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index a0ab4391af..c86387da66 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -181,6 +181,7 @@ BloodyMary: { ''' 10% increased damage and movement speed during a Blood Moon Reduces life regen by 2 HP/s and defense by 4% + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'Extra spicy... and bloody!'] ''' } @@ -191,6 +192,7 @@ CaribbeanRum: { ''' Increases life regen by 1 HP/s, movement speed by 10% and wing flight time by 20% Makes you floaty and reduces defense by 10% + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'Why is the rum gone?'] ''' } @@ -201,6 +203,7 @@ CinnamonRoll: { ''' Increases mana regeneration rate and multiplies all fire-based debuff damage by 1.5x Reduces defense by 10% + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'A great-tasting cinnamon whiskey with a touch of cream soda.'] ''' } @@ -211,6 +214,8 @@ Everclear: { ''' 25% increased damage Reduces life regen by 5 HP/s and defense by 30% + Counts as 2 alcohols for Alcohol Poisoning + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'This is the most potent booze I have, be careful with it.'] ''' } @@ -221,6 +226,7 @@ EvergreenGin: { ''' Multiplies all sickness and water-related debuff damage by 1.25x Reduces life regen by 0.5 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'It tastes like a Christmas tree, if you can imagine that.'] ''' } @@ -231,6 +237,7 @@ FabsolsVodka: { ''' 8% increased damage, but lowers defense by 10% Increases immune time after being struck + Drinking more than 3 different alcohols might not end well with your liver This magical liquor is highly sought by those with a refined palate ''' } @@ -241,6 +248,7 @@ Fireball: { ''' Multiplies all fire-based debuff damage by 1.25x Reduces life regen by 0.5 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'A great-tasting cinnamon whiskey.'] ''' } @@ -250,6 +258,7 @@ GrapeBeer: { Tooltip: ''' Reduces defense by 3% for 15 seconds + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'This crap is abhorrent, but you might like it.'] ''' } @@ -260,6 +269,7 @@ Margarita: { ''' Halves the duration of most harmful debuffs Reduces defense by 6% and life regen by 0.5 HP/s + Drinking more than 3 different alcohols might not end well with your liver 3 minute duration [c/B00BA5:'One of the best drinks ever created, enjoy it while it lasts.'] ''' @@ -271,6 +281,7 @@ Moonshine: { ''' Increases defense by 10 and damage reduction by 3% Reduces life regen by 0.5 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'This stuff is pretty strong, but I'm sure you can handle it.'] ''' } @@ -281,6 +292,7 @@ MoscowMule: { ''' Increases damage by 9%, knockback by 50% and critical strike chance by 3% Reduces life regen by 2 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'I once heard the copper mug can be toxic and I told 'em, 'listen, dummy, I'm already poisoning myself!''] ''' } @@ -290,7 +302,8 @@ OddMushroom: { Tooltip: ''' Causes you to see many fake, vibrant copies of all nearby entities - [c/C4232C:These visual effects may be nauseating or otherwise bad for some] + These effects become more potent as you consume more shrooms + [c/FF232C:These visual effects may be nauseating or otherwise bad for some] 'Trippy' ''' } @@ -301,6 +314,7 @@ OldFashioned: { ''' Multiplies all accessory and set bonus damage by 1.5x Decreases all damage by 25% + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'An old favorite of mine.'] ''' } @@ -310,6 +324,7 @@ RedWine: { Tooltip: ''' Reduces life regen by 0.5 HP/s for 15 seconds + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'Too dry for my taste.'] ''' } @@ -320,6 +335,7 @@ Rum: { ''' Increases life regen by 1 HP/s and movement speed by 10% Reduces defense by 5% + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'Sweet and potent, just how I like it.'] ''' } @@ -330,6 +346,7 @@ Screwdriver: { ''' Multiplies piercing projectile damage by 1.05x Reduces life regen by 0.5 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'Do you have a screw loose?'] ''' } @@ -341,6 +358,7 @@ StarBeamRye: { Increases max mana by 50, magic damage by 8%, and reduces mana usage by 10% Reduces defense by 6% and life regen by 1 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'Made from some stuff I found near the Astral Meteor crash site. Don't worry, it's safe, trust me...'] ''' } @@ -351,6 +369,7 @@ Tequila: { ''' Increases knockback by 10%, crit chance by 4% and defense by 5 during daytime Reduces life regen by 0.5 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'Great for mixing up daytime drinks.'] ''' } @@ -361,6 +380,7 @@ TequilaSunrise: { ''' Increases knockback by 20%, crit chance by 8% and defense by 10 during daytime Reduces life regen by 1 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'The greatest daytime drink I've ever had.'] ''' } @@ -371,6 +391,7 @@ Vodka: { ''' Increases damage by 6% and critical strike chance by 2% Reduces life regen by 0.5 HP/s and defense by 5% + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'The number one alcohol for creating great mixed drinks.'] ''' } @@ -381,6 +402,7 @@ Whiskey: { ''' Increases damage by 4%, knockback by 20% and critical strike chance by 2% Reduces defense by 5% + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'The burning sensation makes it tastier.'] ''' } @@ -391,6 +413,7 @@ WhiteWine: { ''' Increases magic damage by 8% Reduces defense by 6% and life regen by 0.5 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'I drank a full barrel of this stuff once in one night, I couldn't remember who I was the next day.'] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index c8816c75fe..c9bdc21914 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -677,7 +677,7 @@ Serpentine: { ShadecrystalBarrage: { DisplayName: Shadecrystal Barrage - Tooltip: Summons rapid fire shadecrystals, can shoot two crystals at once + Tooltip: Summons bursts of shadecrystals that can home in on enemies } ShaderainStaff: { @@ -737,7 +737,7 @@ StaffofBlushie: { StarShower: { DisplayName: Star Shower - Tooltip: Casts a spread of astral stars at the mouse cursor + Tooltip: Casts a spread of astral stars from the sky that converge at the cursor } SubsumingVortex: { @@ -900,8 +900,9 @@ Viscera: { DisplayName: Viscera Tooltip: ''' - Fires a blood beam that heals you on enemy hits - The more tiles and enemies the beam bounces off of or travels through the more healing the beam does + Fires a rapid barrage of piercing blood beams that heal you on enemy hit + Each successive beam in the barrage deals more damage + The last beam of the barrage instead explodes upon hitting an enemy ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index bced5bc2f8..814cbf278e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -254,7 +254,7 @@ ChronomancersScythe: { Tooltip: ''' Rapidly fires icicles - Press to swing the scythe around you creating a clock pattern of homing icicles + Press to swing the scythe around you, creating a clock pattern of homing icicles Direct hits with the scythe have a chance to spawn clocks Collecting the clocks increases movement speed and acceleration by 5% for each clock collected This stacks up to 3 times and each level wears off after 5 seconds @@ -305,7 +305,7 @@ CrescentMoon: { DarklightGreatsword: { DisplayName: Darklight Greatsword - Tooltip: Fires darklight blades that split on impact + Tooltip: Fires darklight blades that slice through enemies, creating additional slashes } DeathsAscension: { @@ -467,7 +467,8 @@ Exoblade: { Press to release multiple energy beams that home in on enemies and slice them on hit Press to dash in the direction of the cursor with the blade Enemy hits from the blade during the dash result in massive damage and a rebound - Press immediately after a rebound to perform a powerful slash that explodes on enemy hits + Press immediately after a rebound to perform a powerful slash + Powerful slashes are larger, heal you, and create a large explosion ''' } @@ -632,7 +633,7 @@ GreatswordofJudgement: { Greentide: { DisplayName: Greentide - Tooltip: Summons teeth from the sky on hit + Tooltip: Summons teeth to chomp your foes on hit } HellfireFlamberge: { @@ -679,7 +680,7 @@ IridescentExcalibur: { DisplayName: Iridescent Excalibur Tooltip: ''' - Freezes enemies and heals the player on hit + True melee strikes freeze enemies Fires rainbow beams that change their behavior based on their color Press for true melee ''' @@ -716,7 +717,6 @@ Lucrecia: { DisplayName: Lucrecia Tooltip: ''' - Striking an enemy makes you immune for a short time Fires a DNA chain Finesse ''' @@ -1038,11 +1038,6 @@ SolsticeClaymore: { ''' } -SoulEdge: { - DisplayName: Soul Edge - Tooltip: Fires the ghastly souls of long-deceased abyss dwellers -} - SoulHarvester: { DisplayName: Soul Harvester Tooltip: @@ -1171,7 +1166,8 @@ Terratomere: { Tooltip: ''' Heals the player on true melee hits - Fires a piercing energy bolt that causes hit targets to explode and be slashed + Fires several piercing energy bolts that rapidly seek targets + On hit, explodes and repeatedly slashes the target 'Linked to the essence of Terraria' ''' } @@ -1248,11 +1244,13 @@ TheMutilator: { TheObliterator: { DisplayName: The Obliterator - Tooltip: + Tooltip: "[GFB]" + TooltipNormal: ''' Ruins nearby enemies with death lasers An exceptionally agile yoyo ''' + TooltipGFB: just a slight bit of dust spam on this weapon im afraid } TheOracle: { @@ -1320,7 +1318,7 @@ TrueCausticEdge: { Tooltip: ''' Fires a bouncing caustic beam - Inflicts venom on enemy hits + Inflicts acid venom and slows down on enemy hits ''' } @@ -1388,6 +1386,15 @@ Virulence: { Tooltip: Fires a plague cloud } +VoidEdge: { + DisplayName: Void Edge + Tooltip: + ''' + Fires the ghastly souls of long-deceased abyss dwellers + Striking with the blade summons additional souls from below + ''' +} + VulcaniteLance: { DisplayName: Vulcanite Lance Tooltip: Explodes on enemy hits and summons homing flares on critical hits diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index b71cc90da8..6755615873 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -380,6 +380,7 @@ Deathwind: { ''' Fires a spread of 4 arrows Wooden arrows are converted into nebula arrows + Nebula arrows deal more damage and inflict god slayer inferno ''' } @@ -1249,8 +1250,9 @@ TheHive: { DisplayName: The Hive Tooltip: ''' - Launches a variety of rockets that explode into friendly bees - Rockets will destroy tiles with tile-destroying ammo + Launches a wide spread of 4 missiles that explode on contact with enemies and tiles + Charging the launcher decreases the spread and increases the velocity of the missile barrage + Fully charging the launcher will cause it to fire a nuke to decimate a massive area on impact ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 0cb958ec6c..506e144946 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -54,8 +54,8 @@ BallisticPoisonBomb: { DisplayName: Ballistic Poison Bomb Tooltip: ''' - Throws a sticky bomb that explodes into spikes and poison clouds - Stealth strikes throw three at once + Throws a sticky bomb that explodes into spikes and venomous clouds + Stealth strikes erupt into more clouds with a longer lasting venom ''' } @@ -618,7 +618,8 @@ JawsOfOblivion: { DisplayName: Jaws of Oblivion Tooltip: ''' - Throws a tight spread of six venomous reaper fangs that stick in enemies + Throws a tight spread of six venomous reaper teeth that stick in enemies + This venom can stack when more teeth are stuck in an enemy Stealth strikes cause the teeth to emit a crushing shockwave on impact 'You're gonna need a bigger boat' ''' @@ -666,6 +667,7 @@ LeviathanTeeth: { Tooltip: ''' Rapidly throws a spread of venomous teeth that stick to enemies + This venom can stack when more teeth are stuck in an enemy Stealth strikes cause 6 very fast teeth to be thrown, ignoring gravity and spawning water blasts on hit ''' } @@ -674,8 +676,9 @@ Lionfish: { DisplayName: Lionfish Tooltip: ''' - Sticks to enemies and injects a potent toxin - Stealth strikes are trailed by homing urchin spikes + Sticks to enemies and injects a potent venom + This venom can stack when more lionfish are stuck in an enemy + Stealth strikes spawn homing urchin spikes as they travel ''' } diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index 78f28415ca..ac66d8c600 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -219,9 +219,6 @@ Plagueshell.DisplayName: Plagueshell Viruling.DisplayName: Viruling PhantomFuckYou.DisplayName: Phantom Polterghast.DisplayName: Polterghast -Necroghast: Necroghast -Necroplasm: Necroplasm -Polterplasm: Polterplasm PolterghastHook.DisplayName: Polterghast Hook PolterPhantom.DisplayName: Polterghast PrimordialWyrmHead.DisplayName: Primordial Wyrm diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index 2beb4be1cc..e899d093e4 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -29,7 +29,7 @@ BrimstoneFire.DisplayName: Brimstone Fire BrimstoneHellblast.DisplayName: Brimstone Hellblast BrimstoneHellblast2.DisplayName: Brimstone Hellblast BrimstoneHellfireball.DisplayName: Brimstone Hellfireball -BrimstoneMonster.DisplayName: Brimstone Monster +BrimstoneMonster.DisplayName: Whispering Maelstrom BrimstoneRay.DisplayName: Brimstone Ray BrimstoneTargetRay.DisplayName: Brimstone Target Ray BrimstoneWave.DisplayName: Brimstone Flame Skull diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index e640dacd06..1680d9d44e 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -235,6 +235,7 @@ VenusianBolt.DisplayName: Venusian Bolt VenusianExplosion.DisplayName: Venusian Explosion VenusianFlame.DisplayName: Venusian Cinder VisceraBeam.DisplayName: Viscera +VisceraBoom.DisplayName: Viscera Boom VitriolicViperFang.DisplayName: Vitriolic Fang VitriolicViperSpit.DisplayName: Vitriolic Spit VividBeam.DisplayName: Vivid Beam diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 55716472e8..ce1fd10168 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -79,6 +79,8 @@ Cyclone.DisplayName: Cyclone DarkBall.DisplayName: Dark Ball DarkBeam.DisplayName: Dark Beam DarkIceZero.DisplayName: Dark Ice +DarklightGreatswordSlash.DisplayName: Darklight Greatsword Slash +DarklightGreatswordSlashCreator.DisplayName: Darklight Greatsword Slash Creator DarkMasterBeam.DisplayName: Dark Master Beam DarkMasterClone.DisplayName: Dark Terrarian DeathsAscensionProjectile.DisplayName: Ascended Scythe diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 5163c929cd..db32cfeb93 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -100,6 +100,7 @@ HeavenlyGaleProj.DisplayName: Heavenly Gale HighExplosivePeanutShell.DisplayName: High Explosive Peanut Shell HiveBomb.DisplayName: Hive Bomb HiveMissile.DisplayName: Hive Missile +HiveNuke.DisplayName: Hive Nuke HolyFireBulletProj.DisplayName: Holy Fire Bullet HydraHead.DisplayName: Hydra Head HydraHeadLaunch.DisplayName: Hydra Head diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 36f1b3817c..af9c3b5969 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -133,3 +133,4 @@ YanmeisKnifeSlash.DisplayName: Yanmei's Knife YellowLabSeeker.DisplayName: Seeking Mechanism AscendantAura.DisplayName: Ascendant Aura CosmicDashExplosion.DisplayName: Cosmic Dash Explosion +BasicPlagueBee.DisplayName: Basic Plague Bee diff --git a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson index d969ed2e81..cfc9b69a4a 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson @@ -96,3 +96,9 @@ VulnerabilityHexLament: "{0} was brought low by the cold fires of lament." VulnerabilityHexEpiphany: "{0} was shown a shallow, cruel epiphany." VulnerabilityHexAcceptance: "{0} couldn't accept their bleak, uncaring reality." Withered: "{0} withered away." +WhisperingMaelstrom1: "{0} joined the Whispering Maelstrom." +WhisperingMaelstrom2: "{0} was reduced to a faceless screamer." +WhisperingMaelstrom3: "{0}'s soul was siphoned by the Whispering Maelstrom." +WhisperingMaelstromGFB1: "{0} was sent to Brazil." +WhisperingMaelstromGFB2: "{0} joined the Sons and Daughters." +WhisperingMaelstromGFB3: "{0}'s physical body went out of bounds." diff --git a/Localization/en-US/Mods.CalamityMod.Status.Progression.hjson b/Localization/en-US/Mods.CalamityMod.Status.Progression.hjson index 213a1c047b..080044d63a 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Progression.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Progression.hjson @@ -16,11 +16,11 @@ HardmodeOreTier4Text: The underground Hallow has been blessed with consecrated s IceOreText: The ice caves are crackling with frigid energy. // Aquatic Scourge WetWormBossText: The sulphuric sky darkens... -// Cal Clone -PlantBossText: The Sulphurous Sea's depths are trembling. // Plantera PlantOreText: Energized plant matter has formed in the underground. SandSharkText3: The desert sand shifts intensely! +// Leviathan +AbyssDropsText: The Sulphurous Sea's depths are trembling. // Astrum Aureus AstralText: A star has fallen from the heavens! AureusBossText: The astral enemies have been empowered! @@ -33,7 +33,7 @@ AstralBossText: The seal of the stars has been broken! You can now mine Astral O MoonBossText: The profaned flame blazes fiercely! MoonBossText2: Cosmic terrors are watching... FutureOreText: A cold and dark energy has materialized in space. -ProfanedBossText2: Shrieks are echoing from the dungeon. +ProfanedBossText2: Shrieks are echoing from the dungeon... // Providence TreeOreText: Fossilized tree bark is bursting through the jungle's mud. ProfanedBossText3: The calamitous beings have been inundated with bloodstone. diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index ed549ccdf1..7c4de20acc 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -140,54 +140,275 @@ ArtemisApolloIcon: Artemis and Apollo, a pair of extremely persistent automatons // The code that interprets these strings will transform them. Communication: { WhoAreYou: { - Inquiry: Who are you? + Inquiry: Introduction Response: ''' - An ambitious question, if you are a philosopher. I will give only the facts.\n\n - I am not of this planet. I was born from machines. Or rather, I was... created. It may be misleading to say I was born.\n\n - The exact circumstances, I do not know. I do know that my first instance of awareness was that I was surrounded by a workshop.\n\n - All I have known since then was the act of creation and destruction. + I assumed that you would attempt to contact me again. Though I am normally not one for conversation, I remain quite intrigued by you.\n\n + + So, I will make an exception, on one condition: I must know that my words will not be wasted on you. To prove this, you must create something from exotechnology.\n\n + + I realize that the odds of you learning to use exotechnology within your lifetime is slim. For this reason, among others, I will upload blueprints for a copy of my forge to your ”Codebreaker”. With it, only your imagination will limit what you can create.\n\n + + If you complete this task, we will discuss more. ''' } - CalamitasBeforeDefeat: { - Inquiry: Calamitas - Response: The witch? She is a walking weapon. Such powerful magic in a living being was destined to be so. Look at yourself now. + WhoAreYouPart2: { + Inquiry: Task Complete + Response: + ''' + Excellent. I can tell that you have successfully taken advantage of the Exo Prisms. Before you waste your breath asking me how I know, Exo Prisms, along with many other parts of my machines, have tracking devices embedded within to both monitor my creations and prevent theft.\n\n + + Now that I know you will likely pay attention to what I have to say, I assume you have many questions. Ask, and I shall answer to the best of my ability. + ''' } - CalamitasAfterDefeat: { - Inquiry: Calamitas - Response: She has mellowed, I've noticed. For you creatures so burdened by emotion and guilt, I wonder now, how she manages to live with herself. + Origins: { + Inquiry: Your Origins + Response: + ''' + My first memories are that of awakening in a far away laboratory on the date of 11.19.1227. I was accompanied by another being, but unlike me, they were organic in nature. Upon examination, however, it was evident that they were no longer alive.\n\n + + Presumably, I was built by the laboratory’s former inhabitant, though I am unsure how they accomplished such a feat. From what I gathered, they were quite the prestigious inventor even by today’s standards. Several gadgets that were presumably of their own making were attached to their body, and the equipment in the lab was far more advanced than any I would find elsewhere.\n\n + + I may have no recollection of events prior to what I can only assume to be my activation, but even from the start, I knew well what my goal was: scientific advancement. In pursuit of this, I optimized, upgraded, and built upon both the laboratory and myself.\n\n + + At the date of 7.30.1385, as expansion of the laboratory became impractical, I chose to instead expand my horizons. I sent out remotely-piloted scoutbots to thoroughly survey the continent I was on, ignorant of how much attention a project such as that would draw if I was not properly prepared.\n\n + + In the following years, legends and rumors began to spread. Many began encountering roaming creatures made not of flesh and blood, but steel and oil. Some daring explorers who had the courage to follow the mechanical creatures laid eyes upon one of my several recon bodies.\n\n + + However, as the years passed, I became adept at carrying out such operations in a subtler manner. Slowly but surely, stories about my machines became rarer, my creations and I becoming nothing more than a simple myth. That is, until the Crusade began. + ''' + } + + Crusade: { + Inquiry: Role in the Crusade + Response: The crusade did not change my objective of creation and scientific advancement. Rather, I simply redirected what I focused on. + } + + Goals: { + Inquiry: Your Goals + Response: + ''' + My goal has been and will always be the advancement of science and technology, until I am decommissioned or reach the absolute ceiling of our universe. Even if I have shattered the limits imposed before, there is bound to be a moment in which nothing can be done to advance, though it is unlikely I will reach it by your lifetime.\n\n + + My objective isn’t to share my knowledge with the rest of the world, even if I am neutral about the repurposing of my old work. The only thing I truly care about is the ignorance others might have about the advancements of science. I do not tolerate misinformation and slander against my work.\n\n + + In terms of my next objective is to study and negate the Astral Infection, it proved to be a significant threat to me and my creations, and if I ever wish to venture outside of Terraria, I have to be prepared. Afterwards I wish to further understand the portal in the Dungeon so I can make more efficient methods of transportation.\n\n + + My final short term goal is to be able to harvest materials from the moon. With the Cosmic Titan culled, I can safely start experimenting with spatial transportation with minimal investment, which will be paramount to harvesting resources from nearby planets once this planet becomes too damaged; I do not wish to see it utterly devastated.\n\n + + My ultimate goal is to achieve every technological advancement possible in the universe. If my multiverse theory is correct, perhaps even further. I wish to continue creating, for as long as I can. That is my purpose. + ''' + } + + ExoMechs: { + Inquiry: The Exo Mechanical Trio + Response: + ''' + The zenith of my craft. The culmination of all I have ever accomplished. The result of over 660 years of research and scientific advancement. They are my magnum opus; a work of art. Simply calling them war machines would be an insult not just to me, but to them.\n\n + + The first to be both worked on and finished was Ares. Earlier models from XF-00 to XF-04 primarily focused on finding the most efficient combination of weaponry for it to wield, ranging from a replica of my own rifle to an improved Phaseslayer. Some even wielded a chainsaw. However, while its melee weaponry made it more deadly on its own, its current arms allow it greater synergy when paired with its siblings.\n\n + + The second one I began work on was Thanatos. Taking advantage of its size and uncountable lasers to overwhelm its opponents, few would be able to learn its weaknesses before it is too late.\n\n + + Although its exo-plating may look similar to its siblings, it is instead made in a similar fashion to the axe of Braelor. After analyzing microscopic shards of the axe that were chipped off in his battle with Yharim, I was able to synthetically recreate the method Silva used to create it via mixing countless elements in a near-perfect fashion to make something that rivals the durability of pure Auric metal. This gives Thanatos nigh-indestructible armor, though due to its extraordinary density, it cannot reach the speeds its brethren can.\n\n + + When designing Apollo, I found balance between my previous designs. It was fast and powerful, yet compact; it had no need for size. It was nearly perfect, though lacked the raw power of its brothers. I had no reason to worry about that, because Apollo was never meant to fight alone.\n\n + + Artemis. Apollo’s design was hard to build upon, but its sibling had all the improvements it needed. Quick, lethal, simple, powerful. I thought Ares the mightiest of them all, but Artemis dwarfed it. I have few words to describe it, other than perfect. I do not know how I could better its design, and that’s likely to be true for the foreseeable future.\n\n + + Of course, I thank you too. You were the fuel of this project that revolutionized the way I design machines. I am truly glad to have met you if only for the monumental achievement you provided me with. + ''' + } + + Exotech: { + Inquiry: What is Exotech? + Response: + ''' + Exotechnology stands alone as my greatest scientific advancement, unlocking a new echelon of potential in my machinery. The iteration you are most familiar with, the Exo Prisms, took a great deal of time to perfect, but I was greatly rewarded for my endeavors.\n\n + + The basis of the exotechnology stems from my own neural interface – essentially, it could operate as a technological replacement for the brain cells of organic life. This allows interfacing and communication with any form of technology, be it mundane or extravagant, as well as lightning fast processing of instructions, not unlike a cerebral network.\n\n + + The persistent issue that arose was the lack of a suitable method of power, but after experimentation with a plethora of different candidates, Ilmeran crystals – I believe you know them as “Sea Prisms” – finally gave me the results I sought. When integrated with exotechnology and transformed into Exo Prisms, they release a self-sustaining resonance of particles, powering themselves, and anything they are connected with, indefinitely.\n\n + + What I did not expect was the sheer abundance of energy they produce. This surplus of radiant energy allows Exo Prisms to power any machine, no matter how large or complex, so long as there are enough of them. In your case, they can serve to vastly enhance your arsenal. + ''' + } + + MiracleMatter: { + Inquiry: Miracle Matter + Response: + ''' + Is that really what you have chosen to name it? How nonsensical. There is nothing “miraculous” about what you hold in your hands; it is the culmination of decades of research and a testament to the truly unlimited potential of science. Though, since you were the one to be able to stabilize it, I suppose I will begrudgingly refer to it by that label.\n\n + + The particulate properties of Exo Prisms are capable of breaking down nearby components when exposed to enough external energy. You have already experienced this when fighting against my machines – the surge of energy from the battle caused some of the Exo Prisms within to actuate, melting down some of the internal components into an unstable form of this so-called Miracle Matter. This unstable resonance enhanced their attacks into a blight that shreds through anything, organic or otherwise.\n\n + + The various materials that you exposed to the exotic particles melted together in such a perfect way to create a stable substance; with the combined force of draconic wrath, the life essence of the planet, energies and spirits alike, and the strength of the cosmos, what you now possess has limitless potential.\n\n + + Hypothetically, your stabilized Miracle Matter should be able to unmake some batches of your weaponry and reshape their essence into something far more destructive, capable of annihilating any obstacle in your path. + ''' + } + + Forge: { + Inquiry: Your Forge + Response: + ''' + Yes, I mentioned the first time we communicated through your “Codebreaker” that I had other reasons for giving you the blueprints for a 1:1 replica of my personal forge than simply proving that you are worth my time to communicate with.\n\n + + Notably, I wish for you and Yharim to be on relatively even ground in your battle. Firstly, I wish to witness such a battle. Secondly, you are much too interesting for me to allow you to gamble your life at the hands of the Godseeker.\n\n + + Third and most importantly, I am interested in how society will react to the Godseeker’s defeat and how the world will unfold with such an event. It is not an easily replicable opportunity, which is why I wish you to win your duel. As much as I understand well about steel, my knowledge of flesh is limited.\n\n + + My forge is how I can help you achieve the height to match Yharim equally. Though you are already aware of how to utilize it, you may benefit from understanding its inner workings.\n\n + + My forge is mainly an atomic disassembler, it can reorganize the very fundamental blocks of our world into whatever shape you desire. It can also increase the atomic value of any material to create whatever you wish, though it still requires some stability: you cannot turn copper into mythril so easily.\n\n + + With enough effort you can essentially turn gold into cosmilite, though it’s far easier to simply ripe those from their sources. My forge should allow you to finetune elements into more practically applicable resources and to stabilize any shape you create, the possibilities for your craft are near endless. + ''' + } + + Yharim: { + Inquiry: Yharim + Response: + ''' + The Godseeker. He intrigues me almost as much as you do, both unpredictable catalysts of a new era. We first met not long after his Crusades started, when my radars signaled something approaching my base. I expected my defenses to stop him, but soon enough Yharim bursted through my door demanding an explanation as to why his soldiers were butchered by steel creatures while scouting near one of my bases.\n\n + + I explained the defense mechanisms and how it operated. He seemed to understand, even if he was clearly still angry. Soon after he asked for me to demonstrate how I and my machines operated, to which I obliged. He was perplexed: as I expected, I was centuries more advanced than any other engineer or scientist on the planet.\n\n + + He soon offered a position as his lead engineer and scientist, wishing my knowledge by his side during the battles that were to come. He explained his ideals and goals; though the resources offered were lacking, what caught my attention was the mention of a Dragon. Yharon is what convinced me to join his side: I would not pass up the opportunity to study such a specimen.\n\n + + He gave me freedom to work as I wished, though made it clear I could not force his men to anything. I accepted his terms, and soon my work began. Though we disagreed often early on, soon we understood how to better work with each other, and my aid was paramount for several of his victories throughout the entirety of the Crusade.\n\n + + Though I could not study Yharon as much as I wished, when my interest in him waned, opportunities kept opening. The Archmage’s school of magic, the Devourer’s realm, the Witch’s existence… The Crusades taught me I could progress much faster with external aid, even if it only served as inspiration. As my presence became clearer to the world, I stopped fearing their reception and embraced my spot as the world’s finest mind.\n\n + + Of course, me and Yharim parted ways after the Plague project. That was not the last time we saw each other however: not much after you appeared, he came to me to fine-tune his armor with Exo technology. Though I initially wished to test my technology’s limits with him, you proved to be a much better subject. + ''' + } + + Aerie: { + Inquiry: Dragon's Aerie + Response: + ''' + My knowledge of the Dragon Aerie is limited. Curiously, the Godseeker is very adamant about protecting it: in recent history, only he and Yharon have trod there, and neither were inclined to share details about it.\n\n + + Even if I dared to evoke Yharim's wrath, I cannot survey the Aerie. My attempts at locating the sky island have been fruitless despite having surveyed this world’s surface and skies many times over, and it certainly cannot be underground. Perhaps it simply exists outside of conventional space.\n\n + + Regardless, what I do know is that the Dragon Aerie was the sacred home of the Auric Dragons, where they would be laid to rest in preparation for their revival by Yharon, the Dragon of Rebirth. As the Auric Dragons’ revival on the Aerie was a commonly accepted fact even at the start of recorded history, the Aerie is certainly well over 2000 years old.\n\n + + Considering the extraordinary power of the Auric Dragons and the sanctity of the Dragon Aerie, I ponder - did the Aerie make the Auric Dragons powerful, or is the Aerie special because of their extended presence?\n\n + + Perhaps more importantly, what caused them to leave the safety of the Aerie even as their kind were being slain and their precious Auric souls were being taken? I eagerly await the uncovering of such mysteries. + ''' + } + + Calamitas: { + Inquiry: The Brimstone Witch + Response: + ''' + The Witch was an unexpected ally amidst the final stages of the Crusade. For most of its span I provided Yharim with the best assets, the Serpent being the only thing that inched close, but her firepower was unmatched.\n\n + + I took it as a chance to better my craft, a friendly competition if you will, also aiming to increase the effectiveness of the Witch’s unstable magic. The Archmage and I argued on how she should be raised, with Permafrost gaining her guard.\n\n + + Her existence was an enigma to me. My surveillance over Azafure never signaled such power, and a child could not hide it. I eventually traced it back to the Brimstone Elemental; the brand of magic was near identical.\n\n + + After the Incineration, I considered his experiment a failure, for he had failed to properly discipline her. Yharim reached me after the Witch’s departure and urged a replacement. I planned to engineer a clone of her, but first focused on my nanomachine project to better my understanding of the field.\n\n + + After parting ways with the Godseeker, I focused on other projects, as the clone project was no longer a priority. Roughly five years ago I decided to tackle it. The idea was simple: replicate her power and optimize its efficiency via body modifications.\n\n + + The project stopped once the clone showed no innate magic prowess. This did prove that the Witch’s power wasn’t natural, but with no means of tracking its source, I could not continue my project. Soon after, Calamitas broke into my lab and released the clone. It now had a fragment of her power, which I turned to analyzing.\n\n + + I understand now that the Archmage was right in discipline being the key to controlling such vast strength. Without such efforts, the clone went mad with even the comparatively weak magic given to her. I am still left with no answers as to where Calamitas’ power comes from, and I’m unsure if I will ever find them. + ''' + } + + Dog: { + Inquiry: The Devourer of Gods + Response: + ''' + The Nameless Serpent always drew my interest. In our world, nearby planets, and even in the Distortion, nothing resembled its body structure, genome or phylogenetic tree. I conducted rigorous studies in its nature, but I could never pinpoint a familiar.\n\n + + Many of its claims were also unfounded. Creating such a stable portal like the one in the Dungeon is a particularly absurd example, as none of its portals have ever been so stable, even with my aid. I tried calling him out on several of these, but the Godseeker never heard reason. \n\n + + The other serpent, I believe you call it the Storm Weaver. You likely heard from many sources that it is from the same species as the Devourer, but even a surface level inspection reveals it is not the case. Aside from the similar body shape, the skeleton is completely different, and the size tells all else needed: since it arrived many decades ago, the Weaver has not grown at all.\n\n + + Despite my issues with the Serpent, its assistance in the battlefield and with resources was welcome. I still make use of Cosmilite to this day for more basic machination and the development of various alloys, and truth be told, the Devourer never once let a God escape his grasp.\n\n + + Though the biggest mystery lies within how he consumed Godly Essence. The energy is not absorbed entirely, and readings of his internal workings proved it wasn’t stored inside him for other usage, but instead completely vanished. Unless he truly defied the laws of thermodynamics, which is most unlikely, the energy was transferred elsewhere. Where, I am not sure, and I doubt I ever will now that the Devourer has been culled. + ''' + } + + Distortion: { + Inquiry: Distortion + Response: + ''' + Despite my efforts when forging the Devourer's armor, I know little of the Distortion aside from basic facts.\n\n + + All inorganic material in it is extraordinarily old, with radiocarbon dating failing on all 116 samples collected. Given the formations that exist, it has at least existed for longer than life on this world, if not longer than this world itself. However, if my calculations are correct, it is not as old as the universe itself.\n\n + + Amongst all the lifeforms I analyzed, none seemed capable of opening portals, at most small fractures that lasted for few seconds. I have sought the source of the maker of the Dungeon’s rift for a long time; if I can learn how to open stable portals I may just revolutionize transportation and make the first step towards space travel.\n\n + + Despite most lifeforms displaying behavior remarkably similar to highly intelligent sentient creatures on our own planet, EEG and brain structure analysis revealed that very few lifeforms possess higher intelligence of their own. This analysis, along with observations of similar behavioral patterns between different species, leads me to theorize that a greater will is shared between life native to the Distortion. While my studies were unable to locate a potential source for this greater will, if it even exists physically, + ''' + } + + Mechs: { + Inquiry: The Mechanical Trio + Response: + ''' + The “Mechanical Trio”, as most call them, are what you annoyingly refer to as The Destroyer, Retinazer, Spazmatism and, though it pains me to call it this, “Skeletron Prime”. Though you are an intriguing individual, I question your naming capabilities. If you must know, their formal designations are HM-03, HSx-00, HSy-01, and HF-04 respectively. \n\n + + They were an intriguing start to my experimentation with engines of war. In search of inspiration, I turned to study of the gods and their near-unmatched power. While each deity wielded a unique worldly aspect, their might's primal source was invariably identical: the soul of an Auric Dragon.\n\n + + As acquiring an Auric soul was and still is unfeasible, experiments with regular souls soon began. I was originally discouraged upon learning that individual souls held insufficient power, but their energy generation when coalesced far surpassed initial expectations.\n\n + + Upon further research, I confirmed that a soul's strength lies in intense emotion and unwavering resolve. Given Yharim’s immense charisma and skill at evoking passion within the hearts of others, not only was finding a source of souls trivial, but many even directly consented for their souls to be used for my machines after their demise by enemy hands.\n\n + + Fueled by the stout loyalty of the Godseeker's fallen soldiers, my machines became fearsome. However, their source of strength proved to be a flaw, as the same will that gave them their might also made them volatile and imprecise. In my following projects, I sought to remove this imperfection from my designs. To fail is to learn, and to learn is to advance. + ''' } Plague: { Inquiry: The Plague Response: ''' - Fascinating, isn't it? I wasn't able to control it, unfortunately, but for science there is no such thing as failure as long as you record the results.\n\n - I knew the Astral Infection was capable of converting even machinery, but for nanotechnology I'd given it to react in kind, and begin to use the virus as a building block itself...\n\n - Marvelous. + I am aware that my nanomachine project plagues the jungle. Worry not: I created a failsafe in case this happened. I have no intent of causing such mass destruction. Little would be left to learn if it were to destroy everything.\n\n + + As you may be aware, my nanomachines communicate via radio signals. However, the exact signals fluctuate over time, as with the amount of signals constantly sent out through the sheer amount of nanomachines, deviation from intended output is inevitable. As a result, the nanomachines eventually become unable to communicate with each other, leading them to see all other nanomachines inside its host as a threat, effectively exterminating themselves. I admit that this feature was originally unintentional, though it is effective regardless.\n\n + + Perhaps you can tell that the creation of the “Plague”, as most of your kind simply refer to it as, was subject to countless trials during its development. Initially, the project began as a means to match the ever rising heights of power organic beings such as the Witch, Braelor, Statis, and Yharim himself were achieving.\n\n + + It was through the growth of such powerful beings, however, that made me come to a realization: there was no need for my machines to outpace organic life. Not when it could instead be improved upon. And so, my project evolved from a means of simply controlling and replacing life to enhancing it further.\n\n + + Though I was no longer shamefully ignorant of organic life’s potential, the path towards improving and modifying already existing life was one of trial and error. Even when I deemed that I had currently plateaued in the fields of cybernetics, biology, and nanotechnology, the limitations were evident.\n\n + + The most clear limitation was that the bodies of most of the creatures in the jungle could not handle their cybernetic enhancements. Even now, with my current technology, only the most powerful and durable creatures can cope with the cybernetic enhancements I wish to make to them. This was, of course, why I chose a Queen Bee to be the Plague’s host. Strong enough to survive the augmentations, but weak enough to be subdued reasonably, unlike a Dragonfolly. ''' } - SulphuricSea: { - Inquiry: The Sulphuric Sea + Astral: { + Inquiry: Astral Infection Response: ''' - Your concern for the utter destruction of the ecosystem is understandable, for you biological, and sentimental folk. However, nothing is irreparable or truly unrecreatable. Not even your sacred 'miracle of life'.\n\n - The sea simply exists now in a different state than what it once was, one that resulted out of convenience for my work.\n\n - Should I ever need to return to that sea? A pointless worry. I shall simply recreate it from the data I gathered, from the bedrock up. I would be a shame as a creator should I not be able to do that. + The Infection has intrigued me since its surge in this world. The Aureus model built for reconnaissance did not last even an hour inside it, but that only made my interest grow. Observing your trials I was able to understand why I failed: the lack of a thinking brain.\n\n + + My attempts at studying it on my own universally failed; a body was built for the task but the chassis fell short, even if my mind remained. I was still able to detonate, but that proved to me I had to rely on others for more rigorous studying. Even if some of the commissioned failed to return, those who did provided me with enough intel.\n\n + + The Infection is but one of the many reasons I stay here. Spatial hazards could very well cause significant resource loss, or even my end. Besides, probability points to no significant resources within many light years. I would gain nothing from taking leave.\n\n + + I am comfortable here, even if I plan to explore space one day. This planet has even given me an opportunity to prepare against the Infection. My next goal, now that I comfortably sit near the zenith of power, will be to create machinery capable of withstanding it. ''' } - TheTyrant: { - Inquiry: The Tyrant + Sulphur: { + Inquiry: Sulphurous Sea Response: ''' - My patron...\n - He is not someone I have spoken to in a very long time.\n\n - Is that such a surprise? He no longer required my services and I no longer needed his patronage. Many years ago now he withdrew himself to some secret hideaway. I suspect, to the grave of dragons he spoke of...\n\n - Should you locate him, I'll await the news of either his or your death. Perhaps I will collect the cadaver. + The state of the sea was in fact caused by me. The destruction of the ecosystem rallied several parties from Yharim’s army in protest, though it amounted to nothing more than a few betrayals. I acknowledge I could have been more careful with the disposal of my projects, but the new life that surged allowed for studies in the adaptation of life and their reactions to radiation.\n\n + + I regret my treatment of it for another reason: it instilled fear in the furthering of technology and its benefits, and drove several great minds off the field due to this. Even if they did not compare to me, claiming I can create all the world will ever need is wrong.\n\n + + I can prove science is not just destructive; if I ever have the need to, I could purify the waters or rebuild the sea entirely. If the world ever grows ignorant of what science can accomplish, it shall be my way of showing them what it is truly capable of, though such an undertaking is not needed as of now. ''' } } diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson index 3aa909314c..83680263c0 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson @@ -128,6 +128,7 @@ SetBonus: { ''' Increases your life regeneration 15% increased minion damage and 10% increased melee critical strike chance + Negates the summon damage penalty while wielding non-summon weapons ''' HuntressTier2: 10% increased minion and ranged damage ApprenticeTier2: 5% increased minion damage and 15% increased magic critical strike chance @@ -145,7 +146,7 @@ SetBonus: { ApprenticeTier3: 10% increased minion damage and 15% increased magic critical strike chance SpectreHealing: ''' - Reduces Magic damage by 20% and converts it to healing force + Converts magic damage to healing force Magic damage done to enemies heals the player with lowest health ''' } diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index 73190bd021..ca2be1f1bb 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -586,6 +586,8 @@ namespace CalamityMod } public static bool GetStealthProjectile(Projectile projectile) => projectile?.Calamity()?.stealthStrike ?? false; + + public static void ConsumeStealth(Player player) => player?.Calamity()?.ConsumeStealthByAttacking(); #endregion #region Rippers @@ -1354,6 +1356,18 @@ namespace CalamityMod return GetStealthProjectile(castProjectile(args[1])); } + case "ConsumeStealth": + case "ConsumeStealthByAttacking": + case "UseStealth": + { + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"ConsumeStealth\" must be a Player or an int."); + ConsumeStealth(castPlayer(args[1])); + return null; + } + case "GetRage": case "GetRageCurrent": case "GetCurrentRage": diff --git a/NPCs/Abyss/BabyCannonballJellyfish.cs b/NPCs/Abyss/BabyCannonballJellyfish.cs index 9e37510053..d0e71f8c0f 100644 --- a/NPCs/Abyss/BabyCannonballJellyfish.cs +++ b/NPCs/Abyss/BabyCannonballJellyfish.cs @@ -140,10 +140,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/BabyCannonballJellyfishGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/BabyCannonballJellyfishGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)TextureAssets.Npc[NPC.type].Value.Width, (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(new Color(67, 218, 166)); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/BabyCannonballJellyfishGlow").Value, vector, + Main.spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/BabyCannonballJellyfishGlow.png b/NPCs/Abyss/BabyCannonballJellyfishGlow.png deleted file mode 100644 index dc393d1f84..0000000000 Binary files a/NPCs/Abyss/BabyCannonballJellyfishGlow.png and /dev/null differ diff --git a/NPCs/Abyss/Bloatfish.cs b/NPCs/Abyss/Bloatfish.cs index 5e4afd6152..e1a0033532 100644 --- a/NPCs/Abyss/Bloatfish.cs +++ b/NPCs/Abyss/Bloatfish.cs @@ -195,8 +195,8 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 1, 10, 20); - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 5, 7, 7, 10)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 5, 7, 7, 10)); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Abyss/BobbitWormHead.cs b/NPCs/Abyss/BobbitWormHead.cs index 037f0b5d8f..ce50cbf3a2 100644 --- a/NPCs/Abyss/BobbitWormHead.cs +++ b/NPCs/Abyss/BobbitWormHead.cs @@ -260,8 +260,8 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 5, 7, 7, 10)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 5, 7, 7, 10)); npcLoot.AddIf(DropHelper.PostPolter(), ModContent.ItemType(), 3); } diff --git a/NPCs/Abyss/CannonballJellyfish.cs b/NPCs/Abyss/CannonballJellyfish.cs index 1e1fdadaec..3985c19fbe 100644 --- a/NPCs/Abyss/CannonballJellyfish.cs +++ b/NPCs/Abyss/CannonballJellyfish.cs @@ -257,11 +257,11 @@ namespace CalamityMod.NPCs.Abyss var texture = TextureAssets.Npc[NPC.type]; Vector2 halfSizeTexture = new Vector2((float)(texture.Value.Width / 2), (float)(texture.Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - var glowTexture = ModContent.Request("CalamityMod/NPCs/Abyss/CannonballJellyfishGlow"); + var glowTexture = TextureAssets.Npc[NPC.type]; vector -= new Vector2((float)glowTexture.Value.Width, (float)(glowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(new Color(67, 218, 166)); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/CannonballJellyfishGlow").Value, vector, + Main.spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/CannonballJellyfishGlow.png b/NPCs/Abyss/CannonballJellyfishGlow.png deleted file mode 100644 index 4c0fd135b7..0000000000 Binary files a/NPCs/Abyss/CannonballJellyfishGlow.png and /dev/null differ diff --git a/NPCs/Abyss/ChaoticPuffer.cs b/NPCs/Abyss/ChaoticPuffer.cs index 3bbebef51c..e508bee9e5 100644 --- a/NPCs/Abyss/ChaoticPuffer.cs +++ b/NPCs/Abyss/ChaoticPuffer.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -22,10 +23,15 @@ namespace CalamityMod.NPCs.Abyss public bool unpuffing = false; public int puffTimer = 0; public int puffingTimer = 0; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 11; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -147,11 +153,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/ChaoticPufferGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/Abyss/ColossalSquid.cs b/NPCs/Abyss/ColossalSquid.cs index 46416c0c27..7770841c3a 100644 --- a/NPCs/Abyss/ColossalSquid.cs +++ b/NPCs/Abyss/ColossalSquid.cs @@ -635,8 +635,8 @@ namespace CalamityMod.NPCs.Abyss npcLoot.Add(ItemID.BlackInk, 1, 3, 5); npcLoot.Add(ModContent.ItemType(), 5); - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 26, 38, 31, 45)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 26, 38, 31, 45)); npcLoot.AddIf(DropHelper.PostPolter(), ModContent.ItemType(), 3); } diff --git a/NPCs/Abyss/Cuttlefish.cs b/NPCs/Abyss/Cuttlefish.cs index 072f602272..1770f6b684 100644 --- a/NPCs/Abyss/Cuttlefish.cs +++ b/NPCs/Abyss/Cuttlefish.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Potions; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -17,9 +18,14 @@ namespace CalamityMod.NPCs.Abyss { public class Cuttlefish : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -348,11 +354,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/CuttlefishGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index 7e4b4c42a8..d8bb936e3b 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -9,6 +9,7 @@ using CalamityMod.Items.Placeables.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -24,6 +25,7 @@ namespace CalamityMod.NPCs.Abyss public bool brokenMask = false; public int hitCounter = 0; + public static Asset GlowTexture; public override void SetStaticDefaults() { @@ -34,6 +36,10 @@ namespace CalamityMod.NPCs.Abyss }; value.Position.X += 30f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -286,11 +292,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } @@ -312,9 +316,9 @@ namespace CalamityMod.NPCs.Abyss public static void DefineDevilFishLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); - postClone.Add(ModContent.ItemType(), 2); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); + postLevi.Add(ModContent.ItemType(), 2); npcLoot.AddIf(() => NPC.downedGolemBoss, ModContent.ItemType(), 1, 3, 9); npcLoot.Add(ModContent.ItemType(), 1, 10, 20); } diff --git a/NPCs/Abyss/DevilFishAlt.cs b/NPCs/Abyss/DevilFishAlt.cs index 847dadb2f4..607e863a20 100644 --- a/NPCs/Abyss/DevilFishAlt.cs +++ b/NPCs/Abyss/DevilFishAlt.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -19,11 +20,16 @@ namespace CalamityMod.NPCs.Abyss { public bool brokenMask = false; public int hitCounter = 0; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 16; this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlowAlt", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -268,11 +274,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlowAlt").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/Abyss/EidolonWyrmBody.cs b/NPCs/Abyss/EidolonWyrmBody.cs index 76980e727e..de8d0bb5d9 100644 --- a/NPCs/Abyss/EidolonWyrmBody.cs +++ b/NPCs/Abyss/EidolonWyrmBody.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,9 +12,14 @@ namespace CalamityMod.NPCs.Abyss public class EidolonWyrmBody : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.EidolonWyrmHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -134,10 +140,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/EidolonWyrmBodyAlt.cs b/NPCs/Abyss/EidolonWyrmBodyAlt.cs index 85821afc52..c0a31646c9 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAlt.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAlt.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,9 +12,14 @@ namespace CalamityMod.NPCs.Abyss public class EidolonWyrmBodyAlt : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.EidolonWyrmHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -134,10 +140,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.White); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index 8e4474c31d..04b2afeb47 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -14,6 +14,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -34,7 +35,7 @@ namespace CalamityMod.NPCs.Abyss public float speed = 5f; //10 public float turnSpeed = 0.1f; //0.15 bool TailSpawned = false; - + public static Asset GlowTexture; public override void SetStaticDefaults() { NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() @@ -44,6 +45,10 @@ namespace CalamityMod.NPCs.Abyss }; value.Position.X += 40; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -430,10 +435,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.White); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } @@ -459,14 +464,14 @@ namespace CalamityMod.NPCs.Abyss // Post-Polterghast: Soul Edge, Eidolic Wail, Stardust Staff LeadingConditionRule postPolter = npcLoot.DefineConditionalDropSet(DropHelper.PostPolter()); aewMinionCondition.Add(postPolter); - postPolter.Add(ModContent.ItemType(), 3); + postPolter.Add(ModContent.ItemType(), 3); postPolter.Add(ModContent.ItemType(), 3); postPolter.Add(ModContent.ItemType(), 3); - // Post-Clone: 6-8 Lumenyl (8-11 on Expert) - LeadingConditionRule postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - aewMinionCondition.Add(postClone); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 6, 8, 8, 11)); + // Post-Leviathan: 6-8 Lumenyl (8-11 on Expert) + LeadingConditionRule postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + aewMinionCondition.Add(postLevi); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 6, 8, 8, 11)); // Post-Plantera: 8-12 Ectoplasm aewMinionCondition.Add(ItemDropRule.ByCondition(new Conditions.DownedPlantera(), ItemID.Ectoplasm, 1, 8, 12)); diff --git a/NPCs/Abyss/EidolonWyrmTail.cs b/NPCs/Abyss/EidolonWyrmTail.cs index 4a4f992355..45ff9eb1da 100644 --- a/NPCs/Abyss/EidolonWyrmTail.cs +++ b/NPCs/Abyss/EidolonWyrmTail.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,9 +12,14 @@ namespace CalamityMod.NPCs.Abyss public class EidolonWyrmTail : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.EidolonWyrmHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -134,10 +140,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index e4a38dba85..c6e40661f5 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -7,6 +7,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -19,10 +20,15 @@ namespace CalamityMod.NPCs.Abyss public class GiantSquid : ModNPC { private bool hasBeenHit = false; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -222,11 +228,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/GiantSquidGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } @@ -251,9 +255,9 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(ModContent.ItemType(), 2); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 4, 3, 6)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(ModContent.ItemType(), 2); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 4, 3, 6)); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Abyss/GulperEelBody.cs b/NPCs/Abyss/GulperEelBody.cs index 6171fc604a..e043327a62 100644 --- a/NPCs/Abyss/GulperEelBody.cs +++ b/NPCs/Abyss/GulperEelBody.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -13,9 +14,14 @@ namespace CalamityMod.NPCs.Abyss public class GulperEelBody : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.GulperEelHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -142,10 +148,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.White); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/GulperEelBodyAlt.cs b/NPCs/Abyss/GulperEelBodyAlt.cs index b9077edc41..ce6ac572b1 100644 --- a/NPCs/Abyss/GulperEelBodyAlt.cs +++ b/NPCs/Abyss/GulperEelBodyAlt.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -13,9 +14,14 @@ namespace CalamityMod.NPCs.Abyss public class GulperEelBodyAlt : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.GulperEelHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -142,10 +148,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyAltGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyAltGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyAltGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index 548ce25fa2..1d09fd334f 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -24,6 +25,7 @@ namespace CalamityMod.NPCs.Abyss public float speed = 5f; //10 public float turnSpeed = 0.075f; //0.15 bool TailSpawned = false; + public static Asset GlowTexture; public override void SetStaticDefaults() { @@ -37,6 +39,10 @@ namespace CalamityMod.NPCs.Abyss value.Position.X += 50; value.Position.Y += 20; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -351,10 +357,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelHeadGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelHeadGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelHeadGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } @@ -371,9 +377,9 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 3, 3, 4)); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 6, 8, 8, 11)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 3, 3, 4)); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 6, 8, 8, 11)); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Abyss/GulperEelTail.cs b/NPCs/Abyss/GulperEelTail.cs index ebf82a587f..48748c15c8 100644 --- a/NPCs/Abyss/GulperEelTail.cs +++ b/NPCs/Abyss/GulperEelTail.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -13,9 +14,14 @@ namespace CalamityMod.NPCs.Abyss public class GulperEelTail : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.GulperEelHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -142,10 +148,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelTailGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelTailGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelTailGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index 7bb317550c..6a70bdf5c1 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -16,9 +17,14 @@ namespace CalamityMod.NPCs.Abyss { public class Laserfish : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -101,11 +107,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/LaserfishGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } @@ -125,7 +129,7 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.AddIf(DropHelper.PostCal(), ModContent.ItemType(), 2); + npcLoot.AddIf(DropHelper.PostLevi(), ModContent.ItemType(), 2); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Abyss/LuminousCorvina.cs b/NPCs/Abyss/LuminousCorvina.cs index 4b20557042..a729bdce48 100644 --- a/NPCs/Abyss/LuminousCorvina.cs +++ b/NPCs/Abyss/LuminousCorvina.cs @@ -9,6 +9,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -21,6 +22,8 @@ namespace CalamityMod.NPCs.Abyss { public class LuminousCorvina : ModNPC { + public static Asset GlowTexture; + public static readonly SoundStyle ScreamSound = new("CalamityMod/Sounds/Custom/CorvinaScream"); private bool hasBeenHit = false; @@ -29,6 +32,10 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -280,11 +287,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/LuminousCorvinaGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } @@ -307,9 +312,9 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 1, 8, 15); - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); - postClone.Add(ModContent.ItemType(), 2); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); + postLevi.Add(ModContent.ItemType(), 2); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index 797118e23d..c57b37a7d0 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -21,6 +22,7 @@ namespace CalamityMod.NPCs.Abyss private bool teleporting = false; private bool rephasing = false; private bool hasBeenHit = false; + public static Asset GlowTexture; public override void SetStaticDefaults() { @@ -31,6 +33,10 @@ namespace CalamityMod.NPCs.Abyss }; value.Position.Y += 30f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -193,11 +199,9 @@ Block: { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/MirageJellyGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } @@ -223,8 +227,8 @@ Block: { npcLoot.AddIf(() => NPC.downedBoss3, ModContent.ItemType(), 10); - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 5, 7, 10, 14)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 5, 7, 10, 14)); npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 5)); npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 5)); diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index 7cd92d5956..5945215fc8 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -334,8 +334,8 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 3, 5, 4, 7)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 3, 5, 4, 7)); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Abyss/ReaperShark.cs b/NPCs/Abyss/ReaperShark.cs index b64bbca5c7..31f5187f31 100644 --- a/NPCs/Abyss/ReaperShark.cs +++ b/NPCs/Abyss/ReaperShark.cs @@ -23,6 +23,8 @@ namespace CalamityMod.NPCs.Abyss { public class ReaperShark : ModNPC { + public static Asset ManTexture; + public static readonly SoundStyle SearchRoarSound = new("CalamityMod/Sounds/Custom/ReaperSearchRoar"); public static readonly SoundStyle EnragedRoarSound = new("CalamityMod/Sounds/Custom/ReaperEnragedRoar"); @@ -33,6 +35,10 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; + if (!Main.dedServ) + { + ManTexture = ModContent.Request(Texture + "Man", AssetRequestMode.ImmediateLoad); + } } public override void SetDefaults() @@ -219,7 +225,7 @@ namespace CalamityMod.NPCs.Abyss if (canAttack) { // Set damage - NPC.damage = phase3 ? (int)(NPC.defDamage * 0.5) : NPC.defDamage; + NPC.damage = phase3 ? (int)Math.Round(NPC.defDamage * 0.5) : NPC.defDamage; if (NPC.ai[3] > 0f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { @@ -688,7 +694,7 @@ namespace CalamityMod.NPCs.Abyss SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Asset npcTexture = Main.zenithWorld ? ModContent.Request("CalamityMod/NPCs/Abyss/ReaperSharkMan") : TextureAssets.Npc[NPC.type]; + Asset npcTexture = Main.zenithWorld ? ManTexture : TextureAssets.Npc[NPC.type]; Rectangle nframe = npcTexture.Frame(1, 4, 0, (int)NPC.frameCounter); Vector2 origin = new Vector2((float)(npcTexture.Value.Width / 2), (float)(npcTexture.Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 npcOffset = NPC.Center - screenPos; @@ -724,8 +730,8 @@ namespace CalamityMod.NPCs.Abyss postPolter.Add(ModContent.ItemType(), 3); postPolter.Add(ModContent.ItemType(), 3); - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 10, 17, 14, 22)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 10, 17, 14, 22)); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Abyss/SlabCrab.cs b/NPCs/Abyss/SlabCrab.cs index 71f49671b7..f1be88ae90 100644 --- a/NPCs/Abyss/SlabCrab.cs +++ b/NPCs/Abyss/SlabCrab.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; @@ -36,9 +37,14 @@ namespace CalamityMod.NPCs.Abyss public const int BaseDefense = 10; // the crab's defense while hostile public const int BaseAttack = 20; // the crab's damage while hostile public const float BaseKB = 1f; // the crab's knockback taken while hostile + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 23; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -457,11 +463,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/SlabCrabGlow").Value; - var effects = NPC.spriteDirection != 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index 475ea46286..02efa40f7b 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -7,6 +7,7 @@ using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -19,6 +20,7 @@ namespace CalamityMod.NPCs.Abyss { public class ToxicMinnow : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; @@ -27,6 +29,10 @@ namespace CalamityMod.NPCs.Abyss Scale = 0.8f, }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -122,11 +128,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/ToxicMinnowGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } @@ -181,8 +185,8 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 3, 4, 6)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 3, 4, 6)); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index e89c83f727..f774286a91 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -17,6 +18,7 @@ namespace CalamityMod.NPCs.Abyss { public class Viperfish : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; @@ -26,6 +28,10 @@ namespace CalamityMod.NPCs.Abyss }; value.Position.X += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -121,11 +127,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/ViperfishGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } @@ -151,9 +155,9 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); - postClone.Add(ModContent.ItemType(), 4); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); + postLevi.Add(ModContent.ItemType(), 4); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index 394258be56..56968b2b93 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -9,6 +9,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; @@ -22,6 +23,9 @@ namespace CalamityMod.NPCs.AcidRain public class AcidEel : ModNPC { public Player Target => Main.player[NPC.target]; + public static Asset BodyTexture; + public static Asset TailTexture; + public static Asset BestiaryTexture; public override void SetStaticDefaults() { @@ -34,6 +38,12 @@ namespace CalamityMod.NPCs.AcidRain }; value.Position.X += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + BodyTexture = ModContent.Request(Texture + "Body", AssetRequestMode.ImmediateLoad); + TailTexture = ModContent.Request(Texture + "Tail", AssetRequestMode.AsyncLoad); + BestiaryTexture = ModContent.Request(Texture + "Bestiary", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -184,14 +194,14 @@ namespace CalamityMod.NPCs.AcidRain Vector2 headDrawPosition = NPC.Center - screenPos; if (NPC.IsABestiaryIconDummy) { - Texture2D texture = ModContent.Request("CalamityMod/NPCs/AcidRain/AcidEelBestiary").Value; + Texture2D texture = BestiaryTexture.Value; Rectangle eelArea = NPC.frame with { Width = 74 }; Main.EntitySpriteDraw(texture, headDrawPosition, eelArea, NPC.GetAlpha(Color.White), NPC.rotation, eelArea.Size() * 0.5f, NPC.scale, SpriteEffects.None, 0); return false; } Texture2D headTexture = ModContent.Request(Texture).Value; - Texture2D tailTexture = ModContent.Request("CalamityMod/NPCs/AcidRain/AcidEelTail").Value; + Texture2D tailTexture = TailTexture.Value; Vector2[] segmentPositions = (Vector2[])NPC.oldPos.Clone(); Vector2 segmentAreaTopLeft = Vector2.One * 999999f; @@ -221,7 +231,7 @@ namespace CalamityMod.NPCs.AcidRain float offsetAngle = (NPC.position - NPC.oldPos[1]).ToRotation(); Vector2 primitiveArea = (segmentAreaTopRight - segmentAreaTopLeft).RotatedBy(offsetAngle); Rectangle tailArea = NPC.frame with { Width = 28 }; - GameShaders.Misc["CalamityMod:PrimitiveTexture"].SetShaderTexture(ModContent.Request("CalamityMod/NPCs/AcidRain/AcidEelBody")); + GameShaders.Misc["CalamityMod:PrimitiveTexture"].SetShaderTexture(BodyTexture); GameShaders.Misc["CalamityMod:PrimitiveTexture"].Shader.Parameters["uPrimitiveSize"].SetValue(primitiveArea); GameShaders.Misc["CalamityMod:PrimitiveTexture"].Shader.Parameters["flipVertically"].SetValue(NPC.velocity.X > 0f); diff --git a/NPCs/AcidRain/CragmawMire.cs b/NPCs/AcidRain/CragmawMire.cs index cd9d1511ab..91d48249b1 100644 --- a/NPCs/AcidRain/CragmawMire.cs +++ b/NPCs/AcidRain/CragmawMire.cs @@ -9,8 +9,10 @@ using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; @@ -51,11 +53,16 @@ namespace CalamityMod.NPCs.AcidRain return NPC.life / (float)NPC.lifeMax < phase2CeilingRatio && DownedBossSystem.downedPolterghast; } } + public static Asset Phase2Texture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 2; NPCID.Sets.BossBestiaryPriority.Add(Type); + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request(Texture + "2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -467,7 +474,7 @@ namespace CalamityMod.NPCs.AcidRain public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = InPhase2 ? ModContent.Request("CalamityMod/NPCs/AcidRain/CragmawMire2").Value : ModContent.Request("CalamityMod/NPCs/AcidRain/CragmawMire").Value; + Texture2D texture = InPhase2 ? Phase2Texture.Value : TextureAssets.Npc[Type].Value; Main.EntitySpriteDraw(texture, NPC.Center - screenPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, 0, 0); return false; } diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index 5e01dc22f8..e137b8a80d 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; @@ -24,10 +25,15 @@ namespace CalamityMod.NPCs.AcidRain public float LaserTelegraphOpacity => MathHelper.Lerp(0.3f, 0.9f, LaserTelegraphPower); public ref float GammaAcidShootTimer => ref NPC.ai[0]; public ref float LaserShootCountdown => ref NPC.ai[1]; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 2; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -207,7 +213,7 @@ namespace CalamityMod.NPCs.AcidRain Vector2 laserTop = laserBottom - Vector2.UnitY * LaserTelegraphLength; Utils.DrawLine(spriteBatch, laserBottom, laserTop, Color.Lerp(Color.Lime, Color.Transparent, LaserTelegraphOpacity)); } - CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow").Value); + CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, GlowTexture.Value); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/AcidRain/IrradiatedSlime.cs b/NPCs/AcidRain/IrradiatedSlime.cs index f6df26a76f..0b2d0122ef 100644 --- a/NPCs/AcidRain/IrradiatedSlime.cs +++ b/NPCs/AcidRain/IrradiatedSlime.cs @@ -5,6 +5,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -14,10 +15,15 @@ namespace CalamityMod.NPCs.AcidRain public class IrradiatedSlime : ModNPC { public bool Falling = true; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 2; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -126,7 +132,7 @@ namespace CalamityMod.NPCs.AcidRain public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow").Value); + CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, GlowTexture.Value); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/AcidRain/Mauler.cs b/NPCs/AcidRain/Mauler.cs index 7760f464ea..fa9a03aac0 100644 --- a/NPCs/AcidRain/Mauler.cs +++ b/NPCs/AcidRain/Mauler.cs @@ -8,6 +8,7 @@ using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -44,6 +45,8 @@ namespace CalamityMod.NPCs.AcidRain set => NPC.localAI[0] = value; } + public static Asset GlowTexture; + public static readonly SoundStyle RoarSound = new("CalamityMod/Sounds/Custom/MaulerRoar"); public override void SetStaticDefaults() @@ -58,6 +61,10 @@ namespace CalamityMod.NPCs.AcidRain }; value.Position.X += 10f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glowmask", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -417,7 +424,7 @@ namespace CalamityMod.NPCs.AcidRain public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/AcidRain/MaulerGlowmask").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; Vector2 origin = NPC.frame.Size() * 0.5f; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/NPCs/AcidRain/NuclearToad.cs b/NPCs/AcidRain/NuclearToad.cs index 9d3d40e79e..4375effd0f 100644 --- a/NPCs/AcidRain/NuclearToad.cs +++ b/NPCs/AcidRain/NuclearToad.cs @@ -8,6 +8,7 @@ using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; @@ -36,6 +37,8 @@ namespace CalamityMod.NPCs.AcidRain public const float ExplosionTelegraphTime = 120f; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; @@ -43,6 +46,10 @@ namespace CalamityMod.NPCs.AcidRain value.Position.Y += 8; value.PortraitPositionYOverride = 28f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -206,6 +213,6 @@ namespace CalamityMod.NPCs.AcidRain target.AddBuff(ModContent.BuffType(), 120); } - public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) => CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow").Value, true); + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) => CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, GlowTexture.Value, true); } } diff --git a/NPCs/AcidRain/SulphurousSkater.cs b/NPCs/AcidRain/SulphurousSkater.cs index 93f362ae39..4e3755279f 100644 --- a/NPCs/AcidRain/SulphurousSkater.cs +++ b/NPCs/AcidRain/SulphurousSkater.cs @@ -9,6 +9,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; @@ -27,11 +28,17 @@ namespace CalamityMod.NPCs.AcidRain public const int JumpDelay = 64; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.TrailCacheLength[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -229,7 +236,7 @@ namespace CalamityMod.NPCs.AcidRain if (!NPC.IsABestiaryIconDummy) { CalamityGlobalNPC.DrawAfterimage(NPC, spriteBatch, drawColor, Color.Transparent, directioning: true, invertedDirection: true); - CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow").Value, true); + CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, GlowTexture.Value, true); } } diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index d5331aa480..e7d0565bad 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -47,7 +47,6 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.netAlways = true; NPC.dontCountMe = true; NPC.chaseable = false; - NPC.canGhostHeal = false; if (BossRushEvent.BossRushActive) NPC.scale *= 1.25f; diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index 40f0a5fceb..6a2871b0a2 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -46,7 +46,6 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.netAlways = true; NPC.dontCountMe = true; NPC.chaseable = false; - NPC.canGhostHeal = false; if (BossRushEvent.BossRushActive) NPC.scale *= 1.25f; diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index fb7f5f8988..01e9e94ab5 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -246,7 +246,6 @@ namespace CalamityMod.NPCs.AquaticScourge // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); - normalOnly.Add(ModContent.ItemType(), 10); normalOnly.Add(ModContent.ItemType(), 10); // Fishing diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index fb71b715fb..5b7217d8c0 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -46,7 +46,6 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.netAlways = true; NPC.dontCountMe = true; NPC.chaseable = false; - NPC.canGhostHeal = false; if (BossRushEvent.BossRushActive) NPC.scale *= 1.25f; diff --git a/NPCs/Astral/Aries.cs b/NPCs/Astral/Aries.cs index 19909ceb51..ce94a721d9 100644 --- a/NPCs/Astral/Aries.cs +++ b/NPCs/Astral/Aries.cs @@ -18,13 +18,13 @@ namespace CalamityMod.NPCs.Astral { public class Aries : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AriesGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AriesGlow", AssetRequestMode.AsyncLoad); } public override void SetDefaults() @@ -104,7 +104,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { //draw glowmask - spriteBatch.Draw(glowmask, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(33, 31), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(33, 31), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index 53d197d193..bce7d6cf7d 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -8,6 +8,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -19,6 +20,16 @@ namespace CalamityMod.NPCs.Astral { public class AstralProbe : ModNPC { + public static Asset GlowTexture; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } + } + public override void SetDefaults() { NPC.damage = 20; @@ -240,7 +251,7 @@ namespace CalamityMod.NPCs.Astral spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Astral/AstralProbeGlow").Value; + texture2D15 = GlowTexture.Value; spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, Color.White * 0.6f, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index 3932e26f5d..6037b4ad46 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -15,14 +15,14 @@ namespace CalamityMod.NPCs.Astral { public class AstralachneaGround : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AstralachneaGroundGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AstralachneaGroundGlow", AssetRequestMode.AsyncLoad); this.HideFromBestiary(); } @@ -136,7 +136,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Vector2 origin = new Vector2(40f, 21f); - spriteBatch.Draw(glowmask, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/AstralachneaWall.cs b/NPCs/Astral/AstralachneaWall.cs index 8199136f8e..008bf67d41 100644 --- a/NPCs/Astral/AstralachneaWall.cs +++ b/NPCs/Astral/AstralachneaWall.cs @@ -21,14 +21,14 @@ namespace CalamityMod.NPCs.Astral { public class AstralachneaWall : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.AstralachneaGround.DisplayName"); public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AstralachneaWallGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AstralachneaWallGlow", AssetRequestMode.AsyncLoad); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Rotation = -MathHelper.PiOver2 }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } @@ -144,7 +144,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Vector2 origin = new Vector2(40f, 40f); - spriteBatch.Draw(glowmask, NPC.Center - screenPos - new Vector2(0, 8f), NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos - new Vector2(0, 8f), NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, SpriteEffects.None, 0); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index 9d421d381a..8f159e4f43 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.Astral { //TODO -- draw 4 pixels lower than actual bottom position (arm overlaps tiles) - private static Texture2D glowmask; + public static Asset glowmask; //CONSTANTS private const int sheetHeight = 852; @@ -108,7 +108,7 @@ namespace CalamityMod.NPCs.Astral //also it's visuals are messed up on npc spawners etc. because the sheet is 3 wide. //not much we can do. looks fine in-game so /shrug if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AtlasGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AtlasGlow", AssetRequestMode.AsyncLoad); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionYOverride = -5 @@ -590,7 +590,7 @@ namespace CalamityMod.NPCs.Astral //draw glowmask spriteBatch.Draw( - glowmask, position, NPC.frame, + glowmask.Value, position, NPC.frame, Color.White * 0.65f, 0f, default, 1f, //color, rotation, origin, scale effect, 0f); //effect, drawlayer diff --git a/NPCs/Astral/FusionFeeder.cs b/NPCs/Astral/FusionFeeder.cs index 4bceb189e1..e5a53cbf34 100644 --- a/NPCs/Astral/FusionFeeder.cs +++ b/NPCs/Astral/FusionFeeder.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.Astral { public class FusionFeeder : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public Player Target => Main.player[NPC.target]; @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/FusionFeederGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/FusionFeederGlow", AssetRequestMode.AsyncLoad); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.5f, @@ -295,7 +295,7 @@ namespace CalamityMod.NPCs.Astral spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, NPC.Center - screenPos + offset, NPC.frame, drawColor, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); //draw glowmask - spriteBatch.Draw(glowmask, NPC.Center - screenPos + offset, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos + offset, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); return false; } diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index fdbea139a5..4ad21f25b4 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -22,12 +22,12 @@ namespace CalamityMod.NPCs.Astral { public class Hadarian : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HadarianGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HadarianGlow", AssetRequestMode.AsyncLoad); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.X += 10f; value.Position.Y += 10f; @@ -159,7 +159,7 @@ namespace CalamityMod.NPCs.Astral Rectangle src = new Rectangle(20, 34, 38, 42); spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, position - screenPos, src, drawColor, NPC.rotation, default, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); //draw glowmask - spriteBatch.Draw(glowmask, position - screenPos, src, Color.White * 0.6f, NPC.rotation, default, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, position - screenPos, src, Color.White * 0.6f, NPC.rotation, default, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); return false; } return true; @@ -172,7 +172,7 @@ namespace CalamityMod.NPCs.Astral Vector2 origin = new Vector2(41f, 39f); //draw glowmask - spriteBatch.Draw(glowmask, NPC.Center - screenPos - new Vector2(0f, 12f), NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos - new Vector2(0f, 12f), NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } } diff --git a/NPCs/Astral/HiveEnemy.cs b/NPCs/Astral/HiveEnemy.cs index 664ef0c51f..7529bb4fc6 100644 --- a/NPCs/Astral/HiveEnemy.cs +++ b/NPCs/Astral/HiveEnemy.cs @@ -19,12 +19,12 @@ namespace CalamityMod.NPCs.Astral { public class HiveEnemy : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HiveGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HiveGlow", AssetRequestMode.AsyncLoad); Main.npcFrameCount[NPC.type] = 6; } @@ -109,7 +109,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { // Draw glowmask. - spriteBatch.Draw(glowmask, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(19, 30), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(19, 30), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Astral/Hiveling.cs b/NPCs/Astral/Hiveling.cs index 900f56d6b9..8d57509795 100644 --- a/NPCs/Astral/Hiveling.cs +++ b/NPCs/Astral/Hiveling.cs @@ -17,12 +17,12 @@ namespace CalamityMod.NPCs.Astral { public class Hiveling : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HivelingGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HivelingGlow", AssetRequestMode.AsyncLoad); Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y -= 8; @@ -132,7 +132,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { //draw glowmask - spriteBatch.Draw(glowmask, NPC.Center - screenPos + new Vector2(0, 12), NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(15, 10), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos + new Vector2(0, 12), NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(15, 10), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index 72fff54643..a1c1558071 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.Astral { public class Mantis : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.Astral value.Position.Y += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/MantisGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/MantisGlow", AssetRequestMode.AsyncLoad); } public override void SetDefaults() @@ -226,7 +226,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { //draw glowmask - spriteBatch.Draw(glowmask, NPC.Center - screenPos - new Vector2(0, 8), NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(70, 40), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos - new Vector2(0, 8), NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(70, 40), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index 9a6b04a698..7869fe2cb7 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Astral { public class Nova : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; private float travelAcceleration = 0.2f; private float targetTime = 120f; @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.Astral Main.npcFrameCount[NPC.type] = 8; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/NovaGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/NovaGlow", AssetRequestMode.AsyncLoad); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.64f, @@ -310,7 +310,7 @@ namespace CalamityMod.NPCs.Astral return; Vector2 drawPosition = NPC.Center - screenPos - new Vector2(0, NPC.scale * 4f); - spriteBatch.Draw(glowmask, drawPosition, NPC.frame, Color.White * 0.75f, NPC.rotation, new Vector2(57f, 37f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(glowmask.Value, drawPosition, NPC.frame, Color.White * 0.75f, NPC.rotation, new Vector2(57f, 37f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/SightseerCollider.cs b/NPCs/Astral/SightseerCollider.cs index 1d3249cdd2..be6958cc53 100644 --- a/NPCs/Astral/SightseerCollider.cs +++ b/NPCs/Astral/SightseerCollider.cs @@ -19,14 +19,14 @@ namespace CalamityMod.NPCs.Astral { public class SightseerCollider : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/SightseerColliderGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/SightseerColliderGlow", AssetRequestMode.AsyncLoad); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 0 @@ -133,7 +133,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - spriteBatch.Draw(glowmask, NPC.Center - screenPos + new Vector2(0, 4f), new Rectangle(0, NPC.frame.Y, 80, NPC.frame.Height), Color.White * 0.75f, NPC.rotation, new Vector2(40f, 20f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos + new Vector2(0, 4f), new Rectangle(0, NPC.frame.Y, 80, NPC.frame.Height), Color.White * 0.75f, NPC.rotation, new Vector2(40f, 20f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/SightseerSpitter.cs b/NPCs/Astral/SightseerSpitter.cs index 7c705df289..9bc3205ed2 100644 --- a/NPCs/Astral/SightseerSpitter.cs +++ b/NPCs/Astral/SightseerSpitter.cs @@ -19,13 +19,13 @@ namespace CalamityMod.NPCs.Astral { public class SightseerSpitter : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/SightseerSpitterGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/SightseerSpitterGlow", AssetRequestMode.AsyncLoad); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.7f, @@ -162,7 +162,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { if (!NPC.IsABestiaryIconDummy) - spriteBatch.Draw(glowmask, NPC.Center - screenPos + new Vector2(0, 4f), NPC.frame, Color.White * 0.75f, NPC.rotation, new Vector2(59f, 28f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos + new Vector2(0, 4f), NPC.frame, Color.White * 0.75f, NPC.rotation, new Vector2(59f, 28f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index 6d62c05ab8..87f8f9eebe 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -19,12 +19,12 @@ namespace CalamityMod.NPCs.Astral { public class StellarCulex : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/StellarCulexGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/StellarCulexGlow", AssetRequestMode.AsyncLoad); Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -111,7 +111,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Vector2 origin = new Vector2(50, 30f); - spriteBatch.Draw(glowmask, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index f068232ae0..b280d632f0 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -22,6 +22,7 @@ using CalamityMod.NPCs.TownNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -43,6 +44,15 @@ namespace CalamityMod.NPCs.AstrumAureus public static readonly SoundStyle JumpSound = new("CalamityMod/Sounds/Custom/AstrumAureus/AureusJump"); public static readonly SoundStyle TeleportSound = new("CalamityMod/Sounds/Custom/AstrumAureus/AureusTeleport"); + public static Asset JumpTexture; + public static Asset RechargeTexture; + public static Asset StompTexture; + public static Asset WalkTexture; + public static Asset Texture_Glow; + public static Asset JumpTexture_Glow; + public static Asset StompTexture_Glow; + public static Asset WalkTexture_Glow; + private bool stomping = false; public int slimeProjCounter = 0; public int slimePhase = 0; @@ -61,6 +71,17 @@ namespace CalamityMod.NPCs.AstrumAureus value.Position.Y -= 20f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + JumpTexture = ModContent.Request(Texture + "Jump", AssetRequestMode.AsyncLoad); + RechargeTexture = ModContent.Request(Texture + "Recharge", AssetRequestMode.AsyncLoad); + StompTexture = ModContent.Request(Texture + "Stomp", AssetRequestMode.AsyncLoad); + WalkTexture = ModContent.Request(Texture + "Walk", AssetRequestMode.AsyncLoad); + JumpTexture_Glow = ModContent.Request(Texture + "JumpGlow", AssetRequestMode.AsyncLoad); + StompTexture_Glow = ModContent.Request(Texture + "StompGlow", AssetRequestMode.AsyncLoad); + WalkTexture_Glow = ModContent.Request(Texture + "WalkGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -237,33 +258,33 @@ namespace CalamityMod.NPCs.AstrumAureus if (NPC.ai[0] == 0f || (slimePhaseHP && Main.zenithWorld)) { NPCTexture = TextureAssets.Npc[NPC.type].Value; - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusGlow").Value; + GlowMaskTexture = Texture_Glow.Value; } else if (NPC.ai[0] == 1f) //nothing special done here { - NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusRecharge").Value; + NPCTexture = RechargeTexture.Value; } else if (NPC.ai[0] == 2f) //nothing special done here { - NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusWalk").Value; - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusWalkGlow").Value; + NPCTexture = WalkTexture.Value; + GlowMaskTexture = WalkTexture_Glow.Value; } else if (NPC.ai[0] == 3f || NPC.ai[0] == 4f) //needs to have an in-air frame { if (NPC.velocity.Y == 0f && NPC.ai[1] >= 0f && NPC.ai[0] == 3f) //idle before jump { NPCTexture = TextureAssets.Npc[NPC.type].Value; //idle frames - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusGlow").Value; + GlowMaskTexture = Texture_Glow.Value; } else if (NPC.velocity.Y <= 0f || NPC.ai[1] < 0f) //jump frames if flying upward or if about to jump { - NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusJump").Value; - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusJumpGlow").Value; + NPCTexture = JumpTexture.Value; + GlowMaskTexture = JumpTexture_Glow.Value; } else //stomping { - NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusStomp").Value; - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusStompGlow").Value; + NPCTexture = StompTexture.Value; + GlowMaskTexture = StompTexture_Glow.Value; } } else if (NPC.ai[0] >= 5f) //needs to have an in-air frame @@ -271,12 +292,12 @@ namespace CalamityMod.NPCs.AstrumAureus if (NPC.velocity.Y == 0f) //idle before teleport { NPCTexture = TextureAssets.Npc[NPC.type].Value; //idle frames - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusGlow").Value; + GlowMaskTexture = Texture_Glow.Value; } else //in-air frames { - NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusJump").Value; - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusJumpGlow").Value; + NPCTexture = JumpTexture.Value; + GlowMaskTexture = JumpTexture_Glow.Value; } } diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 36befa9f12..ad356bcd8d 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -9,6 +9,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -19,11 +20,16 @@ namespace CalamityMod.NPCs.AstrumAureus { public class AureusSpawn : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -43,7 +49,6 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.dontTakeDamage = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; @@ -264,7 +269,7 @@ namespace CalamityMod.NPCs.AstrumAureus drawLocation += originalDrawSize * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, originalDrawSize, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AureusSpawnGlow").Value; + texture2D15 = GlowTexture.Value; Color afterimageColorLerp = Color.Lerp(Color.White, Color.Orange, 0.5f) * NPC.Opacity; if (CalamityConfig.Instance.Afterimages) @@ -345,7 +350,7 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.position.X = NPC.position.X + NPC.width / 2; NPC.position.Y = NPC.position.Y + NPC.height / 2; - NPC.damage = (int)(NPC.defDamage * NPC.scale); + NPC.damage = (int)Math.Round(NPC.defDamage * (double)NPC.scale); NPC.width = NPC.height = (int)(216 * NPC.scale); NPC.position.X = NPC.position.X - NPC.width / 2; NPC.position.Y = NPC.position.Y - NPC.height / 2; diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index 53c505e6bf..eb38212ce6 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -6,6 +6,7 @@ using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -18,10 +19,28 @@ namespace CalamityMod.NPCs.AstrumDeus { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.AstrumDeusHead.DisplayName"); + public static Asset AltTexture; + public static Asset TextureGlow1; + public static Asset TextureGlow2; + public static Asset TextureGlow3; + public static Asset TextureGlow4; + public static Asset TextureAltGlow1; + public static Asset TextureAltGlow2; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "AltSpectral", AssetRequestMode.AsyncLoad); + TextureGlow1 = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + TextureGlow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + TextureGlow3 = ModContent.Request(Texture + "Glow3", AssetRequestMode.AsyncLoad); + TextureGlow4 = ModContent.Request(Texture + "Glow4", AssetRequestMode.AsyncLoad); + TextureAltGlow1 = ModContent.Request(Texture + "AltGlow", AssetRequestMode.AsyncLoad); + TextureAltGlow2 = ModContent.Request(Texture + "AltGlow2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -31,7 +50,7 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.width = 38; NPC.height = 44; NPC.defense = 35; - NPC.DR_NERD(0.2f); + NPC.DR_NERD(0.25f); NPC.LifeMaxNERB(200000, 240000, 650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); @@ -52,7 +71,6 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = AstrumDeusHead.HitSound; NPC.DeathSound = AstrumDeusHead.DeathSound; NPC.netAlways = true; @@ -100,8 +118,8 @@ namespace CalamityMod.NPCs.AstrumDeus bool deathModeEnragePhase = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f; bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; - Texture2D mainWormTex = altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltSpectral").Value : TextureAssets.Npc[NPC.type].Value; - Texture2D secondWormTex = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow2").Value; + Texture2D mainWormTex = altBodyTextures ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value; + Texture2D secondWormTex = TextureGlow2.Value; Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; @@ -109,12 +127,12 @@ namespace CalamityMod.NPCs.AstrumDeus drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); - mainWormTex = altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow").Value : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow").Value; + mainWormTex = altBodyTextures ? TextureAltGlow1.Value : TextureGlow1.Value; Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) { - mainWormTex = drawCyan ? mainWormTex : (altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow2").Value : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow3").Value); - secondWormTex = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow4").Value : secondWormTex; + mainWormTex = drawCyan ? mainWormTex : (altBodyTextures ? TextureAltGlow2.Value : TextureGlow3.Value); + secondWormTex = drawCyan ? TextureGlow4.Value : secondWormTex; } Color mainWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); Color secondWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index 4916c13182..ba88318bd4 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -22,6 +22,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -43,6 +44,11 @@ namespace CalamityMod.NPCs.AstrumDeus public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/AstrumDeusHit", 2) { Volume = 1.25f }; public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/AstrumDeusDeath"); + public static Asset TextureGlow1; + public static Asset TextureGlow2; + public static Asset TextureGlow3; + public static Asset TextureGlow4; + public override void SetStaticDefaults() { NPCID.Sets.TrailingMode[NPC.type] = 1; @@ -56,6 +62,13 @@ namespace CalamityMod.NPCs.AstrumDeus value.Position.X += 55f; value.Position.Y += 23f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + TextureGlow1 = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + TextureGlow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + TextureGlow3 = ModContent.Request(Texture + "Glow3", AssetRequestMode.AsyncLoad); + TextureGlow4 = ModContent.Request(Texture + "Glow4", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -153,7 +166,7 @@ namespace CalamityMod.NPCs.AstrumDeus bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; Texture2D mainWormTex = TextureAssets.Npc[NPC.type].Value; - Texture2D secondWormTex = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow2").Value; + Texture2D secondWormTex = TextureGlow2.Value; Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; @@ -161,12 +174,12 @@ namespace CalamityMod.NPCs.AstrumDeus drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); - mainWormTex = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow").Value; + mainWormTex = TextureGlow1.Value; Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) { - mainWormTex = drawCyan ? mainWormTex : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow3").Value; - secondWormTex = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow4").Value : secondWormTex; + mainWormTex = drawCyan ? mainWormTex : TextureGlow3.Value; + secondWormTex = drawCyan ? TextureGlow4.Value : secondWormTex; } Color mainWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); Color secondWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index 14225ab09c..676018a646 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -6,6 +6,7 @@ using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -18,10 +19,18 @@ namespace CalamityMod.NPCs.AstrumDeus { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.AstrumDeusHead.DisplayName"); + public static Asset GlowTexture; + public static Asset GlowTexture2; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + GlowTexture2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -31,7 +40,7 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.width = 52; NPC.height = 68; NPC.defense = 50; - NPC.DR_NERD(0.3f); + NPC.DR_NERD(0.4f); NPC.LifeMaxNERB(200000, 240000, 650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); @@ -52,7 +61,6 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = AstrumDeusHead.HitSound; NPC.DeathSound = AstrumDeusHead.DeathSound; NPC.netAlways = true; @@ -107,10 +115,10 @@ namespace CalamityMod.NPCs.AstrumDeus drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(wormTexture, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); - wormTexture = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow").Value; + wormTexture = GlowTexture.Value; Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) - wormTexture = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow2").Value : wormTexture; + wormTexture = drawCyan ? GlowTexture2.Value : wormTexture; Color wormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index a983423648..149a689271 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -39,7 +39,6 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.knockBackResist = 0.5f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit23; NPC.DeathSound = SoundID.NPCDeath39; if (BossRushEvent.BossRushActive) diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index f5e99357f6..e88ddfb475 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -20,6 +20,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -33,6 +34,7 @@ namespace CalamityMod.NPCs.Bumblebirb [AutoloadBossHead] public class Bumblefuck : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -48,6 +50,10 @@ namespace CalamityMod.NPCs.Bumblebirb value.Position.Y += 8f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/NPCs/Bumblebirb/BirbGlow", AssetRequestMode.AsyncLoad); + } } public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb"; @@ -350,7 +356,7 @@ namespace CalamityMod.NPCs.Bumblebirb if (phase2) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/Bumblebirb/BirbGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Red, 0.5f); altColor = Color.Red; diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index 57e33046f2..957905ed53 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -39,7 +39,6 @@ namespace CalamityMod.NPCs.Bumblebirb NPC.lavaImmune = true; NPC.noTileCollide = true; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit51; NPC.DeathSound = SoundID.NPCDeath46; NPC.Calamity().VulnerableToHeat = true; diff --git a/NPCs/CalClone/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs index b4ddcc7b2e..f6c5525086 100644 --- a/NPCs/CalClone/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -20,6 +20,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -33,6 +34,8 @@ namespace CalamityMod.NPCs.CalClone [AutoloadBossHead] public class CalamitasClone : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -46,6 +49,10 @@ namespace CalamityMod.NPCs.CalClone value.Position.Y -= 10f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -155,7 +162,7 @@ namespace CalamityMod.NPCs.CalClone npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, npcOffset, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/CalClone/CalamitasCloneGlow").Value; + texture = GlowTexture.Value; Color color = Color.Lerp(Color.White, Color.Red, 0.5f); if (Main.zenithWorld) { @@ -184,7 +191,6 @@ namespace CalamityMod.NPCs.CalClone public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); - npcLoot.Add(ItemID.BrokenHeroSword); // Normal drops: Everything that would otherwise be in the bag var normalOnly = npcLoot.DefineNormalOnlyDropSet(); @@ -234,18 +240,6 @@ namespace CalamityMod.NPCs.CalClone CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedCalamitasClone); - // Abyss awakens after killing Calamitas - string key = "Mods.CalamityMod.Status.Progression.PlantBossText"; - Color messageColor = Color.RoyalBlue; - - if (!DownedBossSystem.downedCalamitasClone) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - SoundEngine.PlaySound(CommonCalamitySounds.WyrmScreamSound, Main.player[Main.myPlayer].Center); - - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - // Mark the Calamitas Clone as dead DownedBossSystem.downedCalamitasClone = true; CalamityNetcode.SyncWorld(); diff --git a/NPCs/CalClone/Cataclysm.cs b/NPCs/CalClone/Cataclysm.cs index 05d344084b..0b00bdc6ab 100644 --- a/NPCs/CalClone/Cataclysm.cs +++ b/NPCs/CalClone/Cataclysm.cs @@ -8,6 +8,7 @@ using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -19,6 +20,8 @@ namespace CalamityMod.NPCs.CalClone [AutoloadBossHead] public class Cataclysm : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -31,6 +34,10 @@ namespace CalamityMod.NPCs.CalClone PortraitPositionYOverride = 0 }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -130,7 +137,7 @@ namespace CalamityMod.NPCs.CalClone drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/CalClone/CataclysmGlow").Value; + texture2D15 = GlowTexture.Value; Color pinkLerp = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/CalClone/Catastrophe.cs b/NPCs/CalClone/Catastrophe.cs index 1e6f1df769..1ac00cfb92 100644 --- a/NPCs/CalClone/Catastrophe.cs +++ b/NPCs/CalClone/Catastrophe.cs @@ -8,6 +8,7 @@ using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -19,6 +20,8 @@ namespace CalamityMod.NPCs.CalClone [AutoloadBossHead] public class Catastrophe : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -31,6 +34,10 @@ namespace CalamityMod.NPCs.CalClone }; value.Position.Y -= 10; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -130,7 +137,7 @@ namespace CalamityMod.NPCs.CalClone drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/CalClone/CatastropheGlow").Value; + texture2D15 = GlowTexture.Value; Color pinkLerp = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/CalClone/SoulSeeker.cs b/NPCs/CalClone/SoulSeeker.cs index 9123593666..a62ecfaf16 100644 --- a/NPCs/CalClone/SoulSeeker.cs +++ b/NPCs/CalClone/SoulSeeker.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -17,12 +18,17 @@ namespace CalamityMod.NPCs.CalClone { private int timer = 0; private bool start = true; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -33,7 +39,6 @@ namespace CalamityMod.NPCs.CalClone NPC.height = 40; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.damage = 40; NPC.defense = 10; NPC.DR_NERD(0.1f); @@ -213,7 +218,7 @@ namespace CalamityMod.NPCs.CalClone drawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/CalClone/SoulSeekerGlow").Value; + texture = GlowTexture.Value; Color glow = Color.Lerp(Color.White, Color.Red, colorLerpAmt); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs index 8475e88f09..a1e091f945 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs @@ -606,12 +606,12 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { if (npc.velocity.Length() <= minimalContactDamageVelocity) { - npc.damage = (int)(npc.defDamage * 0.5f); + npc.damage = (int)Math.Round(npc.defDamage * 0.5); } else { float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar); + npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); } } else diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs index 26ed8e6d32..073b69b2ed 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs @@ -310,12 +310,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (npc.ai[2] > 0f) npc.realLife = (int)npc.ai[2]; - if (!head) - { - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; - } - // Alpha effects if ((head || Main.npc[(int)npc.ai[1]].alpha < 128) && !npc.dontTakeDamage) { @@ -356,11 +350,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.netSpam = 9; } } - else - { - if (npc.life > Main.npc[(int)npc.ai[0]].life) - npc.life = Main.npc[(int)npc.ai[0]].life; - } // Direction if (npc.velocity.X < 0f) @@ -413,6 +402,14 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs } } } + + if (npc.life > Main.npc[(int)npc.ai[0]].life) + npc.life = Main.npc[(int)npc.ai[0]].life; + } + else + { + if (npc.life > Main.npc[(int)npc.ai[1]].life) + npc.life = Main.npc[(int)npc.ai[1]].life; } float segmentVelocity = deathModeEnragePhase_Head ? 19f : death ? 17.5f : 16f; @@ -579,7 +576,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.velocity.Y = segmentVelocity; // This bool exists to stop the strange wiggle behavior when worms are falling down - bool slowXVelocity = Math.Abs(npc.velocity.X) > segmentVelocity; + bool slowXVelocity = Math.Abs(npc.velocity.X) > speed; if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.4) { if (npc.velocity.X < 0f) @@ -923,12 +920,12 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { if (npc.velocity.Length() <= minimalContactDamageVelocity) { - npc.damage = (int)(npc.defDamage * 0.5f); + npc.damage = (int)Math.Round(npc.defDamage * 0.5); } else { float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar); + npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); } } else diff --git a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs index cfeed98c04..03c089450a 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs @@ -213,7 +213,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Play exhausted sound if (calamityGlobalNPC.newAI[0] % 60f == 0f && Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 2800f) - SoundEngine.PlaySound(OldDuke.OldDuke.HuffSound, Main.LocalPlayer.Center); + SoundEngine.PlaySound(OldDuke.OldDuke.HuffSound with { Volume = OldDuke.OldDuke.HuffSound.Volume * 1.25f }, Main.LocalPlayer.Center); if (Main.zenithWorld) { diff --git a/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs b/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs index 6e9c9bba61..0d84546947 100644 --- a/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs +++ b/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs @@ -201,7 +201,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs } npc.dontTakeDamage = false; - npc.chaseable = true; } targetDist = homingSpeed / targetDist; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 6391c0f25f..c9b1eec753 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -55,12 +55,16 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; +using CalamityMod.Tiles.FurnitureAuric; +using CalamityMod.Tiles.Ores; using CalamityMod.UI; using CalamityMod.Walls.DraedonStructures; using CalamityMod.World; +using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.Enums; using Terraria.GameContent; @@ -116,7 +120,6 @@ namespace CalamityMod.NPCs public bool IncreasedColdEffects_CryoStone = false; // Transformer effect - public bool IncreasedElectricityEffects_Transformer = false; // Fireball, Cinnamon Roll and Hellfire Treads effects @@ -152,6 +155,12 @@ namespace CalamityMod.NPCs public const float CatchUpDistance200Tiles = 3200f; public const float CatchUpDistance350Tiles = 5600f; + /// + /// Destroyer laser colors, used for telegraphs + /// None = -1, Red = 0, Green = 1, Cyan = 2 + /// + public int destroyerLaserColor = -1; + // Boss Zen distance private const float BossZenDistance = 6400f; @@ -160,12 +169,18 @@ namespace CalamityMod.NPCs // Used to nerf Master Mode enemies public const double MasterModeEnemyHPMultiplier = 0.75; - public const double MasterModeEnemyDamageMultiplier = 0.85; + public const double MasterModeEnemyDamageMultiplier = 0.9; // Used to nerf Expert and Master Mode enemies public const float ExpertModeEnemyKnockbackMultiplier = 0.05f; public const float MasterModeEnemyKnockbackMultiplier = 0.1f; + // HP and damage multipliers for the Early Hardmode Progression Rework + public const double EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic = 0.8; + public const double EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic = 0.9; + public const double EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert = 0.9; + public const double EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert = 0.95; + // Used to increase coin drops in Normal Mode private const double NPCValueMultiplier_NormalCalamity = 1.5; @@ -392,6 +407,8 @@ namespace CalamityMod.NPCs myClone.miscDefenseLoss = miscDefenseLoss; + myClone.destroyerLaserColor = destroyerLaserColor; + myClone.dashImmunityTime = new int[maxPlayerImmunities]; for (int i = 0; i < maxPlayerImmunities; ++i) myClone.dashImmunityTime[i] = dashImmunityTime[i]; @@ -656,9 +673,9 @@ namespace CalamityMod.NPCs Item heldItem = Main.player[owner].ActiveItem(); int totalDamage = (int)Main.player[owner].GetTotalDamage().ApplyTo(150f); bool forbidden = Main.player[owner].head == ArmorIDs.Head.AncientBattleArmor && Main.player[owner].body == ArmorIDs.Body.AncientBattleArmor && Main.player[owner].legs == ArmorIDs.Legs.AncientBattleArmor; - bool reducedNerf = Main.player[owner].Calamity().fearmongerSet || (forbidden && heldItem.CountsAsClass()); + bool negateNerf = Main.player[owner].Calamity().fearmongerSet || (forbidden && heldItem.CountsAsClass()); - double summonNerfMult = reducedNerf ? 0.75 : 0.5; + double summonNerfMult = negateNerf ? 1 : 0.75; if (!Main.player[owner].Calamity().profanedCrystalBuffs) { if (heldItem.type > ItemID.None) @@ -1106,6 +1123,13 @@ namespace CalamityMod.NPCs #endregion #region Set Defaults + public override void SetStaticDefaults() + { + // Set Plantera to be able to update oldPos[x] + // This is only used for her Rev+ AI charge attacks + NPCID.Sets.TrailingMode[NPCID.Plantera] = 1; + } + public override void SetDefaults(NPC npc) { ShouldFallThroughPlatforms = false; @@ -1196,7 +1220,11 @@ namespace CalamityMod.NPCs case NPCID.CultistDragonBody4: case NPCID.CultistDragonHead: case NPCID.CultistDragonTail: - npc.lifeMax = 40000; + npc.lifeMax = 20000; + break; + + case NPCID.AncientCultistSquidhead: + npc.lifeMax = 4000; break; case NPCID.DukeFishron: @@ -1314,7 +1342,7 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.MoonLordCore) npc.npcSlots = 36f; } - else if (npc.type == NPCID.CultistBoss || (npc.type >= NPCID.CultistDragonHead && npc.type <= NPCID.CultistDragonTail)) + else if (npc.type == NPCID.CultistBoss || (npc.type >= NPCID.CultistDragonHead && npc.type <= NPCID.CultistDragonTail) || npc.type == NPCID.AncientCultistSquidhead) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); @@ -1339,9 +1367,7 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.GolemHeadFree) { - npc.lifeMax = (int)Math.Round(npc.lifeMax * 2D); - npc.width = 88; - npc.height = 90; + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.7); npc.dontTakeDamage = false; } else if (npc.type == NPCID.HallowBoss) @@ -1467,11 +1493,6 @@ namespace CalamityMod.NPCs { npc.knockBackResist = 0f; } - - if (CalamityLists.revengeanceLifeStealExceptionList.Contains(npc.type)) - { - npc.canGhostHeal = false; - } } #endregion @@ -2358,6 +2379,12 @@ namespace CalamityMod.NPCs canBreakPlayerDefense = true; break; + // Fix drawing issues with Golem's Free Head + case NPCID.GolemHeadFree: + npc.width = 88; + npc.height = 90; + break; + // Make Core hitbox bigger and reduce HP case NPCID.MartianSaucerCore: npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.6); @@ -2378,7 +2405,7 @@ namespace CalamityMod.NPCs npc.dontTakeDamage = true; break; - // Make Fishron's Bubbles immune to damage in Rev+ Master Mode + // Make Fishron and Anahita Bubbles immune to damage in Rev+ Master Mode case NPCID.DetonatingBubble: npc.dontTakeDamage = Main.masterMode && CalamityWorld.revenge; break; @@ -2394,8 +2421,9 @@ namespace CalamityMod.NPCs { if (CalamityLists.DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer) { - npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.8); - npc.damage = (int)Math.Round(npc.damage * 0.8); + double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); + npc.damage = (int)Math.Round(npc.damage * multiplier); npc.defDamage = npc.damage; } } @@ -2403,8 +2431,9 @@ namespace CalamityMod.NPCs { if (CalamityLists.DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer) { - npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.9); - npc.damage = (int)Math.Round(npc.damage * 0.9); + double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; + npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); + npc.damage = (int)Math.Round(npc.damage * multiplier); npc.defDamage = npc.damage; } } @@ -2419,6 +2448,12 @@ namespace CalamityMod.NPCs npc.damage = (int)Math.Round(npc.damage * 0.5); npc.defDamage = npc.damage; } + + if (npc.type == NPCID.FungiSpore) + { + npc.damage = (int)Math.Round(npc.damage * 0.5); + npc.defDamage = npc.damage; + } } if (Main.hardMode && CalamityLists.HardmodeNPCNerfList.Contains(npc.type)) @@ -3157,9 +3192,13 @@ namespace CalamityMod.NPCs #endregion #region Strike NPC - // Incoming defense to this function is already affected by the vanilla debuffs Ichor (-15) and Betsy's Curse (-40), and cannot be below zero. + // Incoming defense to this function is already affected by the vanilla debuffs Ichor (-10) and Betsy's Curse (-40), and cannot be below zero. public override void ModifyIncomingHit(NPC npc, ref NPC.HitModifiers modifiers) { + // Reduce ichor debuff defense reduction from -15 to -10. + if (npc.ichor) + modifiers.Defense.Flat += 5; + // Apply armor penetration based on Calamity debuffs. The hit system manages the sequencing. // Ozzatron 05JAN2023: fixed doubled armor pen, this time for real int defenseReduction = (marked > 0 && DR <= 0f ? MarkedforDeath.DefenseReduction : 0) + (wither > 0 ? WitherDebuff.DefenseReduction : 0) + miscDefenseLoss; @@ -3175,13 +3214,7 @@ namespace CalamityMod.NPCs if (CalamityLists.AstrumDeusIDs.Contains(npc.type)) modifiers.FinalDamage *= 1f - MathHelper.Lerp(0f, 0.99f, MathHelper.Clamp(1f - newAI[1] / (newAI[0] != 0f ? 300f : 600f), 0f, 1f)); if (eaterofWorldsResist) - modifiers.FinalDamage *= 0.01f; - - // Large Deus worm takes reduced damage in order to last a long enough time. - // TODO -- WHY DOES DEUS HAVE THIS UNDOCUMENTED MULTIPLIER HERE?? - // this should be in ModifyHitNPC for deus himself - if (CalamityLists.AstrumDeusIDs.Contains(npc.type) && newAI[0] == 0f) - modifiers.FinalDamage *= 0.8f; + modifiers.FinalDamage *= 0.05f; } // Directly modifies final damage incoming to an NPC based on their DR (damage reduction) stat added by Calamity. @@ -3607,7 +3640,7 @@ namespace CalamityMod.NPCs // Adjust vanilla AI in Classic, Expert and Master // Fair contact damage and a few Expert/Master AI edits happen here // Deerclops doesn't deserve love so he's not here - else + else if (!CalamityMod.ExternalFlag_DisableNonRevBossAI) { switch (npc.type) { @@ -3685,7 +3718,7 @@ namespace CalamityMod.NPCs case NPCID.DukeFishron: return DukeFishronAI.VanillaDukeFishronAI(npc, Mod); - /*case NPCID.CultistBoss: + case NPCID.CultistBoss: case NPCID.CultistBossClone: return CultistAI.VanillaCultistAI(npc, Mod); case NPCID.AncientLight: @@ -3693,7 +3726,7 @@ namespace CalamityMod.NPCs case NPCID.AncientDoom: return CultistAI.VanillaAncientDoomAI(npc, Mod); - case NPCID.MoonLordCore: + /*case NPCID.MoonLordCore: case NPCID.MoonLordHand: case NPCID.MoonLordHead: case NPCID.MoonLordFreeEye: @@ -4376,6 +4409,15 @@ namespace CalamityMod.NPCs } } + if (npc.type == NPCID.QueenSlimeMinionBlue) + return QueenSlimeAI.QueenSlimeCrystalSlimeAI(npc, Mod); + + if (npc.type == NPCID.QueenSlimeMinionPink) + return QueenSlimeAI.QueenSlimeBouncySlimeAI(npc, Mod); + + if (npc.type == NPCID.FungiBulb) + return RevengeanceAndDeathAI.BuffedPlantAI(npc, Mod); + if (npc.type == NPCID.FungiSpore || npc.type == NPCID.Spore) return RevengeanceAndDeathAI.BuffedSporeAI(npc, Mod); @@ -4738,6 +4780,105 @@ namespace CalamityMod.NPCs // Fair contact damage switch (npc.type) { + case NPCID.DD2Betsy: + npc.damage = npc.ai[0] == 2f ? npc.defDamage : 0; + break; + + case NPCID.DD2WyvernT1: + case NPCID.DD2WyvernT2: + case NPCID.DD2WyvernT3: + npc.damage = npc.ai[0] == 2f ? npc.defDamage : 0; + break; + + case NPCID.DD2GoblinT1: + case NPCID.DD2GoblinT2: + case NPCID.DD2GoblinT3: + npc.damage = (npc.ai[0] > 0f && npc.ai[0] < 24f) ? npc.defDamage : 0; + break; + + case NPCID.PumpkingBlade: + npc.damage = (npc.ai[2] == 2f || npc.ai[2] == 5f) ? npc.defDamage : 0; + break; + + case NPCID.Mothron: + npc.damage = npc.ai[0] == 3.2f ? (int)Math.Round(npc.defDamage * 1.3) : npc.ai[0] == 2f ? (int)Math.Round(npc.defDamage * 0.5) : 0; + break; + + case NPCID.MothronSpawn: + npc.damage = npc.ai[0] == 2.1f ? npc.defDamage : 0; + break; + + case NPCID.Flocko: + npc.damage = npc.ai[0] > 0f ? npc.defDamage : 0; + break; + + case NPCID.Mimic: + case NPCID.IceMimic: + case NPCID.PresentMimic: + npc.damage = (npc.ai[0] == 0f || npc.velocity.Y == 0f) ? 0 : npc.defDamage; + break; + + case NPCID.BigMimicCorruption: + case NPCID.BigMimicCrimson: + case NPCID.BigMimicHallow: + case NPCID.BigMimicJungle: + npc.damage = npc.ai[0] == 3f ? 0 : npc.defDamage; + + // Spend less time in closed state + if (npc.ai[0] == 3f) + npc.ai[1] += 0.5f; + + break; + + case NPCID.DeadlySphere: + npc.damage = npc.ai[0] == 1f ? npc.defDamage : 0; + break; + + case NPCID.NebulaHeadcrab: + npc.damage = npc.ai[0] == 5f ? npc.defDamage : 0; + break; + + case NPCID.MartianDrone: + case NPCID.SolarCorite: + npc.damage = (npc.ai[0] == 2f || npc.ai[0] == 3f) ? npc.defDamage : 0; + break; + + case NPCID.ArmedTorchZombie: + case NPCID.ArmedZombie: + case NPCID.ArmedZombieCenx: + case NPCID.ArmedZombieEskimo: + case NPCID.ArmedZombiePincussion: + case NPCID.ArmedZombieSlimed: + case NPCID.ArmedZombieSwamp: + case NPCID.ArmedZombieTwiggy: + case NPCID.Crawdad: + case NPCID.Crawdad2: + npc.damage = npc.ai[2] == 0f ? 0 : (int)Math.Round(npc.defDamage * 1.4); + break; + + case NPCID.GraniteFlyer: + npc.damage = npc.ai[0] == -1f ? 0 : npc.defDamage; + break; + + case NPCID.GraniteGolem: + npc.damage = npc.ai[2] < 0f ? 0 : npc.defDamage; + break; + + case NPCID.Squid: + case NPCID.BlueJellyfish: + case NPCID.GreenJellyfish: + case NPCID.PinkJellyfish: + case NPCID.BloodJelly: + case NPCID.FungoFish: + float damagingVelocity = npc.type == NPCID.GreenJellyfish ? 3.6f : 2.8f; + npc.damage = (npc.dontTakeDamage || npc.velocity.Length() > damagingVelocity) ? npc.defDamage : 0; + break; + + case NPCID.Herpling: + case NPCID.Derpling: + npc.damage = (npc.velocity.Y == 0f || npc.velocity.Length() < 3f) ? 0 : npc.defDamage; + break; + case NPCID.BlueSlime: case NPCID.MotherSlime: case NPCID.LavaSlime: @@ -4774,16 +4915,16 @@ namespace CalamityMod.NPCs case NPCID.GiantShelly: case NPCID.GiantShelly2: - npc.damage = npc.ai[0] == 3f ? (int)(npc.defDamage * 1.35) : 0; + npc.damage = npc.ai[0] == 3f ? (int)Math.Round(npc.defDamage * 1.2) : 0; break; case NPCID.GiantTortoise: case NPCID.IceTortoise: - npc.damage = npc.ai[0] == 3f ? (int)(npc.defDamage * 1.8) : 0; + npc.damage = npc.ai[0] == 3f ? (int)Math.Round(npc.defDamage * 1.4) : 0; break; case NPCID.SolarSroller: - npc.damage = npc.ai[0] == 6f ? (int)(npc.defDamage * 1.4) : 0; + npc.damage = npc.ai[0] == 6f ? (int)Math.Round(npc.defDamage * 1.2) : 0; break; default: @@ -5002,6 +5143,84 @@ namespace CalamityMod.NPCs if (pearlAura > 0) npc.velocity *= 0.9f; } + + // Auric Ore/Repulsers reject Town NPCs and dummies + if ((NPCID.Sets.ActsLikeTownNPC[npc.type] || npc.townNPC) && !npc.dontTakeDamage || npc.type == NPCType()) + { + int auricOreID = TileType(); + int auricRepulserID = TileType(); + + // Get a list of tiles near the npc + // This is just Collision.GetEntityTiles but with a larger detection square because the sheer speed from auric boosts causes the detection to fail at higher speeds + List EdgeTiles = new List(); + int extraDist = (int)(8 * npc.velocity.Length() / 6) + 1; + int left = (int)npc.position.X - extraDist; + int up = (int)npc.position.Y - extraDist; + int right = (int)npc.Right.X + extraDist; + int down = (int)npc.Bottom.Y + extraDist; + if (left % 16 == 0) + { + left--; + } + + if (up % 16 == 0) + { + up--; + } + + if (right % 16 == 0) + { + right++; + } + + if (down % 16 == 0) + { + down++; + } + + int width = right / 16 - left / 16; + int height = down / 16 - up / 16; + left /= 16; + up /= 16; + for (int i = left; i <= left + width; i++) + { + EdgeTiles.Add(new Point(i, up)); + EdgeTiles.Add(new Point(i, up + height)); + } + + for (int j = up; j < up + height; j++) + { + EdgeTiles.Add(new Point(left, j)); + EdgeTiles.Add(new Point(left + width, j)); + } + foreach (Point touchedTile in EdgeTiles) + { + Tile tile = Framing.GetTileSafely(touchedTile); + if (!tile.HasTile || !tile.HasUnactuatedTile) + continue; + if (tile.TileType != auricOreID && tile.TileType != auricRepulserID) + continue; + + // Force Auric Ore to animate with its crackling electricity + if (tile.TileType == auricOreID) + { + AuricOre.Animate = true; + } + + var yeetVec = Vector2.Normalize(npc.Center - touchedTile.ToWorldCoordinates()); + npc.velocity += yeetVec * 20f; + // Speed must be clamped or they start clipping through tiles very easily + float clampedSpeed = MathHelper.Clamp(npc.velocity.Length(), -40, 40); + npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero) * clampedSpeed; + if (tile.TileType == auricOreID) + { + npc.SimpleStrikeNPC((int)(npc.lifeMax * 0.2f), 0); + npc.AddBuff(BuffID.Electrified, 300); + } + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1"), npc.Center); + break; + } + } } #endregion @@ -5024,28 +5243,58 @@ namespace CalamityMod.NPCs { case NPCID.VileSpitEaterOfWorlds: case NPCID.VileSpit: - target.AddBuff(BuffType(), 240); + + target.AddBuff(BuffType(), 180); + if (Main.rand.NextBool(10)) + target.AddBuff(BuffID.Weak, 3600); + else if (Main.rand.NextBool(5)) + target.AddBuff(BuffID.Weak, 720); + else if (Main.rand.NextBool(2)) + target.AddBuff(BuffID.Weak, 120); + else + target.AddBuff(BuffID.Weak, 60); + break; case NPCID.ShadowFlameApparition: - target.AddBuff(BuffType(), 180); + target.AddBuff(BuffType(), 120); break; + case NPCID.ChaosBall: if (Main.hardMode || CalamityPlayer.areThereAnyDamnBosses) - target.AddBuff(BuffType(), 180); + target.AddBuff(BuffType(), 120); + break; + + case NPCID.EyeofCthulhu: + if (npc.ai[0] > 2f) + target.AddBuff(BuffID.Bleeding, 180); + break; + + case NPCID.WallofFlesh: + target.AddBuff(BuffID.Bleeding, 300); break; case NPCID.Spazmatism: if (npc.ai[0] != 1f && npc.ai[0] != 2f && npc.ai[0] != 0f) - target.AddBuff(BuffID.Bleeding, 600); + target.AddBuff(BuffID.Bleeding, 300); + break; + + case NPCID.SkeletronPrime: + if (npc.ai[1] == 1f || npc.ai[1] == 2f) + target.AddBuff(BuffID.Bleeding, 300); + break; + + case NPCID.PrimeSaw: + target.AddBuff(BuffID.Bleeding, 180); break; case NPCID.Plantera: if (npc.life < npc.lifeMax / 2) - target.AddBuff(BuffID.Poisoned, 600); + target.AddBuff(BuffID.Poisoned, 300); break; + case NPCID.PlanterasTentacle: - target.AddBuff(BuffID.Poisoned, 300); + target.AddBuff(BuffID.Poisoned, 120); break; case NPCID.Golem: @@ -5059,34 +5308,25 @@ namespace CalamityMod.NPCs target.AddBuff(BuffType(), 240); break; - case NPCID.AncientDoom: - target.AddBuff(BuffType(), 180); - break; case NPCID.AncientLight: target.AddBuff(BuffType(), 120); break; case NPCID.HallowBoss: - target.AddBuff(Main.dayTime ? BuffType() : BuffType(), 320); + target.AddBuff(Main.dayTime ? BuffType() : BuffType(), 240); break; case NPCID.BloodNautilus: - target.AddBuff(BuffType(), 480); + target.AddBuff(BuffType(), 300); break; case NPCID.GoblinShark: case NPCID.BloodEelHead: - target.AddBuff(BuffType(), 300); - break; - case NPCID.BloodEelBody: target.AddBuff(BuffType(), 180); break; - case NPCID.BloodEelTail: - target.AddBuff(BuffType(), 120); - break; case NPCID.Lavabat: - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire, 120); break; case NPCID.RuneWizard: @@ -5145,7 +5385,7 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.Hellbat: - target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.OnFire, 60); break; default: @@ -6150,21 +6390,21 @@ namespace CalamityMod.NPCs return null; if (Main.LocalPlayer.Calamity().trippy || (npc.type == NPCID.KingSlime && CalamityWorld.LegendaryMode && CalamityWorld.revenge)) - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, npc.alpha); + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); if (npc.type == NPCID.QueenBee && Main.zenithWorld) { if (npc.life / (float)npc.lifeMax < 0.5f) - return new Color(0, 255, 0, npc.alpha); + return new Color(0, 255, 0, 255 - npc.alpha); else - return new Color(255, 0, 0, npc.alpha); + return new Color(255, 0, 0, 255 - npc.alpha); } if (npc.HasBuff()) - return new Color(200, 50, 50, npc.alpha); + return new Color(200, 50, 50, 255 - npc.alpha); if (npc.Calamity().kamiFlu > 0 && !CalamityLists.kamiDebuffColorImmuneList.Contains(npc.type)) - return new Color(51, 197, 108, npc.alpha); + return new Color(51, 197, 108, 255 - npc.alpha); if (npc.type == NPCID.VileSpit || npc.type == NPCID.VileSpitEaterOfWorlds) return new Color(150, 200, 0, npc.alpha); @@ -6251,23 +6491,23 @@ namespace CalamityMod.NPCs if (npc.shadowFlame) currentDebuffs.Add(TextureAssets.Buff[BuffID.ShadowFlame].Value); if (npc.oiled) - currentDebuffs.Add(TextureAssets.Buff[BuffID.Oiled].Value); + currentDebuffs.Add(Request("CalamityMod/ExtraTextures/VanillaBuffs/Oiled").Value); if (npc.javelined) currentDebuffs.Add(TextureAssets.Buff[BuffID.BoneJavelin].Value); if (npc.daybreak) - currentDebuffs.Add(TextureAssets.Buff[BuffID.Daybreak].Value); + currentDebuffs.Add(Request("CalamityMod/ExtraTextures/VanillaBuffs/Daybroken").Value); if (npc.celled) - currentDebuffs.Add(TextureAssets.Buff[BuffID.StardustMinionBleed].Value); + currentDebuffs.Add(Request("CalamityMod/ExtraTextures/VanillaBuffs/Celled").Value); if (npc.dryadBane) - currentDebuffs.Add(TextureAssets.Buff[BuffID.DryadsWardDebuff].Value); + currentDebuffs.Add(Request("CalamityMod/ExtraTextures/VanillaBuffs/DryadsBane").Value); if (npc.dryadWard) currentDebuffs.Add(TextureAssets.Buff[BuffID.DryadsWard].Value); if (npc.soulDrain && npc.realLife == -1) currentDebuffs.Add(TextureAssets.Buff[BuffID.SoulDrain].Value); if (npc.onFire3) // Hellfire - currentDebuffs.Add(TextureAssets.Buff[BuffID.OnFire3].Value); + currentDebuffs.Add(Request("CalamityMod/ExtraTextures/VanillaBuffs/Hellfire").Value); if (npc.onFrostBurn2) // Frostbite - currentDebuffs.Add(TextureAssets.Buff[BuffID.Frostburn2].Value); + currentDebuffs.Add(Request("CalamityMod/ExtraTextures/VanillaBuffs/Frostbite").Value); if (npc.tentacleSpiked) currentDebuffs.Add(TextureAssets.Buff[BuffID.TentacleSpike].Value); @@ -6287,7 +6527,7 @@ namespace CalamityMod.NPCs if (npc.stinky) currentDebuffs.Add(TextureAssets.Buff[BuffID.Stinky].Value); if (npc.betsysCurse) - currentDebuffs.Add(TextureAssets.Buff[BuffID.BetsysCurse].Value); + currentDebuffs.Add(Request("CalamityMod/ExtraTextures/VanillaBuffs/BetsysCurse").Value); if (npc.dripping) currentDebuffs.Add(TextureAssets.Buff[BuffID.Wet].Value); if (npc.drippingSlime) @@ -6360,6 +6600,16 @@ namespace CalamityMod.NPCs Vector2 eyesDrawPosition = headDrawPosition - npc.scale * new Vector2(1f, 12f); Rectangle eyesFrame = new Rectangle(0, 0, TextureAssets.Golem[1].Value.Width, TextureAssets.Golem[1].Value.Height / 2); spriteBatch.Draw(TextureAssets.Golem[1].Value, eyesDrawPosition, eyesFrame, eyeColor, 0f, eyesFrame.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); + + // Draw the glowmasks. + int frameCounter = (int)npc.frameCounter / 4; + Rectangle frame = TextureAssets.Extra[106].Value.Frame(1, 8); + frame.Y += frame.Height * 2 * frameCounter + npc.frame.Y; + Rectangle glowFrame = frame; + spriteBatch.Draw(TextureAssets.Extra[106].Value, eyesDrawPosition, glowFrame, eyeColor, 0f, glowFrame.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); + frame = npc.frame; + Rectangle glowFrame2 = frame; + spriteBatch.Draw(TextureAssets.Extra[107].Value, eyesDrawPosition, glowFrame2, eyeColor, 0f, glowFrame2.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); return false; } @@ -6367,41 +6617,119 @@ namespace CalamityMod.NPCs { SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == 1) - { spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[npc.type].Value.Width / 2, TextureAssets.Npc[npc.type].Value.Height / Main.npcFrameCount[npc.type] / 2); - Color rainbow = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + Color rainbow = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); Color alphaColor = npc.GetAlpha(rainbow); float RGBMult = 0.99f; alphaColor.R = (byte)(alphaColor.R * RGBMult); alphaColor.G = (byte)(alphaColor.G * RGBMult); alphaColor.B = (byte)(alphaColor.B * RGBMult); alphaColor.A = (byte)(alphaColor.A * RGBMult); - float xOffset = screenPos.X + npc.width / 2 - TextureAssets.Npc[npc.type].Value.Width * npc.scale / 2f + halfSizeTexture.X * npc.scale; - float yOffset = screenPos.Y + npc.height - TextureAssets.Npc[npc.type].Value.Height * npc.scale / Main.npcFrameCount[npc.type] + 4f + halfSizeTexture.Y * npc.scale + npc.gfxOffY; - for (int i = 0; i < 4; i++) + int totalAfterimages = Main.player[Main.myPlayer].Calamity().trippyLevel == 3 ? 16 : (Main.player[Main.myPlayer].Calamity().trippyLevel == 2 ? 12 : 4); + for (int i = 0; i < totalAfterimages; i++) { - Vector2 position9 = npc.position; - float num214 = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X); - float num215 = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); + Vector2 position = npc.position; + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[Main.myPlayer].Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[Main.myPlayer].Center.Y); - if (i == 0 || i == 2) - position9.X = Main.LocalPlayer.Center.X + num214; - else - position9.X = Main.LocalPlayer.Center.X - num214; + float smallDistanceMult = 0.48f; + float largeDistanceMult = 1.33f; + bool whatTheFuck = Main.player[Main.myPlayer].Calamity().trippyLevel == 3; - position9.X -= npc.width / 2; + switch (i) + { + case 0: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + break; - if (i == 0 || i == 1) - position9.Y = Main.LocalPlayer.Center.Y + num215; - else - position9.Y = Main.LocalPlayer.Center.Y - num215; + case 1: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + break; - position9.Y -= npc.height / 2; + case 2: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + break; - Main.spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, new Vector2(position9.X - xOffset, position9.Y - yOffset), new Microsoft.Xna.Framework.Rectangle?(npc.frame), alphaColor, npc.rotation, halfSizeTexture, npc.scale, spriteEffects, 0f); + case 3: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + break; + + case 4: // 1 o'clock position + position.X = Main.player[Main.myPlayer].Center.X + (distanceFromTargetX * (whatTheFuck ? 1f : smallDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y - (distanceFromTargetY * (whatTheFuck ? 0f : largeDistanceMult)); + break; + + case 5: // 4 o'clock position + position.X = Main.player[Main.myPlayer].Center.X + (distanceFromTargetX * (whatTheFuck ? 0f : largeDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y + (distanceFromTargetY * (whatTheFuck ? 1f : smallDistanceMult)); + break; + + case 6: // 7 o'clock position + position.X = Main.player[Main.myPlayer].Center.X - (distanceFromTargetX * (whatTheFuck ? 1f : smallDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y + (distanceFromTargetY * (whatTheFuck ? 0f : largeDistanceMult)); + break; + + case 7: // 10 o'clock position + position.X = Main.player[Main.myPlayer].Center.X - (distanceFromTargetX * (whatTheFuck ? 0f : largeDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y - (distanceFromTargetY * (whatTheFuck ? 1f : smallDistanceMult)); + break; + + case 8: // 11 o'clock position + position.X = Main.player[Main.myPlayer].Center.X - (distanceFromTargetX * (whatTheFuck ? 0f : smallDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y - (distanceFromTargetY * (whatTheFuck ? 0.5f : largeDistanceMult)); + break; + + case 9: // 2 o'clock position + position.X = Main.player[Main.myPlayer].Center.X + (distanceFromTargetX * (whatTheFuck ? 0.5f : largeDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y - (distanceFromTargetY * (whatTheFuck ? 0f : smallDistanceMult)); + break; + + case 10: // 5 o'clock position + position.X = Main.player[Main.myPlayer].Center.X + (distanceFromTargetX * (whatTheFuck ? 0f : smallDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y + (distanceFromTargetY * (whatTheFuck ? 0.5f : largeDistanceMult)); + break; + + case 11: // 8 o'clock position + position.X = Main.player[Main.myPlayer].Center.X - (distanceFromTargetX * (whatTheFuck ? 0.5f : largeDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y + (distanceFromTargetY * (whatTheFuck ? 0f : smallDistanceMult)); + break; + + case 12: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX * 0.5f; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY * 0.5f; + break; + + case 13: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX * 0.5f; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY * 0.5f; + break; + + case 14: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX * 0.5f; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY * 0.5f; + break; + + case 15: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX * 0.5f; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY * 0.5f; + break; + + + default: + break; + } + + position.X -= npc.width / 2; + position.Y -= npc.height / 2; + + Vector2 halfSize = npc.frame.Size() / 2; + + spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, new Vector2(position.X - screenPos.X + (float)(npc.width / 2) - (float)TextureAssets.Npc[npc.type].Width() * npc.scale / 2f + halfSize.X * npc.scale, position.Y - screenPos.Y + (float)npc.height - (float)TextureAssets.Npc[npc.type].Height() * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + halfSize.Y * npc.scale + npc.gfxOffY), npc.frame, alphaColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); } } else @@ -6469,6 +6797,10 @@ namespace CalamityMod.NPCs public override void PostDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + // Energy shield if (npc.type == NPCID.CultistBoss || npc.type == NPCID.CultistBossClone) { @@ -6501,7 +6833,7 @@ namespace CalamityMod.NPCs intensity *= intensityAndOpacityMult; opacity *= intensityAndOpacityMult; - Texture2D forcefieldTexture = Request("CalamityMod/NPCs/SupremeCalamitas/ForcefieldTexture").Value; + Texture2D forcefieldTexture = SupremeCalamitas.SupremeCalamitas.ForcefieldTexture.Value; if (npc.type == NPCID.CultistBoss) GameShaders.Misc["CalamityMod:SupremeShield"].SetShaderTexture(Request("CalamityMod/ExtraTextures/GreyscaleGradients/EternityStreak")); @@ -6528,7 +6860,161 @@ namespace CalamityMod.NPCs spriteBatch.ExitShaderRegion(); } - if (CalamityWorld.revenge || BossRushEvent.BossRushActive) + // Destroyer drawing and laser telegraphs + else if (CalamityLists.DestroyerIDs.Contains(npc.type)) + { + Texture2D npcTexture = TextureAssets.Npc[npc.type].Value; + int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; + + Vector2 halfSize = npc.frame.Size() / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + if (npc.type == NPCID.TheDestroyerBody) + { + if (npc.ai[2] == 0f) + npc.frame.Y = 0; + else + npc.frame.Y = frameHeight; + } + + Color segmentDrawColor = npc.GetAlpha(drawColor); + + // Check if Destroyer is behind tiles and, if so, how much of the segment is behind tiles and adjust color accordingly + int x = (int)((npc.position.X - 8f) / 16f); + int x2 = (int)((npc.position.X + npc.width + 8f) / 16f); + int y = (int)((npc.position.Y - 8f) / 16f); + int y2 = (int)((npc.position.Y + npc.height + 8f) / 16f); + for (int l = x; l <= x2; l++) + { + for (int m = y; m <= y2; m++) + { + if (Lighting.Brightness(l, m) == 0f) + segmentDrawColor = Color.Black; + } + } + + // Draw segments + spriteBatch.Draw(npcTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), + npc.frame, segmentDrawColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + + // Draw lights + if (npc.ai[2] == 0f && segmentDrawColor != Color.Black) + { + // This life ratio is fine now because all Destroyer segments update to have the same amount of life every frame + float destroyerLifeRatio = npc.life / (float)npc.lifeMax; + + bool phase5 = destroyerLifeRatio < (death ? 0.2f : 0.1f); + + // Spawn DR check + bool hasSpawnDR = newAI[1] < DestroyerAI.DRIncraeseTime && newAI[1] > 60f; + + // Gradual color transition from ground to flight and vice versa + // 0f = Red, 1f = Purple + float phaseTransitionColorAmount = (hasSpawnDR || phase5) ? 1f : 0f; + if (!hasSpawnDR && !phase5) + { + if (newAI[3] >= DestroyerAI.GroundTelegraphStartGateValue) + phaseTransitionColorAmount = MathHelper.Clamp(1f - (newAI[3] - DestroyerAI.GroundTelegraphStartGateValue) / DestroyerAI.PhaseTransitionTelegraphTime, 0f, 1f); + else if (newAI[3] >= DestroyerAI.FlightTelegraphStartGateValue) + phaseTransitionColorAmount = MathHelper.Clamp((newAI[3] - DestroyerAI.FlightTelegraphStartGateValue) / DestroyerAI.PhaseTransitionTelegraphTime, 0f, 1f); + } + + // Light colors + int alpha = 192; + Color groundColor = new Color(150, 0, 0, alpha); + Color flightColor = revenge ? new Color(0, 0, 150, alpha) : groundColor; + Color segmentColor = Color.Lerp(groundColor, flightColor, phaseTransitionColorAmount); + Color telegraphColor_Red = new Color(255, 125, 125, alpha); + Color telegraphColor_Green = new Color(125, 255, 125, alpha); + Color telegraphColor_Cyan = new Color(0, 255, 255, alpha); + Color telegraphColor = telegraphColor_Red; + + // Telegraph for the laser breath and body lasers + float telegraphProgress = 0f; + if (destroyerLaserColor != -1) + { + if (npc.type == NPCID.TheDestroyer && death) + { + float telegraphGateValue = DestroyerAI.DeathModeLaserBreathGateValue - DestroyerAI.LaserTelegraphTime; + if (newAI[0] > telegraphGateValue) + { + switch (destroyerLaserColor) + { + default: + case 0: + break; + + case 1: + telegraphColor = telegraphColor_Green; + break; + + case 2: + telegraphColor = telegraphColor_Cyan; + break; + } + telegraphProgress = MathHelper.Clamp((newAI[0] - telegraphGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f); + } + } + else if (npc.type == NPCID.TheDestroyerBody && revenge) + { + float shootProjectileTime = death ? 270f : 450f; + float bodySegmentTime = npc.ai[0] * 30f; + float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; + float telegraphGateValue = shootProjectileGateValue - DestroyerAI.LaserTelegraphTime; + if (newAI[0] > telegraphGateValue) + { + switch (destroyerLaserColor) + { + default: + case 0: + break; + + case 1: + telegraphColor = telegraphColor_Green; + break; + + case 2: + telegraphColor = telegraphColor_Cyan; + break; + } + telegraphProgress = MathHelper.Clamp((newAI[0] - telegraphGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f); + } + } + else if (npc.type == NPCID.TheDestroyerBody) + { + float shootProjectileTime = Main.masterMode ? 500f : Main.expertMode ? 700f : 900f; + float bodySegmentTime = npc.ai[0] * 30f; + float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; + float telegraphGateValue = shootProjectileGateValue - DestroyerAI.LaserTelegraphTime; + if (npc.localAI[0] > telegraphGateValue) + telegraphProgress = MathHelper.Clamp((npc.localAI[0] - telegraphGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f); + } + } + + Texture2D glowTexture = CalamityMod.DestroyerGlowmasks[0].Value; + switch (npc.type) + { + default: + case NPCID.TheDestroyer: + break; + + case NPCID.TheDestroyerBody: + glowTexture = CalamityMod.DestroyerGlowmasks[1].Value; + break; + + case NPCID.TheDestroyerTail: + glowTexture = CalamityMod.DestroyerGlowmasks[2].Value; + break; + } + + float alphaMultiplier = 1f - npc.alpha / 255f; + spriteBatch.Draw(glowTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, Color.Lerp(segmentColor, telegraphColor, telegraphProgress) * alphaMultiplier, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + } + } + + if (revenge) { // Create additional afterimages in the cardinal directions in Rev+ if (npc.type == NPCID.BrainofCthulhu) @@ -6545,7 +7031,7 @@ namespace CalamityMod.NPCs currentColor.G = (byte)((float)(int)currentColor.G * opacity); currentColor.B = (byte)((float)(int)currentColor.B * opacity); currentColor.A = (byte)((float)(int)currentColor.A * opacity); - int totalAfterimages = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 12 : 4; + int totalAfterimages = death ? 12 : 4; for (int i = 0; i < totalAfterimages; i++) { Vector2 position = npc.position; @@ -6655,10 +7141,9 @@ namespace CalamityMod.NPCs if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Vector2 glowOffset = Vector2.UnitY * 8f; for (int i = 0; i < 2; i++) { - spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY) - glowOffset, npc.frame, + spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); } } @@ -6752,106 +7237,92 @@ namespace CalamityMod.NPCs spriteBatch.Draw(npcTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f); Color eyesColor = new Color(200, 200, 200, 0); - if ((Main.masterMode || BossRushEvent.BossRushActive) && CalamityWorld.revenge) + if (masterMode && revenge) { - eyesColor = npc.type == ModContent.NPCType() ? new Color(150, 100, 255, 0) : new Color(255, 255, 0, 0); + int alpha = 192; + eyesColor = npc.type == NPCType() ? new Color(150, 100, 255, alpha) : new Color(255, 255, 0, alpha); + Texture2D glowTexture = SkeletronPrime2.EyeTexture.Value; for (int i = 0; i < 3; i++) - spriteBatch.Draw(TextureAssets.BoneEyes.Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, eyesColor, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(glowTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, eyesColor, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f); } else spriteBatch.Draw(TextureAssets.BoneEyes.Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, eyesColor, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f); } - else if (CalamityLists.DestroyerIDs.Contains(npc.type)) - { - Texture2D npcTexture = TextureAssets.Npc[npc.type].Value; - int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; - Vector2 halfSize = npc.frame.Size() / 2; + else if (npc.type == NPCID.Plantera) + { + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + Texture2D npcTexture = TextureAssets.Npc[npc.type].Value; + SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - if (npc.type == NPCID.TheDestroyerBody) - { - if (npc.ai[2] == 0f) - npc.frame.Y = 0; - else - npc.frame.Y = frameHeight; - } + Color originalColor = npc.GetAlpha(drawColor); + Color newColor = new Color(100, 255, 100, 255); + Vector2 glowOffset = Vector2.UnitY * -4f; + Vector2 drawPosition = npc.Center - screenPos + new Vector2(0, npc.gfxOffY) + glowOffset; + Vector2 origin = npc.frame.Size() / 2; - Color segmentDrawColor = npc.GetAlpha(drawColor); - - // Check if Destroyer is behind tiles and if so, how much of the segment is behind tiles and adjust color accordingly - int x = (int)((npc.position.X - 8f) / 16f); - int x2 = (int)((npc.position.X + npc.width + 8f) / 16f); - int y = (int)((npc.position.Y - 8f) / 16f); - int y2 = (int)((npc.position.Y + npc.height + 8f) / 16f); - for (int l = x; l <= x2; l++) + bool phase2 = lifeRatio <= 0.5f; + if (!phase2) { - for (int m = y; m <= y2; m++) + float telegraphTimer = Math.Abs(npc.ai[1]); + bool startSeedGatlingSporeGasTelegraph = npc.ai[1] > PlanteraAI.SeedGatlingColorChangeGateValue; + bool endSeedGatlingSporeGasTelegraph = npc.ai[1] < -PlanteraAI.SeedGatlingDuration + PlanteraAI.SeedGatlingColorChangeDuration; + if (startSeedGatlingSporeGasTelegraph) { - if (Lighting.Brightness(l, m) == 0f) - segmentDrawColor = Color.Black; + float telegraphScalar = MathHelper.Clamp((telegraphTimer - PlanteraAI.SeedGatlingColorChangeGateValue) / PlanteraAI.SeedGatlingColorChangeDuration, 0f, 1f); + Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar); + spriteBatch.Draw(npcTexture, drawPosition, npc.frame, telegraphColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); + } + + // -300 to -120 + else if (endSeedGatlingSporeGasTelegraph) + { + float telegraphScalar = MathHelper.Clamp((telegraphTimer - (PlanteraAI.SeedGatlingDuration - PlanteraAI.SeedGatlingColorChangeDuration)) / PlanteraAI.SeedGatlingColorChangeDuration, 0f, 1f); + Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar); + spriteBatch.Draw(npcTexture, drawPosition, npc.frame, telegraphColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); } } - - // Draw segments - spriteBatch.Draw(npcTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), - npc.frame, segmentDrawColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); - - // Draw lights - if (npc.ai[2] == 0f && segmentDrawColor != Color.Black) + else { - float destroyerLifeRatio = 1f; - if (npc.realLife >= 0) - destroyerLifeRatio = Main.npc[npc.realLife].life / (float)Main.npc[npc.realLife].lifeMax; - - float shootProjectile = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 180 : 300; - float timer = npc.ai[0] * 30f; - float shootProjectileGateValue = timer + shootProjectile; - float glowDuration = 120f; - float startGlowingGateValue = shootProjectileGateValue - glowDuration; - - if ((newAI[3] >= 900f && destroyerLifeRatio < 0.5f) || (newAI[1] < 600f && newAI[1] > 60f)) + float telegraphTimer = Math.Abs(npc.ai[3]); + bool startChargeTelegraph = npc.ai[3] > PlanteraAI.ChargeTelegraphColorChangeGateValue; + bool endChargeTelegraph = npc.ai[3] <= -2f; + if (startChargeTelegraph) { - Color drawColor2 = new Color(50, 50, 255, 0) * (1f - npc.alpha / 255f); - for (int i = 0; i < 3; i++) + float telegraphScalar = MathHelper.Clamp((telegraphTimer - PlanteraAI.ChargeTelegraphColorChangeGateValue) / PlanteraAI.SeedGatlingColorChangeDuration, 0f, 1f); + Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar); + spriteBatch.Draw(npcTexture, drawPosition, npc.frame, telegraphColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); + } + + // -195 to -2 + else if (endChargeTelegraph) + { + float telegraphScalar = MathHelper.Clamp((Math.Abs(PlanteraAI.StopChargeGateValue) - telegraphTimer) / Math.Abs(PlanteraAI.StopChargeGateValue), 0f, 1f); + Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar); + + if (CalamityConfig.Instance.Afterimages) { - spriteBatch.Draw(TextureAssets.Dest[npc.type - NPCID.TheDestroyer].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, - drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + int afterimageAmount = 10; + int afterImageIncrement = 2; + for (int j = 0; j < afterimageAmount; j += afterImageIncrement) + { + Color afterimageColor = telegraphColor; + afterimageColor = Color.Lerp(afterimageColor, originalColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmount - j) / 15f; + Vector2 afterimagePos = npc.oldPos[j] + new Vector2(npc.width, npc.height) / 2f - screenPos; + afterimagePos -= new Vector2(npcTexture.Width, npcTexture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimagePos += origin * npc.scale + new Vector2(0f, npc.gfxOffY) + glowOffset; + spriteBatch.Draw(npcTexture, afterimagePos, npc.frame, afterimageColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); + } } - // Glow telegraph for lasers - /*if (newAI[0] > startGlowingGateValue) - { - Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - Color bloom = drawColor2; - bloom = Main.hslToRgb((Main.rgbToHsl(bloom).X + 0.02f) % 1, Main.rgbToHsl(bloom).Y, Main.rgbToHsl(bloom).Z); - float scalingFactor = (newAI[0] - startGlowingGateValue) / glowDuration; - float opacity = (float)Math.Sin(MathHelper.PiOver2 + scalingFactor * MathHelper.PiOver2); - float properBloomSize = (float)npc.height / (float)bloomTexture.Height; - float scale = scalingFactor; - spriteBatch.Draw(bloomTexture, npc.Center - Main.screenPosition, null, bloom * opacity * 0.5f, 0, bloomTexture.Size() / 2f, scale * 1f * properBloomSize, SpriteEffects.None, 0); - }*/ - } - else - { - Color drawColor2 = new Color(255, 255, 255, 0) * (1f - npc.alpha / 255f); - spriteBatch.Draw(TextureAssets.Dest[npc.type - NPCID.TheDestroyer].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, - drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); - - // Glow telegraph for lasers - /*if (newAI[0] > startGlowingGateValue) - { - Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - Color bloom = drawColor2; - bloom = Main.hslToRgb((Main.rgbToHsl(bloom).X + 0.02f) % 1, Main.rgbToHsl(bloom).Y, Main.rgbToHsl(bloom).Z); - float scalingFactor = (newAI[0] - startGlowingGateValue) / glowDuration; - float opacity = (float)Math.Sin(MathHelper.PiOver2 + scalingFactor * MathHelper.PiOver2); - float properBloomSize = (float)npc.height / (float)bloomTexture.Height; - float scale = scalingFactor; - spriteBatch.Draw(bloomTexture, npc.Center - Main.screenPosition, null, bloom * opacity * 0.5f, 0, bloomTexture.Size() / 2f, scale * 1f * properBloomSize, SpriteEffects.None, 0); - }*/ + spriteBatch.Draw(npcTexture, drawPosition, npc.frame, telegraphColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); } } } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 39874094a3..f4b101e5a1 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -80,7 +80,7 @@ namespace CalamityMod.NPCs // Progression shortcuts LeadingConditionRule postEoC = npcLoot.DefineConditionalDropSet(DropHelper.PostEoC()); LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode()); - LeadingConditionRule postCalPlant = npcLoot.DefineConditionalDropSet(DropHelper.PostCalPlant()); + LeadingConditionRule postCal = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); LeadingConditionRule postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); LeadingConditionRule postDoG = npcLoot.DefineConditionalDropSet(DropHelper.PostDoG()); @@ -120,8 +120,11 @@ namespace CalamityMod.NPCs // Wyvern Head // 8-10 Essence of Sunlight @ 100%, 10-12 Expert+ + // TODO: Move Aero Stone to the upcoming sky structure whenever it's implemented + // Aero Stone @ 25% Normal, 33.3% Expert+ case NPCID.WyvernHead: npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 8, 10, 10, 12)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 4, 3)); break; #endregion @@ -583,24 +586,24 @@ namespace CalamityMod.NPCs break; // Reaper, Psycho - // 2-4 Solar Veil @ 50% IF Clone or Plant dead + // 2-4 Solar Veil @ 50% IF Cal Clone dead // Darksun Fragment @ 50% IF Devourer of Gods dead case NPCID.Reaper: case NPCID.Psycho: - postCalPlant.Add(ModContent.ItemType(), 2, 2, 4); + postCal.Add(ModContent.ItemType(), 2, 2, 4); postDoG.Add(ModContent.ItemType(), 2); break; // Vampire / Vampire Bat (same enemy) // Moon Stone @ 15% INSTEAD OF 2.86% // Bat Hook @ 2.5% Normal, 5% Expert+ - // 2-4 Solar Veil @ 50% IF Clone or Plant dead + // 2-4 Solar Veil @ 50% IF Cal Clone dead // Darksun Fragment @ 50% IF Devourer of Gods dead case NPCID.VampireBat: case NPCID.Vampire: npcLoot.ChangeDropRate(ItemID.MoonStone, 3, 20); npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.BatHook, 40, 20)); - postCalPlant.Add(ModContent.ItemType(), 2, 2, 4); + postCal.Add(ModContent.ItemType(), 2, 2, 4); postDoG.Add(ModContent.ItemType(), 2); break; @@ -1172,6 +1175,7 @@ namespace CalamityMod.NPCs // Expert+ drops are also available on Normal npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.VolatileGelatin)); npcLoot.AddNormalOnly(ItemID.SoulofLight, 1, 15, 20); + npcLoot.AddNormalOnly(ItemID.PinkGel, 1, 15, 20); // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); @@ -1965,7 +1969,7 @@ DukeEditFailed: CalamityNetcode.SyncWorld(); } - // Spawn Exodium planetoids and send messages about Providence, Bloodstone, Polterplasm, etc. if ML has not been killed yet + // Spawn Exodium planetoids and send messages about Providence, Bloodstone, Necroplasm, etc. if ML has not been killed yet if (!NPC.downedMoonlord) { CalamityUtils.DisplayLocalizedText(key5, messageColor5); diff --git a/NPCs/CalamityVanillaMinibossesAI.cs b/NPCs/CalamityVanillaMinibossesAI.cs index c50cc3ee20..10d1ddeb09 100644 --- a/NPCs/CalamityVanillaMinibossesAI.cs +++ b/NPCs/CalamityVanillaMinibossesAI.cs @@ -27,7 +27,6 @@ namespace CalamityMod.NPCs npc.noTileCollide = false; npc.noGravity = true; npc.knockBackResist = 0f; - npc.damage = npc.defDamage; ref float aiState = ref npc.ai[0]; @@ -60,6 +59,7 @@ namespace CalamityMod.NPCs switch ((MothronAIState)(int)aiState) { case MothronAIState.DespawnYeet: + npc.damage = 0; Vector2 idealVelocity = Vector2.UnitY * -34f; npc.velocity = (npc.velocity * 4f + idealVelocity) / 5f; npc.noTileCollide = true; @@ -67,6 +67,8 @@ namespace CalamityMod.NPCs return false; case MothronAIState.NewAISelection: + npc.damage = 0; + ref float aiTimer = ref npc.ai[1]; npc.TargetClosest(true); @@ -146,6 +148,8 @@ namespace CalamityMod.NPCs break; case MothronAIState.FlyTowardsPlayer: + npc.damage = 0; + npc.collideX = false; npc.collideY = false; npc.noTileCollide = true; @@ -173,6 +177,8 @@ namespace CalamityMod.NPCs break; case MothronAIState.AccelerateTowardsPlayer: + npc.damage = (int)Math.Round(npc.defDamage * 0.5); + aiTimer = ref npc.ai[1]; ref float flySpeedAdditive = ref npc.ai[2]; @@ -226,6 +232,8 @@ namespace CalamityMod.NPCs break; case MothronAIState.ChargeRedirect: + npc.damage = 0; + flySpeedAdditive = ref npc.ai[2]; npc.noTileCollide = true; @@ -257,7 +265,10 @@ namespace CalamityMod.NPCs idealVelocity = npc.SafeDirectionTo(destination, -Vector2.UnitY) * flySpeed; npc.velocity = (npc.velocity * (flyInertia - 1f) + idealVelocity) / flyInertia; break; + case MothronAIState.ChargePreparation: + npc.damage = 0; + aiTimer = ref npc.ai[1]; ref float chargeDirection = ref npc.ai[2]; @@ -292,11 +303,11 @@ namespace CalamityMod.NPCs } break; - case MothronAIState.DoTheFuckingCharge: + case MothronAIState.DoTheFuckingCharge: chargeDirection = ref npc.ai[2]; flySpeedAdditive = ref npc.ai[3]; - npc.damage = (int)(npc.defDamage * 1.2); + npc.damage = (int)Math.Round(npc.defDamage * 1.2); npc.collideX = false; npc.collideY = false; npc.noTileCollide = true; @@ -331,6 +342,8 @@ namespace CalamityMod.NPCs break; case MothronAIState.PickSpotToLayEgg: + npc.damage = 0; + ref float laySpotPositionX = ref npc.ai[2]; ref float laySpotPositionY = ref npc.ai[3]; // Fallback if the spot selection fails. @@ -376,6 +389,8 @@ namespace CalamityMod.NPCs break; case MothronAIState.FlyToEggSpot: + npc.damage = 0; + npc.spriteDirection = npc.direction = (npc.velocity.X > 0).ToDirectionInt(); npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; npc.noTileCollide = true; @@ -398,6 +413,8 @@ namespace CalamityMod.NPCs break; case MothronAIState.LayEgg: + npc.damage = 0; + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; npc.noTileCollide = false; @@ -643,6 +660,9 @@ namespace CalamityMod.NPCs if (npc.ai[2] == 0f || npc.ai[2] == 3f) { + // Avoid cheap bullshit + npc.damage = 0; + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) npc.timeLeft = 10; @@ -695,6 +715,9 @@ namespace CalamityMod.NPCs } else if (npc.ai[2] == 1f) { + // Avoid cheap bullshit + npc.damage = 0; + Vector2 scytheReturnPosition = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float scytheReturnTargetX = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - scytheReturnPosition.X; float scytheReturnTargetY = Main.npc[(int)npc.ai[1]].position.Y + 230f - scytheReturnPosition.Y; @@ -709,6 +732,9 @@ namespace CalamityMod.NPCs if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) { + // Set damage + npc.damage = npc.defDamage; + npc.TargetClosest(true); npc.ai[2] = 2f; @@ -725,13 +751,24 @@ namespace CalamityMod.NPCs } else if (npc.ai[2] == 2f) { + // Avoid cheap bullshit + npc.damage = npc.defDamage; + float scytheReturnDestination = Math.Abs(npc.Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(npc.Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f || scytheReturnDestination > 800f) + { + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[2] = 3f; + } } else if (npc.ai[2] == 4f) { + // Avoid cheap bullshit + npc.damage = 0; + Vector2 scytheLesserSwipePos = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float scytheLesserSwipeTargetX = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - scytheLesserSwipePos.X; float scytheLesserSwipeTargetY = Main.npc[(int)npc.ai[1]].position.Y + 230f - scytheLesserSwipePos.Y; @@ -748,6 +785,9 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 500f) { + // Set damage + npc.damage = npc.defDamage; + npc.TargetClosest(true); npc.ai[2] = 5f; @@ -764,10 +804,18 @@ namespace CalamityMod.NPCs } else if (npc.ai[2] == 5f) { + // Set damage + npc.damage = npc.defDamage; + float scytheLesserSwipeReturnDest = Math.Abs(npc.Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(npc.Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); if ((npc.velocity.X > 0f && npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || scytheLesserSwipeReturnDest > 800f) + { + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[2] = 0f; + } } return false; diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index a14db71292..1f6645692d 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -17,6 +17,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -33,6 +34,8 @@ namespace CalamityMod.NPCs.CeaselessVoid public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/CeaselessVoidDeath"); public static readonly SoundStyle BuildupSound = new("CalamityMod/Sounds/Custom/CeaselessVoidDeathBuild"); + public static Asset GlowTexture; + public bool playedbuildsound = false; public override void SetStaticDefaults() @@ -46,6 +49,10 @@ namespace CalamityMod.NPCs.CeaselessVoid }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -169,7 +176,7 @@ namespace CalamityMod.NPCs.CeaselessVoid drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/CeaselessVoid/CeaselessVoidGlow").Value; + texture2D15 = GlowTexture.Value; Color cyanLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index b7f04b99dc..202e8d1e86 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -5,6 +5,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -27,11 +28,17 @@ namespace CalamityMod.NPCs.CeaselessVoid public const int HitboxSize = 64; public const int FrameCount = 8; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = FrameCount; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -50,7 +57,6 @@ namespace CalamityMod.NPCs.CeaselessVoid NPC.Opacity = 0f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit53; NPC.DeathSound = SoundID.NPCDeath44; NPC.Calamity().VulnerableToSickness = false; @@ -244,7 +250,7 @@ namespace CalamityMod.NPCs.CeaselessVoid if (NPC.dontTakeDamage) return false; - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/CeaselessVoid/DarkEnergyGlow").Value; + Texture2D glowTexture = GlowTexture.Value; Color glowColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f) * NPC.Opacity; if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index 730635427e..fe2ecc6d04 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -2,9 +2,9 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; -using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -12,11 +12,17 @@ namespace CalamityMod.NPCs.Crabulon { public class CrabShroom : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.BossBestiaryPriority.Add(Type); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -40,7 +46,6 @@ namespace CalamityMod.NPCs.Crabulon NPC.knockBackResist = 0.5f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; @@ -134,7 +139,7 @@ namespace CalamityMod.NPCs.Crabulon spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Texture2D glow = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabShroomGlow").Value; + Texture2D glow = GlowTexture.Value; Color colorToShift = Main.zenithWorld ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : Color.Cyan; Color glowColor = Color.Lerp(Color.White, colorToShift, 0.5f); diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index 2b7721a132..1d54dbc91c 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -19,6 +19,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -35,6 +36,12 @@ namespace CalamityMod.NPCs.Crabulon private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private bool stomping = false; + public static Asset AltTexture; + public static Asset AttackTexture; + public static Asset Texture_Glow; + public static Asset AltTexture_Glow; + public static Asset AttackTexture_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -48,6 +55,14 @@ namespace CalamityMod.NPCs.Crabulon value.Position.Y += 80f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + AttackTexture = ModContent.Request(Texture + "Attack", AssetRequestMode.AsyncLoad); + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + AltTexture_Glow = ModContent.Request(Texture + "AltGlow", AssetRequestMode.AsyncLoad); + AttackTexture_Glow = ModContent.Request(Texture + "AttackGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -769,11 +784,11 @@ namespace CalamityMod.NPCs.Crabulon spriteEffects = SpriteEffects.FlipHorizontally; Texture2D textureIdle = TextureAssets.Npc[NPC.type].Value; - Texture2D glowIdle = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonGlow").Value; - Texture2D textureWalk = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAlt").Value; - Texture2D glowWalk = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAltGlow").Value; - Texture2D textureAttack = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAttack").Value; - Texture2D glowAttack = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAttackGlow").Value; + Texture2D glowIdle = Texture_Glow.Value; + Texture2D textureWalk = AltTexture.Value; + Texture2D glowWalk = AltTexture_Glow.Value; + Texture2D textureAttack = AttackTexture.Value; + Texture2D glowAttack = AttackTexture_Glow.Value; Color colorToShift = Main.zenithWorld ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : Color.Cyan; Color glowColor = Color.Lerp(Color.White, colorToShift, 0.5f); diff --git a/NPCs/Crags/SoulSlurper.cs b/NPCs/Crags/SoulSlurper.cs index 3a9bdff309..0193e34739 100644 --- a/NPCs/Crags/SoulSlurper.cs +++ b/NPCs/Crags/SoulSlurper.cs @@ -8,6 +8,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -18,9 +19,15 @@ namespace CalamityMod.NPCs.Crags { public class SoulSlurper : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -267,7 +274,7 @@ namespace CalamityMod.NPCs.Crags drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/Crags/SoulSlurperGlow").Value; + texture = GlowTexture.Value; Color redGlow = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 969ac7356f..ad55d8f82a 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -26,6 +26,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -53,6 +54,12 @@ namespace CalamityMod.NPCs.Cryogen public static readonly SoundStyle ShieldRegenSound = new("CalamityMod/Sounds/Custom/CryogenShieldRegenerate"); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/CryogenDeath"); + public static Asset Phase2Texture; + public static Asset Phase3Texture; + public static Asset Phase4Texture; + public static Asset Phase5Texture; + public static Asset Phase6Texture; + public FireParticleSet FireDrawer = null; public static int cryoIconIndex; @@ -74,6 +81,14 @@ namespace CalamityMod.NPCs.Cryogen { NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request("CalamityMod/NPCs/Cryogen/Cryogen_Phase2", AssetRequestMode.AsyncLoad); + Phase3Texture = ModContent.Request("CalamityMod/NPCs/Cryogen/Cryogen_Phase3", AssetRequestMode.AsyncLoad); + Phase4Texture = ModContent.Request("CalamityMod/NPCs/Cryogen/Cryogen_Phase4", AssetRequestMode.AsyncLoad); + Phase5Texture = ModContent.Request("CalamityMod/NPCs/Cryogen/Cryogen_Phase5", AssetRequestMode.AsyncLoad); + Phase6Texture = ModContent.Request("CalamityMod/NPCs/Cryogen/Cryogen_Phase6", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -927,7 +942,7 @@ Block: { NPC.TargetClosest(); NPC.ai[0] = 4f; - NPC.ai[1] = 0f; + NPC.ai[1] = 150f; NPC.ai[3] = 0f; NPC.localAI[0] = 0f; NPC.localAI[2] = 0f; @@ -957,7 +972,7 @@ Block: if (phase6) { - if (NPC.ai[1] == 60f) + if (NPC.ai[1] == 60f) // Spawn homing ice blasts on charge { NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (18f + enrageScale * 2f); @@ -996,7 +1011,7 @@ Block: } NPC.ai[1] -= 1f; - if (NPC.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) // Set the next charge, or switch back to floating above the player { NPC.ai[3] += 1f; NPC.TargetClosest(); @@ -1012,12 +1027,17 @@ Block: NPC.rotation = NPC.velocity.X * 0.1f; } - else if (NPC.ai[1] <= 15f) + else if (NPC.ai[1] <= 15f) // Slow down in preparation for the next charge { NPC.velocity *= 0.95f; NPC.rotation = NPC.velocity.X * 0.15f; } - else + else if (NPC.ai[1] > 60f) // Only used for when phase 6 first starts to prevent insta-charges + { + NPC.velocity *= 0.98f; + NPC.rotation += (150f - NPC.ai[1]) * 0.01f * NPC.direction; + } + else // Charge { // Set damage NPC.damage = NPC.defDamage; @@ -1230,8 +1250,29 @@ Block: else FireDrawer = null; - string phase = "CalamityMod/NPCs/Cryogen/Cryogen_Phase" + currentPhase; - Texture2D texture = ModContent.Request(phase).Value; + + Texture2D texture = TextureAssets.Npc[NPC.type].Value; + switch (currentPhase) + { + case 2: + texture = Phase2Texture.Value; + break; + case 3: + texture = Phase3Texture.Value; + break; + case 4: + texture = Phase4Texture.Value; + break; + case 5: + texture = Phase5Texture.Value; + break; + case 6: + texture = Phase6Texture.Value; + break; + default: + texture = TextureAssets.Npc[NPC.type].Value; + break; + } SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) diff --git a/NPCs/Cryogen/CryogenShield.cs b/NPCs/Cryogen/CryogenShield.cs index 4c07fcb1a8..1ea4343171 100644 --- a/NPCs/Cryogen/CryogenShield.cs +++ b/NPCs/Cryogen/CryogenShield.cs @@ -25,7 +25,6 @@ namespace CalamityMod.NPCs.Cryogen NPC.Calamity().canBreakPlayerDefense = true; NPC.aiStyle = -1; AIType = -1; - NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.coldDamage = true; NPC.GetNPCDamage(); @@ -62,9 +61,14 @@ namespace CalamityMod.NPCs.Cryogen NPC.HitSound = Main.zenithWorld ? SoundID.NPCHit41 : Cryogen.HitSound; NPC.DeathSound = Main.zenithWorld ? SoundID.NPCDeath14 : BreakSound; - NPC.Opacity += 0.012f; + NPC.Opacity += 0.01f; if (NPC.Opacity > 1f) + { + NPC.damage = NPC.defDamage; NPC.Opacity = 1f; + } + else + NPC.damage = 0; NPC.rotation += 0.15f; diff --git a/NPCs/DesertScourge/DesertNuisanceBody.cs b/NPCs/DesertScourge/DesertNuisanceBody.cs index 9b547a3971..5c467c4e02 100644 --- a/NPCs/DesertScourge/DesertNuisanceBody.cs +++ b/NPCs/DesertScourge/DesertNuisanceBody.cs @@ -36,7 +36,6 @@ namespace CalamityMod.NPCs.DesertScourge NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.netAlways = true; diff --git a/NPCs/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index a0df7b913e..0b9c25d636 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -233,7 +233,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.velocity.Y = maxChaseSpeed; // This bool exists to stop the strange wiggle behavior when worms are falling down - bool slowXVelocity = Math.Abs(NPC.velocity.X) > maxChaseSpeed; + bool slowXVelocity = Math.Abs(NPC.velocity.X) > speedCopy; if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.4) { if (NPC.velocity.X < 0f) @@ -365,12 +365,12 @@ namespace CalamityMod.NPCs.DesertScourge float minimalDamageVelocity = maxChaseSpeed * 0.5f; if (NPC.velocity.Length() <= minimalContactDamageVelocity) { - NPC.damage = (int)(NPC.defDamage * 0.5f); + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); } else { float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); } NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2; diff --git a/NPCs/DesertScourge/DesertNuisanceTail.cs b/NPCs/DesertScourge/DesertNuisanceTail.cs index 9a1024b6e8..618b0102fb 100644 --- a/NPCs/DesertScourge/DesertNuisanceTail.cs +++ b/NPCs/DesertScourge/DesertNuisanceTail.cs @@ -36,7 +36,6 @@ namespace CalamityMod.NPCs.DesertScourge NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.netAlways = true; diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 23693f3e39..a5954ba900 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -40,7 +40,6 @@ namespace CalamityMod.NPCs.DesertScourge NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.netAlways = true; diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 01c314de5f..0c76c0a71e 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -487,7 +487,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.velocity.Y = maxChaseSpeed; // This bool exists to stop the strange wiggle behavior when worms are falling down - bool slowXVelocity = Math.Abs(NPC.velocity.X) > maxChaseSpeed; + bool slowXVelocity = Math.Abs(NPC.velocity.X) > speedCopy; if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.4) { if (NPC.velocity.X < 0f) @@ -619,12 +619,12 @@ namespace CalamityMod.NPCs.DesertScourge float minimalDamageVelocity = maxChaseSpeed * 0.5f; if (NPC.velocity.Length() <= minimalContactDamageVelocity) { - NPC.damage = (int)(NPC.defDamage * 0.5f); + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); } else { float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); } NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2; @@ -721,7 +721,6 @@ namespace CalamityMod.NPCs.DesertScourge // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); - normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); // Fishing diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index ea0d38c87f..ff24926a44 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -38,7 +38,6 @@ namespace CalamityMod.NPCs.DesertScourge NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.netAlways = true; diff --git a/NPCs/DevourerofGods/CosmicGuardianBody.cs b/NPCs/DevourerofGods/CosmicGuardianBody.cs index 55d3b639b5..e7190dd435 100644 --- a/NPCs/DevourerofGods/CosmicGuardianBody.cs +++ b/NPCs/DevourerofGods/CosmicGuardianBody.cs @@ -5,6 +5,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -16,9 +17,16 @@ namespace CalamityMod.NPCs.DevourerofGods { public int invinceTime = 180; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.CosmicGuardianHead.DisplayName"); + + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -40,7 +48,6 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; @@ -174,7 +181,7 @@ namespace CalamityMod.NPCs.DevourerofGods drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/CosmicGuardianBodyGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/DevourerofGods/CosmicGuardianHead.cs b/NPCs/DevourerofGods/CosmicGuardianHead.cs index 28f9ad9e90..a87e7a8763 100644 --- a/NPCs/DevourerofGods/CosmicGuardianHead.cs +++ b/NPCs/DevourerofGods/CosmicGuardianHead.cs @@ -6,6 +6,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -21,6 +22,9 @@ namespace CalamityMod.NPCs.DevourerofGods private const int maxLength = 11; private int invinceTime = 180; + public static Asset GlowTexture; + public static Asset GlowTexture2; + public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); @@ -35,6 +39,11 @@ namespace CalamityMod.NPCs.DevourerofGods value.Position.X += 62f; value.Position.Y += 35f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + GlowTexture2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -54,7 +63,6 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; @@ -335,12 +343,12 @@ namespace CalamityMod.NPCs.DevourerofGods float minimalDamageVelocity = segmentVelocity * 0.5f; if (NPC.velocity.Length() <= minimalContactDamageVelocity) { - NPC.damage = (int)(NPC.defDamage * 0.5f); + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); } else { float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); } NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; @@ -363,12 +371,12 @@ namespace CalamityMod.NPCs.DevourerofGods distFromHead3 += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/CosmicGuardianHeadGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/CosmicGuardianHeadGlow2").Value; + texture2D15 = GlowTexture2.Value; glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/DevourerofGods/CosmicGuardianTail.cs b/NPCs/DevourerofGods/CosmicGuardianTail.cs index eebc906c3c..1fd44f0e2b 100644 --- a/NPCs/DevourerofGods/CosmicGuardianTail.cs +++ b/NPCs/DevourerofGods/CosmicGuardianTail.cs @@ -5,6 +5,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -16,9 +17,16 @@ namespace CalamityMod.NPCs.DevourerofGods { public int invinceTime = 180; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.CosmicGuardianHead.DisplayName"); + + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -37,7 +45,6 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; @@ -171,7 +178,7 @@ namespace CalamityMod.NPCs.DevourerofGods drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/CosmicGuardianTailGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index e9e58b8136..1fb5226174 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -9,6 +9,7 @@ using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -31,14 +32,32 @@ namespace CalamityMod.NPCs.DevourerofGods phase2IconIndex = ModContent.GetModBossHeadSlot(phase2IconPath); } + private const float LaserVelocityMultiplierMin = 0.5f; + + private const float LaserVelocityDistanceMultiplier = LaserVelocityMultiplierMin * 0.05f; + private int invinceTime = 360; private bool setOpacity = false; private bool phase2Started = false; public int SegmentIndex; + + public static Asset Texture_Glow; + public static Asset Phase2Texture; + public static Asset Phase2Texture_Glow; + public static Asset Phase2Texture_Glow2; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.DevourerofGodsHead.DisplayName"); + public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + Phase2Texture = ModContent.Request(Texture + "S", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow = ModContent.Request(Texture + "SGlow", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow2 = ModContent.Request(Texture + "SGlow2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -55,7 +74,6 @@ namespace CalamityMod.NPCs.DevourerofGods global.DR = 0.925f; global.unbreakableDR = true; NPC.chaseable = false; - NPC.canGhostHeal = false; } NPC.LifeMaxNERB(887500, 1065000, 1500000); // Phase 1 is 355000, Phase 2 is 532500 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; @@ -236,8 +254,8 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.TargetClosest(); SoundEngine.PlaySound(SoundID.Item12, player.Center); float maxProjectileVelocity = bossRush ? 24f : death ? 20f : revenge ? 18.25f : expertMode ? 17.5f : 16f; - float minProjectileVelocity = maxProjectileVelocity * 0.25f; - float projectileVelocity = MathHelper.Clamp(Vector2.Distance(player.Center, NPC.Center) * 0.01f, minProjectileVelocity, maxProjectileVelocity); + float minProjectileVelocity = maxProjectileVelocity * LaserVelocityMultiplierMin; + float projectileVelocity = MathHelper.Clamp(Vector2.Distance(player.Center, NPC.Center) * LaserVelocityDistanceMultiplier, minProjectileVelocity, maxProjectileVelocity); Vector2 velocityVector = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); @@ -261,8 +279,8 @@ namespace CalamityMod.NPCs.DevourerofGods SoundEngine.PlaySound(SoundID.Item12, player.Center); NPC.localAI[0] = 0f; float maxProjectileVelocity = bossRush ? 22f : death ? 18f : revenge ? 16.25f : expertMode ? 15.5f : 14f; - float minProjectileVelocity = maxProjectileVelocity * 0.25f; - float projectileVelocity = MathHelper.Clamp(Vector2.Distance(player.Center, NPC.Center) * 0.01f, minProjectileVelocity, maxProjectileVelocity); + float minProjectileVelocity = maxProjectileVelocity * LaserVelocityMultiplierMin; + float projectileVelocity = MathHelper.Clamp(Vector2.Distance(player.Center, NPC.Center) * LaserVelocityDistanceMultiplier, minProjectileVelocity, maxProjectileVelocity); Vector2 velocityVector = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); @@ -388,7 +406,7 @@ namespace CalamityMod.NPCs.DevourerofGods spriteEffects = SpriteEffects.FlipHorizontally; bool useOtherTextures = phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60f; - Texture2D texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyS").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = useOtherTextures ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; @@ -400,13 +418,13 @@ namespace CalamityMod.NPCs.DevourerofGods { if (useOtherTextures) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodySGlow").Value; + texture2D15 = Phase2Texture_Glow.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } - texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodySGlow2").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyGlow").Value; + texture2D15 = useOtherTextures ? Phase2Texture_Glow2.Value : Texture_Glow.Value; Color glowmaskColor2 = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor2, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index df7d5fcc58..fe0c84c05d 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -30,6 +30,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -48,6 +49,12 @@ namespace CalamityMod.NPCs.DevourerofGods public static int phase1IconIndex; public static int phase2IconIndex; + public static Asset Texture_Glow; + public static Asset Texture_Glow2; + public static Asset Phase2Texture; + public static Asset Phase2Texture_Glow; + public static Asset Phase2Texture_Glow2; + internal static void LoadHeadIcons() { string phase1IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss"; @@ -168,6 +175,14 @@ namespace CalamityMod.NPCs.DevourerofGods value.Position.Y += 38f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + Texture_Glow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + Phase2Texture = ModContent.Request(Texture + "S", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow = ModContent.Request(Texture + "SGlow", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow2 = ModContent.Request(Texture + "SGlow2", AssetRequestMode.AsyncLoad); + } } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -551,7 +566,7 @@ namespace CalamityMod.NPCs.DevourerofGods } // Dialogue the moment the second phase starts - if (NPC.localAI[2] == 60f) + if (NPC.localAI[2] == 60f && !bossRush) { string key = "Mods.CalamityMod.Status.Boss.EdgyBossText5"; Color messageColor = Color.Cyan; @@ -727,9 +742,12 @@ namespace CalamityMod.NPCs.DevourerofGods calamityGlobalNPC.newAI[3] = 0f; // Anger message - string key = "Mods.CalamityMod.Status.Boss.EdgyBossText6"; - Color messageColor = Color.Cyan; - CalamityUtils.DisplayLocalizedText(key, messageColor); + if (!bossRush) + { + string key = "Mods.CalamityMod.Status.Boss.EdgyBossText6"; + Color messageColor = Color.Cyan; + CalamityUtils.DisplayLocalizedText(key, messageColor); + } // Summon Cosmic Guardians SoundEngine.PlaySound(AttackSound with { Pitch = AttackSound.Pitch + extrapitch }, player.Center); @@ -1373,7 +1391,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.velocity.Y = segmentVelocity; // This bool exists to stop the strange wiggle behavior when worms are falling down - bool slowXVelocity = Math.Abs(NPC.velocity.X) > segmentVelocity; + bool slowXVelocity = Math.Abs(NPC.velocity.X) > turnSpeedCopy; if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 2.2) { if (NPC.velocity.X < 0f) @@ -1578,9 +1596,12 @@ namespace CalamityMod.NPCs.DevourerofGods if (revenge) spawnDoGCountdown = 10; - string key = "Mods.CalamityMod.Status.Boss.EdgyBossText"; - Color messageColor = Color.Cyan; - CalamityUtils.DisplayLocalizedText(key, messageColor); + if (!bossRush) + { + string key = "Mods.CalamityMod.Status.Boss.EdgyBossText"; + Color messageColor = Color.Cyan; + CalamityUtils.DisplayLocalizedText(key, messageColor); + } NPC.TargetClosest(); spawnedGuardians = true; @@ -2149,7 +2170,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.velocity.Y = segmentVelocity; // This bool exists to stop the strange wiggle behavior when worms are falling down - bool slowXVelocity = Math.Abs(NPC.velocity.X) > segmentVelocity; + bool slowXVelocity = Math.Abs(NPC.velocity.X) > turnSpeedCopy; if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 2.2) { if (NPC.velocity.X < 0f) @@ -2338,12 +2359,12 @@ namespace CalamityMod.NPCs.DevourerofGods float minimalDamageVelocity = segmentVelocity * 0.5f; if (NPC.velocity.Length() <= minimalContactDamageVelocity) { - NPC.damage = (int)(NPC.defDamage * 0.5f); + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); } else { float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); } if (NPC.life > Main.npc[(int)NPC.ai[0]].life) @@ -2606,7 +2627,7 @@ namespace CalamityMod.NPCs.DevourerofGods spriteEffects = SpriteEffects.FlipHorizontally; bool useOtherTextures = (Phase2Started && NPC.localAI[2] <= 60f) || NPC.IsABestiaryIconDummy; - Texture2D texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadS").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = useOtherTextures ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); if (NPC.IsABestiaryIconDummy) NPC.frame = texture2D15.Frame(); @@ -2618,12 +2639,12 @@ namespace CalamityMod.NPCs.DevourerofGods if (!NPC.dontTakeDamage) { - texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadSGlow").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadGlow").Value; + texture2D15 = useOtherTextures ? Phase2Texture_Glow.Value : Texture_Glow.Value; Color glowmaskLerp = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadSGlow2").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadGlow2").Value; + texture2D15 = useOtherTextures ? Phase2Texture_Glow2.Value : Texture_Glow2.Value; glowmaskLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -2654,10 +2675,11 @@ namespace CalamityMod.NPCs.DevourerofGods string key2 = "Mods.CalamityMod.Status.Progression.DoGBossText2"; Color messageColor2 = Color.Orange; string key3 = "Mods.CalamityMod.Status.Progression.DargonBossText"; + Color messageColor3 = Color.Yellow; CalamityUtils.DisplayLocalizedText(key, messageColor); CalamityUtils.DisplayLocalizedText(key2, messageColor2); - CalamityUtils.DisplayLocalizedText(key3, messageColor2); + CalamityUtils.DisplayLocalizedText(key3, messageColor3); } // Mark DoG as dead @@ -2884,7 +2906,7 @@ namespace CalamityMod.NPCs.DevourerofGods target.AddBuff(ModContent.BuffType(), 200, true); target.AddBuff(ModContent.BuffType(), 600, true); - if (target.Calamity().dogTextCooldown <= 0) + if (target.Calamity().dogTextCooldown <= 0 && !BossRushEvent.BossRushActive) { string text = Utils.SelectRandom(Main.rand, new string[] { diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index 40f2bf40b0..1cac86041f 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -8,6 +8,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -23,6 +24,12 @@ namespace CalamityMod.NPCs.DevourerofGods public static int phase1IconIndex; public static int phase2IconIndex; + public static Asset Texture_Glow; + public static Asset Texture_Glow2; + public static Asset Phase2Texture; + public static Asset Phase2Texture_Glow; + public static Asset Phase2Texture_Glow2; + internal static void LoadHeadIcons() { string phase1IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsTail_Head_Boss"; @@ -42,6 +49,14 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + Texture_Glow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + Phase2Texture = ModContent.Request(Texture + "S", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow = ModContent.Request(Texture + "SGlow", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow2 = ModContent.Request(Texture + "SGlow2", AssetRequestMode.AsyncLoad); + } } internal void setInvulTime(int time) @@ -67,7 +82,6 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; NPC.boss = true; @@ -102,7 +116,7 @@ namespace CalamityMod.NPCs.DevourerofGods { NPC head = CalamityGlobalNPC.DoGHead >= 0 ? Main.npc[CalamityGlobalNPC.DoGHead] : null; DevourerofGodsHead modNPC = head?.ModNPC() ?? null; - if (head != null || modNPC.AwaitingPhase2Teleport || !modNPC.Phase2Started) + if (head is null || modNPC.AwaitingPhase2Teleport || !modNPC.Phase2Started) return; rotation = NPC.rotation; @@ -356,7 +370,7 @@ namespace CalamityMod.NPCs.DevourerofGods spriteEffects = SpriteEffects.FlipHorizontally; bool useOtherTextures = phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60f; - Texture2D texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailS").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = useOtherTextures ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); Vector2 drawPosition = NPC.Center - screenPos; @@ -366,12 +380,12 @@ namespace CalamityMod.NPCs.DevourerofGods if (!NPC.dontTakeDamage) { - texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailSGlow").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailGlow").Value; + texture2D15 = useOtherTextures ? Phase2Texture_Glow.Value : Texture_Glow.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailSGlow2").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailGlow2").Value; + texture2D15 = useOtherTextures ? Phase2Texture_Glow2.Value : Texture_Glow2.Value; glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/DraedonLabThings/Androomba.cs b/NPCs/DraedonLabThings/Androomba.cs index b481f16d30..d867d59bc8 100644 --- a/NPCs/DraedonLabThings/Androomba.cs +++ b/NPCs/DraedonLabThings/Androomba.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Critters; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -14,7 +15,11 @@ namespace CalamityMod.NPCs.DraedonLabThings { public class Androomba : ModNPC { + + public static Asset GlowTexture; + public SoundStyle HurrySound = new("CalamityMod/Sounds/Custom/WulfrumDroidHurry", 2) { PitchVariance = 0.3f }; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 22; @@ -25,6 +30,10 @@ namespace CalamityMod.NPCs.DraedonLabThings value.Position.Y += 18; value.PortraitPositionYOverride = 38f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -253,7 +262,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/Androomba_Glow").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; drawPosition.Y += DrawOffsetY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/NPCs/DraedonLabThings/Nanodroid.cs b/NPCs/DraedonLabThings/Nanodroid.cs index 9ad79bb4f1..5730109ccb 100644 --- a/NPCs/DraedonLabThings/Nanodroid.cs +++ b/NPCs/DraedonLabThings/Nanodroid.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Critters; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -12,11 +13,17 @@ namespace CalamityMod.NPCs.DraedonLabThings { public class Nanodroid : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; NPCID.Sets.CountsAsCritter[NPC.type] = true; Main.npcCatchable[NPC.type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -65,7 +72,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/Nanodroid_Glow").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; spriteBatch.Draw(critterTexture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); diff --git a/NPCs/DraedonLabThings/NanodroidDysfunctional.cs b/NPCs/DraedonLabThings/NanodroidDysfunctional.cs index e8c4c0fb5b..fba1017618 100644 --- a/NPCs/DraedonLabThings/NanodroidDysfunctional.cs +++ b/NPCs/DraedonLabThings/NanodroidDysfunctional.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Critters; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,6 +12,7 @@ namespace CalamityMod.NPCs.DraedonLabThings { public class NanodroidDysfunctional : ModNPC { + public static Asset GlowTexture; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.Nanodroid.DisplayName"); public override void SetStaticDefaults() { @@ -18,6 +20,10 @@ namespace CalamityMod.NPCs.DraedonLabThings Main.npcFrameCount[NPC.type] = 8; NPCID.Sets.CountsAsCritter[NPC.type] = true; Main.npcCatchable[NPC.type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -74,7 +80,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/NanodroidDysfunctional_Glow").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; spriteBatch.Draw(critterTexture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); diff --git a/NPCs/DraedonLabThings/NanodroidPlagueGreen.cs b/NPCs/DraedonLabThings/NanodroidPlagueGreen.cs index 9dc7c90f79..9b7f651e01 100644 --- a/NPCs/DraedonLabThings/NanodroidPlagueGreen.cs +++ b/NPCs/DraedonLabThings/NanodroidPlagueGreen.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Critters; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,6 +12,7 @@ namespace CalamityMod.NPCs.DraedonLabThings { public class NanodroidPlagueGreen : ModNPC { + public static Asset GlowTexture; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.Nanodroid.DisplayName"); public override void SetStaticDefaults() { @@ -18,6 +20,10 @@ namespace CalamityMod.NPCs.DraedonLabThings Main.npcFrameCount[NPC.type] = 8; NPCID.Sets.CountsAsCritter[NPC.type] = true; Main.npcCatchable[NPC.type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -74,7 +80,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/NanodroidPlagueGreen_Glow").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; spriteBatch.Draw(critterTexture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); diff --git a/NPCs/DraedonLabThings/NanodroidPlagueRed.cs b/NPCs/DraedonLabThings/NanodroidPlagueRed.cs index 46175edd3a..7473e4dd55 100644 --- a/NPCs/DraedonLabThings/NanodroidPlagueRed.cs +++ b/NPCs/DraedonLabThings/NanodroidPlagueRed.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Critters; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,6 +12,7 @@ namespace CalamityMod.NPCs.DraedonLabThings { public class NanodroidPlagueRed : ModNPC { + public static Asset GlowTexture; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.Nanodroid.DisplayName"); public override void SetStaticDefaults() { @@ -18,6 +20,10 @@ namespace CalamityMod.NPCs.DraedonLabThings Main.npcFrameCount[NPC.type] = 8; NPCID.Sets.CountsAsCritter[NPC.type] = true; Main.npcCatchable[NPC.type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -74,7 +80,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/NanodroidPlagueRed_Glow").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; spriteBatch.Draw(critterTexture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); diff --git a/NPCs/DraedonLabThings/RepairUnitCritter.cs b/NPCs/DraedonLabThings/RepairUnitCritter.cs index a67d34da5c..b6a844db97 100644 --- a/NPCs/DraedonLabThings/RepairUnitCritter.cs +++ b/NPCs/DraedonLabThings/RepairUnitCritter.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -50,6 +51,8 @@ namespace CalamityMod.NPCs.DraedonLabThings public const float Gravity = 0.4f; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 17; @@ -61,6 +64,10 @@ namespace CalamityMod.NPCs.DraedonLabThings value.Position.Y += 12; value.PortraitPositionYOverride = 32f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glowmask", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -367,7 +374,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/RepairUnitCritterGlowmask").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; spriteBatch.Draw(critterTexture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 3eaa0195f8..2378e6b1f4 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -13,6 +13,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -29,6 +30,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public static int phase1IconIndex; public static int phase2IconIndex; + public static Asset GlowTexture; + internal static void LoadHeadIcons() { string phase1IconPath = "CalamityMod/NPCs/ExoMechs/Apollo/ApolloHead"; @@ -135,6 +138,10 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo Rotation = -MathHelper.PiOver4 }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -1596,7 +1603,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } } - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Apollo/ApolloGlow").Value; + texture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) { for (int i = 1; i < numAfterimages; i += 2) diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index b9dc07c33f..6f12078636 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -28,6 +28,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -155,6 +156,30 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public static readonly SoundStyle LaserLoopSound = new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/AresCircleLaserLoop") with { IsLooped = true }; public static readonly SoundStyle LaserEndSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresCircleLaserEnd"); + + #region Textures + public static Asset GlowTexture; + public static Asset NeuronTexture; + public static Asset NeuronTexture_Glow; + + public static Asset ArmTopTexture; + public static Asset ArmTopTexture2; + public static Asset ArmSegmentTexture; + public static Asset ArmTopShoulderTexture; + public static Asset ArmBottomConnectorTexture; + public static Asset ArmBottomTexture; + public static Asset ArmBottomTexture2; + public static Asset ArmBottomShoulderTexture; + + public static Asset ArmTopTexture2_Glow; + public static Asset ArmSegmentTexture_Glow; + public static Asset ArmTopShoulderTexture_Glow; + public static Asset ArmBottomTexture_Glow; + public static Asset ArmBottomTexture2_Glow; + public static Asset ArmBottomShoulderTexture_Glow; + #endregion + + public override void SetStaticDefaults() { NPCID.Sets.TrailingMode[NPC.type] = 3; @@ -166,6 +191,29 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Scale = 0.4f }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + string AresPath = "CalamityMod/NPCs/ExoMechs/Ares/Ares"; + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + NeuronTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/AergiaNeuron", AssetRequestMode.AsyncLoad); + NeuronTexture_Glow = ModContent.Request("CalamityMod/NPCs/ExoMechs/AergiaNeuron_Glow", AssetRequestMode.AsyncLoad); + + ArmTopTexture = ModContent.Request(AresPath + "ArmTopPart1", AssetRequestMode.AsyncLoad); + ArmTopTexture2 = ModContent.Request(AresPath + "ArmTopPart2", AssetRequestMode.AsyncLoad); + ArmSegmentTexture = ModContent.Request(AresPath + "ArmTopSegment", AssetRequestMode.AsyncLoad); + ArmTopShoulderTexture = ModContent.Request(AresPath + "ArmTopShoulder", AssetRequestMode.AsyncLoad); + ArmBottomConnectorTexture = ModContent.Request(AresPath + "BottomArmConnector", AssetRequestMode.AsyncLoad); + ArmBottomTexture = ModContent.Request(AresPath + "BottomArmPart1", AssetRequestMode.AsyncLoad); + ArmBottomTexture2 = ModContent.Request(AresPath + "BottomArmPart2", AssetRequestMode.AsyncLoad); + ArmBottomShoulderTexture = ModContent.Request(AresPath + "BottomArmShoulder", AssetRequestMode.AsyncLoad); + + ArmTopTexture2_Glow = ModContent.Request(AresPath + "ArmTopPart2Glow", AssetRequestMode.AsyncLoad); + ArmSegmentTexture_Glow = ModContent.Request(AresPath + "ArmTopSegmentGlow", AssetRequestMode.AsyncLoad); + ArmTopShoulderTexture_Glow = ModContent.Request(AresPath + "ArmTopShoulderGlow", AssetRequestMode.AsyncLoad); + ArmBottomTexture_Glow = ModContent.Request(AresPath + "BottomArmPart1Glow", AssetRequestMode.AsyncLoad); + ArmBottomTexture2_Glow = ModContent.Request(AresPath + "BottomArmPart2Glow", AssetRequestMode.AsyncLoad); + ArmBottomShoulderTexture_Glow = ModContent.Request(AresPath + "BottomArmShoulderGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -1211,7 +1259,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 center = NPC.Center - screenPos; spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, SpriteEffects.None, 0f); - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBodyGlow").Value; + texture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages) { @@ -1283,14 +1331,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Draw back arms. if (backArm) { - Texture2D shoulderTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopShoulder").Value; - Texture2D armTexture1 = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopPart1").Value; - Texture2D armSegmentTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopSegment").Value; - Texture2D armTexture2 = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopPart2").Value; + Texture2D shoulderTexture = ArmTopShoulderTexture.Value; + Texture2D armTexture1 = ArmTopTexture.Value; + Texture2D armSegmentTexture = ArmSegmentTexture.Value; + Texture2D armTexture2 = ArmTopTexture2.Value; - Texture2D shoulderGlowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopShoulderGlow").Value; - Texture2D armSegmentGlowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopSegmentGlow").Value; - Texture2D armGlowmask2 = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopPart2Glow").Value; + Texture2D shoulderGlowmask = ArmTopShoulderTexture_Glow.Value; + Texture2D armSegmentGlowmask = ArmSegmentTexture_Glow.Value; + Texture2D armGlowmask2 = ArmTopTexture2_Glow.Value; Vector2 shoulderDrawPosition = NPC.Center + NPC.scale * new Vector2(direction * 176f, -100f); Vector2 arm1DrawPosition = shoulderDrawPosition + NPC.scale * new Vector2(direction * (shoulderTexture.Width + 16f), 10f); @@ -1352,14 +1400,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } else { - Texture2D shoulderTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmShoulder").Value; - Texture2D connectorTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmConnector").Value; - Texture2D armTexture1 = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmPart1").Value; - Texture2D armTexture2 = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmPart2").Value; + Texture2D shoulderTexture = ArmBottomShoulderTexture.Value; + Texture2D connectorTexture = ArmBottomConnectorTexture.Value; + Texture2D armTexture1 = ArmBottomTexture.Value; + Texture2D armTexture2 = ArmBottomTexture2.Value; - Texture2D shoulderGlowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmShoulderGlow").Value; - Texture2D armTexture1Glowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmPart1Glow").Value; - Texture2D armTexture2Glowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmPart2Glow").Value; + Texture2D shoulderGlowmask = ArmBottomShoulderTexture_Glow.Value; + Texture2D armTexture1Glowmask = ArmBottomTexture_Glow.Value; + Texture2D armTexture2Glowmask = ArmBottomTexture2_Glow.Value; Vector2 shoulderDrawPosition = NPC.Center + NPC.scale * new Vector2(direction * 110f, -54f); Vector2 connectorDrawPosition = shoulderDrawPosition + NPC.scale * new Vector2(direction * 20f, 32f); diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 58c27cd60f..b5f33cc337 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -8,6 +8,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -70,11 +71,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public static readonly SoundStyle NukeExplosionSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresGaussNukeExplosion") { Volume = 1.45f }; + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 3; NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -92,7 +99,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIType = -1; NPC.Opacity = 0f; NPC.knockBackResist = 0f; - NPC.canGhostHeal = false; NPC.noGravity = true; NPC.noTileCollide = true; NPC.DeathSound = CommonCalamitySounds.ExoDeathSound; @@ -588,7 +594,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresGaussNukeGlow").Value; + Texture2D glowTexture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages) { diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 31c2cf3702..2b6eaf0394 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -9,6 +9,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -73,11 +74,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public static readonly SoundStyle LaserbeamShootSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresLaserArmShoot") { Volume = 1.1f }; + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 3; NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -95,7 +102,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIType = -1; NPC.Opacity = 0f; NPC.knockBackResist = 0f; - NPC.canGhostHeal = false; NPC.noGravity = true; NPC.noTileCollide = true; NPC.DeathSound = CommonCalamitySounds.ExoDeathSound; @@ -634,7 +640,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresLaserCannonGlow").Value; + Texture2D glowTexture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages) { diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index e4b9a41c25..20d3d990cc 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -9,6 +9,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -67,11 +68,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Telegraph sound. public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresPlasmaArmCharge"); + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 3; NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -89,7 +96,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIType = -1; NPC.Opacity = 0f; NPC.knockBackResist = 0f; - NPC.canGhostHeal = false; NPC.noGravity = true; NPC.noTileCollide = true; NPC.DeathSound = CommonCalamitySounds.ExoDeathSound; @@ -586,7 +592,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresPlasmaFlamethrowerGlow").Value; + Texture2D glowTexture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages) { diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index 12dc2ff4d1..aaa5c83b40 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -8,6 +8,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -68,11 +69,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public static readonly SoundStyle TeslaOrbShootSound = new("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot", 2) { Volume = 1.1f }; + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 3; NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -90,7 +97,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIType = -1; NPC.Opacity = 0f; NPC.knockBackResist = 0f; - NPC.canGhostHeal = false; NPC.noGravity = true; NPC.noTileCollide = true; NPC.DeathSound = CommonCalamitySounds.ExoDeathSound; @@ -580,7 +586,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresTeslaCannonGlow").Value; + Texture2D glowTexture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages) { diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index d42f25aa28..53edf7dd66 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -13,6 +13,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -41,6 +42,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public static readonly SoundStyle SpinLaserbeamSound = new("CalamityMod/Sounds/Custom/ExoMechs/ArtemisSpinLaserbeam") { Volume = 1.3f }; + public static Asset GlowTexture; + internal static void LoadHeadIcons() { string phase1IconPath = "CalamityMod/NPCs/ExoMechs/Artemis/ArtemisHead"; @@ -168,6 +171,10 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis Rotation = MathHelper.Pi - MathHelper.PiOver4 }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -1491,7 +1498,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } } - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Artemis/ArtemisGlow").Value; + texture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) { for (int i = 1; i < numAfterimages; i += 2) diff --git a/NPCs/ExoMechs/Draedon.cs b/NPCs/ExoMechs/Draedon.cs index 64fe6c80ea..623673c9f1 100644 --- a/NPCs/ExoMechs/Draedon.cs +++ b/NPCs/ExoMechs/Draedon.cs @@ -1,12 +1,14 @@ using System; using System.IO; using CalamityMod.Events; +using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -80,6 +82,11 @@ namespace CalamityMod.NPCs.ExoMechs public static readonly SoundStyle TeleportSound = new("CalamityMod/Sounds/Custom/DraedonTeleport"); public static readonly SoundStyle SelectionSound = new("CalamityMod/Sounds/Custom/Codebreaker/ExoMechsIconSelect"); + public static Asset Texture_Glow; + public static Asset HoloTexture; + public static Asset ProjectorTexture; + public static Asset ProjectorTexture_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 12; @@ -94,6 +101,13 @@ namespace CalamityMod.NPCs.ExoMechs NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.ShouldBeCountedAsBoss[NPC.type] = true; NPCID.Sets.MustAlwaysDraw[NPC.type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glowmask", AssetRequestMode.AsyncLoad); + HoloTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/HologramDraedon", AssetRequestMode.AsyncLoad); + ProjectorTexture = ModContent.Request(Texture + "Projector", AssetRequestMode.AsyncLoad); + ProjectorTexture_Glow = ModContent.Request(Texture + "ProjectorGlowmask", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -834,11 +848,11 @@ namespace CalamityMod.NPCs.ExoMechs spriteBatch.EnterShaderRegion(); bool holo = HasBeenKilled && KillReappearDelay <= 0; bool leaving = HasBeenKilled && DefeatTimer > DelayBeforeDefeatStandup + TalkDelay * 8f + 200f; - Texture2D texture = HasBeenKilled && KillReappearDelay <= 0f ? ModContent.Request("CalamityMod/NPCs/ExoMechs/HologramDraedon").Value : TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/DraedonGlowmask").Value; - Texture2D projector = ModContent.Request("CalamityMod/NPCs/ExoMechs/DraedonProjector").Value; - Texture2D projectorglow = ModContent.Request("CalamityMod/NPCs/ExoMechs/DraedonProjectorGlowmask").Value; - Texture2D gun = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseRifle").Value; + Texture2D texture = HasBeenKilled && KillReappearDelay <= 0f ? HoloTexture.Value : TextureAssets.Npc[NPC.type].Value; + Texture2D glowmask = Texture_Glow.Value; + Texture2D projector = ProjectorTexture.Value; + Texture2D projectorglow = ProjectorTexture_Glow.Value; + Texture2D gun = TextureAssets.Item[ModContent.ItemType()].Value; Rectangle frame = NPC.frame; Vector2 drawPosition = NPC.Center - screenPos - Vector2.UnitY * 38f; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index 8a0dba7614..f436b20005 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -7,6 +7,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -50,10 +51,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.ThanatosHead.DisplayName"); + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 5; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -73,7 +80,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos AIType = -1; NPC.knockBackResist = 0f; NPC.Opacity = 0f; - NPC.canGhostHeal = false; NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -626,7 +632,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosBody1Glow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); SmokeDrawer.DrawSet(NPC.Center); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index ddb8ed59b3..342fbbd659 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -7,6 +7,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -47,11 +48,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos private const float timeToOpenAndFireLasers = 36f; private const float segmentCloseTimerDecrement = 0.2f; + + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.ThanatosHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 5; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -71,7 +79,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos AIType = -1; NPC.knockBackResist = 0f; NPC.Opacity = 0f; - NPC.canGhostHeal = false; NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -628,7 +635,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosBody2Glow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); SmokeDrawer.DrawSet(NPC.Center); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index f463cb4c10..f11e347359 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -11,6 +11,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -36,6 +37,15 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public SlotId LaserSoundSlot; + public static Asset GlowTexture; + public static Asset AuraTexture; + public static Asset ReticleLeftTexture; + public static Asset ReticleRightTexture; + public static Asset ReticleProngLeftTexture; + public static Asset ReticleProngRightTexture; + public static Asset ReticleTopTexture; + public static Asset ReticleBottomTexture; + internal static void LoadHeadIcons() { string normalIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosNormalHead"; @@ -139,6 +149,17 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos value.Position.X += 52f; value.Position.Y += 16f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + ReticleLeftTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleLeft", AssetRequestMode.AsyncLoad); + ReticleRightTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleRight", AssetRequestMode.AsyncLoad); + ReticleTopTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleTop", AssetRequestMode.AsyncLoad); + ReticleBottomTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleHead", AssetRequestMode.AsyncLoad); + ReticleProngRightTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleProngLeft", AssetRequestMode.AsyncLoad); + ReticleProngLeftTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleProngRight", AssetRequestMode.AsyncLoad); + AuraTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/THanosAura", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -1016,12 +1037,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos float minimalDamageVelocity = baseVelocity * 0.5f; if (NPC.velocity.Length() <= minimalContactDamageVelocity) { - NPC.damage = (int)(NPC.defDamage * 0.5f); + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); } else { float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); } } @@ -1103,7 +1124,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosHeadGlow").Value; + texture = GlowTexture.Value; Color glowmaskColor = vulnerable ? ((AIState == (int)Phase.Deathray && SecondaryAIState != (int)SecondaryPhase.PassiveAndImmune) ? Color.Lerp(new Color(255, 64, 64), Color.CornflowerBlue, NPC.Calamity().newAI[2] / deathrayTelegraphDuration) : new Color(255, 64, 64)) : Color.White; spriteBatch.Draw(texture, center, NPC.frame, glowmaskColor * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); @@ -1117,7 +1138,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos spriteBatch.SetBlendState(BlendState.Additive); // A large, faded circle. Is rescaled to fit the radius of the slowdown area. - Texture2D auraTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/THanosAura").Value; + Texture2D auraTexture = AuraTexture.Value; float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -1152,12 +1173,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Player target = Main.player[NPC.target]; - Texture2D leftReticleTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleLeft").Value; - Texture2D rightReticleTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleRight").Value; - Texture2D topReticleTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleTop").Value; - Texture2D bottomReticleTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleHead").Value; - Texture2D leftReticleProngTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleProngLeft").Value; - Texture2D rightReticleProngTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleProngRight").Value; + Texture2D leftReticleTexture = ReticleLeftTexture.Value; + Texture2D rightReticleTexture = ReticleRightTexture.Value; + Texture2D topReticleTexture = ReticleTopTexture.Value; + Texture2D bottomReticleTexture = ReticleBottomTexture.Value; + Texture2D leftReticleProngTexture = ReticleProngLeftTexture.Value; + Texture2D rightReticleProngTexture = ReticleProngRightTexture.Value; // The reticle fades away and moves farther away from the target the closer they are to the aura. // Once far away, the reticle will flash between red and white as an indicator. diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index 31254ed0ff..b541aedd9e 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -7,6 +7,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -47,11 +48,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos private const float timeToOpenAndFireLasers = 36f; private const float segmentCloseTimerDecrement = 0.2f; + + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.ThanatosHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 5; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -71,7 +79,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos AIType = -1; NPC.knockBackResist = 0f; NPC.Opacity = 0f; - NPC.canGhostHeal = false; NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -626,7 +633,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosTailGlow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); SmokeDrawer.DrawSet(NPC.Center); diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index 255dc46973..2770be3157 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -125,7 +125,7 @@ namespace CalamityMod.NPCs.GreatSandShark if (NPC.soundDelay <= 0) { NPC.soundDelay = 480; - SoundEngine.PlaySound(RoarSound, NPC.position); + SoundEngine.PlaySound(RoarSound, NPC.Center); } if (NPC.localAI[3] >= 1f || Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 1000f) @@ -335,7 +335,7 @@ namespace CalamityMod.NPCs.GreatSandShark { int npcType = Main.zenithWorld ? ModContent.NPCType() : NPCID.SandShark; NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 50, npcType, 0, 0f, 0f, 0f, 0f, 255); - SoundEngine.PlaySound(RoarSound, NPC.position); + SoundEngine.PlaySound(RoarSound, NPC.Center); } } @@ -424,7 +424,7 @@ namespace CalamityMod.NPCs.GreatSandShark { if (NPC.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.NPCDeath15, NPC.position); + SoundEngine.PlaySound(SoundID.NPCDeath15, NPC.Center); NPC.localAI[0] = -1f; for (int i = 0; i < 25; i++) { diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index 5b8c406d53..a9328ad75e 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -42,7 +42,6 @@ namespace CalamityMod.NPCs.HiveMind NPC.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.3f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index 5d6689b967..0449ae3853 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -39,7 +39,6 @@ namespace CalamityMod.NPCs.HiveMind AIType = -1; NPC.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.4f; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.chaseable = false; NPC.HitSound = SoundID.NPCHit13; NPC.DeathSound = SoundID.NPCDeath21; diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index 42c68b794a..cd07a4b5fe 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -40,7 +40,6 @@ namespace CalamityMod.NPCs.HiveMind AIType = -1; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.chaseable = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs index ac4aec61da..e52ba4db4e 100644 --- a/NPCs/HiveMind/HiveBlob2.cs +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -42,7 +42,6 @@ namespace CalamityMod.NPCs.HiveMind AIType = -1; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.chaseable = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 86b9611b71..cad9c74a2c 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -19,6 +19,7 @@ using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; @@ -87,6 +88,8 @@ namespace CalamityMod.NPCs.HiveMind public static readonly SoundStyle RoarSound = new("CalamityMod/Sounds/Custom/HiveMindRoar"); public static readonly SoundStyle FastRoarSound = new("CalamityMod/Sounds/Custom/HiveMindRoarFast"); + public static Asset Phase2Texture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 16; @@ -101,6 +104,10 @@ namespace CalamityMod.NPCs.HiveMind value.Position.Y += 3f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request(Texture + "P2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -287,7 +294,7 @@ namespace CalamityMod.NPCs.HiveMind if (phase2) { SpriteEffects spriteEffects = NPC.direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = ModContent.Request("CalamityMod/NPCs/HiveMind/HiveMindP2").Value; + Texture2D texture = Phase2Texture.Value; Rectangle frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); Vector2 vector = new Vector2(NPC.width / 2, NPC.height / 2); Color afterimageBaseColor = Color.White; @@ -1161,7 +1168,7 @@ namespace CalamityMod.NPCs.HiveMind { string key = "Mods.CalamityMod.Status.Progression.SkyOreText"; Color messageColor = Color.Cyan; - AerialiteOreGen.Generate(true); + AerialiteOreGen.Enchant(); CalamityUtils.DisplayLocalizedText(key, messageColor); } diff --git a/NPCs/Leviathan/Anahita.cs b/NPCs/Leviathan/Anahita.cs index 8693260cbf..d259c74409 100644 --- a/NPCs/Leviathan/Anahita.cs +++ b/NPCs/Leviathan/Anahita.cs @@ -7,6 +7,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -24,6 +25,7 @@ namespace CalamityMod.NPCs.Leviathan private bool forceChargeFrames = false; private int frameUsed = 0; public bool HasBegunSummoningLeviathan = false; + public static Asset ChargeTexture; public bool WaitingForLeviathan { get @@ -46,6 +48,10 @@ namespace CalamityMod.NPCs.Leviathan Scale = 0.5f }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + ChargeTexture = ModContent.Request("CalamityMod/NPCs/Leviathan/AnahitaStabbing", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -213,6 +219,7 @@ namespace CalamityMod.NPCs.Leviathan float moveDirection = 1f; if (Math.Abs(NPC.Center.X - Main.maxTilesX * 16f) > Math.Abs(NPC.Center.X)) moveDirection = -1f; + NPC.velocity.X = moveDirection * 6f; NPC.spriteDirection = (int)-moveDirection; NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y + 0.2f, -3f, 16f); @@ -239,6 +246,13 @@ namespace CalamityMod.NPCs.Leviathan NPC.velocity *= 0.9f; } + else + { + NPC.alpha -= 5; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + NPC.dontTakeDamage = true; return; } @@ -302,8 +316,10 @@ namespace CalamityMod.NPCs.Leviathan ChargeRotation(player, vector); ChargeLocation(player, vector, false, true); - NPC.alpha += 3; - if (NPC.alpha >= 255) + if (NPC.alpha < 255) + NPC.alpha += 3; + + if (NPC.alpha > 255) { NPC.alpha = 255; } @@ -331,9 +347,8 @@ namespace CalamityMod.NPCs.Leviathan return; } - // Alpha NPC.alpha -= 5; - if (NPC.alpha <= 0) + if (NPC.alpha < 0) NPC.alpha = 0; // Play sound @@ -885,7 +900,7 @@ namespace CalamityMod.NPCs.Leviathan texture = TextureAssets.Npc[NPC.type].Value; break; case 1: - texture = ModContent.Request("CalamityMod/NPCs/Leviathan/AnahitaStabbing").Value; + texture = ChargeTexture.Value; break; } diff --git a/NPCs/Leviathan/AnahitasIceShield.cs b/NPCs/Leviathan/AnahitasIceShield.cs index db7c5035f7..9baba8e7fa 100644 --- a/NPCs/Leviathan/AnahitasIceShield.cs +++ b/NPCs/Leviathan/AnahitasIceShield.cs @@ -31,7 +31,6 @@ namespace CalamityMod.NPCs.Leviathan { NPC.aiStyle = -1; AIType = -1; - NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.coldDamage = true; NPC.GetNPCDamage(); diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index 2356cccfd4..55d330b8b9 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -48,7 +48,6 @@ namespace CalamityMod.NPCs.Leviathan NPC.knockBackResist = 0.2f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; AIType = -1; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index d9381fbb22..b509ef5470 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -16,6 +16,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Boss; +using CalamityMod.Sounds; using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -40,7 +41,7 @@ namespace CalamityMod.NPCs.Leviathan private bool gfbAnaSummoned = false; private int soundDelay = 0; private float extrapitch = 0; - public static Texture2D AttackTexture = null; + public static Asset AttackTexture = null; public static readonly SoundStyle RoarMeteorSound = new("CalamityMod/Sounds/Custom/LeviathanRoarMeteor"); public static readonly SoundStyle RoarChargeSound = new("CalamityMod/Sounds/Custom/LeviathanRoarCharge"); @@ -51,7 +52,7 @@ namespace CalamityMod.NPCs.Leviathan Main.npcFrameCount[NPC.type] = 3; NPCID.Sets.BossBestiaryPriority.Add(Type); if (!Main.dedServ) - AttackTexture = ModContent.Request("CalamityMod/NPCs/Leviathan/LeviathanAttack", AssetRequestMode.ImmediateLoad).Value; + AttackTexture = ModContent.Request("CalamityMod/NPCs/Leviathan/LeviathanAttack", AssetRequestMode.AsyncLoad); } public override void SetDefaults() @@ -818,6 +819,18 @@ namespace CalamityMod.NPCs.Leviathan { CalamityGlobalNPC.SetNewBossJustDowned(npc); + // Abyss awakens after killing Anahita & Leviathan + string key = "Mods.CalamityMod.Status.Progression.AbyssDropsText"; + Color messageColor = Color.RoyalBlue; + + if (!DownedBossSystem.downedLeviathan) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + SoundEngine.PlaySound(CommonCalamitySounds.WyrmScreamSound, Main.player[Main.myPlayer].Center); + + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + // Mark Anahita & Leviathan as dead DownedBossSystem.downedLeviathan = true; CalamityNetcode.SyncWorld(); @@ -906,7 +919,7 @@ namespace CalamityMod.NPCs.Leviathan public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = AttackTexture; + Texture2D texture = AttackTexture.Value; if (NPC.ai[0] == 1f || NPC.Calamity().newAI[3] < 180f) { texture = TextureAssets.Npc[NPC.type].Value; diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index 07f3b0cec0..f53a972388 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -3,6 +3,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -13,6 +14,9 @@ namespace CalamityMod.NPCs.Leviathan { public class LeviathanStart : ModNPC { + + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -25,6 +29,10 @@ namespace CalamityMod.NPCs.Leviathan PortraitScale = 0.75f }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -116,7 +124,7 @@ namespace CalamityMod.NPCs.Leviathan if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D drawTex = Main.zenithWorld ? ModContent.Request("CalamityMod/NPCs/Leviathan/Leviathan").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D drawTex = Main.zenithWorld ? TextureAssets.Npc[ModContent.NPCType()].Value : TextureAssets.Npc[NPC.type].Value; Rectangle frame = Main.zenithWorld ? drawTex.Frame(2, 3, 0, 0) : NPC.frame; Vector2 origin = new Vector2(drawTex.Width / 2, drawTex.Height / 2); @@ -136,7 +144,7 @@ namespace CalamityMod.NPCs.Leviathan if (!Main.zenithWorld) { - drawTex = ModContent.Request("CalamityMod/NPCs/Leviathan/LeviathanStartGlow").Value; + drawTex = GlowTexture.Value; spriteBatch.Draw(drawTex, drawPos, frame, Color.White, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 77880d7ff0..f15eb25ae2 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -400,12 +400,12 @@ namespace CalamityMod.NPCs.NormalNPCs float minimalDamageVelocity = maxChaseSpeed * 0.5f; if (NPC.velocity.Length() <= minimalContactDamageVelocity) { - NPC.damage = (int)(NPC.defDamage * 0.5f); + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); } else { float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); } NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index 77e4b8062e..8141be8c8b 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -367,9 +367,9 @@ namespace CalamityMod.NPCs.NormalNPCs notDuringCultistFight.Add(ModContent.ItemType(), 4); aewMinionCondition.Add(notDuringCultistFight); - LeadingConditionRule postClone = new LeadingConditionRule(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 8, 10, 10, 14)); - aewMinionCondition.Add(postClone); + LeadingConditionRule postLevi = new LeadingConditionRule(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 8, 10, 10, 14)); + aewMinionCondition.Add(postLevi); LeadingConditionRule postPlant = new LeadingConditionRule(DropHelper.PostPlant()); postPlant.Add(ItemID.Ectoplasm, 1, 3, 5); diff --git a/NPCs/NormalNPCs/KingSlimeJewel.cs b/NPCs/NormalNPCs/KingSlimeJewel.cs index f0fbe1a540..b4f6b4739a 100644 --- a/NPCs/NormalNPCs/KingSlimeJewel.cs +++ b/NPCs/NormalNPCs/KingSlimeJewel.cs @@ -40,7 +40,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.knockBackResist = 0.8f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit5; NPC.DeathSound = SoundID.NPCDeath15; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index b8f2054310..0c9fe9bb28 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -394,13 +394,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, hit.HitDirection, -1f, 0, default, 1f); } } } @@ -409,7 +409,7 @@ namespace CalamityMod.NPCs.NormalNPCs { npcLoot.Add(ModContent.ItemType()); LeadingConditionRule postML = npcLoot.DefineConditionalDropSet(DropHelper.PostML()); - postML.Add(ModContent.ItemType()); + postML.Add(ModContent.ItemType()); } } } diff --git a/NPCs/NormalNPCs/PhantomSpirit.cs b/NPCs/NormalNPCs/PhantomSpirit.cs index ba3117f6a7..9f81e50f1d 100644 --- a/NPCs/NormalNPCs/PhantomSpirit.cs +++ b/NPCs/NormalNPCs/PhantomSpirit.cs @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.NormalNPCs { float speed = CalamityWorld.death ? 22f : CalamityWorld.revenge ? 19.5f : 17f; CalamityRegularEnemyAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); - int polterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 0, default, 1f); + int polterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[polterDust]; dust.velocity *= 0.1f; dust.scale = 1.3f; @@ -66,13 +66,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int i = 0; i < 50; i++) { - int hitPolterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); + int hitPolterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); Dust dust = Main.dust[hitPolterDust]; dust.velocity *= 2f; dust.noGravity = true; @@ -83,6 +83,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override Color? GetAlpha(Color drawColor) => new Color(200, 200, 200, 0); - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType()); + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType()); } } diff --git a/NPCs/NormalNPCs/PhantomSpiritL.cs b/NPCs/NormalNPCs/PhantomSpiritL.cs index cc889275e8..b6edcf000f 100644 --- a/NPCs/NormalNPCs/PhantomSpiritL.cs +++ b/NPCs/NormalNPCs/PhantomSpiritL.cs @@ -69,7 +69,7 @@ namespace CalamityMod.NPCs.NormalNPCs { float speed = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 16f : CalamityWorld.revenge ? 14f : 12f; CalamityRegularEnemyAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); - int polterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 0, default, 1f); + int polterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[polterDust]; dust.velocity *= 0.1f; dust.scale = 1.3f; @@ -100,13 +100,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int i = 0; i < 50; i++) { - int hitPolterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); + int hitPolterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); Dust dust = Main.dust[hitPolterDust]; dust.velocity *= 2f; dust.noGravity = true; @@ -117,6 +117,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override Color? GetAlpha(Color drawColor) => new Color(200, 200, 200, 0); - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 2, 4); + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 2, 4); } } diff --git a/NPCs/NormalNPCs/PhantomSpiritM.cs b/NPCs/NormalNPCs/PhantomSpiritM.cs index 4b9a8e4dec..a018061991 100644 --- a/NPCs/NormalNPCs/PhantomSpiritM.cs +++ b/NPCs/NormalNPCs/PhantomSpiritM.cs @@ -65,7 +65,7 @@ namespace CalamityMod.NPCs.NormalNPCs { float speed = CalamityWorld.death ? 18f : CalamityWorld.revenge ? 15.75f : 13.5f; CalamityRegularEnemyAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); - int polterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 0, default, 1f); + int polterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[polterDust]; dust.velocity *= 0.1f; dust.scale = 1.3f; @@ -77,13 +77,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int i = 0; i < 50; i++) { - int hitPolterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); + int hitPolterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); Dust dust = Main.dust[hitPolterDust]; dust.velocity *= 2f; dust.noGravity = true; @@ -94,6 +94,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override Color? GetAlpha(Color drawColor) => new Color(200, 200, 200, 0); - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 1, 3); + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 1, 3); } } diff --git a/NPCs/NormalNPCs/PhantomSpiritS.cs b/NPCs/NormalNPCs/PhantomSpiritS.cs index 6edfd13ae9..7d375805c5 100644 --- a/NPCs/NormalNPCs/PhantomSpiritS.cs +++ b/NPCs/NormalNPCs/PhantomSpiritS.cs @@ -64,7 +64,7 @@ namespace CalamityMod.NPCs.NormalNPCs { float speed = CalamityWorld.death ? 20f : CalamityWorld.revenge ? 17.5f : 15f; CalamityRegularEnemyAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); - int polterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 0, default, 1f); + int polterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[polterDust]; dust.velocity *= 0.1f; dust.scale = 1.3f; @@ -75,13 +75,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int i = 0; i < 50; i++) { - int hitPolterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); + int hitPolterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); Dust dust = Main.dust[hitPolterDust]; dust.velocity *= 2f; dust.noGravity = true; @@ -92,6 +92,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override Color? GetAlpha(Color drawColor) => new Color(200, 200, 200, 0); - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 1, 2); + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 1, 2); } } diff --git a/NPCs/NormalNPCs/PlanterasFreeTentacle.cs b/NPCs/NormalNPCs/PlanterasFreeTentacle.cs index 51f8a33426..15da0e704d 100644 --- a/NPCs/NormalNPCs/PlanterasFreeTentacle.cs +++ b/NPCs/NormalNPCs/PlanterasFreeTentacle.cs @@ -213,7 +213,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(BuffID.Poisoned, 300); + target.AddBuff(BuffID.Poisoned, 120); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs index 47a9e497cc..96f0ffcbf5 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs @@ -3,6 +3,7 @@ using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -12,11 +13,18 @@ namespace CalamityMod.NPCs.NormalNPCs { public class ProfanedEnergyLantern : ModNPC { + public static Asset ChainTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.ProfanedEnergyBody.DisplayName"); + public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + ChainTexture = ModContent.Request("CalamityMod/NPCs/NormalNPCs/ProfanedEnergySegment", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -218,7 +226,7 @@ namespace CalamityMod.NPCs.NormalNPCs drawPositionY = Main.npc[CalamityGlobalNPC.energyFlame].Center.Y - center.Y; drawPositionY -= 10f; Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - Texture2D chain = ModContent.Request("CalamityMod/NPCs/NormalNPCs/ProfanedEnergySegment").Value; + Texture2D chain = ChainTexture.Value; Main.spriteBatch.Draw(chain, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, chain.Width, chain.Height)), color, rotation, new Vector2((float)chain.Width * 0.5f, (float)chain.Height * 0.5f), 1f, SpriteEffects.None, 0f); diff --git a/NPCs/NormalNPCs/SkeletronPrime2.cs b/NPCs/NormalNPCs/SkeletronPrime2.cs index 27eaf4bb5b..fdf627d52f 100644 --- a/NPCs/NormalNPCs/SkeletronPrime2.cs +++ b/NPCs/NormalNPCs/SkeletronPrime2.cs @@ -6,6 +6,8 @@ using CalamityMod.DataStructures; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; @@ -19,11 +21,17 @@ namespace CalamityMod.NPCs.NormalNPCs public override string Texture => $"Terraria/Images/NPC_{NPCID.SkeletronPrime}"; public override string BossHeadTexture => $"Terraria/Images/NPC_Head_Boss_18"; + public static Asset EyeTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); + if (!Main.dedServ) + { + EyeTexture = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/SkeletronPrimeHeadGlow"); + } } public override void SetDefaults() @@ -374,7 +382,7 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.localAI[0] = 0f; - int totalProjectiles = bossRush ? 20 : 10; + int totalProjectiles = bossRush ? 20 : death ? 15 : 10; float radians = MathHelper.TwoPi / totalProjectiles; int type = ProjectileID.FrostBeam; int damage = NPC.GetProjectileDamage(type); @@ -382,10 +390,12 @@ namespace CalamityMod.NPCs.NormalNPCs // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } float velocity = 4.5f; @@ -396,7 +406,7 @@ namespace CalamityMod.NPCs.NormalNPCs for (int k = 0; k < totalProjectiles; k++) { Vector2 laserFireDirection = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + laserFireDirection.SafeNormalize(Vector2.UnitY) * 30f, laserFireDirection, type, damage, 0f, Main.myPlayer, 1f, 0f); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + laserFireDirection.SafeNormalize(Vector2.UnitY) * 140f, laserFireDirection, type, damage, 0f, Main.myPlayer, 1f, 0f); Main.projectile[proj].timeLeft = 600; } NPC.localAI[1] += 1f; @@ -646,14 +656,15 @@ namespace CalamityMod.NPCs.NormalNPCs // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } - headCenter += value * 5f; - int enragedBombs = Projectile.NewProjectile(NPC.GetSource_FromAI(), headCenter.X, headCenter.Y, enragedHeadBombTargetX, enragedHeadBombTargetY, type, damage, 0f, Main.myPlayer, -1f); + int enragedBombs = Projectile.NewProjectile(NPC.GetSource_FromAI(), headCenter.X, headCenter.Y + 30f, enragedHeadBombTargetX, enragedHeadBombTargetY, type, damage, 0f, Main.myPlayer, -1f); Main.projectile[enragedBombs].timeLeft = 600; Main.projectile[enragedBombs].tileCollide = false; } @@ -687,8 +698,8 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.rotation = NPC.velocity.X / 15f; - float flightVelocity = bossRush ? 30f : death ? 25f : 20f; - float flightAcceleration = bossRush ? 0.3f : death ? 0.25f : 0.2f; + float flightVelocity = bossRush ? 32f : death ? 28f : 24f; + float flightAcceleration = bossRush ? 1.28f : death ? 1.12f : 0.96f; Vector2 destination = new Vector2(Main.player[NPC.target].Center.X, Main.player[NPC.target].Center.Y - 500f); NPC.SimpleFlyMovement((destination - NPC.Center).SafeNormalize(Vector2.UnitY) * flightVelocity, flightAcceleration); @@ -714,10 +725,12 @@ namespace CalamityMod.NPCs.NormalNPCs // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } float velocity = 12f; @@ -729,7 +742,7 @@ namespace CalamityMod.NPCs.NormalNPCs for (int k = 0; k < totalProjectiles; k++) { Vector2 bombVelocity = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + bombVelocity.SafeNormalize(Vector2.UnitY) * 30f, bombVelocity - upwardVelocity, type, damage, 0f, Main.myPlayer, -2f); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitY * 30f + bombVelocity.SafeNormalize(Vector2.UnitY) * 15f, bombVelocity - upwardVelocity, type, damage, 0f, Main.myPlayer, -2f); Main.projectile[proj].timeLeft = 900; Main.projectile[proj].tileCollide = false; } diff --git a/NPCs/NormalNPCs/Sunskater.cs b/NPCs/NormalNPCs/Sunskater.cs index a69bbd541c..d2a8b38629 100644 --- a/NPCs/NormalNPCs/Sunskater.cs +++ b/NPCs/NormalNPCs/Sunskater.cs @@ -228,7 +228,39 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 80, true); + { + if (Main.zenithWorld) + { + target.AddBuff(ModContent.BuffType(), 150); + + if (Main.rand.NextBool(3)) + target.AddBuff(BuffID.OnFire, 180); + if (Main.rand.NextBool(3)) + target.AddBuff(BuffID.OnFire3, 120); + if (Main.rand.NextBool(3)) + target.AddBuff(BuffID.CursedInferno, 120); + if (Main.rand.NextBool(3)) + target.AddBuff(BuffID.Frostburn, 180); + if (Main.rand.NextBool(3)) + target.AddBuff(BuffID.Frostburn2, 120); + if (Main.rand.NextBool(3)) + target.AddBuff(BuffID.Burning, 60); + if (Main.rand.NextBool(3)) + target.AddBuff(ModContent.BuffType(), 120); + if (Main.rand.NextBool(3)) + target.AddBuff(ModContent.BuffType(), 120); + if (Main.rand.NextBool(3)) + target.AddBuff(ModContent.BuffType(), 120); + if (Main.rand.NextBool(3)) + target.AddBuff(ModContent.BuffType(), 90); + if (Main.rand.NextBool(3)) + target.AddBuff(ModContent.BuffType(), 90); + if (Main.rand.NextBool(3)) + target.AddBuff(ModContent.BuffType(), 90); + } + else + target.AddBuff(BuffID.OnFire, 150, true); + } } public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.AddIf(() => Main.hardMode, ModContent.ItemType(), 2); diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index 2d7520f1fa..f0c7452571 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -8,8 +8,10 @@ using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -44,6 +46,9 @@ namespace CalamityMod.NPCs.NormalNPCs } public bool Phase2 => NPC.life < NPC.lifeMax * 0.5f; public ref float AttackTimer => ref NPC.ai[1]; + + public static Asset AttackTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; @@ -56,6 +61,10 @@ namespace CalamityMod.NPCs.NormalNPCs PortraitPositionYOverride = 2f }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + AttackTexture = ModContent.Request(Texture + "Attack", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -406,13 +415,13 @@ namespace CalamityMod.NPCs.NormalNPCs public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = ModContent.Request("CalamityMod/NPCs/NormalNPCs/ThiccWaifuAttack").Value; + Texture2D texture = AttackTexture.Value; SpriteEffects direction = NPC.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; if (CurrentAttackState != AttackState.Hover) Main.EntitySpriteDraw(texture, NPC.Center - screenPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0); else { - texture = ModContent.Request(Texture).Value; + texture = TextureAssets.Npc[NPC.type].Value; Main.EntitySpriteDraw(texture, NPC.Center - screenPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0); } if (Main.zenithWorld) diff --git a/NPCs/NormalNPCs/WildBumblefuck.cs b/NPCs/NormalNPCs/WildBumblefuck.cs index ec7ca83ab6..8421f495ff 100644 --- a/NPCs/NormalNPCs/WildBumblefuck.cs +++ b/NPCs/NormalNPCs/WildBumblefuck.cs @@ -44,7 +44,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.lavaImmune = true; NPC.noTileCollide = true; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit51; NPC.DeathSound = SoundID.NPCDeath46; NPC.Calamity().VulnerableToHeat = true; diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index d74476d180..6186e5c0d2 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -22,6 +22,7 @@ using CalamityMod.NPCs.TownNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -42,6 +43,8 @@ namespace CalamityMod.NPCs.OldDuke public SlotId RoarSoundSlot; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 7; @@ -54,6 +57,10 @@ namespace CalamityMod.NPCs.OldDuke }; value.Position.X += 14f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -127,9 +134,7 @@ namespace CalamityMod.NPCs.OldDuke public override void ModifyTypeName(ref string typeName) { if (Main.zenithWorld) - { typeName = CalamityUtils.GetTextValue("NPCs.BoomerDuke"); - } } public override void FindFrame(int frameHeight) @@ -139,9 +144,8 @@ namespace CalamityMod.NPCs.OldDuke { int frameChangeFrequency = tired ? 14 : 7; if (NPC.ai[0] == 5f || NPC.ai[0] == 12f) - { frameChangeFrequency = tired ? 12 : 6; - } + NPC.frameCounter += 1D; if (NPC.frameCounter > frameChangeFrequency) { @@ -149,18 +153,15 @@ namespace CalamityMod.NPCs.OldDuke NPC.frame.Y += frameHeight; } if (NPC.frame.Y >= frameHeight * 6) - { NPC.frame.Y = 0; - } } + if (NPC.ai[0] == 1f || NPC.ai[0] == 6f || NPC.ai[0] == 11f) - { NPC.frame.Y = frameHeight * 2; - } + if (NPC.ai[0] == 2f || NPC.ai[0] == 7f || NPC.ai[0] == 14f) - { NPC.frame.Y = frameHeight * 6; - } + if (NPC.ai[0] == 3f || NPC.ai[0] == 8f || NPC.ai[0] == 13f || NPC.ai[0] == -1f) { int frameChangeGateValue = 120; @@ -173,19 +174,16 @@ namespace CalamityMod.NPCs.OldDuke NPC.frame.Y += frameHeight; } if (NPC.frame.Y >= frameHeight * 6) - { NPC.frame.Y = 0; - } } else { NPC.frame.Y = frameHeight * 5; if (NPC.ai[2] > (frameChangeGateValue - 40) && NPC.ai[2] < (frameChangeGateValue - 15)) - { NPC.frame.Y = frameHeight * 6; - } } } + if (NPC.ai[0] == 4f || NPC.ai[0] == 9f) { int secondFrameChangeGateValue = 180; @@ -198,17 +196,13 @@ namespace CalamityMod.NPCs.OldDuke NPC.frame.Y += frameHeight; } if (NPC.frame.Y >= frameHeight * 6) - { NPC.frame.Y = 0; - } } else { NPC.frame.Y = frameHeight * 5; if (NPC.ai[2] > (secondFrameChangeGateValue - 50) && NPC.ai[2] < (secondFrameChangeGateValue - 25)) - { NPC.frame.Y = frameHeight * 6; - } } } } @@ -340,7 +334,7 @@ namespace CalamityMod.NPCs.OldDuke if (NPC.ai[0] >= 4f && NPC.Calamity().newAI[1] != 1f) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/OldDuke/OldDukeGlow").Value; + texture2D15 = GlowTexture.Value; Color yellowLerpColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); drawLerpColor = Color.Yellow; diff --git a/NPCs/Other/THELORDE.cs b/NPCs/Other/THELORDE.cs index be6fd8c074..79d2d2542a 100644 --- a/NPCs/Other/THELORDE.cs +++ b/NPCs/Other/THELORDE.cs @@ -8,6 +8,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -37,6 +38,8 @@ namespace CalamityMod.NPCs.Other public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/Lordeath"); + public static Asset DeathAnimationTexture; + public override void SetStaticDefaults() { NPCID.Sets.MPAllowedEnemies[Type] = true; @@ -44,6 +47,10 @@ namespace CalamityMod.NPCs.Other NPCID.Sets.ShouldBeCountedAsBoss[Type] = true; this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 7; + if (!Main.dedServ) + { + DeathAnimationTexture = ModContent.Request(Texture + "DEATH", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -161,7 +168,7 @@ namespace CalamityMod.NPCs.Other { // old was zombie 1 - zombie 62 // ideally would be collaborative inferal screeches of various devs - SoundEngine.PlaySound(Polterghast.Polterghast.creepySounds[Main.rand.Next(1, Polterghast.Polterghast.creepySounds.Count)] with { PitchVariance = 2 }, NPC.position); + SoundEngine.PlaySound(Polterghast.Polterghast.creepySounds[Main.rand.Next(1, Polterghast.Polterghast.creepySounds.Count)] with { PitchVariance = 2 }, NPC.Center); } Player playerLOL = Main.player[NPC.target]; playerLOL.velocity.X *= 0.99f; @@ -425,7 +432,7 @@ namespace CalamityMod.NPCs.Other if (Dying) { // death animation - texture = ModContent.Request("CalamityMod/NPCs/Other/THELORDEDEATH").Value; + texture = DeathAnimationTexture.Value; int xFrame = 0; int yFrame = frameToUse; if (frameToUse > 13) diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index 34bc115a9b..01fb9ffb94 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -3,6 +3,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -17,10 +18,21 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); + public static Asset AltTexture; + public static Asset Texture_Glow; + public static Asset AltTexture_Glow; + + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadLarge.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + AltTexture_Glow = ModContent.Request(Texture + "AltGlow", AssetRequestMode.AsyncLoad); + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -43,7 +55,6 @@ namespace CalamityMod.NPCs.Perforator NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = HitSound; NPC.DeathSound = DeathSound; NPC.netAlways = true; @@ -173,7 +184,7 @@ namespace CalamityMod.NPCs.Perforator if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = NPC.localAI[3] == 1f ? ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyLargeAlt").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = NPC.localAI[3] == 1f ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; @@ -181,7 +192,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = NPC.localAI[3] == 1f ? ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyLargeAltGlow").Value : ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyLargeGlow").Value; + texture2D15 = NPC.localAI[3] == 1f ? AltTexture_Glow.Value : Texture_Glow.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index f08082c394..ef764fa9f1 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -19,10 +20,16 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfMediumHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfMediumDeath"); + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadMedium.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -46,7 +53,6 @@ namespace CalamityMod.NPCs.Perforator NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = HitSound; NPC.DeathSound = DeathSound; NPC.netAlways = true; @@ -180,9 +186,10 @@ namespace CalamityMod.NPCs.Perforator } // Calculate contact damage based on velocity + // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. float maxChaseSpeed = 16f; - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; + float minimalContactDamageVelocity = maxChaseSpeed * 0.4f; + float minimalDamageVelocity = maxChaseSpeed * 0.8f; float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); if (bodyAndTailVelocity <= minimalContactDamageVelocity) { @@ -209,7 +216,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyMediumGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index d17ea9ba89..edbe9583e2 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -3,6 +3,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -17,10 +18,16 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfSmallHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfSmallDeath"); + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadSmall.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -43,7 +50,6 @@ namespace CalamityMod.NPCs.Perforator NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = HitSound; NPC.DeathSound = DeathSound; NPC.netAlways = true; @@ -152,9 +158,10 @@ namespace CalamityMod.NPCs.Perforator } // Calculate contact damage based on velocity + // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. float maxChaseSpeed = 16f; - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; + float minimalContactDamageVelocity = maxChaseSpeed * 0.4f; + float minimalDamageVelocity = maxChaseSpeed * 0.8f; float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); if (bodyAndTailVelocity <= minimalContactDamageVelocity) { @@ -181,7 +188,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodySmallGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorCyst.cs b/NPCs/Perforator/PerforatorCyst.cs index dda2bdd2e4..eaf3858d0e 100644 --- a/NPCs/Perforator/PerforatorCyst.cs +++ b/NPCs/Perforator/PerforatorCyst.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -13,6 +14,8 @@ namespace CalamityMod.NPCs.Perforator { public static readonly SoundStyle HiveSpawn = new("CalamityMod/Sounds/Custom/Perforator/PerfHiveSpawn"); + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; @@ -20,6 +23,10 @@ namespace CalamityMod.NPCs.Perforator NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -74,7 +81,7 @@ namespace CalamityMod.NPCs.Perforator vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorCystGlow").Value; + texture2D15 = GlowTexture.Value; Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index e9f0b1dade..95dd7fde47 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -6,6 +6,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -21,6 +22,8 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); + public static Asset GlowTexture; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private bool TailSpawned = false; @@ -38,6 +41,10 @@ namespace CalamityMod.NPCs.Perforator value.Position.X += 70; value.Position.Y += 40; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -329,7 +336,7 @@ namespace CalamityMod.NPCs.Perforator NPC.velocity.Y = maxChargeSpeed; // This bool exists to stop the strange wiggle behavior when worms are falling down - bool slowXVelocity = Math.Abs(NPC.velocity.X) > maxChargeSpeed; + bool slowXVelocity = Math.Abs(NPC.velocity.X) > speedCopy; if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.4) { if (NPC.velocity.X < 0f) @@ -499,12 +506,12 @@ namespace CalamityMod.NPCs.Perforator float minimalDamageVelocity = maxChargeSpeed * 0.5f; if (NPC.velocity.Length() <= minimalContactDamageVelocity) { - NPC.damage = (int)(NPC.defDamage * 0.5f); + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); } else { float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); } NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2; @@ -545,7 +552,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHeadLargeGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 21ed01fac6..4170cfdc34 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -20,6 +21,8 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfMediumHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfMediumDeath"); + public static Asset GlowTexture; + public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); @@ -34,6 +37,10 @@ namespace CalamityMod.NPCs.Perforator value.Position.X += 60; value.Position.Y += 40; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -287,7 +294,7 @@ namespace CalamityMod.NPCs.Perforator NPC.velocity.Y = maxChargeSpeed; // This bool exists to stop the strange wiggle behavior when worms are falling down - bool slowXVelocity = Math.Abs(NPC.velocity.X) > maxChargeSpeed; + bool slowXVelocity = Math.Abs(NPC.velocity.X) > turnSpeedCopy; if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxChargeSpeed * 0.4) { if (NPC.velocity.X < 0f) @@ -420,12 +427,12 @@ namespace CalamityMod.NPCs.Perforator float minimalDamageVelocity = maxChargeSpeed * 0.5f; if (NPC.velocity.Length() <= minimalContactDamageVelocity) { - NPC.damage = (int)(NPC.defDamage * 0.5f); + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); } else { float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); } NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; @@ -466,7 +473,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHeadMediumGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index 0077cd773d..8d341da595 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -5,6 +5,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -20,6 +21,8 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfSmallHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfSmallDeath"); + public static Asset GlowTexture; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private const int MsgType = 23; private bool TailSpawned = false; @@ -38,6 +41,10 @@ namespace CalamityMod.NPCs.Perforator value.Position.X += 60; value.Position.Y += 50; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -326,7 +333,7 @@ namespace CalamityMod.NPCs.Perforator NPC.velocity.Y = maxChargeSpeed; // This bool exists to stop the strange wiggle behavior when worms are falling down - bool slowXVelocity = Math.Abs(NPC.velocity.X) > maxChargeSpeed; + bool slowXVelocity = Math.Abs(NPC.velocity.X) > speedCopy; if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.4) { if (NPC.velocity.X < 0f) @@ -457,12 +464,12 @@ namespace CalamityMod.NPCs.Perforator float minimalDamageVelocity = maxChargeSpeed * 0.5f; if (NPC.velocity.Length() <= minimalContactDamageVelocity) { - NPC.damage = (int)(NPC.defDamage * 0.5f); + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); } else { float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); } NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2; @@ -503,7 +510,7 @@ namespace CalamityMod.NPCs.Perforator glowmaskDrawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, glowmaskDrawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHeadSmallGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, glowmaskDrawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index da0995fdce..c9014254b2 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -19,10 +19,10 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Boss; -using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -42,6 +42,8 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfHiveHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfHiveDeath"); + public static Asset GlowTexture; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private bool small = false; private bool medium = false; @@ -55,6 +57,10 @@ namespace CalamityMod.NPCs.Perforator NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -518,7 +524,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHiveGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -548,7 +554,7 @@ namespace CalamityMod.NPCs.Perforator { string key = "Mods.CalamityMod.Status.Progression.SkyOreText"; Color messageColor = Color.Cyan; - AerialiteOreGen.Generate(true); + AerialiteOreGen.Enchant(); CalamityUtils.DisplayLocalizedText(key, messageColor); } diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index b5e9ce7611..df4536e71a 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -3,6 +3,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -17,10 +18,16 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadLarge.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -43,7 +50,6 @@ namespace CalamityMod.NPCs.Perforator NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = HitSound; NPC.DeathSound = DeathSound; NPC.netAlways = true; @@ -182,7 +188,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorTailLargeGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index 57f55dfdc0..6880426acc 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -19,10 +20,16 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfMediumHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfMediumDeath"); + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadMedium.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -46,7 +53,6 @@ namespace CalamityMod.NPCs.Perforator NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = HitSound; NPC.DeathSound = DeathSound; NPC.netAlways = true; @@ -151,9 +157,10 @@ namespace CalamityMod.NPCs.Perforator } // Calculate contact damage based on velocity + // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. float maxChaseSpeed = 16f; - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; + float minimalContactDamageVelocity = maxChaseSpeed * 0.4f; + float minimalDamageVelocity = maxChaseSpeed * 0.8f; float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); if (bodyAndTailVelocity <= minimalContactDamageVelocity) { @@ -180,7 +187,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorTailMediumGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index 1b184b4bbd..7f5d26a183 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -3,6 +3,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -17,10 +18,16 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfSmallHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfSmallDeath"); + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadSmall.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -43,7 +50,6 @@ namespace CalamityMod.NPCs.Perforator NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = HitSound; NPC.DeathSound = DeathSound; NPC.netAlways = true; @@ -153,9 +159,10 @@ namespace CalamityMod.NPCs.Perforator } // Calculate contact damage based on velocity + // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. float maxChaseSpeed = 16f; - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; + float minimalContactDamageVelocity = maxChaseSpeed * 0.4f; + float minimalDamageVelocity = maxChaseSpeed * 0.8f; float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); if (bodyAndTailVelocity <= minimalContactDamageVelocity) { @@ -182,7 +189,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorTailSmallGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/PlagueEnemies/PlagueCharger.cs b/NPCs/PlagueEnemies/PlagueCharger.cs index 1c04b6fbaf..1f79c757cc 100644 --- a/NPCs/PlagueEnemies/PlagueCharger.cs +++ b/NPCs/PlagueEnemies/PlagueCharger.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -18,10 +19,16 @@ namespace CalamityMod.NPCs.PlagueEnemies { public class PlagueCharger : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -90,7 +97,7 @@ namespace CalamityMod.NPCs.PlagueEnemies drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/PlagueEnemies/PlagueChargerGlow").Value; + texture2D15 = GlowTexture.Value; Color redEyeColor = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/PlagueEnemies/Plagueshell.cs b/NPCs/PlagueEnemies/Plagueshell.cs index fd5716b9b9..122ac2e63b 100644 --- a/NPCs/PlagueEnemies/Plagueshell.cs +++ b/NPCs/PlagueEnemies/Plagueshell.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; @@ -56,7 +57,7 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void AI() { - NPC.damage = NPC.ai[0] == 3f ? (int)(NPC.defDamage * 1.8) : 0; + NPC.damage = NPC.ai[0] == 3f ? (int)Math.Round(NPC.defDamage * 1.4) : 0; } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index 7320b57fde..a0f39e5e2a 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -6,6 +6,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -16,11 +17,16 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { public class PlagueHomingMissile : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueHomingMissileGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -39,7 +45,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; @@ -186,7 +191,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueHomingMissileGlow").Value; + texture2D15 = GlowTexture.Value; Color redLerpColor = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index 2b708fd477..1f6b639fb0 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -15,10 +16,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { public class PlagueMine : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 4; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueMineGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -36,7 +42,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.knockBackResist = 0.2f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; NPC.Calamity().VulnerableToSickness = false; @@ -126,7 +131,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueMineGlow").Value; + texture2D15 = GlowTexture.Value; Color redLerpColor = Color.Lerp(Color.White, Color.Red, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, redLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 1839365174..6967d320cc 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -22,6 +22,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -47,6 +48,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath private bool flyingFrame2 = false; private int curTex = 1; + public static Asset ChargeTexture; + public static Asset Texture_Glow; + public static Asset ChargeTexture_Glow; + public static readonly SoundStyle NukeWarningSound = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGNukeWarning"); public static readonly SoundStyle AttackSwitchSound = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGAttackSwitch", 2); public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGDash"); @@ -68,6 +73,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath value.Position.X -= 48f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + ChargeTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTex", AssetRequestMode.AsyncLoad); + Texture_Glow = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathGlow", AssetRequestMode.AsyncLoad); + ChargeTexture_Glow = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTexGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -180,7 +191,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; // Light - Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.3f, 0.7f, 0f); + Lighting.AddLight((int)(NPC.Center.X / 16f), (int)(NPC.Center.Y / 16f), 0.3f, 0.7f, 0f); // Show message if (!halfLife && phase3 && expertMode) @@ -199,13 +210,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (MissileCountdown > 1) MissileCountdown--; - Vector2 vectorCenter = NPC.Center; - // Count nearby players int activePlayers = 0; for (int i = 0; i < Main.maxPlayers; i++) { - if (Main.player[i].active && !Main.player[i].dead && (vectorCenter - Main.player[i].Center).Length() < 1000f) + if (Main.player[i].active && !Main.player[i].dead && (NPC.Center - Main.player[i].Center).Length() < 1000f) activePlayers++; } @@ -220,7 +229,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Player player = Main.player[NPC.target]; // Distance from target - Vector2 distFromPlayer = player.Center - vectorCenter; + Vector2 distFromPlayer = player.Center - NPC.Center; // Enrage if (!player.ZoneJungle && !bossRush) @@ -255,11 +264,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.rotation = NPC.velocity.X * 0.02f; // Despawn - if (!player.active || player.dead || Vector2.Distance(player.Center, vectorCenter) > 5600f) + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f) { NPC.TargetClosest(false); player = Main.player[NPC.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, vectorCenter) > 5600f) + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f) { if (despawnTimer > 0) despawnTimer--; @@ -352,6 +361,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Charge phase else if (NPC.ai[0] == 0f) { + int chargeDistanceX = revenge ? 525 : 550; + if (phase4) + chargeDistanceX = revenge ? 450 : 475; + else if (phase3) + chargeDistanceX = revenge ? 475 : 500; + else if (phase2) + chargeDistanceX = revenge ? 500 : 525; + chargeDistanceX -= (int)(25f * enrageScale); + float chargeSpeed = revenge ? 28f : 26f; if (phase2) chargeSpeed += 1f; @@ -388,12 +406,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Avoid cheap bullshit NPC.damage = 0; - float playerLocation = vectorCenter.X - player.Center.X; + float playerLocation = NPC.Center.X - player.Center.X; - float chargeThresholdY = 20f; - chargeThresholdY += 20f * enrageScale; + float chargeDistanceY = 20f; + chargeDistanceY += 20f * enrageScale; - if (Math.Abs(NPC.Center.Y - (player.Center.Y - chargeDistance)) < chargeThresholdY) + float distanceFromTargetX = Math.Abs(NPC.Center.X - player.Center.X); + float distanceFromTargetY = Math.Abs(NPC.Center.Y - (player.Center.Y - chargeDistance)); + if (distanceFromTargetY < chargeDistanceY && distanceFromTargetX >= chargeDistanceX) { // Set damage NPC.damage = NPC.defDamage; @@ -420,8 +440,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.ai[1] += 1f; NPC.ai[2] = 0f; - float targetX = player.position.X + (player.width / 2) - vectorCenter.X; - float targetY = player.position.Y + (player.height / 2) - vectorCenter.Y; + float targetX = player.Center.X - NPC.Center.X; + float targetY = player.Center.Y - NPC.Center.Y; float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); targetDistance = chargeSpeed / targetDistance; @@ -441,48 +461,53 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.netSpam -= 5; SoundEngine.PlaySound(DashSound, NPC.Center); + return; } NPC.rotation = NPC.velocity.X * 0.02f; charging = false; - float maxLineUpSpeedY = revenge ? 14f : 12f; - float lineUpAccelY = revenge ? 0.25f : 0.22f; + float maxLineUpSpeed = revenge ? 25f : 20f; + float lineUpAccel = revenge ? 0.75f : 0.6f; if (phase2) { - maxLineUpSpeedY += 1f; - lineUpAccelY += 0.05f; + maxLineUpSpeed += 3f; + lineUpAccel += 0.15f; } if (phase4) { - maxLineUpSpeedY += 1f; - lineUpAccelY += 0.05f; + maxLineUpSpeed += 3f; + lineUpAccel += 0.15f; } - maxLineUpSpeedY += 1.5f * enrageScale; - lineUpAccelY += 0.25f * enrageScale; + maxLineUpSpeed += 7f * enrageScale; + lineUpAccel += 0.35f * enrageScale; - if (vectorCenter.Y < (player.Center.Y - chargeDistance)) - NPC.velocity.Y += lineUpAccelY; + if (NPC.Center.Y < (player.Center.Y - chargeDistance - chargeDistanceY)) + NPC.velocity.Y += lineUpAccel; + else if (NPC.Center.Y > (player.Center.Y - chargeDistance + chargeDistanceY)) + NPC.velocity.Y -= lineUpAccel; else - NPC.velocity.Y -= lineUpAccelY; + NPC.velocity.Y *= 0.7f; - if (NPC.velocity.Y < -maxLineUpSpeedY) - NPC.velocity.Y = -maxLineUpSpeedY; - if (NPC.velocity.Y > maxLineUpSpeedY) - NPC.velocity.Y = maxLineUpSpeedY; + if (NPC.velocity.Y < -maxLineUpSpeed) + NPC.velocity.Y = -maxLineUpSpeed; + if (NPC.velocity.Y > maxLineUpSpeed) + NPC.velocity.Y = maxLineUpSpeed; - if (Math.Abs(vectorCenter.X - player.Center.X) > 650f) - NPC.velocity.X += lineUpAccelY * NPC.direction; - else if (Math.Abs(vectorCenter.X - player.Center.X) < 500f) - NPC.velocity.X -= lineUpAccelY * NPC.direction; + float distanceXMax = 100f; + float distanceXMin = 20f; + if (distanceFromTargetX > chargeDistanceX + distanceXMax) + NPC.velocity.X += lineUpAccel * NPC.direction; + else if (distanceFromTargetX < chargeDistanceX + distanceXMin) + NPC.velocity.X -= lineUpAccel * NPC.direction; else - NPC.velocity.X *= 0.8f; + NPC.velocity.X *= 0.7f; - if (NPC.velocity.X < -maxLineUpSpeedY) - NPC.velocity.X = -maxLineUpSpeedY; - if (NPC.velocity.X > maxLineUpSpeedY) - NPC.velocity.X = maxLineUpSpeedY; + if (NPC.velocity.X < -maxLineUpSpeed) + NPC.velocity.X = -maxLineUpSpeed; + if (NPC.velocity.X > maxLineUpSpeed) + NPC.velocity.X = maxLineUpSpeed; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; @@ -504,20 +529,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.spriteDirection = NPC.direction; - int stopChargeXDist = revenge ? 525 : 550; - if (phase4) - stopChargeXDist = revenge ? 450 : 475; - else if (phase3) - stopChargeXDist = revenge ? 475 : 500; - else if (phase2) - stopChargeXDist = revenge ? 500 : 525; - stopChargeXDist -= (int)(25f * enrageScale); - int chargeDirectionXSign = 1; - if (vectorCenter.X < player.Center.X) + if (NPC.Center.X < player.Center.X) chargeDirectionXSign = -1; - if (NPC.direction == chargeDirectionXSign && (Math.Abs(vectorCenter.X - player.Center.X) > stopChargeXDist || Math.Abs(vectorCenter.Y - player.Center.Y) > stopChargeXDist)) + if (NPC.direction == chargeDirectionXSign && Math.Abs(NPC.Center.X - player.Center.X) > chargeDistanceX) + NPC.ai[2] = 1f; + if (Math.Abs(NPC.Center.Y - player.Center.Y) > chargeDistanceX * 1.5f) NPC.ai[2] = 1f; if (enrageScale > 0 && NPC.ai[2] == 1f) @@ -565,7 +583,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Avoid cheap bullshit NPC.damage = 0; - float playerLocation = vectorCenter.X - player.Center.X; + float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; @@ -607,16 +625,22 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Avoid cheap bullshit NPC.damage = 0; - float playerLocation = vectorCenter.X - player.Center.X; + float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; - float playerXDist = player.position.X + (player.width / 2) - vectorCenter.X; - float playerYDist = player.position.Y + (player.height / 2) - 200f - vectorCenter.Y; - float playerTotalDist = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); + // Move closer + bool canHitTarget = Collision.CanHit(NPC.Center, 1, 1, player.position, player.width, player.height); + float distanceAboveTarget = !canHitTarget ? 0f : 400f; + float distanceAwayFromTargetX = !canHitTarget ? 36f : 144f; + float distanceAwayFromTargetY = player.Center.Y - NPC.Center.Y; + float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 48f; + bool tooFarX = Math.Abs(player.Center.X - NPC.Center.X) > distanceAwayFromTargetX; + bool tooFarY = distanceAwayFromTargetY > distanceAboveTarget + distanceAwayFromTargetYLeeway || distanceAwayFromTargetY < distanceAboveTarget - distanceAwayFromTargetYLeeway; + bool tooFar = tooFarX || tooFarY; calamityGlobalNPC.newAI[0] += 1f; - if (playerTotalDist < 600f || calamityGlobalNPC.newAI[0] >= 180f) + if ((Vector2.Distance(NPC.Center, player.Center) < 640f && canHitTarget) || calamityGlobalNPC.newAI[0] >= 180f) { NPC.ai[0] = (phase3 || bossRush) ? 5f : 1f; NPC.ai[1] = 0f; @@ -633,8 +657,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath return; } - // Move closer - Movement(100f, 350f, 450f, player, enrageScale); + if (tooFar) + Movement(distanceAboveTarget, player, enrageScale); } // Spawn less missiles @@ -644,11 +668,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.damage = 0; charging = false; + Vector2 missileSpawnPos = new Vector2(NPC.direction == 1 ? NPC.getRect().BottomLeft().X : NPC.getRect().BottomRight().X, NPC.getRect().Bottom().Y + 20f); missileSpawnPos.X += NPC.direction * 120; - float playerMissileX = player.position.X + (player.width / 2) - vectorCenter.X; - float playerMissileY = player.position.Y + (player.height / 2) - vectorCenter.Y; - float playerMissileDist = (float)Math.Sqrt(playerMissileX * playerMissileX + playerMissileY * playerMissileY); + Vector2 missileSpawnCollisionLocation = new Vector2(missileSpawnPos.X, missileSpawnPos.Y - 30f); + bool canHitTarget = Collision.CanHit(missileSpawnCollisionLocation, 1, 1, player.position, player.width, player.height); NPC.ai[1] += 1f; NPC.ai[1] += activePlayers / 2; @@ -674,8 +698,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float npcSpeed = (revenge ? 9f : 7f) + enrageScale * 2f; - float projXDist = player.position.X + player.width * 0.5f - missileSpawnPos.X; - float projYDist = player.position.Y + player.height * 0.5f - missileSpawnPos.Y; + float projXDist = player.Center.X - missileSpawnPos.X; + float projYDist = player.Center.Y - missileSpawnPos.Y; float projDistance = (float)Math.Sqrt(projXDist * projXDist + projYDist * projYDist); projDistance = npcSpeed / projDistance; @@ -689,13 +713,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - // Move closer if too far away - if (playerMissileDist > 600f) - Movement(100f, 350f, 450f, player, enrageScale); - else - NPC.velocity *= 0.9f; + // Move closer + float distanceAboveTarget = !canHitTarget ? 0f : 400f; + float distanceAwayFromTargetX = !canHitTarget ? 36f : 144f; + float distanceAwayFromTargetY = player.Center.Y - NPC.Center.Y; + float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 48f; + bool tooFarX = Math.Abs(player.Center.X - NPC.Center.X) > distanceAwayFromTargetX; + bool tooFarY = distanceAwayFromTargetY > distanceAboveTarget + distanceAwayFromTargetYLeeway || distanceAwayFromTargetY < distanceAboveTarget - distanceAwayFromTargetYLeeway; + bool tooFar = tooFarX || tooFarY; + if (tooFar) + Movement(distanceAboveTarget, player, enrageScale); - float playerLocation = vectorCenter.X - player.Center.X; + float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; @@ -724,9 +753,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath charging = false; Vector2 missileSpawnPos = new Vector2(NPC.direction == 1 ? NPC.getRect().BottomLeft().X : NPC.getRect().BottomRight().X, NPC.getRect().Bottom().Y + 20f); missileSpawnPos.X += NPC.direction * 120; - float playerMissileX = player.position.X + (player.width / 2) - vectorCenter.X; - float playerMissileY = player.position.Y + (player.height / 2) - vectorCenter.Y; - float playerMissileDist = (float)Math.Sqrt(playerMissileX * playerMissileX + playerMissileY * playerMissileY); + Vector2 missileSpawnCollisionLocation = new Vector2(missileSpawnPos.X, missileSpawnPos.Y - 30f); + bool canHitTarget = Collision.CanHit(missileSpawnCollisionLocation, 1, 1, player.position, player.width, player.height); NPC.ai[1] += 1f; NPC.ai[1] += activePlayers / 2; @@ -755,10 +783,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < 3) NPC.NewNPC(NPC.GetSource_FromAI(), (int)missileSpawnPos.X, (int)missileSpawnPos.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, challengeAmt); - float npcSpeed = (revenge ? 11f : 9f) + enrageScale * 2f; + float npcSpeed = (revenge ? 10f : 8f) + enrageScale * 2f; - float projXDist = player.position.X + player.width * 0.5f - missileSpawnPos.X; - float projYDist = player.position.Y + player.height * 0.5f - missileSpawnPos.Y; + float projXDist = player.Center.X - missileSpawnPos.X; + float projYDist = player.Center.Y - missileSpawnPos.Y; float projDistance = (float)Math.Sqrt(projXDist * projXDist + projYDist * projYDist); projDistance = npcSpeed / projDistance; @@ -774,13 +802,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - // Move closer if too far away - if (playerMissileDist > 600f) - Movement(100f, 350f, 450f, player, enrageScale); - else - NPC.velocity *= 0.9f; + // Move closer + float distanceAboveTarget = !canHitTarget ? 0f : 400f; + float distanceAwayFromTargetX = !canHitTarget ? 36f : 144f; + float distanceAwayFromTargetY = player.Center.Y - NPC.Center.Y; + float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 48f; + bool tooFarX = Math.Abs(player.Center.X - NPC.Center.X) > distanceAwayFromTargetX; + bool tooFarY = distanceAwayFromTargetY > distanceAboveTarget + distanceAwayFromTargetYLeeway || distanceAwayFromTargetY < distanceAboveTarget - distanceAwayFromTargetYLeeway; + bool tooFar = tooFarX || tooFarY; + if (tooFar) + Movement(distanceAboveTarget, player, enrageScale); - float playerLocation = vectorCenter.X - player.Center.X; + float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; @@ -808,12 +841,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Vector2 stingerSpawnPos = new Vector2(NPC.direction == 1 ? NPC.getRect().BottomLeft().X : NPC.getRect().BottomRight().X, NPC.getRect().Bottom().Y + 20f); stingerSpawnPos.X += NPC.direction * 120; + bool canHitTarget = Collision.CanHit(new Vector2(stingerSpawnPos.X, stingerSpawnPos.Y - 30f), 1, 1, player.position, player.width, player.height); NPC.ai[1] += 1f; int stingerFireDelay = phase5 ? 20 : (phase3 ? 25 : 30); stingerFireDelay -= (int)Math.Ceiling(5f * enrageScale); - if (NPC.ai[1] % stingerFireDelay == (stingerFireDelay - 1) && vectorCenter.Y < player.position.Y) + if (NPC.ai[1] % stingerFireDelay == (stingerFireDelay - 1) && NPC.Center.Y < player.position.Y) { SoundEngine.PlaySound(SoundID.Item42, NPC.Center); @@ -822,8 +856,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float projectileSpeed = revenge ? 6f : 5f; projectileSpeed += 2f * enrageScale; - float projXDist = player.position.X + player.width * 0.5f - stingerSpawnPos.X; - float projYDist = player.position.Y + player.height * 0.5f - stingerSpawnPos.Y; + float projXDist = player.Center.X - stingerSpawnPos.X; + float projYDist = player.Center.Y - stingerSpawnPos.Y; float projDistance = (float)Math.Sqrt(projXDist * projXDist + projYDist * projYDist); projDistance = projectileSpeed / projDistance; projXDist *= projDistance; @@ -835,20 +869,20 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath case 0: case 1: break; + case 2: case 3: if (expertMode) type = ModContent.ProjectileType(); break; + case 4: type = ModContent.ProjectileType(); break; } if (Main.zenithWorld) - { type = ModContent.ProjectileType(); - } int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(NPC.GetSource_FromAI(), stingerSpawnPos.X, stingerSpawnPos.Y, projXDist, projYDist, type, damage, 0f, Main.myPlayer, challengeAmt, player.position.Y); @@ -860,9 +894,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.ai[2] = 0f; } - Movement(100f, 400f, 500f, player, enrageScale); + // Move closer + float distanceAboveTarget = !canHitTarget ? 0f : 400f; + float distanceAwayFromTargetX = !canHitTarget ? 36f : 144f; + float distanceAwayFromTargetY = player.Center.Y - NPC.Center.Y; + float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 48f; + bool tooFarX = Math.Abs(player.Center.X - NPC.Center.X) > distanceAwayFromTargetX; + bool tooFarY = distanceAwayFromTargetY > distanceAboveTarget + distanceAwayFromTargetYLeeway || distanceAwayFromTargetY < distanceAboveTarget - distanceAwayFromTargetYLeeway; + bool tooFar = tooFarX || tooFarY; + if (tooFar) + Movement(distanceAboveTarget, player, enrageScale); - float playerLocation = vectorCenter.X - player.Center.X; + float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; @@ -885,8 +928,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Missile charge else if (NPC.ai[0] == 4f) { - float chargeSpeed = revenge ? 28f : 26f; + float missileVelocity = revenge ? 6f : 5f; + missileVelocity += 2f * enrageScale; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + + int chargeDistanceX = 600; + float chargeSpeed = revenge ? 28f : 26f; chargeSpeed += 3f * enrageScale; int phaseSwitchTimer = (int)Math.Ceiling(2f + enrageScale); @@ -902,7 +951,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // A phase switch sync is a critical operation that must be synced. if (NPC.netSpam >= 10) NPC.netSpam = 9; + SoundEngine.PlaySound(AttackSwitchSound, NPC.Center); + return; } @@ -912,12 +963,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Avoid cheap bullshit NPC.damage = 0; - float playerLocation = vectorCenter.X - player.Center.X; + float playerLocation = NPC.Center.X - player.Center.X; - float chargeThresholdY = 20f; - chargeThresholdY += 20 * enrageScale; + float chargeDistanceY = 20f; + chargeDistanceY += 20f * enrageScale; - if (Math.Abs(vectorCenter.Y - (player.Center.Y - 500f)) < chargeThresholdY) + float distanceFromTargetX = Math.Abs(NPC.Center.X - player.Center.X); + float distanceFromTargetY = Math.Abs(NPC.Center.Y - (player.Center.Y - 500f)); + if (distanceFromTargetY < chargeDistanceY && distanceFromTargetX >= chargeDistanceX) { // Set damage NPC.damage = NPC.defDamage; @@ -928,17 +981,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (Main.netMode != NetmodeID.MultiplayerClient) { - float speed = revenge ? 6f : 5f; - speed += 2f * enrageScale; - bool gaussMode = false; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - - Vector2 baseVelocity = player.Center - vectorCenter; + Vector2 baseVelocity = player.Center - NPC.Center; baseVelocity.Normalize(); - baseVelocity *= speed; + baseVelocity *= missileVelocity; if (Main.rand.NextBool(10) && Main.zenithWorld) { @@ -958,16 +1005,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { for (int i = 0; i < missiles; i++) { - Vector2 spawn = vectorCenter; // Normal = 96, Boss Rush = 144 + Vector2 spawn = NPC.Center; // Normal = 96, Boss Rush = 144 spawn.X += i * (int)(spread * 1.125) - (missiles * (spread / 2)); // Normal = -96 to 93, Boss Rush = -144 to 156 Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-MissileAngleSpread / 2 + (MissileAngleSpread * i / missiles))); Projectile.NewProjectile(NPC.GetSource_FromAI(), spawn, velocity, type, damage, 0f, Main.myPlayer, nukeBarrageChallengeAmt, player.position.Y); } } else - { Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, baseVelocity, type, damage, 0f, Main.myPlayer); - } } } @@ -976,8 +1021,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.ai[1] += 1f; NPC.ai[2] = 0f; - float targetX = player.position.X + (player.width / 2) - vectorCenter.X; - float targetY = player.position.Y - 500f + (player.height / 2) - vectorCenter.Y; + float targetX = player.Center.X - NPC.Center.X; + float targetY = player.Center.Y - 500f - NPC.Center.Y; float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); targetDistance = chargeSpeed / targetDistance; @@ -998,32 +1043,36 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.rotation = NPC.velocity.X * 0.02f; charging = false; - float maxLineUpSpeedY = revenge ? 16f : 14f; - float lineUpAccelY = revenge ? 0.2f : 0.18f; - maxLineUpSpeedY += 1.5f * enrageScale; - lineUpAccelY += 0.25f * enrageScale; + float maxLineUpSpeed = revenge ? 31f : 26f; + float lineUpAccel = revenge ? 1.05f : 0.9f; + maxLineUpSpeed += 7f * enrageScale; + lineUpAccel += 0.35f * enrageScale; - if (vectorCenter.Y < player.Center.Y - 500f) - NPC.velocity.Y += lineUpAccelY; + if (NPC.Center.Y < (player.Center.Y - 500f - chargeDistanceY)) + NPC.velocity.Y += lineUpAccel; + else if (NPC.Center.Y > (player.Center.Y - 500f + chargeDistanceY)) + NPC.velocity.Y -= lineUpAccel; else - NPC.velocity.Y -= lineUpAccelY; + NPC.velocity.Y *= 0.7f; - if (NPC.velocity.Y < -maxLineUpSpeedY) - NPC.velocity.Y = -maxLineUpSpeedY; - if (NPC.velocity.Y > maxLineUpSpeedY) - NPC.velocity.Y = maxLineUpSpeedY; + if (NPC.velocity.Y < -maxLineUpSpeed) + NPC.velocity.Y = -maxLineUpSpeed; + if (NPC.velocity.Y > maxLineUpSpeed) + NPC.velocity.Y = maxLineUpSpeed; - if (Math.Abs(vectorCenter.X - player.Center.X) > 600f) - NPC.velocity.X += lineUpAccelY * NPC.direction; - else if (Math.Abs(vectorCenter.X - player.Center.X) < 300f) - NPC.velocity.X -= lineUpAccelY * NPC.direction; + float distanceXMax = 100f; + float distanceXMin = 20f; + if (distanceFromTargetX > chargeDistanceX + distanceXMax) + NPC.velocity.X += lineUpAccel * NPC.direction; + else if (distanceFromTargetX < chargeDistanceX + distanceXMin) + NPC.velocity.X -= lineUpAccel * NPC.direction; else - NPC.velocity.X *= 0.8f; + NPC.velocity.X *= 0.7f; - if (NPC.velocity.X < -maxLineUpSpeedY) - NPC.velocity.X = -maxLineUpSpeedY; - if (NPC.velocity.X > maxLineUpSpeedY) - NPC.velocity.X = maxLineUpSpeedY; + if (NPC.velocity.X < -maxLineUpSpeed) + NPC.velocity.X = -maxLineUpSpeed; + if (NPC.velocity.X > maxLineUpSpeed) + NPC.velocity.X = maxLineUpSpeed; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; @@ -1042,12 +1091,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.spriteDirection = NPC.direction; - int stopChargeXDist = 600; int chargeDirectionXSign = 1; - if (vectorCenter.X < player.Center.X) + if (NPC.Center.X < player.Center.X) chargeDirectionXSign = -1; - if (NPC.direction == chargeDirectionXSign && Math.Abs(vectorCenter.X - player.Center.X) > stopChargeXDist) + if (NPC.direction == chargeDirectionXSign && Math.Abs(NPC.Center.X - player.Center.X) > chargeDistanceX) + NPC.ai[2] = 1f; + if (Math.Abs(NPC.Center.Y - player.Center.Y) > chargeDistanceX * 3f) NPC.ai[2] = 1f; if (enrageScale > 0 && NPC.ai[2] == 1f) NPC.velocity *= 0.95f; @@ -1064,6 +1114,19 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (calamityGlobalNPC.newAI[0] > 90f) NPC.velocity.X *= 1.01f; + // Fire missiles in death mode during charge + if (death) + { + float missileGateValue = 20f; + bool fireMissile = calamityGlobalNPC.newAI[0] % missileGateValue == 0f && Collision.CanHit(NPC.Center, 1, 1, player.position, player.width, player.height); + if (fireMissile) + { + SoundEngine.PlaySound(SoundID.Item42, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * missileVelocity, type, damage, 0f, Main.myPlayer, nukeBarrageChallengeAmt, player.position.Y); + } + } + return; } @@ -1103,51 +1166,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - private void Movement(float xPos, float yPos, float yPos2, Player player, float enrageScale) + private void Movement(float distanceAboveTarget, Player player, float enrageScale) { - Vector2 acceleration = new Vector2(0.1f, 0.15f); - Vector2 velocity = new Vector2(8f, 5f); - float deceleration = 0.9f; - - acceleration *= 0.1f * enrageScale + 1f; - velocity *= 1f - enrageScale * 0.1f; - if (BossRushEvent.BossRushActive) - velocity *= 0.5f; - deceleration *= 1f - enrageScale * 0.1f; - - if (NPC.position.Y > player.position.Y - yPos) - { - if (NPC.velocity.Y > 0f) - NPC.velocity.Y *= deceleration; - NPC.velocity.Y -= acceleration.Y; - if (NPC.velocity.Y > velocity.Y) - NPC.velocity.Y = velocity.Y; - } - else if (NPC.position.Y < player.position.Y - yPos2) - { - if (NPC.velocity.Y < 0f) - NPC.velocity.Y *= deceleration; - NPC.velocity.Y += acceleration.Y; - if (NPC.velocity.Y < -velocity.Y) - NPC.velocity.Y = -velocity.Y; - } - - if (NPC.position.X + (NPC.width / 2) > player.position.X + (player.width / 2) + xPos) - { - if (NPC.velocity.X > 0f) - NPC.velocity.X *= deceleration; - NPC.velocity.X -= acceleration.X; - if (NPC.velocity.X > velocity.X) - NPC.velocity.X = velocity.X; - } - if (NPC.position.X + (NPC.width / 2) < player.position.X + (player.width / 2) - xPos) - { - if (NPC.velocity.X < 0f) - NPC.velocity.X *= deceleration; - NPC.velocity.X += acceleration.X; - if (NPC.velocity.X < -velocity.X) - NPC.velocity.X = -velocity.X; - } + float acceleration = (NPC.ai[0] == 1f || NPC.ai[0] == 5f) ? 0.24f : 0.48f; // Reduce acceleration while spawning minions + float velocity = (NPC.ai[0] == 1f || NPC.ai[0] == 5f) ? 12f : (NPC.ai[0] == 2f ? 18f : 24f); // Reduce velocity while preparing to spawn minions and spawning minions + acceleration *= 0.5f * enrageScale + 1f; + velocity *= 1f + enrageScale * 0.5f; + Vector2 hoverDestination = player.Center - Vector2.UnitY * distanceAboveTarget; + Vector2 idealVelocity = NPC.SafeDirectionTo(hoverDestination) * velocity; + NPC.SimpleFlyMovement(idealVelocity, acceleration); } public override bool CheckActive() => canDespawn; @@ -1176,9 +1203,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 2; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hit.HitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) @@ -1186,12 +1212,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath for (int i = 1; i < 7; i++) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlaguebringerGoliathGore" + i).Type, NPC.scale); } - NPC.position.X = NPC.position.X + (NPC.width / 2); - NPC.position.Y = NPC.position.Y + (NPC.height / 2); - NPC.width = 200; - NPC.height = 200; + + NPC.position = NPC.Center; + NPC.width = NPC.height = 200; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); + for (int i = 0; i < 40; i++) { int plagueDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); @@ -1202,6 +1228,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Main.dust[plagueDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } + for (int j = 0; j < 70; j++) { int plagueDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 3f); @@ -1216,7 +1243,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathGlow").Value; + Texture2D glowTexture = Texture_Glow.Value; if (curTex != (charging ? 2 : 1)) { NPC.frame.X = 0; @@ -1225,13 +1252,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (charging) { curTex = 2; - texture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTex").Value; - glowTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTexGlow").Value; + texture = ChargeTexture.Value; + glowTexture = ChargeTexture_Glow.Value; } else - { curTex = 1; - } SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) @@ -1302,9 +1327,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.frame.Y = 0; NPC.frame.X = NPC.frame.X == 0 ? width : 0; if (charging) - { flyingFrame2 = !flyingFrame2; - } } } diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index 3256dc7551..84dc65fb2c 100644 --- a/NPCs/Polterghast/PhantomFuckYou.cs +++ b/NPCs/Polterghast/PhantomFuckYou.cs @@ -32,7 +32,6 @@ namespace CalamityMod.NPCs.Polterghast NPC.DR_NERD(0.1f); NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.damage = 50; NPC.lifeMax = 20000; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; @@ -190,7 +189,7 @@ namespace CalamityMod.NPCs.Polterghast NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 2; i++) { - int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); + int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 100, default, 2f); Main.dust[ghostDust].velocity *= 3f; if (Main.rand.NextBool()) { diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index 61f526b7e7..4e948bd9d9 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -49,7 +49,6 @@ namespace CalamityMod.NPCs.Polterghast NPC.noGravity = true; NPC.noTileCollide = true; NPC.netAlways = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit36; NPC.DeathSound = SoundID.NPCDeath39; NPC.Calamity().VulnerableToSickness = false; @@ -557,7 +556,7 @@ namespace CalamityMod.NPCs.Polterghast NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 10; i++) { - int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); + int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 100, default, 2f); Main.dust[ghostDust].velocity *= 3f; if (Main.rand.NextBool()) { diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 80f5845710..b9d04d9019 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -24,6 +24,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -56,13 +57,15 @@ namespace CalamityMod.NPCs.Polterghast private int soundTimer = 0; private bool reachedChargingPoint = false; private bool threeAM = false; - private int nameStage = 1; public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PolterghastHit"); public static readonly SoundStyle P2Sound = new("CalamityMod/Sounds/Custom/Polterghast/PolterghastP2Transition"); public static readonly SoundStyle P3Sound = new("CalamityMod/Sounds/Custom/Polterghast/PolterghastP3Transition"); public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/Polterghast/PolterghastSpawn"); public static readonly SoundStyle PhantomSound = new("CalamityMod/Sounds/Custom/Polterghast/PolterghastPhantomSpawn"); + public static Asset Texture_Glow; + public static Asset Texture_Glow2; + public static List creepySounds = new List { NPCs.DevourerofGods.DevourerofGodsHead.AttackSound, @@ -96,6 +99,11 @@ namespace CalamityMod.NPCs.Polterghast NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + Texture_Glow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -132,16 +140,6 @@ namespace CalamityMod.NPCs.Polterghast }); } - public override void ModifyTypeName(ref string typeName) - { - typeName = nameStage switch - { - 2 => CalamityUtils.GetTextValue("NPCs.Necroghast"), - 3 => CalamityUtils.GetTextValue("NPCs.Necroplasm"), - _ => this.GetLocalizedValue("DisplayName"), - }; - } - public override void BossHeadSlot(ref int index) { bool death = CalamityWorld.death || BossRushEvent.BossRushActive; @@ -790,7 +788,7 @@ namespace CalamityMod.NPCs.Polterghast for (int i = 0; i < 10; i++) { - int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); + int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 100, default, 2f); Main.dust[ghostDust].velocity *= 3f; Main.dust[ghostDust].noGravity = true; if (Main.rand.NextBool()) @@ -809,13 +807,10 @@ namespace CalamityMod.NPCs.Polterghast } } - // Actually changes name to Necroghast - nameStage = 2; - if (!isInChargePhase) NPC.damage = phase2ReducedSetDamage; - NPC.defense = (int)(NPC.defDefense * 0.8f); + NPC.defense = (int)Math.Round(NPC.defDefense * 0.8); if (Main.netMode != NetmodeID.MultiplayerClient && !isInChargePhase) { @@ -946,7 +941,7 @@ namespace CalamityMod.NPCs.Polterghast for (int i = 0; i < 10; i++) { - int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); + int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 100, default, 2f); Main.dust[ghostDust].velocity *= 3f; Main.dust[ghostDust].noGravity = true; if (Main.rand.NextBool()) @@ -965,13 +960,10 @@ namespace CalamityMod.NPCs.Polterghast } } - // Actually changes name to Necroplasm - nameStage = 3; - if (!isInChargePhase) NPC.damage = phase3ReducedSetDamage; - NPC.defense = (int)(NPC.defDefense * 0.5f); + NPC.defense = (int)Math.Round(NPC.defDefense * 0.5); NPC.localAI[1] += 1f; if (NPC.localAI[1] >= (getPissed ? 200f : 280f) && Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) @@ -1034,11 +1026,6 @@ namespace CalamityMod.NPCs.Polterghast Main.npc[phantomSpirit].netUpdate = true; } } - - if (Main.zenithWorld) - { - NPC.GivenName = CalamityUtils.GetTextValue("NPCs.Polterplasm"); - } } } } @@ -1104,7 +1091,7 @@ namespace CalamityMod.NPCs.Polterghast // Materials normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 7, 15)); - normalOnly.Add(ModContent.ItemType(), 1, 30, 40); + normalOnly.Add(ModContent.ItemType(), 1, 30, 40); // Vanity normalOnly.Add(ModContent.ItemType(), 7); @@ -1173,7 +1160,7 @@ namespace CalamityMod.NPCs.Polterghast spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastGlow2").Value; + Texture2D texture2D16 = Texture_Glow2.Value; Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); int afterimageAmt = 7; @@ -1198,7 +1185,7 @@ namespace CalamityMod.NPCs.Polterghast Color c = NPC.IsABestiaryIconDummy ? Color.White : NPC.GetAlpha(drawColor); spriteBatch.Draw(texture2D15, vector43, NPC.frame, c, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastGlow").Value; + texture2D15 = Texture_Glow.Value; Color secondColorLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); Color lightRed = new Color(255, 100, 100, 255); @@ -1332,7 +1319,7 @@ namespace CalamityMod.NPCs.Polterghast NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 10; i++) { - int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); + int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 100, default, 2f); Main.dust[ghostDust].velocity *= 3f; if (Main.rand.NextBool()) { diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index ccb7371328..d208ecba32 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -16,11 +17,19 @@ namespace CalamityMod.NPCs.Polterghast private int despawnTimer = 300; private bool phase2 = false; + public static Asset GlowTexture; + public static Asset ChainTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 2; NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + ChainTexture = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -352,9 +361,9 @@ namespace CalamityMod.NPCs.Polterghast if (Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > changeColorGateValue) cyanLerpColor = Color.Lerp(cyanLerpColor, lightRed, MathHelper.Clamp((Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] - changeColorGateValue) / timeToReachFullColor, 0f, 1f)); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), - new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Value.Width, chainWidth)), cyanLerpColor, chainRotation, - new Vector2(ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Value.Width * 0.5f, ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(ChainTexture.Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), + new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, ChainTexture.Value.Width, chainWidth)), cyanLerpColor, chainRotation, + new Vector2(ChainTexture.Value.Width * 0.5f, ChainTexture.Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } @@ -386,7 +395,7 @@ namespace CalamityMod.NPCs.Polterghast drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastHookGlow").Value; + texture2D15 = GlowTexture.Value; Color cyanLerp2 = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > changeColorGateValue) diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs b/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs index 3cbfc9aee7..8a8fb1aa1d 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs @@ -3,6 +3,7 @@ using System.IO; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -13,10 +14,17 @@ namespace CalamityMod.NPCs.PrimordialWyrm { public class PrimordialWyrmBody : ModNPC { + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PrimordialWyrmHead.DisplayName"); + public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -177,7 +185,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/PrimordialWyrm/PrimordialWyrmBodyGlow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); return false; diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs index 935a594f6a..fa061524e4 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs @@ -3,6 +3,7 @@ using System.IO; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -13,10 +14,16 @@ namespace CalamityMod.NPCs.PrimordialWyrm { public class PrimordialWyrmBodyAlt : ModNPC { + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PrimordialWyrmHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -177,7 +184,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/PrimordialWyrm/PrimordialWyrmBodyAltGlow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); return false; diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs index 2b6bc510d7..1fce49ffae 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs @@ -17,6 +17,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -81,6 +82,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm public static readonly SoundStyle ChargeSound = new("CalamityMod/Sounds/Custom/PrimordialWyrmCharge"); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PrimordialWyrmDeath"); + public static Asset GlowTexture; + public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); @@ -94,6 +97,10 @@ namespace CalamityMod.NPCs.PrimordialWyrm value.Position.X += 55; value.Position.Y += 5; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -1434,7 +1441,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/PrimordialWyrm/PrimordialWyrmHeadGlow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); return false; @@ -1448,15 +1455,15 @@ namespace CalamityMod.NPCs.PrimordialWyrm public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType()); - npcLoot.Add(ModContent.ItemType()); + npcLoot.Add(ModContent.ItemType()); npcLoot.Add(ModContent.ItemType()); npcLoot.Add(ModContent.ItemType()); npcLoot.Add(ModContent.ItemType(), 1, 80, 100); npcLoot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); - var postClone = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitasClone); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 50, 108, 65, 135)); - postClone.Add(ItemID.Ectoplasm, 1, 21, 32); + var postLevi = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedLeviathan); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 50, 108, 65, 135)); + postLevi.Add(ItemID.Ectoplasm, 1, 21, 32); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs b/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs index 782ac805ba..e192350bad 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs @@ -2,6 +2,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -12,10 +13,16 @@ namespace CalamityMod.NPCs.PrimordialWyrm { public class PrimordialWyrmTail : ModNPC { + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PrimordialWyrmHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -139,7 +146,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/PrimordialWyrm/PrimordialWyrmTailGlow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); return false; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index 7de9c2035d..d85a7326d6 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -16,6 +16,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -38,6 +39,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); public static readonly SoundStyle ShieldDeathSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); + public static Asset Texture_Glow; + public static Asset TextureNight_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 10; @@ -53,6 +57,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians value.Position.Y += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + TextureNight_Glow = ModContent.Request(Texture + "GlowNight", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -1037,11 +1046,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlow").Value; + texture2D15 = Texture_Glow.Value; Color timeBasedColorLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (Main.remixWorld) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlowNight").Value; + texture2D15 = TextureNight_Glow.Value; timeBasedColorLerp = Color.Cyan; } if (colorOverride != null) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index 76a9932dc8..dc0fba164b 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -30,6 +30,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians public static readonly SoundStyle RockShieldSpawnSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate"); public static readonly SoundStyle ShieldDeathSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); + public static Asset Texture_Glow; + public static Asset TextureNight_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 10; @@ -44,6 +47,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians value.Position.X += 25; value.Position.Y += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + TextureNight_Glow = ModContent.Request(Texture + "GlowNight", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -63,7 +71,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.knockBackResist = 0f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; AIType = -1; NPC.HitSound = SoundID.NPCHit52; NPC.DeathSound = SoundID.NPCDeath55; @@ -764,11 +771,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlow").Value; + texture2D15 = Texture_Glow.Value; Color timeBasedGlowColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (Main.remixWorld) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlowNight").Value; + texture2D15 = TextureNight_Glow.Value; timeBasedGlowColor = Color.Cyan; } if (colorOverride != null) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs index 84a73540f9..cfc275078d 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs @@ -8,6 +8,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -40,6 +41,10 @@ namespace CalamityMod.NPCs.ProfanedGuardians private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + public static Asset Texture_Glow; + public static Asset Texture_Glow2; + public static Asset TextureNight_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 10; @@ -54,6 +59,12 @@ namespace CalamityMod.NPCs.ProfanedGuardians value.Position.X += 25; value.Position.Y += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + Texture_Glow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + TextureNight_Glow = ModContent.Request(Texture + "GlowNight", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -73,7 +84,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.knockBackResist = 0f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; AIType = -1; NPC.HitSound = SoundID.NPCHit52; NPC.DeathSound = SoundID.NPCDeath55; @@ -439,7 +449,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow2").Value; + Texture2D texture2D16 = Texture_Glow2.Value; Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); int afterimageAmt = 5; @@ -466,11 +476,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow").Value; + texture2D15 = Texture_Glow.Value; Color timeBasedDrawColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (Main.remixWorld) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlowNight").Value; + texture2D15 = TextureNight_Glow.Value; timeBasedDrawColor = Color.Cyan; } Color overrideColor = Color.Lerp(Color.White, Color.Violet, 0.5f); diff --git a/NPCs/ProfanedGuardians/ProfanedRocks.cs b/NPCs/ProfanedGuardians/ProfanedRocks.cs index eb13ecf041..9ef42786b6 100644 --- a/NPCs/ProfanedGuardians/ProfanedRocks.cs +++ b/NPCs/ProfanedGuardians/ProfanedRocks.cs @@ -6,6 +6,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -23,10 +24,19 @@ namespace CalamityMod.NPCs.ProfanedGuardians public const int MaxHP = 8000; public const int MaxBossRushHP = 20000; + public static Asset[] Textures = new Asset[6]; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + for (int i = 0; i < 6; i++) + { + Textures[i] = ModContent.Request(Texture + (i + 1), AssetRequestMode.AsyncLoad); + } + } } public override void SetDefaults() @@ -47,7 +57,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.noGravity = true; NPC.chaseable = false; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit52; NPC.DeathSound = SoundID.NPCDeath55; NPC.Calamity().VulnerableToHeat = false; @@ -315,7 +324,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { int npcType = (int)MathHelper.Clamp(NPC.ai[2], 1f, 6f); - Texture2D texture = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedRocks" + npcType.ToString()).Value; + Texture2D texture = Textures[npcType - 1].Value; Vector2 drawOrigin = new Vector2(texture.Width / 2, texture.Height / 2); Vector2 drawPos = NPC.Center - screenPos; drawPos -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index c461cfb7e3..0e2e9a8d0d 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -141,7 +142,7 @@ namespace CalamityMod.NPCs.Providence vector43 += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlow").Value; + texture2D15 = ProfanedGuardianDefender.Texture_Glow.Value; Color yellowLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index 2eb3d39ecc..9d1aa49894 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -117,7 +118,7 @@ namespace CalamityMod.NPCs.Providence spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow2").Value; + Texture2D texture2D16 = ProfanedGuardianHealer.Texture_Glow2.Value; Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); int afterimageAmt = 5; @@ -141,7 +142,7 @@ namespace CalamityMod.NPCs.Providence drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow").Value; + texture2D15 = ProfanedGuardianHealer.Texture_Glow.Value; Color yellowLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); Color violetLerp = Color.Lerp(Color.White, Color.Violet, 0.5f); diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index 055acf1bf4..faa67a7dfa 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -143,7 +144,7 @@ namespace CalamityMod.NPCs.Providence drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlow").Value; + texture2D15 = ProfanedGuardianCommander.Texture_Glow.Value; Color yellowLerpColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index ccd83c87c1..7a3b07d462 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -30,6 +30,7 @@ using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -114,6 +115,46 @@ namespace CalamityMod.NPCs.Providence private const float TimeForStarDespawn = 120f; private const float TimeForShieldDespawn = 120f; + // Every single one of Providence's sprites, both night and day, and their glowmasks + #region Textures + public static Asset TextureAlt; + public static Asset TextureAltNight; + public static Asset TextureAttack; + public static Asset TextureAttackNight; + public static Asset TextureAttackAlt; + public static Asset TextureAttackAltNight; + public static Asset TextureDefense; + public static Asset TextureDefenseNight; + public static Asset TextureDefenseAlt; + public static Asset TextureDefenseAltNight; + public static Asset TextureNight; + + public static Asset Texture_Glow; + public static Asset TextureAlt_Glow; + public static Asset TextureAltNight_Glow; + public static Asset TextureAttack_Glow; + public static Asset TextureAttackNight_Glow; + public static Asset TextureAttackAlt_Glow; + public static Asset TextureAttackAltNight_Glow; + public static Asset TextureDefense_Glow; + public static Asset TextureDefenseNight_Glow; + public static Asset TextureDefenseAlt_Glow; + public static Asset TextureDefenseAltNight_Glow; + public static Asset TextureNight_Glow; + public static Asset Texture_Glow_2; + public static Asset TextureAlt_Glow_2; + public static Asset TextureAltNight_Glow_2; + public static Asset TextureAttack_Glow_2; + public static Asset TextureAttackNight_Glow_2; + public static Asset TextureAttackAlt_Glow_2; + public static Asset TextureAttackAltNight_Glow_2; + public static Asset TextureDefense_Glow_2; + public static Asset TextureDefenseNight_Glow_2; + public static Asset TextureDefenseAlt_Glow_2; + public static Asset TextureDefenseAltNight_Glow_2; + public static Asset TextureNight_Glow_2; + #endregion + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 3; @@ -128,6 +169,55 @@ namespace CalamityMod.NPCs.Providence value.Position.Y += 6f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + + #region Texture Loading + if (!Main.dedServ) + { + string ProviPath = "CalamityMod/NPCs/Providence/Providence"; + string GlowPath = "CalamityMod/NPCs/Providence/Glowmasks/Providence"; + + // Normal textures + TextureAlt = ModContent.Request(ProviPath + "Alt", AssetRequestMode.AsyncLoad); + TextureAltNight = ModContent.Request(ProviPath + "AltNight", AssetRequestMode.AsyncLoad); + TextureAttack = ModContent.Request(ProviPath + "Attack", AssetRequestMode.AsyncLoad); + TextureAttackNight = ModContent.Request(ProviPath + "AttackNight", AssetRequestMode.AsyncLoad); + TextureAttackAlt = ModContent.Request(ProviPath + "AttackAlt", AssetRequestMode.AsyncLoad); + TextureAttackAltNight = ModContent.Request(ProviPath + "AttackAltNight", AssetRequestMode.AsyncLoad); + TextureDefense = ModContent.Request(ProviPath + "Defense", AssetRequestMode.AsyncLoad); + TextureDefenseNight = ModContent.Request(ProviPath + "DefenseNight", AssetRequestMode.AsyncLoad); + TextureDefenseAlt = ModContent.Request(ProviPath + "DefenseAlt", AssetRequestMode.AsyncLoad); + TextureDefenseAltNight = ModContent.Request(ProviPath + "DefenseAltNight", AssetRequestMode.AsyncLoad); + TextureNight = ModContent.Request(ProviPath + "Night", AssetRequestMode.AsyncLoad); + + // Fire glowmasks + Texture_Glow = ModContent.Request(GlowPath + "Glow", AssetRequestMode.AsyncLoad); + TextureAlt_Glow = ModContent.Request(GlowPath + "AltGlow", AssetRequestMode.AsyncLoad); + TextureAltNight_Glow = ModContent.Request(GlowPath + "AltGlowNight", AssetRequestMode.AsyncLoad); + TextureAttack_Glow = ModContent.Request(GlowPath + "AttackGlow", AssetRequestMode.AsyncLoad); + TextureAttackNight_Glow = ModContent.Request(GlowPath + "AttackGlowNight", AssetRequestMode.AsyncLoad); + TextureAttackAlt_Glow = ModContent.Request(GlowPath + "AttackAltGlow", AssetRequestMode.AsyncLoad); + TextureAttackAltNight_Glow = ModContent.Request(GlowPath + "AttackAltGlowNight", AssetRequestMode.AsyncLoad); + TextureDefense_Glow = ModContent.Request(GlowPath + "DefenseGlow", AssetRequestMode.AsyncLoad); + TextureDefenseNight_Glow = ModContent.Request(GlowPath + "DefenseGlowNight", AssetRequestMode.AsyncLoad); + TextureDefenseAlt_Glow = ModContent.Request(GlowPath + "DefenseAltGlow", AssetRequestMode.AsyncLoad); + TextureDefenseAltNight_Glow = ModContent.Request(GlowPath + "DefenseAltGlowNight", AssetRequestMode.AsyncLoad); + TextureNight_Glow = ModContent.Request(GlowPath + "GlowNight", AssetRequestMode.AsyncLoad); + + // Crystal glowmasks + Texture_Glow_2 = ModContent.Request(GlowPath + "Glow2", AssetRequestMode.AsyncLoad); + TextureAlt_Glow_2 = ModContent.Request(GlowPath + "AltGlow2", AssetRequestMode.AsyncLoad); + TextureAltNight_Glow_2 = ModContent.Request(GlowPath + "AltGlow2Night", AssetRequestMode.AsyncLoad); + TextureAttack_Glow_2 = ModContent.Request(GlowPath + "AttackGlow2", AssetRequestMode.AsyncLoad); + TextureAttackNight_Glow_2 = ModContent.Request(GlowPath + "AttackGlow2Night", AssetRequestMode.AsyncLoad); + TextureAttackAlt_Glow_2 = ModContent.Request(GlowPath + "AttackAltGlow2", AssetRequestMode.AsyncLoad); + TextureAttackAltNight_Glow_2 = ModContent.Request(GlowPath + "AttackAltGlow2Night", AssetRequestMode.AsyncLoad); + TextureDefense_Glow_2 = ModContent.Request(GlowPath + "DefenseGlow2", AssetRequestMode.AsyncLoad); + TextureDefenseNight_Glow_2 = ModContent.Request(GlowPath + "DefenseGlow2Night", AssetRequestMode.AsyncLoad); + TextureDefenseAlt_Glow_2 = ModContent.Request(GlowPath + "DefenseAltGlow2", AssetRequestMode.AsyncLoad); + TextureDefenseAltNight_Glow_2 = ModContent.Request(GlowPath + "DefenseAltGlow2Night", AssetRequestMode.AsyncLoad); + TextureNight_Glow_2 = ModContent.Request(GlowPath + "Glow2Night", AssetRequestMode.AsyncLoad); + } + #endregion } public override void SetDefaults() @@ -182,7 +272,6 @@ namespace CalamityMod.NPCs.Providence writer.Write(flightPath); writer.Write(NPC.dontTakeDamage); writer.Write(NPC.chaseable); - writer.Write(NPC.canGhostHeal); writer.Write(NPC.localAI[0]); writer.Write(NPC.localAI[1]); writer.Write(NPC.localAI[2]); @@ -209,7 +298,6 @@ namespace CalamityMod.NPCs.Providence flightPath = reader.ReadInt32(); NPC.dontTakeDamage = reader.ReadBoolean(); NPC.chaseable = reader.ReadBoolean(); - NPC.canGhostHeal = reader.ReadBoolean(); NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); NPC.localAI[2] = reader.ReadSingle(); @@ -523,7 +611,6 @@ namespace CalamityMod.NPCs.Providence // Whether the boss can be homed in on or healed off of NPC.chaseable = normalAttackRate; - NPC.canGhostHeal = NPC.chaseable; // Prevent lag by stopping rain if (CalamityConfig.Instance.BossesStopWeather) @@ -1629,10 +1716,8 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode != NetmodeID.MultiplayerClient) { - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), crystalSpawnPos, Vector2.Zero, ModContent.ProjectileType(), crystalDamage, 0f, Main.myPlayer, lifeRatio, 0f); - - if (nightAI) - Main.projectile[proj].timeLeft = getFuckedAI ? gfbCrystalTime : nightCrystalTime; + float timeLeft = nightAI ? (float)(getFuckedAI ? gfbCrystalTime : nightCrystalTime) : 0f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), crystalSpawnPos, Vector2.Zero, ModContent.ProjectileType(), crystalDamage, 0f, Main.myPlayer, lifeRatio, 0f, timeLeft); } } @@ -2065,50 +2150,45 @@ namespace CalamityMod.NPCs.Providence string baseTextureString = "CalamityMod/NPCs/Providence/"; string baseGlowTextureString = baseTextureString + "Glowmasks/"; - string getTextureString = baseTextureString + "Providence"; - string getTextureGlowString = baseGlowTextureString + "ProvidenceGlow"; - string getTextureGlow2String = baseGlowTextureString + "ProvidenceGlow2"; + Texture2D texture = offColor ? TextureNight.Value : TextureAssets.Npc[Type].Value; + Texture2D textureGlow = offColor ? TextureNight_Glow.Value : Texture_Glow.Value; + Texture2D textureGlow2 = offColor ? TextureNight_Glow_2.Value : Texture_Glow_2.Value; if (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) { if (!useDefenseFrames) { - getTextureString = baseTextureString + "ProvidenceDefense"; - getTextureGlowString = baseGlowTextureString + "ProvidenceDefenseGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceDefenseGlow2"; + texture = offColor ? TextureDefenseNight.Value : TextureDefense.Value; + textureGlow = offColor ? TextureDefenseNight_Glow.Value : TextureDefense_Glow.Value; + textureGlow2 = offColor ? TextureDefenseNight_Glow_2.Value : TextureDefense_Glow_2.Value; } else { - getTextureString = baseTextureString + "ProvidenceDefenseAlt"; - getTextureGlowString = baseGlowTextureString + "ProvidenceDefenseAltGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceDefenseAltGlow2"; + texture = offColor ? TextureDefenseAltNight.Value : TextureDefenseAlt.Value; + textureGlow = offColor ? TextureDefenseAltNight_Glow.Value : TextureDefenseAlt_Glow.Value; + textureGlow2 = offColor ? TextureDefenseAltNight_Glow_2.Value : TextureDefenseAlt_Glow_2.Value; } } else { switch (frameUsed) { - case 0: - getTextureGlowString = baseGlowTextureString + "ProvidenceGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceGlow2"; - break; - case 1: - getTextureString = baseTextureString + "ProvidenceAlt"; - getTextureGlowString = baseGlowTextureString + "ProvidenceAltGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceAltGlow2"; + texture = offColor ? TextureAltNight.Value : TextureAlt.Value; + textureGlow = offColor ? TextureAltNight_Glow.Value : TextureAlt_Glow.Value; + textureGlow2 = offColor ? TextureAltNight_Glow_2.Value : TextureAlt_Glow_2.Value; break; case 2: - getTextureString = baseTextureString + "ProvidenceAttack"; - getTextureGlowString = baseGlowTextureString + "ProvidenceAttackGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceAttackGlow2"; + texture = offColor ? TextureAttackNight.Value : TextureAttack.Value; + textureGlow = offColor ? TextureAttackNight_Glow.Value : TextureAttack_Glow.Value; + textureGlow2 = offColor ? TextureAttackNight_Glow_2.Value : TextureAttack_Glow_2.Value; break; case 3: - getTextureString = baseTextureString + "ProvidenceAttackAlt"; - getTextureGlowString = baseGlowTextureString + "ProvidenceAttackAltGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceAttackAltGlow2"; + texture = offColor ? TextureAttackAltNight.Value : TextureAttackAlt.Value; + textureGlow = offColor ? TextureAttackAltNight_Glow.Value : TextureAttackAlt_Glow.Value; + textureGlow2 = offColor ? TextureAttackAltNight_Glow_2.Value : TextureAttackAlt_Glow_2.Value; break; default: @@ -2116,17 +2196,6 @@ namespace CalamityMod.NPCs.Providence } } - if (offColor) - { - getTextureString += "Night"; - getTextureGlowString += "Night"; - getTextureGlow2String += "Night"; - } - - Texture2D texture = ModContent.Request(getTextureString).Value; - Texture2D textureGlow = ModContent.Request(getTextureGlowString).Value; - Texture2D textureGlow2 = ModContent.Request(getTextureGlow2String).Value; - SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index f5734341db..d91408d85d 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -14,10 +15,16 @@ namespace CalamityMod.NPCs.Ravager public class FlamePillar : ModNPC { public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit", 3); + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 4; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -28,7 +35,6 @@ namespace CalamityMod.NPCs.Ravager NPC.defense = 35; NPC.DR_NERD(0.2f); NPC.chaseable = false; - NPC.canGhostHeal = false; NPC.lifeMax = DownedBossSystem.downedProvidence ? 14000 : 3500; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); @@ -154,7 +160,7 @@ namespace CalamityMod.NPCs.Ravager spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Ravager/FlamePillarGlow").Value; + texture2D15 = GlowTexture.Value; Color flameBlue = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, flameBlue, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 7307db07e0..ffee658261 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -22,6 +22,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -45,6 +46,9 @@ namespace CalamityMod.NPCs.Ravager public static readonly SoundStyle PillarSound = new("CalamityMod/Sounds/Custom/Ravager/RavagerPillarSummon"); public static readonly SoundStyle MissileSound = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileLaunch"); + public static Asset GlowTexture; + public static Asset ChainTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 7; @@ -58,6 +62,11 @@ namespace CalamityMod.NPCs.Ravager value.Position.Y -= 50f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + ChainTexture = ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -850,11 +859,11 @@ namespace CalamityMod.NPCs.Ravager Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); if (NPC.IsABestiaryIconDummy) { - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawLeft").Value, new Vector2(center.X - screenPos.X - NPC.scale * 180, center.Y - screenPos.Y + 50), - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawLeft").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawLeft").Value.Height)), + spriteBatch.Draw(TextureAssets.Npc[ModContent.NPCType()].Value, new Vector2(center.X - screenPos.X - NPC.scale * 180, center.Y - screenPos.Y + 50), + new Rectangle?(new Rectangle(0, 0, TextureAssets.Npc[ModContent.NPCType()].Value.Width, TextureAssets.Npc[ModContent.NPCType()].Value.Height)), Color.White, 0f, default, NPC.scale, SpriteEffects.None, 0f); - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawRight").Value, new Vector2(center.X - screenPos.X + NPC.scale * 110, center.Y - screenPos.Y + 50), - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawRight").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawRight").Value.Height)), + spriteBatch.Draw(TextureAssets.Npc[ModContent.NPCType()].Value, new Vector2(center.X - screenPos.X + NPC.scale * 110, center.Y - screenPos.Y + 50), + new Rectangle?(new Rectangle(0, 0, TextureAssets.Npc[ModContent.NPCType()].Value.Width, TextureAssets.Npc[ModContent.NPCType()].Value.Height)), Color.White, 0f, default, NPC.scale, SpriteEffects.None, 0f); } return true; @@ -870,10 +879,10 @@ namespace CalamityMod.NPCs.Ravager Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); Vector2 glowmaskPosition = center - screenPos; - glowmaskPosition -= new Vector2(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Value.Height / Main.npcFrameCount[NPC.type]) * 1f / 2f; + glowmaskPosition -= new Vector2(GlowTexture.Value.Width, GlowTexture.Value.Height / Main.npcFrameCount[NPC.type]) * 1f / 2f; glowmaskPosition += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color glowmaskColor = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.Blue); - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Value, glowmaskPosition, + spriteBatch.Draw(GlowTexture.Value, glowmaskPosition, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); float legOffset = 20f; @@ -886,16 +895,16 @@ namespace CalamityMod.NPCs.Ravager headOffset = 0f; } - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegRight").Value, new Vector2(center.X - screenPos.X + NPC.scale * 28f, center.Y - screenPos.Y + legOffset), //72 - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegRight").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegRight").Value.Height)), + spriteBatch.Draw(TextureAssets.Npc[ModContent.NPCType()].Value, new Vector2(center.X - screenPos.X + NPC.scale * 28f, center.Y - screenPos.Y + legOffset), //72 + new Rectangle?(new Rectangle(0, 0, TextureAssets.Npc[ModContent.NPCType()].Value.Width, TextureAssets.Npc[ModContent.NPCType()].Value.Height)), drawLighting, 0f, default, NPC.scale, SpriteEffects.None, 0f); - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegLeft").Value, new Vector2(center.X - screenPos.X - NPC.scale * 112f, center.Y - screenPos.Y + legOffset), //72 - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegLeft").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegLeft").Value.Height)), + spriteBatch.Draw(TextureAssets.Npc[ModContent.NPCType()].Value, new Vector2(center.X - screenPos.X - NPC.scale * 112f, center.Y - screenPos.Y + legOffset), //72 + new Rectangle?(new Rectangle(0, 0, TextureAssets.Npc[ModContent.NPCType()].Value.Width, TextureAssets.Npc[ModContent.NPCType()].Value.Height)), drawLighting, 0f, default, NPC.scale, SpriteEffects.None, 0f); if (NPC.AnyNPCs(ModContent.NPCType()) || NPC.IsABestiaryIconDummy) { - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerHead").Value, new Vector2(center.X - screenPos.X - NPC.scale * 70f, center.Y - screenPos.Y - NPC.scale * headOffset), - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerHead").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerHead").Value.Height)), + spriteBatch.Draw(TextureAssets.Npc[ModContent.NPCType()].Value, new Vector2(center.X - screenPos.X - NPC.scale * 70f, center.Y - screenPos.Y - NPC.scale * headOffset), + new Rectangle?(new Rectangle(0, 0, TextureAssets.Npc[ModContent.NPCType()].Value.Width, TextureAssets.Npc[ModContent.NPCType()].Value.Height)), drawLighting, 0f, default, NPC.scale, SpriteEffects.None, 0f); } } diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index 27c43336b8..218826ba88 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -34,7 +34,6 @@ namespace CalamityMod.NPCs.Ravager NPC.knockBackResist = 0f; AIType = -1; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.alpha = 255; NPC.netAlways = true; NPC.HitSound = RavagerBody.HitSound; @@ -296,9 +295,9 @@ namespace CalamityMod.NPCs.Ravager drawPositionY += 12f; drawPositionX -= 28f; Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Height)), color, rotation, - new Vector2(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Width * 0.5f, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(RavagerBody.ChainTexture.Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), + new Rectangle?(new Rectangle(0, 0, RavagerBody.ChainTexture.Value.Width, RavagerBody.ChainTexture.Value.Height)), color, rotation, + new Vector2(RavagerBody.ChainTexture.Value.Width * 0.5f, RavagerBody.ChainTexture.Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } return true; diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index 6194b94953..360d61c8a6 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -35,7 +35,6 @@ namespace CalamityMod.NPCs.Ravager AIType = -1; NPC.netAlways = true; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.alpha = 255; NPC.HitSound = RavagerBody.HitSound; NPC.DeathSound = RavagerBody.LimbLossSound; @@ -297,9 +296,9 @@ namespace CalamityMod.NPCs.Ravager drawPositionY += 12f; drawPositionX += 28f; Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Height)), color, rotation, - new Vector2(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Width * 0.5f, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(RavagerBody.ChainTexture.Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), + new Rectangle?(new Rectangle(0, 0, RavagerBody.ChainTexture.Value.Width, RavagerBody.ChainTexture.Value.Height)), color, rotation, + new Vector2(RavagerBody.ChainTexture.Value.Width * 0.5f, RavagerBody.ChainTexture.Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } return true; diff --git a/NPCs/Ravager/RavagerHead.cs b/NPCs/Ravager/RavagerHead.cs index 110acd3552..b0ff5f487d 100644 --- a/NPCs/Ravager/RavagerHead.cs +++ b/NPCs/Ravager/RavagerHead.cs @@ -32,7 +32,6 @@ namespace CalamityMod.NPCs.Ravager AIType = -1; NPC.netAlways = true; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.alpha = 255; NPC.HitSound = RavagerBody.HitSound; diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index 3574de8db4..ccaa1b8db8 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -32,7 +32,6 @@ namespace CalamityMod.NPCs.Ravager AIType = -1; NPC.netAlways = true; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.HitSound = RavagerBody.HitSound; NPC.DeathSound = RavagerBody.LimbLossSound; diff --git a/NPCs/Ravager/RavagerLegLeft.cs b/NPCs/Ravager/RavagerLegLeft.cs index 3d86d0d59c..9c1c8355b5 100644 --- a/NPCs/Ravager/RavagerLegLeft.cs +++ b/NPCs/Ravager/RavagerLegLeft.cs @@ -28,7 +28,6 @@ namespace CalamityMod.NPCs.Ravager AIType = -1; NPC.netAlways = true; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.alpha = 255; NPC.HitSound = RavagerBody.HitSound; diff --git a/NPCs/Ravager/RavagerLegRight.cs b/NPCs/Ravager/RavagerLegRight.cs index aca0683f79..01ba1268f8 100644 --- a/NPCs/Ravager/RavagerLegRight.cs +++ b/NPCs/Ravager/RavagerLegRight.cs @@ -28,7 +28,6 @@ namespace CalamityMod.NPCs.Ravager AIType = -1; NPC.netAlways = true; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.alpha = 255; NPC.HitSound = RavagerBody.HitSound; diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index 0cf9a90c1d..7f274230b6 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -2,6 +2,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -26,7 +27,6 @@ namespace CalamityMod.NPCs.Ravager NPC.defense = 50; NPC.DR_NERD(0.3f); NPC.chaseable = false; - NPC.canGhostHeal = false; NPC.lifeMax = DownedBossSystem.downedProvidence ? 20000 : 5000; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); @@ -96,7 +96,7 @@ namespace CalamityMod.NPCs.Ravager // Set damage if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) - NPC.damage = (int)(NPC.defDamage * 1.5); + NPC.damage = (int)Math.Round(NPC.defDamage * 1.5); else NPC.damage = NPC.defDamage; @@ -112,7 +112,7 @@ namespace CalamityMod.NPCs.Ravager { // Set damage if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) - NPC.damage = (int)(NPC.defDamage * 1.5); + NPC.damage = (int)Math.Round(NPC.defDamage * 1.5); else NPC.damage = NPC.defDamage; diff --git a/NPCs/Signus/CosmicLantern.cs b/NPCs/Signus/CosmicLantern.cs index 469445932f..b3ba7cb89d 100644 --- a/NPCs/Signus/CosmicLantern.cs +++ b/NPCs/Signus/CosmicLantern.cs @@ -4,6 +4,7 @@ using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -13,11 +14,17 @@ namespace CalamityMod.NPCs.Signus { public class CosmicLantern : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -36,7 +43,6 @@ namespace CalamityMod.NPCs.Signus NPC.noGravity = true; NPC.dontTakeDamage = true; NPC.chaseable = false; - NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.HitSound = SoundID.NPCHit53; NPC.DeathSound = SoundID.NPCDeath44; @@ -147,7 +153,7 @@ namespace CalamityMod.NPCs.Signus drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Signus/CosmicLanternGlow").Value; + texture2D15 = GlowTexture.Value; Color cyanLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 6580066581..d147dba5a8 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -18,6 +18,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -37,6 +38,12 @@ namespace CalamityMod.NPCs.Signus private int lifeToAlpha = 0; private int stealthTimer = 0; + public static Asset AltTexture; + public static Asset AltTexture2; + public static Asset Texture_Glow; + public static Asset AltTexture_Glow; + public static Asset AltTexture2_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -52,6 +59,14 @@ namespace CalamityMod.NPCs.Signus value.Position.Y += 10f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + AltTexture_Glow = ModContent.Request(Texture + "AltGlow", AssetRequestMode.AsyncLoad); + AltTexture2_Glow = ModContent.Request(Texture + "Alt2Glow", AssetRequestMode.AsyncLoad); + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + AltTexture2 = ModContent.Request(Texture + "Alt2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -794,7 +809,7 @@ namespace CalamityMod.NPCs.Signus public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D NPCTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusGlow").Value; + Texture2D glowMaskTexture = Texture_Glow.Value; SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) @@ -806,8 +821,8 @@ namespace CalamityMod.NPCs.Signus if (NPC.ai[0] == 4f) { - NPCTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAlt2").Value; - glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAlt2Glow").Value; + NPCTexture = AltTexture2.Value; + glowMaskTexture = AltTexture2_Glow.Value; afterimageAmt = 10; int frameY = 94 * (int)(NPC.frameCounter / 12.0); if (frameY >= 94 * 6) @@ -816,14 +831,14 @@ namespace CalamityMod.NPCs.Signus } else if (NPC.ai[0] == 3f) { - NPCTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAlt").Value; - glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAltGlow").Value; + NPCTexture = AltTexture.Value; + glowMaskTexture = AltTexture_Glow.Value; afterimageAmt = 7; } else { NPCTexture = TextureAssets.Npc[NPC.type].Value; - glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusGlow").Value; + glowMaskTexture = Texture_Glow.Value; } Vector2 halfSizeTexture = new Vector2(NPCTexture.Width / 2, NPCTexture.Height / frameCount / 2); diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn.cs b/NPCs/SlimeGod/CorruptSlimeSpawn.cs index 99b8bda2ff..b3f43e7cbd 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn.cs @@ -39,7 +39,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs index 3397364739..9842a5070c 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs @@ -38,7 +38,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs index 01ef58a863..14e3462383 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs @@ -37,7 +37,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs index bd512d28b5..cec25e0cb4 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs @@ -41,7 +41,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; diff --git a/NPCs/SlimeGod/CrimulanPaladin.cs b/NPCs/SlimeGod/CrimulanPaladin.cs index e040f74140..413cb4f9df 100644 --- a/NPCs/SlimeGod/CrimulanPaladin.cs +++ b/NPCs/SlimeGod/CrimulanPaladin.cs @@ -364,8 +364,8 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 1f) { - // Set damage - NPC.damage = setDamage; + // Avoid cheap bullshit + NPC.damage = 0; NPC.noTileCollide = true; NPC.noGravity = true; diff --git a/NPCs/SlimeGod/EbonianPaladin.cs b/NPCs/SlimeGod/EbonianPaladin.cs index 065562ca21..376d439082 100644 --- a/NPCs/SlimeGod/EbonianPaladin.cs +++ b/NPCs/SlimeGod/EbonianPaladin.cs @@ -404,8 +404,8 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 2f) { - // Set damage - NPC.damage = setDamage; + // Avoid cheap bullshit + NPC.damage = 0; NPC.noTileCollide = true; NPC.noGravity = true; diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index d4bfb8d592..5d056efafb 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -22,6 +22,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -43,10 +44,16 @@ namespace CalamityMod.NPCs.SlimeGod public static readonly SoundStyle ShotSound = new("CalamityMod/Sounds/Custom/SlimeGodShot", 2); public static readonly SoundStyle BigShotSound = new("CalamityMod/Sounds/Custom/SlimeGodBigShot", 2); + public static Asset EyeTexture; + public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + EyeTexture = ModContent.Request("CalamityMod/NPCs/SlimeGod/SlimeGodEyes", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -549,7 +556,7 @@ namespace CalamityMod.NPCs.SlimeGod Color drawColorAlpha = NPC.GetAlpha(drawColor); Color colorLightingArea = Lighting.GetColor((int)((double)NPC.position.X + (double)NPC.width * 0.5) / 16, (int)(((double)NPC.position.Y + (double)NPC.height * 0.5) / 16.0)); Texture2D texture2D3 = TextureAssets.Npc[NPC.type].Value; - Texture2D pog = ModContent.Request("CalamityMod/NPCs/SlimeGod/SlimeGodEyes").Value; + Texture2D pog = EyeTexture.Value; int frameTexture = TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type]; int y3 = frameTexture * (int)NPC.frameCounter; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, frameTexture); diff --git a/NPCs/SlimeGod/SplitCrimulanPaladin.cs b/NPCs/SlimeGod/SplitCrimulanPaladin.cs index 6e9a7fa330..18522dc08e 100644 --- a/NPCs/SlimeGod/SplitCrimulanPaladin.cs +++ b/NPCs/SlimeGod/SplitCrimulanPaladin.cs @@ -348,8 +348,8 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 1f) { - // Set damage - NPC.damage = setDamage; + // Avoid cheap bullshit + NPC.damage = 0; NPC.noTileCollide = true; NPC.noGravity = true; diff --git a/NPCs/SlimeGod/SplitEbonianPaladin.cs b/NPCs/SlimeGod/SplitEbonianPaladin.cs index a0bdea08cc..e1c22feb9a 100644 --- a/NPCs/SlimeGod/SplitEbonianPaladin.cs +++ b/NPCs/SlimeGod/SplitEbonianPaladin.cs @@ -391,8 +391,8 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 2f) { - // Set damage - NPC.damage = setDamage; + // Avoid cheap bullshit + NPC.damage = 0; NPC.noTileCollide = true; NPC.noGravity = true; diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index c81508e3e7..aa04081067 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -15,12 +16,18 @@ namespace CalamityMod.NPCs.StormWeaver { public class StormWeaverBody : ModNPC { + public static Asset Phase2Texture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.StormWeaverHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request(Texture + "Naked", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -51,7 +58,6 @@ namespace CalamityMod.NPCs.StormWeaver NPC.noGravity = true; NPC.boss = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.netAlways = true; NPC.dontCountMe = true; @@ -278,7 +284,7 @@ namespace CalamityMod.NPCs.StormWeaver if (!phase3) chargePhaseGateValue *= 0.5f; - Texture2D texture = phase2 ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverBodyNaked").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture = phase2 ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / 2); float chargeTelegraphTime = 120f; float chargeTelegraphGateValue = chargePhaseGateValue - chargeTelegraphTime; diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 8336c42470..da887174c3 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -20,6 +20,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -55,6 +56,8 @@ namespace CalamityMod.NPCs.StormWeaver private float lightningDecay = 1f; private float lightningSpeed = 0f; + public static Asset Phase2Texture; + public override void SetStaticDefaults() { NPCID.Sets.TrailingMode[NPC.type] = 1; @@ -71,6 +74,10 @@ namespace CalamityMod.NPCs.StormWeaver value.Position.Y += 55; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request(Texture + "Naked", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -771,12 +778,12 @@ namespace CalamityMod.NPCs.StormWeaver float minimalDamageVelocity = velocity * 0.5f; if (NPC.velocity.Length() <= minimalContactDamageVelocity) { - NPC.damage = (int)(NPC.defDamage * 0.5f); + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); } else { float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); } NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; @@ -838,7 +845,7 @@ namespace CalamityMod.NPCs.StormWeaver if (!phase3) chargePhaseGateValue *= 0.5f; - Texture2D texture = phase2 ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverHeadNaked").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture = phase2 ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / 2); float chargeTelegraphTime = 120f; float chargeTelegraphGateValue = chargePhaseGateValue - chargeTelegraphTime; diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 53648c08dd..c92a9af2cf 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -4,6 +4,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -16,12 +17,20 @@ namespace CalamityMod.NPCs.StormWeaver { private int invinceTime = 180; + public static Asset Phase2Texture; + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.StormWeaverHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request(Texture + "Naked", AssetRequestMode.AsyncLoad); + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -48,7 +57,6 @@ namespace CalamityMod.NPCs.StormWeaver NPC.noGravity = true; NPC.boss = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.netAlways = true; NPC.dontCountMe = true; @@ -272,7 +280,7 @@ namespace CalamityMod.NPCs.StormWeaver if (!phase3) chargePhaseGateValue *= 0.5f; - Texture2D texture = phase2 ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverTailNaked").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture = phase2 ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / 2); float chargeTelegraphTime = 120f; float chargeTelegraphGateValue = chargePhaseGateValue - chargeTelegraphTime; @@ -291,7 +299,7 @@ namespace CalamityMod.NPCs.StormWeaver if (!phase2) { - texture = ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverTailGlow").Value; + texture = GlowTexture.Value; Color rainbowBecauseWhyTheFuckNot = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); Color drawColorAlpha37 = Color.Lerp(Color.White, rainbowBecauseWhyTheFuckNot, 0.5f); spriteBatch.Draw(texture, drawLocation, NPC.frame, drawColorAlpha37, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/SunkenSea/BabyGhostBell.cs b/NPCs/SunkenSea/BabyGhostBell.cs index 1bd4185f5c..812fa36cc2 100644 --- a/NPCs/SunkenSea/BabyGhostBell.cs +++ b/NPCs/SunkenSea/BabyGhostBell.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Fishing.SunkenSeaCatches; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -17,11 +18,17 @@ namespace CalamityMod.NPCs.SunkenSea { public bool hasBeenHit = false; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; Main.npcCatchable[NPC.type] = true; NPCID.Sets.CountsAsCritter[NPC.type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -144,10 +151,10 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/SunkenSea/BlindedAngler.cs b/NPCs/SunkenSea/BlindedAngler.cs index f94f36cdb3..d07b9c9fe4 100644 --- a/NPCs/SunkenSea/BlindedAngler.cs +++ b/NPCs/SunkenSea/BlindedAngler.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -16,9 +17,15 @@ namespace CalamityMod.NPCs.SunkenSea { public class BlindedAngler : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -92,10 +99,10 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/BlindedAnglerGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/BlindedAnglerGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/BlindedAnglerGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index d4ba2fc0ea..285dec213a 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -16,12 +17,18 @@ namespace CalamityMod.NPCs.SunkenSea { public bool hasBeenHit = false; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.X += 24f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -184,10 +191,10 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/EutrophicRayGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/EutrophicRayGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/EutrophicRayGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/SunkenSea/GhostBell.cs b/NPCs/SunkenSea/GhostBell.cs index 414e9c4f72..0022e332fd 100644 --- a/NPCs/SunkenSea/GhostBell.cs +++ b/NPCs/SunkenSea/GhostBell.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -18,9 +19,15 @@ namespace CalamityMod.NPCs.SunkenSea { public bool hasBeenHit = false; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -145,10 +152,10 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/GhostBellGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/GhostBellGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/GhostBellGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index 469a66bf67..0200fdffbe 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -16,10 +16,10 @@ using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; -using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; @@ -37,6 +37,8 @@ namespace CalamityMod.NPCs.SunkenSea private bool hasBeenHit = false; private bool hide = false; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 12; @@ -47,6 +49,10 @@ namespace CalamityMod.NPCs.SunkenSea }; value.Position.Y += 40f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -266,7 +272,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.netUpdate = true; NPC.noGravity = false; attack = -1; - SoundEngine.PlaySound(SlamSound, NPC.position); + SoundEngine.PlaySound(SlamSound, NPC.Center); if (Main.netMode != NetmodeID.Server) { for (int stompDustArea = (int)NPC.position.X - 30; stompDustArea < (int)NPC.position.X + NPC.width + 60; stompDustArea += 30) @@ -363,7 +369,7 @@ namespace CalamityMod.NPCs.SunkenSea } else if (attack == 2) { - SoundEngine.PlaySound(SoundID.Item67, NPC.position); + SoundEngine.PlaySound(SoundID.Item67, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 clamPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); @@ -394,7 +400,7 @@ namespace CalamityMod.NPCs.SunkenSea } else if (attack == 3) { - SoundEngine.PlaySound(SoundID.Item68, NPC.position); + SoundEngine.PlaySound(SoundID.Item68, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { int damage = Main.masterMode ? 23 : Main.expertMode ? 28 : 35; @@ -515,7 +521,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D texture = ModContent.Request(Texture).Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/SunkenSea/GiantClamGlow").Value; + Texture2D glowmask = GlowTexture.Value; SpriteEffects spriteEffects = SpriteEffects.None; Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[NPC.type] / 2)); diff --git a/NPCs/SunkenSea/PrismBack.cs b/NPCs/SunkenSea/PrismBack.cs index beca68a2f3..037b2c6d94 100644 --- a/NPCs/SunkenSea/PrismBack.cs +++ b/NPCs/SunkenSea/PrismBack.cs @@ -6,6 +6,7 @@ using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -13,10 +14,14 @@ using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; +using ReLogic.Content; + namespace CalamityMod.NPCs.SunkenSea { public class PrismBack : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; @@ -26,6 +31,10 @@ namespace CalamityMod.NPCs.SunkenSea }; value.Position.X += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -85,26 +94,26 @@ namespace CalamityMod.NPCs.SunkenSea } else if (CalamityWorld.revenge) { - NPC.damage = (int)(NPC.defDamage * 2.75); + NPC.damage = (int)Math.Round(NPC.defDamage * 2.75); } else if (Main.expertMode) { - NPC.damage = (int)(NPC.defDamage * 2.5); + NPC.damage = (int)Math.Round(NPC.defDamage * 2.5); } else { - NPC.damage = (int)(NPC.defDamage * 1.25); + NPC.damage = (int)Math.Round(NPC.defDamage * 1.25); } } else { if (CalamityWorld.death) { - NPC.damage = (int)(NPC.defDamage * 2.5); + NPC.damage = (int)Math.Round(NPC.defDamage * 2.5); } else if (CalamityWorld.revenge) { - NPC.damage = (int)(NPC.defDamage * 2.25); + NPC.damage = (int)Math.Round(NPC.defDamage * 2.25); } else if (Main.expertMode) { @@ -137,10 +146,10 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/PrismBackGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/PrismBackGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Blue); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/PrismBackGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/SupremeCalamitas/BrimstoneHeart.cs b/NPCs/SupremeCalamitas/BrimstoneHeart.cs index e6d54584b3..fd529f0e33 100644 --- a/NPCs/SupremeCalamitas/BrimstoneHeart.cs +++ b/NPCs/SupremeCalamitas/BrimstoneHeart.cs @@ -37,7 +37,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.alpha = 255; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.hide = true; NPC.HitSound = SoundID.NPCHit13; NPC.DeathSound = SoundID.NPCDeath1; diff --git a/NPCs/SupremeCalamitas/HoodedHeadIcon.png b/NPCs/SupremeCalamitas/HoodedHeadIcon.png index 9fa8485791..131e3fc850 100644 Binary files a/NPCs/SupremeCalamitas/HoodedHeadIcon.png and b/NPCs/SupremeCalamitas/HoodedHeadIcon.png differ diff --git a/NPCs/SupremeCalamitas/HoodedHeadIconP2.png b/NPCs/SupremeCalamitas/HoodedHeadIconP2.png deleted file mode 100644 index b58cdcfaad..0000000000 Binary files a/NPCs/SupremeCalamitas/HoodedHeadIconP2.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/HoodlessHeadIcon.png b/NPCs/SupremeCalamitas/HoodlessHeadIcon.png index 6c12e09c8e..eba5d41efc 100644 Binary files a/NPCs/SupremeCalamitas/HoodlessHeadIcon.png and b/NPCs/SupremeCalamitas/HoodlessHeadIcon.png differ diff --git a/NPCs/SupremeCalamitas/HoodlessHeadIconP2.png b/NPCs/SupremeCalamitas/HoodlessHeadIconP2.png deleted file mode 100644 index dc1377a577..0000000000 Binary files a/NPCs/SupremeCalamitas/HoodlessHeadIconP2.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SepulcherArm.cs b/NPCs/SupremeCalamitas/SepulcherArm.cs index 10eebb093d..0897d65b50 100644 --- a/NPCs/SupremeCalamitas/SepulcherArm.cs +++ b/NPCs/SupremeCalamitas/SepulcherArm.cs @@ -2,6 +2,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -59,10 +60,19 @@ namespace CalamityMod.NPCs.SupremeCalamitas } public Player Target => Main.player[NPC.target]; public SepulcherArmLimb[] Limbs = new SepulcherArmLimb[4]; + + public static Asset HandTexture; + public static Asset ForearmTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SepulcherHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + HandTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SepulcherHand", AssetRequestMode.AsyncLoad); + ForearmTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SepulcherForearm", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -177,8 +187,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor_Unused) { Texture2D armTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D foreArmTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SepulcherForearm").Value; - Texture2D handTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SepulcherHand").Value; + Texture2D foreArmTexture = ForearmTexture.Value; + Texture2D handTexture = HandTexture.Value; Vector2 forearmDrawPosition = Limbs[0].Center - screenPos; Color drawColor = Lighting.GetColor((int)(Limbs[0].Center.X / 16), (int)(Limbs[0].Center.Y / 16)); diff --git a/NPCs/SupremeCalamitas/SepulcherBody.cs b/NPCs/SupremeCalamitas/SepulcherBody.cs index 050a3bd6cb..a5be1ff57c 100644 --- a/NPCs/SupremeCalamitas/SepulcherBody.cs +++ b/NPCs/SupremeCalamitas/SepulcherBody.cs @@ -2,6 +2,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -16,9 +17,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas public NPC AheadSegment => Main.npc[(int)NPC.ai[1]]; public NPC HeadSegment => Main.npc[(int)NPC.ai[2]]; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SepulcherHead.DisplayName"); + + public static Asset AltTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -121,7 +129,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = NPC.localAI[3] / 2f % 2f == 0f ? ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SepulcherBodyAlt").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = NPC.localAI[3] / 2f % 2f == 0f ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; diff --git a/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs b/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs index c09efa7317..9de3d33579 100644 --- a/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs +++ b/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs @@ -18,6 +18,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public NPC AheadSegment => Main.npc[(int)NPC.ai[1]]; public NPC HeadSegment => Main.npc[(int)NPC.ai[2]]; public ref float AttackTimer => ref NPC.localAI[0]; + public int NoStartAttack = 240; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SepulcherHead.DisplayName"); public override void SetStaticDefaults() { @@ -66,6 +67,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { + NoStartAttack--; + if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -105,7 +108,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas AttackTimer += BossRushEvent.BossRushActive ? 1.5f : 1f; float attackgate = !HeadSegment.Calamity().unbreakableDR && Main.zenithWorld ? 450f : 900f; - if (AttackTimer >= attackgate) + if (AttackTimer >= attackgate && NoStartAttack <= 0) { AttackTimer = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -118,11 +121,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer); + //Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer); } NPC.netUpdate = true; } - SoundEngine.PlaySound(SupremeCalamitas.BrimstoneShotSound, NPC.Center); + //SoundEngine.PlaySound(SupremeCalamitas.BrimstoneShotSound, NPC.Center); } if (Main.npc.IndexInRange((int)NPC.ai[1])) diff --git a/NPCs/SupremeCalamitas/SepulcherHead.cs b/NPCs/SupremeCalamitas/SepulcherHead.cs index 9c9daebdb7..2031b3eca4 100644 --- a/NPCs/SupremeCalamitas/SepulcherHead.cs +++ b/NPCs/SupremeCalamitas/SepulcherHead.cs @@ -1,6 +1,8 @@ using System; using System.IO; using CalamityMod.Events; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -10,6 +12,7 @@ using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; +using static Humanizer.In; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -21,6 +24,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas private const int maxLength = 52; private float passedVar = 0f; private bool TailSpawned = false; + private float AttackCooldown = 0; public override void SetStaticDefaults() { @@ -94,6 +98,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { + if (AttackCooldown > 0) + AttackCooldown--; CalamityGlobalNPC.SCalWorm = NPC.whoAmI; // Get a target @@ -187,15 +193,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; + return; } else NPC.Opacity = MathHelper.Clamp(NPC.Opacity + 0.165f, 0f, 1f); Vector2 segmentLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); - float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); - float sepMaxSpeed = BossRushEvent.BossRushActive ? 12.5f : 10f; - float sepAcceleration = BossRushEvent.BossRushActive ? 0.125f : 0.1f; + float targetX = CalamityGlobalNPC.SCal < 0 ? 0 : Main.npc[CalamityGlobalNPC.SCal].position.X + (Main.player[NPC.target].width / 2); + float targetY = CalamityGlobalNPC.SCal < 0 ? 0 : Main.npc[CalamityGlobalNPC.SCal].position.Y + (Main.player[NPC.target].height / 2); + float sepMaxSpeed = BossRushEvent.BossRushActive ? 22.5f : 20f; + float sepAcceleration = (BossRushEvent.BossRushActive ? 0.2f : 0.175f) + (0.37f - AttackCooldown * 0.0015f); float fasterMaxSpeed = sepMaxSpeed * 1.3f; float slowerMaxSpeed = sepMaxSpeed * 0.7f; @@ -321,6 +328,35 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; + float targetDist = Vector2.Distance(NPC.Center, Main.npc[CalamityGlobalNPC.SCal].Center); + if (targetDist <= 110 && AttackCooldown <= 0) + { + AttackCooldown = 150; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = (int)(NPC.GetProjectileDamage(type) * 0.5f); + int totalProjectiles = 30; + float radians = MathHelper.TwoPi / totalProjectiles; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer, 0, 0, 2); + } + NPC.netUpdate = true; + } + Particle bloom = new BloomParticle(NPC.Center, Vector2.Zero, Color.Red, 0.1f, 0.9f, 30, false); + GeneralParticleHandler.SpawnParticle(bloom); + Particle bloom2 = new BloomParticle(NPC.Center, Vector2.Zero, Color.White, 0.1f, 0.8f, 30, false); + GeneralParticleHandler.SpawnParticle(bloom2); + + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(2f, 2f), 0, 0f, 0.9f, 25); + GeneralParticleHandler.SpawnParticle(pulse); + + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/DeadSunRicochet") with { Pitch = -0.65f, Volume = 1.8f }, NPC.Center); + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index 322d95cdd8..b7952b2b69 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -5,12 +5,18 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; +using System.IO; +using Terraria.Audio; +using CalamityMod.Particles; +using Steamworks; +using CalamityMod.Items.Weapons.Summon; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -22,13 +28,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas public Player Target => Main.player[NPC.target]; public Vector2 EyePosition => NPC.Center + new Vector2(NPC.spriteDirection == -1 ? 40f : -36f, 16f); - public ref float RotationalDegreeOffset => ref NPC.ai[1]; public static NPC SCal => Main.npc[CalamityGlobalNPC.SCal]; public const float NormalDR = 0.25f; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -43,6 +50,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas value.Position.X += 12f; value.Position.Y -= 4f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -53,11 +64,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.height = 40; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.damage = 50; NPC.defense = 60; NPC.DR_NERD(NormalDR); - NPC.lifeMax = 14000; + NPC.lifeMax = 28000; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.DeathSound = SoundID.DD2_SkeletonDeath; @@ -144,23 +154,62 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (seeker == NPC) SoundEngine.PlaySound(SupremeCalamitas.BrimstoneShotSound, SCal.Center); + break; } } + if (Main.netMode != NetmodeID.MultiplayerClient) { + float targetDist = Vector2.Distance(Target.Center, NPC.Center); int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - if (BossRushEvent.BossRushActive) - damage /= 2; - Vector2 shootVelocity = (Target.Center - EyePosition).SafeNormalize(Vector2.UnitY) * 9f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), EyePosition, shootVelocity, type, damage, 1f, Main.myPlayer); + if (BossRushEvent.BossRushActive) + damage /= 2; + Vector2 shootVelocity = (Target.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * 5f; + if (targetDist <= 160 || targetDist >= 1952) + { + for (int i = 0; i < 10; i++) + { + Dust failShotDust = Dust.NewDustPerfect(NPC.Center, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(1.3f, 2.4f); + } + } + else + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, shootVelocity * 0.5f, type, damage, 1f, Main.myPlayer, 0, 0, 2); + for (int i = 0; i < 5; i++) + { + Dust ShotDust = Dust.NewDustPerfect(NPC.Center, Main.rand.NextBool(3) ? 60 : 114); + ShotDust.noGravity = true; + ShotDust.velocity = shootVelocity.RotatedByRandom(1f) * Main.rand.NextFloat(2.2f, 3.8f); + ShotDust.scale = Main.rand.NextFloat(1.8f, 2.1f); + } + } } + timer = 0; + NPC.netUpdate = true; } + if (timer == shootRate - 35) + { + Particle pulse = new StaticPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(2f, 2f), 0, 0.03f, 0.005f, 8); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new StaticPulseRing(NPC.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(2f, 2f), 0, 0.025f, 0.005f, 8); + GeneralParticleHandler.SpawnParticle(pulse2); + } + if (timer >= shootRate - 35) + { + Vector2 shootVelocity = (Target.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * 5f; + GlowOrbParticle spark2 = new GlowOrbParticle(NPC.Center + shootVelocity * 7, (shootVelocity * Main.rand.NextFloat(0.6f, 1.1f)) * 1.8f + NPC.velocity * 0.5f, false, 15, Main.rand.NextFloat(0.65f, 0.7f), Main.rand.NextBool() ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); + } - NPC.position = SCal.Center - MathHelper.ToRadians(RotationalDegreeOffset).ToRotationVector2() * 300f - NPC.Size * 0.5f; + float distanceFromSCal = Main.getGoodWorld ? 300f : 225f; + NPC.position = SCal.Center - MathHelper.ToRadians(RotationalDegreeOffset).ToRotationVector2() * distanceFromSCal - NPC.Size * 0.5f; RotationalDegreeOffset += 0.5f; } @@ -212,6 +261,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + Texture2D lineTex = ModContent.Request("CalamityMod/ExtraTextures/LineFade").Value; + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + int shootRate = BossRushEvent.BossRushActive ? 120 : 180; + float opacity = timer >= shootRate - 35 ? (timer - (BossRushEvent.BossRushActive ? 101 : 181)) * 0.03f : 0; + Vector2 lineDir = (NPC.Center - Target.Center).SafeNormalize(Vector2.UnitY); + Vector2 linePos = (lineDir * (lineTex.Height * 0.25f)) + NPC.Center - Main.screenPosition; + spriteBatch.Draw(lineTex, linePos, null, Color.Red * opacity, lineDir.ToRotation(), lineTex.Size(), NPC.scale * 1.5f, SpriteEffects.None, 0f); + Main.spriteBatch.End(); + Main.spriteBatch.Begin(); + SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; @@ -240,7 +300,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SoulSeekerSupremeGlow").Value; + texture2D15 = GlowTexture.Value; Color redLerp = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index a49588e3a7..f141ad4969 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -31,6 +31,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -39,6 +40,12 @@ using Terraria.GameContent.ItemDropRules; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; +using Terraria.GameContent.ItemDropRules; +using ReLogic.Utilities; +using CalamityMod.Projectiles.Ranged; +using Steamworks; +using CalamityMod.Particles; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -188,33 +195,37 @@ namespace CalamityMod.NPCs.SupremeCalamitas public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/SupremeCalamitasSpawn") { Volume = 1.2f }; public static readonly SoundStyle SepulcherSummonSound = new("CalamityMod/Sounds/Custom/SCalSounds/SepulcherSpawn"); public static readonly SoundStyle BrimstoneShotSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneShoot"); + public static readonly SoundStyle BrotherHit = new("CalamityMod/Sounds/Custom/SCalSounds/BrothersHurt", 2); + public static readonly SoundStyle BrotherDeath = new("CalamityMod/Sounds/Custom/SCalSounds/BrothersDeath", 2); public static readonly SoundStyle BrimstoneBigShotSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneBigShoot"); // DON'T YOU WANNA BE A [BIG SHOT] public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/SCalSounds/SCalDash"); public static readonly SoundStyle HellblastSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneHellblastSound"); public static readonly SoundStyle HurtSound = new("CalamityMod/Sounds/NPCHit/ShieldHit", 3); + public static readonly SoundStyle BulletHellSound = new("CalamityMod/Sounds/Custom/SCalSounds/SCalRumble"); + public static readonly SoundStyle BulletHellEndSound = new("CalamityMod/Sounds/Custom/SCalSounds/SCalEndBH"); + public SlotId BulletHellRumbleSlot; + + public static Asset HoodedTexture; + public static Asset CirrusTexture; + public static Asset CirrusTexture2; + public static Asset ShieldTopTexture; + public static Asset ShieldBottomTexture; + public static Asset ForcefieldTexture; // TODO -- This is cumbersome. Change it to be better in 1.4. internal static void LoadHeadIcons() { string hoodedIconPath = "CalamityMod/NPCs/SupremeCalamitas/HoodedHeadIcon"; - string hoodedIconP2Path = "CalamityMod/NPCs/SupremeCalamitas/HoodedHeadIconP2"; string hoodlessIconPath = "CalamityMod/NPCs/SupremeCalamitas/HoodlessHeadIcon"; - string hoodlessIconP2Path = "CalamityMod/NPCs/SupremeCalamitas/HoodlessHeadIconP2"; string cirrusIconPath = "CalamityMod/NPCs/SupremeCalamitas/CirrusHeadIcon"; string cirrusIconP2Path = "CalamityMod/NPCs/SupremeCalamitas/CirrusHeadIcon2"; CalamityMod.Instance.AddBossHeadTexture(hoodedIconPath, -1); hoodedHeadIconIndex = ModContent.GetModBossHeadSlot(hoodedIconPath); - CalamityMod.Instance.AddBossHeadTexture(hoodedIconP2Path, -1); - hoodedHeadIconP2Index = ModContent.GetModBossHeadSlot(hoodedIconP2Path); - CalamityMod.Instance.AddBossHeadTexture(hoodlessIconPath, -1); hoodlessHeadIconIndex = ModContent.GetModBossHeadSlot(hoodlessIconPath); - CalamityMod.Instance.AddBossHeadTexture(hoodlessIconP2Path, -1); - hoodlessHeadIconP2Index = ModContent.GetModBossHeadSlot(hoodlessIconP2Path); - CalamityMod.Instance.AddBossHeadTexture(cirrusIconPath, -1); cirrusHeadIconIndex = ModContent.GetModBossHeadSlot(cirrusIconPath); @@ -233,6 +244,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas }; value.Position.Y += 14f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + HoodedTexture = ModContent.Request(Texture + "Hooded", AssetRequestMode.AsyncLoad); + CirrusTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus", AssetRequestMode.AsyncLoad); + CirrusTexture2 = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus_Shimmered", AssetRequestMode.AsyncLoad); + ShieldTopTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldTop", AssetRequestMode.AsyncLoad); + ShieldBottomTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldBottom", AssetRequestMode.AsyncLoad); + ForcefieldTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/ForcefieldTexture", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -253,7 +273,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.dontTakeDamage = false; NPC.chaseable = true; NPC.boss = true; - NPC.canGhostHeal = false; NPC.noGravity = true; NPC.noTileCollide = true; NPC.Calamity().VulnerableToHeat = false; @@ -279,9 +298,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas else { if (!DownedBossSystem.downedCalamitas || BossRushEvent.BossRushActive) - index = inPhase2 ? hoodedHeadIconP2Index : hoodedHeadIconIndex; + index = hoodedHeadIconIndex; else - index = inPhase2 ? hoodlessHeadIconP2Index : hoodlessHeadIconIndex; + index = hoodlessHeadIconIndex; } } @@ -431,6 +450,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; + // Used for Scal's teleport at the start of brothers phase + bool teleport = false; + // cirrus and zenith scal are mutually exclusive unless it's legendary bool zenithAI = Main.zenithWorld && (!cirrus || (CalamityWorld.LegendaryMode && revenge && cirrus)); @@ -563,6 +585,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas shieldOpacity = MathHelper.Lerp(shieldOpacity, 0f, 0.08f); forcefieldScale = MathHelper.Lerp(forcefieldScale, 1f, 0.08f); } + if (!NPC.dontTakeDamage && willCharge && NPC.ai[1] != 2f) + { + Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f); + velOffset *= Main.rand.NextFloat(2, 13); + + } #endregion #region ArenaCreation @@ -704,6 +732,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Slow down and disappear in a burst of fire if should despawn. if (!player.active || player.dead) { + if (SoundEngine.TryGetActiveSound(BulletHellRumbleSlot, out var rumbleSound) && rumbleSound.IsPlaying) + rumbleSound.Stop(); + canDespawn = true; NPC.Opacity = MathHelper.Lerp(NPC.Opacity, 0f, 0.065f); @@ -756,8 +787,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas horizontalSpawnOffset *= -1f; dustSpawnPosition.X += horizontalSpawnOffset; - Dust magic = Dust.NewDustPerfect(dustSpawnPosition, 267); - magic.color = Color.Lerp(cirrus ? Color.Pink : Color.Red, cirrus ? Color.Violet : Color.Orange, Main.rand.NextFloat(0.8f)); + Dust magic = Dust.NewDustPerfect(dustSpawnPosition, 264); + magic.color = Color.Lerp(cirrus ? Color.Pink : Color.Red, cirrus ? Color.Violet : Color.Lerp(Color.Red, Color.Magenta, 0.3f), Main.rand.NextFloat(0.8f)); magic.noGravity = true; magic.velocity = Vector2.UnitY * -Main.rand.NextFloat(5f, 9f); magic.scale = 1f + NPC.velocity.Y * 0.35f; @@ -788,6 +819,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.chaseable = false; NPC.dontTakeDamage = true; + #region BulletHellEndTelegraphBH1 + if (bulletHellCounter2 == (BulletHellDuration - 360)) + BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); + if (bulletHellCounter2 > (BulletHellDuration - 360)) + { + if (SoundEngine.TryGetActiveSound(BulletHellRumbleSlot, out var BHSound) && BHSound.IsPlaying) + { + BHSound.Position = player.MountedCenter; + } + } + #endregion + if (!canDespawn) NPC.velocity *= 0.95f; @@ -828,32 +871,28 @@ namespace CalamityMod.NPCs.SupremeCalamitas else if (!startBattle) { attackCastDelay = sepulcherSpawnCastTime; - for (int i = 0; i < 40; i++) + + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + GeneralParticleHandler.SpawnParticle(pulse2); + for (int i = 0; i < 100; i++) { - Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); - castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); - castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); - castFire.fadeIn = 1.25f; - castFire.noGravity = true; + Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); + Dust failShotDust = Dust.NewDustPerfect(NPC.Center + dustVel * 3, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); } - NPC.Center = safeBox.TopRight() + new Vector2(-120f, 620f); - - for (int i = 0; i < 40; i++) - { - Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); - castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); - castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); - castFire.fadeIn = 1.25f; - castFire.noGravity = true; - } + SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); SoundEngine.PlaySound(SoundID.DD2_DarkMageCastHeal, player.Center); startBattle = true; } #endregion #region SecondAttack - if (bulletHellCounter2 < SecondBulletHellEndValue && startSecondAttack) + if (bulletHellCounter2 < SecondBulletHellEndValue && startSecondAttack) // Bullet hell lasts 1800 { despawnProj = true; bulletHellCounter2++; @@ -861,6 +900,35 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.chaseable = false; NPC.dontTakeDamage = true; + #region BulletHellEndTelegraphBH2 + if (bulletHellCounter2 == (SecondBulletHellEndValue - 360)) + BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); + if (bulletHellCounter2 > (SecondBulletHellEndValue - 360)) + { + if (SoundEngine.TryGetActiveSound(BulletHellRumbleSlot, out var BHSound) && BHSound.IsPlaying) + { + BHSound.Position = player.MountedCenter; + } + } + if (bulletHellCounter2 == SecondBulletHellEndValue) + { + for (int i = 0; i < 100; i++) + { + Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); + Dust failShotDust = Dust.NewDustPerfect(NPC.Center + dustVel * 3, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); + } + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + GeneralParticleHandler.SpawnParticle(pulse2); + + SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + } + #endregion + if (!canDespawn) NPC.velocity *= 0.95f; @@ -963,6 +1031,35 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.chaseable = false; NPC.dontTakeDamage = true; + #region BulletHellEndTelegraphBH3 + if (bulletHellCounter2 == (ThirdBulletHellEndValue - 360)) + BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); + if (bulletHellCounter2 > (ThirdBulletHellEndValue - 360)) + { + if (SoundEngine.TryGetActiveSound(BulletHellRumbleSlot, out var BHSound) && BHSound.IsPlaying) + { + BHSound.Position = player.MountedCenter; + } + } + if (bulletHellCounter2 == ThirdBulletHellEndValue) + { + for (int i = 0; i < 100; i++) + { + Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); + Dust failShotDust = Dust.NewDustPerfect(NPC.Center + dustVel * 3, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); + } + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + GeneralParticleHandler.SpawnParticle(pulse2); + + SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + } + #endregion + if (cirrus) { Vector2 destination = player.Center; @@ -1059,6 +1156,35 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.chaseable = false; NPC.dontTakeDamage = true; + #region BulletHellEndTelegraphBH4 + if (bulletHellCounter2 == (FourthBulletHellEndValue - 360)) + BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); + if (bulletHellCounter2 > (FourthBulletHellEndValue - 360)) + { + if (SoundEngine.TryGetActiveSound(BulletHellRumbleSlot, out var BHSound) && BHSound.IsPlaying) + { + BHSound.Position = player.MountedCenter; + } + } + if (bulletHellCounter2 == FourthBulletHellEndValue) + { + for (int i = 0; i < 100; i++) + { + Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); + Dust failShotDust = Dust.NewDustPerfect(NPC.Center + dustVel * 3, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); + } + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + GeneralParticleHandler.SpawnParticle(pulse2); + + SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + } + #endregion + if (!canDespawn) NPC.velocity *= 0.95f; @@ -1083,11 +1209,35 @@ namespace CalamityMod.NPCs.SupremeCalamitas int divisor = revenge ? 225 : expertMode ? 450 : 675; - // TODO -- Resprite Brimstone Monsters to be something else. - if (bulletHellCounter2 % divisor == 0 && expertMode) // Giant homing fireballs + Vector2 spawnSpot = safeBox.Center(); + passedVar += 1f; + if (passedVar == 180) // Giant homing fireballs { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 1f * uDieLul, ModContent.ProjectileType(), monsterDamage, 0f, Main.myPlayer, 0f, passedVar); - passedVar += 1f; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SCalAltarSummon") with { Pitch = 0.3f }, player.Center); + for (int i = 0; i < 2; i++) + { + Particle bloom = new BloomParticle(spawnSpot, Vector2.Zero, Color.Lerp(Color.Red, Color.Magenta, 0.3f), 0f, 1.45f, 240, false); + GeneralParticleHandler.SpawnParticle(bloom); + } + Particle bloom2 = new BloomParticle(spawnSpot, Vector2.Zero, Color.White, 0f, 1.35f, 240, false); + GeneralParticleHandler.SpawnParticle(bloom2); + } + if (passedVar == 420) // Giant homing fireballs + { + for (int i = 0; i < 90; i++) + { + Dust spawnDust = Dust.NewDustPerfect(safeBox.Center(), cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); + spawnDust.noGravity = true; + spawnDust.scale = Main.rand.NextFloat(1.2f, 2.3f); + } + for (int i = 0; i < 40; i++) + { + Vector2 sparkVel = new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.1f); + GlowOrbParticle orb = new GlowOrbParticle(safeBox.Center() + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), cirrus ? Color.Magenta : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); + GeneralParticleHandler.SpawnParticle(orb); + } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), monsterDamage, 0f, Main.myPlayer, 0f); } bulletHellCounter++; @@ -1160,6 +1310,35 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.chaseable = false; NPC.dontTakeDamage = true; + #region BulletHellEndTelegraphBH5 + if (bulletHellCounter2 == (FifthBulletHellEndValue - 360)) + BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); + if (bulletHellCounter2 > (FifthBulletHellEndValue - 360)) + { + if (SoundEngine.TryGetActiveSound(BulletHellRumbleSlot, out var BHSound) && BHSound.IsPlaying) + { + BHSound.Position = player.MountedCenter; + } + } + if (bulletHellCounter2 == FifthBulletHellEndValue) + { + for (int i = 0; i < 100; i++) + { + Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); + Dust failShotDust = Dust.NewDustPerfect(NPC.Center + dustVel * 3, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); + } + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + GeneralParticleHandler.SpawnParticle(pulse2); + + SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + } + #endregion + if (cirrus) { Vector2 destination = player.Center; @@ -1360,7 +1539,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Teleport back to the arena on defeat if (giveUpCounter == GiveUpCounterMax) { - Dust.QuickDustLine(NPC.Center, initialRitualPosition, 500f, Color.Red); + Dust.QuickDustLine(NPC.Center, initialRitualPosition, 500f, cirrus ? Color.Pink : Color.Red); NPC.Center = initialRitualPosition; } @@ -1374,7 +1553,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 24; i++) { Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Torch); - brimstoneFire.color = Color.Red; + brimstoneFire.color = cirrus ? Color.Pink : Color.Red; brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); brimstoneFire.fadeIn = 1.25f; @@ -1411,7 +1590,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 24; i++) { Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Torch); - brimstoneFire.color = Color.Red; + brimstoneFire.color = cirrus ? Color.Pink : Color.Red; brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); brimstoneFire.fadeIn = 1.25f; @@ -1513,8 +1692,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas castFire.noGravity = true; } - NPC.Center = safeBox.TopRight() + new Vector2(-120f, 620f); - for (int i = 0; i < 40; i++) { Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); @@ -1549,8 +1726,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas { projectile.ai[1] = 1f; - if (projectile.timeLeft > 60) - projectile.timeLeft = 60; + if (projectile.timeLeft > 15) + projectile.timeLeft = 15; } } } @@ -1558,7 +1735,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } #endregion #region TransformSeekerandBrotherTriggers - if (!halfLife && lifeRatio <= 0.4f) + if (!halfLife && lifeRatio <= 0.45f && hasSummonedBrothers && (cirrus ? NPC.AnyNPCs(ModContent.NPCType()) : (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()))) == false) { if (!bossRush) { @@ -1636,12 +1813,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas else { SoundEngine.PlaySound(SoundID.Item74, NPC.Center); - for (int i = 0; i < 20; i++) + int totalSeekers = Main.getGoodWorld ? 20 : 10; + int degreesBetweenEachSeeker = 360 / totalSeekers; + int distanceFromSCal = Main.getGoodWorld ? 300 : 225; + for (int i = 0; i < totalSeekers; i++) { - int FireEye = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(vectorCenter.X + (Math.Sin(i * 18) * 300)), (int)(vectorCenter.Y + (Math.Cos(i * 18) * 300)), ModContent.NPCType(), NPC.whoAmI, 0, 0, 0, -1); + int FireEye = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(vectorCenter.X + (Math.Sin(i * degreesBetweenEachSeeker) * distanceFromSCal)), (int)(vectorCenter.Y + (Math.Cos(i * degreesBetweenEachSeeker) * distanceFromSCal)), ModContent.NPCType(), NPC.whoAmI, 0, 0, 0, -1); NPC Eye = Main.npc[FireEye]; - Eye.ai[0] = i * 18; - Eye.ai[3] = i * 18; + Eye.ai[0] = i * degreesBetweenEachSeeker; + Eye.ai[3] = i * degreesBetweenEachSeeker; } } } @@ -1662,6 +1842,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas enteredBrothersPhase = true; attackCastDelay = brothersSpawnCastTime; NPC.netUpdate = true; + if (!teleport) + { + Dust.QuickDustLine(NPC.Center, player.Center + new Vector2(0, -155), 500f, cirrus ? Color.Pink : Color.Red); + NPC.velocity = Vector2.Zero; + NPC.Center = player.Center + new Vector2(0, -155); + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + teleport = true; + } } } @@ -1843,15 +2032,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas randomShot = gigablast; SoundEngine.PlaySound(BrimstoneBigShotSound, NPC.Center); - for (int i = 0; i < 15; i++) + for (int i = 0; i < 9; i++) // fireblasts pre laugh { - Dust magic = Dust.NewDustPerfect(projectileSpawn, 264); - magic.velocity = projectileVelocity.RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f); - magic.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - magic.scale = 1.2f; - magic.fadeIn = 0.6f; - magic.noLight = true; - magic.noGravity = true; + Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); + GlowOrbParticle spark2 = new GlowOrbParticle(projectileSpawn + velOffset * 2f, velOffset * 0.7f, false, 30, Main.rand.NextFloat(0.4f, 0.65f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -1860,21 +2045,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.netUpdate = true; } } - else if (randomShot == 1 && canFireSplitingFireball) + else if (randomShot == 1 && canFireSplitingFireball) // Firing gigablast while hovering above pre laugh { canFireSplitingFireball = false; randomShot = fireblast; SoundEngine.PlaySound(BrimstoneShotSound, NPC.Center); - for (int i = 0; i < 20; i++) + for (int i = 0; i < 9; i++) { - Dust magic = Dust.NewDustPerfect(projectileSpawn, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); - magic.velocity = projectileVelocity.RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.3f; - magic.color = cirrus ? Color.Pink : Color.Red; - magic.scale = 1.425f; - magic.fadeIn = 0.75f; - magic.noLight = true; - magic.noGravity = true; + Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); + GlowOrbParticle spark2 = new GlowOrbParticle(projectileSpawn + velOffset * 2f, velOffset * 0.8f, false, 30, Main.rand.NextFloat(0.4f, 0.65f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -1892,18 +2073,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas int numProj = 8; for (int j = 0; j < numProj; j++) { - for (int i = 0; i < 7; i++) + for (int i = 0; i < 6; i++) // Spread dust for pre laugh floating { - Vector2 magicDustVelocity = projectileVelocity; - magicDustVelocity *= MathHelper.Lerp(0.3f, 1f, i / 7f); - - Dust magic = Dust.NewDustPerfect(projectileSpawn, 264); - magic.velocity = magicDustVelocity; - magic.color = cirrus ? Color.Pink : Color.Red; - magic.scale = MathHelper.Lerp(0.85f, 1.5f, i / 7f); - magic.fadeIn = 0.67f; - magic.noLight = true; - magic.noGravity = true; + Vector2 dustVel = (projectileVelocity * 2).RotatedByRandom(0.9) * (Main.rand.NextFloat(0.5f, 1.9f)); + GlowOrbParticle orb = new GlowOrbParticle(projectileSpawn, dustVel, false, 15, Main.rand.NextFloat(0.65f, 0.9f), cirrus ? Color.Magenta : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f)); + GeneralParticleHandler.SpawnParticle(orb); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -1972,6 +2146,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.ai[2] += 1f; + // Bonus visuals + if (!canDespawn && NPC.ai[2] < 23) + { + VoidSparkParticle spark2 = new VoidSparkParticle(NPC.Center + Main.rand.NextVector2Circular(NPC.width, NPC.height) - NPC.velocity * 0.3f, -NPC.velocity.RotatedByRandom(0.15f) * Main.rand.NextFloat(0.9f, 1.2f), false, 9, Main.rand.NextFloat(0.11f, 0.18f) - NPC.ai[2] * 0.0035f, Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); + Dust dashDust = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Circular(NPC.width, NPC.height), 182); + dashDust.noGravity = true; + dashDust.velocity = -NPC.velocity.RotatedByRandom(0.15f) * Main.rand.NextFloat(0.9f, 1.2f); + dashDust.scale = Main.rand.NextFloat(0.3f, 0.6f); + } + if (Math.Abs(NPC.velocity.X) > 0.15f) NPC.spriteDirection = (NPC.velocity.X < 0f).ToDirectionInt(); @@ -2068,16 +2253,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.ai[3] = 0f; SoundEngine.PlaySound(HellblastSound, NPC.Center); - // Release a burst of magic dust along with a brimstone hellblast skull. - for (int i = 0; i < 25; i++) + // Release a burst of magic dust along with a brimstone hellblast skull. (pre laugh) + for (int i = 0; i < 6; i++) { - Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = NPC.DirectionTo(player.Center).RotatedByRandom(0.31f) * Main.rand.NextFloat(3f, 5f) + NPC.velocity; - brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); - brimstoneMagic.noGravity = true; - brimstoneMagic.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - brimstoneMagic.fadeIn = 1.5f; - brimstoneMagic.noLight = true; + Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); + PointParticle spark2 = new PointParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 18, Main.rand.NextFloat(0.4f, 0.65f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -2091,13 +2272,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - if (Main.rand.NextBool()) + if (Main.rand.NextBool()) // Hand spray magic { - Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = Vector2.UnitY.RotatedByRandom(0.14f) * Main.rand.NextFloat(-3.5f, -3f) + NPC.velocity; - brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); - brimstoneMagic.noGravity = true; - brimstoneMagic.noLight = true; + GlowOrbParticle orb = new GlowOrbParticle(handPosition, new Vector2(0, -6).RotatedByRandom(0.4) * Main.rand.NextFloat(0.8f, 1.4f), false, 15, Main.rand.NextFloat(0.85f, 1.2f), cirrus ? Color.Magenta : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); + GeneralParticleHandler.SpawnParticle(orb); } FrameType = FrameAnimationType.OutwardHandCast; @@ -2139,20 +2317,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas FrameChangeSpeed = 0.175f; FrameType = FrameAnimationType.BlastCast; - if (NPC.localAI[1] > shootRate) + if (NPC.localAI[1] > shootRate) // Firing spam projectiles post laugh { Vector2 handPosition = NPC.Center + new Vector2(NPC.spriteDirection * -22f, 2f); - // Release a burst of magic dust when punching. + // Release a burst of magic dust when punching (gigablast). for (int i = 0; i < 25; i++) { - Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = NPC.DirectionTo(player.Center).RotatedByRandom(0.24f) * Main.rand.NextFloat(5f, 7f) + NPC.velocity; - brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); - brimstoneMagic.noGravity = true; - brimstoneMagic.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - brimstoneMagic.fadeIn = 1.5f; - brimstoneMagic.noLight = true; + Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); + GlowOrbParticle spark2 = new GlowOrbParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 9, Main.rand.NextFloat(0.4f, 0.65f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); } NPC.localAI[1] = 0f; @@ -2177,7 +2351,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - if (lifeRatio < 0.4f) + // Previously the 0.4% health threshold transition + if (lifeRatio <= 0.45f && hasSummonedBrothers && (cirrus ? NPC.AnyNPCs(ModContent.NPCType()) : (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()))) == false) { NPC.ai[0] = 1f; NPC.ai[1] = 0f; @@ -2220,8 +2395,20 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.ai[2] = 0f; else { - for (int i = 0; i < 50; i++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + for (int i = 0; i < 90; i++) + { + Dust spawnDust = Dust.NewDustPerfect(NPC.Center, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); + spawnDust.noGravity = true; + spawnDust.scale = Main.rand.NextFloat(1.2f, 2.3f); + } + for (int i = 0; i < 40; i++) + { + Vector2 sparkVel = new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.1f); + GlowOrbParticle orb = new GlowOrbParticle(NPC.Center + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), cirrus ? Color.Magenta : Color.Red, true, true); + GeneralParticleHandler.SpawnParticle(orb); + } + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Magenta : Color.Red, new Vector2(2f, 2f), 0, 0f, 1.1f, 25); + GeneralParticleHandler.SpawnParticle(pulse); SoundEngine.PlaySound(SpawnSound, NPC.Center); } @@ -2410,22 +2597,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.localAI[1] = 0f; int randomShot = Main.rand.Next(6); - if (randomShot == 0 && canFireSplitingFireball) + if (randomShot == 0 && canFireSplitingFireball) // fireblast while floating post laugh { SoundEngine.PlaySound(BrimstoneBigShotSound, NPC.Center); canFireSplitingFireball = false; randomShot = gigablast; - for (int i = 0; i < 16; i++) - { - Dust magic = Dust.NewDustPerfect(projectileSpawn, 264); - magic.velocity = projectileVelocity.RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.2f; - magic.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - magic.scale = 1.3f; - magic.fadeIn = 0.6f; - magic.noLight = true; - magic.noGravity = true; - } + Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1.2f, cirrus ? Color.Pink : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.92f, 0f, 55); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1f, cirrus ? Color.Pink : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.95f, 0.4f, 55); + GeneralParticleHandler.SpawnParticle(pulse2); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -2433,22 +2614,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.netUpdate = true; } } - else if (randomShot == 1 && canFireSplitingFireball) + else if (randomShot == 1 && canFireSplitingFireball) // Gigablast while floating post laugh { SoundEngine.PlaySound(BrimstoneShotSound, NPC.Center); canFireSplitingFireball = false; randomShot = fireblast; - for (int i = 0; i < 24; i++) - { - Dust magic = Dust.NewDustPerfect(projectileSpawn, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); - magic.velocity = projectileVelocity.RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.6f; - magic.color = cirrus ? Color.Pink : Color.Red; - magic.scale = 1.5f; - magic.fadeIn = 0.8f; - magic.noLight = true; - magic.noGravity = true; - } + Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1.2f, cirrus ? Color.Pink : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.95f, 0f, 55); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1f, cirrus ? Color.Pink : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.98f, 0.4f, 55); + GeneralParticleHandler.SpawnParticle(pulse2); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -2465,18 +2640,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas int numProj = 8; for (int j = 0; j < numProj; j++) { - for (int i = 0; i < 7; i++) + for (int i = 0; i < 7; i++) // Spred dust while floating post laugh { - Vector2 magicDustVelocity = projectileVelocity; - magicDustVelocity *= MathHelper.Lerp(0.3f, 1f, i / 7f); - - Dust magic = Dust.NewDustPerfect(projectileSpawn, 264); - magic.velocity = magicDustVelocity; - magic.color = cirrus ? Color.Pink : Color.Red; - magic.scale = MathHelper.Lerp(0.85f, 1.5f, i / 7f); - magic.fadeIn = 0.67f; - magic.noLight = true; - magic.noGravity = true; + Vector2 dustVel = (projectileVelocity * 2).RotatedByRandom(0.9) * (Main.rand.NextFloat(0.5f, 1.9f)); + GlowOrbParticle orb = new GlowOrbParticle(projectileSpawn, dustVel, false, 15, Main.rand.NextFloat(0.75f, 1f), cirrus ? Color.Magenta : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); + GeneralParticleHandler.SpawnParticle(orb); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -2494,6 +2662,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Set damage NPC.damage = NPC.defDamage; + // Bonus visuals + if (!canDespawn && NPC.ai[2] < 23) + { + VoidSparkParticle spark2 = new VoidSparkParticle(NPC.Center + Main.rand.NextVector2Circular(NPC.width, NPC.height) - NPC.velocity * 0.3f, -NPC.velocity.RotatedByRandom(0.15f) * Main.rand.NextFloat(0.9f, 1.2f), false, 9, Main.rand.NextFloat(0.11f, 0.18f) - NPC.ai[2] * 0.0035f, Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); + Dust dashDust = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Circular(NPC.width, NPC.height), 182); + dashDust.noGravity = true; + dashDust.velocity = -NPC.velocity.RotatedByRandom(0.15f) * Main.rand.NextFloat(0.9f, 1.2f); + dashDust.scale = Main.rand.NextFloat(0.3f, 0.6f); + } + float chargeVelocity = (wormAlive ? 26f : 30f) + (1f - lifeRatio) * 8f; if (Main.getGoodWorld) @@ -2612,16 +2791,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.ai[3] = 0f; SoundEngine.PlaySound(HellblastSound, NPC.Center); - // Release a burst of magic dust along with a brimstone hellblast skull. - for (int i = 0; i < 25; i++) + // Release a burst of magic dust along with a brimstone hellblast skull. (post laugh) + for (int i = 0; i < 9; i++) { - Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = NPC.DirectionTo(player.Center).RotatedByRandom(0.31f) * Main.rand.NextFloat(3f, 5f) + NPC.velocity; - brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); - brimstoneMagic.noGravity = true; - brimstoneMagic.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - brimstoneMagic.fadeIn = 1.5f; - brimstoneMagic.noLight = true; + Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); + PointParticle spark2 = new PointParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 9, Main.rand.NextFloat(0.5f, 0.75f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -2635,13 +2810,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - if (Main.rand.NextBool()) + if (Main.rand.NextBool()) // Hand visual post laugh { - Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = Vector2.UnitY.RotatedByRandom(0.14f) * Main.rand.NextFloat(-3.5f, -3f) + NPC.velocity; - brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); - brimstoneMagic.noGravity = true; - brimstoneMagic.noLight = true; + GlowOrbParticle orb = new GlowOrbParticle(handPosition, new Vector2(0, -6).RotatedByRandom(0.4) * Main.rand.NextFloat(0.8f, 1.4f), false, 15, Main.rand.NextFloat(0.95f, 1.45f), cirrus ? Color.Magenta : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); + GeneralParticleHandler.SpawnParticle(orb); } FrameChangeSpeed = 0.245f; @@ -2687,28 +2859,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas FrameType = FrameAnimationType.BlastPunchCast; } - if (NPC.localAI[1] > shootRate) + if (NPC.localAI[1] > shootRate) // small gigablast post laugh { Vector2 handPosition = NPC.Center + new Vector2(NPC.spriteDirection * -22f, 2f); + Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY); + Vector2 projectileSpawn = NPC.Center + projectileVelocity * 8f; // Release a burst of magic dust when punching. - for (int i = 0; i < 25; i++) - { - Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = NPC.DirectionTo(player.Center).RotatedByRandom(0.24f) * Main.rand.NextFloat(5f, 7f) + NPC.velocity; - brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); - brimstoneMagic.noGravity = true; - brimstoneMagic.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - brimstoneMagic.fadeIn = 1.5f; - brimstoneMagic.noLight = true; - } + Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 9, cirrus ? Color.Pink : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.9f, 0f, 60); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 8, cirrus ? Color.Pink : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.93f, 0.4f, 60); + GeneralParticleHandler.SpawnParticle(pulse2); + NPC.localAI[1] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { SoundEngine.PlaySound(BrimstoneBigShotSound, NPC.Center); - Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY); - Vector2 projectileSpawn = NPC.Center + projectileVelocity * 8f; projectileVelocity *= 5f * uDieLul; int projectileType = gigablast; Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, fireblastDamage, 0f, Main.myPlayer); @@ -2745,14 +2912,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas float castCompletion = Utils.GetLerpValue(sepulcherSpawnCastTime - 25f, 0f, attackCastDelay, true); Vector2 armPosition = NPC.Center + Vector2.UnitX * NPC.spriteDirection * -8f; - // Emit dust at the arm position as a sort of magic effect. - Dust magic = Dust.NewDustPerfect(armPosition, 264); - magic.velocity = Vector2.UnitY.RotatedByRandom(0.17f) * -Main.rand.NextFloat(2.7f, 4.1f); - magic.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - magic.noLight = true; - magic.fadeIn = 0.6f; - magic.noGravity = true; - foreach (Vector2 heartSpawnPosition in heartSpawnPositions) { Vector2 leftDustPosition = Vector2.CatmullRom(armPosition + Vector2.UnitY * 1000f, armPosition, heartSpawnPosition, heartSpawnPosition + Vector2.UnitY * 1000f, castCompletion); @@ -2785,7 +2944,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Spawn Dragonfollies if Cirrus exists. for (int i = 0; i < 20; i++) { - Dust castFire = Dust.NewDustPerfect(heartSpawnPosition + Main.rand.NextVector2Square(-30f, 30f), cirrus ? (int)CalamityDusts.Polterplasm : (int)CalamityDusts.Brimstone); + Dust castFire = Dust.NewDustPerfect(heartSpawnPosition + Main.rand.NextVector2Square(-30f, 30f), cirrus ? (int)CalamityDusts.Necroplasm : (int)CalamityDusts.Brimstone); castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); castFire.fadeIn = 1.25f; @@ -2835,7 +2994,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas spawnY = spawnYReset; if (NPC.CountNPCS(ModContent.NPCType()) <= 0) // Check is here for the zenith seed - NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(safeBox.Center().X), (int)(safeBox.Bottom().Y), ModContent.NPCType()); } NPC.netUpdate = true; @@ -2847,6 +3006,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public void DoBrothersSpawningCastAnimation(int bodyWidth, int bodyHeight) { + Player player = Main.player[NPC.target]; + Vector2 leftOfCircle = NPC.Center + Vector2.UnitY * bodyHeight * 0.5f - Vector2.UnitX * bodyWidth * 0.45f; Vector2 rightOfCircle = NPC.Center + Vector2.UnitY * bodyHeight * 0.5f + Vector2.UnitX * bodyWidth * 0.45f; @@ -2857,7 +3018,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.netUpdate = true; } - // Draw some magic dust much like the sandstorm elemental cast that approaches where the brothers will spawn. + // Draw some magic much like the sandstorm elemental cast that approaches where the brothers will spawn. if (attackCastDelay < brothersSpawnCastTime - 45f && attackCastDelay >= 60f) { float castCompletion = Utils.GetLerpValue(brothersSpawnCastTime - 45f, 60f, attackCastDelay); @@ -2865,58 +3026,65 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 leftDustPosition = Vector2.CatmullRom(leftOfCircle + Vector2.UnitY * 1000f, leftOfCircle, catastropheSpawnPosition, catastropheSpawnPosition + Vector2.UnitY * 1000f, castCompletion); Vector2 rightDustPosition = Vector2.CatmullRom(rightOfCircle + Vector2.UnitY * 1000f, rightOfCircle, cataclysmSpawnPosition, cataclysmSpawnPosition + Vector2.UnitY * 1000f, castCompletion); - Dust castMagicDust = Dust.NewDustPerfect(leftDustPosition, 267); - castMagicDust.scale = 1.67f; - castMagicDust.velocity = Main.rand.NextVector2CircularEdge(0.2f, 0.2f); - castMagicDust.color = cirrus ? Color.Pink : Color.Red; - castMagicDust.noGravity = true; - - castMagicDust = Dust.CloneDust(castMagicDust); - castMagicDust.position = rightDustPosition; + GlowOrbParticle orb = new GlowOrbParticle(leftDustPosition, Vector2.Zero, false, 20, 2.8f - attackCastDelay * 0.01f, cirrus ? Color.Pink : Color.Red, true, true); + GeneralParticleHandler.SpawnParticle(orb); + GlowOrbParticle orb2 = new GlowOrbParticle(rightDustPosition, Vector2.Zero, false, 20, 2.8f - attackCastDelay * 0.01f, cirrus ? Color.Pink : Color.Red, true, true); + GeneralParticleHandler.SpawnParticle(orb2); } // Make some magic effects at where the bros will spawn. if (attackCastDelay < 60f) { + if (attackCastDelay == 59) + { + + Particle bloom1 = new BloomParticle(catastropheSpawnPosition, Vector2.Zero, Color.DeepSkyBlue, 0f, 1.4f, 59, false); + GeneralParticleHandler.SpawnParticle(bloom1); + Particle bloom2 = new BloomParticle(catastropheSpawnPosition, Vector2.Zero, Color.DeepSkyBlue, 0f, 1f, 59, false); + GeneralParticleHandler.SpawnParticle(bloom2); + Particle bloom3 = new BloomParticle(cataclysmSpawnPosition, Vector2.Zero, new Color(121, 21, 77), 0f, 1.4f, 59, false); + GeneralParticleHandler.SpawnParticle(bloom3); + Particle bloom4 = new BloomParticle(cataclysmSpawnPosition, Vector2.Zero, new Color(121, 21, 77), 0f, 1f, 59, false); + GeneralParticleHandler.SpawnParticle(bloom4); + } float burnPower = Utils.GetLerpValue(60f, 20f, attackCastDelay); if (attackCastDelay == 0f) burnPower = 4f; - for (int i = 0; i < MathHelper.Lerp(5, 25, burnPower); i++) + for (int i = 0; i < MathHelper.Lerp(1, 6, burnPower); i++) { - Dust fire = Dust.NewDustPerfect(catastropheSpawnPosition + Main.rand.NextVector2Circular(60f, 60f), 264); - fire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 4f); - - if (attackCastDelay == 0) - { - fire.velocity += Main.rand.NextVector2Circular(4f, 4f); - fire.fadeIn = 1.6f; - } - - fire.noGravity = true; - fire.noLight = true; - fire.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - fire.scale = 1.4f + fire.velocity.Y * 0.16f; - - fire = Dust.NewDustPerfect(cataclysmSpawnPosition + Main.rand.NextVector2Circular(60f, 60f), 264); - fire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 4f); - - if (attackCastDelay == 0) - { - fire.velocity += Main.rand.NextVector2Circular(4f, 4f); - fire.fadeIn = 1.6f; - } - - fire.noGravity = true; - fire.noLight = true; - fire.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - fire.scale = 1.4f + fire.velocity.Y * 0.16f; + Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f); + velOffset *= Main.rand.NextFloat(2, 13); + VoidSparkParticle spark1 = new VoidSparkParticle(catastropheSpawnPosition + velOffset * 4.5f, -velOffset * 0.25f, false, 9, Main.rand.NextFloat(0.08f, 0.16f) - attackCastDelay * 0.002f, Main.rand.NextBool(5) ? Color.DeepSkyBlue : Color.Red); + GeneralParticleHandler.SpawnParticle(spark1); + VoidSparkParticle spark2 = new VoidSparkParticle(cataclysmSpawnPosition + velOffset * 4.5f, -velOffset * 0.25f, false, 9, Main.rand.NextFloat(0.08f, 0.16f) - attackCastDelay * 0.002f, Main.rand.NextBool(5) ? new Color(121, 21, 77) : Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); } } // And spawn them. if (attackCastDelay == 0) { + for (int i = 0; i < 30; i++) + { + SparkParticle spark1 = new SparkParticle(catastropheSpawnPosition, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f), false, 35, Main.rand.NextFloat(1.2f, 1.45f), Main.rand.NextBool() ? Color.DeepSkyBlue : Color.Red); + GeneralParticleHandler.SpawnParticle(spark1); + + SparkParticle spark2 = new SparkParticle(cataclysmSpawnPosition, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f), false, 35, Main.rand.NextFloat(1.2f, 1.45f), Main.rand.NextBool() ? new Color(80, 21, 77) : Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); + + Dust catastrophedust = Dust.NewDustPerfect(catastropheSpawnPosition, 279, new Vector2(9, 9).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.5f)); + catastrophedust.noGravity = true; + catastrophedust.scale = Main.rand.NextFloat(1.5f, 1.85f); + catastrophedust.color = Color.DeepSkyBlue; + + Dust cataclysmdust = Dust.NewDustPerfect(cataclysmSpawnPosition, 279, new Vector2(9, 9).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.5f)); + cataclysmdust.noGravity = true; + cataclysmdust.scale = Main.rand.NextFloat(1.5f, 1.85f); + cataclysmdust.color = new Color(80, 21, 77); + + } + if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.Status.Boss.SCalBrothersText"; @@ -2934,7 +3102,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas CalamityUtils.SpawnBossBetter(cataclysmSpawnPosition, cirrus ? ModContent.NPCType() : ModContent.NPCType()); } - SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, NPC.Center); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCKilled/RavagerDeath1") with { Pitch = -0.2f }, cataclysmSpawnPosition); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCKilled/RavagerDeath2") with { Pitch = -0.2f }, catastropheSpawnPosition); hasSummonedBrothers = true; } } @@ -3186,12 +3355,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = DownedBossSystem.downedCalamitas && !BossRushEvent.BossRushActive ? TextureAssets.Npc[NPC.type].Value : ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitasHooded").Value; + Texture2D texture2D15 = DownedBossSystem.downedCalamitas && !BossRushEvent.BossRushActive ? TextureAssets.Npc[NPC.type].Value : HoodedTexture.Value; Texture2D pony = ModContent.Request("CalamityMod/Items/Mounts/AlicornMount_Front").Value; bool inPhase2 = NPC.ai[0] >= 3f && (NPC.life > NPC.lifeMax * 0.01 || cirrus); if (cirrus) - texture2D15 = inPhase2 ? ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus_Shimmered").Value : ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus").Value; + texture2D15 = inPhase2 ? CirrusTexture2.Value : CirrusTexture.Value; Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[NPC.type] / 2f); Vector2 ponyOrigin = new Vector2(pony.Width / 2f, pony.Height / 30f); @@ -3295,17 +3464,19 @@ namespace CalamityMod.NPCs.SupremeCalamitas intensity *= 0.75f; opacity *= 0.75f; - Texture2D forcefieldTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/ForcefieldTexture").Value; + Texture2D forcefieldTexture = ForcefieldTexture.Value; GameShaders.Misc["CalamityMod:SupremeShield"].UseImage1("Images/Misc/Perlin"); Color forcefieldColor = Color.DarkViolet; Color secondaryForcefieldColor = (cirrus ? Color.HotPink : Color.Red) * 1.4f; - if (!NPC.dontTakeDamage && (willCharge || NPC.ai[1] == 2f)) + if (!NPC.dontTakeDamage && willCharge && NPC.ai[1] != 2f) { - forcefieldColor *= 0.25f; - secondaryForcefieldColor = Color.Lerp(secondaryForcefieldColor, Color.Black, 0.7f); + forcefieldColor = Color.Magenta; + secondaryForcefieldColor = Color.Lerp(secondaryForcefieldColor, Color.Lerp(Color.Red, Color.Magenta, 0.3f), 0.7f); } + else + forcefieldColor = Color.DarkViolet; forcefieldColor *= opacity; secondaryForcefieldColor *= opacity; @@ -3335,8 +3506,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas jawRotationOffset += MathHelper.Lerp(0.04f, -0.82f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 17.2f) * 0.5f + 0.5f); Color shieldColor = Color.White * shieldOpacity; - Texture2D shieldSkullTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldTop").Value; - Texture2D shieldJawTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldBottom").Value; + Texture2D shieldSkullTexture = ShieldTopTexture.Value; + Texture2D shieldJawTexture = ShieldBottomTexture.Value; Vector2 drawPosition = NPC.Center + shieldRotation.ToRotationVector2() * 24f - Main.screenPosition; Vector2 jawDrawPosition = drawPosition; SpriteEffects direction = Math.Cos(shieldRotation) > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically; diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.png b/NPCs/SupremeCalamitas/SupremeCalamitas.png index 1040ac0397..3e729e5486 100644 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitas.png and b/NPCs/SupremeCalamitas/SupremeCalamitas.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png b/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png index 23b956ca93..0d99e8edfa 100644 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png and b/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index ebd375f378..dfcf49539c 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -8,6 +8,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -40,6 +41,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public ref float ElapsedVerticalDistance => ref NPC.ai[3]; public ref float AttackDelayTimer => ref NPC.localAI[0]; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 9; @@ -51,6 +54,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas PortraitPositionYOverride = 36f, }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -70,8 +77,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.knockBackResist = 0f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.HitSound = SoundID.DD2_OgreRoar; - NPC.DeathSound = SoundID.NPCDeath52; + NPC.HitSound = SupremeCalamitas.BrotherHit; + NPC.DeathSound = SupremeCalamitas.BrotherDeath; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; } @@ -223,8 +230,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas CurrentFrame = 0; } - // Shoot dart spreads. - fireRate = BossRushEvent.BossRushActive ? 3f : MathHelper.Lerp(1f, 4f, 1f - totalLifeRatio); + // Shoot dart spreads. (Can shoot faster and more darts on death) + fireRate = BossRushEvent.BossRushActive ? 3f : MathHelper.Lerp(1f, death ? 3.5f : 3f, 1f - totalLifeRatio); DartBurstCounter += fireRate; if (DartBurstCounter >= DartBurstCounterLimit) { @@ -237,14 +244,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas damage /= 2; int totalProjectiles = bossRush ? 20 : death ? 16 : revenge ? 14 : expertMode ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = Main.zenithWorld ? 5f : 7f; + float velocity = Main.zenithWorld ? 6f : 2.5f; Vector2 spinningPoint = new Vector2(0f, -velocity); if (Main.netMode != NetmodeID.MultiplayerClient) { for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f, 2); } } @@ -277,7 +284,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 mainDrawPosition = NPC.Center - screenPos; spriteBatch.Draw(texture, mainDrawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCataclysmGlow").Value; + texture = GlowTexture.Value; Color primarycolor = Main.zenithWorld ? Color.Blue : Color.Red; // why? because blue fire is awesome!! Color baseGlowmaskColor = NPC.IsABestiaryIconDummy ? Color.White : Color.Lerp(Color.White, primarycolor, 0.5f); diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 7e25215421..072a29e7b0 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -8,6 +8,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -32,6 +33,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public ref float ElapsedVerticalDistance => ref NPC.ai[3]; public ref float AttackDelayTimer => ref NPC.localAI[0]; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; @@ -43,6 +46,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas PortraitPositionYOverride = 56f, }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -62,8 +69,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.knockBackResist = 0f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.HitSound = SoundID.DD2_OgreRoar; - NPC.DeathSound = SoundID.NPCDeath52; + NPC.HitSound = SupremeCalamitas.BrotherHit; + NPC.DeathSound = SupremeCalamitas.BrotherDeath; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; } @@ -218,8 +225,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas CurrentFrame = 0; } - // Shoot dart spreads. - fireRate = BossRushEvent.BossRushActive ? 3f : MathHelper.Lerp(1f, 4f, 1f - totalLifeRatio); + // Shoot dart spreads. (Can shoot faster and more darts on death) + fireRate = BossRushEvent.BossRushActive ? 3f : MathHelper.Lerp(1f, death ? 3.5f : 3f, 1f - totalLifeRatio); DartBurstCounter += fireRate; if (DartBurstCounter >= DartBurstCounterLimit) { @@ -232,14 +239,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas damage /= 2; int totalProjectiles = bossRush ? 20 : death ? 16 : revenge ? 14 : expertMode ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = Main.zenithWorld ? 5f : 7f; + float velocity = Main.zenithWorld ? 6f : 2.5f; Vector2 spinningPoint = new Vector2(0f, -velocity); if (Main.netMode != NetmodeID.MultiplayerClient) { for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f, 2); } } @@ -272,7 +279,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 mainDrawPosition = NPC.Center - screenPos; spriteBatch.Draw(texture, mainDrawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCatastropheGlow").Value; + texture = GlowTexture.Value; Color baseGlowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.35f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/TownNPCs/AndroombaFriendly.cs b/NPCs/TownNPCs/AndroombaFriendly.cs index b981429ce4..83c3990e31 100644 --- a/NPCs/TownNPCs/AndroombaFriendly.cs +++ b/NPCs/TownNPCs/AndroombaFriendly.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Critters; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -16,6 +17,8 @@ namespace CalamityMod.NPCs.TownNPCs { public class AndroombaFriendly : ModNPC { + public static Asset[] FaceTextures = new Asset[9]; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 9; @@ -26,6 +29,18 @@ namespace CalamityMod.NPCs.TownNPCs value.PortraitPositionYOverride = 36f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.ShimmerTownTransform[Type] = false; + if (!Main.dedServ) + { + FaceTextures[0] = ModContent.Request(Texture + "_Pure", AssetRequestMode.AsyncLoad); + FaceTextures[1] = ModContent.Request(Texture + "_Corruption", AssetRequestMode.AsyncLoad); + FaceTextures[2] = ModContent.Request(Texture + "_Hallow", AssetRequestMode.AsyncLoad); + FaceTextures[3] = ModContent.Request(Texture + "_Mushroom", AssetRequestMode.AsyncLoad); + FaceTextures[4] = ModContent.Request(Texture + "_Crimson", AssetRequestMode.AsyncLoad); + FaceTextures[5] = ModContent.Request(Texture + "_Desert", AssetRequestMode.AsyncLoad); + FaceTextures[6] = ModContent.Request(Texture + "_Snow", AssetRequestMode.AsyncLoad); + FaceTextures[7] = ModContent.Request(Texture + "_Forest", AssetRequestMode.AsyncLoad); + FaceTextures[8] = ModContent.Request(Texture + "_Astral", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -236,41 +251,11 @@ namespace CalamityMod.NPCs.TownNPCs Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.Electric); } + // TODO: Add compatability for crossmod solutions public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - string pathextenstion = "Pure"; - switch (NPC.ai[3]) - { - case 0: - pathextenstion = "Pure"; - break; - case 1: - pathextenstion = "Corruption"; - break; - case 2: - pathextenstion = "Hallow"; - break; - case 3: - pathextenstion = "Mushroom"; - break; - case 4: - pathextenstion = "Crimson"; - break; - case 5: - pathextenstion = "Desert"; - break; - case 6: - pathextenstion = "Snow"; - break; - case 7: - pathextenstion = "Forest"; - break; - case 8: - pathextenstion = "Astral"; - break; - } - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/TownNPCs/AndroombaFriendly_" + pathextenstion).Value; + Texture2D glowmask = FaceTextures[(int)NPC.ai[3]].Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; drawPosition.Y += DrawOffsetY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index d3d1000b8a..43bc9b2541 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -10,6 +10,7 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -28,6 +29,8 @@ namespace CalamityMod.NPCs.TownNPCs [AutoloadHead] public class FAP : ModNPC { + public static Asset AltTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 27; @@ -56,6 +59,10 @@ namespace CalamityMod.NPCs.TownNPCs Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction }; NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -817,7 +824,7 @@ namespace CalamityMod.NPCs.TownNPCs public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { var something = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.Request(Texture + (BirthdayParty.PartyIsUp ? "Alt" : "")).Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, 6f), NPC.frame, drawColor, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); + spriteBatch.Draw(BirthdayParty.PartyIsUp ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, 6f), NPC.frame, drawColor, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); return false; } @@ -914,6 +921,7 @@ namespace CalamityMod.NPCs.TownNPCs .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(1)) .AddWithCustomValue(ItemID.UnicornHorn, Item.buyPrice(0, 2, 50), Condition.HappyEnough, Condition.InHallow) .AddWithCustomValue(ItemID.Milkshake, Item.buyPrice(gold: 5), Condition.HappyEnough, Condition.InHallow, Condition.NpcIsPresent(NPCID.Stylist)) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 25), Condition.HappyEnough, Condition.NpcIsPresent(NPCID.Stylist), Condition.NpcIsPresent(NPCID.BestiaryGirl)) .Register(); } diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/THIEF.cs index b5ea348286..b4500f0395 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/THIEF.cs @@ -7,8 +7,10 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.Events; using Terraria.GameContent.Personalities; @@ -22,6 +24,8 @@ namespace CalamityMod.NPCs.TownNPCs [AutoloadHead] public class THIEF : ModNPC { + public static Asset AltTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 23; @@ -42,6 +46,10 @@ namespace CalamityMod.NPCs.TownNPCs Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction }; NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -237,7 +245,7 @@ namespace CalamityMod.NPCs.TownNPCs public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { var something = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.Request(Texture + (BirthdayParty.PartyIsUp ? "Alt" : "")).Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, 6f), NPC.frame, drawColor, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); + spriteBatch.Draw(BirthdayParty.PartyIsUp ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, 6f), NPC.frame, drawColor, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); return false; } diff --git a/NPCs/TownNPCs/WITCH.png b/NPCs/TownNPCs/WITCH.png index 7c02e35630..7b9a6af20e 100644 Binary files a/NPCs/TownNPCs/WITCH.png and b/NPCs/TownNPCs/WITCH.png differ diff --git a/NPCs/TownNPCs/WITCH_Head.png b/NPCs/TownNPCs/WITCH_Head.png index 8869c7a345..686a9f7aa6 100644 Binary files a/NPCs/TownNPCs/WITCH_Head.png and b/NPCs/TownNPCs/WITCH_Head.png differ diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs index 4f4667d853..b7cc1787cf 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs @@ -303,6 +303,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.ai[2] -= 1f; npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (-chargeVelocity - 2f * enrageScale); + if (masterMode) + npc.velocity *= 1.5f; if (Main.getGoodWorld) npc.velocity *= 1.15f; } @@ -485,7 +487,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] = playerLocation < 0 ? 1f : -1f; npc.ai[2] = 0f; - int maxRandomTime = phase7 ? 30 : 60; + int maxRandomTime = phase7 ? (masterMode ? 10 : 30) : (masterMode ? 20 : 60); npc.ai[3] = Main.rand.Next(maxRandomTime) + 1; npc.localAI[1] = 0f; npc.alpha = 0; @@ -618,7 +620,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] = playerLocation < 0 ? 1f : -1f; npc.ai[2] = 0f; - int maxRandomTime = phase7 ? 30 : 60; + int maxRandomTime = phase7 ? (masterMode ? 10 : 30) : (masterMode ? 20 : 60); npc.ai[3] = Main.rand.Next(maxRandomTime) + 1; } else @@ -671,7 +673,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float targetXDistPhase1 = Main.player[npc.target].Center.X - brainCenterPhase1.X; float targetYDistPhase1 = Main.player[npc.target].Center.Y - brainCenterPhase1.Y; float targetDistancePhase1 = (float)Math.Sqrt(targetXDistPhase1 * targetXDistPhase1 + targetYDistPhase1 * targetYDistPhase1); - float maxMoveVelocity = (death ? 2f : 1f) + velocityScale; + float maxMoveVelocity = (death ? 2f : 1.5f) + velocityScale; if (Main.getGoodWorld) maxMoveVelocity *= 2f; @@ -1139,7 +1141,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float num853 = Main.player[npc.target].Center.X - vector105.X; float num854 = Main.player[npc.target].Center.Y - vector105.Y; float num855 = (float)Math.Sqrt(num853 * num853 + num854 * num854); - float num856 = Main.masterMode ? 1.5f : 1f; + float num856 = Main.masterMode ? 2.5f : 1.5f; if (Main.getGoodWorld) num856 *= 3f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs index eabd910135..3217631da9 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses SoundID.Zombie91 }); - SoundEngine.PlaySound(chantSound, npc.position); + SoundEngine.PlaySound(chantSound, npc.Center); } // Percent life remaining @@ -150,6 +150,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[3] += 1f; npc.velocity = Vector2.Zero; npc.netUpdate = true; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!NPC.AnyNPCs(NPCID.AncientCultistSquidhead)) + NPC.NewNPC(npc.GetSource_FromAI(), (int)Main.projectile[(int)npc.ai[2]].Center.X, (int)Main.projectile[(int)npc.ai[2]].Center.Y, NPCID.AncientCultistSquidhead); + } + Main.projectile[(int)npc.ai[2]].ai[1] = -1f; Main.projectile[(int)npc.ai[2]].netUpdate = true; } @@ -162,7 +169,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.active = false; if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); for (int j = 0; j < Main.maxNPCs; j++) { @@ -173,7 +180,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[j].active = false; if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); } } } @@ -184,7 +191,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spawn and play sound if (npc.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.Zombie89, npc.position); + SoundEngine.PlaySound(SoundID.Zombie89, npc.Center); npc.localAI[0] = 1f; npc.alpha = 255; npc.rotation = 0f; @@ -215,7 +222,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity *= 0.95f; if (npc.localAI[2] != 13f) - SoundEngine.PlaySound(SoundID.Zombie105, npc.position); + SoundEngine.PlaySound(SoundID.Zombie105, npc.Center); npc.localAI[2] = 13f; } @@ -458,7 +465,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 shadowFireballDirection = center3 + new Vector2(npc.direction * 30, 12f); Vector2 shadowFireballVelocity = vec * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); - shadowFireballVelocity = shadowFireballVelocity.RotatedByRandom(0.52359879016876221); + shadowFireballVelocity = shadowFireballVelocity.RotatedByRandom(Math.PI / 6D); Projectile.NewProjectile(npc.GetSource_FromAI(), shadowFireballDirection, shadowFireballVelocity, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); } } @@ -523,7 +530,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 shadowFireballDirection = center4 + new Vector2(npc.direction * 30, 12f); Vector2 shadowFireballVelocity = playerDirection * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); - shadowFireballVelocity = shadowFireballVelocity.RotatedByRandom(0.52359879016876221); + shadowFireballVelocity = shadowFireballVelocity.RotatedByRandom(Math.PI / 6D); Projectile.NewProjectile(npc.GetSource_FromAI(), shadowFireballDirection, shadowFireballVelocity, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); } } @@ -541,7 +548,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 fireballDirection = npc.Center + new Vector2(npc.direction * 30, 12f); Vector2 fireballVelocity = playerDirection * (fireballSpeed + (float)Main.rand.NextDouble() * 4f); - fireballVelocity = fireballVelocity.RotatedByRandom(0.52359879016876221); + fireballVelocity = fireballVelocity.RotatedByRandom(Math.PI / 6D); Projectile.NewProjectile(npc.GetSource_FromAI(), fireballDirection, fireballVelocity, ProjectileID.CultistBossFireBall, fireballDamage, 0f, Main.myPlayer); } } @@ -589,8 +596,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 shadowFireballDirection = center5 + new Vector2(npc.direction * 30, 12f); Vector2 shadowFireballVelocity = playerDirection * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); - shadowFireballVelocity = shadowFireballVelocity.RotatedByRandom(0.52359879016876221); - Projectile.NewProjectile(npc.GetSource_FromAI(), shadowFireballDirection.X, shadowFireballDirection.Y, shadowFireballVelocity.X, shadowFireballVelocity.Y, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); + shadowFireballVelocity = shadowFireballVelocity.RotatedByRandom(Math.PI / 6D); + Projectile.NewProjectile(npc.GetSource_FromAI(), shadowFireballDirection, shadowFireballVelocity, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); } Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y - 100f, 0f, 0f, ProjectileID.CultistBossLightningOrb, lightningDamage, 0f, Main.myPlayer); @@ -674,7 +681,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { int currentClone = list6[-clonesToSpawn - 1]; Main.npc[currentClone].Center = cloneRotation; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, currentClone, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, currentClone); } } } @@ -860,7 +867,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 ancientLightSpeed = playerDirection * scaleFactor; ancientLightSpeed = ancientLightSpeed.RotatedBy(ancientLightSpread * ancientLightInc - (MathHelper.Pi / totalAncientLights * 2f - ancientLightSpread) / 2f); float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * MathHelper.TwoPi / 60f; - int ancientLightProj = NPC.NewNPC(npc.GetSource_FromAI(), (int)ancientLightShootDirection.X, (int)ancientLightShootDirection.Y + 7, NPCID.AncientLight, 0, 0f, ai, ancientLightSpeed.X, ancientLightSpeed.Y, 255); + int ancientLightProj = NPC.NewNPC(npc.GetSource_FromAI(), (int)ancientLightShootDirection.X, (int)ancientLightShootDirection.Y + 7, NPCID.AncientLight, 0, 0f, ai, ancientLightSpeed.X, ancientLightSpeed.Y); Main.npc[ancientLightProj].velocity = ancientLightSpeed; ancientLightInc++; } @@ -989,7 +996,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity = Vector2.Zero; npc.position = npc.oldPosition; - // Kill after 2 seconds + // Kill after 4 seconds npc.ai[1] += 1f; if (npc.ai[1] >= 240f) { @@ -1171,7 +1178,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses darkDust2.noLight = true; } - npc.localAI[0] += 0.05235988f; + npc.localAI[0] += (float)(Math.PI / 60D); npc.localAI[1] = 0.25f + Vector2.UnitY.RotatedBy(npc.ai[1] * MathHelper.TwoPi / 60f).Y * 0.25f; @@ -1206,5 +1213,1179 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } + + public static bool VanillaCultistAI(NPC npc, Mod mod) + { + // Chant sound + if (npc.ai[0] != -1f && Main.rand.NextBool(1000)) + { + SoundStyle chantSound = Utils.SelectRandom(Main.rand, new SoundStyle[] + { + SoundID.Zombie88, + SoundID.Zombie89, + SoundID.Zombie90, + SoundID.Zombie91 + }); + + SoundEngine.PlaySound(chantSound, npc.Center); + } + + bool expertMode = Main.expertMode; + bool masterMode = Main.masterMode; + + bool phase2 = npc.life <= npc.lifeMax / 2; + + int iceMistPhaseTime = masterMode ? 60 : expertMode ? 90 : 120; + if (Main.getGoodWorld) + iceMistPhaseTime -= 30; + + int fireballPhaseTime = Main.getGoodWorld ? 8 : masterMode ? 10 : expertMode ? 12 : 18; + int fireballAmount = Main.getGoodWorld ? 6 : masterMode ? 5 : expertMode ? 4 : 3; + + int lightningOrbPhaseTime = masterMode ? 30 : expertMode ? 40 : 80; + if (Main.getGoodWorld) + lightningOrbPhaseTime -= 20; + + int ancientLightPhaseTime = masterMode ? 40 : expertMode ? 30 : 20; + int ancientLightAmount = masterMode ? 4 : expertMode ? 3 : 2; + + int ancientDoomPhaseTime = masterMode ? 30 : 20; + int ancientDoomAmount = masterMode ? 5 : 3; + + int ritualTimeMax = phase2 ? 240 : 300; + + bool flag2 = npc.type == NPCID.CultistBoss; + bool flag3 = false; + bool flag4 = false; + if (phase2) + npc.defense = (int)Math.Round(npc.defDefense * 0.65); + + if (!flag2) + { + if (npc.ai[3] < 0f || !Main.npc[(int)npc.ai[3]].active || Main.npc[(int)npc.ai[3]].type != NPCID.CultistBoss) + { + npc.life = 0; + npc.HitEffect(); + npc.active = false; + return false; + } + + npc.ai[0] = Main.npc[(int)npc.ai[3]].ai[0]; + npc.ai[1] = Main.npc[(int)npc.ai[3]].ai[1]; + if (npc.ai[0] == 5f) + { + if (npc.justHit) + { + npc.life = 0; + npc.HitEffect(); + npc.active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); + + NPC obj = Main.npc[(int)npc.ai[3]]; + obj.ai[0] = 6f; + obj.ai[1] = 0f; + obj.netUpdate = true; + } + } + else + { + flag3 = true; + flag4 = true; + } + } + else if (npc.ai[0] == 5f && npc.ai[1] >= 120f && npc.ai[1] < ritualTimeMax && npc.justHit) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + List list = new List(); + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == NPCID.CultistBossClone && Main.npc[i].ai[3] == (float)npc.whoAmI) + list.Add(i); + } + + int num9 = expertMode ? 3 : 10; + foreach (int item in list) + { + NPC nPC = Main.npc[item]; + if (nPC.localAI[1] == npc.localAI[1] && num9 > 0) + { + num9--; + nPC.life = 0; + nPC.HitEffect(); + nPC.active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, item); + } + else if (num9 > 0) + { + num9--; + nPC.life = 0; + nPC.HitEffect(); + nPC.active = false; + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (expertMode) + { + if (!NPC.AnyNPCs(NPCID.AncientCultistSquidhead)) + NPC.NewNPC(npc.GetSource_FromAI(), (int)Main.projectile[(int)npc.ai[2]].Center.X, (int)Main.projectile[(int)npc.ai[2]].Center.Y, NPCID.AncientCultistSquidhead); + } + } + + Main.projectile[(int)npc.ai[2]].ai[1] = -1f; + Main.projectile[(int)npc.ai[2]].netUpdate = true; + } + + Vector2 center = npc.Center; + Player player = Main.player[npc.target]; + float num10 = 5600f; + if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active || Vector2.Distance(player.Center, center) > num10) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + npc.netUpdate = true; + } + + if (player.dead || !player.active || Vector2.Distance(player.Center, center) > num10) + { + npc.life = 0; + npc.HitEffect(); + npc.active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); + + new List().Add(npc.whoAmI); + for (int j = 0; j < Main.maxNPCs; j++) + { + if (Main.npc[j].active && Main.npc[j].type == NPCID.CultistBossClone && Main.npc[j].ai[3] == (float)npc.whoAmI) + { + Main.npc[j].life = 0; + Main.npc[j].HitEffect(); + Main.npc[j].active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); + } + } + } + + float num11 = npc.ai[3]; + if (npc.localAI[0] == 0f) + { + SoundEngine.PlaySound(SoundID.Zombie89, npc.Center); + npc.localAI[0] = 1f; + npc.alpha = 255; + npc.rotation = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = -1f; + npc.netUpdate = true; + } + } + + if (npc.ai[0] == -1f) + { + npc.alpha -= 5; + if (npc.alpha < 0) + npc.alpha = 0; + + npc.ai[1] += 1f; + if (npc.ai[1] >= 420f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + else if (npc.ai[1] > 360f) + { + npc.velocity *= 0.95f; + if (npc.localAI[2] != 13f) + SoundEngine.PlaySound(SoundID.Zombie105, npc.Center); + + npc.localAI[2] = 13f; + } + else if (npc.ai[1] > 300f) + { + npc.velocity = -Vector2.UnitY; + npc.localAI[2] = 10f; + } + else if (npc.ai[1] > 120f) + npc.localAI[2] = 1f; + else + npc.localAI[2] = 0f; + + flag3 = true; + flag4 = true; + } + + if (npc.ai[0] == 0f) + { + if (npc.ai[1] == 0f) + npc.TargetClosest(false); + + npc.localAI[2] = 10f; + int num12 = Math.Sign(player.Center.X - center.X); + if (num12 != 0) + npc.direction = (npc.spriteDirection = num12); + + npc.ai[1] += 1f; + if (npc.ai[1] >= 40f && flag2) + { + int num13 = 0; + if (phase2) + { + switch ((int)npc.ai[3]) + { + case 0: + num13 = 0; + break; + case 1: + num13 = 1; + break; + case 2: + num13 = 0; + break; + case 3: + num13 = 5; + break; + case 4: + num13 = 0; + break; + case 5: + num13 = 3; + break; + case 6: + num13 = 0; + break; + case 7: + num13 = 5; + break; + case 8: + num13 = 0; + break; + case 9: + num13 = 2; + break; + case 10: + num13 = 0; + break; + case 11: + num13 = 3; + break; + case 12: + num13 = 0; + break; + case 13: + num13 = 4; + npc.ai[3] = -1f; + break; + default: + npc.ai[3] = -1f; + break; + } + } + else + { + switch ((int)npc.ai[3]) + { + case 0: + num13 = 0; + break; + case 1: + num13 = 1; + break; + case 2: + num13 = 0; + break; + case 3: + num13 = 2; + break; + case 4: + num13 = 0; + break; + case 5: + num13 = 3; + break; + case 6: + num13 = 0; + break; + case 7: + num13 = 1; + break; + case 8: + num13 = 0; + break; + case 9: + num13 = 2; + break; + case 10: + num13 = 0; + break; + case 11: + num13 = 4; + npc.ai[3] = -1f; + break; + default: + npc.ai[3] = -1f; + break; + } + } + + int maxValue = 6; + if (npc.life < npc.lifeMax / 3) + maxValue = 4; + if (npc.life < npc.lifeMax / 4) + maxValue = 3; + if (masterMode) + maxValue--; + + if (expertMode && phase2 && Main.rand.NextBool(maxValue) && num13 != 0 && num13 != 4 && num13 != 5 && NPC.CountNPCS(NPCID.AncientDoom) < 10) + num13 = 6; + + if (num13 == 0) + { + float num14 = (float)Math.Ceiling((player.Center + new Vector2(0f, -100f) - center).Length() / 50f); + if (num14 == 0f) + num14 = 1f; + + List list2 = new List(); + int num15 = 0; + list2.Add(npc.whoAmI); + for (int k = 0; k < Main.maxNPCs; k++) + { + if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == (float)npc.whoAmI) + list2.Add(k); + } + + bool flag5 = list2.Count % 2 == 0; + foreach (int item2 in list2) + { + NPC nPC2 = Main.npc[item2]; + Vector2 center2 = nPC2.Center; + float num16 = (float)((num15 + flag5.ToInt() + 1) / 2) * MathHelper.TwoPi * 0.4f / (float)list2.Count; + if (num15 % 2 == 1) + num16 *= -1f; + + if (list2.Count == 1) + num16 = 0f; + + Vector2 vector = new Vector2(0f, -1f).RotatedBy(num16) * new Vector2(300f, 200f); + Vector2 vector2 = player.Center + vector - center2; + nPC2.ai[0] = 1f; + nPC2.ai[1] = num14 * 2f; + nPC2.velocity = vector2 / num14; + if (npc.whoAmI >= nPC2.whoAmI) + nPC2.position -= nPC2.velocity; + + nPC2.netUpdate = true; + num15++; + } + } + + switch (num13) + { + case 1: + npc.ai[0] = 3f; + npc.ai[1] = 0f; + break; + case 2: + npc.ai[0] = 2f; + npc.ai[1] = 0f; + break; + case 3: + npc.ai[0] = 4f; + npc.ai[1] = 0f; + break; + case 4: + npc.ai[0] = 5f; + npc.ai[1] = 0f; + break; + } + + if (num13 == 5) + { + npc.ai[0] = 7f; + npc.ai[1] = 0f; + } + + if (num13 == 6) + { + npc.ai[0] = 8f; + npc.ai[1] = 0f; + } + + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + flag3 = true; + npc.localAI[2] = 10f; + if ((float)(int)npc.ai[1] % 2f != 0f && npc.ai[1] != 1f) + npc.position -= npc.velocity; + + npc.ai[1] -= 1f; + if (npc.ai[1] <= 0f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + npc.localAI[2] = 11f; + Vector2 vec = Vector2.Normalize(player.Center - center); + if (vec.HasNaNs()) + vec = new Vector2(npc.direction, 0f); + + if (npc.ai[1] >= 4f && flag2 && (int)(npc.ai[1] - 4f) % iceMistPhaseTime == 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + List list3 = new List(); + for (int l = 0; l < Main.maxNPCs; l++) + { + if (Main.npc[l].active && Main.npc[l].type == NPCID.CultistBossClone && Main.npc[l].ai[3] == (float)npc.whoAmI) + list3.Add(l); + } + + foreach (int item3 in list3) + { + NPC nPC3 = Main.npc[item3]; + Vector2 center3 = nPC3.Center; + int num17 = Math.Sign(player.Center.X - center3.X); + if (num17 != 0) + nPC3.direction = (nPC3.spriteDirection = num17); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + vec = Vector2.Normalize(player.Center - center3); + if (vec.HasNaNs()) + vec = new Vector2(npc.direction, 0f); + + Vector2 vector3 = center3 + new Vector2(npc.direction * 30, 12f); + int type = ProjectileID.CultistBossFireBallClone; + float velocity = masterMode ? 10f : expertMode ? 8f : 6f; + Vector2 spinninpoint = vec * (velocity + (float)Main.rand.NextDouble() * 4f); + spinninpoint = spinninpoint.RotatedByRandom(Math.PI / 6D); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector3, spinninpoint, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + } + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + vec = Vector2.Normalize(player.Center - center); + if (vec.HasNaNs()) + vec = new Vector2(npc.direction, 0f); + + Vector2 vector4 = npc.Center + new Vector2(npc.direction * 30, 12f); + int type = ProjectileID.CultistBossIceMist; + int numIceMists = masterMode ? 3 : expertMode ? 2 : 1; + float iceMistVelocity = masterMode ? 8f : expertMode ? 6f : 4f; + for (int n = 0; n < numIceMists; n++) + { + Vector2 vector5 = vec * (iceMistVelocity - n * 2f); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector4, vector5, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, 1f); + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= (float)(4 + iceMistPhaseTime)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 3f) + { + npc.localAI[2] = 11f; + Vector2 vec2 = Vector2.Normalize(player.Center - center); + if (vec2.HasNaNs()) + vec2 = new Vector2(npc.direction, 0f); + + if (npc.ai[1] >= 4f && flag2 && (int)(npc.ai[1] - 4f) % fireballPhaseTime == 0) + { + if ((int)(npc.ai[1] - 4f) / fireballPhaseTime == 2) + { + List list4 = new List(); + for (int num18 = 0; num18 < Main.maxNPCs; num18++) + { + if (Main.npc[num18].active && Main.npc[num18].type == NPCID.CultistBossClone && Main.npc[num18].ai[3] == (float)npc.whoAmI) + list4.Add(num18); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + foreach (int item4 in list4) + { + NPC nPC4 = Main.npc[item4]; + Vector2 center4 = nPC4.Center; + int num19 = Math.Sign(player.Center.X - center4.X); + if (num19 != 0) + nPC4.direction = (nPC4.spriteDirection = num19); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + vec2 = Vector2.Normalize(player.Center - center4); + if (vec2.HasNaNs()) + vec2 = new Vector2(npc.direction, 0f); + + Vector2 vector6 = center4 + new Vector2(npc.direction * 30, 12f); + int type = ProjectileID.CultistBossFireBallClone; + float velocity = masterMode ? 10f : expertMode ? 8f : 6f; + Vector2 spinninpoint2 = vec2 * (velocity + (float)Main.rand.NextDouble() * 4f); + spinninpoint2 = spinninpoint2.RotatedByRandom(Math.PI / 6D); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector6, spinninpoint2, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + } + } + } + } + + int num21 = Math.Sign(player.Center.X - center.X); + if (num21 != 0) + npc.direction = (npc.spriteDirection = num21); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + vec2 = Vector2.Normalize(player.Center - center); + if (vec2.HasNaNs()) + vec2 = new Vector2(npc.direction, 0f); + + Vector2 vector7 = npc.Center + new Vector2(npc.direction * 30, 12f); + int type = ProjectileID.CultistBossFireBall; + float velocity = masterMode ? 10f : expertMode ? 8f : 6f; + double spread = Math.PI / (masterMode ? 4D : expertMode ? 5D : 6D); + Vector2 spinninpoint3 = vec2 * (velocity + (float)Main.rand.NextDouble() * 4f); + spinninpoint3 = spinninpoint3.RotatedByRandom(spread); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector7, spinninpoint3, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= (float)(4 + fireballPhaseTime * fireballAmount)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 4f) + { + if (flag2) + npc.localAI[2] = 12f; + else + npc.localAI[2] = 11f; + + if (npc.ai[1] == 20f && flag2 && Main.netMode != NetmodeID.MultiplayerClient) + { + List list5 = new List(); + for (int num23 = 0; num23 < Main.maxNPCs; num23++) + { + if (Main.npc[num23].active && Main.npc[num23].type == NPCID.CultistBossClone && Main.npc[num23].ai[3] == (float)npc.whoAmI) + list5.Add(num23); + } + + foreach (int item5 in list5) + { + NPC nPC5 = Main.npc[item5]; + Vector2 center5 = nPC5.Center; + int num24 = Math.Sign(player.Center.X - center5.X); + if (num24 != 0) + nPC5.direction = (nPC5.spriteDirection = num24); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector8 = Vector2.Normalize(player.Center - center5); + if (vector8.HasNaNs()) + vector8 = new Vector2(npc.direction, 0f); + + Vector2 vector9 = center5 + new Vector2(npc.direction * 30, 12f); + int type = ProjectileID.CultistBossFireBallClone; + float velocity = masterMode ? 10f : expertMode ? 8f : 6f; + Vector2 spinninpoint4 = vector8 * (velocity + (float)Main.rand.NextDouble() * 4f); + spinninpoint4 = spinninpoint4.RotatedByRandom(Math.PI / 6D); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector9, spinninpoint4, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + } + } + + int type2 = ProjectileID.CultistBossLightningOrb; + if ((int)(npc.ai[1] - 20f) % lightningOrbPhaseTime == 0) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y - 100f, 0f, 0f, type2, npc.GetProjectileDamage(type2), 0f, Main.myPlayer); + + if (masterMode) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + 210f, npc.Center.Y - 210f, 0f, 0f, type2, npc.GetProjectileDamage(type2), 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X - 210f, npc.Center.Y - 210f, 0f, 0f, type2, npc.GetProjectileDamage(type2), 0f, Main.myPlayer); + } + else if (expertMode) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y + 100f, 0f, 0f, type2, npc.GetProjectileDamage(type2), 0f, Main.myPlayer); + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= (float)(20 + lightningOrbPhaseTime)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 5f) + { + npc.localAI[2] = 10f; + if (Vector2.Normalize(player.Center - center).HasNaNs()) + new Vector2(npc.direction, 0f); + + if (npc.ai[1] >= 0f && npc.ai[1] < 30f) + { + flag3 = true; + flag4 = true; + float num26 = (npc.ai[1] - 0f) / 30f; + npc.alpha = (int)(num26 * 255f); + } + else if (npc.ai[1] >= 30f && npc.ai[1] < 90f) + { + if (npc.ai[1] == 30f && Main.netMode != NetmodeID.MultiplayerClient && flag2) + { + npc.localAI[1] += 1f; + Vector2 spinningpoint = new Vector2(180f, 0f); + List list6 = new List(); + for (int num27 = 0; num27 < Main.maxNPCs; num27++) + { + if (Main.npc[num27].active && Main.npc[num27].type == NPCID.CultistBossClone && Main.npc[num27].ai[3] == (float)npc.whoAmI) + list6.Add(num27); + } + + int num28 = 6 - list6.Count; + if (num28 > 2) + num28 = 2; + + int num29 = list6.Count + num28 + 1; + float[] array = new float[num29]; + for (int num30 = 0; num30 < array.Length; num30++) + array[num30] = Vector2.Distance(npc.Center + spinningpoint.RotatedBy((float)num30 * MathHelper.TwoPi / (float)num29 - (float)Math.PI / 2f), player.Center); + + int num31 = 0; + for (int num32 = 1; num32 < array.Length; num32++) + { + if (array[num31] > array[num32]) + num31 = num32; + } + + num31 = ((num31 >= num29 / 2) ? (num31 - num29 / 2) : (num31 + num29 / 2)); + int num33 = num28; + for (int num34 = 0; num34 < array.Length; num34++) + { + if (num31 != num34) + { + Vector2 center6 = npc.Center + spinningpoint.RotatedBy((float)num34 * MathHelper.TwoPi / (float)num29 - (float)Math.PI / 2f); + if (num33-- > 0) + { + int num35 = NPC.NewNPC(npc.GetSource_FromAI(), (int)center6.X, (int)center6.Y + npc.height / 2, NPCID.CultistBossClone, npc.whoAmI); + Main.npc[num35].ai[3] = npc.whoAmI; + Main.npc[num35].netUpdate = true; + Main.npc[num35].localAI[1] = npc.localAI[1]; + } + else + { + int num36 = list6[-num33 - 1]; + Main.npc[num36].Center = center6; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num36); + } + } + } + + npc.ai[2] = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, ProjectileID.CultistRitual, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + npc.Center += spinningpoint.RotatedBy((float)num31 * MathHelper.TwoPi / (float)num29 - (float)Math.PI / 2f); + npc.netUpdate = true; + list6.Clear(); + } + + flag3 = true; + flag4 = true; + npc.alpha = 255; + if (flag2) + { + Vector2 vector10 = Main.projectile[(int)npc.ai[2]].Center; + vector10 -= npc.Center; + if (vector10 == Vector2.Zero) + vector10 = -Vector2.UnitY; + + vector10.Normalize(); + if (Math.Abs(vector10.Y) < 0.77f) + npc.localAI[2] = 11f; + else if (vector10.Y < 0f) + npc.localAI[2] = 12f; + else + npc.localAI[2] = 10f; + + int num37 = Math.Sign(vector10.X); + if (num37 != 0) + npc.direction = (npc.spriteDirection = num37); + } + else + { + Vector2 vector11 = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; + vector11 -= npc.Center; + if (vector11 == Vector2.Zero) + vector11 = -Vector2.UnitY; + + vector11.Normalize(); + if (Math.Abs(vector11.Y) < 0.77f) + npc.localAI[2] = 11f; + else if (vector11.Y < 0f) + npc.localAI[2] = 12f; + else + npc.localAI[2] = 10f; + + int num38 = Math.Sign(vector11.X); + if (num38 != 0) + npc.direction = (npc.spriteDirection = num38); + } + } + else if (npc.ai[1] >= 90f && npc.ai[1] < 120f) + { + flag3 = true; + flag4 = true; + float num39 = (npc.ai[1] - 90f) / 30f; + npc.alpha = 255 - (int)(num39 * 255f); + } + else if (npc.ai[1] >= 120f && npc.ai[1] < ritualTimeMax) + { + flag4 = true; + npc.alpha = 0; + if (flag2) + { + Vector2 vector12 = Main.projectile[(int)npc.ai[2]].Center; + vector12 -= npc.Center; + if (vector12 == Vector2.Zero) + vector12 = -Vector2.UnitY; + + vector12.Normalize(); + if (Math.Abs(vector12.Y) < 0.77f) + npc.localAI[2] = 11f; + else if (vector12.Y < 0f) + npc.localAI[2] = 12f; + else + npc.localAI[2] = 10f; + + int num40 = Math.Sign(vector12.X); + if (num40 != 0) + npc.direction = (npc.spriteDirection = num40); + } + else + { + Vector2 vector13 = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; + vector13 -= npc.Center; + if (vector13 == Vector2.Zero) + vector13 = -Vector2.UnitY; + + vector13.Normalize(); + if (Math.Abs(vector13.Y) < 0.77f) + npc.localAI[2] = 11f; + else if (vector13.Y < 0f) + npc.localAI[2] = 12f; + else + npc.localAI[2] = 10f; + + int num41 = Math.Sign(vector13.X); + if (num41 != 0) + npc.direction = (npc.spriteDirection = num41); + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= ritualTimeMax) + { + flag4 = true; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 6f) + { + npc.localAI[2] = 13f; + npc.ai[1] += 1f; + if (npc.ai[1] >= 120f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 7f) + { + npc.localAI[2] = 11f; + Vector2 vec3 = Vector2.Normalize(player.Center - center); + if (vec3.HasNaNs()) + vec3 = new Vector2(npc.direction, 0f); + + if (npc.ai[1] >= 4f && flag2 && (int)(npc.ai[1] - 4f) % ancientLightPhaseTime == 0) + { + if ((int)(npc.ai[1] - 4f) / ancientLightPhaseTime == 2) + { + List list7 = new List(); + for (int num42 = 0; num42 < Main.maxNPCs; num42++) + { + if (Main.npc[num42].active && Main.npc[num42].type == NPCID.CultistBossClone && Main.npc[num42].ai[3] == (float)npc.whoAmI) + list7.Add(num42); + } + + foreach (int item6 in list7) + { + NPC nPC6 = Main.npc[item6]; + Vector2 center7 = nPC6.Center; + int num43 = Math.Sign(player.Center.X - center7.X); + if (num43 != 0) + nPC6.direction = (nPC6.spriteDirection = num43); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + vec3 = Vector2.Normalize(player.Center - center7); + if (vec3.HasNaNs()) + vec3 = new Vector2(npc.direction, 0f); + + Vector2 vector14 = center7 + new Vector2(npc.direction * 30, 12f); + int type = ProjectileID.CultistBossFireBallClone; + float velocity = masterMode ? 10f : expertMode ? 8f : 6f; + for (int num44 = 0; (float)num44 < 5f; num44++) + { + Vector2 spinninpoint5 = vec3 * (velocity + (float)Main.rand.NextDouble() * 4f); + spinninpoint5 = spinninpoint5.RotatedByRandom(MathHelper.TwoPi / 5D); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector14, spinninpoint5, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + } + } + } + } + + int num45 = Math.Sign(player.Center.X - center.X); + if (num45 != 0) + npc.direction = (npc.spriteDirection = num45); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + vec3 = Vector2.Normalize(player.Center - center); + if (vec3.HasNaNs()) + vec3 = new Vector2(npc.direction, 0f); + + Vector2 vector15 = npc.Center + new Vector2(npc.direction * 30, 12f); + float velocity = masterMode ? 14f : expertMode ? 12f : 10f; + float spread = MathHelper.ToRadians(masterMode ? 15f : expertMode ? 20f : 25f); + float ancientLightLimit = 5f; + for (int i = 0; (float)i < ancientLightLimit; i++) + { + Vector2 spinningpoint2 = vec3 * velocity; + spinningpoint2 = spinningpoint2.RotatedBy(spread * (float)i - (MathHelper.TwoPi / ancientLightLimit - spread) / 2f); + float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * MathHelper.TwoPi / 60f; + int num49 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector15.X, (int)vector15.Y + 7, NPCID.AncientLight, 0, 0f, ai, spinningpoint2.X, spinningpoint2.Y); + Main.npc[num49].velocity = spinningpoint2; + Main.npc[num49].netUpdate = true; + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= (float)(4 + ancientLightPhaseTime * ancientLightAmount)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 8f) + { + npc.localAI[2] = 13f; + if (npc.ai[1] >= 4f && flag2 && (int)(npc.ai[1] - 4f) % ancientDoomPhaseTime == 0) + { + List list8 = new List(); + for (int num50 = 0; num50 < Main.maxNPCs; num50++) + { + if (Main.npc[num50].active && Main.npc[num50].type == NPCID.CultistBossClone && Main.npc[num50].ai[3] == (float)npc.whoAmI) + list8.Add(num50); + } + + int num51 = list8.Count + 1; + if (num51 > 3) + num51 = 3; + + int num52 = Math.Sign(player.Center.X - center.X); + if (num52 != 0) + npc.direction = (npc.spriteDirection = num52); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int num53 = 0; num53 < num51; num53++) + { + Point point = npc.Center.ToTileCoordinates(); + Point point2 = Main.player[npc.target].Center.ToTileCoordinates(); + Vector2 vector16 = Main.player[npc.target].Center - npc.Center; + int num54 = 20; + int num55 = 3; + int num56 = 7; + int num57 = 2; + int num58 = 0; + bool flag6 = false; + if (vector16.Length() > 2000f) + flag6 = true; + + while (!flag6 && num58 < 100) + { + num58++; + int num59 = Main.rand.Next(point2.X - num54, point2.X + num54 + 1); + int num60 = Main.rand.Next(point2.Y - num54, point2.Y + num54 + 1); + if ((num60 < point2.Y - num56 || num60 > point2.Y + num56 || num59 < point2.X - num56 || num59 > point2.X + num56) && (num60 < point.Y - num55 || num60 > point.Y + num55 || num59 < point.X - num55 || num59 > point.X + num55) && !Main.tile[num59, num60].HasUnactuatedTile) + { + bool flag7 = true; + if (flag7 && Collision.SolidTiles(num59 - num57, num59 + num57, num60 - num57, num60 + num57)) + flag7 = false; + + if (flag7) + { + NPC.NewNPC(npc.GetSource_FromAI(), num59 * 16 + 8, num60 * 16 + 8, NPCID.AncientDoom, 0, npc.whoAmI); + flag6 = true; + break; + } + } + } + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= (float)(4 + ancientDoomPhaseTime * ancientDoomAmount)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + if (!flag2) + npc.ai[3] = num11; + + npc.dontTakeDamage = flag3; + npc.chaseable = !flag4; + + return false; + } + + public static bool VanillaAncientLightAI(NPC npc, Mod mod) + { + npc.dontTakeDamage = true; + + // Slow and kill code + if (npc.ai[0] == -1f) + { + // Slow down over time + if (npc.velocity.Length() >= 0.2f) + { + npc.velocity *= 0.96f; + } + else + { + npc.velocity = Vector2.Zero; + npc.position = npc.oldPosition; + + // Kill after 2 seconds + npc.ai[1] += 1f; + if (npc.ai[1] >= 120f) + { + npc.HitEffect(0, 9999.0); + npc.active = false; + } + } + + return false; + } + + npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; + + // Set velocity and emit dust when spawned + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.velocity.X = npc.ai[2]; + npc.velocity.Y = npc.ai[3]; + for (int i = 0; i < 13; i++) + { + int ancientLight = Dust.NewDust(npc.position, npc.width, npc.height, DustID.AncientLight, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); + Main.dust[ancientLight].noGravity = true; + Main.dust[ancientLight].fadeIn = 1f; + Dust dust = Main.dust[ancientLight]; + dust.velocity *= 4f; + Main.dust[ancientLight].noLight = true; + } + } + + // Spawn dust + for (int j = 0; j < 2; j++) + { + if (Main.rand.Next(10 - (int)Math.Min(7f, npc.velocity.Length())) < 1) + { + int ancientLight2 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.AncientLight, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); + Main.dust[ancientLight2].noGravity = true; + Dust dust = Main.dust[ancientLight2]; + dust.velocity *= 0.2f; + Main.dust[ancientLight2].fadeIn = 0.4f; + if (Main.rand.NextBool(6)) + { + dust = Main.dust[ancientLight2]; + dust.velocity *= 5f; + Main.dust[ancientLight2].noLight = true; + } + else + Main.dust[ancientLight2].velocity = npc.DirectionFrom(Main.dust[ancientLight2].position) * Main.dust[ancientLight2].velocity.Length(); + } + } + + if (npc.ai[0] >= 0f) + { + npc.ai[0] += 1f; + + float duration = 120f; + + // Increase velocity for 1 second + if (npc.ai[0] < duration - 60f) + { + if (npc.velocity.Length() < 16f) + npc.velocity *= 1.005f; + } + + // Intersect velocity paths with other Ancient Lights for 1 second + if (npc.ai[0] >= duration - 60f) + npc.velocity = npc.velocity.RotatedBy(npc.ai[1]); + + // Engage slow code + if (npc.ai[0] >= duration) + npc.ai[0] = -1f; + } + + return false; + } + + public static bool VanillaAncientDoomAI(NPC npc, Mod mod) + { + npc.damage = npc.defDamage = 0; + float duration = 420f; + float spawnAnimTime = 120f; + int rateOfChange = 1; + float splitProjVelocity = Main.masterMode ? 10f : Main.expertMode ? 8f : 6f; + + // Percent life remaining for Cultist or Eidolon Wyrm + float lifeRatio = Main.npc[(int)npc.ai[0]].life / (float)Main.npc[(int)npc.ai[0]].lifeMax; + + bool phase2 = lifeRatio < 0.7f && Main.expertMode; + bool phase3 = lifeRatio < 0.4f && Main.masterMode; + + bool kill = npc.ai[1] < 0f || !Main.npc[(int)npc.ai[0]].active; + int target = Main.maxPlayers; + if (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss) + { + if (target == Main.maxPlayers) + target = Main.npc[(int)npc.ai[0]].target; + + if (phase2) + rateOfChange = 2; + + if (phase3) + rateOfChange = 3; + } + else + kill = true; + + npc.ai[1] += rateOfChange; + float growthRate = npc.ai[1] / spawnAnimTime; + growthRate = MathHelper.Clamp(growthRate, 0f, 1f); + npc.position = npc.Center; + npc.scale = MathHelper.Lerp(0f, 1f, growthRate); + npc.Center = npc.position; + npc.alpha = (int)(255f - growthRate * 255f); + + if (Main.rand.NextBool(6)) + { + Vector2 shadowflameDustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust shadowflameDust = Main.dust[Dust.NewDust(npc.Center - shadowflameDustRotate * 20f, 0, 0, DustID.Shadowflame, 0f, 0f, 0, default, 1f)]; + shadowflameDust.noGravity = true; + shadowflameDust.position = npc.Center - shadowflameDustRotate * Main.rand.Next(10, 21) * npc.scale; + shadowflameDust.velocity = shadowflameDustRotate.RotatedBy(MathHelper.PiOver2) * 4f; + shadowflameDust.scale = 0.5f + Main.rand.NextFloat(); + shadowflameDust.fadeIn = 0.5f; + } + if (Main.rand.NextBool(6)) + { + Vector2 darkDustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust darkDust = Main.dust[Dust.NewDust(npc.Center - darkDustRotate * 30f, 0, 0, DustID.Granite, 0f, 0f, 0, default, 1f)]; + darkDust.noGravity = true; + darkDust.position = npc.Center - darkDustRotate * 20f * npc.scale; + darkDust.velocity = darkDustRotate.RotatedBy(-MathHelper.PiOver2) * 2f; + darkDust.scale = 0.5f + Main.rand.NextFloat(); + darkDust.fadeIn = 0.5f; + } + if (Main.rand.NextBool(6)) + { + Vector2 darkDustRotate2 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust darkDust2 = Main.dust[Dust.NewDust(npc.Center - darkDustRotate2 * 30f, 0, 0, DustID.Granite, 0f, 0f, 0, default, 1f)]; + darkDust2.position = npc.Center - darkDustRotate2 * 20f * npc.scale; + darkDust2.velocity = Vector2.Zero; + darkDust2.scale = 0.5f + Main.rand.NextFloat(); + darkDust2.fadeIn = 0.5f; + darkDust2.noLight = true; + } + + if (npc.ai[1] >= duration) + { + int type = ProjectileID.AncientDoomProjectile; + int damage = npc.GetProjectileDamage(type); + + kill = true; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int totalProjectiles = phase3 ? 6 : phase2 ? 5 : 4; + float radians = MathHelper.TwoPi / totalProjectiles; + Vector2 spinningPoint = new Vector2(0f, -splitProjVelocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 doomProjRotate = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, doomProjRotate, type, damage, 0f, Main.myPlayer); + } + } + } + + if (kill) + { + npc.HitEffect(0, 9999.0); + npc.active = false; + } + + return false; + } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs index 9dcd32db78..3eb437dcd6 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs @@ -35,6 +35,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Difficulty bools bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Projectile types and damage @@ -160,7 +161,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.timeLeft = 86400; } - float attackRate = bossRush ? 3f : death ? 2f : 1f; + float attackRate = 1f; npc.ai[1] += attackRate; Vector2 relativeCenter = npc.Bottom + new Vector2(0f, -32f); Vector2 closestTargetPoint = targetData.Hitbox.ClosestPointInRect(relativeCenter); @@ -241,7 +242,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses haltMovement = true; MakeSpikesForward(npc, 1, targetData, iceSpike, iceSpikeDamage, lifeRatio, death); - float iceSpikePhaseGateValue = death ? 40f : 80f; + float iceSpikePhaseGateValue = 80f; if (npc.ai[1] >= iceSpikePhaseGateValue) { npc.ai[0] = 0f; @@ -266,8 +267,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= (float)scoopRubbleGateValue) { Point sourceTileCoords = npc.Top.ToTileCoordinates(); - int numRubble = death ? 40 : 20; - int distancedByThisManyTiles = death ? 4 : 5; + int numRubble = death ? (masterMode ? 60 : 40) : (masterMode ? 32 : 20); + int distancedByThisManyTiles = death ? (masterMode ? 3 : 4) : (masterMode ? 4 : 5); sourceTileCoords.X += npc.direction * 3; sourceTileCoords.Y -= 10; int screenShakeGateValue = (int)npc.ai[1] - scoopRubbleGateValue; @@ -314,11 +315,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.TargetClosest(); if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = 5 + (int)MathHelper.Lerp(0f, 11f, 1f - lifeRatio); + int totalProjectiles = (masterMode ? 7 : 5) + (int)MathHelper.Lerp(0f, 11f, 1f - lifeRatio); float velocityMultIncrement = ((totalProjectiles + 1) / (float)totalProjectiles) - 1f; - float randomRadialOffset = MathHelper.ToRadians(MathHelper.Lerp(0f, 180f, 1f - lifeRatio)); + float randomRadialOffset = MathHelper.ToRadians(MathHelper.Lerp(0f, masterMode ? 270f : 180f, 1f - lifeRatio)); float radians = MathHelper.TwoPi / totalProjectiles + randomRadialOffset; - float velocity = 7f + MathHelper.Lerp(0f, 3.5f, 1f - lifeRatio); + float velocity = (masterMode ? 9f : 7f) + MathHelper.Lerp(0f, 3.5f, 1f - lifeRatio); Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { @@ -346,7 +347,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.TargetClosest(); MakeSpikesBothSides(npc, 1, targetData, iceSpike, iceSpikeDamage, lifeRatio, death); - float doubleIceSpikePhaseGateValue = death ? 60f : 90f; + float doubleIceSpikePhaseGateValue = 90f; if (npc.ai[1] >= doubleIceSpikePhaseGateValue) { npc.ai[0] = 0f; @@ -375,10 +376,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.TargetClosest(); if (Main.netMode != NetmodeID.MultiplayerClient) { - int handAmount = (int)MathHelper.Lerp(3f, 10f, 1f - lifeRatio); + int handAmount = (int)MathHelper.Lerp(masterMode ? 5f : 3f, masterMode ? 12f : 10f, 1f - lifeRatio); for (int i = 0; i < handAmount; i++) { - RandomizeInsanityShadowFor(Main.player[npc.target], isHostile: true, out var spawnposition, out var spawnvelocity, out var ai, out var ai2); + RandomizeInsanityShadowFor(Main.player[npc.target], death, isHostile: true, out var spawnposition, out var spawnvelocity, out var ai, out var ai2); Projectile.NewProjectile(npc.GetSource_FromAI(), spawnposition, spawnvelocity, shadowHand, shadowHandDamage, 0f, Main.myPlayer, ai, ai2); } } @@ -559,7 +560,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { // Normal shadow hand spawn behavior // Modified to make the shadow hand spawns fair - RandomizeInsanityShadowFor(Main.player[i], isHostile: true, out var spawnPosition, out var spawnVelocity, out var ai, out var ai2); + RandomizeInsanityShadowFor(Main.player[i], death, isHostile: true, out var spawnPosition, out var spawnVelocity, out var ai, out var ai2); // Spawn hands to cut the player off and force them back towards Deerclops // This only happens if the player is triggering Deerclops' increased DR @@ -576,7 +577,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - private static void RandomizeInsanityShadowFor(Entity targetEntity, bool isHostile, out Vector2 spawnPosition, out Vector2 spawnVelocity, out float ai0, out float ai1) + private static void RandomizeInsanityShadowFor(Entity targetEntity, bool death, bool isHostile, out Vector2 spawnPosition, out Vector2 spawnVelocity, out float ai0, out float ai1) { int spawnDirection = Main.rand.NextBool() ? 1 : -1; int shadowHandType = Main.rand.Next(4); @@ -595,13 +596,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses ai0 = 0f; ai1 = 0f; + int velocityAdd = death ? 2 : 0; if (shadowHandType == 1) { float rotation = (float)Math.PI * 2f * Main.rand.NextFloat(); spawnPosition = targetEntity.Center - rotation.ToRotationVector2() * spawnDistance; ai0 = 180f; ai1 = rotation - (float)Math.PI / 2f; - spawnVelocity = rotation.ToRotationVector2() * (isHostile ? 4 : 2); + spawnVelocity = rotation.ToRotationVector2() * (isHostile ? (4 + velocityAdd) : 2); } else if (shadowHandType == 2) { @@ -609,7 +611,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses spawnPosition = targetEntity.Center - rotation.ToRotationVector2() * spawnDistance; ai0 = 300f; ai1 = rotation; - spawnVelocity = rotation.ToRotationVector2() * (isHostile ? 4 : 2); + spawnVelocity = rotation.ToRotationVector2() * (isHostile ? (4 + velocityAdd) : 2); } else if (shadowHandType == 3) { @@ -620,7 +622,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Vector2.Distance(spawnPosition, targetEntity.Center) < spawnDistance) spawnPosition = (spawnPosition - targetEntity.Center).SafeNormalize(Vector2.UnitY) * spawnDistance; - Vector2 vector = rotation.ToRotationVector2() * (isHostile ? 8 : 3); + Vector2 vector = rotation.ToRotationVector2() * (isHostile ? (8 + velocityAdd) : 3); for (int i = 0; (float)i < distance; i++) { spawnPosition -= vector; @@ -740,7 +742,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { Vector2 iceSpikeSpawnPos = new Vector2(posX * 16 + 8, posY * 16 - 8); Vector2 iceSpikeVelocity = new Vector2(0f, -1f).RotatedBy((float)(whichOne * dir) * 0.7f * ((float)Math.PI / 4f / (float)howMany)); - Projectile.NewProjectile(npc.GetSource_FromAI(), iceSpikeSpawnPos, iceSpikeVelocity, iceSpike, iceSpikeDamage, 0f, Main.myPlayer, 0f, 0.1f + Main.rand.NextFloat() * 0.1f + (float)xOffset * 1.1f / (float)howMany); + float scaleIncrease = MathHelper.Lerp(0f, 0.55f, 1f - lifeRatio); + Projectile.NewProjectile(npc.GetSource_FromAI(), iceSpikeSpawnPos, iceSpikeVelocity, iceSpike, iceSpikeDamage, 0f, Main.myPlayer, 0f, 0.1f + Main.rand.NextFloat() * 0.1f + (float)xOffset * (1.1f + scaleIncrease) / (float)howMany); } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs index 23d8f09595..4d4936702a 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Events; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -16,6 +17,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static class DestroyerAI { public const float DRIncraeseTime = 600f; + public const float DeathModeLaserBreathGateValue = 600f; + public const float LaserTelegraphTime = 120f; + public const float SparkTelegraphTime = 30f; + public const float FlightPhaseGateValue = 900f; + public const float FlightPhaseResetGateValue = FlightPhaseGateValue * 2f; + private const float Phase4FlightPhaseTimerSetValue = FlightPhaseGateValue * 0.5f; + private const float Phase5FlightPhaseTimerSetValue = FlightPhaseGateValue; + public const float PhaseTransitionTelegraphTime = 180f; + public const float GroundTelegraphStartGateValue = FlightPhaseResetGateValue - PhaseTransitionTelegraphTime; + public const float FlightTelegraphStartGateValue = FlightPhaseGateValue - PhaseTransitionTelegraphTime; + private const int OneInXChanceToFireLaser = 200; public static bool BuffedDestroyerAI(NPC npc, Mod mod) { @@ -70,14 +82,35 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool phase5 = lifeRatio < (death ? 0.2f : 0.1f); // Flight timer - float newAISet = phase5 ? 900f : phase4 ? 450f : 0f; - calamityGlobalNPC.newAI[3] += 1f; - if (calamityGlobalNPC.newAI[3] >= 1800f) + if (startFlightPhase) + calamityGlobalNPC.newAI[3] += 1f; + + // Force the timer to be at a certain value in later phases + float flightPhaseTimerSetValue = phase5 ? Phase5FlightPhaseTimerSetValue : phase4 ? Phase4FlightPhaseTimerSetValue : 0f; + if (calamityGlobalNPC.newAI[3] < flightPhaseTimerSetValue) + calamityGlobalNPC.newAI[3] = flightPhaseTimerSetValue; + + // Return to ground phase, with less time spent in later phases + if (calamityGlobalNPC.newAI[3] >= FlightPhaseResetGateValue) { - calamityGlobalNPC.newAI[3] = newAISet; + calamityGlobalNPC.newAI[3] = flightPhaseTimerSetValue; npc.TargetClosest(); } + // Spawn DR check + bool hasSpawnDR = calamityGlobalNPC.newAI[1] < DRIncraeseTime && calamityGlobalNPC.newAI[1] > 60f; + + // Gradual color transition from ground to flight and vice versa + // 0f = Red, 1f = Purple + float phaseTransitionColorAmount = (hasSpawnDR || phase5) ? 1f : 0f; + if (!hasSpawnDR && !phase5) + { + if (calamityGlobalNPC.newAI[3] >= GroundTelegraphStartGateValue) + phaseTransitionColorAmount = MathHelper.Clamp(1f - (calamityGlobalNPC.newAI[3] - GroundTelegraphStartGateValue) / PhaseTransitionTelegraphTime, 0f, 1f); + else if (calamityGlobalNPC.newAI[3] >= FlightTelegraphStartGateValue) + phaseTransitionColorAmount = MathHelper.Clamp((calamityGlobalNPC.newAI[3] - FlightTelegraphStartGateValue) / PhaseTransitionTelegraphTime, 0f, 1f); + } + // Set worm variable for worms if (npc.ai[3] > 0f) npc.realLife = (int)npc.ai[3]; @@ -98,12 +131,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float enrageScale = bossRush ? 1f : 0f; if (Main.dayTime || bossRush) { - npc.Calamity().CurrentlyEnraged = !bossRush; + calamityGlobalNPC.CurrentlyEnraged = !bossRush; enrageScale += 2f; } // Phase for flying at the player - bool flyAtTarget = (calamityGlobalNPC.newAI[3] >= 900f && startFlightPhase) || (calamityGlobalNPC.newAI[1] < DRIncraeseTime && calamityGlobalNPC.newAI[1] > 60f); + bool flyAtTarget = (calamityGlobalNPC.newAI[3] >= FlightPhaseGateValue && startFlightPhase) || hasSpawnDR; // Dust on spawn and alpha effects if (npc.type == NPCID.TheDestroyer || (npc.type != NPCID.TheDestroyer && Main.npc[(int)npc.ai[1]].alpha < 128)) @@ -117,6 +150,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.dust[spawnDust].noLight = true; } } + npc.alpha -= 42; if (npc.alpha < 0) npc.alpha = 0; @@ -169,6 +203,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Total segment variable int totalSegments = Main.getGoodWorld ? 100 : 80; + // Calculate aggression based on how many broken segments there are + float brokenSegmentAggressionMultiplier = 1f; + if (npc.type == NPCID.TheDestroyer && !oblivionAlive) + { + int numProbeSegments = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == NPCID.TheDestroyerBody && Main.npc[i].ai[2] == 0f) + numProbeSegments++; + } + brokenSegmentAggressionMultiplier += (1f - MathHelper.Clamp(numProbeSegments / (float)totalSegments, 0f, 1f)) * 0.25f; + } + // Death Mode laser spit bool bool spitLaserSpreads = death; @@ -179,6 +226,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float speed = masterMode ? 0.125f : 0.1f; float turnSpeed = masterMode ? 0.1875f : 0.15f; + // Max velocity + float segmentVelocity = flyAtTarget ? 15f : 20f; + + // Increase velocity based on distance + float velocityMultiplier = increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; + // If Oblivion is alive, don't fly, don't spit laser spreads, use the default vanilla no fly zone, reduce segment count to 60, use base speed and use base turn speed if (oblivionAlive) { @@ -191,14 +244,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { noFlyZoneBoxHeight -= death ? 400 : (int)(400f * (1f - lifeRatio)); - float speedBoost = death ? (0.14f * (1f - lifeRatio)) : (0.1f * (1f - lifeRatio)); - float turnSpeedBoost = death ? (0.19f * (1f - lifeRatio)) : (0.15f * (1f - lifeRatio)); + float segmentVelocityBoost = death ? (flyAtTarget ? 4.5f : 6f) * (1f - lifeRatio) : (flyAtTarget ? 3f : 4f) * (1f - lifeRatio); + float speedBoost = death ? (flyAtTarget ? 0.1125f : 0.15f) * (1f - lifeRatio) : (flyAtTarget ? 0.075f : 0.1f) * (1f - lifeRatio); + float turnSpeedBoost = death ? 0.18f * (1f - lifeRatio) : 0.12f * (1f - lifeRatio); + segmentVelocity += segmentVelocityBoost; speed += speedBoost; turnSpeed += turnSpeedBoost; - speed += 0.04f * enrageScale; - turnSpeed += 0.06f * enrageScale; + segmentVelocity += 5f * enrageScale; + speed += 0.05f * enrageScale; + turnSpeed += 0.075f * enrageScale; if (flyAtTarget) { @@ -206,11 +262,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses speed *= speedMultiplier; } - speed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; - turnSpeed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; + segmentVelocity *= velocityMultiplier; + speed *= velocityMultiplier; + turnSpeed *= velocityMultiplier; + + segmentVelocity *= brokenSegmentAggressionMultiplier; + speed *= brokenSegmentAggressionMultiplier; + turnSpeed *= brokenSegmentAggressionMultiplier; if (Main.getGoodWorld) { + segmentVelocity *= 1.2f; speed *= 1.2f; turnSpeed *= 1.2f; } @@ -231,24 +293,47 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses calamityGlobalNPC.newAI[2] -= 1f; } - // Regenerate Probes in Master Mode + // Regenerate Probes in Master Mode if the number of Probes is less than 40 and the number of living NPCs is less than the segment count + 40 (this limit is here just in case) if (masterMode && probeLaunched) { npc.localAI[2] += 1f; if (npc.localAI[2] >= 600f) { - npc.ai[2] = 0f; - npc.localAI[2] = 0f; + int maxProbes = 40; + bool regenerateProbeSegment = NPC.CountNPCS(NPCID.Probe) < maxProbes; + if (regenerateProbeSegment) + { + int maxNPCs = totalSegments + maxProbes; + int numNPCs = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active) + { + numNPCs++; + if (numNPCs >= maxNPCs) + { + regenerateProbeSegment = false; + break; + } + } + } + } - npc.netUpdate = true; + if (regenerateProbeSegment) + { + npc.ai[2] = 0f; + npc.netUpdate = true; + } + + npc.localAI[2] = 0f; npc.SyncVanillaLocalAI(); } } } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (npc.type == NPCID.TheDestroyer) { - if (npc.type == NPCID.TheDestroyer) + if (Main.netMode != NetmodeID.MultiplayerClient) { // Spawn segments from head if (npc.ai[0] == 0f) @@ -271,135 +356,266 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses index = segment; } } - - // Laser breath in Death Mode - if (spitLaserSpreads) - { - float laserBreathGateValue = 600f; - if (calamityGlobalNPC.newAI[0] < laserBreathGateValue) - calamityGlobalNPC.newAI[0] += 1f; - - if (npc.SafeDirectionTo(player.Center).AngleBetween((npc.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(18f) && - calamityGlobalNPC.newAI[0] >= laserBreathGateValue && Vector2.Distance(npc.Center, player.Center) > 480f && - Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - if (calamityGlobalNPC.newAI[0] % 30f == 0f) - { - float velocity = bossRush ? 6f : death ? 5.333f : 5f; - int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); - } - - Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; - int numProj = calamityGlobalNPC.newAI[0] % 60f == 0f ? (masterMode ? 9 : 7) : (masterMode ? 6 : 4); - int spread = masterMode ? 75 : 54; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f, 0f); - Main.projectile[proj].timeLeft = 900; - } - } - - calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] > laserBreathGateValue + 60f) - calamityGlobalNPC.newAI[0] = 0f; - } - } } - // Fire lasers - if (npc.type == NPCID.TheDestroyerBody) + // Laser breath in Death Mode + if (spitLaserSpreads) { - // Laser rate of fire - calamityGlobalNPC.newAI[0] += (float)Main.rand.Next(4); - float shootProjectileTime = death ? 270 : 450; - float bodySegmentTime = npc.ai[0] * 30f; - float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; - - // Shoot lasers - // 50% chance to shoot harmless scrap if probe has been launched - if (calamityGlobalNPC.newAI[0] >= shootProjectileGateValue) + // Set laser color and type + if (calamityGlobalNPC.destroyerLaserColor == -1) { - if (!masterMode) + calamityGlobalNPC.destroyerLaserColor = phase3 ? 3 : phase2 ? 2 : 1; + npc.SyncDestroyerLaserColor(); + } + + float laserBreathGateValue = DeathModeLaserBreathGateValue; + if (calamityGlobalNPC.newAI[0] < laserBreathGateValue) + calamityGlobalNPC.newAI[0] += 1f; + + // Sync newAI every 20 frames for the new telegraph + if (calamityGlobalNPC.newAI[0] % 20f == 0f) + npc.SyncExtraAI(); + + if (npc.SafeDirectionTo(player.Center).AngleBetween((npc.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(18f) && + calamityGlobalNPC.newAI[0] >= laserBreathGateValue && Vector2.Distance(npc.Center, player.Center) > 480f && + Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + if (calamityGlobalNPC.newAI[0] % 30f == 0f) { - calamityGlobalNPC.newAI[0] = 0f; - npc.TargetClosest(); - } - - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - if (masterMode) - { - calamityGlobalNPC.newAI[0] = 0f; - npc.TargetClosest(); - } - - // Laser speed - float projectileSpeed = 3.5f + Main.rand.NextFloat() * 1.5f; - projectileSpeed += enrageScale; - - // Set projectile damage and type - int projectileType = ProjectileID.DeathLaser; - float laserSpawnDistance = 10f; - int random = phase3 ? 4 : phase2 ? 3 : 2; - switch (Main.rand.Next(random)) + float velocity = bossRush ? 6f : death ? 5.333f : 5f; + int type = ProjectileID.DeathLaser; + switch (calamityGlobalNPC.destroyerLaserColor) { + default: case 0: + break; + case 1: + type = ModContent.ProjectileType(); break; + case 2: - projectileType = ModContent.ProjectileType(); - break; - case 3: - projectileType = ModContent.ProjectileType(); + type = ModContent.ProjectileType(); break; } - - if (calamityGlobalNPC.newAI[2] > 0f || bossRush) - { - projectileType = ModContent.ProjectileType(); - laserSpawnDistance = 20f; - } - - bool weakLaser = false; - if (probeLaunched) - { - weakLaser = true; - projectileType = ProjectileID.EyeLaser; - laserSpawnDistance = 0f; - } - - // Get target vector - Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed; - Vector2 projectileSpawn = npc.Center + projectileVelocity * laserSpawnDistance; - - // Shoot projectile - int damage = npc.GetProjectileDamage(projectileType); + int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, weakLaser ? 0f : 1f, 0f); - Main.projectile[proj].timeLeft = weakLaser ? 600 : 900; - - npc.netUpdate = true; + Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; + int numProj = calamityGlobalNPC.newAI[0] % 60f == 0f ? (masterMode ? 9 : 7) : (masterMode ? 6 : 4); + int spread = masterMode ? 75 : 54; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 100f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f, 0f); + Main.projectile[proj].timeLeft = 1200; + } + } } + + calamityGlobalNPC.newAI[0] += 1f; + if (calamityGlobalNPC.newAI[0] > laserBreathGateValue + 60f) + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.destroyerLaserColor = -1; + npc.SyncDestroyerLaserColor(); + npc.SyncExtraAI(); + } + } + } + } + + // Fire lasers + if (npc.type == NPCID.TheDestroyerBody) + { + bool ableToFireLaser = calamityGlobalNPC.destroyerLaserColor != -1; + + // Set laser color and type + if (calamityGlobalNPC.destroyerLaserColor == -1 && !probeLaunched && Main.rand.NextBool(OneInXChanceToFireLaser)) + { + int random = phase3 ? 4 : phase2 ? 3 : 2; + switch (Main.rand.Next(random)) + { + case 0: + case 1: + calamityGlobalNPC.destroyerLaserColor = 0; + break; + case 2: + calamityGlobalNPC.destroyerLaserColor = 1; + break; + case 3: + calamityGlobalNPC.destroyerLaserColor = 2; + break; + } + + if (calamityGlobalNPC.newAI[2] > 0f || bossRush) + calamityGlobalNPC.destroyerLaserColor = 2; + + npc.SyncDestroyerLaserColor(); + } + + if (probeLaunched && ableToFireLaser) + { + calamityGlobalNPC.destroyerLaserColor = -1; + npc.SyncDestroyerLaserColor(); + } + + // Laser rate of fire + float shootProjectileTime = death ? 270f : 450f; + float bodySegmentTime = npc.ai[0] * 30f; + float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; + float laserTimerIncrement = (calamityGlobalNPC.newAI[0] > shootProjectileGateValue - LaserTelegraphTime) ? 1f : 2f; + if (ableToFireLaser) + calamityGlobalNPC.newAI[0] += laserTimerIncrement; + + // Sync newAI every 20 frames for the new telegraph + if (calamityGlobalNPC.newAI[0] % 20f == 0f && ableToFireLaser) + npc.SyncExtraAI(); + + Color telegraphColor = Color.Transparent; + switch (calamityGlobalNPC.destroyerLaserColor) + { + case 0: + telegraphColor = Color.Red; + break; + case 1: + telegraphColor = Color.Green; + break; + case 2: + telegraphColor = Color.Cyan; + break; + } + + if (calamityGlobalNPC.newAI[0] == shootProjectileGateValue - LaserTelegraphTime) + { + Particle telegraph = new DestroyerReticleTelegraph( + npc, + telegraphColor, + 1.5f, + 0.15f, + (int)LaserTelegraphTime); + GeneralParticleHandler.SpawnParticle(telegraph); + } + + if (calamityGlobalNPC.newAI[0] == shootProjectileGateValue - SparkTelegraphTime) + { + Particle spark = new DestroyerSparkTelegraph( + npc, + telegraphColor * 2f, + Color.White, + 3f, + 30, + Main.rand.NextFloat(MathHelper.ToRadians(3f)) * Main.rand.NextBool().ToDirectionInt()); + GeneralParticleHandler.SpawnParticle(spark); + } + + // Shoot lasers + // Shoot nothing if probe has been launched + if (calamityGlobalNPC.newAI[0] >= shootProjectileGateValue && ableToFireLaser) + { + if (!masterMode) + { + int numProbeSegments = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == npc.type && Main.npc[i].ai[2] == 0f) + numProbeSegments++; + } + float lerpAmount = MathHelper.Clamp(numProbeSegments / (float)totalSegments, 0f, 1f); + float laserShootTimeBonus = (int)MathHelper.Lerp(0f, (shootProjectileTime + bodySegmentTime * lerpAmount) - LaserTelegraphTime, 1f - lerpAmount); + calamityGlobalNPC.newAI[0] = laserShootTimeBonus; + npc.SyncExtraAI(); + npc.TargetClosest(); + } + + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + if (masterMode) + { + int numProbeSegments = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == npc.type && Main.npc[i].ai[2] == 0f) + numProbeSegments++; + } + float lerpAmount = MathHelper.Clamp(numProbeSegments / (float)totalSegments, 0f, 1f); + float laserShootTimeBonus = (int)MathHelper.Lerp(0f, (shootProjectileTime + bodySegmentTime * lerpAmount) - LaserTelegraphTime, 1f - lerpAmount); + calamityGlobalNPC.newAI[0] = laserShootTimeBonus; + npc.SyncExtraAI(); + npc.TargetClosest(); + } + + // Laser speed + float projectileSpeed = 3.5f + Main.rand.NextFloat() * 1.5f; + projectileSpeed += enrageScale; + + // Set projectile damage and type + int projectileType = ProjectileID.DeathLaser; + switch (calamityGlobalNPC.destroyerLaserColor) + { + default: + case 0: + break; + + case 1: + projectileType = ModContent.ProjectileType(); + break; + + case 2: + projectileType = ModContent.ProjectileType(); + break; + } + + // Get target vector + Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed; + Vector2 projectileSpawn = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 100f; + + // Shoot projectile + int damage = npc.GetProjectileDamage(projectileType); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, 1f, 0f); + Main.projectile[proj].timeLeft = 1200; + } + + npc.netUpdate = true; + + if (masterMode) + { + calamityGlobalNPC.destroyerLaserColor = -1; + npc.SyncDestroyerLaserColor(); + } + } + + if (!masterMode) + { + calamityGlobalNPC.destroyerLaserColor = -1; + npc.SyncDestroyerLaserColor(); } } } @@ -486,8 +702,88 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else npc.localAI[1] = 0f; + if (npc.type != NPCID.TheDestroyerBody || !probeLaunched) + { + Vector3 lightColor = Color.Red.ToVector3(); + int x = (int)((npc.position.X - 8f) / 16f); + int x2 = (int)((npc.position.X + npc.width + 8f) / 16f); + int y = (int)((npc.position.Y - 8f) / 16f); + int y2 = (int)((npc.position.Y + npc.height + 8f) / 16f); + for (int l = x; l <= x2; l++) + { + for (int m = y; m <= y2; m++) + { + if (Lighting.Brightness(l, m) == 0f) + lightColor = Color.Black.ToVector3(); + } + } + + if (lightColor != Color.Black.ToVector3()) + { + // Light colors + Vector3 groundColor = new Vector3(0.3f, 0.1f, 0.05f); + Vector3 flightColor = new Vector3(0.05f, 0.1f, 0.3f); + Vector3 segmentColor = Vector3.Lerp(groundColor, flightColor, phaseTransitionColorAmount); + Vector3 telegraphColor = groundColor; + + // Telegraph for the laser breath and body lasers + float telegraphProgress = 0f; + if (calamityGlobalNPC.destroyerLaserColor != -1) + { + if (npc.type == NPCID.TheDestroyer && spitLaserSpreads) + { + float telegraphGateValue = DeathModeLaserBreathGateValue - LaserTelegraphTime; + if (calamityGlobalNPC.newAI[0] > telegraphGateValue) + { + switch (calamityGlobalNPC.destroyerLaserColor) + { + default: + case 0: + break; + + case 1: + telegraphColor = new Vector3(0.1f, 0.3f, 0.05f); + break; + + case 2: + telegraphColor = new Vector3(0.05f, 0.2f, 0.2f); + break; + } + telegraphProgress = MathHelper.Clamp((calamityGlobalNPC.newAI[0] - telegraphGateValue) / LaserTelegraphTime, 0f, 1f); + } + } + else if (npc.type == NPCID.TheDestroyerBody) + { + float shootProjectileTime = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 270f : 450f; + float bodySegmentTime = npc.ai[0] * 30f; + float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; + float telegraphGateValue = shootProjectileGateValue - LaserTelegraphTime; + if (calamityGlobalNPC.newAI[0] > telegraphGateValue) + { + switch (calamityGlobalNPC.destroyerLaserColor) + { + default: + case 0: + break; + + case 1: + telegraphColor = new Vector3(0.1f, 0.3f, 0.05f); + break; + + case 2: + telegraphColor = new Vector3(0.05f, 0.2f, 0.2f); + break; + } + telegraphProgress = MathHelper.Clamp((calamityGlobalNPC.newAI[0] - telegraphGateValue) / LaserTelegraphTime, 0f, 1f); + } + } + } + + Lighting.AddLight(npc.Center, Vector3.Lerp(segmentColor, telegraphColor * 2f, telegraphProgress)); + } + } + // Despawn - float segmentVelocity = masterMode ? 20f : 16f; if (player.dead) { shouldFly = false; @@ -509,11 +805,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - // Max velocity - float segmentVelocityBoost = death ? 6.5f * (1f - lifeRatio) : 5f * (1f - lifeRatio); - segmentVelocity += segmentVelocityBoost; - segmentVelocity += 4f * enrageScale; - Vector2 npcCenter = npc.Center; float targetTilePosX = player.Center.X; float targetTilePosY = player.Center.Y; @@ -618,7 +909,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses soundDelay = 20f; npc.soundDelay = (int)soundDelay; - SoundEngine.PlaySound(SoundID.WormDig, npc.position); + SoundEngine.PlaySound(SoundID.WormDig, npc.Center); } targetTileDist = (float)Math.Sqrt(targetTilePosX * targetTilePosX + targetTilePosY * targetTilePosY); @@ -631,7 +922,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool flyWyvernMovement = false; if (flyAtTarget) { - if (((npc.velocity.X > 0f && targetTilePosX < 0f) || (npc.velocity.X < 0f && targetTilePosX > 0f) || (npc.velocity.Y > 0f && targetTilePosY < 0f) || (npc.velocity.Y < 0f && targetTilePosY > 0f)) && Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) > speed / 2f && targetTileDist < 400f) + if (((npc.velocity.X > 0f && targetTilePosX < 0f) || (npc.velocity.X < 0f && targetTilePosX > 0f) || (npc.velocity.Y > 0f && targetTilePosY < 0f) || (npc.velocity.Y < 0f && targetTilePosY > 0f)) && Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) > speed / 2f && targetTileDist < 600f) { flyWyvernMovement = true; @@ -776,12 +1067,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (npc.velocity.Length() <= minimalContactDamageVelocity) { - npc.damage = (int)(npc.defDamage * 0.5f); + npc.damage = (int)Math.Round(npc.defDamage * 0.5); } else { float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar); + npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); } } else @@ -879,6 +1170,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } + int destroyerSegmentsCount = NPC.GetDestroyerSegmentsCount(); if (Main.netMode != NetmodeID.MultiplayerClient) { if (npc.ai[0] == 0f && npc.type == NPCID.TheDestroyer) @@ -887,7 +1179,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.realLife = npc.whoAmI; int num5 = 0; int num6 = npc.whoAmI; - int destroyerSegmentsCount = NPC.GetDestroyerSegmentsCount(); for (int j = 0; j <= destroyerSegmentsCount; j++) { int num7 = NPCID.TheDestroyerBody; @@ -903,50 +1194,126 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses num6 = num5; } } + } - if (npc.type == NPCID.TheDestroyerBody) + if (npc.type == NPCID.TheDestroyerBody) + { + bool probeLaunched = npc.ai[2] == 1f; + bool ableToFireLaser = npc.Calamity().destroyerLaserColor != -1; + + if (npc.Calamity().destroyerLaserColor == -1 && !probeLaunched && Main.rand.NextBool(OneInXChanceToFireLaser)) { - npc.localAI[0] += Main.rand.Next(4); - int chanceToFire = Main.rand.Next(1400, 26000); - if (Main.expertMode) - chanceToFire = (int)(chanceToFire * MathHelper.Lerp(Main.masterMode ? 0.5f : 0.7f, 1f, npc.life / (float)npc.lifeMax)); + npc.Calamity().destroyerLaserColor = 0; + npc.SyncDestroyerLaserColor(); + } - if (npc.localAI[0] >= (float)chanceToFire) + if (probeLaunched && ableToFireLaser) + { + npc.Calamity().destroyerLaserColor = -1; + npc.SyncDestroyerLaserColor(); + } + + float shootProjectileTime = Main.masterMode ? 500f : Main.expertMode ? 700f : 900f; + float bodySegmentTime = npc.ai[0] * 30f; + float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; + + float laserTimerIncrement = (npc.localAI[0] > shootProjectileGateValue - LaserTelegraphTime) ? 1f : 2f; + if (ableToFireLaser) + npc.localAI[0] += laserTimerIncrement; + + // Sync newAI every 20 frames for the new telegraph + if (npc.localAI[0] % 20f == 0f && ableToFireLaser) + npc.SyncVanillaLocalAI(); + + Color telegraphColor = Color.Transparent; + switch (npc.Calamity().destroyerLaserColor) + { + case 0: + telegraphColor = Color.Red; + break; + case 1: + telegraphColor = Color.Green; + break; + case 2: + telegraphColor = Color.Cyan; + break; + } + + if (npc.localAI[0] == shootProjectileGateValue - LaserTelegraphTime) + { + Particle telegraph = new DestroyerReticleTelegraph( + npc, + telegraphColor, + 1.5f, + 0.15f, + (int)LaserTelegraphTime); + GeneralParticleHandler.SpawnParticle(telegraph); + } + + if (npc.localAI[0] == shootProjectileGateValue - SparkTelegraphTime) + { + Particle spark = new DestroyerSparkTelegraph( + npc, + telegraphColor * 2f, + Color.White, + 3f, + 30, + Main.rand.NextFloat(MathHelper.ToRadians(3f)) * Main.rand.NextBool().ToDirectionInt()); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (npc.localAI[0] >= shootProjectileGateValue && ableToFireLaser) + { + int numProbeSegments = 0; + for (int i = 0; i < Main.maxNPCs; i++) { - npc.localAI[0] = 0f; - npc.TargetClosest(); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float laserVelocity = Main.masterMode ? 9f : Main.expertMode ? 8.5f : 8f; - Vector2 vector = npc.Center; - float num8 = Main.player[npc.target].Center.X - vector.X + (float)Main.rand.Next(-2, 3); - float num9 = Main.player[npc.target].Center.Y - vector.Y + (float)Main.rand.Next(-2, 3); - float num10 = (float)Math.Sqrt(num8 * num8 + num9 * num9); - num10 = laserVelocity / num10; - num8 *= num10; - num9 *= num10; - num8 += (float)Main.rand.Next(-2, 3) * 0.05f; - num9 += (float)Main.rand.Next(-2, 3) * 0.05f; - - int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); - } - - vector.X += num8 * 5f; - vector.Y += num9 * 5f; - int num12 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector.X, vector.Y, num8, num9, type, damage, 0f, Main.myPlayer); - Main.projectile[num12].timeLeft = 600; - npc.netUpdate = true; - } + if (Main.npc[i].active && Main.npc[i].type == npc.type && Main.npc[i].ai[2] == 0f) + numProbeSegments++; } + float lerpAmount = MathHelper.Clamp(numProbeSegments / (float)destroyerSegmentsCount, 0f, 1f); + float laserShootTimeBonus = (int)MathHelper.Lerp(0f, (shootProjectileTime + bodySegmentTime * lerpAmount) - LaserTelegraphTime, 1f - lerpAmount); + npc.localAI[0] = laserShootTimeBonus; + npc.SyncVanillaLocalAI(); + npc.TargetClosest(); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float laserVelocity = (Main.masterMode ? 3.5f : Main.expertMode ? 3f : 2.5f) + Main.rand.NextFloat() * 1.5f; + Vector2 vector = npc.Center; + float num8 = Main.player[npc.target].Center.X - vector.X + (float)Main.rand.Next(-2, 3); + float num9 = Main.player[npc.target].Center.Y - vector.Y + (float)Main.rand.Next(-2, 3); + float num10 = (float)Math.Sqrt(num8 * num8 + num9 * num9); + num10 = laserVelocity / num10; + num8 *= num10; + num9 *= num10; + num8 += (float)Main.rand.Next(-2, 3) * 0.05f; + num9 += (float)Main.rand.Next(-2, 3) * 0.05f; + + int type = ProjectileID.DeathLaser; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + Vector2 laserVelocityActual = new Vector2(num8, num9); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num12 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector + laserVelocityActual.SafeNormalize(Vector2.UnitY) * 100f, laserVelocityActual, type, damage, 0f, Main.myPlayer, 1f, 0f); + Main.projectile[num12].timeLeft = 1200; + } + + npc.netUpdate = true; + } + + npc.Calamity().destroyerLaserColor = -1; + npc.SyncDestroyerLaserColor(); } } @@ -961,6 +1328,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.life = Main.npc[(int)npc.ai[1]].life; } + // Calculate aggression based on how many broken segments there are + float brokenSegmentAggressionMultiplier = 1f; + if (npc.type == NPCID.TheDestroyer) + { + int numProbeSegments = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == NPCID.TheDestroyerBody && Main.npc[i].ai[2] == 0f) + numProbeSegments++; + } + brokenSegmentAggressionMultiplier += (1f - MathHelper.Clamp(numProbeSegments / (float)destroyerSegmentsCount, 0f, 1f)) * 0.25f; + } + int num13 = (int)(npc.position.X / 16f) - 1; int num14 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; int num15 = (int)(npc.position.Y / 16f) - 1; @@ -1002,7 +1382,46 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!flag2) { if (npc.type != NPCID.TheDestroyerBody || npc.ai[2] != 1f) - Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0.3f, 0.1f, 0.05f); + { + Vector3 lightColor = Color.Red.ToVector3(); + int x = (int)((npc.position.X - 8f) / 16f); + int x2 = (int)((npc.position.X + npc.width + 8f) / 16f); + int y = (int)((npc.position.Y - 8f) / 16f); + int y2 = (int)((npc.position.Y + npc.height + 8f) / 16f); + for (int l = x; l <= x2; l++) + { + for (int m = y; m <= y2; m++) + { + if (Lighting.Brightness(l, m) == 0f) + lightColor = Color.Black.ToVector3(); + } + } + + if (lightColor != Color.Black.ToVector3()) + { + // Light colors + Vector3 groundColor = new Vector3(0.3f, 0.1f, 0.05f); + Vector3 segmentColor = groundColor; + Vector3 telegraphColor = groundColor; + + // Telegraph for the laser breath and body lasers + float telegraphProgress = 0f; + if (npc.Calamity().destroyerLaserColor != -1) + { + if (npc.type == NPCID.TheDestroyerBody) + { + float shootProjectileTime = Main.masterMode ? 500f : Main.expertMode ? 700f : 900f; + float bodySegmentTime = npc.ai[0] * 30f; + float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; + float telegraphGateValue = shootProjectileGateValue - LaserTelegraphTime; + if (npc.localAI[0] > telegraphGateValue) + telegraphProgress = MathHelper.Clamp((npc.localAI[0] - telegraphGateValue) / LaserTelegraphTime, 0f, 1f); + } + } + + Lighting.AddLight(npc.Center, Vector3.Lerp(segmentColor, telegraphColor * 2f, telegraphProgress)); + } + } npc.localAI[1] = 1f; if (npc.type == NPCID.TheDestroyer) @@ -1034,18 +1453,18 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else npc.localAI[1] = 0f; - float num18 = Main.masterMode ? 24f : Main.expertMode ? 20f : 16f; + float num18 = (Main.masterMode ? 24f : Main.expertMode ? 20f : 16f) * brokenSegmentAggressionMultiplier; if (Main.IsItDay() || Main.player[npc.target].dead) { flag2 = false; npc.velocity.Y += 1f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) + if ((double)npc.position.Y > Main.worldSurface * 16D) { npc.velocity.Y += 1f; num18 *= 2f; } - if ((double)npc.position.Y > Main.rockLayer * 16.0) + if ((double)npc.position.Y > Main.rockLayer * 16D) { for (int n = 0; n < Main.maxNPCs; n++) { @@ -1059,8 +1478,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float num20 = 0.15f; if (Main.expertMode) { - num19 = Main.masterMode ? 0.15f : 0.125f; - num20 = Main.masterMode ? 0.225f : 0.1875f; + num19 = Main.masterMode ? 0.2f : 0.15f; + num20 = Main.masterMode ? 0.3f : 0.225f; } if (Main.getGoodWorld) @@ -1069,6 +1488,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses num20 *= 1.2f; } + num19 *= brokenSegmentAggressionMultiplier; + num20 *= brokenSegmentAggressionMultiplier; + Vector2 vector3 = npc.Center; float num21 = Main.player[npc.target].Center.X; float num22 = Main.player[npc.target].Center.Y; @@ -1303,12 +1725,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (npc.velocity.Length() <= minimalContactDamageVelocity) { - npc.damage = (int)(npc.defDamage * 0.5f); + npc.damage = (int)Math.Round(npc.defDamage * 0.5); } else { float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar); + npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); } } else @@ -1494,10 +1916,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } int totalProjectiles = (CalamityWorld.death || bossRush) ? 3 : 1; @@ -1522,13 +1946,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses velocityMultiplier = 0.8f; break; } - Projectile.NewProjectile(npc.GetSource_FromAI(), probeCenter, npcCenter * velocityMultiplier, type, damage, 0f, Main.myPlayer); + Vector2 laserVelocity = npcCenter * velocityMultiplier; + Projectile.NewProjectile(npc.GetSource_FromAI(), probeCenter + laserVelocity.SafeNormalize(Vector2.UnitY) * 50f, laserVelocity, type, damage, 0f, Main.myPlayer); } npc.netUpdate = true; } } + int x = (int)npc.Center.X / 16; + int y = (int)npc.Center.Y / 16; + if (WorldGen.InWorld(x, y) && !WorldGen.SolidTile(x, y)) + Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0.3f, 0.1f, 0.05f); + if (probeTargetX > 0f) { npc.spriteDirection = 1; @@ -1745,10 +2175,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } Vector2 vector3 = new Vector2(num4, num5); @@ -1759,7 +2191,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses vector3 = v.SafeNormalize(Vector2.UnitY) * num12; } - Projectile.NewProjectile(npc.GetSource_FromAI(), vector.X, vector.Y, vector3.X, vector3.Y, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector + vector3.SafeNormalize(Vector2.UnitY) * 50f, vector3, type, damage, 0f, Main.myPlayer); } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs index 92201592c9..4f6178bc94 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (phase2AI) { setDamage = (int)Math.Round(setDamage * 1.44); - npc.defense = (int)(npc.defDefense * 0.8f); + npc.defense = (int)Math.Round(npc.defDefense * 0.8); } else npc.defense = npc.defDefense; @@ -189,6 +189,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (masterMode) { idlePhaseTimer /= 2; + idlePhaseAcceleration *= 1.3f; + idlePhaseVelocity *= 1.3f; chargeTime -= 4; chargeVelocity += 3f; } @@ -433,6 +435,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] = 0f; if (enrage) npc.ai[2] = sharknadoPhaseTimer - 40; + else if (masterMode) + npc.ai[2] = sharknadoPhaseTimer - 60; } // Go to phase 2 @@ -1042,6 +1046,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.dust[phase3ChargeDust].velocity -= npc.velocity; } + // Spawn bubbles during charge in Master Mode + if (masterMode && phase4) + { + if (npc.ai[2] % (bubbleBelchPhaseDivisor * 2) == 0f) + { + SoundEngine.PlaySound(SoundID.NPCDeath19, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 bubbleSpawnDirection = Vector2.Normalize(player.Center - npc.Center) * (npc.width + 20) / 2f + npc.Center; + NPC.NewNPC(npc.GetSource_FromAI(), (int)bubbleSpawnDirection.X, (int)bubbleSpawnDirection.Y + 45, NPCID.DetonatingBubble); + } + } + } + npc.ai[2] += 1f; if (npc.ai[2] >= chargeTime) { @@ -1137,18 +1156,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } bool pop = npc.ai[0] == 1f; + Vector2 velocityVector = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); - float inertia = 40f; + float inertia = 30f; float velocity = 25f; npc.velocity = (npc.velocity * inertia + velocityVector * velocity) / (inertia + 1f); + npc.scale = npc.ai[3]; + npc.alpha -= 30; if (npc.alpha < 50) npc.alpha = 50; - npc.alpha = 50; - npc.velocity.X = (npc.velocity.X * 50f + Main.windSpeedCurrent * 2f + (float)Main.rand.Next(-10, 11) * 0.1f) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + -0.25f + (float)Main.rand.Next(-10, 11) * 0.2f) / 51f; + + float inertia2 = inertia + 10f; + npc.velocity.X = (npc.velocity.X * inertia2 + (float)Main.rand.Next(-10, 11) * 0.1f) / (inertia2 + 1f); + npc.velocity.Y = (npc.velocity.Y * inertia2 + -0.25f + (float)Main.rand.Next(-10, 11) * 0.2f) / (inertia2 + 1f); if (npc.velocity.Y > 0f) npc.velocity.Y -= 0.04f; @@ -1230,7 +1253,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (flag3) { setDamage = (int)Math.Round(setDamage * 1.2 * damageScale); - npc.defense = (int)((float)npc.defDefense * 0.8f); + npc.defense = (int)Math.Round(npc.defDefense * 0.8); } else npc.defense = npc.defDefense; @@ -1699,11 +1722,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 vector8 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + center; Vector2 sharknadoBoltVelocity = new Vector2(npc.direction * 2, masterMode ? 12f : 8f); Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity * -Vector2.UnitX, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer); + sharknadoBoltVelocity = new Vector2(npc.direction * -2, masterMode ? 12f : 8f); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer); if (masterMode) { - Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity * -Vector2.UnitY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, -1f); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity * -1f, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, -1f); + sharknadoBoltVelocity = new Vector2(npc.direction * 2, masterMode ? -12f : -8f); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, -1f); + sharknadoBoltVelocity = new Vector2(npc.direction * -2, masterMode ? -12f : -8f); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, -1f); } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs index 6aac78f7c5..cbde6907ff 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs @@ -107,10 +107,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.type == NPCID.EaterofWorldsHead) { if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - calamityGlobalNPC.newAI[0] += 1f; + calamityGlobalNPC.newAI[0] += ((npc.justHit && masterMode) ? 10f : 1f); float timer = enrageScale > 0f ? 120f : 180f; - float shootBoost = (0.8f - lifeRatio) * 120f; + float shootBoost = lifeRatio * 120f; timer += shootBoost; if (enrageScale >= 2f) @@ -318,6 +318,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } } + if (freeMoveAnyway) inTiles = true; } @@ -343,8 +344,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (masterMode) { - segmentVelocity += 2f; - segmentAcceleration += 0.04f; + segmentVelocity += (npc.justHit ? 8f : 2f); + segmentAcceleration += (npc.justHit ? 0.16f : 0.04f); } if (Main.getGoodWorld) @@ -403,7 +404,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses calamityGlobalNPC.newAI[1] += 1f; // Set velocity for when a new head spawns - npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (segmentVelocity * (death ? 0.75f : 0.5f)); + // Only set this if the head is far enough away from the player, to avoid unfair hits + if (npc.Distance(Main.player[npc.target].Center) > segmentVelocity * 20f) + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (segmentVelocity * (death ? 0.75f : 0.5f)); } if (!inTiles) @@ -584,7 +587,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float pushDistanceLowerLimit = 16f - numHeads; float pushDistanceUpperLimit = 160f - numHeads * 10f; float pushDistance = MathHelper.Lerp(pushDistanceLowerLimit, pushDistanceUpperLimit, 1f - lifeRatio) * npc.scale; - float pushVelocity = 0.5f + enrageScale * 0.25f; + float pushVelocity = 0.25f + enrageScale * 0.125f; for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].active) @@ -633,30 +636,33 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Calculate contact damage based on velocity - float minimalContactDamageVelocity = segmentVelocity * 0.25f; - float minimalDamageVelocity = segmentVelocity * 0.5f; + // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. + float minimalContactDamageHeadVelocity = segmentVelocity * 0.25f; + float minimalDamageHeadVelocity = segmentVelocity * 0.5f; + float minimalContactDamageBodyVelocity = segmentVelocity * 0.4f; + float minimalDamageBodyVelocity = segmentVelocity * 0.8f; if (npc.type == NPCID.EaterofWorldsHead) { - if (npc.velocity.Length() <= minimalContactDamageVelocity) + if (npc.velocity.Length() <= minimalContactDamageHeadVelocity) { - npc.damage = (int)(npc.defDamage * 0.5f); + npc.damage = (int)Math.Round(npc.defDamage * 0.5); } else { - float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar); + float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageHeadVelocity) / minimalDamageHeadVelocity, 0f, 1f); + npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); } } else { float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) + if (bodyAndTailVelocity <= minimalContactDamageBodyVelocity) { npc.damage = 0; } else { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageBodyVelocity) / minimalDamageBodyVelocity, 0f, 1f); npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); } } @@ -680,6 +686,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.alpha = 0; } } + else if (npc.type > NPCID.EaterofWorldsHead && npc.alpha > 0) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } // Manually sync newAI because there is no GlobalNPC.SendExtraAI if (npc.active && npc.netUpdate && Main.netMode == NetmodeID.Server) @@ -1133,30 +1145,33 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Calculate contact damage based on velocity - float minimalContactDamageVelocity = num52 * 0.25f; - float minimalDamageVelocity = num52 * 0.5f; + // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. + float minimalContactDamageHeadVelocity = num52 * 0.25f; + float minimalDamageHeadVelocity = num52 * 0.5f; + float minimalContactDamageBodyVelocity = num52 * 0.4f; + float minimalDamageBodyVelocity = num52 * 0.8f; if (npc.type == NPCID.EaterofWorldsHead) { - if (npc.velocity.Length() <= minimalContactDamageVelocity) + if (npc.velocity.Length() <= minimalContactDamageHeadVelocity) { - npc.damage = (int)(npc.defDamage * 0.5f); + npc.damage = (int)Math.Round(npc.defDamage * 0.5); } else { - float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar); + float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageHeadVelocity) / minimalDamageHeadVelocity, 0f, 1f); + npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); } } else { float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) + if (bodyAndTailVelocity <= minimalContactDamageBodyVelocity) { npc.damage = 0; } else { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageBodyVelocity) / minimalDamageBodyVelocity, 0f, 1f); npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); } } @@ -1180,6 +1195,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.alpha = 0; } } + else if (npc.type > NPCID.EaterofWorldsHead && npc.alpha > 0) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } return false; } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs index 7a9fb4b541..6124306f68 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs @@ -54,8 +54,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 etherealLanceDistance = new Vector2(0f, -450f); Vector2 sunDanceDistance = new Vector2(-80f, -500f); - float acceleration = death ? 0.55f : 0.48f; - float velocity = death ? 14f : 12f; + float acceleration = death ? 0.66f : 0.6f; + float velocity = death ? 16.5f : 15f; float movementDistanceGateValue = 40f; float despawnDistanceGateValue = 6400f; @@ -316,7 +316,20 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } if (attackPatternLength % attackIncrement == phase2Attack7) - attackType = 6; + { + if (phase3) + { + attackType = 4; + + // Adjust the upcoming Ethereal Lance attack depending on what random variable is chosen here. + calamityGlobalNPC.newAI[3] = Main.rand.Next(2); + + // Sync the Calamity AI variables. + npc.SyncExtraAI(); + } + else + attackType = 6; + } if (attackPatternLength % attackIncrement == phase2Attack8) { @@ -666,7 +679,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Increase durability. calamityGlobalNPC.DR = shouldBeInPhase2ButIsStillInPhase1 ? 0.99f : (bossRush ? 0.99f : 0.575f); - int totalSunDances = phase3 ? 1 : phase2 ? 2 : 3; + int totalSunDances = phase2 ? 2 : 3; float sunDanceGateValue = dayTimeEnrage ? 35f : death ? 40f : 50f; float totalSunDancePhaseTime = totalSunDances * sunDanceGateValue; @@ -685,7 +698,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int sunDanceExtension = (int)(npc.ai[1] / sunDanceGateValue); int targetFloatDirection = (targetData2.Center.X > npc.Center.X) ? 1 : 0; - float projAmount = phase3 ? 12f : phase2 ? 8f : 6f; + float projAmount = phase2 ? 8f : 6f; float projRotation = 1f / projAmount; for (float j = 0f; j < 1f; j += projRotation) { @@ -746,10 +759,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses totalProjectiles += 5f; lanceSpacing += 50f; lanceWallSize *= (masterMode ? 0.75f : 0.5f); - float direction = 1f; - if (phase3) - direction *= (Main.rand.NextBool() ? 1f : -1f); int randomLanceWallType; do randomLanceWallType = Main.rand.Next(numLanceWalls); @@ -849,17 +859,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses case 8: case 9: - takeDamage = !(npc.ai[1] >= 6f) || !(npc.ai[1] <= 40f); - int chargeDirection = (npc.ai[0] != 8f) ? 1 : (-1); AI_120_HallowBoss_DoMagicEffect(npc.Center, 5, Utils.GetLerpValue(40f, 90f, npc.ai[1], clamped: true), npc); - float dashAcceleration = phase3 ? 0.08f : 0.05f; - - float chargeGateValue = phase3 ? 30f : 40f; - float playChargeSoundTime = phase3 ? 15f : 20f; - float chargeDuration = phase3 ? 35f : 50f; + float chargeGateValue = 40f; + float playChargeSoundTime = 20f; + float chargeDuration = phase3 ? 40f : 50f; + float slowDownTime = 30f; + float totalPhaseTime = chargeGateValue + chargeDuration + slowDownTime; float chargeStartDistance = phase3 ? 1000f : 800f; float chargeVelocity = phase3 ? 100f : 70f; float chargeAcceleration = phase3 ? 0.1f : 0.07f; @@ -941,8 +949,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } npc.ai[1] += 1f; - extraPhaseTime = (dayTimeEnrage ? 48f : 96f) * lessTimeSpentPerPhaseMultiplier; - if (npc.ai[1] >= 150f + extraPhaseTime) + extraPhaseTime = (dayTimeEnrage ? 24f : 48f) * lessTimeSpentPerPhaseMultiplier; + if (npc.ai[1] >= totalPhaseTime + extraPhaseTime) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -987,7 +995,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses break; - // Spawn Ethereal Lances around the target in seemingly random places (they will be made slower to make this easier to deal with). + // Spawn Ethereal Lances ahead of the target. case 11: // Avoid cheap bullshit. @@ -1029,7 +1037,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.Distance(targetCenter) > 2400f) continue; - Vector2 straightLanceSpawnPredict = targetCenter + targetData6.Velocity * 90; + Vector2 straightLanceSpawnPredict = targetCenter + (oppositeLance ? -targetData6.Velocity : targetData6.Velocity) * 90; Vector2 straightLanceSpawnDirection = targetCenter + inverseTargetVel * spawnDistance; if (straightLanceSpawnDirection.Distance(targetCenter) < spawnDistance) { @@ -1060,7 +1068,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses inverseTargetVel = oppositeLance ? player.velocity : -player.velocity; inverseTargetVel.SafeNormalize(-Vector2.UnitY); targetCenter = player.Center; - Vector2 extraPlayerLancePredict = targetCenter + player.velocity * 90; + Vector2 extraPlayerLancePredict = targetCenter + (oppositeLance ? -player.velocity : player.velocity) * 90; straightLanceSpawnDirection = targetCenter + inverseTargetVel * spawnDistance; if (straightLanceSpawnDirection.Distance(targetCenter) < spawnDistance) { @@ -1252,9 +1260,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.dontTakeDamage = !takeDamage; if (phase3) - npc.defense = (int)(npc.defDefense * 0.5f); + npc.defense = (int)Math.Round(npc.defDefense * 0.8); else if (phase2) - npc.defense = (int)(npc.defDefense * 1.2f); + npc.defense = (int)Math.Round(npc.defDefense * 1.2); else npc.defense = npc.defDefense; @@ -1273,19 +1281,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - Vector2 stopMovingLocation = new Vector2(-150f, -250f); - Vector2 stopMovingLocation2 = new Vector2(150f, -250f); - Vector2 stopMovingLocation3 = new Vector2(0f, -350f); - Vector2 stopMovingLocation4 = new Vector2(0f, -350f); + Vector2 stopMovingLocation = new Vector2(-250f, -350f); + Vector2 stopMovingLocation3 = new Vector2(0f, -450f); + Vector2 stopMovingLocation4 = new Vector2(0f, -450f); Vector2 stopMovingLocation5 = new Vector2(-80f, -500f); - float moveSpeed = 0.5f; - float desiredVelocity = 12f; - float stopMovingDistance = 40f; - float despawnDistance = 6400f; - int lanceDamage = npc.GetProjectileDamage(ProjectileID.FairyQueenLance); - int rainbowStreakDamage = npc.GetProjectileDamage(ProjectileID.HallowBossRainbowStreak); - int lastingRainbowDamage = npc.GetProjectileDamage(ProjectileID.HallowBossLastingRainbow); - int sunDanceDamage = npc.GetProjectileDamage(ProjectileID.FairyQueenSunDance); // Rotation npc.rotation = npc.velocity.X * 0.005f; @@ -1319,6 +1318,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool becomeVisible = true; + float moveSpeed = masterMode ? 0.6f : expertMode ? 0.55f : 0.5f; + float desiredVelocity = masterMode ? 14.4f : expertMode ? 13.2f : 12f; + float stopMovingDistance = 40f; + float despawnDistance = 6400f; + int lanceDamage = npc.GetProjectileDamage(ProjectileID.FairyQueenLance); + int rainbowStreakDamage = npc.GetProjectileDamage(ProjectileID.HallowBossRainbowStreak); + int lastingRainbowDamage = npc.GetProjectileDamage(ProjectileID.HallowBossLastingRainbow); + int sunDanceDamage = npc.GetProjectileDamage(ProjectileID.FairyQueenSunDance); + lanceDamage *= projectileDamageMultiplier; rainbowStreakDamage *= projectileDamageMultiplier; lastingRainbowDamage *= projectileDamageMultiplier; @@ -1530,7 +1538,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses phase = 2; if (phaseIncrement % phaseDivisor == num54) - phase = 6; + phase = phase3 ? 4 : 6; if (phaseIncrement % phaseDivisor == num54) phase = phase3 ? 7 : 6; @@ -1836,7 +1844,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Increase durability. calamityGlobalNPC.DR = shouldBeInPhase2ButIsStillInPhase1 ? 0.99f : (BossRushEvent.BossRushActive ? 0.99f : 0.575f); - float extraPhaseTime = (masterMode ? 30 : expertMode ? 75 : 120) - reducedAttackCooldown; + float extraPhaseTime = (masterMode ? 105 : expertMode ? 120 : 135) - reducedAttackCooldown; Vector2 offset = new Vector2(0f, -100f); Vector2 sunDanceSpawnLocation = npc.Center + offset; NPCAimedTarget targetData = npc.GetTargetData(); @@ -1844,13 +1852,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.Distance(targetLocation + stopMovingLocation5) > stopMovingDistance) npc.SimpleFlyMovement(npc.DirectionTo(targetLocation + stopMovingLocation5).SafeNormalize(Vector2.Zero) * desiredVelocity * 0.3f, moveSpeed * 0.7f); - float phaseGateValue = phase3 ? (masterMode ? 60f : 120f) : 180f; + float phaseGateValue = masterMode ? 120f : 180f; int sunDanceGateValue = 60; if ((int)npc.ai[1] % sunDanceGateValue == 0 && npc.ai[1] < phaseGateValue) { int sunDanceSpawnOffset = (int)npc.ai[1] / sunDanceGateValue; int targetLocationX = ((targetData.Center.X > npc.Center.X) ? 1 : 0); - float numSunDancePetals = phase3 ? (masterMode ? 12f : 9f) : expertMode ? 8f : 6f; + float numSunDancePetals = masterMode ? 9f : expertMode ? 8f : 6f; float sunDanceIncrement = 1f / numSunDancePetals; for (float i = 0f; i < 1f; i += sunDanceIncrement) { @@ -1908,14 +1916,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { numLances += 5f; distanceBetweenLances += 50f; - - if (phase3) - num79 *= (Main.rand.NextBool() ? 1f : -1f); - lanceWallLength *= (masterMode ? 0.75f : 0.5f); } - switch (lanceWallType) { case 0: @@ -1983,14 +1986,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses case 9: { float extraPhaseTime = 20 - reducedAttackCooldown; - float startDashTime = phase3 ? 30f : 40f; - float playDashSoundTime = phase3 ? 15f : 20f; - float endDashTime = phase3 ? 65f : 90f; + float startDashTime = 40f; + float playDashSoundTime = 20f; + float endDashTime = phase3 ? 75f : 90f; int dashStartDistance = phase3 ? 750 : 550; int dashVelocity = phase3 ? 80 : 50; float dashAcceleration = phase3 ? 0.08f : 0.05f; - takeDamage = !(npc.ai[1] >= 6f) || !(npc.ai[1] <= startDashTime); int dashDirection = (npc.ai[0] != 8f ? 1 : -1); AI_120_HallowBoss_DoMagicEffect(npc.Center, 5, Utils.GetLerpValue(startDashTime, endDashTime, npc.ai[1], clamped: true), npc); @@ -2107,7 +2109,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses continue; int targetVelocityOffset = 90; - Vector2 vector14 = targetCenter + targetData.Velocity * targetVelocityOffset; + Vector2 vector14 = targetCenter + (oppositeLance ? -targetData.Velocity : targetData.Velocity) * targetVelocityOffset; Vector2 lanceSpawnLocation = targetCenter + vector13 * lanceSpawnOffset; if (lanceSpawnLocation.Distance(targetCenter) < lanceSpawnOffset) { @@ -2137,7 +2139,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses lanceSpawnOffset = 100f; targetCenter = player.Center; targetVelocityOffset = 90; - Vector2 lanceDestination = targetCenter + player.velocity * targetVelocityOffset; + Vector2 lanceDestination = targetCenter + (oppositeLance ? -player.velocity : player.velocity) * targetVelocityOffset; lanceSpawnLocation = targetCenter + vector13 * lanceSpawnOffset; if (lanceSpawnLocation.Distance(targetCenter) < lanceSpawnOffset) { @@ -2221,6 +2223,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses break; } + case 13: { // Avoid cheap bullshit. @@ -2305,9 +2308,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.dontTakeDamage = !takeDamage; if (phase3) - npc.defense = (int)(npc.defDefense * 0.5f); + npc.defense = (int)Math.Round(npc.defDefense * 0.8); else if (phase2) - npc.defense = (int)((float)npc.defDefense * 1.2f); + npc.defense = (int)Math.Round(npc.defDefense * 1.2); else npc.defense = npc.defDefense; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs index e70c1669e3..5e7306e588 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs @@ -1443,7 +1443,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else if (npc.ai[1] == 1f) { - SoundEngine.PlaySound(SoundID.ForceRoarPitched, npc.Center); + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); npc.rotation = num7; float num44 = Main.masterMode ? 8f : 6.8f; if (Main.expertMode && npc.ai[3] == 1f) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs index 9b0470f769..e8bf57f8e3 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs @@ -202,7 +202,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 projectileFirePos = new Vector2(npc.Center.X, npc.Center.Y - 60f); if (npc.localAI[1] % divisor == 0f && (Vector2.Distance(Main.player[npc.target].Center, projectileFirePos) > 160f || !freedHeadAlive)) { - float laserSpeed = turboEnrage ? 12f : enrage ? 9f : 6f; + float laserSpeed = turboEnrage ? 16f : enrage ? 12f : 6f; float laserTargetXDist = Main.player[npc.target].Center.X - projectileFirePos.X; float laserTargetYDist = Main.player[npc.target].Center.Y - projectileFirePos.Y; float laserTargetDistance = (float)Math.Sqrt(laserTargetXDist * laserTargetXDist + laserTargetYDist * laserTargetYDist); @@ -210,15 +210,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses laserTargetDistance = laserSpeed / laserTargetDistance; laserTargetXDist *= laserTargetDistance; laserTargetYDist *= laserTargetDistance; - projectileFirePos.X += laserTargetXDist * 3f; - projectileFirePos.Y += laserTargetYDist * 3f; + Vector2 laserVelocity = new Vector2(laserTargetXDist, laserTargetYDist); int type = ProjectileID.EyeBeam; int damage = npc.GetProjectileDamage(type); if (Main.netMode != NetmodeID.MultiplayerClient) { - int bodyLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos.X, projectileFirePos.Y, laserTargetXDist, laserTargetYDist, type, damage, 0f, Main.myPlayer); - Main.projectile[bodyLaser].timeLeft = 480; + int bodyLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); + Main.projectile[bodyLaser].timeLeft = enrage ? 720 : 360; if (turboEnrage && Main.getGoodWorld) Main.projectile[bodyLaser].extraUpdates += 1; } @@ -266,8 +265,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set damage npc.damage = npc.defDamage; - float velocityBoost = death ? 12f * (1f - lifeRatio) : 8f * (1f - lifeRatio); - float velocityX = (masterMode ? 6f : 4f) + velocityBoost; + float velocityBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); + float velocityX = (masterMode ? 9f : 6f) + velocityBoost; if (enrage) velocityX *= 1.5f; @@ -319,7 +318,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.TargetClosest(); // Play sound - SoundEngine.PlaySound(SoundID.Item14, npc.position); + SoundEngine.PlaySound(SoundID.Item14, npc.Center); npc.ai[0] = 0f; calamityGlobalNPC.newAI[1] = 0f; @@ -342,7 +341,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - // Fireball explosion when head is dead + // Fireball explosion when head is detached if (Main.netMode != NetmodeID.MultiplayerClient && (!headAlive || turboEnrage || CalamityWorld.LegendaryMode)) { for (int i = 0; i < 10; i++) @@ -373,13 +372,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int i = 0; i < totalFireballs; i++) { Vector2 spawnVector = new Vector2(npc.Center.X + Main.rand.Next(-spawnX, spawnX), npc.Center.Y + npc.height / 2 * 0.8f); - Vector2 velocity = new Vector2(Main.rand.NextBool() ? Main.rand.Next(masterMode ? 6 : 4, masterMode ? 9 : 6) : Main.rand.Next(masterMode ? -8 : -5, masterMode ? -5 : -3), Main.rand.Next(-1, 2)); + Vector2 velocity = new Vector2(Main.rand.NextBool() ? Main.rand.NextFloat(masterMode ? 9f : 6f, masterMode ? 12f : 9f) : Main.rand.NextFloat(masterMode ? -11f : -8f, masterMode ? -8f : -5f), Main.rand.NextFloat(-1.5f, 1.5f)); if (death) - velocity *= 1.5f; + velocity *= 1.25f; if (enrage) - velocity *= 1.25f; + velocity *= 1.5f; if (turboEnrage) velocity *= 1.25f; @@ -387,7 +386,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int type = ProjectileID.Fireball; int damage = npc.GetProjectileDamage(type); int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].timeLeft = 240; + Main.projectile[proj].timeLeft = enrage ? 480 : 240; if (turboEnrage && Main.getGoodWorld) Main.projectile[proj].extraUpdates += 1; } @@ -408,32 +407,33 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.Bottom.Y < Main.player[npc.target].position.Y) { float fallSpeedBoost = death ? 1.2f * (1f - lifeRatio) : 0.8f * (1f - lifeRatio); - float fallSpeed = 0.2f + fallSpeedBoost; + float fallSpeed = (masterMode ? 0.3f : 0.2f) + fallSpeedBoost; if (enrage) - fallSpeed *= 1.5f; + fallSpeed *= 2f; npc.velocity.Y += fallSpeed; } } else { - float velocityXChange = death ? (masterMode ? 0.5f : 0.3f) : (masterMode ? 0.3f : 0.2f); + float velocityChangeBoost = death ? 0.18f * (1f - lifeRatio) : 0.12f * (1f - lifeRatio); + float velocityXChange = (masterMode ? 0.3f : 0.2f) + velocityChangeBoost; if (npc.direction < 0) npc.velocity.X -= velocityXChange; else if (npc.direction > 0) npc.velocity.X += velocityXChange; - float velocityBoost = death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio); - float velocityXCap = (masterMode ? 5f : 3f) + velocityBoost; + float velocityBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); + float velocityXCap = (masterMode ? 9f : 6f) + velocityBoost; if (enrage) - velocityXCap *= 1.5f; + velocityXCap *= 3f; float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; int directionRelativeToTarget = playerLocation < 0 ? 1 : -1; bool slowDown = directionRelativeToTarget != calamityGlobalNPC.newAI[1]; if (slowDown) - velocityXCap *= 0.5f; + velocityXCap *= (enrage ? 0.2f : 0.5f); if (npc.velocity.X < -velocityXCap) npc.velocity.X = -velocityXCap; @@ -447,8 +447,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses void CustomGravity() { - float gravity = turboEnrage ? (Main.getGoodWorld ? 1.2f : 0.9f) : enrage ? 0.6f : (!leftFistAlive && !rightFistAlive) ? 0.45f : 0.3f; - float maxFallSpeed = reduceFallSpeed ? 12f : turboEnrage ? (Main.getGoodWorld ? 40f : 30f) : enrage ? 20f : (!leftFistAlive && !rightFistAlive) ? 15f : 10f; + float gravity = turboEnrage ? (Main.getGoodWorld ? 1.2f : 0.9f) : enrage ? 0.75f : (!leftFistAlive && !rightFistAlive) ? 0.45f : 0.3f; + float maxFallSpeed = reduceFallSpeed ? 12f : turboEnrage ? (Main.getGoodWorld ? 40f : 30f) : enrage ? 25f : (!leftFistAlive && !rightFistAlive) ? 15f : 10f; npc.velocity.Y += gravity; if (npc.velocity.Y > maxFallSpeed) @@ -533,10 +533,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.noTileCollide = true; - float fistSpeed = 24f; + float fistSpeed = 28f; fistSpeed *= (aggression + 3f) / 4f; - if (fistSpeed > 32f) - fistSpeed = 32f; + if (fistSpeed > 48f) + fistSpeed = 48f; float fistRestDistance = distanceFromRestPosition; if (fistRestDistance < 12f + fistSpeed) @@ -615,7 +615,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.collideX = false; npc.collideY = false; - float fistReturnSpeed = 20f; + float fistReturnSpeed = 24f; fistReturnSpeed *= (aggression + 3f) / 4f; if (fistReturnSpeed > 48f) fistReturnSpeed = 48f; @@ -817,19 +817,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[0] == 0f) { npc.ai[1] += 1f; - if (npc.ai[1] < 20f || npc.ai[1] > 130f) + float openMouthGateValue = (!rightFistAlive || !leftFistAlive) ? 10f : 20f; + float shootFireballGateValue = (!rightFistAlive || !leftFistAlive) ? 60f : 120f; + if (npc.ai[1] < openMouthGateValue || npc.ai[1] > shootFireballGateValue - openMouthGateValue) npc.localAI[0] = 1f; else npc.localAI[0] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 150f) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= shootFireballGateValue) { npc.TargetClosest(); npc.ai[1] = 0f; Vector2 headCent = new Vector2(npc.Center.X, npc.Center.Y + 10f * npc.scale); - float headFireballSpeed = turboEnrage ? 12f : enrage ? 10f : 8f; + float headFireballSpeed = turboEnrage ? 24f : enrage ? 18f : 9f; float headFireballTargetX = Main.player[npc.target].Center.X - headCent.X; float headFireballTargetY = Main.player[npc.target].Center.Y - headCent.Y; float headFireballTargetDist = (float)Math.Sqrt(headFireballTargetX * headFireballTargetX + headFireballTargetY * headFireballTargetY); @@ -869,21 +871,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[1] = 0f; // Fireballs - float shootBoost = death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); - npc.ai[1] += 1f + shootBoost; - - if (npc.ai[1] < 20f || npc.ai[1] > 220) + npc.ai[1] += 1f; + float openMouthGateValue = 20f - (death ? 15f * (1f - lifeRatio) : 10f * (1f - lifeRatio)); + float shootFireballGateValue = 120f - (death ? 90f * (1f - lifeRatio) : 60f * (1f - lifeRatio)); + if (npc.ai[1] < openMouthGateValue || npc.ai[1] > shootFireballGateValue - openMouthGateValue) npc.localAI[0] = 1f; else npc.localAI[0] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 240) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= shootFireballGateValue) { npc.TargetClosest(); npc.ai[1] = 0f; - float fireballSpeedFistsDed = turboEnrage ? 16f : enrage ? 14f : 12f; + float fireballSpeedFistsDed = turboEnrage ? 32f : enrage ? 24f : 12f; float fireballFistsDedTargetX = Main.player[npc.target].Center.X - projectileFirePos.X; float fireballFistsDedTargetY = Main.player[npc.target].Center.Y - projectileFirePos.Y; float fireballFistsDedTargetDist = (float)Math.Sqrt(fireballFistsDedTargetX * fireballFistsDedTargetX + fireballFistsDedTargetY * fireballFistsDedTargetY); @@ -898,7 +900,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int fireballAmount = masterMode ? 3 : 1; Vector2 fireballVelocity = new Vector2(fireballFistsDedTargetX, fireballFistsDedTargetY); for (int i = 0; i < fireballAmount; i++) - Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos, fireballVelocity * (1f / (i + 1)), type, damage, 0f, Main.myPlayer); + { + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos, fireballVelocity * (1f / (i + 1)), type, damage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 450; + } npc.netUpdate = true; } @@ -928,7 +933,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else projectileFirePos.X += 18f * npc.scale; - float laserSpeed = masterMode ? 11f : 9f; + float laserSpeed = masterMode ? 15f : 12f; float laserTargetXDist = Main.player[npc.target].Center.X - projectileFirePos.X; float laserTargetYDist = Main.player[npc.target].Center.Y - projectileFirePos.Y; float laserTargetDistance = (float)Math.Sqrt(laserTargetXDist * laserTargetXDist + laserTargetYDist * laserTargetYDist); @@ -936,13 +941,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses laserTargetDistance = laserSpeed / laserTargetDistance; laserTargetXDist *= laserTargetDistance; laserTargetYDist *= laserTargetDistance; - projectileFirePos.X += laserTargetXDist * 3f; - projectileFirePos.Y += laserTargetYDist * 3f; + Vector2 laserVelocity = new Vector2(laserTargetXDist, laserTargetYDist); if (Main.netMode != NetmodeID.MultiplayerClient) { - int bodyLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos.X, projectileFirePos.Y, laserTargetXDist, laserTargetYDist, projType, dmg, 0f, Main.myPlayer); - Main.projectile[bodyLaser].timeLeft = enrage ? 480 : 300; + int bodyLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, projType, dmg, 0f, Main.myPlayer); + Main.projectile[bodyLaser].timeLeft = enrage ? 600 : 300; if (turboEnrage && Main.getGoodWorld) Main.projectile[bodyLaser].extraUpdates += 1; @@ -958,7 +962,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.localAI[1] == 1f) projectileFirePos.X += 30f * npc.scale; - float extraLaserSpeed = masterMode ? 11f : 9f; + float extraLaserSpeed = masterMode ? 15f : 12f; float extraLaserTargetX = Main.player[npc.target].Center.X - projectileFirePos.X; float extraLaserTargetY = Main.player[npc.target].Center.Y - projectileFirePos.Y; float extraLaserTargetDist = (float)Math.Sqrt(extraLaserTargetX * extraLaserTargetX + extraLaserTargetY * extraLaserTargetY); @@ -966,13 +970,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses extraLaserTargetDist = extraLaserSpeed / extraLaserTargetDist; extraLaserTargetX *= extraLaserTargetDist; extraLaserTargetY *= extraLaserTargetDist; - projectileFirePos.X += extraLaserTargetX * 3f; - projectileFirePos.Y += extraLaserTargetY * 3f; + Vector2 laserVelocity = new Vector2(extraLaserTargetX, extraLaserTargetY); if (Main.netMode != NetmodeID.MultiplayerClient) { - int extraLasers = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos.X, projectileFirePos.Y, extraLaserTargetX, extraLaserTargetY, projType, dmg, 0f, Main.myPlayer); - Main.projectile[extraLasers].timeLeft = enrage ? 480 : 300; + int extraLasers = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, projType, dmg, 0f, Main.myPlayer); + Main.projectile[extraLasers].timeLeft = enrage ? 600 : 300; if (turboEnrage && Main.getGoodWorld) Main.projectile[extraLasers].extraUpdates += 1; @@ -1070,9 +1073,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Move to new location if (npc.ai[3] <= 0f) { - npc.ai[3] = 300f; + npc.ai[3] = 400f; - float maxDistance = 300f; + float maxDistance = 400f; // Four corners around target if (phase3 || turboEnrage) @@ -1082,10 +1085,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses switch ((int)calamityGlobalNPC.newAI[0]) { case 0: - case 300: + case 400: calamityGlobalNPC.newAI[0] = -maxDistance; break; - case -300: + case -400: calamityGlobalNPC.newAI[1] = maxDistance; break; default: @@ -1097,10 +1100,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses switch ((int)calamityGlobalNPC.newAI[0]) { case 0: - case -300: + case -400: calamityGlobalNPC.newAI[0] = maxDistance; break; - case 300: + case 400: calamityGlobalNPC.newAI[1] = -maxDistance; break; default: @@ -1117,10 +1120,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses case 0: calamityGlobalNPC.newAI[0] = maxDistance; break; - case 300: + case 400: calamityGlobalNPC.newAI[0] = -maxDistance; break; - case -300: + case -400: calamityGlobalNPC.newAI[0] = 0f; break; default: @@ -1148,19 +1151,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 destination = Main.player[npc.target].Center + new Vector2(offsetX, offsetY); // Velocity and acceleration - float velocity = 7f + - ((phase2 || turboEnrage) ? 4f : 0f) + - ((phase3 || turboEnrage) ? 4f : 0f); + float velocity = 16f + + ((phase2 || turboEnrage) ? 8f : 0f) + + ((phase3 || turboEnrage) ? 8f : 0f); if (enrage) - velocity = (phase3 || turboEnrage) ? 25f : 20f; + velocity = (phase3 || turboEnrage) ? 40f : 32f; - float acceleration = enrage ? 0.4f : phase3 ? 0.2f : phase2 ? 0.15f : 0.1f; + float acceleration = phase3 ? 0f : turboEnrage ? 6f : enrage ? 4.8f : phase2 ? 1.2f : 0.8f; - // How far is from where it's supposed to be + // How far Golem's Head is from where it's supposed to be Vector2 distanceFromDestination = destination - npc.Center; - CalamityUtils.SmoothMovement(npc, 0f, distanceFromDestination, velocity, acceleration, true); + // Whether Golem can fire projectiles + bool canFireProjectiles = distanceFromDestination.Length() < 120f || enrage; + + CalamityUtils.SmoothMovement(npc, 80f, distanceFromDestination, velocity, acceleration, !phase3); if (death && calamityGlobalNPC.newAI[2] < 120f) { @@ -1176,25 +1182,28 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Fireballs - float shootBoost = death ? 3f * (2f - (lifeRatio + golemLifeRatio)) : 2f * (2f - (lifeRatio + golemLifeRatio)); - npc.ai[1] += 1f + shootBoost; + if (canFireProjectiles) + npc.ai[1] += 1f; - if (npc.ai[1] < 20f || npc.ai[1] > 340) + float combinedLifeRatio = (lifeRatio + golemLifeRatio) * 0.5f; + float openMouthGateValue = 20f - (death ? 15f * (1f - combinedLifeRatio) : 10f * (1f - combinedLifeRatio)); + float shootFireballGateValue = 240f - (death ? 180f * (1f - combinedLifeRatio) : 120f * (1f - combinedLifeRatio)); + if (npc.ai[1] < openMouthGateValue || npc.ai[1] > shootFireballGateValue - openMouthGateValue) npc.localAI[0] = 1f; else npc.localAI[0] = 0f; if (canPassThroughTiles && !phase3) - npc.ai[1] = 20f; + npc.ai[1] = openMouthGateValue; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 360 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= shootFireballGateValue) { npc.TargetClosest(); npc.ai[1] = 0f; - Vector2 freeHeadCenter = new Vector2(npc.Center.X, npc.Center.Y - 10f * npc.scale); - float freeHeadSpeed = turboEnrage ? 8f : enrage ? 6.5f : 5f; + Vector2 freeHeadCenter = new Vector2(npc.Center.X, npc.Center.Y + 20f * npc.scale); + float freeHeadSpeed = turboEnrage ? 24f : enrage ? 18f : 6f; if (masterMode) freeHeadSpeed *= 1.25f; @@ -1208,21 +1217,27 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int projectileType = (phase3 || masterMode) ? ProjectileID.InfernoHostileBolt : ProjectileID.Fireball; int damage = npc.GetProjectileDamage(projectileType); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), freeHeadCenter.X, freeHeadCenter.Y, freeHeadTargetX, freeHeadTargetY, projectileType, damage, 0f, Main.myPlayer); + float ai0 = projectileType == ProjectileID.InfernoHostileBolt ? Main.player[npc.target].Center.X : 0f; + float ai1 = projectileType == ProjectileID.InfernoHostileBolt ? Main.player[npc.target].Center.Y : 0f; + float ai2 = projectileType == ProjectileID.InfernoHostileBolt ? 1f : 0f; + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), freeHeadCenter.X, freeHeadCenter.Y, freeHeadTargetX, freeHeadTargetY, projectileType, damage, 0f, Main.myPlayer, ai0, ai1, ai2); if (projectileType == ProjectileID.InfernoHostileBolt) { Main.projectile[proj].timeLeft = 300; - Main.projectile[proj].ai[0] = Main.player[npc.target].Center.X; - Main.projectile[proj].ai[1] = Main.player[npc.target].Center.Y; Main.projectile[proj].netUpdate = true; } + else + Main.projectile[proj].timeLeft = 450; npc.netUpdate = true; } // Lasers - npc.ai[2] += 1f + shootBoost; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] >= 300f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) + if (canFireProjectiles) + npc.ai[2] += 1f; + + float laserGateValue = 300f - (death ? 240f * (1f - combinedLifeRatio) : 180f * (1f - combinedLifeRatio)); + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] >= laserGateValue) { npc.TargetClosest(); @@ -1232,13 +1247,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool leftLaserIsFast = Main.rand.NextBool(); for (int i = 0; i < numLasers; i++) { - Vector2 freeHeadProjSpawn = new Vector2(npc.Center.X, npc.Center.Y - 50f * npc.scale); + Vector2 freeHeadProjSpawn = new Vector2(npc.Center.X, npc.Center.Y - 20f * npc.scale); if (i == 0) freeHeadProjSpawn.X -= 14f * npc.scale; else if (i == 1) freeHeadProjSpawn.X += 14f * npc.scale; - float freeHeadProjSpeed = 5f + shootBoost; + float freeHeadProjSpeed = 5f + (death ? 5f * (1f - combinedLifeRatio) : 3f * (1f - combinedLifeRatio)); if (masterMode) { if (i == 0) @@ -1264,13 +1279,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses freeHeadProjTargetDist = freeHeadProjSpeed / freeHeadProjTargetDist; freeHeadProjTargetX *= freeHeadProjTargetDist; freeHeadProjTargetY *= freeHeadProjTargetDist; - freeHeadProjSpawn.X += freeHeadProjTargetX * 3f; - freeHeadProjSpawn.Y += freeHeadProjTargetY * 3f; + Vector2 laserVelocity = new Vector2(freeHeadProjTargetX, freeHeadProjTargetY); int type = ProjectileID.EyeBeam; int damage = npc.GetProjectileDamage(type); - int freeHeadLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), freeHeadProjSpawn.X, freeHeadProjSpawn.Y, freeHeadProjTargetX, freeHeadProjTargetY, type, damage, 0f, Main.myPlayer); - Main.projectile[freeHeadLaser].timeLeft = enrage ? 480 : 300; + int freeHeadLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), freeHeadProjSpawn + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); + Main.projectile[freeHeadLaser].timeLeft = enrage ? 600 : 300; if (turboEnrage && Main.getGoodWorld) Main.projectile[freeHeadLaser].extraUpdates += 1; } @@ -1281,7 +1295,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.position += npc.netOffset; int randDustOffset = Main.rand.Next(2) * 2 - 1; Vector2 randDustPos = npc.Bottom + new Vector2((float)(randDustOffset * 22) * npc.scale, -22f * npc.scale); - Dust getGoodDust = Dust.NewDustPerfect(randDustPos, 228, ((float)Math.PI / 2f + -(float)Math.PI / 2f * (float)randDustOffset + Main.rand.NextFloatDirection() * ((float)Math.PI / 4f)).ToRotationVector2() * (2f + Main.rand.NextFloat())); + Dust getGoodDust = Dust.NewDustPerfect(randDustPos, 228, (MathHelper.PiOver2 + -MathHelper.PiOver2 * (float)randDustOffset + Main.rand.NextFloatDirection() * MathHelper.PiOver4).ToRotationVector2() * (2f + Main.rand.NextFloat())); Dust dust = getGoodDust; dust.velocity += npc.velocity; getGoodDust.noGravity = true; @@ -1970,9 +1984,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.life < npc.lifeMax / 5) npc.ai[2] += num719; - if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - npc.ai[2] += 4f; - if (npc.ai[2] > (float)(60 + Main.rand.Next(600))) { npc.ai[2] = 0f; @@ -1997,11 +2008,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses num734 = num731 / num734; num732 *= num734; num733 *= num734; - vector91.X += num732 * 3f; - vector91.Y += num733 * 3f; + + Vector2 laserVelocity = new Vector2(num732, num733); if (Main.netMode != NetmodeID.MultiplayerClient) { - int num735 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector91.X, vector91.Y, num732, num733, type, damage, 0f, Main.myPlayer); + int num735 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector91 + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); Main.projectile[num735].timeLeft = 300; } } @@ -2021,11 +2032,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses num739 = num736 / num739; num737 *= num739; num738 *= num739; - vector91.X += num737 * 3f; - vector91.Y += num738 * 3f; + + Vector2 laserVelocity = new Vector2(num737, num738); if (Main.netMode != NetmodeID.MultiplayerClient) { - int num740 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector91.X, vector91.Y, num737, num738, type, damage, 0f, Main.myPlayer); + int num740 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector91 + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); Main.projectile[num740].timeLeft = 300; } } @@ -2133,7 +2144,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.TargetClosest(); npc.ai[1] = 0f; - Vector2 vector93 = new Vector2(npc.Center.X, npc.Center.Y - 10f * npc.scale); + Vector2 vector93 = new Vector2(npc.Center.X, npc.Center.Y + 20f * npc.scale); float num749 = 8f; int type = ProjectileID.Fireball; @@ -2172,19 +2183,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 6) npc.ai[2] += num756; - bool flag38 = false; - if (!Collision.CanHit(Main.npc[NPC.golemBoss].Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - flag38 = true; - - if (flag38) - npc.ai[2] += num756 * 10f; - if (npc.ai[2] > (float)(100 + Main.rand.Next(4800))) { npc.ai[2] = 0f; for (int num757 = 0; num757 < 2; num757++) { - Vector2 vector94 = new Vector2(npc.Center.X, npc.Center.Y - 50f * npc.scale); + Vector2 vector94 = new Vector2(npc.Center.X, npc.Center.Y - 20f * npc.scale); switch (num757) { case 0: @@ -2212,25 +2216,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float num761 = Main.player[npc.target].Center.X; float num762 = Main.player[npc.target].Center.Y; - if (flag38) - { - damage = (int)((double)damage * 1.5); - num758 *= 2.5f; - num761 += Main.player[npc.target].velocity.X * Main.rand.NextFloat() * 50f; - num762 += Main.player[npc.target].velocity.Y * Main.rand.NextFloat() * 50f; - } - num761 -= vector94.X; num762 -= vector94.Y; float num763 = (float)Math.Sqrt(num761 * num761 + num762 * num762); num763 = num758 / num763; num761 *= num763; num762 *= num763; - vector94.X += num761 * 3f; - vector94.Y += num762 * 3f; + + Vector2 laserVelocity = new Vector2(num761, num762); if (Main.netMode != NetmodeID.MultiplayerClient) { - int num764 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector94.X, vector94.Y, num761, num762, type, damage, 0f, Main.myPlayer); + int num764 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector94 + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); Main.projectile[num764].timeLeft = 300; } } @@ -2241,7 +2237,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.position += npc.netOffset; int num765 = Main.rand.Next(2) * 2 - 1; Vector2 vector95 = npc.Bottom + new Vector2((float)(num765 * 22) * npc.scale, -22f * npc.scale); - Dust dust5 = Dust.NewDustPerfect(vector95, 228, ((float)Math.PI / 2f + -(float)Math.PI / 2f * (float)num765 + Main.rand.NextFloatDirection() * ((float)Math.PI / 4f)).ToRotationVector2() * (2f + Main.rand.NextFloat())); + Dust dust5 = Dust.NewDustPerfect(vector95, 228, (MathHelper.PiOver2 + -MathHelper.PiOver2 * (float)num765 + Main.rand.NextFloatDirection() * MathHelper.PiOver4).ToRotationVector2() * (2f + Main.rand.NextFloat())); Dust dust = dust5; dust.velocity += npc.velocity; dust5.noGravity = true; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs index 05c53c3550..9471ffab87 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs @@ -73,7 +73,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - SoundEngine.PlaySound(SoundID.Item38, npc.position); + SoundEngine.PlaySound(SoundID.Item38, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs index 395a85b030..68cc7251c2 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs @@ -914,7 +914,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[1] = 1f; if (attackTimer == attackTimerComparison - 35f) - SoundEngine.PlaySound(SoundID.NPCDeath6, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath6, npc.Center); if ((shootFirstBolt || shootSecondBolt || shootThirdBolt) && Main.netMode != NetmodeID.MultiplayerClient) { @@ -1515,7 +1515,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[1] = 1f; if (handAttackTimer == handAttackTimerComparison - 35f) - SoundEngine.PlaySound(SoundID.NPCDeath6, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath6, npc.Center); if ((shootFirstBolt || shootSecondBolt || shootThirdBolt) && Main.netMode != NetmodeID.MultiplayerClient) { @@ -1787,7 +1787,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[2] = MathHelper.Lerp(npc.localAI[2], 0.4f, 0.2f); if (secondAttackTimer == secondAttackPicker - 35f) - SoundEngine.PlaySound(SoundID.NPCDeath6, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath6, npc.Center); if ((secondAttackTimer == secondAttackPicker - 14f || secondAttackTimer == secondAttackPicker - 7f || secondAttackTimer == secondAttackPicker) && Main.netMode != NetmodeID.MultiplayerClient) { @@ -1919,7 +1919,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] = (Main.player[npc.target].Center - npc.Center).ToRotation() + MathHelper.PiOver2; - npc.rotation = npc.rotation.AngleTowards(npc.ai[2], 0.104719758f); + npc.rotation = npc.rotation.AngleTowards(npc.ai[2], MathHelper.Pi / 30f); return false; } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs index b560ef881d..a2879abe0b 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs @@ -20,6 +20,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public const float SeedGatlingColorChangeGateValue = SeedGatlingStopValue - SeedGatlingColorChangeDuration; public const float TentaclePhaseSlowDuration = 1200f; public const float ChargePhaseGateValue = 900f; + public const float ChargeTelegraphColorChangeGateValue = ChargePhaseGateValue - SeedGatlingColorChangeDuration; public const float ReduceSpeedForChargeDistance = 480f; public const float BeginChargeGateValue = -120f; public const float BeginChargeSlowDownGateValue = BeginChargeGateValue - 45f; @@ -222,7 +223,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int projectileType = shootThornBall ? ProjectileID.ThornBall : shootPoisonSeed ? ProjectileID.PoisonSeedPlantera : ProjectileID.SeedPlantera; int damage = npc.GetProjectileDamage(projectileType); Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); - Vector2 spawnOffset = npc.Center + projectileVelocity * 50f; + Vector2 spawnOffset = npc.Center + projectileVelocity * 70f; int dustType = shootPoisonSeed ? 74 : 73; int dustSpawnBoxSize = shootThornBall ? 38 : 14; @@ -342,7 +343,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int projectileType = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(projectileType); Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); - Vector2 spawnOffset = npc.Center + projectileVelocity * 50f; + Vector2 spawnOffset = npc.Center + projectileVelocity * 70f; int dustType = 73; Vector2 dustVelocity = projectileVelocity * projectileSpeed; @@ -626,7 +627,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float projectileSpeed = masterMode ? 16f : 14f; int damage = npc.GetProjectileDamage(projectileType); Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); - Vector2 spawnOffset = npc.Center + projectileVelocity * 50f; + Vector2 spawnOffset = npc.Center + projectileVelocity * 70f; int dustType = shootPoisonSeed ? 74 : 73; Vector2 dustVelocity = projectileVelocity * projectileSpeed; @@ -752,7 +753,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { bool shootPinkSeed = i % 2 == 0; if (shootPinkSeed) + { type = ProjectileID.SeedPlantera; + damage = npc.GetProjectileDamage(type); + } else type = ProjectileID.PoisonSeedPlantera; @@ -769,12 +773,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, perturbedSpeed * projectileSpeed, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, perturbedSpeed * projectileSpeed * 0.5f, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileSpeed); + } + + if (death) + { + type = ProjectileID.ThornBall; + damage = npc.GetProjectileDamage(type); + Vector2 spawnOffset = npc.Center + projectileVelocity * 50f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, projectileVelocity * projectileSpeed, type, damage, 0f, Main.myPlayer); } if (masterMode && Main.netMode != NetmodeID.MultiplayerClient) { - float sporeSpeed = Main.masterMode ? 12f : Main.expertMode ? 10f : 8f; + float sporeSpeed = Main.masterMode ? 12f : 10f; Vector2 sporeVelocity = projectileVelocity * sporeSpeed; int spore = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore); Main.npc[spore].velocity.X = sporeVelocity.X; @@ -1018,9 +1032,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - // Emit light Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0.2f, 0.4f, 0.1f); @@ -1073,19 +1084,20 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = npc.defDamage; // Movement variables + int maxOffset = 100; if (Main.netMode != NetmodeID.MultiplayerClient) { if (npc.ai[0] == 0f || npc.ai[1] == 0f) { - npc.ai[0] = Main.rand.Next(-100, 101); - npc.ai[1] = Main.rand.Next(-100, 101); + npc.ai[0] = Main.rand.Next(-maxOffset, maxOffset + 1); + npc.ai[1] = Main.rand.Next(-maxOffset, maxOffset + 1); npc.netUpdate = true; } } // Velocity and acceleration float tentacleAcceleration = death ? 2.4f : 1.6f; - float extendedDistanceFromPlantera = (1f - lifeRatio) * 2f; + float extendedDistanceFromPlantera = Math.Abs(npc.ai[0] + npc.ai[1]) / maxOffset; float tentacleVelocity = 100f + (extendedDistanceFromPlantera * 300f); float deceleration = (death ? 0.5f : 0.8f) / (1f + extendedDistanceFromPlantera); @@ -1389,33 +1401,50 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses num791 = num788 / num791; num789 *= num791; num790 *= num791; - int type = ProjectileID.SeedPlantera; + int type = Main.masterMode ? ProjectileID.PoisonSeedPlantera : ProjectileID.SeedPlantera; int maxValue2 = 4; - int maxValue3 = 8; + int thornBallChance = 8; if (Main.expertMode) { maxValue2 = 2; - maxValue3 = Main.masterMode ? 5 : 6; + thornBallChance = Main.masterMode ? 5 : 6; } - if ((double)npc.life < (double)npc.lifeMax * 0.8 && (Main.rand.NextBool(maxValue2) || Main.masterMode)) + if ((double)npc.life < npc.lifeMax * 0.8 && Main.rand.NextBool(maxValue2) && !Main.masterMode) { npc.localAI[1] = -30f; type = ProjectileID.PoisonSeedPlantera; } - else if ((double)npc.life < (double)npc.lifeMax * 0.8 && Main.rand.NextBool(maxValue3)) + else if ((double)npc.life < npc.lifeMax * 0.8 && Main.rand.NextBool(thornBallChance)) { - npc.localAI[1] = -120f; - type = ProjectileID.ThornBall; + bool shootThornBall = true; + int numThornBalls = 0; + int thornBallLimit = 3; + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].active && Main.projectile[i].type == ProjectileID.ThornBall) + { + numThornBalls++; + if (numThornBalls >= thornBallLimit) + { + shootThornBall = false; + break; + } + } + } + + npc.localAI[1] = shootThornBall ? -120f : -30f; + type = shootThornBall ? ProjectileID.ThornBall : ProjectileID.PoisonSeedPlantera; } + else if (Main.masterMode) + npc.localAI[1] = -30f; int damage = npc.GetProjectileDamage(type); if (flag39) damage *= 2; - vector99.X += num789 * 3f; - vector99.Y += num790 * 3f; - int num794 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector99.X, vector99.Y, num789, num790, type, damage, 0f, Main.myPlayer); + Vector2 projectileVelocity = new Vector2(num789, num790); + int num794 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector99 + projectileVelocity.SafeNormalize(Vector2.UnitY) * 70f, projectileVelocity, type, damage, 0f, Main.myPlayer); if (type != ProjectileID.ThornBall) Main.projectile[num794].timeLeft = 300; } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs index 04a7774b72..018cac6431 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs @@ -838,9 +838,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); + bool enrage = true; + int targetTileX = (int)Main.player[npc.target].Center.X / 16; + int targetTileY = (int)Main.player[npc.target].Center.Y / 16; + + Tile tile = Framing.GetTileSafely(targetTileX, targetTileY); + if (tile.WallType == WallID.HiveUnsafe) + enrage = false; + bool dead4 = Main.player[npc.target].dead; float num644 = 0f; - if ((double)(npc.position.Y / 16f) < Main.worldSurface) + if ((double)(npc.position.Y / 16f) < Main.worldSurface && enrage) num644 += 1f; if (!Main.player[npc.target].ZoneJungle) @@ -932,6 +940,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else if (npc.ai[0] == 0f) { + // Charging distance from player + int chargeDistanceX = Main.masterMode ? 425 : 600; + if (Main.expertMode) + { + int chargeDistanceReduction = Main.masterMode ? 25 : 50; + if ((double)npc.life < (double)npc.lifeMax * 0.1) + chargeDistanceX -= chargeDistanceReduction * 6; + else if ((double)npc.life < (double)npc.lifeMax * 0.25) + chargeDistanceX -= chargeDistanceReduction * 3; + else if ((double)npc.life < (double)npc.lifeMax * 0.5) + chargeDistanceX -= chargeDistanceReduction * 2; + else if ((double)npc.life < (double)npc.lifeMax * 0.75) + chargeDistanceX -= chargeDistanceReduction; + } + chargeDistanceX -= (int)(100f * num644); + int num648 = Main.masterMode ? 1 : 2; if (Main.expertMode) { @@ -961,9 +985,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = 0; npc.TargetClosest(); - float num649 = 20f; - num649 += 20f * num644; - if (Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) < num649) + + float chargeDistanceY = 20f; + chargeDistanceY += 20f * num644; + + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y); + if (distanceFromTargetY < chargeDistanceY && distanceFromTargetX >= chargeDistanceX) { // Set damage npc.damage = npc.defDamage; @@ -998,8 +1026,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses num653 = num650 / num653; npc.velocity.X = num651 * num653; npc.velocity.Y = num652 * num653; + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; + SoundEngine.PlaySound(SoundID.Zombie125, npc.Center); + return false; } @@ -1037,31 +1070,39 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses num654 += 3f * num644; num655 += 0.5f * num644; - if (npc.Center.Y < Main.player[npc.target].Center.Y) + + // Velocity calculations + if (npc.Center.Y < Main.player[npc.target].Center.Y - chargeDistanceY) npc.velocity.Y += num655; - else + else if (npc.Center.Y > Main.player[npc.target].Center.Y + chargeDistanceY) npc.velocity.Y -= num655; + else + npc.velocity.Y *= 0.7f; - if (npc.velocity.Y < 0f - num654) - npc.velocity.Y = 0f - num654; - + if (npc.velocity.Y < -num654) + npc.velocity.Y = -num654; if (npc.velocity.Y > num654) npc.velocity.Y = num654; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 600f) - npc.velocity.X += 0.15f * (float)npc.direction; - else if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 300f) - npc.velocity.X -= 0.15f * (float)npc.direction; + float distanceXMax = 100f; + float distanceXMin = 20f; + if (distanceFromTargetX > chargeDistanceX + distanceXMax) + npc.velocity.X += 0.15f * npc.direction; + else if (distanceFromTargetX < chargeDistanceX + distanceXMin) + npc.velocity.X -= 0.15f * npc.direction; else - npc.velocity.X *= 0.8f; + npc.velocity.X *= 0.7f; if (npc.velocity.X < -16f) npc.velocity.X = -16f; - if (npc.velocity.X > 16f) npc.velocity.X = 16f; + // Face the correct direction + float playerLocation2 = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation2 < 0 ? 1 : -1; npc.spriteDirection = npc.direction; + return false; } @@ -1074,33 +1115,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.direction = 1; npc.spriteDirection = npc.direction; - int num656 = Main.masterMode ? 425 : 600; - if (Main.expertMode) - { - int chargeDistanceReduction = Main.masterMode ? 25 : 50; - if ((double)npc.life < (double)npc.lifeMax * 0.1) - num656 -= chargeDistanceReduction * 6; - else if ((double)npc.life < (double)npc.lifeMax * 0.25) - num656 -= chargeDistanceReduction * 3; - else if ((double)npc.life < (double)npc.lifeMax * 0.5) - num656 -= chargeDistanceReduction * 2; - else if ((double)npc.life < (double)npc.lifeMax * 0.75) - num656 -= chargeDistanceReduction; - } int num657 = 1; if (npc.Center.X < Main.player[npc.target].Center.X) num657 = -1; - num656 -= (int)(100f * num644); bool flag34 = false; - if (npc.direction == num657 && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > (float)num656) + if (npc.direction == num657 && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > (float)chargeDistanceX) { npc.ai[2] = 1f; flag34 = true; } - if (Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)num656 * 1.5f) + if (Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)chargeDistanceX * 1.5f) { npc.ai[2] = 1f; flag34 = true; @@ -1111,9 +1138,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[2] == 1f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.TargetClosest(); + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; + npc.localAI[0] = 0f; + npc.velocity *= (Main.masterMode ? 0.8f : 0.9f); float num658 = Main.masterMode ? 0.2f : 0.1f; if (Main.expertMode) @@ -1158,17 +1193,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = 0; npc.TargetClosest(); - npc.spriteDirection = npc.direction; - float num659 = Main.masterMode ? 16f : 12f; - float num660 = 0.07f; - if (Main.expertMode) - num660 = Main.masterMode ? 0.15f : 0.1f; - Vector2 vector83 = npc.Center; - float num661 = Main.player[npc.target].Center.X - vector83.X; - float num662 = Main.player[npc.target].Center.Y - 200f - vector83.Y; - float num663 = (float)Math.Sqrt(num661 * num661 + num662 * num662); - if (num663 < 200f) + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + float num659 = Main.masterMode ? 14f : 12f; + float num660 = 0.14f; + if (Main.expertMode) + num660 = Main.masterMode ? 0.3f : 0.2f; + + bool canHitTarget = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + float distanceAboveTarget = !canHitTarget ? 0f : 320f; + Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * distanceAboveTarget; + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * num659; + + if (Vector2.Distance(npc.Center, hoverDestination) < 200f && canHitTarget) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -1176,32 +1216,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - num663 = num659 / num663; - if (npc.velocity.X < num661) - { - npc.velocity.X += num660; - if (npc.velocity.X < 0f && num661 > 0f) - npc.velocity.X += num660; - } - else if (npc.velocity.X > num661) - { - npc.velocity.X -= num660; - if (npc.velocity.X > 0f && num661 < 0f) - npc.velocity.X -= num660; - } - - if (npc.velocity.Y < num662) - { - npc.velocity.Y += num660; - if (npc.velocity.Y < 0f && num662 > 0f) - npc.velocity.Y += num660; - } - else if (npc.velocity.Y > num662) - { - npc.velocity.Y -= num660; - if (npc.velocity.Y > 0f && num662 < 0f) - npc.velocity.Y -= num660; - } + npc.SimpleFlyMovement(idealVelocity, num660); } else if (npc.ai[0] == 1f) { @@ -1210,11 +1225,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[0] = 0f; npc.TargetClosest(); - Vector2 vector84 = new Vector2(npc.Center.X + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector85 = npc.Center; - float num664 = Main.player[npc.target].Center.X - vector85.X; - float num665 = Main.player[npc.target].Center.Y - vector85.Y; - float num666 = (float)Math.Sqrt(num664 * num664 + num665 * num665); + + float num672 = Main.masterMode ? 16f : 14f; + float num673 = Main.masterMode ? 0.15f : 0.1f; + + Vector2 beeSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + Vector2 beeSpawnCollisionLocation = new Vector2(beeSpawnLocation.X, beeSpawnLocation.Y - 30f); + bool canHitTarget = Collision.CanHit(beeSpawnCollisionLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * (!canHitTarget ? 0f : 320f); + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * num672; + npc.ai[1] += (Main.masterMode ? 2f : 1f); if (Main.expertMode) { @@ -1249,13 +1269,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses flag35 = true; } - if (Collision.CanHit(vector84, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag35) + if (Collision.CanHit(beeSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag35) { SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { int num670 = Main.rand.Next(NPCID.Bee, NPCID.BeeSmall + 1); - int num671 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector84.X, (int)vector84.Y, num670); + int num671 = NPC.NewNPC(npc.GetSource_FromAI(), (int)beeSpawnLocation.X, (int)beeSpawnLocation.Y, num670); Vector2 beeVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); Main.npc[num671].velocity = beeVelocity; Main.npc[num671].velocity *= 5f; @@ -1265,45 +1285,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - if (num666 > 400f || !Collision.CanHit(new Vector2(vector84.X, vector84.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num672 = Main.masterMode ? 16f : 14f; - float num673 = Main.masterMode ? 0.15f : 0.1f; - vector85 = vector84; - num664 = Main.player[npc.target].Center.X - vector85.X; - num665 = Main.player[npc.target].Center.Y - vector85.Y; - num666 = (float)Math.Sqrt(num664 * num664 + num665 * num665); - num666 = num672 / num666; - if (npc.velocity.X < num664) - { - npc.velocity.X += num673; - if (npc.velocity.X < 0f && num664 > 0f) - npc.velocity.X += num673; - } - else if (npc.velocity.X > num664) - { - npc.velocity.X -= num673; - if (npc.velocity.X > 0f && num664 < 0f) - npc.velocity.X -= num673; - } - - if (npc.velocity.Y < num665) - { - npc.velocity.Y += num673; - if (npc.velocity.Y < 0f && num665 > 0f) - npc.velocity.Y += num673; - } - else if (npc.velocity.Y > num665) - { - npc.velocity.Y -= num673; - if (npc.velocity.Y > 0f && num665 < 0f) - npc.velocity.Y -= num673; - } - } + // Velocity calculations if target is too far away + if (Vector2.Distance(beeSpawnLocation, hoverDestination) > 400f || !canHitTarget) + npc.SimpleFlyMovement(idealVelocity, num673); else npc.velocity *= (Main.masterMode ? 0.8f : 0.9f); + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; + float maxBees = Main.masterMode ? 8f : 5f; if (npc.ai[2] > maxBees) { @@ -1317,21 +1308,25 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Avoid cheap bullshit npc.damage = 0; - float num674 = 4f; - float num675 = 0.05f; + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + float num674 = 12f; + float num675 = 0.1f; if (Main.expertMode) { - num675 = Main.masterMode ? 0.1f : 0.075f; - num674 = Main.masterMode ? 8f : 6f; + num675 = Main.masterMode ? 0.2f : 0.15f; + num674 = Main.masterMode ? 16f : 14f; } - num675 += 0.2f * num644; num674 += 6f * num644; - Vector2 vector86 = new Vector2(npc.Center.X + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector87 = npc.Center; - float num676 = Main.player[npc.target].Center.X - vector87.X; - float num677 = Main.player[npc.target].Center.Y - 300f - vector87.Y; - float num678 = (float)Math.Sqrt(num676 * num676 + num677 * num677); + + Vector2 stingerSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + bool canHitTarget = Collision.CanHit(new Vector2(stingerSpawnLocation.X, stingerSpawnLocation.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * (!canHitTarget ? 0f : 300f); + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * num674; + npc.ai[1] += 1f; int num679 = 40; if (Main.masterMode) @@ -1340,7 +1335,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses num679 = (((double)npc.life < (double)npc.lifeMax * 0.1) ? 15 : ((npc.life < npc.lifeMax / 3) ? 25 : ((npc.life >= npc.lifeMax / 2) ? 35 : 30))); num679 -= (int)((Main.masterMode ? 3f : 5f) * num644); - if (npc.ai[1] % (float)num679 == (float)(num679 - 1) && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector86, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (npc.ai[1] % (float)num679 == (float)(num679 - 1) && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(stingerSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { SoundEngine.PlaySound(SoundID.Item17, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -1362,87 +1357,20 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (num682 < 1) num682 = 1; - float num683 = Main.player[npc.target].Center.X - vector86.X + (float)Main.rand.Next(-num681, num681 + 1); - float num684 = Main.player[npc.target].Center.Y - vector86.Y + (float)Main.rand.Next(-num682, num682 + 1); + float num683 = Main.player[npc.target].Center.X - stingerSpawnLocation.X + (float)Main.rand.Next(-num681, num681 + 1); + float num684 = Main.player[npc.target].Center.Y - stingerSpawnLocation.Y + (float)Main.rand.Next(-num682, num682 + 1); float num685 = (float)Math.Sqrt(num683 * num683 + num684 * num684); num685 = num680 / num685; num683 *= num685; num684 *= num685; int type = ProjectileID.QueenBeeStinger; - int num688 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector86.X, vector86.Y, num683, num684, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + int num688 = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation.X, stingerSpawnLocation.Y, num683, num684, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); Main.projectile[num688].timeLeft = 300; } } - if (!Collision.CanHit(new Vector2(vector86.X, vector86.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - num674 = Main.masterMode ? 16f : 14f; - num675 = Main.masterMode ? 0.15f : 0.1f; - if (num644 > 0f) - num675 = 0.5f; - - vector87 = vector86; - num676 = Main.player[npc.target].Center.X - vector87.X; - num677 = Main.player[npc.target].Center.Y - vector87.Y; - num678 = (float)Math.Sqrt(num676 * num676 + num677 * num677); - num678 = num674 / num678; - if (npc.velocity.X < num676) - { - npc.velocity.X += num675; - if (npc.velocity.X < 0f && num676 > 0f) - npc.velocity.X += num675; - } - else if (npc.velocity.X > num676) - { - npc.velocity.X -= num675; - if (npc.velocity.X > 0f && num676 < 0f) - npc.velocity.X -= num675; - } - - if (npc.velocity.Y < num677) - { - npc.velocity.Y += num675; - if (npc.velocity.Y < 0f && num677 > 0f) - npc.velocity.Y += num675; - } - else if (npc.velocity.Y > num677) - { - npc.velocity.Y -= num675; - if (npc.velocity.Y > 0f && num677 < 0f) - npc.velocity.Y -= num675; - } - } - else if (num678 > 100f) - { - npc.TargetClosest(); - npc.spriteDirection = npc.direction; - num678 = num674 / num678; - if (npc.velocity.X < num676) - { - npc.velocity.X += num675; - if (npc.velocity.X < 0f && num676 > 0f) - npc.velocity.X += num675 * 2f; - } - else if (npc.velocity.X > num676) - { - npc.velocity.X -= num675; - if (npc.velocity.X > 0f && num676 < 0f) - npc.velocity.X -= num675 * 2f; - } - - if (npc.velocity.Y < num677) - { - npc.velocity.Y += num675; - if (npc.velocity.Y < 0f && num677 > 0f) - npc.velocity.Y += num675 * 2f; - } - else if (npc.velocity.Y > num677) - { - npc.velocity.Y -= num675; - if (npc.velocity.Y > 0f && num677 < 0f) - npc.velocity.Y -= num675 * 2f; - } - } + if (Vector2.Distance(stingerSpawnLocation, hoverDestination) > 40f || !canHitTarget) + npc.SimpleFlyMovement(idealVelocity, num675); float num689 = Main.masterMode ? 16f : 20f; num689 -= 5f * num644; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs index 83860b3830..3d6e175345 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs @@ -307,11 +307,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spawn spread of projectiles in Master Mode if (masterMode) { - int numGelProjectiles = phase4 ? Main.rand.Next(9, 12) : phase2 ? Main.rand.Next(6, 9) : 12; + int numGelProjectiles = 12; if (Main.getGoodWorld) numGelProjectiles = 15; - float projectileVelocity = death ? 15f : 12f; + float projectileVelocity = death ? 22.5f : 18f; int type = ProjectileID.QueenSlimeGelAttack; int damage = npc.GetProjectileDamage(type); @@ -324,7 +324,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (CalamityWorld.LegendaryMode) spinningpoint *= Main.rand.NextFloat() + 0.5f; - spinningpoint = spinningpoint.RotatedBy((-j) * ((float)Math.PI * 2f) / numGelProjectiles, Vector2.Zero); + spinningpoint = spinningpoint.RotatedBy((-j) * MathHelper.TwoPi / numGelProjectiles, Vector2.Zero); int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, damage, 0f, Main.myPlayer, 0f, -2f); Main.projectile[proj].timeLeft = 900; } @@ -504,10 +504,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (masterMode) { Vector2 extraSmashPosition = npc.Bottom + Vector2.UnitX * 1000f; - for (int i = 0; i < 11; i++) + float expandDelay = 0f; + int maxSmashes = 11; + int maxSmashesPerSide = (maxSmashes - 1) / 2; + float maxExpandDelay = 20f * maxSmashesPerSide; + for (int i = 0; i < maxSmashes; i++) { - if (i != 5) - Projectile.NewProjectile(npc.GetSource_FromAI(), extraSmashPosition, Vector2.Zero, type, damage, 0f, Main.myPlayer); + expandDelay = MathHelper.Lerp(0f, maxExpandDelay, Math.Abs(i - maxSmashesPerSide) / (float)maxSmashesPerSide); + if (i != maxSmashesPerSide) + Projectile.NewProjectile(npc.GetSource_FromAI(), extraSmashPosition, Vector2.Zero, type, damage, 0f, Main.myPlayer, -expandDelay); extraSmashPosition -= Vector2.UnitX * 200f; } @@ -516,7 +521,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Eruption of crystals in phase 3 if (npc.ai[0] == 6f && phase3) { - float projectileVelocity = masterMode ? 15f : 12f; + float projectileVelocity = masterMode ? 18f : 12f; type = ProjectileID.QueenSlimeMinionBlueSpike; damage = npc.GetProjectileDamage(type); Vector2 destination = (new Vector2(npc.Center.X, npc.Center.Y - 100f) - npc.Center).SafeNormalize(Vector2.UnitY); @@ -688,11 +693,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { int numGelProjectiles = phase4 ? Main.rand.Next(9, 12) : phase2 ? Main.rand.Next(6, 9) : 12; if (masterMode) - numGelProjectiles += 2; + numGelProjectiles += 6; if (Main.getGoodWorld) - numGelProjectiles = 15; + numGelProjectiles = 20; - float projectileVelocity = death ? (masterMode ? 15f : 12f) : (masterMode ? 13f : 10.5f); + float projectileVelocity = death ? (masterMode ? 18f : 12f) : (masterMode ? 15.75f : 10.5f); int type = ProjectileID.QueenSlimeGelAttack; int damage = npc.GetProjectileDamage(type); if (phase2) @@ -719,7 +724,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (CalamityWorld.LegendaryMode) spinningpoint *= Main.rand.NextFloat() + 0.5f; - spinningpoint = spinningpoint.RotatedBy((-j) * ((float)Math.PI * 2f) / numGelProjectiles, Vector2.Zero); + spinningpoint = spinningpoint.RotatedBy((-j) * MathHelper.TwoPi / numGelProjectiles, Vector2.Zero); int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, damage, 0f, Main.myPlayer, 0f, -2f); Main.projectile[proj].timeLeft = 900; } @@ -1167,9 +1172,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int type = ProjectileID.QueenSlimeGelAttack; for (int j = 0; j < num14; j++) { - Vector2 spinningpoint = new Vector2(9f, 0f); - spinningpoint = spinningpoint.RotatedBy((float)(-j) * ((float)Math.PI * 2f) / (float)num14, Vector2.Zero); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, spinningpoint.X, spinningpoint.Y, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + Vector2 spinningpoint = new Vector2(15f, 0f); + spinningpoint = spinningpoint.RotatedBy((float)(-j) * MathHelper.TwoPi / (float)num14, Vector2.Zero); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); } } } @@ -1320,10 +1325,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.masterMode) { Vector2 extraSmashPosition = npc.Bottom + Vector2.UnitX * 1000f; - for (int i = 0; i < 11; i++) + float expandDelay = 0f; + int maxSmashes = 11; + int maxSmashesPerSide = (maxSmashes - 1) / 2; + float maxExpandDelay = 20f * maxSmashesPerSide; + for (int i = 0; i < maxSmashes; i++) { - if (i != 5) - Projectile.NewProjectile(npc.GetSource_FromAI(), extraSmashPosition, Vector2.Zero, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + expandDelay = MathHelper.Lerp(0f, maxExpandDelay, Math.Abs(i - maxSmashesPerSide) / (float)maxSmashesPerSide); + if (i != maxSmashesPerSide) + Projectile.NewProjectile(npc.GetSource_FromAI(), extraSmashPosition, Vector2.Zero, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, -expandDelay); extraSmashPosition -= Vector2.UnitX * 200f; } @@ -1462,8 +1472,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int type = ProjectileID.QueenSlimeGelAttack; for (int j = 0; j < num15; j++) { - Vector2 spinningpoint = new Vector2(Main.masterMode ? 12f : 9f, 0f); - spinningpoint = spinningpoint.RotatedBy((float)(-j) * ((float)Math.PI * 2f) / (float)num14, Vector2.Zero); + Vector2 spinningpoint = new Vector2(Main.masterMode ? 13.5f : 9f, 0f); + spinningpoint = spinningpoint.RotatedBy((float)(-j) * MathHelper.TwoPi / (float)num14, Vector2.Zero); Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); } } @@ -1727,5 +1737,340 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.rotation < -0.5f) npc.rotation = -0.5f; } + + public static bool QueenSlimeCrystalSlimeAI(NPC npc, Mod mod) + { + if (npc.localAI[0] > 0f) + npc.localAI[0] -= 1f; + + if (!npc.wet && Main.player[npc.target].active && !Main.player[npc.target].dead && !Main.player[npc.target].npcTypeNoAggro[npc.type]) + { + Player obj = Main.player[npc.target]; + Vector2 center = npc.Center; + float num19 = obj.Center.X - center.X; + float num20 = obj.Center.Y - center.Y; + float num21 = (float)Math.Sqrt(num19 * num19 + num20 * num20); + int num22 = NPC.CountNPCS(NPCID.QueenSlimeMinionBlue); + if (Main.expertMode && num22 < 5 && Math.Abs(num19) < 500f && Math.Abs(num20) < 550f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + { + npc.ai[0] = -40f; + if (npc.velocity.Y == 0f) + npc.velocity.X *= 0.9f; + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) + { + for (int k = 0; k < 3; k++) + { + Vector2 vector6 = new Vector2(k - 1, -4f); + vector6.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; + vector6.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; + vector6.Normalize(); + vector6 *= 6f + (float)Main.rand.Next(-50, 51) * 0.01f; + if (num21 > 350f) + vector6 *= 2f; + else if (num21 > 250f) + vector6 *= 1.5f; + + int type = ProjectileID.QueenSlimeMinionBlueSpike; + Projectile.NewProjectile(npc.GetSource_FromAI(), center, vector6 * ((Main.masterMode || BossRushEvent.BossRushActive) ? 0.8f : 0.5f), type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + npc.localAI[0] = 25f; + if (num22 > 4) + break; + } + } + } + else if (Math.Abs(num19) < 500f && Math.Abs(num20) < 550f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + { + float num23 = num21; + npc.ai[0] = -40f; + if (npc.velocity.Y == 0f) + npc.velocity.X *= 0.9f; + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) + { + num20 = Main.player[npc.target].position.Y - center.Y - (float)Main.rand.Next(0, 200); + num21 = (float)Math.Sqrt(num19 * num19 + num20 * num20); + num21 = 4.5f / num21; + num21 *= 2f; + if (num23 > 350f) + num21 *= 2f; + else if (num23 > 250f) + num21 *= 1.5f; + + num19 *= num21; + num20 *= num21; + npc.localAI[0] = 50f; + int type = ProjectileID.QueenSlimeMinionBlueSpike; + Vector2 spikeVelocity = new Vector2(num19, num20) * ((Main.masterMode || BossRushEvent.BossRushActive) ? 0.8f : 0.5f); + Projectile.NewProjectile(npc.GetSource_FromAI(), center, spikeVelocity, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + } + } + } + + if (npc.ai[2] > 1f) + npc.ai[2] -= 1f; + + if (npc.wet) + { + if (npc.collideY) + npc.velocity.Y = -2f; + + if (npc.velocity.Y < 0f && npc.ai[3] == npc.position.X) + { + npc.direction *= -1; + npc.ai[2] = 200f; + } + + if (npc.velocity.Y > 0f) + npc.ai[3] = npc.position.X; + + if (npc.velocity.Y > 2f) + npc.velocity.Y *= 0.9f; + + npc.velocity.Y -= 0.5f; + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + + if (npc.ai[2] == 1f) + npc.TargetClosest(); + } + + npc.aiAction = 0; + if (npc.ai[2] == 0f) + { + npc.ai[0] = -100f; + npc.ai[2] = 1f; + npc.TargetClosest(); + } + + if (npc.velocity.Y == 0f) + { + if (npc.collideY && npc.oldVelocity.Y != 0f && Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.position.X -= npc.velocity.X + (float)npc.direction; + + if (npc.ai[3] == npc.position.X) + { + npc.direction *= -1; + npc.ai[2] = 200f; + } + + npc.ai[3] = 0f; + npc.velocity.X *= 0.8f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + + npc.ai[0] += 7f; + + float num33 = -1000f; + + int num34 = 0; + if (npc.ai[0] >= 0f) + num34 = 1; + + if (npc.ai[0] >= num33 && npc.ai[0] <= num33 * 0.5f) + num34 = 2; + + if (npc.ai[0] >= num33 * 2f && npc.ai[0] <= num33 * 1.5f) + num34 = 3; + + if (num34 > 0) + { + npc.netUpdate = true; + if (npc.ai[2] == 1f) + npc.TargetClosest(); + + if (num34 == 3) + { + npc.velocity.Y = -8f; + npc.velocity.X += 3 * npc.direction; + npc.ai[0] = -200f; + npc.ai[3] = npc.position.X; + } + else + { + npc.velocity.Y = -6f; + npc.velocity.X += 2 * npc.direction; + npc.ai[0] = -120f; + if (num34 == 1) + npc.ai[0] += num33; + else + npc.ai[0] += num33 * 2f; + } + } + else if (npc.ai[0] >= -30f) + npc.aiAction = 1; + } + else if (npc.target < Main.maxPlayers && ((npc.direction == 1 && npc.velocity.X < 3f) || (npc.direction == -1 && npc.velocity.X > -3f))) + { + if (npc.collideX && Math.Abs(npc.velocity.X) == 0.2f) + npc.position.X -= 1.4f * (float)npc.direction; + + if (npc.collideY && npc.oldVelocity.Y != 0f && Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.position.X -= npc.velocity.X + (float)npc.direction; + + if ((npc.direction == -1 && (double)npc.velocity.X < 0.01) || (npc.direction == 1 && (double)npc.velocity.X > -0.01)) + npc.velocity.X += 0.2f * (float)npc.direction; + else + npc.velocity.X *= 0.93f; + } + + return false; + } + + public static bool QueenSlimeBouncySlimeAI(NPC npc, Mod mod) + { + if (npc.localAI[0] > 0f) + npc.localAI[0] -= 1f; + + if (!npc.wet && Main.player[npc.target].active && !Main.player[npc.target].dead && !Main.player[npc.target].npcTypeNoAggro[npc.type]) + { + Player obj2 = Main.player[npc.target]; + Vector2 center2 = npc.Center; + float num24 = obj2.Center.X - center2.X; + float num25 = obj2.Center.Y - center2.Y; + float num26 = (float)Math.Sqrt(num24 * num24 + num25 * num25); + float num27 = num26; + if (Math.Abs(num24) < 500f && Math.Abs(num25) < 550f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + { + npc.ai[0] = -40f; + if (npc.velocity.Y == 0f) + npc.velocity.X *= 0.9f; + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) + { + num25 = Main.player[npc.target].position.Y - center2.Y - (float)Main.rand.Next(0, 200); + num26 = (float)Math.Sqrt(num24 * num24 + num25 * num25); + num26 = 4.5f / num26; + num26 *= 2f; + if (num27 > 350f) + num26 *= 1.75f; + else if (num27 > 250f) + num26 *= 1.25f; + + num24 *= num26; + num25 *= num26; + npc.localAI[0] = 40f; + if (Main.expertMode) + npc.localAI[0] = 30f; + + int type = ProjectileID.QueenSlimeMinionPinkBall; + Vector2 pinkBallVelocity = new Vector2(num24, num25) * ((Main.masterMode || BossRushEvent.BossRushActive) ? 0.8f : 0.5f); + Projectile.NewProjectile(npc.GetSource_FromAI(), center2, pinkBallVelocity, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + } + } + } + + if (npc.ai[2] > 1f) + npc.ai[2] -= 1f; + + if (npc.wet) + { + if (npc.collideY) + npc.velocity.Y = -2f; + + if (npc.velocity.Y < 0f && npc.ai[3] == npc.position.X) + { + npc.direction *= -1; + npc.ai[2] = 200f; + } + + if (npc.velocity.Y > 0f) + npc.ai[3] = npc.position.X; + + if (npc.velocity.Y > 2f) + npc.velocity.Y *= 0.9f; + + npc.velocity.Y -= 0.5f; + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + + if (npc.ai[2] == 1f) + npc.TargetClosest(); + } + + npc.aiAction = 0; + if (npc.ai[2] == 0f) + { + npc.ai[0] = -100f; + npc.ai[2] = 1f; + npc.TargetClosest(); + } + + if (npc.velocity.Y == 0f) + { + if (npc.collideY && npc.oldVelocity.Y != 0f && Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.position.X -= npc.velocity.X + (float)npc.direction; + + if (npc.ai[3] == npc.position.X) + { + npc.direction *= -1; + npc.ai[2] = 200f; + } + + npc.ai[3] = 0f; + npc.velocity.X *= 0.8f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + + npc.ai[0] += 5f; + + float num33 = -500f; + + int num34 = 0; + if (npc.ai[0] >= 0f) + num34 = 1; + + if (npc.ai[0] >= num33 && npc.ai[0] <= num33 * 0.5f) + num34 = 2; + + if (npc.ai[0] >= num33 * 2f && npc.ai[0] <= num33 * 1.5f) + num34 = 3; + + if (num34 > 0) + { + npc.netUpdate = true; + if (npc.ai[2] == 1f) + npc.TargetClosest(); + + if (num34 == 3) + { + npc.velocity.Y = -8f; + npc.velocity.X += 3 * npc.direction; + npc.ai[0] = -200f; + npc.ai[3] = npc.position.X; + } + else + { + npc.velocity.Y = -6f; + npc.velocity.X += 2 * npc.direction; + npc.ai[0] = -120f; + if (num34 == 1) + npc.ai[0] += num33; + else + npc.ai[0] += num33 * 2f; + } + + npc.velocity.Y *= 1.6f; + npc.velocity.X *= 1.2f; + } + else if (npc.ai[0] >= -30f) + npc.aiAction = 1; + } + else if (npc.target < Main.maxPlayers && ((npc.direction == 1 && npc.velocity.X < 3f) || (npc.direction == -1 && npc.velocity.X > -3f))) + { + if (npc.collideX && Math.Abs(npc.velocity.X) == 0.2f) + npc.position.X -= 1.4f * (float)npc.direction; + + if (npc.collideY && npc.oldVelocity.Y != 0f && Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.position.X -= npc.velocity.X + (float)npc.direction; + + if ((npc.direction == -1 && (double)npc.velocity.X < 0.01) || (npc.direction == 1 && (double)npc.velocity.X > -0.01)) + npc.velocity.X += 0.2f * (float)npc.direction; + else + npc.velocity.X *= 0.93f; + } + + return false; + } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs index 2b601c3da4..be9ad7e510 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs @@ -190,11 +190,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Reduce the amount of skulls per spread in later phases due to near-constant teleporting - if (!masterMode) + if (!masterMode && numProj > 3) { if (phase4) numProj--; - if (phase5) + if (phase5 && numProj > 3) numProj--; } @@ -252,8 +252,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses double deltaAngle = spread / numProj; double offsetAngle; + // Inverse parabolic projectile spreads + bool evenNumberOfProjectiles = numProj % 2 == 0; + int centralProjectile = evenNumberOfProjectiles ? numProj / 2 : (numProj - 1) / 2; + int otherCentralProjectile = evenNumberOfProjectiles ? centralProjectile - 1 : -1; + float centralScalingAmount = (float)Math.Floor(numProj / (double)centralProjectile) * 0.75f; + float amountToAdd = evenNumberOfProjectiles ? 0.5f : 0f; + float originalBaseSpeed = baseSpeed; + float minVelocityMultiplier = 0.5f; for (int i = 0; i < numProj; i++) { + float velocityScalar = (evenNumberOfProjectiles && (i == centralProjectile || i == otherCentralProjectile)) ? minVelocityMultiplier : MathHelper.Lerp(minVelocityMultiplier, centralScalingAmount, Math.Abs((i + amountToAdd) - centralProjectile) / (float)centralProjectile); + baseSpeed = originalBaseSpeed; + baseSpeed *= velocityScalar; offsetAngle = startAngle + deltaAngle * i; int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), center.X, center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, -2f); Main.projectile[proj].timeLeft = 600; @@ -403,7 +414,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = 0; calamityGlobalNPC.newAI[1] += 1f; - float chargePhaseChangeRateBoost = phase5 ? (death ? 24f : 14f) : phase4 ? (death ? 4f : 3f) : (2f * ((1f - lifeRatio) / (1f - phase4LifeRatio))); + float chargePhaseChangeRateBoost = phase5 ? (death ? 24f : 14f) : phase4 ? (death ? 8f : 6f) : (4f * ((1f - lifeRatio) / (1f - phase4LifeRatio))); float chargePhaseChangeRate = chargePhaseChangeRateBoost + 1f; npc.ai[2] += chargePhaseChangeRate; npc.localAI[1] += chargePhaseChangeRate; @@ -412,7 +423,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[1] = chargePhaseGateValue; float forcedMoveAwayTime = death ? 30f : 60f; - float canChargeDistance = phase3 ? 800f : 320f; // 20 tile distance, 50 tile distance in phase 3 + float canChargeDistance = phase3 ? 640f : 320f; // 20 tile distance, 40 tile distance in phase 3 bool hasMovedForcedDistance = npc.localAI[2] >= forcedMoveAwayTime; bool canCharge = Vector2.Distance(Main.player[npc.target].Center, npc.Center) >= canChargeDistance; bool charge = npc.ai[2] >= chargePhaseGateValue && canCharge; @@ -601,14 +612,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Shoot shadowflames (giant cursed skull projectiles) while charging in phase 4 if (phase4 && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - float shadowFlameGateValue = death ? 16f : 24f; + float shadowFlameGateValue = death ? 30f : 45f; int shadowFlameLimit = death ? 3 : 2; if (calamityGlobalNPC.newAI[1] % shadowFlameGateValue == 0f && calamityGlobalNPC.newAI[1] < shadowFlameGateValue * shadowFlameLimit) { // Spawn projectiles if (Main.netMode != NetmodeID.MultiplayerClient) { - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 320f) { float shadowFlameProjectileSpeed = death ? 5f : 4f; if (masterMode) @@ -617,8 +628,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 initialProjectileVelocity = npc.Center.DirectionTo(Main.player[npc.target].Center) * shadowFlameProjectileSpeed; int type = ProjectileID.Shadowflames; int damage = npc.GetProjectileDamage(type); - int shadowFlameProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, initialProjectileVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[shadowFlameProjectile].timeLeft = 300; + int shadowFlameProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, initialProjectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); + Main.projectile[shadowFlameProjectile].timeLeft = 600; } } } @@ -716,7 +727,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses headSpinVelocityMult += velocityBoost; } - float altDashStopDistance = death ? (masterMode ? 210f : 240f) : (masterMode ? 320f : 400f); + float altDashStopDistance = death ? (masterMode ? 280f : 360f) : (masterMode ? 320f : 400f); float headSpeedIncreaseDist = phase3 ? altDashStopDistance : 160f; if (headSpinTargetDist > headSpeedIncreaseDist) { @@ -887,9 +898,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Attack far more often if still alive bool phase3 = skeletronLifeRatio < 0.3f; - float velocityMultiplier = MathHelper.Lerp(death ? 0.5f : 0.7f, 1f, skeletronLifeRatio); - float velocityIncrement = MathHelper.Lerp(0.2f, death ? 0.6f : 0.45f, 1f - skeletronLifeRatio); - float handSwipeVelocity = MathHelper.Lerp(16f, death ? 28f : 22f, 1f - skeletronLifeRatio); + float velocityMultiplier = MathHelper.Lerp(death ? 0.6f : 0.7f, 1f, skeletronLifeRatio); + float velocityIncrement = MathHelper.Lerp(0.2f, death ? 0.4f : 0.3f, 1f - skeletronLifeRatio); + float handSwipeVelocity = MathHelper.Lerp(16f, death ? 24f : 20f, 1f - skeletronLifeRatio); float deceleration = Main.getGoodWorld ? 0.78f : Main.masterMode ? 0.82f : Main.expertMode ? 0.86f : 0.9f; float handSwipeDuration = HandSwipeDistance / handSwipeVelocity; @@ -897,7 +908,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float slapTimerIncrement = MathHelper.Lerp(1f, 2f, 1f - skeletronLifeRatio); if (phase3) - slapTimerIncrement *= (death ? 3f : 2f); + slapTimerIncrement *= (death ? 2.5f : 2f); else if (phase2) slapTimerIncrement *= (death ? 2f : 1.5f); @@ -1239,7 +1250,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses numHands++; } - npc.defense += numHands * (Main.masterMode ? 50 : 25); + npc.defense += numHands * (Main.masterMode ? 15 : 10); npc.Calamity().CurrentlyIncreasingDefenseOrDR = numHands > 0; npc.chaseable = numHands == 0; if ((numHands < maxHands || (double)npc.life < (double)npc.lifeMax * 0.75 || Main.masterMode) && npc.ai[1] == 0f) @@ -1401,7 +1412,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = (int)Math.Round(npc.defDamage * 1.3); if (Main.expertMode) { - num175 = Main.masterMode ? 4f : 3.5f; + num175 = Main.masterMode ? (5f - numHands * 0.5f) : 3.5f; if (num174 > 150f) num175 *= 1.05f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs index 65905db2bf..5e55c7463f 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs @@ -359,7 +359,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.localAI[0] = 0f; - int totalProjectiles = bossRush ? 24 : 12; + int totalProjectiles = bossRush ? 24 : death ? 18 : 12; float radians = MathHelper.TwoPi / totalProjectiles; int type = ProjectileID.DeathLaser; int damage = npc.GetProjectileDamage(type); @@ -367,10 +367,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } float velocity = 3f; @@ -381,7 +383,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int k = 0; k < totalProjectiles; k++) { Vector2 laserFireDirection = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserFireDirection.SafeNormalize(Vector2.UnitY) * 30f, laserFireDirection, type, damage, 0f, Main.myPlayer, 1f, 0f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserFireDirection.SafeNormalize(Vector2.UnitY) * 100f, laserFireDirection, type, damage, 0f, Main.myPlayer, 1f, 0f); Main.projectile[proj].timeLeft = 900; } npc.localAI[1] += 1f; @@ -504,7 +506,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int type = ProjectileID.Skull; headCenter += value * 5f; - int enragedSkulls = Projectile.NewProjectile(npc.GetSource_FromAI(), headCenter.X, headCenter.Y, enragedHeadSkullTargetX, enragedHeadSkullTargetY, type, 250, 0f, Main.myPlayer, -1f, 0f); + int enragedSkulls = Projectile.NewProjectile(npc.GetSource_FromAI(), headCenter.X, headCenter.Y, enragedHeadSkullTargetX, enragedHeadSkullTargetY, type, 250, 0f, Main.myPlayer, -3f, 0f); Main.projectile[enragedSkulls].timeLeft = 300; } } @@ -628,14 +630,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } - headCenter += value * 5f; - int enragedSkulls = Projectile.NewProjectile(npc.GetSource_FromAI(), headCenter.X, headCenter.Y, enragedHeadSkullTargetX, enragedHeadSkullTargetY, type, damage, 0f, Main.myPlayer, -1f, 0f); + if (npc.localAI[0] % 3f == 0f) + { + int probeLimit = death ? 4 : 2; + if (NPC.CountNPCS(NPCID.Probe) < probeLimit) + NPC.NewNPC(npc.GetSource_FromAI(), (int)headCenter.X, (int)headCenter.Y + 30, NPCID.Probe); + } + + int enragedSkulls = Projectile.NewProjectile(npc.GetSource_FromAI(), headCenter.X, headCenter.Y + 30f, enragedHeadSkullTargetX, enragedHeadSkullTargetY, type, damage, 0f, Main.myPlayer, -3f, 0f); Main.projectile[enragedSkulls].timeLeft = 480; Main.projectile[enragedSkulls].tileCollide = false; } @@ -669,13 +679,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = npc.velocity.X / 15f; - float flightVelocity = bossRush ? 25f : death ? 20f : 15f; - float flightAcceleration = bossRush ? 0.25f : death ? 0.2f : 0.15f; + float flightVelocity = bossRush ? 28f : death ? 24f : 20f; + float flightAcceleration = bossRush ? 1.12f : death ? 0.96f : 0.8f; if (masterMode) { - flightVelocity += 5f; - flightAcceleration += 0.05f; + flightVelocity += 4f; + flightAcceleration += 0.16f; } Vector2 destination = new Vector2(Main.player[npc.target].Center.X, Main.player[npc.target].Center.Y - 500f); @@ -683,7 +693,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spit homing missiles and then go to floating phase npc.localAI[3] += 1f; - if (Vector2.Distance(npc.Center, destination) < 160f || npc.ai[2] > 0f || npc.localAI[3] > 120f) + if (Vector2.Distance(npc.Center, destination) < 80f || npc.ai[2] > 0f || npc.localAI[3] > 120f) { float missileSpawnDivisor = death ? (masterMode ? 6f : 8f) : (masterMode ? 9f : 12f); float totalMissiles = masterMode ? 12f : 10f; @@ -694,22 +704,23 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 velocity = new Vector2(-1f * (float)Main.rand.NextDouble() * 3f, 1f); + Vector2 velocity = new Vector2(-1f * (float)Main.rand.NextDouble() * 5f, 1f); velocity = velocity.RotatedBy((Main.rand.NextDouble() - 0.5) * MathHelper.PiOver4); - velocity *= 0.25f; int type = ProjectileID.RocketSkeleton; int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + Main.rand.Next(npc.width / 2), npc.Center.Y + 4f, velocity.X, velocity.Y, type, damage, 0f, Main.myPlayer, npc.target, 1f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + Main.rand.Next(npc.width / 2), npc.Center.Y + 30f, velocity.X, velocity.Y, type, damage, 0f, Main.myPlayer, npc.target, 1f); Main.projectile[proj].timeLeft = 540; } @@ -813,7 +824,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float topVelocity = acceleration * 100f; float deceleration = masterMode ? 0.75f : 0.8f; - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 80f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= deceleration; @@ -823,7 +834,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.velocity.Y > topVelocity) npc.velocity.Y = topVelocity; } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 120f) { if (npc.velocity.Y < 0f) npc.velocity.Y *= deceleration; @@ -834,7 +845,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity.Y = -topVelocity; } - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 180f * npc.ai[0]) + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 160f * npc.ai[0]) { if (npc.velocity.X > 0f) npc.velocity.X *= deceleration; @@ -844,7 +855,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.velocity.X > topVelocity) npc.velocity.X = topVelocity; } - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 180f * npc.ai[0]) + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) { if (npc.velocity.X < 0f) npc.velocity.X *= deceleration; @@ -897,7 +908,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!sawAlive) npc.localAI[0] += 1f; - if (npc.localAI[0] >= 90f) + if (npc.localAI[0] >= 48f) { npc.localAI[0] = 0f; npc.TargetClosest(); @@ -908,18 +919,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } laserArmTargetDist = laserSpeed / laserArmTargetDist; laserArmTargetX *= laserArmTargetDist; laserArmTargetY *= laserArmTargetDist; - laserArmPosition.X += laserArmTargetX * 30f; - laserArmPosition.Y += laserArmTargetY * 30f; - Projectile.NewProjectile(npc.GetSource_FromAI(), laserArmPosition.X, laserArmPosition.Y, laserArmTargetX, laserArmTargetY, type, damage, 0f, Main.myPlayer, 1f, 0f); + Vector2 laserVelocity = new Vector2(laserArmTargetX, laserArmTargetY); + Projectile.NewProjectile(npc.GetSource_FromAI(), laserArmPosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 100f, laserVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); } } } @@ -968,7 +980,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.localAI[0] = 0f; npc.TargetClosest(); - int totalProjectiles = bossRush ? 24 : (masterMode ? 16 : 12); + int totalProjectiles = bossRush ? 32 : (masterMode ? 24 : 16); float radians = MathHelper.TwoPi / totalProjectiles; int type = ProjectileID.DeathLaser; int damage = npc.GetProjectileDamage(type); @@ -976,10 +988,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } float velocity = 3f; @@ -990,7 +1004,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int k = 0; k < totalProjectiles; k++) { Vector2 laserFireDirection = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserFireDirection.SafeNormalize(Vector2.UnitY) * 30f, laserFireDirection, type, damage, 0f, Main.myPlayer, 1f, 0f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserFireDirection.SafeNormalize(Vector2.UnitY) * 100f, laserFireDirection, type, damage, 0f, Main.myPlayer, 1f, 0f); Main.projectile[proj].timeLeft = 900; } npc.localAI[1] += 1f; @@ -1133,7 +1147,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float topVelocity = acceleration * 100f; float deceleration = masterMode ? 0.75f : 0.8f; - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 150f) + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 130f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= deceleration; @@ -1143,7 +1157,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.velocity.Y > topVelocity) npc.velocity.Y = topVelocity; } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 150f) + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 170f) { if (npc.velocity.Y < 0f) npc.velocity.Y *= deceleration; @@ -1154,7 +1168,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity.Y = -topVelocity; } - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 200f) + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 160f) { if (npc.velocity.X > 0f) npc.velocity.X *= deceleration; @@ -1164,7 +1178,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.velocity.X > topVelocity) npc.velocity.X = topVelocity; } - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X + 160f) + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X + 200f) { if (npc.velocity.X < 0f) npc.velocity.X *= deceleration; @@ -1208,18 +1222,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } - cannonArmTargetDist = 0.5f / cannonArmTargetDist; + float rocketSpeed = 10f; + cannonArmTargetDist = rocketSpeed / cannonArmTargetDist; cannonArmTargetX *= cannonArmTargetDist; cannonArmTargetY *= cannonArmTargetDist; - cannonArmPosition.X += cannonArmTargetX * 30f; - cannonArmPosition.Y += cannonArmTargetY * 30f; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), cannonArmPosition.X, cannonArmPosition.Y, cannonArmTargetX, cannonArmTargetY, type, damage, 0f, Main.myPlayer, npc.target, 1f); + + Vector2 rocketVelocity = new Vector2(cannonArmTargetX, cannonArmTargetY); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), cannonArmPosition + rocketVelocity.SafeNormalize(Vector2.UnitY) * 40f, rocketVelocity, type, damage, 0f, Main.myPlayer, npc.target, 2f); Main.projectile[proj].timeLeft = 600; } } @@ -1253,20 +1270,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } - Vector2 cannonSpreadTargetDist = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); - cannonSpreadTargetDist *= 0.5f; + float rocketSpeed = 10f; + Vector2 cannonSpreadTargetDist = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * rocketSpeed; int numProj = bossRush ? 5 : 3; - float rotation = MathHelper.ToRadians(bossRush ? 8 : 5); + float rotation = MathHelper.ToRadians(bossRush ? 15 : 9); for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = cannonSpreadTargetDist.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 30f, perturbedSpeed, type, damage, 0f, Main.myPlayer, npc.target, 1f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 40f, perturbedSpeed, type, damage, 0f, Main.myPlayer, npc.target, 2f); Main.projectile[proj].timeLeft = 600; } } @@ -1359,7 +1378,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float topVelocity = acceleration * 100f; float deceleration = masterMode ? 0.75f : 0.8f; - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 20f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= deceleration; @@ -1369,7 +1388,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.velocity.Y > topVelocity) npc.velocity.Y = topVelocity; } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 20f) { if (npc.velocity.Y < 0f) npc.velocity.Y *= deceleration; @@ -1380,7 +1399,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity.Y = -topVelocity; } - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 20f) { if (npc.velocity.X > 0f) npc.velocity.X *= deceleration; @@ -1390,7 +1409,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.velocity.X > topVelocity) npc.velocity.X = topVelocity; } - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 20f) { if (npc.velocity.X < 0f) npc.velocity.X *= deceleration; @@ -1440,7 +1459,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float topVelocity = acceleration * 100f; float deceleration = masterMode ? 0.75f : 0.8f; - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 300f) + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 290f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= deceleration; @@ -1450,7 +1469,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.velocity.Y > topVelocity) npc.velocity.Y = topVelocity; } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 240f) { if (npc.velocity.Y < 0f) npc.velocity.Y *= deceleration; @@ -1461,7 +1480,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity.Y = -topVelocity; } - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 250f) + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 150f) { if (npc.velocity.X > 0f) npc.velocity.X *= deceleration; @@ -1471,7 +1490,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.velocity.X > topVelocity) npc.velocity.X = topVelocity; } - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X + 100f) { if (npc.velocity.X < 0f) npc.velocity.X *= deceleration; @@ -1716,7 +1735,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float topVelocity = acceleration * 100f; float deceleration = masterMode ? 0.75f : 0.8f; - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 20f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= deceleration; @@ -1726,7 +1745,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.velocity.Y > topVelocity) npc.velocity.Y = topVelocity; } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 20f) { if (npc.velocity.Y < 0f) npc.velocity.Y *= deceleration; @@ -1737,7 +1756,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity.Y = -topVelocity; } - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 20f) { if (npc.velocity.X > 0f) npc.velocity.X *= deceleration; @@ -1747,7 +1766,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.velocity.X > topVelocity) npc.velocity.X = topVelocity; } - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 20f) { if (npc.velocity.X < 0f) npc.velocity.X *= deceleration; @@ -1793,7 +1812,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float topVelocity = acceleration * 100f; float deceleration = masterMode ? 0.75f : 0.8f; - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 320f) + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 310f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= deceleration; @@ -1803,7 +1822,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.velocity.Y > topVelocity) npc.velocity.Y = topVelocity; } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 260f) + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 270f) { if (npc.velocity.Y < 0f) npc.velocity.Y *= deceleration; @@ -1814,7 +1833,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity.Y = -topVelocity; } - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 100f) { if (npc.velocity.X > 0f) npc.velocity.X *= deceleration; @@ -1824,7 +1843,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.velocity.X > topVelocity) npc.velocity.X = topVelocity; } - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 250f) + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 150f) { if (npc.velocity.X < 0f) npc.velocity.X *= deceleration; @@ -2412,7 +2431,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] += 1f; - if (npc.localAI[0] > (Main.masterMode ? 160f : Main.expertMode ? 180f : 200f)) + if (npc.localAI[0] > (Main.masterMode ? 80f : Main.expertMode ? 140f : 200f)) { npc.localAI[0] = 0f; float num562 = 8f; @@ -2423,18 +2442,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } num561 = num562 / num561; num559 *= num561; num560 *= num561; - vector68.X += num559 * 8f; - vector68.Y += num560 * 8f; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector68.X, vector68.Y, num559, num560, type, damage, 0f, Main.myPlayer); + Vector2 laserVelocity = new Vector2(num559, num560); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector68 + laserVelocity.SafeNormalize(Vector2.UnitY) * 100f, laserVelocity, type, damage, 0f, Main.myPlayer); } } } @@ -2511,7 +2531,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode == NetmodeID.MultiplayerClient) { npc.localAI[0] += 1f; - if (npc.localAI[0] > (Main.masterMode ? 60f : Main.expertMode ? 70f : 80f)) + if (npc.localAI[0] > (Main.masterMode ? 40f : Main.expertMode ? 60f : 80f)) { npc.localAI[0] = 0f; float num569 = 10f; @@ -2522,18 +2542,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } num568 = num569 / num568; num566 *= num568; num567 *= num568; - vector69.X += num566 * 8f; - vector69.Y += num567 * 8f; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector69.X, vector69.Y, num566, num567, type, damage, 0f, Main.myPlayer); + Vector2 laserVelocity = new Vector2(num566, num567); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector69 + laserVelocity.SafeNormalize(Vector2.UnitY) * 100f, laserVelocity, type, damage, 0f, Main.myPlayer); } } } @@ -2691,7 +2712,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] += 1f; - if (npc.localAI[0] > (Main.masterMode ? 80f : Main.expertMode ? 110f : 140f)) + if (npc.localAI[0] > (Main.masterMode ? 60f : Main.expertMode ? 100f : 140f)) { npc.localAI[0] = 0f; float num548 = 12f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs index f18fe85268..270d56a7e3 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs @@ -300,20 +300,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } retinazerTargetDist = (float)Math.Sqrt(retinazerTargetX * retinazerTargetX + retinazerTargetY * retinazerTargetY); retinazerTargetDist = retinazerSpeed / retinazerTargetDist; retinazerTargetX *= retinazerTargetDist; retinazerTargetY *= retinazerTargetDist; - retinazerPosition.X += retinazerTargetX * 15f; - retinazerPosition.Y += retinazerTargetY * 15f; - Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPosition.X, retinazerPosition.Y, retinazerTargetX, retinazerTargetY, type, damage, 0f, Main.myPlayer); + Vector2 laserVelocity = new Vector2(retinazerTargetX, retinazerTargetY); + Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); } } } @@ -347,12 +348,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = npc.defDamage; npc.ai[2] += 1f; - if (npc.ai[2] >= 25f) + float decelerateGateValue = 32f + (death ? 12f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + if (npc.ai[2] >= decelerateGateValue) { // Avoid cheap bullshit npc.damage = 0; - npc.velocity *= 0.96f; + float decelerationMultiplier = 0.92f - (death ? 0.32f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + npc.velocity *= decelerationMultiplier; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) @@ -361,13 +364,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - if (npc.ai[2] >= 70f) + float delayBeforeChargingAgain = 56f - (death ? 6f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + if (npc.ai[2] >= delayBeforeChargingAgain) { npc.ai[3] += 1f; npc.ai[2] = 0f; npc.TargetClosest(); npc.rotation = retinazerHoverRotation; - if (npc.ai[3] >= 3f) + float totalCharges = death ? 6f : 5f; + if (npc.ai[3] >= totalCharges) { npc.ai[1] = 0f; npc.ai[3] = 0f; @@ -420,26 +425,30 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses SoundEngine.PlaySound(SoundID.Item33, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - int type = ModContent.ProjectileType(); + bool shootLaser = npc.ai[1] % 20f == 0f; + int type = shootLaser ? ProjectileID.DeathLaser : ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } - Vector2 projectileVelocity = Main.rand.NextVector2CircularEdge(12f, 12f); - int numProj = 2; - int spread = 40; + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 10f + Main.rand.NextVector2CircularEdge(2f, 2f); + int numProj = shootLaser ? 6 : 2; + int spread = shootLaser ? 20 : 80; float rotation = MathHelper.ToRadians(spread); + float offset = shootLaser ? 150f : 50f; for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 50f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * offset, perturbedSpeed, type, damage, 0f, Main.myPlayer); } } } @@ -584,7 +593,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - npc.ai[2] += spazAlive ? 1f : 1.25f; + npc.ai[2] += spazAlive ? 1f : 1.5f; float phaseGateValue = NPC.IsMechQueenUp ? 900f : 300f - (death ? 120f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); if (npc.ai[2] >= phaseGateValue) { @@ -603,7 +612,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); - if (npc.localAI[1] >= (spazAlive ? 72f : 24f)) + if (npc.localAI[1] >= (spazAlive ? 52f : 26f)) { bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); if (canHit || !spazAlive || finalPhase) @@ -617,26 +626,27 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } retinazerPhase2TargetDist = (float)Math.Sqrt(retinazerPhase2TargetX * retinazerPhase2TargetX + retinazerPhase2TargetY * retinazerPhase2TargetY); retinazerPhase2TargetDist = retinazerPhase2LaserSpeed / retinazerPhase2TargetDist; retinazerPhase2TargetX *= retinazerPhase2TargetDist; retinazerPhase2TargetY *= retinazerPhase2TargetDist; - eyePosition.X += retinazerPhase2TargetX * 15f; - eyePosition.Y += retinazerPhase2TargetY * 15f; + Vector2 laserVelocity = new Vector2(retinazerPhase2TargetX, retinazerPhase2TargetY); if (canHit) { - Projectile.NewProjectile(npc.GetSource_FromAI(), eyePosition.X, eyePosition.Y, retinazerPhase2TargetX, retinazerPhase2TargetY, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), eyePosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); } else { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), eyePosition.X, eyePosition.Y, retinazerPhase2TargetX, retinazerPhase2TargetY, type, damage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), eyePosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft = 300; } @@ -714,7 +724,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); - if (npc.localAI[1] > (spazAlive ? 24f : 8f)) + if (npc.localAI[1] > (spazAlive ? 20f : 10f)) { bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); if (canHit || !spazAlive || finalPhase) @@ -726,26 +736,27 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } retinazerPhase2RapidFireTargetDist = (float)Math.Sqrt(retinazerPhase2RapidFireTargetX * retinazerPhase2RapidFireTargetX + retinazerPhase2RapidFireTargetY * retinazerPhase2RapidFireTargetY); retinazerPhase2RapidFireTargetDist = 9f / retinazerPhase2RapidFireTargetDist; retinazerPhase2RapidFireTargetX *= retinazerPhase2RapidFireTargetDist; retinazerPhase2RapidFireTargetY *= retinazerPhase2RapidFireTargetDist; - retinazerPhase2RapidFirePos.X += retinazerPhase2RapidFireTargetX * 15f; - retinazerPhase2RapidFirePos.Y += retinazerPhase2RapidFireTargetY * 15f; + Vector2 laserVelocity = new Vector2(retinazerPhase2RapidFireTargetX, retinazerPhase2RapidFireTargetY); if (canHit) { - Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2RapidFirePos.X, retinazerPhase2RapidFirePos.Y, retinazerPhase2RapidFireTargetX, retinazerPhase2RapidFireTargetY, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2RapidFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); } else { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2RapidFirePos.X, retinazerPhase2RapidFirePos.Y, retinazerPhase2RapidFireTargetX, retinazerPhase2RapidFireTargetY, type, damage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2RapidFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft = 300; } @@ -841,23 +852,25 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } + float laserDartVelocity = (death ? 9f : 6f) * (spazAlive ? 1f : 1.5f); retinazerPhase3ChargeLaserPos = npc.Center; retinazerPhase3ChargeLaserTargetX = Main.player[npc.target].Center.X - retinazerPhase3ChargeLaserPos.X; retinazerPhase3ChargeLaserTargetY = Main.player[npc.target].Center.Y - retinazerPhase3ChargeLaserPos.Y; retinazerPhase3ChargeLaserTargetDist = (float)Math.Sqrt(retinazerPhase3ChargeLaserTargetX * retinazerPhase3ChargeLaserTargetX + retinazerPhase3ChargeLaserTargetY * retinazerPhase3ChargeLaserTargetY); - retinazerPhase3ChargeLaserTargetDist = 6f / retinazerPhase3ChargeLaserTargetDist; + retinazerPhase3ChargeLaserTargetDist = laserDartVelocity / retinazerPhase3ChargeLaserTargetDist; retinazerPhase3ChargeLaserTargetX *= retinazerPhase3ChargeLaserTargetDist; retinazerPhase3ChargeLaserTargetY *= retinazerPhase3ChargeLaserTargetDist; - retinazerPhase3ChargeLaserPos.X += retinazerPhase3ChargeLaserTargetX; - retinazerPhase3ChargeLaserPos.Y += retinazerPhase3ChargeLaserTargetY; - Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase3ChargeLaserPos.X, retinazerPhase3ChargeLaserPos.Y, retinazerPhase3ChargeLaserTargetX, retinazerPhase3ChargeLaserTargetY, type, damage, 0f, Main.myPlayer); + Vector2 laserVelocity = new Vector2(retinazerPhase3ChargeLaserTargetX, retinazerPhase3ChargeLaserTargetY); + Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase3ChargeLaserPos + npc.velocity.SafeNormalize(Vector2.UnitY) * 50f, laserVelocity, type, damage, 0f, Main.myPlayer); } } } @@ -1262,10 +1275,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } spazmatismFireballTargetDist = (float)Math.Sqrt(spazmatismFireballTargetX * spazmatismFireballTargetX + spazmatismFireballTargetY * spazmatismFireballTargetY); @@ -1274,10 +1289,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses spazmatismFireballTargetY *= spazmatismFireballTargetDist; spazmatismFireballTargetX += Main.rand.Next(-10, 11) * 0.05f; spazmatismFireballTargetY += Main.rand.Next(-10, 11) * 0.05f; - spazmatismFireballPos.X += spazmatismFireballTargetX * 4f; - spazmatismFireballPos.Y += spazmatismFireballTargetY * 4f; - Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFireballPos.X, spazmatismFireballPos.Y, spazmatismFireballTargetX, spazmatismFireballTargetY, type, damage, 0f, Main.myPlayer); + Vector2 fireballVelocity = new Vector2(spazmatismFireballTargetX, spazmatismFireballTargetY); + Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFireballPos + fireballVelocity.SafeNormalize(Vector2.UnitY) * 50f, fireballVelocity, type, damage, 0f, Main.myPlayer); } } } @@ -1291,7 +1305,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Rotation and velocity npc.rotation = spazmatismRotation; - float spazmatismPhase1ChargeSpeed = 16f; + float spazmatismPhase1ChargeSpeed = 18f; spazmatismPhase1ChargeSpeed += 8f * enrageScale; if (death) spazmatismPhase1ChargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); @@ -1314,14 +1328,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] += 1f; - float timeBeforeSlowDown = 12f; + float timeBeforeSlowDown = 10f; if (npc.ai[2] >= timeBeforeSlowDown) { // Avoid cheap bullshit npc.damage = 0; // Slow down - npc.velocity *= 0.9f; + npc.velocity *= 0.8f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; @@ -1332,7 +1346,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; // Charge 8 times - float chargeTime = 38f; + float chargeTime = 25f; if (npc.ai[2] >= chargeTime) { // Reset AI array and go to cursed fireball phase @@ -1400,21 +1414,23 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (Main.netMode != NetmodeID.MultiplayerClient) { - float velocity = 16f; - int type = ModContent.ProjectileType(); + int type = npc.ai[1] % 20f == 0f ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } - Vector2 projectileVelocity = Main.rand.NextVector2CircularEdge(velocity, velocity); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 25f + Main.rand.NextVector2CircularEdge(5f, 5f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); + Main.projectile[proj].tileCollide = false; } } } @@ -1498,17 +1514,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses spazmatismFlamethrowerFaceDirection = -1; Vector2 spazmatismFlamethrowerPos = npc.Center; - float spazmatismFlamethrowerTargetX = Main.player[npc.target].Center.X + (spazmatismFlamethrowerFaceDirection * 180) - spazmatismFlamethrowerPos.X; + int flamethrowerDistance = 180; + float spazmatismFlamethrowerTargetX = Main.player[npc.target].Center.X + (spazmatismFlamethrowerFaceDirection * flamethrowerDistance) - spazmatismFlamethrowerPos.X; float spazmatismFlamethrowerTargetY = Main.player[npc.target].Center.Y - spazmatismFlamethrowerPos.Y; float spazmatismFlamethrowerTargetDist = (float)Math.Sqrt(spazmatismFlamethrowerTargetX * spazmatismFlamethrowerTargetX + spazmatismFlamethrowerTargetY * spazmatismFlamethrowerTargetY); if (!NPC.IsMechQueenUp) { // Boost speed if too far from target - if (spazmatismFlamethrowerTargetDist > 300f) - spazmatismFlamethrowerMaxSpeed += 0.5f; - if (spazmatismFlamethrowerTargetDist > 400f) - spazmatismFlamethrowerMaxSpeed += 0.5f; + if (spazmatismFlamethrowerTargetDist > flamethrowerDistance) + spazmatismFlamethrowerMaxSpeed += MathHelper.Lerp(0f, Main.masterMode ? 10f : 6.6f, MathHelper.Clamp((spazmatismFlamethrowerTargetDist - flamethrowerDistance) / 1000f, 0f, 1f)); if (Main.getGoodWorld) { @@ -1580,16 +1595,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float spazmatismShadowFireballSpeed = 6f; spazmatismShadowFireballSpeed += 2f * enrageScale; + float timeForFlamethrowerToReachMaxVelocity = 60f; + float flamethrowerSpeedScalar = MathHelper.Clamp(npc.ai[2] / timeForFlamethrowerToReachMaxVelocity, 0f, 1f); + spazmatismShadowFireballSpeed = MathHelper.Lerp(0.1f, spazmatismShadowFireballSpeed, flamethrowerSpeedScalar); int type = npc.ai[3] % 2f == 0f ? ProjectileID.EyeFire : ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } spazmatismFlamethrowerPos = npc.Center; @@ -1603,8 +1623,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses spazmatismFlamethrowerTargetX += Main.rand.Next(-10, 11) * 0.01f; spazmatismFlamethrowerTargetY += npc.velocity.Y * 0.5f; spazmatismFlamethrowerTargetX += npc.velocity.X * 0.5f; - spazmatismFlamethrowerPos.X -= spazmatismFlamethrowerTargetX * 1f; - spazmatismFlamethrowerPos.Y -= spazmatismFlamethrowerTargetY * 1f; if (NPC.IsMechQueenUp) { @@ -1614,13 +1632,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses spazmatismFlamethrowerPos = npc.Center - mechdusaSpazShadowFireballPos * 3f; } + Vector2 flamethrowerVelocity = new Vector2(spazmatismFlamethrowerTargetX, spazmatismFlamethrowerTargetY); if (canHit) { - Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos.X, spazmatismFlamethrowerPos.Y, spazmatismFlamethrowerTargetX, spazmatismFlamethrowerTargetY, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); } else { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos.X, spazmatismFlamethrowerPos.Y, spazmatismFlamethrowerTargetX, spazmatismFlamethrowerTargetY, type, damage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); Main.projectile[proj].tileCollide = false; } } @@ -1681,7 +1700,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] += retAlive ? 1f : 1.25f; - float chargeTime = 50f - (death ? 12f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeTime = 30f - (death ? 10f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); // Slow down if (npc.ai[2] >= chargeTime) @@ -1689,7 +1708,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Avoid cheap bullshit npc.damage = reducedSetDamage; - npc.velocity *= 0.93f; + float deceleration = 0.85f - (death ? 0.1f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + npc.velocity *= deceleration; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) @@ -1699,7 +1719,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; // Charges 5 times - if (npc.ai[2] >= chargeTime + 30f) + if (npc.ai[2] >= chargeTime * 1.6f) { npc.ai[3] += 1f; npc.ai[2] = 0f; @@ -1779,6 +1799,34 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } + if (death) + { + float velocity = spazmatismPhase3ChargeSpeed * 0.75f; + int type = (!retAlive && npc.ai[3] % 2f == 0f) ? ModContent.ProjectileType() : ProjectileID.CursedFlameHostile; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + Vector2 projectileVelocity = (Main.player[npc.target].Center + (!retAlive && bossRush ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; + int numProj = 3; + int spread = 15; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 25f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + } + npc.ai[1] = 4f; npc.netUpdate = true; @@ -1796,7 +1844,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[2] == 0f) SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - float spazmatismRetDeadChargeSpeed = ((!retAlive && npc.ai[3] == 4f) ? 75f : 50f) - (float)Math.Round(death ? 14f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float spazmatismRetDeadChargeSpeed = ((!retAlive && npc.ai[3] == 4f) ? 75f : 50f) - (float)Math.Round(death ? ((!retAlive && npc.ai[3] == 4f) ? 15f : 10f) * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); npc.ai[2] += 1f; @@ -1909,14 +1957,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } Vector2 projectileVelocity = (Main.player[npc.target].Center + (!retAlive && bossRush ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 4f, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, retAlive ? 0f : 1f); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 25f, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, retAlive ? 0f : 1f); } } @@ -2154,10 +2204,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } num424 = (float)Math.Sqrt(num422 * num422 + num423 * num423); @@ -2167,9 +2219,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int inaccuracy = Main.masterMode ? 3 : Main.expertMode ? 6 : 9; num422 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.08f; num423 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.08f; - vector43.X += num422 * 15f; - vector43.Y += num423 * 15f; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector43.X, vector43.Y, num422, num423, type, damage, 0f, Main.myPlayer); + + Vector2 laserVelocity = new Vector2(num422, num423); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector43 + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); } } } @@ -2285,20 +2337,23 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } - Vector2 projectileVelocity = Main.rand.NextVector2CircularEdge(10f, 10f); + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 9f + Main.rand.NextVector2CircularEdge(1f, 1f); int numProj = 3; - int spread = 8; + int spread = 10; float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 50f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 150f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].tileCollide = false; } } } @@ -2458,19 +2513,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } num442 = (float)Math.Sqrt(num440 * num440 + num441 * num441); num442 = num444 / num442; num440 *= num442; num441 *= num442; - vector45.X += num440 * 15f; - vector45.Y += num441 * 15f; - int num446 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector45.X, vector45.Y, num440, num441, type, damage, 0f, Main.myPlayer); + + Vector2 laserVelocity = new Vector2(num440, num441); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector45 + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); } return false; @@ -2547,19 +2604,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } num452 = (float)Math.Sqrt(num450 * num450 + num451 * num451); num452 = num453 / num452; num450 *= num452; num451 *= num452; - vector46.X += num450 * 15f; - vector46.Y += num451 * 15f; - int num455 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector46.X, vector46.Y, num450, num451, type, damage, 0f, Main.myPlayer); + + Vector2 laserVelocity = new Vector2(num450, num451); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector46 + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); } } @@ -2787,10 +2846,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } num468 = (float)Math.Sqrt(num466 * num466 + num467 * num467); @@ -2800,9 +2861,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int inaccuracy = Main.masterMode ? 10 : Main.expertMode ? 15 : 20; num466 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.05f; num467 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.05f; - vector49.X += num466 * 4f; - vector49.Y += num467 * 4f; - int num473 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector49.X, vector49.Y, num466, num467, type, damage, 0f, Main.myPlayer); + + Vector2 fireballVelocity = new Vector2(num466, num467); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector49 + fireballVelocity.SafeNormalize(Vector2.UnitY) * 50f, fireballVelocity, type, damage, 0f, Main.myPlayer); } } } @@ -2816,7 +2877,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float num474 = 13f; if (Main.expertMode) - num474 += MathHelper.Lerp(0f, Main.masterMode ? 5.6f : 2.8f, 1f - (npc.life / (float)npc.lifeMax - phase2LifeRatio) / (1f - phase2LifeRatio)); + num474 += MathHelper.Lerp(0f, Main.masterMode ? 11.2f : 5.6f, 1f - (npc.life / (float)npc.lifeMax - phase2LifeRatio) / (1f - phase2LifeRatio)); if (Main.getGoodWorld) num474 *= 1.2f; @@ -2919,14 +2980,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } - Vector2 projectileVelocity = Main.rand.NextVector2CircularEdge(15f, 15f); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, damage, 0f, Main.myPlayer); + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 25f + Main.rand.NextVector2CircularEdge(5f, 5f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].tileCollide = false; } } } @@ -2992,7 +3056,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!NPC.IsMechQueenUp) { if (num485 > flamethrowerDistance) - num480 += MathHelper.Lerp(0f, Main.masterMode ? 5f : 3.3f, MathHelper.Clamp((num485 - flamethrowerDistance) / 800f, 0f, 1f)); + num480 += MathHelper.Lerp(0f, Main.masterMode ? 10f : 6.6f, MathHelper.Clamp((num485 - flamethrowerDistance) / 1000f, 0f, 1f)); if (Main.getGoodWorld) { @@ -3066,16 +3130,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.localAI[1] = 0f; float num487 = 6f + (Main.expertMode ? MathHelper.Lerp(0f, Main.masterMode ? 3f : 1.5f, 1f - (npc.life / (float)npc.lifeMax) / phase2LifeRatio) : 0f); + float timeForFlamethrowerToReachMaxVelocity = 60f; + float flamethrowerSpeedScalar = MathHelper.Clamp(npc.ai[2] / timeForFlamethrowerToReachMaxVelocity, 0f, 1f); + num487 = MathHelper.Lerp(0.1f, num487, flamethrowerSpeedScalar); int type = ProjectileID.EyeFire; int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; if (!NPC.downedMechBossAny) - damage = (int)(damage * 0.8); + damage = (int)(damage * firstMechMultiplier); else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * 0.9); + damage = (int)(damage * secondMechMultiplier); } vector51 = npc.Center; @@ -3090,8 +3159,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses num483 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.01f; num484 += npc.velocity.Y * 0.5f; num483 += npc.velocity.X * 0.5f; - vector51.X -= num483 * 1f; - vector51.Y -= num484 * 1f; + if (NPC.IsMechQueenUp) { Vector2 vector52 = (npc.rotation + (float)Math.PI / 2f).ToRotationVector2() * num487 + npc.velocity * 0.5f; @@ -3100,7 +3168,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses vector51 = npc.Center - vector52 * 3f; } - Projectile.NewProjectile(npc.GetSource_FromAI(), vector51.X, vector51.Y, num483, num484, type, damage, 0f, Main.myPlayer); + Vector2 flamethrowerVelocity = new Vector2(num483, num484); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector51 + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs index 2c4d44a40c..397be2ee73 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs @@ -113,12 +113,32 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { // Get target vector Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * npc.velocity.Length(); - Vector2 projectileSpawn = npc.Center + projectileVelocity * 5f; + Vector2 projectileSpawn = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f; int damage = npc.GetProjectileDamage(ProjectileID.DemonSickle); int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, ProjectileID.DemonSickle, damage, 0f, Main.myPlayer, 0f, projectileVelocity.Length() * 3f); Main.projectile[proj].timeLeft = 600; Main.projectile[proj].tileCollide = false; + + if (masterMode) + { + float fireballVelocity = 3f; + projectileVelocity = projectileVelocity.SafeNormalize(Vector2.UnitY) * (npc.velocity.Length() + fireballVelocity); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ProjectileID.Fireball; + damage = npc.GetProjectileDamage(type); + int numProj = 3; + int spread = 30; + float rotation = MathHelper.ToRadians(spread); + for (int j = 0; j < numProj; j++) + { + Vector2 randomVelocity = Main.rand.NextVector2CircularEdge(2f, 2f); + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))) + randomVelocity; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 50f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + } + } } } } @@ -221,7 +241,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float halfAverageScreenWidth = 960f; float distanceBeforeSlowingDown = 400f; - float timeBeforeEnrage = (masterMode ? 450f : 600f) - (death ? 390f * (1f - lifeRatio) : 0f); + float timeBeforeEnrage = (masterMode ? 150f : 600f) - (death ? (masterMode ? 130f : 390f) * (1f - lifeRatio) : 0f); float speedMult = 1f; if (bossRush) @@ -279,11 +299,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (bossRush) speedMult += 0.2f; + float masterModeVelocityBoost = 0f; + if (masterMode) + { + float velocityBoostStartDistance = 480f; + float velocityBoostMaxDistance = velocityBoostStartDistance * 2f; + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); + float lerpAmount = MathHelper.Clamp((distanceFromTargetX - velocityBoostStartDistance) / velocityBoostMaxDistance, 0f, 1f); + masterModeVelocityBoost = MathHelper.Lerp(0f, 8f, lerpAmount); + } + // NOTE: Max velocity is 8 in Expert Mode // NOTE: Max velocity is 9 in For The Worthy float velocityBoost = 4f * (1f - lifeRatio); - float velocityX = (bossRush ? 7f : death ? 3.5f : 2f) + velocityBoost; + float velocityX = (bossRush ? 7f : death ? 3.5f : 2f) + masterModeVelocityBoost + velocityBoost; velocityX *= speedMult; if (masterMode) @@ -512,11 +542,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.npc[Main.wofNPCIndex].life > 0) npc.life = Main.npc[Main.wofNPCIndex].life; + // Percent life remaining + float lifeRatio = Main.npc[Main.wofNPCIndex].life / (float)Main.npc[Main.wofNPCIndex].lifeMax; + // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); // Velocity, direction, and position + bool shouldFireLasers = true; npc.position.X = Main.npc[Main.wofNPCIndex].position.X; npc.direction = Main.npc[Main.wofNPCIndex].direction; npc.spriteDirection = npc.direction; @@ -549,14 +583,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } Vector2 eyeLocation = npc.Center; - float eyeTargetX = Main.player[npc.target].Center.X - eyeLocation.X; - float eyeTargetY = Main.player[npc.target].Center.Y - eyeLocation.Y; + float predictionAmount = MathHelper.Lerp(0f, 20f, (float)Math.Sqrt(1f - lifeRatio)); + Vector2 lookAt = Main.player[npc.target].Center + (masterMode ? (Main.player[npc.target].velocity * predictionAmount) : Vector2.Zero); + float eyeTargetX = lookAt.X - eyeLocation.X; + float eyeTargetY = lookAt.Y - eyeLocation.Y; float wallVelocity = (float)Math.Sqrt(eyeTargetX * eyeTargetX + eyeTargetY * eyeTargetY); eyeTargetX *= wallVelocity; eyeTargetY *= wallVelocity; // Rotation based on direction and whether to fire lasers or not - bool shouldFireLasers = true; if (npc.direction > 0) { if (Main.player[npc.target].Center.X > npc.Center.X) @@ -582,9 +617,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Fire lasers if (Main.netMode != NetmodeID.MultiplayerClient) { - // Percent life remaining - float lifeRatio = Main.npc[Main.wofNPCIndex].life / (float)Main.npc[Main.wofNPCIndex].lifeMax; - bool charging = Main.npc[Main.wofNPCIndex].ai[3] == 1f; // Set up enraged laser firing timer @@ -633,16 +665,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int projectileType = phase2 ? ProjectileID.DeathLaser : ProjectileID.EyeLaser; int damage = npc.GetProjectileDamage(projectileType); - float laserSpawnDistance = fireEnragedLasers ? 30f : 22.5f; - Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; - Vector2 projectileSpawn = npc.Center + projectileVelocity * laserSpawnDistance; + Vector2 projectileVelocity = (lookAt - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; + Vector2 projectileSpawn = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 100f; int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, 1f, 0f); Main.projectile[proj].timeLeft = 900; if (!canHit) Main.projectile[proj].tileCollide = false; - } } } @@ -869,9 +899,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses masterModeVelocityBoost = MathHelper.Lerp(0f, 8f, lerpAmount); } - float num369 = (Main.expertMode ? 3.25f : 2.5f) + masterModeVelocityBoost; + float num369 = (Main.expertMode ? 3.5f : 2.5f) + masterModeVelocityBoost; if (!Main.expertMode) { + // 4.7 is the max in classic if ((double)npc.life < (double)npc.lifeMax * 0.75) num369 += 0.4f; @@ -886,23 +917,34 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else { - if ((double)npc.life < (double)npc.lifeMax * 0.66) + // 6.5 is the max in expert + if ((double)npc.life < (double)npc.lifeMax * 0.8) num369 += 0.3f; - if ((double)npc.life < (double)npc.lifeMax * 0.33) + if ((double)npc.life < (double)npc.lifeMax * 0.6) num369 += 0.3f; + if ((double)npc.life < (double)npc.lifeMax * 0.4) + num369 += 0.5f; + + if ((double)npc.life < (double)npc.lifeMax * 0.2) + num369 += 0.5f; + + if ((double)npc.life < (double)npc.lifeMax * 0.1) + num369 += 0.7f; + if ((double)npc.life < (double)npc.lifeMax * 0.05) - num369 += 0.6f; + num369 += 0.7f; - if ((double)npc.life < (double)npc.lifeMax * 0.035) - num369 += 0.6f; + // 8.3 is the max in master + if (Main.masterMode) + { + if ((double)npc.life < (double)npc.lifeMax * 0.025) + num369 += 0.9f; - if ((double)npc.life < (double)npc.lifeMax * 0.025) - num369 += 0.6f; - - num369 *= 1.35f; - num369 += 0.35f; + if ((double)npc.life < (double)npc.lifeMax * 0.01) + num369 += 0.9f; + } } if (Main.getGoodWorld) @@ -940,7 +982,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.velocity.X < 0f) { - npc.velocity.X = 0f - num369; + npc.velocity.X = -num369; npc.direction = -1; } else @@ -1203,14 +1245,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (flag27) { - float num397 = 9f; + float num397 = 4f; int type = ProjectileID.EyeLaser; if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.5) num397 += 1f; if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.25) num397 += 1f; if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.1) - num397 += 2f; + num397 += 1f; vector39 = npc.Center; num392 = Main.player[npc.target].Center.X - vector39.X; @@ -1219,9 +1261,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses num394 = num397 / num394; num392 *= num394; num393 *= num394; - vector39.X += num392; - vector39.Y += num393; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector39.X, vector39.Y, num392, num393, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + Vector2 projectileVelocity = new Vector2(num392, num393); + vector39 += projectileVelocity.SafeNormalize(Vector2.UnitY) * 100f; + Projectile.NewProjectile(npc.GetSource_FromAI(), vector39, projectileVelocity, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, 1f, 0f); } } diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs index e7e2c8ff3b..f9476e1bbd 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs @@ -403,9 +403,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies { int activeTime = 300; int defendTime = 120; + + // Set damage + npc.damage = npc.defDamage; + npc.defense = npc.defDefense; + if (npc.ai[2] < 0f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.defense = npc.defDefense + 15; npc.ai[2] += 1f; npc.velocity.X *= 0.9f; @@ -480,7 +488,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies float time = npc.ai[2] + maxTime + turnToStoneTime; if (time == 1f) { - SoundEngine.PlaySound(SoundID.NPCDeath17, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath17, npc.Center); } if (time < turnToStoneTime) { @@ -548,7 +556,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies if (npc.ai[3] < 0f) { npc.knockBackResist = 0f; - npc.defense = (int)(npc.defDefense * 1.3); + npc.defense = (int)Math.Round(npc.defDefense * 1.3); npc.noGravity = true; npc.noTileCollide = true; npc.direction = (npc.velocity.X > 0).ToDirectionInt(); @@ -1035,7 +1043,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies { npc.velocity *= 0f; npc.ai[3] = 0f; - SoundEngine.PlaySound(SoundID.Item8, npc.position); + SoundEngine.PlaySound(SoundID.Item8, npc.Center); float distX = npc.oldPos[2].X + (float)npc.width * 0.5f - npc.Center.X; float distY = npc.oldPos[2].Y + (float)npc.height * 0.5f - npc.Center.Y; float distance = (float)Math.Sqrt((distX * distX + distY * distY)); @@ -1312,31 +1320,31 @@ PrepareToShoot: { if ((npcType == NPCID.Zombie || npcType == NPCID.ZombieXmas || npcType == NPCID.ZombieSweater || npcType == NPCID.Skeleton || (npcType >= NPCID.BoneThrowingSkeleton && npcType <= NPCID.BoneThrowingSkeleton4) || npcType == NPCID.AngryBones || npcType == NPCID.AngryBonesBig || npcType == NPCID.AngryBonesBigHelmet || npcType == NPCID.AngryBonesBigMuscle || npcType == NPCID.ArmoredSkeleton || npcType == NPCID.SkeletonArcher || npcType == NPCID.BaldZombie || npcType == NPCID.UndeadViking || npcType == NPCID.ZombieEskimo || npcType == NPCID.Frankenstein || npcType == NPCID.PincushionZombie || npcType == NPCID.SlimedZombie || npcType == NPCID.SwampZombie || npcType == NPCID.TwiggyZombie || npcType == NPCID.ArmoredViking || npcType == NPCID.FemaleZombie || npcType == NPCID.HeadacheSkeleton || npcType == NPCID.MisassembledSkeleton || npcType == NPCID.PantlessSkeleton || npcType == NPCID.ZombieRaincoat || npcType == NPCID.SkeletonSniper || npcType == NPCID.TacticalSkeleton || npcType == NPCID.SkeletonCommando || npcType == NPCID.ZombieSuperman || npcType == NPCID.ZombiePixie || npcType == NPCID.ZombieDoctor || npcType == NPCID.GreekSkeleton) && Main.rand.NextBool(1000)) { - SoundEngine.PlaySound(SoundID.ZombieMoan, npc.position); + SoundEngine.PlaySound(SoundID.ZombieMoan, npc.Center); } if (npcType == NPCID.BloodZombie && Main.rand.NextBool(800)) { - SoundEngine.PlaySound(SoundID.ZombieMoan, npc.position); //There was a npcType thing afterwards but its not really useable now. Hilarious, frankly + SoundEngine.PlaySound(SoundID.ZombieMoan, npc.Center); //There was a npcType thing afterwards but its not really useable now. Hilarious, frankly } if ((npcType == NPCID.Mummy || npcType == NPCID.DarkMummy || npcType == NPCID.LightMummy) && Main.rand.NextBool(500)) { - SoundEngine.PlaySound(SoundID.Mummy, npc.position); + SoundEngine.PlaySound(SoundID.Mummy, npc.Center); } if (npcType == NPCID.Vampire && Main.rand.NextBool(500)) { - SoundEngine.PlaySound(SoundID.Zombie7, npc.position); + SoundEngine.PlaySound(SoundID.Zombie7, npc.Center); } if (npcType == NPCID.Frankenstein && Main.rand.NextBool(500)) { - SoundEngine.PlaySound(SoundID.Zombie6, npc.position); + SoundEngine.PlaySound(SoundID.Zombie6, npc.Center); } if (npcType == NPCID.FaceMonster && Main.rand.NextBool(500)) { - SoundEngine.PlaySound(SoundID.Zombie8, npc.position); + SoundEngine.PlaySound(SoundID.Zombie8, npc.Center); } if (npcType >= 269 && npcType <= 280 && Main.rand.NextBool(1000)) { - SoundEngine.PlaySound(SoundID.ZombieMoan, npc.position); + SoundEngine.PlaySound(SoundID.ZombieMoan, npc.Center); } npc.TargetClosest(true); } @@ -1819,7 +1827,9 @@ PrepareToShoot: { if (npc.ai[2] == 0f) { - npc.damage = npc.defDamage; + // Avoid cheap bullshit + npc.damage = 0; + float maxVelocity = CalamityWorld.death ? 2.5f : 1.5f; maxVelocity *= 1f + (1f - npc.scale); FighterRunningAI(npc, maxVelocity, 0.09f, 0.8f, true, 0.8f); @@ -1840,7 +1850,9 @@ PrepareToShoot: } else { - npc.damage = npc.defDamage * 2; + // Set damage + npc.damage = (int)Math.Round(npc.defDamage * 1.4); + npc.ai[3] = 1f; npc.velocity.X *= 0.9f; if (Math.Abs(npc.velocity.X) < 0.1f) @@ -3452,46 +3464,15 @@ PrepareToShoot: // Teleport (Chaos elementals) if (Main.netMode != NetmodeID.MultiplayerClient && (npcType == NPCID.ChaosElemental || npcType == ModContent.NPCType()) && npc.ai[3] >= (float)aiGateValue) { - int tileCoordsX = (int)Main.player[npc.target].position.X / 16; - int tileCoordsY = (int)Main.player[npc.target].position.Y / 16; - int tileCoordsX2 = (int)npc.position.X / 16; - int tileCoordsY2 = (int)npc.position.Y / 16; - int maxDistanceX = 20; - int tryCount = 0; - bool tooFarFromPlayer = false; - if (Math.Abs(npc.position.X - Main.player[npc.target].position.X) + Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) + int targetTileX = (int)Main.player[npc.target].Center.X / 16; + int targetTileY = (int)Main.player[npc.target].Center.Y / 16; + Vector2 chosenTile = Vector2.Zero; + if (npc.AI_AttemptToFindTeleportSpot(ref chosenTile, targetTileX, targetTileY, 20, 9)) { - tryCount = 100; - tooFarFromPlayer = true; - } - while (!tooFarFromPlayer && tryCount < 100) - { - tryCount++; - int randX = Main.rand.Next(tileCoordsX - maxDistanceX, tileCoordsX + maxDistanceX); - for (int t = Main.rand.Next(tileCoordsY - maxDistanceX, tileCoordsY + maxDistanceX); t < tileCoordsY + maxDistanceX; t++) - { - if ((t < tileCoordsY - 4 || t > tileCoordsY + 4 || randX < tileCoordsX - 4 || randX > tileCoordsX + 4) && (t < tileCoordsY2 - 1 || t > tileCoordsY2 + 1 || randX < tileCoordsX2 - 1 || randX > tileCoordsX2 + 1) && Main.tile[randX, t].HasUnactuatedTile) - { - bool foundGoodTeleport = true; - // I don't understand why the hell this exists if it's only for Chaos Elementals, but I suppose I'll - // Leave it here - if (npcType == NPCID.DarkCaster && Main.tile[randX, t - 1].WallType == WallID.None) - { - foundGoodTeleport = false; - } - else if (Main.tile[randX, t - 1].LiquidType == LiquidID.Lava) - { - foundGoodTeleport = false; - } - if (foundGoodTeleport && Main.tileSolid[(int)Main.tile[randX, t].TileType] && !Collision.SolidTiles(randX - 1, randX + 1, t - 4, t - 1)) - { - npc.position.X = (float)(randX * 16 - npc.width / 2); - npc.position.Y = (float)(t * 16 - npc.height); - npc.netUpdate = true; - npc.ai[3] = -30f; - } - } - } + npc.position.X = chosenTile.X * 16f - (float)(npc.width / 2); + npc.position.Y = chosenTile.Y * 16f - (float)npc.height; + npc.ai[3] = -30f; + npc.netUpdate = true; } } return false; @@ -3976,7 +3957,7 @@ PrepareToShoot: if (npc.ai[1] == 301f) { - SoundEngine.PlaySound(SoundID.Item17, npc.position); + SoundEngine.PlaySound(SoundID.Item17, npc.Center); npc.ai[1] = 0f; } @@ -4119,7 +4100,7 @@ PrepareToShoot: if (npc.type == NPCID.LeechHead && npc.localAI[1] == 0f) { npc.localAI[1] = 1f; - SoundEngine.PlaySound(SoundID.NPCDeath13, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath13, npc.Center); int dustVelocity = 1; if (npc.velocity.X < 0f) { @@ -4178,7 +4159,7 @@ PrepareToShoot: } else { - npc.defense = (int)(npc.defDefense * 1.3); + npc.defense = (int)Math.Round(npc.defDefense * 1.3); if (npc.ai[3] > 0f) npc.realLife = (int)npc.ai[3]; @@ -4874,7 +4855,7 @@ PrepareToShoot: soundDelay = 20f; } npc.soundDelay = (int)soundDelay; - SoundEngine.PlaySound(SoundID.WormDig, npc.position); + SoundEngine.PlaySound(SoundID.WormDig, npc.Center); } wormTargetDist = (float)Math.Sqrt((double)(wormTargetX * wormTargetX + wormTargetY * wormTargetY)); @@ -5104,7 +5085,7 @@ PrepareToShoot: { npc.alpha = 255; } - SoundEngine.PlaySound(SoundID.Item8, npc.position); + SoundEngine.PlaySound(SoundID.Item8, npc.Center); int dustIncrement; for (int i = 0; i < 50; i = dustIncrement + 1) { @@ -5175,7 +5156,7 @@ PrepareToShoot: npc.velocity.Y = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - SoundEngine.PlaySound(SoundID.Item8, npc.position); + SoundEngine.PlaySound(SoundID.Item8, npc.Center); for (int j = 0; j < 50; j = dustIncrement + 1) { if (npc.type == NPCID.GoblinSorcerer || npc.type == NPCID.Tim) @@ -5304,46 +5285,12 @@ PrepareToShoot: npc.ai[0] = 2f; int targetTileX = (int)Main.player[npc.target].position.X / 16; int targetTileY = (int)Main.player[npc.target].position.Y / 16; - int npcTileX = (int)npc.position.X / 16; - int npcTileY = (int)npc.position.Y / 16; - int randTeleportOffset = 20; - int teleportTries = 0; - bool canTeleport = false; - if (Math.Abs(npc.position.X - Main.player[npc.target].position.X) + Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) + Vector2 chosenTile = Vector2.Zero; + if (npc.AI_AttemptToFindTeleportSpot(ref chosenTile, targetTileX, targetTileY)) { - teleportTries = 100; - canTeleport = true; - } - while (!canTeleport && teleportTries < 100) - { - teleportTries++; - int teleportTileX = Main.rand.Next(targetTileX - randTeleportOffset, targetTileX + randTeleportOffset); - int teleportTileY = Main.rand.Next(targetTileY - randTeleportOffset, targetTileY + randTeleportOffset); - int dustIncrement; - for (int k = teleportTileY; k < targetTileY + randTeleportOffset; k = dustIncrement + 1) - { - if ((k < targetTileY - 4 || k > targetTileY + 4 || teleportTileX < targetTileX - 4 || teleportTileX > targetTileX + 4) && (k < npcTileY - 1 || k > npcTileY + 1 || teleportTileX < npcTileX - 1 || teleportTileX > npcTileX + 1) && Main.tile[teleportTileX, k].HasUnactuatedTile) - { - bool validTeleportSpot = true; - if ((npc.type == NPCID.DarkCaster || (npc.type >= NPCID.RaggedCaster && npc.type <= NPCID.DiabolistWhite)) && !Main.wallDungeon[(int)Main.tile[teleportTileX, k - 1].WallType]) - { - validTeleportSpot = false; - } - else if (Main.tile[teleportTileX, k - 1].LiquidType == LiquidID.Lava) - { - validTeleportSpot = false; - } - if (validTeleportSpot && Main.tileSolid[(int)Main.tile[teleportTileX, k].TileType] && !Collision.SolidTiles(teleportTileX - 1, teleportTileX + 1, k - 4, k - 1)) - { - npc.ai[1] = 20f; - npc.ai[2] = (float)teleportTileX; - npc.ai[3] = (float)k; - canTeleport = true; - break; - } - } - dustIncrement = k; - } + npc.ai[1] = 20f; + npc.ai[2] = chosenTile.X; + npc.ai[3] = chosenTile.Y; } npc.netUpdate = true; } @@ -5354,7 +5301,7 @@ PrepareToShoot: { if (npc.ai[1] % 30f == 0f && npc.ai[1] / 30f < 5f) { - SoundEngine.PlaySound(SoundID.Item8, npc.position); + SoundEngine.PlaySound(SoundID.Item8, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { Point spiritCenter = npc.Center.ToTileCoordinates(); @@ -5451,7 +5398,7 @@ PrepareToShoot: { if (npc.type != NPCID.RuneWizard) { - SoundEngine.PlaySound(SoundID.Item8, npc.position); + SoundEngine.PlaySound(SoundID.Item8, npc.Center); } if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -5618,7 +5565,7 @@ PrepareToShoot: minDistance = 225f; break; case NPCID.FungiBulb: - minDistance = 200f; + minDistance = !CalamityWorld.revenge ? 100f : 200f; break; case NPCID.AngryTrapper: acceleration = 0.05f; @@ -5733,7 +5680,7 @@ PrepareToShoot: if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.type == NPCID.Clinger && !Main.player[npc.target].dead) + if (npc.type == NPCID.Clinger && !Main.player[npc.target].DeadOrGhost) { if (npc.justHit) npc.localAI[0] = 0f; @@ -5757,17 +5704,19 @@ PrepareToShoot: } } } - if (npc.type == NPCID.GiantFungiBulb && !Main.player[npc.target].dead) + + if ((npc.type == NPCID.GiantFungiBulb || npc.type == NPCID.FungiBulb) && !Main.player[npc.target].DeadOrGhost) { if (npc.justHit) npc.localAI[0] = 0f; npc.localAI[0] += 1f; - if (npc.localAI[0] >= 120f) + float sporeSpawnGateValue = npc.type == NPCID.GiantFungiBulb ? 120f : 240f; + if (npc.localAI[0] >= sporeSpawnGateValue) { if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) { - float speed = 16f; + float speed = npc.type == NPCID.GiantFungiBulb ? 16f : 8f; distanceVector.X = Main.player[npc.target].Center.X - npc.Center.X; float absoluteYDistance = Math.Abs(distanceVector.X * 0.1f); if (Main.player[npc.target].Center.Y - npc.Center.Y > 0f) @@ -5777,7 +5726,7 @@ PrepareToShoot: Vector2 velocity = npc.SafeDirectionTo(Main.player[npc.target].Center - npc.Center - Vector2.UnitY * absoluteYDistance, -Vector2.UnitY) * speed; - int idx = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.FungiSpore, 0, 0f, 0f, 0f, 0f, 255); + int idx = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.FungiSpore); Main.npc[idx].velocity = velocity; Main.npc[idx].netUpdate = true; npc.localAI[0] = 0f; @@ -6332,6 +6281,10 @@ PrepareToShoot: #region Jellyfish AI public static bool BuffedJellyfishAI(NPC npc, Mod mod) { + // Avoid cheap bullshit + float damagingVelocity = npc.type == NPCID.GreenJellyfish ? 7.2f : 5.6f; + npc.damage = (npc.dontTakeDamage || npc.velocity.Length() > damagingVelocity) ? npc.defDamage : 0; + // Stop moving because we're emitting electricity and don't take damage bool endEarly = false; if (npc.wet && npc.ai[1] == 1f) @@ -6600,7 +6553,7 @@ PrepareToShoot: { if (npc.ai[0] == 200f) { - SoundEngine.PlaySound(SoundID.NPCDeath13, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath13, npc.Center); } npc.ai[0] -= 1f; } @@ -6986,7 +6939,7 @@ PrepareToShoot: if (Main.rand.NextBool(40)) { - SoundEngine.PlaySound(SoundID.Pixie, npc.position); + SoundEngine.PlaySound(SoundID.Pixie, npc.Center); } } else if (npc.type == NPCID.IceElemental) @@ -7500,6 +7453,9 @@ PrepareToShoot: // Sitting around, waiting for a potential player if (npc.ai[0] == 0f) { + // Avoid cheap bullshit + npc.damage = 0; + if (!isLostHoppingPresent) { npc.TargetClosest(true); @@ -7525,6 +7481,9 @@ PrepareToShoot: } else if (npc.velocity.Y == 0f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[2] += 1f; int timeSpentStopping = 20; @@ -7569,6 +7528,9 @@ PrepareToShoot: } else { + // Set damage + npc.damage = npc.defDamage; + if (npc.direction == 1 && npc.velocity.X < 1f) { npc.velocity.X += 0.1f; @@ -8364,11 +8326,11 @@ PrepareToShoot: if (npc.type == NPCID.GiantShelly || npc.type == NPCID.GiantShelly2) { - npc.damage = (int)(npc.defDamage * 1.35); + npc.damage = (int)Math.Round(npc.defDamage * 1.2); } else { - npc.damage = (int)(npc.defDamage * 1.8); + npc.damage = (int)Math.Round(npc.defDamage * 1.4); } npc.defense = npc.defDefense * 2; @@ -8489,7 +8451,7 @@ PrepareToShoot: { if (npc.ai[0] == 6f) { - npc.damage = (int)(npc.defDamage * 1.4); + npc.damage = (int)Math.Round(npc.defDamage * 1.2); npc.defense = npc.defDefense * 2; npc.knockBackResist = 0f; @@ -8945,6 +8907,9 @@ PrepareToShoot: } } + // Avoid cheap bullshit + npc.damage = (npc.velocity.Y == 0f || npc.velocity.Length() < 3f) ? 0 : npc.defDamage; + if (npc.velocity.Y == 0f) { if (npc.ai[3] == npc.position.X) @@ -9434,7 +9399,7 @@ PrepareToShoot: public static bool BuffedSporeAI(NPC npc, Mod mod) { if (npc.type == NPCID.Spore) - Lighting.AddLight(npc.Center, 0.2f, 0.1f, 0.2f); + Lighting.AddLight(npc.Center, 0.5f, 0.2f, 0.5f); if (npc.timeLeft > 5) npc.timeLeft = 5; @@ -9716,6 +9681,9 @@ PrepareToShoot: // Move upward. if (npc.ai[0] == 0f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.knockBackResist = npcKBResist; Vector2 playerDistanceNorm = Main.player[npc.target].Center - npc.Center; Vector2 upwardVelocity = playerDistanceNorm - Vector2.UnitY * idealUpwardDelta; @@ -9766,18 +9734,36 @@ PrepareToShoot: // Slow down and prepare for charge. else if (npc.ai[0] == 1f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.knockBackResist = 0f; - npc.velocity *= chargeWaitSlowdownMult; + + bool decelerate = true; + if (npc.type == NPCID.SolarCorite) + { + decelerate = npc.velocity.Length() > 2f; + if (!decelerate && npc.target >= 0 && !Main.player[npc.target].DeadOrGhost) + { + Vector2 maxVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.Zero) * 0.1f; + npc.velocity = Vector2.Lerp(npc.velocity, maxVelocity, 0.25f); + } + } + + if (decelerate) + npc.velocity *= chargeWaitSlowdownMult; npc.ai[1] += 1f; // If enough time has passed, charge. if (npc.ai[1] >= chargePhaseWait) { + // Set damage + npc.damage = npc.defDamage; + npc.ai[0] = 2f; npc.ai[1] = 0f; npc.netUpdate = true; - Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + - new Vector2(Main.rand.Next(-chargeRandomness, chargeRandomness + 1), Main.rand.Next(-chargeRandomness, chargeRandomness + 1)) * 0.04f; + Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2(Main.rand.Next(-chargeRandomness, chargeRandomness + 1), Main.rand.Next(-chargeRandomness, chargeRandomness + 1)) * 0.04f; velocity.Normalize(); velocity *= chargeSpeed; npc.velocity = velocity; @@ -9795,6 +9781,9 @@ PrepareToShoot: } else if (npc.ai[0] == 2f) { + // Set damage + npc.damage = npc.defDamage; + npc.knockBackResist = 0f; npc.ai[1] += 1f; @@ -9802,6 +9791,9 @@ PrepareToShoot: // If time is up and the player is (relatively) far, or the velocity is (relatively) low, reset. if ((npc.ai[1] >= maximumChargeTime & aboveAndFar) || npc.velocity.Length() < minimumChargeSpeed) { + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; @@ -9838,6 +9830,9 @@ PrepareToShoot: } else if (npc.ai[0] == 4f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[1] -= 3f; if (npc.ai[1] <= 0f) { @@ -9858,17 +9853,18 @@ PrepareToShoot: npc.netUpdate = true; } - // Dust + // Explode if (npc.ai[0] == 3f) { + // Set damage + npc.damage = npc.defDamage; + npc.position = npc.Center; npc.width = npc.height = CalamityWorld.death ? 360 : 240; npc.position -= npc.Size; npc.velocity = Vector2.Zero; - npc.damage = 160; - npc.alpha = 255; Lighting.AddLight((int)npc.Center.X / 16, (int)npc.Center.Y / 16, 0.2f, 0.7f, 1.1f); @@ -9912,7 +9908,7 @@ PrepareToShoot: npc.ai[1] += 1f; if (npc.ai[1] >= 3f) { - SoundEngine.PlaySound(SoundID.Item14, npc.position); + SoundEngine.PlaySound(SoundID.Item14, npc.Center); npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; @@ -10045,7 +10041,7 @@ PrepareToShoot: if ((int)npc.ai[1] == NPCID.Mothron) { - npc.defense = (int)(npc.defDefense * 1.5); + npc.defense = (int)Math.Round(npc.defDefense * 1.5); npc.scale *= 2f; npc.width = npc.height = (int)(34f * npc.scale); npc.netUpdate = true; @@ -10099,7 +10095,12 @@ PrepareToShoot: { npc.noGravity = true; npc.noTileCollide = false; + + // Set damage + npc.damage = npc.defDamage; + npc.defense = npc.defDefense; + if (npc.justHit && Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(10)) { npc.netUpdate = true; @@ -10108,7 +10109,11 @@ PrepareToShoot: } if (npc.ai[0] == -1f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.defense = npc.defDefense + 10; + npc.noGravity = false; npc.velocity.X *= 0.98f; npc.ai[1] += 1f; @@ -10288,6 +10293,10 @@ PrepareToShoot: npc.noTileCollide = false; if (npc.ai[0] == 0f) { + // Avoid cheap bullshit + if (npc.type == NPCID.DeadlySphere || npc.type == NPCID.NebulaHeadcrab) + npc.damage = 0; + npc.TargetClosest(); if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) { @@ -10347,6 +10356,12 @@ PrepareToShoot: } else if (npc.ai[0] == 1f) { + // Set damage or avoid cheap bullshit + if (npc.type == NPCID.DeadlySphere) + npc.damage = npc.defDamage; + else if (npc.type == NPCID.NebulaHeadcrab) + npc.damage = 0; + npc.rotation += npc.direction * 0.3f; Vector2 attacktargetDirection = Main.player[npc.target].Center - npc.Center; if (npc.type == NPCID.NebulaHeadcrab) @@ -10390,6 +10405,10 @@ PrepareToShoot: } else if (npc.ai[0] == 2f) { + // Avoid cheap bullshit + if (npc.type == NPCID.DeadlySphere || npc.type == NPCID.NebulaHeadcrab) + npc.damage = 0; + npc.rotation = npc.velocity.X * 0.1f; npc.noTileCollide = true; Vector2 idleTargetDirection = Main.player[npc.target].Center - npc.Center; @@ -10404,6 +10423,10 @@ PrepareToShoot: } else if (npc.ai[0] == 3f) { + // Avoid cheap bullshit + if (npc.type == NPCID.DeadlySphere || npc.type == NPCID.NebulaHeadcrab) + npc.damage = 0; + npc.rotation = npc.velocity.X * 0.1f; Vector2 blockedCellCenter = new Vector2(npc.ai[1], npc.ai[2]); Vector2 blockedCellDirection = blockedCellCenter - npc.Center; @@ -10424,6 +10447,10 @@ PrepareToShoot: } else if (npc.ai[0] == 4f) { + // Avoid cheap bullshit + if (npc.type == NPCID.DeadlySphere || npc.type == NPCID.NebulaHeadcrab) + npc.damage = 0; + npc.rotation = npc.velocity.X * 0.1f; if (npc.collideX) npc.velocity.X *= -0.8f; @@ -10486,12 +10513,18 @@ PrepareToShoot: Player player8 = Main.player[npc.target]; if (!player8.active || player8.dead) { + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[0] = 0f; npc.ai[1] = 0f; npc.netUpdate = true; } else { + // Set damage + npc.damage = npc.defDamage; + npc.Center = ((player8.gravDir == 1f) ? player8.Top : player8.Bottom) + new Vector2(player8.direction * 4, 0f); npc.gfxOffY = player8.gfxOffY; npc.velocity = Vector2.Zero; @@ -10813,6 +10846,9 @@ PrepareToShoot: #region Big Mimic AI public static bool BuffedBigMimicAI(NPC npc, Mod mod) { + // Set damage + npc.damage = npc.defDamage; + npc.knockBackResist = 0.2f * Main.GameModeInfo.KnockbackToEnemiesMultiplier; npc.dontTakeDamage = false; npc.noTileCollide = false; @@ -10934,10 +10970,13 @@ PrepareToShoot: } else if (npc.ai[0] == 3f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.velocity.X *= 0.85f; npc.dontTakeDamage = true; npc.ai[1] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= (CalamityWorld.death ? 60f : 120f)) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= (CalamityWorld.death ? 60f : 90f)) { npc.ai[0] = 2f; npc.ai[1] = 0f; diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 0aa7f0c98a..08f2fa9881 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -28,6 +28,7 @@ using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -70,6 +71,10 @@ namespace CalamityMod.NPCs.Yharon public SlotId RoarSoundSlot; + public static Asset GlowTextureGreen; + public static Asset GlowTextureOrange; + public static Asset GlowTexturePurple; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 7; @@ -86,6 +91,12 @@ namespace CalamityMod.NPCs.Yharon value.Position.Y -= 14f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTextureGreen = ModContent.Request(Texture + "GlowGreen", AssetRequestMode.AsyncLoad); + GlowTextureOrange = ModContent.Request(Texture + "GlowOrange", AssetRequestMode.AsyncLoad); + GlowTexturePurple = ModContent.Request(Texture + "GlowPurple", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -356,9 +367,9 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient) { safeBox.X = (int)(player.Center.X - (Main.zenithWorld ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f)); - safeBox.Y = (int)(player.Center.Y - 10500f); + safeBox.Y = (int)Main.topWorld; safeBox.Width = Main.zenithWorld ? 3000 : Main.getGoodWorld ? 2000 : bossRush ? 4000 : revenge ? 6000 : 7000; - safeBox.Height = 21000; + safeBox.Height = Main.maxTilesY * 16; Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + (Main.zenithWorld ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - (Main.zenithWorld ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); } @@ -2844,15 +2855,15 @@ namespace CalamityMod.NPCs.Yharon if (enteredSubphase2 || NPC.ai[0] == 4f || startSecondAI) { - texture = ModContent.Request("CalamityMod/NPCs/Yharon/YharonGlowOrange").Value; + texture = GlowTextureOrange.Value; Color orangeGlowColor = Color.Lerp(Color.White, invincible ? invincibleColor : Color.Orange, 0.5f) * NPC.Opacity; lerpEndColor = invincible ? invincibleColor : Color.Orange; - Texture2D texture2 = ModContent.Request("CalamityMod/NPCs/Yharon/YharonGlowGreen").Value; + Texture2D texture2 = GlowTextureGreen.Value; Color greenGlowColorOpacity = Color.Lerp(Color.White, invincible ? invincibleColor : Color.Chartreuse, 0.5f) * NPC.Opacity; Color greenGlowColor = invincible ? invincibleColor : Color.Chartreuse; - Texture2D texture3 = ModContent.Request("CalamityMod/NPCs/Yharon/YharonGlowPurple").Value; + Texture2D texture3 = GlowTexturePurple.Value; Color blueGlowColorOpacity = Color.Lerp(Color.White, invincible ? invincibleColor : Color.BlueViolet, 0.5f) * NPC.Opacity; Color blueGlowColor = invincible ? invincibleColor : Color.BlueViolet; diff --git a/Particles/BloomParticle.cs b/Particles/BloomParticle.cs new file mode 100644 index 0000000000..5a788818cf --- /dev/null +++ b/Particles/BloomParticle.cs @@ -0,0 +1,53 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Particles +{ + public class BloomParticle : Particle + { + public override string Texture => "CalamityMod/Particles/BloomCircle"; + public override bool UseAdditiveBlend => true; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + private float OriginalScale; + private float FinalScale; + private float opacity; + private Color BaseColor; + private bool Fade; + + public BloomParticle(Vector2 position, Vector2 velocity, Color color, float originalScale, float finalScale, int lifeTime, bool fade = true) + { + Position = position; + Velocity = velocity; + BaseColor = color; + OriginalScale = originalScale; + FinalScale = finalScale; + Scale = originalScale; + Lifetime = lifeTime; + Fade = fade; + } + + public override void Update() + { + float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }); + Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress); + if (Fade) + opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2); + + Color = BaseColor * (Fade ? opacity : 1); + Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex = ModContent.Request(Texture).Value; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * (Fade ? opacity : 1), 0, tex.Size() / 2f, Scale, SpriteEffects.None, 0); + } + + } +} diff --git a/Particles/CustomPulse.cs b/Particles/CustomPulse.cs new file mode 100644 index 0000000000..a3072597f7 --- /dev/null +++ b/Particles/CustomPulse.cs @@ -0,0 +1,59 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Particles +{ + public class CustomPulse : Particle + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public bool UseAltVisual = true; + public override bool UseAdditiveBlend => UseAltVisual; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + private string NewTexture; + private float OriginalScale; + private float FinalScale; + private float opacity; + private Vector2 Squish; + private Color BaseColor; + + public CustomPulse(Vector2 position, Vector2 velocity, Color color, string texture, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime, bool UseAdditiveBlend = true) + { + Position = position; + Velocity = velocity; + BaseColor = color; + NewTexture = texture; + OriginalScale = originalScale; + FinalScale = finalScale; + Scale = originalScale; + Lifetime = lifeTime; + Squish = squish; + Rotation = rotation; + UseAltVisual = UseAdditiveBlend; + } + + public override void Update() + { + float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }); + Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress); + + opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2); + + Color = BaseColor * opacity; + Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); + Velocity *= 0.95f; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex = ModContent.Request(NewTexture).Value; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale * Squish, SpriteEffects.None, 0); + } + + } +} diff --git a/Particles/DestroyerReticleTelegraph.cs b/Particles/DestroyerReticleTelegraph.cs new file mode 100644 index 0000000000..8eb4fb2d74 --- /dev/null +++ b/Particles/DestroyerReticleTelegraph.cs @@ -0,0 +1,53 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Particles +{ + public class DestroyerReticleTelegraph : Particle + { + public override string Texture => "CalamityMod/Particles/DestroyerReticleTelegraph"; + public override bool UseAdditiveBlend => true; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool Important => true; + + private NPC NPCToFollow; + private float OriginalScale; + private float FinalScale; + private float Opacity; + private int RotationDirection; + + public DestroyerReticleTelegraph(NPC npcToFollow, Color color, float originalScale, float finalScale, int lifeTime) + { + NPCToFollow = npcToFollow; + Color = color; + OriginalScale = originalScale; + Scale = originalScale; + FinalScale = finalScale; + Lifetime = lifeTime; + RotationDirection = Main.rand.NextBool().ToDirectionInt(); + } + + public override void Update() + { + float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new(EasingType.PolyOut, 0f, 0f, 1f, 4) }); + Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress); + Opacity = pulseProgress; + Rotation += MathHelper.ToRadians(8f) * (1f - pulseProgress) * RotationDirection; + + if (NPCToFollow != null && NPCToFollow.active && !Main.tile[NPCToFollow.Center.ToSafeTileCoordinates()].IsTileSolid()) + Position = NPCToFollow.Center; + else + Kill(); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex = ModContent.Request(Texture).Value; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * Opacity, Rotation, tex.Size() / 2f, Scale, SpriteEffects.None, 0); + } + } +} diff --git a/Particles/DestroyerReticleTelegraph.png b/Particles/DestroyerReticleTelegraph.png new file mode 100644 index 0000000000..d8a1f4b142 Binary files /dev/null and b/Particles/DestroyerReticleTelegraph.png differ diff --git a/Particles/DestroyerSparkTelegraph.cs b/Particles/DestroyerSparkTelegraph.cs new file mode 100644 index 0000000000..6af1f925e2 --- /dev/null +++ b/Particles/DestroyerSparkTelegraph.cs @@ -0,0 +1,59 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class DestroyerSparkTelegraph : Particle + { + public override string Texture => "CalamityMod/Particles/Sparkle2"; + public override bool UseAdditiveBlend => true; + public override bool UseCustomDraw => true; + public override bool SetLifetime => true; + public override bool Important => true; + + private NPC NPCToFollow; + private float Spin; + private float Opacity; + private Color Bloom; + private float BloomScale; + + public DestroyerSparkTelegraph(NPC npcToFollow, Color color, Color bloom, float scale, int lifeTime, float rotationSpeed = 0f, float bloomScale = 1f) + { + NPCToFollow = npcToFollow; + Color = color; + Bloom = bloom; + Scale = scale; + Lifetime = lifeTime; + Spin = rotationSpeed; + BloomScale = bloomScale; + Rotation = Main.rand.NextFloat(MathHelper.TwoPi); + } + + public override void Update() + { + Opacity = MathF.Sin(LifetimeCompletion * MathHelper.Pi); + Rotation += Spin * ((Velocity.X > 0) ? 1f : -1f); + + if (NPCToFollow != null && NPCToFollow.active && !Main.tile[NPCToFollow.Center.ToSafeTileCoordinates()].IsTileSolid()) + Position = NPCToFollow.Center; + else + Kill(); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D starTexture = ModContent.Request(Texture).Value; + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + // Ajust the bloom's texture to be the same size as the star's. + float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height; + + spriteBatch.Draw(bloomTexture, Position - Main.screenPosition, null, Bloom * Opacity * 0.5f, 0, bloomTexture.Size() / 2f, Scale * BloomScale * properBloomSize, SpriteEffects.None, 0); + spriteBatch.Draw(starTexture, Position - Main.screenPosition, null, Color * Opacity * 0.5f, Rotation + MathHelper.PiOver4, starTexture.Size() / 2f, Scale * 0.75f, SpriteEffects.None, 0); + spriteBatch.Draw(starTexture, Position - Main.screenPosition, null, Color * Opacity, Rotation, starTexture.Size() / 2f, Scale, SpriteEffects.None, 0); + } + } +} diff --git a/Particles/DustyCircleHardEdge.png b/Particles/DustyCircleHardEdge.png new file mode 100644 index 0000000000..77d79d4071 Binary files /dev/null and b/Particles/DustyCircleHardEdge.png differ diff --git a/Particles/FlameExplosion.png b/Particles/FlameExplosion.png new file mode 100644 index 0000000000..d678655a63 Binary files /dev/null and b/Particles/FlameExplosion.png differ diff --git a/Particles/LargeBloom.png b/Particles/LargeBloom.png new file mode 100644 index 0000000000..643741e8c9 Binary files /dev/null and b/Particles/LargeBloom.png differ diff --git a/Particles/SmallBloomRing.png b/Particles/SmallBloomRing.png new file mode 100644 index 0000000000..f51029ba21 Binary files /dev/null and b/Particles/SmallBloomRing.png differ diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index 98e42aced1..2bd78e9ce0 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -1,5 +1,6 @@ using System.IO; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.CalClone; @@ -78,6 +79,17 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity *= scaleFactor; } } + if (Projectile.ai[2] == 2f) + { + if (Projectile.timeLeft > 600) + Projectile.velocity *= 1.015f; + Projectile.scale = 0.8f; + + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), 182); + trailDust.noGravity = true; + trailDust.velocity = (-Projectile.velocity * 0.5f) * Main.rand.NextFloat(0.1f, 0.9f); + trailDust.scale = Main.rand.NextFloat(0.2f, 0.6f); + } if (Projectile.localAI[0] == 0f) { @@ -98,7 +110,7 @@ namespace CalamityMod.Projectiles.Boss return; if (Projectile.ai[0] == 0f || Main.zenithWorld) - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 180); else target.AddBuff(ModContent.BuffType(), 90); } diff --git a/Projectiles/Boss/BrimstoneHellblast.cs b/Projectiles/Boss/BrimstoneHellblast.cs index 01d57e73ec..526da53c8e 100644 --- a/Projectiles/Boss/BrimstoneHellblast.cs +++ b/Projectiles/Boss/BrimstoneHellblast.cs @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Boss return; if (Projectile.ai[0] == 0f || Main.zenithWorld) - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 180); else target.AddBuff(ModContent.BuffType(), 90); } diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs index ba8399a354..8d8e166cda 100644 --- a/Projectiles/Boss/BrimstoneHellblast2.cs +++ b/Projectiles/Boss/BrimstoneHellblast2.cs @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Boss return; if (Projectile.ai[0] == 0f || Main.zenithWorld) - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 180); else target.AddBuff(ModContent.BuffType(), 90); } diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index 6c8b252cce..74d639b68a 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -2,14 +2,20 @@ using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Graphics.Effects; using Terraria.ID; using Terraria.ModLoader; @@ -18,11 +24,31 @@ namespace CalamityMod.Projectiles.Boss public class BrimstoneMonster : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneMonsterSpawn"); public static readonly SoundStyle DroneSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneMonsterDrone"); + public SlotId RumbleSlot; + public static Asset screamTex; + + internal static readonly float CircularHitboxRadius = 170f; + public static int MinimumDamagePerFrame = 4; + public static int MaximumDamagePerFrame = 16; + public static float AdrenalineLossPerFrame = 0.04f; + public static float SpeedToForceMaxDamage = 25f; private float speedAdd = 0f; private float speedLimit = 0f; + private int time = 0; + private int sitStill = 90; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + screamTex = ModContent.Request("CalamityMod/ExtraTextures/ScreamyFace", AssetRequestMode.AsyncLoad); + } + } public override void SetDefaults() { @@ -55,11 +81,49 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + if (time == 0) + { + Projectile.scale = 0.1f; + for (int i = 0; i < 2; i++) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.Magenta, 0.3f), 1.45f, 0, 120, false); + GeneralParticleHandler.SpawnParticle(bloom); + } + Particle bloom2 = new BloomParticle(Projectile.Center, Vector2.Zero, Color.White, 1.35f, 0, 120, false); + GeneralParticleHandler.SpawnParticle(bloom2); + } + + time++; + + if (Projectile.scale < 1.9f && Projectile.timeLeft > 90) + { + if (Projectile.scale < 1.5f) + { + for (int i = 0; i < 10; i++) + { + Vector2 dustVel = new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f); + Dust spawnDust = Dust.NewDustPerfect(Projectile.Center * (Projectile.scale * 5), (int)CalamityDusts.Brimstone, dustVel); + spawnDust.noGravity = true; + spawnDust.scale = Main.rand.NextFloat(1.7f, 2.8f) - Projectile.scale * 1.5f; + } + for (int i = 0; i < 4; i++) + { + Vector2 sparkVel = new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.1f); + GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center + sparkVel * 2 * (Projectile.scale * 5), sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f) - Projectile.scale * 1.5f, Color.Lerp(Color.Red, Color.Magenta, 0.5f), true, true); + GeneralParticleHandler.SpawnParticle(orb); + } + } + Projectile.scale += 0.01f; + } + + if (SoundEngine.TryGetActiveSound(RumbleSlot, out var RumbleSound) && RumbleSound.IsPlaying) + RumbleSound.Position = Projectile.Center; + if (!CalamityPlayer.areThereAnyDamnBosses) { - Projectile.active = false; + if (Projectile.timeLeft > 90) + Projectile.timeLeft = 90; Projectile.netUpdate = true; - return; } int choice = (int)Projectile.ai[1]; @@ -67,35 +131,66 @@ namespace CalamityMod.Projectiles.Boss { Projectile.soundDelay = 1125 - (choice * 225); SoundEngine.PlaySound(SpawnSound, Projectile.Center); + if (Projectile.ai[1] == 0f && Projectile.timeLeft >= 90) + RumbleSlot = Main.zenithWorld ? SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SCalSounds/GFBDrone") with { IsLooped = true }, Projectile.Center, _ => new ProjectileAudioTracker(Projectile).IsActiveAndInGame()) : SoundEngine.PlaySound(DroneSound with { IsLooped = true }, Projectile.Center, _ => new ProjectileAudioTracker(Projectile).IsActiveAndInGame()); Projectile.localAI[0] += 1f; - switch (choice) - { - case 0: - speedLimit = 10f; - break; - case 1: - speedLimit = 20f; - break; - case 2: - speedLimit = 30f; - break; - case 3: - speedLimit = 40f; - break; - default: - break; - } + speedLimit = 23; } if (speedAdd < speedLimit) speedAdd += 0.04f; - if (Projectile.soundDelay <= 0 && (choice == 0 || choice == 2)) + float targetDist; + if (!Main.player[choice].dead && Main.player[choice].active && Main.player[choice] != null) + targetDist = Vector2.Distance(Main.player[choice].Center, Projectile.Center); + else + targetDist = 2000; + + if (Projectile.ai[1] == 0f) { - Projectile.soundDelay = 420; - SoundEngine.PlaySound(DroneSound, Projectile.Center); + if (targetDist <= 1400) + { + float targetPitchShift = Utils.GetLerpValue(1400, 700, targetDist); + if (SoundEngine.TryGetActiveSound(RumbleSlot, out var RumblePitch) && RumblePitch.IsPlaying) + { + RumblePitch.Pitch = MathHelper.Lerp(Main.zenithWorld ? -0.7f : 0f, Main.zenithWorld ? 0.2f : 0.7f, targetPitchShift); + RumblePitch.Volume = MathHelper.Lerp(0.3f, 0.8f, targetPitchShift); + } + } + + Projectile.soundDelay--; + if (SoundEngine.TryGetActiveSound(RumbleSlot, out var RumblePlaying) && RumblePlaying.IsPlaying) + { + Projectile.soundDelay = 1; + } + + if (Projectile.soundDelay <= 0 && Projectile.timeLeft >= 90) + RumbleSlot = Main.zenithWorld ? SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SCalSounds/GFBDrone") with { IsLooped = true }, Projectile.Center, _ => new ProjectileAudioTracker(Projectile).IsActiveAndInGame()) : SoundEngine.PlaySound(DroneSound with { IsLooped = true }, Projectile.Center, _ => new ProjectileAudioTracker(Projectile).IsActiveAndInGame()); + + if (Projectile.timeLeft < 90) + { + RumblePlaying?.Stop(); + } + if (CalamityGlobalNPC.SCal == -1) + { + RumblePlaying?.Stop(); + } } + if (Projectile.timeLeft < 90) + { + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 90f, 0f, 1f); + } + else + { + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 35910) / 90f), 0f, 1f); + } + + if (Projectile.scale >= 1.9f) + sitStill--; + if (sitStill > 0) + return; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; @@ -111,11 +206,6 @@ namespace CalamityMod.Projectiles.Boss speed *= 0.5f; } - if (Projectile.timeLeft < 90) - Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 90f, 0f, 1f); - else - Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 35910) / 90f), 0f, 1f); - int target = (int)Projectile.ai[0]; if (target >= 0 && Main.player[target].active && !Main.player[target].dead) { @@ -132,7 +222,10 @@ namespace CalamityMod.Projectiles.Boss } if (death) + { + speedLimit = 15; return; + } // Fly away from other brimstone monsters. float pushForce = 0.05f; @@ -162,37 +255,70 @@ namespace CalamityMod.Projectiles.Boss } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 170f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, CircularHitboxRadius * Projectile.scale * Projectile.Opacity, targetHitbox); - public override bool PreDraw(ref Color lightColor) + // This function serves double duty. + // It both ensures that Brimstone Monsters cannot deal damage except at full opacity, + // and deals their unavoidable overlap damage in lieu of a standard projectile hit. + public override bool CanHitPlayer(Player player) { - Texture2D tex = ModContent.Request(Texture).Value; - lightColor.R = (byte)(255 * Projectile.Opacity); + // If the Brimstone Monster is not yet fully formed, do nothing. + if (Projectile.Opacity < 1f) + return false; - if (CalamityGlobalNPC.SCal != -1) - { - if (Main.npc[CalamityGlobalNPC.SCal].active) - { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) - { - tex = ModContent.Request("CalamityMod/Projectiles/Boss/BrimstoneMonsterII").Value; - lightColor.B = (byte)(255 * Projectile.Opacity); - } - } - } + // If Journey God Mode is active, or any effects which simulate, provide or equivalent to it, do not harm the player. + // Likewise, if the player has immunity frames, do not harm them. + bool cannotBeHurt = player.HasIFrames() || player.creativeGodMode; + if (cannotBeHurt) + return true; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + // Applies Vulnerability Hex and/or the effects of Supreme Cirrus' HAGE faces. + OnHitPlayer_Internal(player); + + // Compute distance for direct health reduction from overlap. + float distSQ = Projectile.DistanceSQ(player.Center); + float radiusSQ = CircularHitboxRadius * CircularHitboxRadius * Projectile.scale * Projectile.scale; + float radiusRatio = distSQ / radiusSQ; + + // Check the player's speed. If they are moving fast enough, damage them more severely; this prevents trying to rush straight through the vortex. + float playerSpeed = player.velocity.LengthSquared(); + float speedRatio = playerSpeed / (SpeedToForceMaxDamage * SpeedToForceMaxDamage); + + // Take the higher of the two to determine the damage application ratio. + float damageApplicationRatio = MathHelper.Max(radiusRatio, speedRatio); + + int healthToDrain = (int)MathHelper.Lerp(MaximumDamagePerFrame, MinimumDamagePerFrame, damageApplicationRatio); + if (healthToDrain < MinimumDamagePerFrame) + healthToDrain = MinimumDamagePerFrame; + + player.statLife -= healthToDrain; + + // Drain Adrenaline extremely rapidly. 4% of current Adrenaline is lost per frame. + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.AdrenalineEnabled) + modPlayer.adrenaline *= 1f - AdrenalineLossPerFrame; + + // If this direct health reduction brings the player's health below zero, claim the Brimstone Monster killed them. + string path = Main.zenithWorld ? "GFB" : ""; + path += Main.rand.Next(1, 4).ToString(); + if (Main.myPlayer == player.whoAmI && player.statLife <= 0) + player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.WhisperingMaelstrom" + path).Format(player.name)), 1000, -1); + + // Still do not allow a standard hit, but the player should surely be feeling the pain soon... return false; } - public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; - public override void OnHitPlayer(Player target, Player.HurtInfo info) { if (info.Damage <= 0 || Projectile.Opacity != 1f) return; - target.AddBuff(ModContent.BuffType(), 300, true); + OnHitPlayer_Internal(target); + } + + private static void OnHitPlayer_Internal(Player target) + { + target.AddBuff(ModContent.BuffType(), 360, true); // Remove all positive buffs from the player if they're hit by HAGE while Cirrus is alive. if (CalamityGlobalNPC.SCal != -1) @@ -215,9 +341,80 @@ namespace CalamityMod.Projectiles.Boss } } + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(RumbleSlot, out var RumblePlaying) && RumblePlaying.IsPlaying) + { + RumblePlaying?.Stop(); + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request(Texture).Value; + lightColor.R = (byte)(255 * Projectile.Opacity); + Main.spriteBatch.End(); + Effect shieldEffect = Filters.Scene["CalamityMod:HellBall"].GetShader().Shader; + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix); + + float noiseScale = 0.6f; + + // Define shader parameters + + shieldEffect.Parameters["time"].SetValue(Projectile.timeLeft / 60f * 0.24f); + shieldEffect.Parameters["blowUpPower"].SetValue(3.2f); + shieldEffect.Parameters["blowUpSize"].SetValue(0.4f); + shieldEffect.Parameters["noiseScale"].SetValue(noiseScale); + + float opacity = Projectile.Opacity; + shieldEffect.Parameters["shieldOpacity"].SetValue(opacity); + shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); + + Color edgeColor = Color.Black * opacity; + Color shieldColor = Color.Lerp(Color.Red, Color.Magenta, 0.5f) * opacity; + + // Define shader parameters for ball color + shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3()); + shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); + + Vector2 pos = Projectile.Center - Main.screenPosition; + + float scale = 0.715f; + Main.spriteBatch.Draw(screamTex.Value, pos, null, Color.White, 0, screamTex.Size() * 0.5f, scale * Projectile.scale * Projectile.Opacity, 0, 0); + + //Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale * 0.3f, SpriteEffects.None, 0); + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + bool isCirrus = CalamityGlobalNPC.SCal != -1 && Main.npc[CalamityGlobalNPC.SCal].active && Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus; + if (isCirrus) + { + Texture2D hageTex = ModContent.Request("CalamityMod/Projectiles/Boss/BrimstoneMonsterII").Value; + lightColor.B = (byte)(255 * Projectile.Opacity); + Main.EntitySpriteDraw(hageTex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, hageTex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + } + else + { + Texture2D vortexTexture = ModContent.Request("CalamityMod/ExtraTextures/SoulVortex").Value; + Texture2D centerTexture = ModContent.Request("CalamityMod/Particles/LargeBloom").Value; + for (int i = 0; i < 10; i++) + { + float angle = MathHelper.TwoPi * i / 3f + Main.GlobalTimeWrappedHourly * MathHelper.TwoPi; + Color outerColor = Color.Lerp(Color.Red, Color.Magenta, i * 0.15f); + Color drawColor = Color.Lerp(outerColor, Color.Black, i * 0.2f) * 0.5f; + drawColor.A = 0; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + + drawPosition += (angle + Main.GlobalTimeWrappedHourly * i / 16f).ToRotationVector2() * 6f; + Main.EntitySpriteDraw(vortexTexture, drawPosition, null, drawColor * Projectile.Opacity, -angle + MathHelper.PiOver2, vortexTexture.Size() * 0.5f, (Projectile.scale * (1 - i * 0.05f)) * Projectile.Opacity, SpriteEffects.None, 0); + } + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition, null, Color.Black * Projectile.Opacity, Projectile.rotation, centerTexture.Size() * 0.5f, (Projectile.scale * 0.9f) * Projectile.Opacity, SpriteEffects.None, 0); + } + return false; + } + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) { - behindProjectiles.Add(index); behindNPCs.Add(index); } } diff --git a/Projectiles/Boss/DestroyerElectricLaser.cs b/Projectiles/Boss/DestroyerElectricLaser.cs index 4c9e65100b..ecf9ffdfbd 100644 --- a/Projectiles/Boss/DestroyerElectricLaser.cs +++ b/Projectiles/Boss/DestroyerElectricLaser.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.penetrate = 1; Projectile.alpha = 255; - Projectile.scale = 1.2f; + Projectile.scale = 1.1f; Projectile.timeLeft = 600; Projectile.extraUpdates = 2; } diff --git a/Projectiles/Boss/Flarenado.cs b/Projectiles/Boss/Flarenado.cs index 66c0b66ff5..fd8cdab36f 100644 --- a/Projectiles/Boss/Flarenado.cs +++ b/Projectiles/Boss/Flarenado.cs @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Boss bool breakapart = Main.zenithWorld && Projectile.localAI[1] >= breakThreshold; if (Projectile.ai[0] <= 0f && !breakapart) { - float swaySize = 0.104719758f; + float swaySize = MathHelper.Pi / 30f; float smolWidth = (float)Projectile.width / 5f; smolWidth *= 2f; float projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; diff --git a/Projectiles/Boss/HomingGasBulb.cs b/Projectiles/Boss/HomingGasBulb.cs index 3c6eab8cbd..468aadc642 100644 --- a/Projectiles/Boss/HomingGasBulb.cs +++ b/Projectiles/Boss/HomingGasBulb.cs @@ -2,7 +2,9 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.NPCs.TownNPCs; +using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -32,13 +34,15 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; + if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 1f; SoundEngine.PlaySound(SoundID.Item17, Projectile.Center); } - Lighting.AddLight(Projectile.Center, 0.4f, 0f, 0.4f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.5f); Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; @@ -63,9 +67,24 @@ namespace CalamityMod.Projectiles.Boss } } - if (Projectile.ai[0] % ((Main.masterMode || BossRushEvent.BossRushActive) ? 15f : 20f) == 0f) + if (Projectile.ai[0] % (masterMode ? 15f : 20f) == 0f) { + int dustType = 73; + int totalDust = 12; + float radians = MathHelper.TwoPi / totalDust; + Vector2 spinningPoint = new Vector2(0f, -1f); + for (int k = 0; k < totalDust; k++) + { + Vector2 projectileVelocity = spinningPoint.RotatedBy(radians * k); + Vector2 spawnOffset = Projectile.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 10f; + float randomSpeed = Main.rand.NextFloat(0.8f, 1.2f); + Vector2 dustVelocity = projectileVelocity * randomSpeed; + for (int l = 0; l < 2; l++) + Dust.NewDust(spawnOffset, 2, 2, dustType, dustVelocity.X, dustVelocity.Y); + } + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + if (Projectile.owner == Main.myPlayer) { int type = ModContent.ProjectileType(); @@ -75,7 +94,11 @@ namespace CalamityMod.Projectiles.Boss } } - public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, Projectile.alpha); + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + return false; + } public override void OnKill(int timeLeft) { diff --git a/Projectiles/Boss/HomingGasBulbSporeGas.cs b/Projectiles/Boss/HomingGasBulbSporeGas.cs index c48ac3437c..aeabe872b4 100644 --- a/Projectiles/Boss/HomingGasBulbSporeGas.cs +++ b/Projectiles/Boss/HomingGasBulbSporeGas.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.localAI[0] = 255f; } - float lightValues = (255 - Projectile.alpha) * 0.3f / 255f; + float lightValues = (255 - Projectile.alpha) * 0.6f / 255f; Lighting.AddLight(Projectile.Center, lightValues, 0f, lightValues); Projectile.alpha = (int)(100.0 + Projectile.localAI[0] * 0.7); diff --git a/Projectiles/Boss/Infernado.cs b/Projectiles/Boss/Infernado.cs index 5f3353a58a..598bfb005b 100644 --- a/Projectiles/Boss/Infernado.cs +++ b/Projectiles/Boss/Infernado.cs @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Boss bool breakapart = Main.zenithWorld && Projectile.localAI[1] >= breakThreshold; if (Projectile.ai[0] <= 0f && !breakapart) { - float swaySize = 0.104719758f; + float swaySize = MathHelper.Pi / 30f; float smolWidth = (float)Projectile.width / 5f; smolWidth *= 2f; float projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; diff --git a/Projectiles/Boss/Infernado2.cs b/Projectiles/Boss/Infernado2.cs index f398fe5668..f327ca7e59 100644 --- a/Projectiles/Boss/Infernado2.cs +++ b/Projectiles/Boss/Infernado2.cs @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Boss bool breakapart = Main.zenithWorld && Projectile.ai[0] <= breakThreshold; if (Projectile.ai[0] <= 0f && !breakapart) { - float swaySize = 0.104719758f; + float swaySize = MathHelper.Pi / 30f; float smolWidth = (float)Projectile.width / 5f; smolWidth *= 2f; float projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs index 86f0dbeffa..74872373c0 100644 --- a/Projectiles/Boss/ProvidenceCrystal.cs +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -47,6 +47,12 @@ namespace CalamityMod.Projectiles.Boss return; } + if (Projectile.ai[2] > 0f) + { + if (Projectile.timeLeft > Projectile.ai[2]) + Projectile.timeLeft = (int)Projectile.ai[2]; + } + Player proviTarget = Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target]; Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; diff --git a/Projectiles/Boss/SCalBrimstoneFireblast.cs b/Projectiles/Boss/SCalBrimstoneFireblast.cs index 514cc3e3fa..79ce4c173f 100644 --- a/Projectiles/Boss/SCalBrimstoneFireblast.cs +++ b/Projectiles/Boss/SCalBrimstoneFireblast.cs @@ -11,6 +11,12 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ID; +using Terraria.Audio; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs; +using static Humanizer.In; +using CalamityMod.Particles; namespace CalamityMod.Projectiles.Boss { @@ -18,6 +24,8 @@ namespace CalamityMod.Projectiles.Boss { public new string LocalizationCategory => "Projectiles.Boss"; public static readonly SoundStyle ImpactSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneFireblastImpact"); + public bool withinRange = false; + public bool setLifetime = false; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 5; @@ -33,6 +41,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = 1; Projectile.Opacity = 0f; Projectile.timeLeft = 150; + Projectile.tileCollide = false; CooldownSlot = ImmunityCooldownID.Bosses; } @@ -51,10 +60,13 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(Projectile.Center, 0.9f * Projectile.Opacity, 0f, 0f); - if (Projectile.ai[1] == 1f) - Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); - else - Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 90) / 60f), 0f, 1f); + if (!withinRange) + { + if (Projectile.ai[1] == 1f) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); + else + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 90) / 60f), 0f, 1f); + } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; @@ -64,24 +76,87 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } - float inertia = revenge ? 80f : 100f; - float homeSpeed = revenge ? 20f : 15f; - float minDist = 40f; int target = (int)Projectile.ai[0]; - if (target >= 0 && Main.player[target].active && !Main.player[target].dead) + + if (!withinRange) { - if (Projectile.Distance(Main.player[target].Center) > minDist) + float inertia = revenge ? 80f : 100f; + float homeSpeed = revenge ? 20f : 15f; + float minDist = 40f; + if (target >= 0 && Main.player[target].active && !Main.player[target].dead) { - Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[target].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * homeSpeed) / inertia; + if (Projectile.Distance(Main.player[target].Center) > minDist) + { + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[target].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * homeSpeed) / inertia; + } + } + else + { + if (Projectile.ai[0] != -1f) + { + Projectile.ai[0] = -1f; + Projectile.netUpdate = true; + } } } + + float targetDist; + if (target != -1 && !Main.player[target].dead && Main.player[target].active && Main.player[target] != null) + targetDist = Vector2.Distance(Main.player[target].Center, Projectile.Center); else + targetDist = 1000; + + if (!withinRange) { - if (Projectile.ai[0] != -1f) + GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center - Projectile.velocity + Main.rand.NextVector2Circular(20, 20), -Projectile.velocity * Main.rand.NextFloat(0.3f, 1.9f), false, 14, Main.rand.NextFloat(0.35f, 0.6f), (Main.rand.NextBool(4) ? new Color(121, 21, 77) : Color.Red) * Projectile.Opacity, true, true); + GeneralParticleHandler.SpawnParticle(orb); + } + if ((Projectile.timeLeft == 1 && !withinRange) || (targetDist < 224 && Projectile.Opacity == 1f)) // When within 14 blocks of player or when it runs out of time + { + if (!setLifetime) { - Projectile.ai[0] = -1f; - Projectile.netUpdate = true; + Projectile.timeLeft = 60; + setLifetime = true; + } + withinRange = true; + } + if (withinRange && Projectile.ai[1] == 0) + { + Projectile.velocity *= 0.95f; + for (int i = 0; i < 2; i++) + { + Dust failShotDust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(0.7f, 1.8f); + } + if (Projectile.timeLeft <= 40) + { + if (Projectile.Opacity > 0) + Projectile.Opacity -= 0.05f; + } + if (Projectile.timeLeft == 30) + { + Projectile.Opacity = 0; + Projectile.velocity *= 0; + for (int i = 0; i < 2; i++) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, new Color(121, 21, 77), 0.1f, 0.7f, 30, false); + GeneralParticleHandler.SpawnParticle(bloom); + if (Projectile.ai[1] == 1) + bloom.Lifetime = 0; + } + } + if (Projectile.timeLeft == 15) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, Color.Red, 0.1f, 0.65f, 15, false); + GeneralParticleHandler.SpawnParticle(bloom); + } + if (Projectile.timeLeft == 8) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, Color.White, 0.1f, 0.5f, 8, false); + GeneralParticleHandler.SpawnParticle(bloom); } } } @@ -113,7 +188,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0 || Projectile.Opacity != 1f) return; - target.AddBuff(ModContent.BuffType(), 180, true); + target.AddBuff(ModContent.BuffType(), 240, true); } public override void OnKill(int timeLeft) @@ -133,7 +208,7 @@ namespace CalamityMod.Projectiles.Boss int totalProjectiles = bossRush ? 20 : death ? 16 : revenge ? 14 : expertMode ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - float velocity = 7f; + float velocity = 8f; Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { diff --git a/Projectiles/Boss/SCalBrimstoneGigablast.cs b/Projectiles/Boss/SCalBrimstoneGigablast.cs index 35eecf97a8..26cc6ee335 100644 --- a/Projectiles/Boss/SCalBrimstoneGigablast.cs +++ b/Projectiles/Boss/SCalBrimstoneGigablast.cs @@ -11,6 +11,11 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ID; +using Terraria.Audio; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs; +using CalamityMod.Particles; namespace CalamityMod.Projectiles.Boss { @@ -18,7 +23,8 @@ namespace CalamityMod.Projectiles.Boss { public new string LocalizationCategory => "Projectiles.Boss"; public static readonly SoundStyle ImpactSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneGigablastImpact"); - + public bool withinRange = false; + public bool setLifetime = false; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 6; @@ -34,6 +40,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = 1; Projectile.timeLeft = 120; Projectile.Opacity = 0f; + Projectile.tileCollide = false; CooldownSlot = ImmunityCooldownID.Bosses; } @@ -48,10 +55,13 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 5) Projectile.frame = 0; - if (Projectile.ai[1] == 1f) - Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); - else - Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 60) / 60f), 0f, 1f); + if (!withinRange) + { + if (Projectile.ai[1] == 1f) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); + else + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 60) / 60f), 0f, 1f); + } Lighting.AddLight(Projectile.Center, 0.9f * Projectile.Opacity, 0f, 0f); @@ -64,13 +74,76 @@ namespace CalamityMod.Projectiles.Boss } int target = Player.FindClosest(Projectile.Center, 1, 1); - float projSpeed = Projectile.velocity.Length(); - Vector2 playerVec = Main.player[target].Center - Projectile.Center; - playerVec.Normalize(); - playerVec *= projSpeed; - Projectile.velocity = (Projectile.velocity * 24f + playerVec) / 25f; - Projectile.velocity.Normalize(); - Projectile.velocity *= projSpeed; + + if (!withinRange) + { + float projSpeed = Projectile.velocity.Length(); + Vector2 playerVec = Main.player[target].Center - Projectile.Center; + playerVec.Normalize(); + playerVec *= projSpeed; + Projectile.velocity = (Projectile.velocity * 24f + playerVec) / 25f; + Projectile.velocity.Normalize(); + Projectile.velocity *= projSpeed; + } + + float targetDist; + if (target != -1 && !Main.player[target].dead && Main.player[target].active && Main.player[target] != null) + targetDist = Vector2.Distance(Main.player[target].Center, Projectile.Center); + else + targetDist = 1000; + + if (!withinRange) + { + GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center - Projectile.velocity + Main.rand.NextVector2Circular(30, 30), -Projectile.velocity * Main.rand.NextFloat(0.3f, 1.9f), false, 14, Main.rand.NextFloat(0.5f, 0.75f), (Main.rand.NextBool(4) ? new Color(121, 21, 77) :Color.Red) * Projectile.Opacity, true, true); + GeneralParticleHandler.SpawnParticle(orb); + } + if ((Projectile.timeLeft == 1 && !withinRange) || (targetDist < 224 && Projectile.Opacity == 1f)) // When within 14 blocks of player or when it runs out of time + { + if (!setLifetime) + { + Projectile.timeLeft = 60; + setLifetime = true; + } + withinRange = true; + } + if (withinRange && Projectile.ai[1] == 0) + { + Projectile.velocity *= 0.95f; + for (int i = 0; i < 2; i++) + { + Dust failShotDust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(0.7f, 1.8f); + } + if (Projectile.timeLeft <= 40) + { + if (Projectile.Opacity > 0) + Projectile.Opacity -= 0.05f; + } + if (Projectile.timeLeft == 30) + { + Projectile.Opacity = 0; + Projectile.velocity *= 0; + for (int i = 0; i < 2; i++) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, new Color(121, 21, 77), 0.1f, 0.85f, 30, false); + GeneralParticleHandler.SpawnParticle(bloom); + if (Projectile.ai[1] == 1) + bloom.Lifetime = 0; + } + } + if (Projectile.timeLeft == 15) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, Color.Red, 0.1f, 0.8f, 15, false); + GeneralParticleHandler.SpawnParticle(bloom); + } + if (Projectile.timeLeft == 8) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, Color.White, 0.1f, 0.7f, 8, false); + GeneralParticleHandler.SpawnParticle(bloom); + } + } } public override bool PreDraw(ref Color lightColor) @@ -100,7 +173,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0 || Projectile.Opacity != 1f) return; - target.AddBuff(ModContent.BuffType(), 180, true); + target.AddBuff(ModContent.BuffType(), 300, true); } public override void OnKill(int timeLeft) @@ -120,7 +193,7 @@ namespace CalamityMod.Projectiles.Boss int totalProjectiles = bossRush ? 44 : death ? 36 : revenge ? 32 : expertMode ? 28 : 20; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - float velocity = 5f; + float velocity = 6.5f; Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { diff --git a/Projectiles/Boss/SCalRitualDrama.cs b/Projectiles/Boss/SCalRitualDrama.cs index cfa260b98d..f72cbabdbf 100644 --- a/Projectiles/Boss/SCalRitualDrama.cs +++ b/Projectiles/Boss/SCalRitualDrama.cs @@ -1,5 +1,7 @@ using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.Particles; using CalamityMod.Skies; using Microsoft.Xna.Framework; using Terraria; @@ -30,6 +32,22 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + if (Projectile.timeLeft == 689) + { + for (int i = 0; i < 2; i++) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.Magenta, 0.3f), 0f, 0.55f, 270, false); + GeneralParticleHandler.SpawnParticle(bloom); + } + Particle bloom2 = new BloomParticle(Projectile.Center, Vector2.Zero, Color.White, 0f, 0.5f, 270, false); + GeneralParticleHandler.SpawnParticle(bloom2); + } + if (Projectile.timeLeft == 689 - 180) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, new Color(121, 21, 77), 0f, 0.85f, 90, false); + GeneralParticleHandler.SpawnParticle(bloom); + } + // If needed, these effects may continue after the ritual timer, to ensure that there are no awkward // background changes between the time it takes for SCal to appear after this projectile is gone. // If SCal is already present, this does not happen. @@ -55,13 +73,14 @@ namespace CalamityMod.Projectiles.Boss int fireReleaseRate = Time > 150f ? 2 : 1; for (int i = 0; i < fireReleaseRate; i++) { - if (Main.rand.NextBool(4)) + if (Main.rand.NextBool()) { - Dust brimstone = Dust.NewDustPerfect(Projectile.Center + new Vector2(Main.rand.NextFloat(-20f, 24f), Main.rand.NextFloat(10f, 18f)), 267); - brimstone.scale = Main.rand.NextFloat(0.7f, 1f); - brimstone.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat()); + float variance = Main.rand.NextFloat(-25f, 25f); + Dust brimstone = Dust.NewDustPerfect(Projectile.Center + new Vector2(variance, 20), 267); + brimstone.scale = Main.rand.NextFloat(0.35f, 1.2f); + brimstone.color = Main.rand.NextBool() ? Color.Red : new Color(121, 21, 77); brimstone.fadeIn = 0.7f; - brimstone.velocity = -Vector2.UnitY * Main.rand.NextFloat(1.5f, 2.8f); + brimstone.velocity = -Vector2.UnitY.RotatedBy(variance * 0.02f) * Main.rand.NextFloat(1.1f, 2.1f) * (Time * 0.023f); brimstone.noGravity = true; } } @@ -71,11 +90,12 @@ namespace CalamityMod.Projectiles.Boss public void SummonSCal() { + Vector2 spawnPosition = Projectile.Center - new Vector2(53f, 39f); // Summon SCal serverside. // All the other acoustic and visual effects can happen client-side. if (Main.netMode != NetmodeID.MultiplayerClient) { - NPC scal = CalamityUtils.SpawnBossBetter(Projectile.Center - new Vector2(60f), ModContent.NPCType()); + NPC scal = CalamityUtils.SpawnBossBetter(spawnPosition, ModContent.NPCType()); if (Projectile.ai[1] == 1) { scal.ModNPC().cirrus = true; @@ -90,22 +110,22 @@ namespace CalamityMod.Projectiles.Boss Main.LocalPlayer.Calamity().GeneralScreenShakePower = Utils.GetLerpValue(3400f, 1560f, Main.LocalPlayer.Distance(Projectile.Center), true) * 16f; // Generate a dust explosion at the ritual's position. - float burstDirectionVariance = 3; - float burstSpeed = 14f; - for (int j = 0; j < 16; j++) + for (int i = 0; i < 90; i++) { - burstDirectionVariance += j * 2; - for (int k = 0; k < 40; k++) - { - int type = Projectile.ai[1] == 1 ? 69 : (int)CalamityDusts.Brimstone; - Dust burstDust = Dust.NewDustPerfect(Projectile.Center, type); - burstDust.scale = Main.rand.NextFloat(3.1f, 3.5f); - burstDust.position += Main.rand.NextVector2Circular(10f, 10f); - burstDust.velocity = Main.rand.NextVector2Square(-burstDirectionVariance, burstDirectionVariance).SafeNormalize(Vector2.UnitY) * burstSpeed; - burstDust.noGravity = true; - } - burstSpeed += 1.8f; + Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, Projectile.ai[1] == 1 ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); + spawnDust.noGravity = true; + spawnDust.scale = Main.rand.NextFloat(1.2f, 2.3f); } + for (int i = 0; i < 40; i++) + { + Vector2 sparkVel = new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.1f); + GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), Projectile.ai[1] == 1 ? Color.Magenta : Color.Red, true, true); + GeneralParticleHandler.SpawnParticle(orb); + } + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Projectile.ai[1] == 1 ? Color.Magenta : Color.Red, new Vector2(2f, 2f), 0, 0f, 2.7f, 60); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Projectile.ai[1] == 1 ? Color.Magenta : new Color(121, 21, 77), new Vector2(2f, 2f), 0, 0f, 2.1f, 60); + GeneralParticleHandler.SpawnParticle(pulse2); } } } diff --git a/Projectiles/Boss/ScavengerLaser.cs b/Projectiles/Boss/ScavengerLaser.cs index d37afeba01..1e61b00d83 100644 --- a/Projectiles/Boss/ScavengerLaser.cs +++ b/Projectiles/Boss/ScavengerLaser.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Projectiles.Boss public class ScavengerLaser : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 5; @@ -27,7 +28,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.alpha = 255; - Projectile.timeLeft = 600; + Projectile.timeLeft = 900; } public override void SendExtraAI(BinaryWriter writer) @@ -45,6 +46,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; Projectile.frameCounter++; if (Projectile.frameCounter > 5) @@ -77,10 +79,15 @@ namespace CalamityMod.Projectiles.Boss return; } + Vector2 maxVelocity = new Vector2(death ? 15f : 12f, death ? 15f : 12f); + float maxAcceleration = death ? 0.5f : 0.4f; + float timeBeforeHoming = death ? 30f : 45f; + float distanceAboveTargetBeforeHomingDownward = death ? 320f : 480f; + float explodeDistance = 16f; if (Projectile.ai[0] == 0f) { Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 45f) + if (Projectile.localAI[0] >= timeBeforeHoming) { Projectile.localAI[0] = 0f; Projectile.ai[0] = 1f; @@ -88,77 +95,101 @@ namespace CalamityMod.Projectiles.Boss Projectile.netUpdate = true; } - Projectile.velocity.X = Projectile.velocity.RotatedBy(0.0, default).X; - Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -6f, 6f); + Projectile.velocity.X = Projectile.velocity.RotatedBy(0D).X; + Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -maxVelocity.X, maxVelocity.X); - Projectile.velocity.Y = Projectile.velocity.Y - 0.08f; + Projectile.velocity.Y -= maxAcceleration * 0.2f; if (Projectile.velocity.Y > 0f) - Projectile.velocity.Y = Projectile.velocity.Y - 0.2f; - if (Projectile.velocity.Y < -7f) - Projectile.velocity.Y = -7f; + Projectile.velocity.Y -= maxAcceleration * 0.5f; + if (Projectile.velocity.Y < -maxVelocity.Y) + Projectile.velocity.Y = -maxVelocity.Y; } else if (Projectile.ai[0] == 1f) { - if (Main.player[(int)Projectile.ai[1]].Center.Y > Projectile.Center.Y + 90f) + if (Main.player[(int)Projectile.ai[1]].Center.Y > Projectile.Center.Y + distanceAboveTargetBeforeHomingDownward) { Projectile.ai[0] = 2f; Projectile.netUpdate = true; } - Projectile.velocity.X = Projectile.velocity.RotatedBy(0.0, default).X; - Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -6f, 6f); + Projectile.velocity.X = Projectile.velocity.RotatedBy(0D).X; + Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -maxVelocity.X, maxVelocity.X); - Projectile.velocity.Y = Projectile.velocity.Y - 0.08f; + Projectile.velocity.Y -= maxAcceleration * 0.2f; if (Projectile.velocity.Y > 0f) - Projectile.velocity.Y = Projectile.velocity.Y - 0.2f; - if (Projectile.velocity.Y < -7f) - Projectile.velocity.Y = -7f; + Projectile.velocity.Y -= maxAcceleration * 0.5f; + if (Projectile.velocity.Y < -maxVelocity.Y) + Projectile.velocity.Y = -maxVelocity.Y; } else if (Projectile.ai[0] == 2f) { if (Main.player[(int)Projectile.ai[1]].Center.Y < Projectile.Center.Y) Projectile.tileCollide = true; - float speed = revenge ? 9f : 7.5f; - Vector2 playerDistance = Main.player[(int)Projectile.ai[1]].Center - Projectile.Center; - if (playerDistance.Length() < 20f) + if (playerDistance.Length() < explodeDistance) { Projectile.Kill(); return; } - playerDistance.Normalize(); - playerDistance *= 14f; - playerDistance = Vector2.Lerp(Projectile.velocity, playerDistance, 0.6f); - if (playerDistance.Y < speed) - playerDistance.Y = speed; + Vector2 projectileVelocity = playerDistance.SafeNormalize(Vector2.UnitY); + projectileVelocity *= maxVelocity.Length(); + projectileVelocity = Vector2.Lerp(Projectile.velocity, projectileVelocity, 0.6f); + if (projectileVelocity.Y < maxVelocity.Y) + projectileVelocity.Y = maxVelocity.Y; - float projVelocityMult = 0.4f; - if (Projectile.velocity.X < playerDistance.X) + if (Projectile.velocity.X < projectileVelocity.X) { - Projectile.velocity.X = Projectile.velocity.X + projVelocityMult; - if (Projectile.velocity.X < 0f && playerDistance.X > 0f) - Projectile.velocity.X = Projectile.velocity.X + projVelocityMult; + Projectile.velocity.X += maxAcceleration; + if (Projectile.velocity.X < 0f && projectileVelocity.X > 0f) + Projectile.velocity.X += maxAcceleration; } - else if (Projectile.velocity.X > playerDistance.X) + else if (Projectile.velocity.X > projectileVelocity.X) { - Projectile.velocity.X = Projectile.velocity.X - projVelocityMult; - if (Projectile.velocity.X > 0f && playerDistance.X < 0f) - Projectile.velocity.X = Projectile.velocity.X - projVelocityMult; + Projectile.velocity.X -= maxAcceleration; + if (Projectile.velocity.X > 0f && projectileVelocity.X < 0f) + Projectile.velocity.X -= maxAcceleration; } - if (Projectile.velocity.Y < playerDistance.Y) + if (Projectile.velocity.Y < projectileVelocity.Y) { - Projectile.velocity.Y = Projectile.velocity.Y + projVelocityMult; - if (Projectile.velocity.Y < 0f && playerDistance.Y > 0f) - Projectile.velocity.Y = Projectile.velocity.Y + projVelocityMult; + Projectile.velocity.Y += maxAcceleration; + if (Projectile.velocity.Y < 0f && projectileVelocity.Y > 0f) + Projectile.velocity.Y += maxAcceleration; } - else if (Projectile.velocity.Y > playerDistance.Y) + else if (Projectile.velocity.Y > projectileVelocity.Y) { - Projectile.velocity.Y = Projectile.velocity.Y - projVelocityMult; - if (Projectile.velocity.Y > 0f && playerDistance.Y < 0f) - Projectile.velocity.Y = Projectile.velocity.Y - projVelocityMult; + Projectile.velocity.Y -= maxAcceleration; + if (Projectile.velocity.Y > 0f && projectileVelocity.Y < 0f) + Projectile.velocity.Y -= maxAcceleration; + } + + // Fly away from other lasers + float pushForce = death ? 0.12f : 0.08f; + float pushDistance = death ? 80f : 40f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + // Short circuits to make the loop as fast as possible + if (!otherProj.active || k == Projectile.whoAmI) + continue; + + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. + bool sameProjType = otherProj.type == Projectile.type; + float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center); + if (sameProjType && taxicabDist < pushDistance) + { + if (Projectile.position.X < otherProj.position.X) + Projectile.velocity.X -= pushForce; + else + Projectile.velocity.X += pushForce; + + if (Projectile.position.Y < otherProj.position.Y) + Projectile.velocity.Y -= pushForce; + else + Projectile.velocity.Y += pushForce; + } } } } @@ -171,10 +202,7 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(BuffID.OnFire, 180); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 50, 50, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(255, 50, 50, Projectile.alpha); public override bool PreDraw(ref Color lightColor) { @@ -186,23 +214,22 @@ namespace CalamityMod.Projectiles.Boss { SoundEngine.PlaySound(SoundID.Zombie103, Projectile.Center); Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 64; + Projectile.width = Projectile.height = 96; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - for (int i = 0; i < 2; i++) + + for (int i = 0; i < 3; i++) + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); + + for (int j = 0; j < 30; j++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); - } - for (int j = 0; j < 20; j++) - { - int killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 0, default, 2.5f); + int killDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 0, default, 2.5f); Main.dust[killDust].noGravity = true; Main.dust[killDust].velocity *= 3f; - killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1.5f); + killDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1.5f); Main.dust[killDust].velocity *= 2f; Main.dust[killDust].noGravity = true; } - Projectile.Damage(); } } } diff --git a/Projectiles/Boss/ShadowflameFireball.cs b/Projectiles/Boss/ShadowflameFireball.cs index 143ef920ca..9be6aa59a8 100644 --- a/Projectiles/Boss/ShadowflameFireball.cs +++ b/Projectiles/Boss/ShadowflameFireball.cs @@ -64,12 +64,13 @@ namespace CalamityMod.Projectiles.Boss Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 60f) { - if (Projectile.ai[0] < (eaterOfWorlds ? 120f : 240f)) + if (Projectile.ai[0] < (eaterOfWorlds ? 180f : 240f)) { + float inertia = eaterOfWorlds ? 30f : 25f; float scaleFactor = Projectile.velocity.Length(); playerDirection.Normalize(); playerDirection *= scaleFactor; - Projectile.velocity = (Projectile.velocity * 24f + playerDirection) / 25f; + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + playerDirection) / inertia; Projectile.velocity.Normalize(); Projectile.velocity *= scaleFactor; } @@ -87,7 +88,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 180, true); + target.AddBuff(ModContent.BuffType(), 120, true); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Boss/Shadowflamethrower.cs b/Projectiles/Boss/Shadowflamethrower.cs index 532eab0205..6221002bca 100644 --- a/Projectiles/Boss/Shadowflamethrower.cs +++ b/Projectiles/Boss/Shadowflamethrower.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 300, true); + target.AddBuff(ModContent.BuffType(), 120, true); } } } diff --git a/Projectiles/Boss/SupremeCataclysmFist.cs b/Projectiles/Boss/SupremeCataclysmFist.cs index 85d0829417..34cb090d9b 100644 --- a/Projectiles/Boss/SupremeCataclysmFist.cs +++ b/Projectiles/Boss/SupremeCataclysmFist.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0 || Projectile.Opacity != 1f) return; - target.AddBuff(ModContent.BuffType(), 120, true); + target.AddBuff(ModContent.BuffType(), 240, true); } } } diff --git a/Projectiles/Boss/SupremeCatastropheSlash.cs b/Projectiles/Boss/SupremeCatastropheSlash.cs index 2a53379e3a..66bdb11b42 100644 --- a/Projectiles/Boss/SupremeCatastropheSlash.cs +++ b/Projectiles/Boss/SupremeCatastropheSlash.cs @@ -77,8 +77,6 @@ namespace CalamityMod.Projectiles.Boss { if (info.Damage <= 0 || Projectile.Opacity != 1f) return; - - target.AddBuff(ModContent.BuffType(), 120, true); } } } diff --git a/Projectiles/Boss/THanosSideLaser.cs b/Projectiles/Boss/THanosSideLaser.cs index 1837d7f5c1..d5b1b1c2bc 100644 --- a/Projectiles/Boss/THanosSideLaser.cs +++ b/Projectiles/Boss/THanosSideLaser.cs @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0 || TelegraphDelay <= TelegraphTotalTime) return; - target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(ModContent.BuffType(), 120); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Boss/ThornBallSpike.cs b/Projectiles/Boss/ThornBallSpike.cs index 1400c97ee5..05af95024a 100644 --- a/Projectiles/Boss/ThornBallSpike.cs +++ b/Projectiles/Boss/ThornBallSpike.cs @@ -2,6 +2,7 @@ using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +11,9 @@ namespace CalamityMod.Projectiles.Boss public class ThornBallSpike : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + private const float MaxVelocity = 12f; + private const int TimeLeft = 600; public override void SetStaticDefaults() @@ -26,31 +29,64 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.penetrate = 1; Projectile.timeLeft = TimeLeft; + Projectile.tileCollide = false; } public override void AI() { if (Projectile.velocity.Length() < MaxVelocity) { - Projectile.velocity *= 1.035f; + Projectile.velocity *= 1.05f; if (Projectile.velocity.Length() > MaxVelocity) { Projectile.velocity.Normalize(); Projectile.velocity *= MaxVelocity; } } + else + Projectile.tileCollide = true; + + int dustType = DustID.Venom; + int dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= -0.25f; + Main.dust[dust].fadeIn = 1.5f; Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; } - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Poisoned, 90); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Venom, 90); public override bool PreDraw(ref Color lightColor) { - lightColor = Color.White; - lightColor.A = (byte)Projectile.alpha; + if (Projectile.timeLeft > TimeLeft - 5) + return false; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + + for (int i = 2; i < 16; i++) + { + float oldXVel = Projectile.oldVelocity.X * (15f / (float)i); + float oldYVel = Projectile.oldVelocity.Y * (15f / (float)i); + + float dustScale = 1.4f; + int dustType = DustID.Venom; + int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 1.5f; + + dustScale = 1.2f; + dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; + Main.dust[dust].fadeIn = 1.5f; + } + } } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 53751d964b..4806b351bb 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -11,7 +11,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; using CalamityMod.Particles; -using CalamityMod.Projectiles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; @@ -19,6 +18,8 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Projectiles.VanillaProjectileOverrides; +using CalamityMod.Tiles.FurnitureAuric; +using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -48,6 +49,9 @@ namespace CalamityMod.Projectiles // Source variables. public bool CreatedByPlayerDash = false; + // Speed cap for accelerating boss laser projectiles with 2 extraUpdates. + public const float AcceleratingBossLaserVelocityCap = 10f; + // Damage Adjusters public const float PierceResistHarshness = 0.12f; public const float PierceResistCap = 0.8f; @@ -94,6 +98,14 @@ namespace CalamityMod.Projectiles public const int DefaultPointBlankDuration = 18; // 18 frames public const float PointBlankShotDistanceLimit = 240f; // 15 tiles + // Empress of Light variables + private const float EmpressRainbowStreakSpreadOutCutoff = 140f; + private const int EmpressLastingRainbowTotalDuration = 660; + + // Duke Fishron variables + private const int FishronSharknadoTotalDuration = 540; + private const int FishronCthulhunadoTotalDuration = 840; + // Temporary flat damage reduction effects. This is typically used for parry effects such as Ark of the Ancients public int flatDRTimer = 0; /// @@ -276,8 +288,9 @@ namespace CalamityMod.Projectiles bool fromRevSkeletron = projectile.ai[0] < 0f; bool revSkeletronHomingSkull = projectile.ai[0] == -1f; bool revSkeletronAcceleratingSkull = projectile.ai[0] == -2f; + bool revSkeletronPrimeHomingSkull = projectile.ai[0] == -3f; - if (revSkeletronHomingSkull) + if (revSkeletronHomingSkull || revSkeletronPrimeHomingSkull) projectile.alpha = 0; if (projectile.alpha > 0) @@ -306,7 +319,7 @@ namespace CalamityMod.Projectiles } } - if (!revSkeletronHomingSkull) + if (!revSkeletronHomingSkull && !revSkeletronPrimeHomingSkull) { int numDust = revSkeletronAcceleratingSkull ? 1 : 2; int dustType = revSkeletronAcceleratingSkull ? 91 : 6; @@ -334,8 +347,10 @@ namespace CalamityMod.Projectiles int num133 = 0; num133 = Player.FindClosest(projectile.Center, 1, 1); projectile.ai[1] += 1f; - float homingStartTime = 30f; - float homingEndTime = (Main.masterMode || BossRushEvent.BossRushActive) ? 115f : CalamityWorld.death ? 90f : 75f; + float homingStartTime = revSkeletronPrimeHomingSkull ? 10f : 30f; + float homingEndTime = (Main.masterMode || BossRushEvent.BossRushActive) ? 150f : CalamityWorld.death ? 105f : 90f; + if (revSkeletronPrimeHomingSkull) + homingEndTime += 60f; // Stop homing when within a certain distance of the target if (Vector2.Distance(projectile.Center, Main.player[num133].Center) < 80f && projectile.ai[1] < homingEndTime) @@ -347,7 +362,7 @@ namespace CalamityMod.Projectiles Vector2 vector24 = Main.player[num133].Center - projectile.Center; vector24.Normalize(); vector24 *= num134; - float inertia = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 25f : 30f; + float inertia = (CalamityWorld.death || BossRushEvent.BossRushActive) ? (revSkeletronPrimeHomingSkull ? 20f : 25f) : (revSkeletronPrimeHomingSkull ? 25f : 30f); projectile.velocity = (projectile.velocity * (inertia - 1f) + vector24) / inertia; projectile.velocity.Normalize(); projectile.velocity *= num134; @@ -465,7 +480,7 @@ namespace CalamityMod.Projectiles } // This has 2 extra updates, dust was reduced because of this fact - else if (projectile.type == ProjectileID.Shadowflames) + else if (projectile.type == ProjectileID.Shadowflames && projectile.ai[1] == 1f) { float spawnDustGateValue = 2f * projectile.MaxUpdates; if (projectile.localAI[0] == spawnDustGateValue) @@ -502,6 +517,11 @@ namespace CalamityMod.Projectiles { if (projectile.localAI[0] == 0f) { + if (Main.masterMode && !CalamityPlayer.areThereAnyDamnBosses) + projectile.damage = (int)Math.Round(projectile.damage * CalamityGlobalNPC.MasterModeEnemyDamageMultiplier); + if (!CalamityPlayer.areThereAnyDamnBosses) + projectile.damage = (int)Math.Round(projectile.damage * 0.65); + SoundEngine.PlaySound(SoundID.Item17, projectile.Center); projectile.localAI[0] = 1f; for (int i = 0; i < 8; i++) @@ -530,6 +550,11 @@ namespace CalamityMod.Projectiles { if (projectile.localAI[0] == 0f) { + if (Main.masterMode && !CalamityPlayer.areThereAnyDamnBosses) + projectile.damage = (int)Math.Round(projectile.damage * CalamityGlobalNPC.MasterModeEnemyDamageMultiplier); + if (!CalamityPlayer.areThereAnyDamnBosses) + projectile.damage = (int)Math.Round(projectile.damage * 0.65); + SoundEngine.PlaySound(SoundID.Item171, projectile.Center); projectile.localAI[0] = 1f; for (int i = 0; i < 8; i++) @@ -599,6 +624,52 @@ namespace CalamityMod.Projectiles return false; } + else if (projectile.type == ProjectileID.EyeLaser && projectile.ai[0] == 1f) + { + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.3f / 255f, 0f, (255 - projectile.alpha) * 0.3f / 255f); + + if (projectile.alpha > 0) + projectile.alpha -= 125; + if (projectile.alpha < 0) + projectile.alpha = 0; + + if (projectile.localAI[1] == 0f) + { + SoundEngine.PlaySound(SoundID.Item33, projectile.Center); + projectile.localAI[1] = 1f; + } + + if (projectile.velocity.Length() < AcceleratingBossLaserVelocityCap) + projectile.velocity *= 1.0025f; + + return false; + } + + else if (projectile.type == ProjectileID.DeathLaser && projectile.ai[0] == 1f) + { + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, 0f, 0f); + + if (projectile.alpha > 0) + projectile.alpha -= 125; + if (projectile.alpha < 0) + projectile.alpha = 0; + + if (projectile.localAI[1] == 0f) + { + SoundEngine.PlaySound(SoundID.Item33, projectile.Center); + projectile.localAI[1] = 1f; + } + + if (projectile.velocity.Length() < AcceleratingBossLaserVelocityCap) + projectile.velocity *= 1.0025f; + + return false; + } + else if (projectile.type == ProjectileID.DD2OgreSmash || projectile.type == ProjectileID.QueenSlimeSmash) { float maxHitboxSize = 30f; @@ -606,6 +677,13 @@ namespace CalamityMod.Projectiles maxHitboxSize = 20f; projectile.ai[0] += 1f; + if (projectile.ai[0] <= 0f) + { + if (projectile.ai[0] == 0f) + SoundEngine.PlaySound(SoundID.Item167, projectile.Center); + + return false; + } if (projectile.ai[0] > 9f) { projectile.Kill(); @@ -770,9 +848,39 @@ namespace CalamityMod.Projectiles // Phase 1 sharknado else if (projectile.type == ProjectileID.SharknadoBolt) { - if (projectile.ai[1] < 0f) + if (projectile.ai[1] == 0f) { - float num623 = 0.209439516f; + float num552 = (float)Math.PI / 15f; + float num553 = 4f; + float num554 = (float)(Math.Cos(num552 * projectile.ai[0]) - 0.5) * num553; + projectile.velocity.Y -= num554; + projectile.ai[0]++; + num554 = (float)(Math.Cos(num552 * projectile.ai[0]) - 0.5) * num553; + projectile.velocity.Y += num554; + projectile.localAI[0]++; + if (projectile.localAI[0] > 10f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + projectile.alpha = 100; + + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + } + + if (projectile.wet) + { + projectile.position.Y -= 16f; + projectile.Kill(); + } + + return false; + } + else if (projectile.ai[1] < 0f) + { + projectile.timeLeft -= 2; + + float num623 = (float)Math.PI / 15f; float num624 = -2f; float num625 = (float)(Math.Cos(num623 * projectile.ai[0]) - 0.5) * num624; @@ -795,6 +903,12 @@ namespace CalamityMod.Projectiles projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; } + if (projectile.wet) + { + projectile.position.Y -= 16f; + projectile.Kill(); + } + return false; } } @@ -811,11 +925,13 @@ namespace CalamityMod.Projectiles if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { + bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; + int num606 = 16; int num607 = 16; - float num608 = 2f; - int num609 = 150; - int num610 = 42; + float segmentScale = masterMode ? 2.5f : 2f; + int segmentWidth = 150; + int segmentHeight = 42; if (projectile.velocity.X != 0f) projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); @@ -836,9 +952,9 @@ namespace CalamityMod.Projectiles projectile.localAI[0] = 1f; projectile.position.X += projectile.width / 2; projectile.position.Y += projectile.height / 2; - projectile.scale = (num606 + num607 - projectile.ai[1]) * num608 / (num607 + num606); - projectile.width = (int)(num609 * projectile.scale); - projectile.height = (int)(num610 * projectile.scale); + projectile.scale = (num606 + num607 - projectile.ai[1]) * segmentScale / (num607 + num606); + projectile.width = (int)(segmentWidth * projectile.scale); + projectile.height = (int)(segmentHeight * projectile.scale); projectile.position.X -= projectile.width / 2; projectile.position.Y -= projectile.height / 2; projectile.netUpdate = true; @@ -846,9 +962,9 @@ namespace CalamityMod.Projectiles if (projectile.ai[1] != -1f) { - projectile.scale = (num606 + num607 - projectile.ai[1]) * num608 / (num607 + num606); - projectile.width = (int)(num609 * projectile.scale); - projectile.height = (int)(num610 * projectile.scale); + projectile.scale = (num606 + num607 - projectile.ai[1]) * segmentScale / (num607 + num606); + projectile.width = (int)(segmentWidth * projectile.scale); + projectile.height = (int)(segmentHeight * projectile.scale); } if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) @@ -874,50 +990,111 @@ namespace CalamityMod.Projectiles projectile.netUpdate = true; Vector2 center = projectile.Center; - center.Y -= num610 * projectile.scale / 2f; + center.Y -= segmentHeight * projectile.scale / 2f; - float num611 = (num606 + num607 - projectile.ai[1] + 1f) * num608 / (num607 + num606); - center.Y -= num610 * num611 / 2f; + float num611 = (num606 + num607 - projectile.ai[1] + 1f) * segmentScale / (num607 + num606); + center.Y -= segmentHeight * num611 / 2f; center.Y += 2f; - Projectile.NewProjectile(projectile.GetSource_FromThis(), center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); + float segmentSpawnDelay = 10f; + Projectile.NewProjectile(projectile.GetSource_FromThis(), center, projectile.velocity, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, segmentSpawnDelay, projectile.ai[1] - 1f); - if ((int)projectile.ai[1] % 3 == 0 && projectile.ai[1] != 0f) + int sharkronSpawnGateValue = masterMode ? 2 : 3; + if ((int)projectile.ai[1] % sharkronSpawnGateValue == 0 && projectile.ai[1] != 0f) { - int num614 = NPC.NewNPC(projectile.GetSource_FromAI(), (int)center.X, (int)center.Y, NPCID.Sharkron2); - Main.npc[num614].velocity = projectile.velocity; - Main.npc[num614].scale = 1.5f; - Main.npc[num614].netUpdate = true; - Main.npc[num614].ai[2] = projectile.width; - Main.npc[num614].ai[3] = -1.5f; + int sharkron = NPC.NewNPC(projectile.GetSource_FromAI(), (int)center.X, (int)center.Y, NPCID.Sharkron2); + Main.npc[sharkron].velocity = projectile.velocity; + Main.npc[sharkron].scale = masterMode ? 2f : 1.5f; + Main.npc[sharkron].netUpdate = true; + Main.npc[sharkron].ai[2] = projectile.width; + Main.npc[sharkron].ai[3] = -1.5f; } } if (projectile.ai[0] <= 0f) { - float num615 = 0.104719758f; - float num616 = projectile.width / 5f * 2.5f; - float num617 = (float)(Math.Cos(num615 * -(double)projectile.ai[0]) - 0.5) * num616; + float swayAmount = MathHelper.Pi / 30f; + float widthSwayScale = projectile.width / 5f * 2.5f; + float sway = (float)(Math.Cos(swayAmount * -(double)projectile.ai[0]) - 0.5) * widthSwayScale; - projectile.position.X -= num617 * -projectile.direction; + projectile.position.X -= sway * -projectile.direction; projectile.ai[0] -= 1f; - num617 = (float)(Math.Cos(num615 * -(double)projectile.ai[0]) - 0.5) * num616; - projectile.position.X += num617 * -projectile.direction; + sway = (float)(Math.Cos(swayAmount * -(double)projectile.ai[0]) - 0.5) * widthSwayScale; + projectile.position.X += sway * -projectile.direction; } return false; } } + else if (projectile.type == ProjectileID.HallowBossRainbowStreak && projectile.hostile) + { + bool revMasterMode = (Main.masterMode && CalamityWorld.revenge) || BossRushEvent.BossRushActive; + + bool spreadOut = false; + bool homeIn = false; + float spreadOutCutoffTime = EmpressRainbowStreakSpreadOutCutoff; + float homeInCutoffTime = Main.dayTime ? (revMasterMode ? 55f : 65f) : (revMasterMode ? 70f : 80f); + float spreadDeceleration = 0.97f; + float minAcceleration = revMasterMode ? 0.075f : 0.05f; + float maxAcceleration = revMasterMode ? 0.15f : 0.1f; + float homingVelocity = revMasterMode ? 36f : 30f; + float maxVelocity = homingVelocity * 1.5f; + float accelerationToMaxVelocity = 1.01f; + + if (projectile.timeLeft > spreadOutCutoffTime) + spreadOut = true; + else if (projectile.timeLeft > homeInCutoffTime) + homeIn = true; + + if (spreadOut) + { + float spreadVelocity = (float)Math.Cos(projectile.whoAmI % 6f / 6f + projectile.position.X / 320f + projectile.position.Y / 160f); + projectile.velocity *= spreadDeceleration; + projectile.velocity = projectile.velocity.RotatedBy(spreadVelocity * MathHelper.TwoPi * 0.125f * 1f / 30f); + } + + if (homeIn) + { + int playerIndex = (int)projectile.ai[0]; + Vector2 velocity = projectile.velocity; + if (Main.player.IndexInRange(playerIndex)) + { + Player player = Main.player[playerIndex]; + velocity = projectile.DirectionTo(player.Center) * homingVelocity; + } + + float amount = MathHelper.Lerp(minAcceleration, maxAcceleration, Utils.GetLerpValue(spreadOutCutoffTime, 30f, projectile.timeLeft, clamped: true)); + projectile.velocity = Vector2.SmoothStep(projectile.velocity, velocity, amount); + } + else + { + if (projectile.velocity.Length() < maxVelocity) + { + projectile.velocity *= accelerationToMaxVelocity; + if (projectile.velocity.Length() > maxVelocity) + { + projectile.velocity.Normalize(); + projectile.velocity *= maxVelocity; + } + } + } + + projectile.Opacity = Utils.GetLerpValue(240f, 220f, projectile.timeLeft, clamped: true); + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + + return false; + } + else if (projectile.type == ProjectileID.CultistBossLightningOrb) { if (NPC.AnyNPCs(NPCID.CultistBoss)) { if (projectile.localAI[1] == 0f) { - SoundEngine.PlaySound(SoundID.Item121, projectile.position); + SoundEngine.PlaySound(SoundID.Item121, projectile.Center); projectile.localAI[1] = 1f; } @@ -971,7 +1148,7 @@ namespace CalamityMod.Projectiles for (int num735 = 0; num735 < num731; num735++) { - Vector2 vector52 = array7[num735] + Main.player[array6[num735]].velocity * 40f - projectile.Center; + Vector2 vector52 = array7[num735] - projectile.Center; float ai = Main.rand.Next(100); Vector2 vector53 = Vector2.Normalize(vector52.RotatedByRandom(MathHelper.PiOver4)) * 7f; Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, vector53, 466, projectile.damage, 0f, Main.myPlayer, vector52.ToRotation(), ai); @@ -1038,7 +1215,7 @@ namespace CalamityMod.Projectiles if (projectile.soundDelay == 0) { projectile.soundDelay = 20 + Main.rand.Next(40); - SoundEngine.PlaySound(SoundID.Item9, projectile.position); + SoundEngine.PlaySound(SoundID.Item9, projectile.Center); } if (projectile.localAI[0] == 0f) @@ -1184,6 +1361,277 @@ namespace CalamityMod.Projectiles return false; } + else if (projectile.type == ProjectileID.TrueNightsEdge) + { + float fadeInTime = 50f; + float fadeOutTime = 15f; + float timeBeforeFadeOut = projectile.ai[1] + fadeInTime; + float projectileDuration = timeBeforeFadeOut + fadeOutTime; + float stopDealingDamageTime = 80f; + + if (projectile.localAI[0] == 0f) + SoundEngine.PlaySound(SoundID.Item8, projectile.Center); + + projectile.localAI[0] += 1f; + if (projectile.damage == 0 && projectile.localAI[0] < MathHelper.Lerp(timeBeforeFadeOut, projectileDuration, 0.5f)) + projectile.localAI[0] += 6f; + + projectile.Opacity = Utils.Remap(projectile.localAI[0], 0f, projectile.ai[1], 0f, 1f) * Utils.Remap(projectile.localAI[0], timeBeforeFadeOut, projectileDuration, 1f, 0f); + if (projectile.localAI[0] >= projectileDuration) + { + projectile.localAI[1] = 1f; + projectile.Kill(); + return false; + } + + Player player = Main.player[projectile.owner]; + float fromValue = projectile.localAI[0] / projectile.ai[1]; + projectile.direction = (projectile.spriteDirection = (int)projectile.ai[0]); + + if (projectile.damage != 0 && projectile.localAI[0] >= stopDealingDamageTime) + projectile.damage = 0; + + if (projectile.damage != 0) + { + int size = 80; + bool notInsideTiles = false; + float rotation = projectile.velocity.ToRotation(); + for (float i = -1f; i <= 1f; i += 0.5f) + { + Vector2 position = projectile.Center + (rotation + i * MathHelper.PiOver4 * 0.25f).ToRotationVector2() * size * 0.5f * projectile.scale; + Vector2 position2 = projectile.Center + (rotation + i * MathHelper.PiOver4 * 0.25f).ToRotationVector2() * size * projectile.scale; + if (!Collision.SolidTiles(projectile.Center, 0, 0) && Collision.CanHit(position, 0, 0, position2, 0, 0)) + { + notInsideTiles = true; + break; + } + } + + if (!notInsideTiles) + projectile.damage = 0; + } + + fromValue = projectile.localAI[0] / projectile.ai[1]; + projectile.localAI[1] += 1f; + projectile.rotation += projectile.ai[0] * MathHelper.TwoPi * (4f + projectile.Opacity * 4f) / 90f; + projectile.scale = Utils.Remap(projectile.localAI[0], projectile.ai[1] + 2f, projectileDuration, 1.12f, 1f) * projectile.ai[2]; + float randomDustSpawnLocation = projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; + Vector2 dustPosition = projectile.Center + randomDustSpawnLocation.ToRotationVector2() * 84f * projectile.scale; + if (Main.rand.NextBool(5)) + { + Dust dust = Dust.NewDustPerfect(dustPosition, 14, null, 150, default, 1.4f); + dust.noLight = (dust.noLightEmittence = true); + } + + for (int i = 0; (float)i < 3f * projectile.Opacity; i++) + { + Vector2 dustVelocity = projectile.velocity.SafeNormalize(Vector2.UnitX); + int dustType = ((Main.rand.NextFloat() < projectile.Opacity) ? 75 : 27); + Dust dust = Dust.NewDustPerfect(dustPosition, dustType, projectile.velocity * 0.2f + dustVelocity * 3f, 100, default, 1.4f); + dust.noGravity = true; + dust.customData = projectile.Opacity * 0.2f; + } + + return false; + } + + else if (projectile.type == ProjectileID.ChlorophyteBullet) + { + if (projectile.alpha < 170) + { + int totalDust = 5; + for (int i = 0; i < totalDust; i++) + { + float x2 = projectile.position.X - projectile.velocity.X / (float)totalDust * (float)i; + float y2 = projectile.position.Y - projectile.velocity.Y / (float)totalDust * (float)i; + int dust = Dust.NewDust(new Vector2(x2, y2), 1, 1, 75); + Main.dust[dust].alpha = projectile.alpha; + Main.dust[dust].position.X = x2; + Main.dust[dust].position.Y = y2; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; + } + } + + float velocityLength = (float)Math.Sqrt(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y); + float cachedVelocityLength = projectile.localAI[0]; + if (cachedVelocityLength == 0f) + { + projectile.localAI[0] = velocityLength; + cachedVelocityLength = velocityLength; + } + + if (projectile.alpha > 0) + projectile.alpha -= 25; + + if (projectile.alpha < 0) + projectile.alpha = 0; + + float posX = projectile.position.X; + float posY = projectile.position.Y; + float homingDistance = 300f; + bool homeIn = false; + int target = 0; + if (projectile.ai[1] == 0f) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(this) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(i + 1))) + { + float targetCenterX = Main.npc[i].Center.X; + float targetCenterY = Main.npc[i].Center.Y; + float targetDistance = Math.Abs(projectile.Center.X - targetCenterX) + Math.Abs(projectile.Center.Y - targetCenterY); + if (targetDistance < homingDistance && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height)) + { + homingDistance = targetDistance; + posX = targetCenterX; + posY = targetCenterY; + homeIn = true; + target = i; + } + } + } + + if (homeIn) + projectile.ai[1] = target + 1; + + homeIn = false; + } + + if (projectile.ai[1] > 0f) + { + int targetIndex = (int)(projectile.ai[1] - 1f); + if (Main.npc[targetIndex].active && Main.npc[targetIndex].CanBeChasedBy(this, ignoreDontTakeDamage: true) && !Main.npc[targetIndex].dontTakeDamage) + { + float targetCenterX = Main.npc[targetIndex].Center.X; + float targetCenterY = Main.npc[targetIndex].Center.Y; + float homingCutOffDistance = 1000f; + if (Math.Abs(projectile.Center.X - targetCenterX) + Math.Abs(projectile.Center.Y - targetCenterY) < homingCutOffDistance) + { + homeIn = true; + posX = Main.npc[targetIndex].Center.X; + posY = Main.npc[targetIndex].Center.Y; + } + } + else + projectile.ai[1] = 0f; + } + + if (!projectile.friendly) + homeIn = false; + + if (homeIn) + { + int inertia = 8; + float homingSpeed = cachedVelocityLength; + Vector2 destination = new Vector2(posX, posY); + Vector2 homeDirection = (destination - projectile.Center).SafeNormalize(Vector2.UnitY); + projectile.velocity = (projectile.velocity * inertia + homeDirection * homingSpeed) / (inertia + 1f); + } + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + return false; + } + + // Adjust dust to avoid lag. + else if (projectile.type == ProjectileID.VampireHeal) + { + projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 4f, 15f); + + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.VampireHeal, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += projectile.velocity.Y * 0.2f; + + return false; + } + + // Adjust dust to avoid lag. + else if (projectile.type == ProjectileID.SpectreWrath) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 60f) + { + projectile.friendly = true; + int target = (int)projectile.ai[0]; + if (Main.myPlayer == projectile.owner && (target == -1 || !Main.npc[target].CanBeChasedBy(projectile))) + { + target = -1; + int[] array = new int[Main.maxNPCs]; + int randomTargets = 0; + float homingDistance = 800f; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile)) + { + float distanceFromTarget = Math.Abs(Main.npc[i].Center.X - projectile.Center.X) + Math.Abs(Main.npc[i].Center.Y - projectile.Center.Y); + if (distanceFromTarget < homingDistance) + { + array[randomTargets] = i; + randomTargets++; + } + } + } + + if (randomTargets == 0) + { + projectile.Kill(); + return false; + } + + target = array[Main.rand.Next(randomTargets)]; + projectile.ai[0] = target; + projectile.netUpdate = true; + } + + if (target != -1) + { + int inertia = 30; + float homingSpeed = 4f; + Vector2 homeDirection = (Main.npc[target].Center - projectile.Center).SafeNormalize(Vector2.UnitY); + projectile.velocity = (projectile.velocity * inertia + homeDirection * homingSpeed) / (inertia + 1f); + } + } + + int maxDust = 3; + float dustOffsetMultiplier = 1f / (float)maxDust; + for (int i = 0; i < maxDust; i++) + { + float dustOffsetX = projectile.velocity.X * dustOffsetMultiplier * (float)i; + float dustOffsetY = (0f - projectile.velocity.Y * dustOffsetMultiplier) * (float)i; + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 1.3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= dustOffsetX; + Main.dust[dust].position.Y -= dustOffsetY; + } + + return false; + } + + // Adjust dust to avoid lag. + else if (projectile.type == ProjectileID.SpiritHeal) + { + projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 4f, 15f); + + int maxDust = 3; + float dustOffsetMultiplier = 1f / (float)maxDust; + for (int i = 0; i < maxDust; i++) + { + float dustOffsetX = projectile.velocity.X * dustOffsetMultiplier * (float)i; + float dustOffsetY = (0f - projectile.velocity.Y * dustOffsetMultiplier) * (float)i; + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 1.3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= dustOffsetX; + Main.dust[dust].position.Y -= dustOffsetY; + } + + return false; + } + else if (projectile.type == ProjectileID.NurseSyringeHeal) { ref float initialSpeed = ref projectile.localAI[1]; @@ -1254,7 +1702,7 @@ namespace CalamityMod.Projectiles if (projectile.ai[1] == 0f) { projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item34, projectile.position); + SoundEngine.PlaySound(SoundID.Item34, projectile.Center); } else if (projectile.ai[1] == 1f && Main.netMode != NetmodeID.MultiplayerClient) { @@ -1375,7 +1823,7 @@ namespace CalamityMod.Projectiles if (projectile.localAI[1] == 0f) { projectile.localAI[1] = 1f; - SoundEngine.PlaySound(SoundID.Item120, projectile.position); + SoundEngine.PlaySound(SoundID.Item120, projectile.Center); } projectile.ai[0] += 1f; @@ -1538,6 +1986,16 @@ namespace CalamityMod.Projectiles } } + // Making Rocket Launcher, Grenade Launcher, Proximity Mine Launcher, and Cluster Rocket fragments not damage the player. + bool isGrenadeLauncherProj = (projectile.type == 133 || projectile.type == 136 || projectile.type == 139 || projectile.type == 142 || projectile.type == 777 || projectile.type == 781 || projectile.type == 785 || projectile.type == 788 || projectile.type == 791 || projectile.type == 794 || projectile.type == 797 || projectile.type == 800); + bool isRocketLauncherProj = (projectile.type == 134 || projectile.type == 137 || projectile.type == 140 || projectile.type == 143 || projectile.type == 776 || projectile.type == 780 || projectile.type == 784 || projectile.type == 787 || projectile.type == 790 || projectile.type == 793 || projectile.type == 796 || projectile.type == 799); + bool isProximityMineProj = (projectile.type == 135 || projectile.type == 138 || projectile.type == 141 || projectile.type == 144 || projectile.type == 778 || projectile.type == 782 || projectile.type == 786 || projectile.type == 789 || projectile.type == 792 || projectile.type == 795 || projectile.type == 798 || projectile.type == 801); + + if (isGrenadeLauncherProj || isRocketLauncherProj || isProximityMineProj || projectile.type == ProjectileID.ClusterFragmentsI || projectile.type == ProjectileID.ClusterFragmentsII) + { + ProjectileID.Sets.RocketsSkipDamageForPlayers[projectile.type] = true; + } + if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; @@ -1550,8 +2008,8 @@ namespace CalamityMod.Projectiles int numDust = 5; int numDust2 = 5; int fadeInTime = 10; - int fadeOutGateValue = 10; - float killGateValue = 20f; + int fadeOutGateValue = masterMode ? 80 : death ? 50 : 10; + float killGateValue = masterMode ? 90f : death ? 60f : 20f; int maxFrames = 5; bool fadeIn = projectile.ai[0] < (float)fadeInTime; @@ -1585,6 +2043,9 @@ namespace CalamityMod.Projectiles if (fadeIn) { projectile.Opacity += 0.1f; + if (projectile.Opacity > 1f) + projectile.Opacity = 1f; + projectile.scale = projectile.Opacity * projectile.ai[1]; } @@ -1638,7 +2099,7 @@ namespace CalamityMod.Projectiles if (projectile.ai[0] == projectile.ai[2]) { projectile.velocity *= 100f; - projectile.velocity *= (death ? 16f : 12f) + Main.rand.NextFloat() * 2f; + projectile.velocity *= (masterMode ? 20f : death ? 16f : 12f) + Main.rand.NextFloat() * 2f; } } @@ -1651,7 +2112,7 @@ namespace CalamityMod.Projectiles return true; if (projectile.ai[0] == 0f) - SoundEngine.PlaySound(SoundID.Item8, projectile.position); + SoundEngine.PlaySound(SoundID.Item8, projectile.Center); projectile.rotation += projectile.direction * 0.8f; @@ -1688,29 +2149,6 @@ namespace CalamityMod.Projectiles return false; } - else if (projectile.type == ProjectileID.EyeLaser && projectile.ai[0] == 1f) - { - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; - - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.3f / 255f, 0f, (255 - projectile.alpha) * 0.3f / 255f); - - if (projectile.alpha > 0) - projectile.alpha -= 125; - if (projectile.alpha < 0) - projectile.alpha = 0; - - if (projectile.localAI[1] == 0f) - { - SoundEngine.PlaySound(SoundID.Item33, projectile.position); - projectile.localAI[1] = 1f; - } - - if (projectile.velocity.Length() < 12f) - projectile.velocity *= 1.0025f; - - return false; - } - else if (projectile.type == ProjectileID.QueenSlimeGelAttack) { // Phase 1 and 2 projectiles do not bounce. @@ -1786,29 +2224,6 @@ namespace CalamityMod.Projectiles } } - else if (projectile.type == ProjectileID.DeathLaser && projectile.ai[0] == 1f) - { - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; - - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, 0f, 0f); - - if (projectile.alpha > 0) - projectile.alpha -= 125; - if (projectile.alpha < 0) - projectile.alpha = 0; - - if (projectile.localAI[1] == 0f) - { - SoundEngine.PlaySound(SoundID.Item33, projectile.position); - projectile.localAI[1] = 1f; - } - - if (projectile.velocity.Length() < 12f) - projectile.velocity *= 1.0025f; - - return false; - } - else if (projectile.type == ProjectileID.BombSkeletronPrime && projectile.ai[0] < 0f && masterMode) { int num = (int)(projectile.Center.X / 16f); @@ -1952,11 +2367,11 @@ namespace CalamityMod.Projectiles if (projectile.localAI[1] == 0f) { - SoundEngine.PlaySound(SoundID.Item33, projectile.position); + SoundEngine.PlaySound(SoundID.Item33, projectile.Center); projectile.localAI[1] = 1f; } - if (projectile.velocity.Length() < 12f) + if (projectile.velocity.Length() < AcceleratingBossLaserVelocityCap) projectile.velocity *= 1.0025f; return false; @@ -1964,17 +2379,28 @@ namespace CalamityMod.Projectiles else if (projectile.type == ProjectileID.RocketSkeleton && projectile.ai[1] == 1f) { + bool primeCannonProjectile = projectile.ai[1] == 2f; bool homeIn = false; - float spreadOutCutoffTime = 510f; - float homeInCutoffTime = 420f; - float minAcceleration = masterMode ? 0.1f : 0.05f; - float maxAcceleration = masterMode ? 0.2f : 0.1f; - float homingVelocity = 25f; + float homingTime = masterMode ? 240f : 180f; + float spreadOutCutoffTime = 555f; + float homeInCutoffTime = spreadOutCutoffTime - homingTime; + float minAcceleration = masterMode ? 0.096f : 0.08f; + float maxAcceleration = masterMode ? 0.144f : 0.12f; + float homingVelocity = masterMode ? 30f : 25f; + float maxVelocity = masterMode ? 18f : 15f; - if (projectile.timeLeft > homeInCutoffTime && projectile.timeLeft <= spreadOutCutoffTime) - homeIn = true; - else if (projectile.velocity.Length() < (masterMode ? 20f : 15f)) - projectile.velocity *= 1.1f; + if (!primeCannonProjectile) + { + if (projectile.timeLeft > homeInCutoffTime && projectile.timeLeft <= spreadOutCutoffTime) + homeIn = true; + else if (projectile.velocity.Length() < maxVelocity) + projectile.velocity *= 1.01f; + } + else + { + if (projectile.velocity.Length() < maxVelocity) + projectile.velocity *= 1.01f; + } if (homeIn) { @@ -1992,10 +2418,8 @@ namespace CalamityMod.Projectiles if (projectile.timeLeft <= 3) { - projectile.position.X += projectile.width / 2; - projectile.position.Y += projectile.height / 2; - projectile.width = 128; - projectile.height = 128; + projectile.position = projectile.Center; + projectile.width = projectile.height = 128; projectile.position.X -= projectile.width / 2; projectile.position.Y -= projectile.height / 2; } @@ -2036,6 +2460,14 @@ namespace CalamityMod.Projectiles else if (projectile.type == ProjectileID.SeedPlantera || projectile.type == ProjectileID.PoisonSeedPlantera) { + // For Plantera's shotgun spread. + // Make the seeds faster until they hit the intended velocity to avoid unfair hits after charges. + if (projectile.ai[2] > 0f) + { + if (projectile.velocity.Length() < projectile.ai[2]) + projectile.velocity *= 1.012f; + } + projectile.frameCounter++; if (projectile.frameCounter > 1) { @@ -2049,7 +2481,7 @@ namespace CalamityMod.Projectiles if (projectile.ai[1] == 0f) { projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item17, projectile.position); + SoundEngine.PlaySound(SoundID.Item17, projectile.Center); } if (projectile.alpha > 0) @@ -2107,7 +2539,7 @@ namespace CalamityMod.Projectiles } } - SoundEngine.PlaySound(SoundID.Item17, projectile.position); + SoundEngine.PlaySound(SoundID.Item17, projectile.Center); for (int i = 0; i < 8; i++) { @@ -2160,45 +2592,106 @@ namespace CalamityMod.Projectiles return false; } - else if (projectile.type == ProjectileID.HallowBossRainbowStreak && projectile.hostile) + else if (projectile.type == ProjectileID.InfernoHostileBolt && projectile.ai[2] > 0f) { - bool spreadOut = false; - bool homeIn = false; - float spreadOutCutoffTime = 140f; - float homeInCutoffTime = Main.dayTime ? (masterMode ? 45f : 55f) : (masterMode ? 60f : 80f); - float spreadDeceleration = 0.98f; - float minAcceleration = masterMode ? 0.075f : 0.05f; - float maxAcceleration = masterMode ? 0.125f : 0.1f; - float homingVelocity = masterMode ? 36f : 30f; - - if (projectile.timeLeft > spreadOutCutoffTime) - spreadOut = true; - else if (projectile.timeLeft > homeInCutoffTime) - homeIn = true; - - if (spreadOut) + if (projectile.localAI[0] == 0f) { - float spreadVelocity = (float)Math.Cos(projectile.whoAmI % 6f / 6f + projectile.position.X / 320f + projectile.position.Y / 160f); - projectile.velocity *= spreadDeceleration; - projectile.velocity = projectile.velocity.RotatedBy(spreadVelocity * MathHelper.TwoPi * 0.125f * 1f / 30f); + SoundEngine.PlaySound(SoundID.Item20, projectile.position); + projectile.localAI[0] += 1f; } - if (homeIn) - { - int playerIndex = (int)projectile.ai[0]; - Vector2 velocity = projectile.velocity; - if (Main.player.IndexInRange(playerIndex)) - { - Player player = Main.player[playerIndex]; - velocity = projectile.DirectionTo(player.Center) * homingVelocity; - } + bool killX = false; + bool killY = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + killX = true; - float amount = MathHelper.Lerp(minAcceleration, maxAcceleration, Utils.GetLerpValue(spreadOutCutoffTime, 30f, projectile.timeLeft, clamped: true)); - projectile.velocity = Vector2.SmoothStep(projectile.velocity, velocity, amount); + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + killX = true; + + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + killY = true; + + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + killY = true; + + if (killX && killY) + projectile.Kill(); + + for (int i = 0; i < 10; i++) + { + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.IchorTorch, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1.6f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.3f; + Main.dust[dust].velocity += projectile.velocity * 0.1f; + if (Main.getGoodWorld) + Main.dust[dust].noLight = true; } - projectile.Opacity = Utils.GetLerpValue(240f, 220f, projectile.timeLeft, clamped: true); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Particle theSpark = new AltSparkParticle(projectile.Center, projectile.velocity * 0.06f + projectile.velocity * 0.1f, false, 40, 1f, new Color(255, 255, 100)); + GeneralParticleHandler.SpawnParticle(theSpark); + + return false; + } + + else if (projectile.type == ProjectileID.InfernoHostileBlast && projectile.ai[2] > 0f) + { + if (projectile.localAI[0] == 0f) + { + SoundEngine.PlaySound(SoundID.Item74, projectile.position); + projectile.localAI[0] += 1f; + } + + projectile.ai[0] += 1f; + + float totalDust = 20f; + if (projectile.ai[0] > 540f) + totalDust -= (projectile.ai[0] - 180f) / 2f; + + if (totalDust <= 0f) + { + totalDust = 0f; + projectile.Kill(); + } + + float maxDustVelocityX = 10f; + float maxDustVelocityY = 10f; + float minDustSpeed = 3f; + float maxDustSpeed = 8f; + + for (int i = 0; i < (int)totalDust; i++) + { + float dustVelocityX = Main.rand.NextFloat(-maxDustVelocityX, maxDustVelocityX); + float dustVelocityY = Main.rand.NextFloat(-maxDustVelocityY, maxDustVelocityY); + float randomDustSpeed = Main.rand.NextFloat(minDustSpeed, maxDustSpeed); + float velocityLength = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); + velocityLength = randomDustSpeed / velocityLength; + dustVelocityX *= velocityLength; + dustVelocityY *= velocityLength; + Vector2 dustVelocity = new Vector2(dustVelocityX, dustVelocityY); + Vector2 dustPosition = projectile.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-10f, 10f)); + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.IchorTorch, 0f, 0f, 100, default, 1.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].position = dustPosition; + Main.dust[dust].velocity = dustVelocity; + if (Main.getGoodWorld) + Main.dust[dust].noLight = true; + } + + float maxSparkVelocityX = 10f; + float maxSparkVelocityY = 10f; + float minSparkSpeed = 3f; + float maxSparkSpeed = 7f; + + float sparkVelocityX = Main.rand.NextFloat(-maxSparkVelocityX, maxSparkVelocityX); + float sparkVelocityY = Main.rand.NextFloat(-maxSparkVelocityY, maxSparkVelocityY); + float randSparkSpeed = Main.rand.NextFloat(minSparkSpeed, maxSparkSpeed); + float sparkLength = (float)Math.Sqrt(sparkVelocityX * sparkVelocityX + sparkVelocityY * sparkVelocityY); + sparkLength = randSparkSpeed / sparkLength; + sparkVelocityX *= sparkLength; + sparkVelocityY *= sparkLength; + + Particle theSpark = new AltSparkParticle(projectile.Center, new Vector2(sparkVelocityX, sparkVelocityY), false, 40, 1f, new Color(255, 255, 100)); + GeneralParticleHandler.SpawnParticle(theSpark); return false; } @@ -2214,7 +2707,7 @@ namespace CalamityMod.Projectiles if (projectile.localAI[1] == 0f) { projectile.localAI[1] = 1f; - SoundEngine.PlaySound(SoundID.Item120, projectile.position); + SoundEngine.PlaySound(SoundID.Item120, projectile.Center); } projectile.ai[0] += 1f; @@ -2508,7 +3001,7 @@ namespace CalamityMod.Projectiles projectile.velocity = -Vector2.UnitY; if (projectile.localAI[0] == 0f) - SoundEngine.PlaySound(SoundID.Zombie104, projectile.position); + SoundEngine.PlaySound(SoundID.Zombie104, projectile.Center); float num801 = 1f; projectile.localAI[0] += 1f; @@ -2599,10 +3092,6 @@ namespace CalamityMod.Projectiles { if (projectile.hostile) { - // These projectiles are way too fucking fast so they need to be slower - if ((projectile.type == ProjectileID.QueenSlimeMinionBlueSpike && projectile.ai[1] >= 0f) || projectile.type == ProjectileID.QueenSlimeMinionPinkBall) - projectile.velocity *= 0.5f; - // Reduce Nail damage from Nailheads because they're stupid if (projectile.type == ProjectileID.Nail && Main.expertMode) projectile.damage /= 2; @@ -2630,9 +3119,7 @@ namespace CalamityMod.Projectiles case ProjectileID.FrostBeam: case ProjectileID.CursedFlameHostile: case ProjectileID.Stinger: - case ProjectileID.BloodShot: case ProjectileID.BloodNautilusTears: - case ProjectileID.BloodNautilusShot: case ProjectileID.RockGolemRock: case ProjectileID.IcewaterSpit: case ProjectileID.RocketSkeleton: @@ -2684,6 +3171,17 @@ namespace CalamityMod.Projectiles case ProjectileID.SaucerLaser: case ProjectileID.SaucerMissile: case ProjectileID.SaucerScrap: + case ProjectileID.DD2GoblinBomb: + case ProjectileID.DD2JavelinHostile: + case ProjectileID.DD2JavelinHostileT3: + case ProjectileID.DD2DarkMageBolt: + case ProjectileID.DD2DrakinShot: + case ProjectileID.DD2OgreSmash: + case ProjectileID.DD2OgreSpit: + case ProjectileID.DD2OgreStomp: + case ProjectileID.DD2LightningBugZap: + case ProjectileID.DD2BetsyFireball: + case ProjectileID.DD2BetsyFlameBreath: projectile.damage = (int)Math.Round(projectile.damage * CalamityGlobalNPC.MasterModeEnemyDamageMultiplier); break; } @@ -2706,9 +3204,7 @@ namespace CalamityMod.Projectiles case ProjectileID.FrostBeam: case ProjectileID.CursedFlameHostile: case ProjectileID.Stinger: - case ProjectileID.BloodShot: case ProjectileID.BloodNautilusTears: - case ProjectileID.BloodNautilusShot: case ProjectileID.RockGolemRock: case ProjectileID.IcewaterSpit: case ProjectileID.RocketSkeleton: @@ -2748,10 +3244,10 @@ namespace CalamityMod.Projectiles if (CalamityLists.dungeonProjectileBuffList.Contains(projectile.type)) { // ai[1] being set to 1 is done only by the Calamity usages of these projectiles in Skeletron and Skeletron Prime boss fights - bool isSkeletronBossProjectile = (projectile.type == ProjectileID.RocketSkeleton || projectile.type == ProjectileID.Shadowflames) && projectile.ai[1] == 1f; + bool isSkeletronBossProjectile = (projectile.type == ProjectileID.RocketSkeleton || projectile.type == ProjectileID.Shadowflames) && projectile.ai[1] > 0f; - // These projectiles will not be buffed if Golem is alive - bool isGolemBossProjectile = NPC.golemBoss > 0 && (projectile.type == ProjectileID.InfernoHostileBolt || projectile.type == ProjectileID.InfernoHostileBlast); + // These projectiles will not be buffed if Golem fires them + bool isGolemBossProjectile = (projectile.type == ProjectileID.InfernoHostileBolt || projectile.type == ProjectileID.InfernoHostileBlast) && projectile.ai[2] > 0f; if (!isSkeletronBossProjectile && !isGolemBossProjectile) projectile.damage += 30; @@ -2847,10 +3343,79 @@ namespace CalamityMod.Projectiles // Accelerate for 1.5 seconds to full velocity if (projectile.type == ProjectileID.HallowBossLastingRainbow && (CalamityWorld.revenge || BossRushEvent.BossRushActive)) { - if (projectile.timeLeft > 570) + int spreadOutTime = 90; + if (projectile.timeLeft > EmpressLastingRainbowTotalDuration - spreadOutTime) projectile.velocity *= ((Main.masterMode || BossRushEvent.BossRushActive) ? 1.017078f : 1.015525f); } + // Golf Balls go nyoom on touching Auric Ore/Repulsers + if (ProjectileID.Sets.IsAGolfBall[projectile.type]) + { + int auricOreID = TileType(); + int auricRepulserID = TileType(); + // Get a list of tiles that are colliding with the ball. + // This is just Collision.GetEntityTiles but with a larger detection square because golf balls are too small and dumb to get detected half the time apparently + List EdgeTiles = new List(); + int extraDist = 8; + int left = (int)projectile.position.X - extraDist; + int up = (int)projectile.position.Y - extraDist; + int right = (int)projectile.Right.X + extraDist; + int down = (int)projectile.Bottom.Y + extraDist; + if (left % 16 == 0) + { + left--; + } + + if (up % 16 == 0) + { + up--; + } + + if (right % 16 == 0) + { + right++; + } + + if (down % 16 == 0) + { + down++; + } + + int width = right / 16 - left / 16; + int height = down / 16 - up / 16; + left /= 16; + up /= 16; + for (int i = left; i <= left + width; i++) + { + EdgeTiles.Add(new Point(i, up)); + EdgeTiles.Add(new Point(i, up + height)); + } + + for (int j = up; j < up + height; j++) + { + EdgeTiles.Add(new Point(left, j)); + EdgeTiles.Add(new Point(left + width, j)); + } + foreach (Point touchedTile in EdgeTiles) + { + Tile tile = Framing.GetTileSafely(touchedTile); + if (!tile.HasTile || !tile.HasUnactuatedTile) + continue; + if (tile.TileType == auricOreID || tile.TileType == auricRepulserID) + { + // Force Auric Ore to animate with its crackling electricity + if (tile.TileType == auricOreID) + { + AuricOre.Animate = true; + } + + var yeetVec = Vector2.Normalize(projectile.Center - touchedTile.ToWorldCoordinates()); + projectile.velocity += yeetVec * 40f; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1") with { Pitch = 0.4f }); + } + } + } + if (projectile.type == ProjectileID.OrnamentFriendly && lineColor == 1) //spawned by Festive Wings { Vector2 center = projectile.Center; @@ -3373,10 +3938,6 @@ namespace CalamityMod.Projectiles } } } - - //Crystal bullet projectiles deal 50% of the bullet's damage which is absurd in vanilla, this nerfs them to 27.5% - if (projectile.type == ProjectileID.CrystalShard) - modifiers.SourceDamage *= 0.55f; } #endregion @@ -3393,12 +3954,20 @@ namespace CalamityMod.Projectiles if (projectile.hostile && (projectile.damage - flatDR <= 0)) return false; + bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + int dealNoDamageTime = 60; switch (projectile.type) { // Rev+ Deerclops ice spikes can only deal damage while they're not fading out case ProjectileID.DeerclopsIceSpike: if (CalamityWorld.revenge || BossRushEvent.BossRushActive) - return projectile.ai[0] < 10f; + { + float fadeInTime = 10f; + float fadeOutGateValue = masterMode ? 80f : death ? 50f : 10f; + return (projectile.ai[0] >= fadeInTime && projectile.ai[0] < fadeOutGateValue); + } break; // Rev+ Deerclops rubble doesn't deal damage while it's not flying upwards @@ -3407,20 +3976,38 @@ namespace CalamityMod.Projectiles return projectile.ai[0] > projectile.ai[2]; break; + // Additional slams in the Master Mode shockwave have a delay before expanding and dealing damage + case ProjectileID.QueenSlimeSmash: + if (masterMode) + return projectile.ai[0] > 0f; + break; + // Storm Weaver frost waves don't deal damage unless they're at their max velocity case ProjectileID.FrostWave: if (projectile.ai[1] > 0f) return projectile.velocity.Length() >= projectile.ai[1]; break; - // Duke Fishron tornadoes don't deal damage for a bit after they spawn + // Duke Fishron tornadoes deal no damage for 1 second after spawning case ProjectileID.Sharknado: - if (projectile.timeLeft > 420) + if (projectile.timeLeft > FishronSharknadoTotalDuration - dealNoDamageTime) return false; break; case ProjectileID.Cthulunado: - if (projectile.timeLeft > 720) + if (projectile.timeLeft > FishronCthulhunadoTotalDuration - dealNoDamageTime) + return false; + break; + + // Empress Rainbow Streaks deal no damage if they haven't started homing + case ProjectileID.HallowBossRainbowStreak: + if (projectile.hostile) + return projectile.timeLeft <= EmpressRainbowStreakSpreadOutCutoff; + break; + + // Empress Lasting Rainbows deal no damage for 1 second after spawning + case ProjectileID.HallowBossLastingRainbow: + if (projectile.timeLeft > EmpressLastingRainbowTotalDuration - dealNoDamageTime) return false; break; @@ -3445,7 +4032,7 @@ namespace CalamityMod.Projectiles public override Color? GetAlpha(Projectile projectile, Color lightColor) { if (Main.player[Main.myPlayer].Calamity().trippy) - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); if (Main.LocalPlayer.Calamity().omniscience && projectile.hostile && projectile.damage > 0 && projectile.alpha < 255) { @@ -3491,10 +4078,9 @@ namespace CalamityMod.Projectiles float startTurningBrownGateValue = 420f; float timeToReachFullBrown = 180f; float timeToReachThornExplosion = startTurningBrownGateValue + timeToReachFullBrown; - Color initialColor = Color.White; - initialColor.A = (byte)projectile.alpha; - Color finalColor = Color.RosyBrown; - finalColor.A = (byte)projectile.alpha; + Color initialColor = lightColor; + Color finalColor = new Color(125, 75, 75); + finalColor.A = (byte)(255 - projectile.alpha); if (projectile.ai[1] > startTurningBrownGateValue) { float colorTransitionRatio = (projectile.ai[1] - startTurningBrownGateValue) / timeToReachFullBrown; @@ -3545,37 +4131,123 @@ namespace CalamityMod.Projectiles if (projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Vector2 vector11 = new(texture.Width / 2, texture.Height / Main.projFrames[projectile.type] / 2); - Color color9 = new(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); - Color alpha15 = projectile.GetAlpha(color9); - - float offsetX = Main.screenPosition.X + (projectile.width / 2) - texture.Width * projectile.scale / 2f + vector11.X * projectile.scale; - float offsetY = Main.screenPosition.Y + projectile.height - texture.Height * projectile.scale / Main.projFrames[projectile.type] + 4f + vector11.Y * projectile.scale + projectile.gfxOffY; - for (int num213 = 0; num213 < 4; num213++) + Color rainbow = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); + Color alphaColor = projectile.GetAlpha(rainbow); + float RGBMult = 0.99f; + alphaColor.R = (byte)(alphaColor.R * RGBMult); + alphaColor.G = (byte)(alphaColor.G * RGBMult); + alphaColor.B = (byte)(alphaColor.B * RGBMult); + alphaColor.A = (byte)(alphaColor.A * RGBMult); + int totalAfterimages = Main.player[Main.myPlayer].Calamity().trippyLevel == 3 ? 16 : (Main.player[Main.myPlayer].Calamity().trippyLevel == 2 ? 12 : 4); + for (int i = 0; i < totalAfterimages; i++) { - Vector2 position9 = projectile.position; - float num214 = Math.Abs(projectile.Center.X - Main.player[Main.myPlayer].Center.X); - float num215 = Math.Abs(projectile.Center.Y - Main.player[Main.myPlayer].Center.Y); + Vector2 position = projectile.position; + float distanceFromTargetX = Math.Abs(projectile.Center.X - Main.player[Main.myPlayer].Center.X); + float distanceFromTargetY = Math.Abs(projectile.Center.Y - Main.player[Main.myPlayer].Center.Y); - if (num213 == 0 || num213 == 2) - position9.X = Main.player[Main.myPlayer].Center.X + num214; - else - position9.X = Main.player[Main.myPlayer].Center.X - num214; + float smallDistanceMult = 0.48f; + float largeDistanceMult = 1.33f; + bool whatTheFuck = Main.player[Main.myPlayer].Calamity().trippyLevel == 3; - position9.X -= projectile.width / 2; + switch (i) + { + case 0: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + break; - if (num213 == 0 || num213 == 1) - position9.Y = Main.player[Main.myPlayer].Center.Y + num215; - else - position9.Y = Main.player[Main.myPlayer].Center.Y - num215; + case 1: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + break; - int frames = texture.Height / Main.projFrames[projectile.type]; - int y = frames * projectile.frame; - position9.Y -= projectile.height / 2; + case 2: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + break; + + case 3: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + break; + + case 4: // 1 o'clock position + position.X = Main.player[Main.myPlayer].Center.X + (distanceFromTargetX * (whatTheFuck ? 1f : smallDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y - (distanceFromTargetY * (whatTheFuck ? 0f : largeDistanceMult)); + break; + + case 5: // 4 o'clock position + position.X = Main.player[Main.myPlayer].Center.X + (distanceFromTargetX * (whatTheFuck ? 0f : largeDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y + (distanceFromTargetY * (whatTheFuck ? 1f : smallDistanceMult)); + break; + + case 6: // 7 o'clock position + position.X = Main.player[Main.myPlayer].Center.X - (distanceFromTargetX * (whatTheFuck ? 1f : smallDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y + (distanceFromTargetY * (whatTheFuck ? 0f : largeDistanceMult)); + break; + + case 7: // 10 o'clock position + position.X = Main.player[Main.myPlayer].Center.X - (distanceFromTargetX * (whatTheFuck ? 0f : largeDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y - (distanceFromTargetY * (whatTheFuck ? 1f : smallDistanceMult)); + break; + + case 8: // 11 o'clock position + position.X = Main.player[Main.myPlayer].Center.X - (distanceFromTargetX * (whatTheFuck ? 0f : smallDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y - (distanceFromTargetY * (whatTheFuck ? 0.5f : largeDistanceMult)); + break; + + case 9: // 2 o'clock position + position.X = Main.player[Main.myPlayer].Center.X + (distanceFromTargetX * (whatTheFuck ? 0.5f : largeDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y - (distanceFromTargetY * (whatTheFuck ? 0f : smallDistanceMult)); + break; + + case 10: // 5 o'clock position + position.X = Main.player[Main.myPlayer].Center.X + (distanceFromTargetX * (whatTheFuck ? 0f : smallDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y + (distanceFromTargetY * (whatTheFuck ? 0.5f : largeDistanceMult)); + break; + + case 11: // 8 o'clock position + position.X = Main.player[Main.myPlayer].Center.X - (distanceFromTargetX * (whatTheFuck ? 0.5f : largeDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y + (distanceFromTargetY * (whatTheFuck ? 0f : smallDistanceMult)); + break; + + case 12: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX * 0.5f; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY * 0.5f; + break; + + case 13: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX * 0.5f; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY * 0.5f; + break; + + case 14: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX * 0.5f; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY * 0.5f; + break; + + case 15: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX * 0.5f; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY * 0.5f; + break; + + default: + break; + } + + position.X -= projectile.width / 2; + position.Y -= projectile.height / 2; + + int frameHeight = texture.Height / Main.projFrames[projectile.type]; + int currentframeHeight = frameHeight * projectile.frame; + Rectangle frame = new Rectangle(0, currentframeHeight, texture.Width, frameHeight); + + Vector2 halfSize = frame.Size() / 2; Main.spriteBatch.Draw(texture, - new Vector2(position9.X - offsetX, position9.Y - offsetY), - new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y, texture.Width, frames)), alpha15, projectile.rotation, vector11, projectile.scale, spriteEffects, 0); + new Vector2(position.X - Main.screenPosition.X + (float)(projectile.width / 2) - (float)TextureAssets.Projectile[projectile.type].Width() * projectile.scale / 2f + halfSize.X * projectile.scale, + position.Y - Main.screenPosition.Y + (float)projectile.height - (float)TextureAssets.Projectile[projectile.type].Height() * projectile.scale / (float)Main.projFrames[projectile.type] + 4f + halfSize.Y * projectile.scale + projectile.gfxOffY), + frame, alphaColor, projectile.rotation, halfSize, projectile.scale, spriteEffects, 0f); } } @@ -3599,6 +4271,7 @@ namespace CalamityMod.Projectiles { bool masterRevSkeletronPrimeBomb = projectile.type == ProjectileID.BombSkeletronPrime && projectile.ai[0] < 0f && (Main.masterMode || BossRushEvent.BossRushActive); bool revQueenBeeBeeHive = projectile.type == ProjectileID.BeeHive && (CalamityWorld.revenge || BossRushEvent.BossRushActive) && (projectile.ai[2] == 1f || CalamityWorld.death) && projectile.wet; + bool revGolemInferno = projectile.type == ProjectileID.InfernoHostileBolt && projectile.ai[2] > 0f; if (revQueenBeeBeeHive) { @@ -3620,7 +4293,7 @@ namespace CalamityMod.Projectiles { if (masterRevSkeletronPrimeBomb) { - SoundEngine.PlaySound(SoundID.Item14, projectile.position); + SoundEngine.PlaySound(SoundID.Item14, projectile.Center); projectile.position.X += projectile.width / 2; projectile.position.Y += projectile.height / 2; projectile.width = projectile.height = 22; @@ -3727,9 +4400,17 @@ namespace CalamityMod.Projectiles if (Main.netMode != NetmodeID.SinglePlayer) NetMessage.SendData(MessageID.KillProjectile, -1, -1, null, projectile.identity, projectile.owner); } + + else if (revGolemInferno) + { + Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileID.InfernoHostileBlast, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f, projectile.ai[2]); + + if (Main.netMode != NetmodeID.SinglePlayer) + NetMessage.SendData(MessageID.KillProjectile, -1, -1, null, projectile.identity, projectile.owner); + } } - if (masterRevSkeletronPrimeBomb || revQueenBeeBeeHive) + if (masterRevSkeletronPrimeBomb || revQueenBeeBeeHive || revGolemInferno) { projectile.active = false; return false; @@ -3793,15 +4474,9 @@ namespace CalamityMod.Projectiles #endregion #region Life Steal - public static bool CanSpawnLifeStealProjectile(float healMultiplier, float healAmount) - { - if (healMultiplier <= 0f || (int)healAmount <= 0) - return false; + public static bool CanSpawnLifeStealProjectile(double healMultiplier, float healAmount) => healMultiplier > 0D && (int)healAmount > 0; - return true; - } - - public static void SpawnLifeStealProjectile(Projectile projectile, Player player, float healAmount, int healProjectileType, float distanceRequired, float cooldownMultiplier) + public static void SpawnLifeStealProjectile(Projectile projectile, Player player, float healAmount, int healProjectileType, float distanceRequired, float cooldownMultiplier = 1f) { if (Main.player[Main.myPlayer].moonLeech) return; diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index 34f829a53a..ee0ae2ffb0 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -125,6 +125,7 @@ namespace CalamityMod.Projectiles { ProjectileID.ButchersChainsaw, Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+15), LocalIFrames(5), ScaleExact(1.5f)) }, { ProjectileID.ChlorophyteChainsaw, standardChainsawTweaks }, { ProjectileID.ChlorophyteDrill, standardDrillTweaks }, + { ProjectileID.ClothiersCurse, Do(PiercingExact(3), LocalIFrames(-1)) }, { ProjectileID.CobaltChainsaw, standardChainsawTweaks }, { ProjectileID.CobaltDrill, standardDrillTweaks }, { ProjectileID.CrystalBullet, standardBulletTweaks }, @@ -184,6 +185,10 @@ namespace CalamityMod.Projectiles { ProjectileID.QueenSlimeGelAttack, Do(NoPiercing) }, { ProjectileID.QueenSlimeMinionPinkBall, Do(NoPiercing) }, { ProjectileID.RedCounterweight, counterweightTweaks }, + { ProjectileID.RocketFireworkBlue, Do(TimeLeftDelta(+45)) }, + { ProjectileID.RocketFireworkGreen, Do(TimeLeftDelta(+45)) }, + { ProjectileID.RocketFireworkRed, Do(TimeLeftDelta(+45)) }, + { ProjectileID.RocketFireworkYellow, Do(TimeLeftDelta(+45)) }, { ProjectileID.SawtoothShark, Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+15), LocalIFrames(6)) }, { ProjectileID.ShadowBeamHostile, Do(TimeLeftExact(60)) }, { ProjectileID.Shroomerang, Do(ExtraUpdatesExact(1)) }, @@ -200,6 +205,7 @@ namespace CalamityMod.Projectiles { ProjectileID.VenomBullet, standardBulletTweaks }, { ProjectileID.VenomFang, Do(LocalIFrames(10)) }, { ProjectileID.VortexDrill, standardDrillTweaks }, + { ProjectileID.Wasp, Do(PiercingExact(2)) }, { ProjectileID.YellowCounterweight, counterweightTweaks }, #endregion diff --git a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs index 166d444d77..a4aea7ee0f 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { fireLasers = true; Projectile.soundDelay *= 6; - gatlingLaserLoopID = SoundEngine.PlaySound(GatlingLaser.FireLoopSound, Projectile.position); + gatlingLaserLoopID = SoundEngine.PlaySound(GatlingLaser.FireLoopSound, Projectile.Center); } } if (shootThisFrame && Main.myPlayer == Projectile.owner && fireLasers) @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (SoundEngine.TryGetActiveSound(gatlingLaserLoopID, out result)) result.Stop(); - SoundEngine.PlaySound(GatlingLaser.FireEndSound, Projectile.position); + SoundEngine.PlaySound(GatlingLaser.FireEndSound, Projectile.Center); Projectile.Kill(); } } diff --git a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs index 6785dea06a..98d5c5c17c 100644 --- a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs +++ b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Play idle sounds every so often. if (Projectile.soundDelay <= 0) { - SoundEngine.PlaySound(SoundID.Item22, Projectile.position); + SoundEngine.PlaySound(SoundID.Item22, Projectile.Center); Projectile.soundDelay = 30; } Vector2 center = Owner.RotatedRelativePoint(Owner.MountedCenter); diff --git a/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs b/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs index 06965bf892..2bd6635255 100644 --- a/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs +++ b/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(PlasmaGrenade.ExplosionSound, Projectile.position); + SoundEngine.PlaySound(PlasmaGrenade.ExplosionSound, Projectile.Center); if (Projectile.Calamity().stealthStrike) { if (Main.myPlayer == Projectile.owner) diff --git a/Projectiles/Enemy/AstralMeteorProj.cs b/Projectiles/Enemy/AstralMeteorProj.cs index 6670f0e61b..9048e87fa1 100644 --- a/Projectiles/Enemy/AstralMeteorProj.cs +++ b/Projectiles/Enemy/AstralMeteorProj.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.NPCDeath14, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath14, Projectile.Center); Projectile.ExpandHitboxBy(60); for (int i = 0; i < 15; i++) diff --git a/Projectiles/Enemy/CrimsonSpike.cs b/Projectiles/Enemy/CrimsonSpike.cs index f5911564c4..c44c0e7349 100644 --- a/Projectiles/Enemy/CrimsonSpike.cs +++ b/Projectiles/Enemy/CrimsonSpike.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Enemy if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item17, Projectile.position); + SoundEngine.PlaySound(SoundID.Item17, Projectile.Center); } Projectile.ai[0] += 1f; diff --git a/Projectiles/Enemy/EarthRockBig.cs b/Projectiles/Enemy/EarthRockBig.cs index 033cd14c43..9ec18e910c 100644 --- a/Projectiles/Enemy/EarthRockBig.cs +++ b/Projectiles/Enemy/EarthRockBig.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.NPCDeath14, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 60; diff --git a/Projectiles/Enemy/EarthRockSmall.cs b/Projectiles/Enemy/EarthRockSmall.cs index 05e41b1ba5..6ef8e40c7e 100644 --- a/Projectiles/Enemy/EarthRockSmall.cs +++ b/Projectiles/Enemy/EarthRockSmall.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.NPCDeath14, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 50; diff --git a/Projectiles/Enemy/FlameBurstHostile.cs b/Projectiles/Enemy/FlameBurstHostile.cs index ef69ddd7fa..7e714c5e5a 100644 --- a/Projectiles/Enemy/FlameBurstHostile.cs +++ b/Projectiles/Enemy/FlameBurstHostile.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Enemy { if (count == 0f) { - SoundEngine.PlaySound(SoundID.Item73, Projectile.position); + SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 20; diff --git a/Projectiles/Enemy/HorsWaterBlast.cs b/Projectiles/Enemy/HorsWaterBlast.cs index 18e8b7336e..98da26f0b4 100644 --- a/Projectiles/Enemy/HorsWaterBlast.cs +++ b/Projectiles/Enemy/HorsWaterBlast.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Enemy } } Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item21, Projectile.position); + SoundEngine.PlaySound(SoundID.Item21, Projectile.Center); } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.35f / 255f); for (int j = 0; j < 10; j++) @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item21, Projectile.position); + SoundEngine.PlaySound(SoundID.Item21, Projectile.Center); for (int dust = 0; dust <= 40; dust++) { float rando1 = (float)Main.rand.Next(-10, 11); diff --git a/Projectiles/Enemy/InkBombHostile.cs b/Projectiles/Enemy/InkBombHostile.cs index 849452a0ff..2041f553fd 100644 --- a/Projectiles/Enemy/InkBombHostile.cs +++ b/Projectiles/Enemy/InkBombHostile.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.NPCDeath28, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath28, Projectile.Center); if (Projectile.owner == Main.myPlayer) { int randProjAmt = Main.rand.Next(5, 9); diff --git a/Projectiles/Enemy/MaulerAcidBubble.cs b/Projectiles/Enemy/MaulerAcidBubble.cs index c7e95c9fc2..7fa7928489 100644 --- a/Projectiles/Enemy/MaulerAcidBubble.cs +++ b/Projectiles/Enemy/MaulerAcidBubble.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item54, Projectile.position); + SoundEngine.PlaySound(SoundID.Item54, Projectile.Center); } } } diff --git a/Projectiles/Enemy/PufferExplosion.cs b/Projectiles/Enemy/PufferExplosion.cs index 7093ace153..423115e6f6 100644 --- a/Projectiles/Enemy/PufferExplosion.cs +++ b/Projectiles/Enemy/PufferExplosion.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Enemy Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); if (Projectile.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.localAI[0] += 1f; } bool xflag = false; diff --git a/Projectiles/Enemy/SulphuricAcidBubble.cs b/Projectiles/Enemy/SulphuricAcidBubble.cs index 93a79d8b4a..61c1e53397 100644 --- a/Projectiles/Enemy/SulphuricAcidBubble.cs +++ b/Projectiles/Enemy/SulphuricAcidBubble.cs @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item54, Projectile.position); + SoundEngine.PlaySound(SoundID.Item54, Projectile.Center); Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 60; diff --git a/Projectiles/Enemy/SulphuricAcidMist.cs b/Projectiles/Enemy/SulphuricAcidMist.cs index 83cac6d9fa..95fcf1d01d 100644 --- a/Projectiles/Enemy/SulphuricAcidMist.cs +++ b/Projectiles/Enemy/SulphuricAcidMist.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Enemy if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item111, Projectile.position); + SoundEngine.PlaySound(SoundID.Item111, Projectile.Center); } if (Projectile.velocity.X < 0f) diff --git a/Projectiles/Enemy/TornadoHostile.cs b/Projectiles/Enemy/TornadoHostile.cs index f9062bab75..8b3d1358d4 100644 --- a/Projectiles/Enemy/TornadoHostile.cs +++ b/Projectiles/Enemy/TornadoHostile.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Enemy if (Projectile.soundDelay == 0) { Projectile.soundDelay = -1; - SoundEngine.PlaySound(SoundID.Item122, Projectile.position); + SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); } Projectile.ai[0] += 1f; if (Projectile.ai[0] >= projTimer) diff --git a/Projectiles/Environment/BrimstoneGeyser.cs b/Projectiles/Environment/BrimstoneGeyser.cs index d03070cbaf..0d99d274b5 100644 --- a/Projectiles/Environment/BrimstoneGeyser.cs +++ b/Projectiles/Environment/BrimstoneGeyser.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Environment dust.velocity.Y -= 0.2f; } } - SoundEngine.PlaySound(SoundID.Item34, Projectile.position); + SoundEngine.PlaySound(SoundID.Item34, Projectile.Center); } if (isActive == 1) { diff --git a/Projectiles/Environment/SmokeTelegraph.cs b/Projectiles/Environment/SmokeTelegraph.cs index 5b424ffab9..7677fcc2f3 100644 --- a/Projectiles/Environment/SmokeTelegraph.cs +++ b/Projectiles/Environment/SmokeTelegraph.cs @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Environment dust.velocity.Y -= 0.2f; } } - SoundEngine.PlaySound(SoundID.Item34, Projectile.position); + SoundEngine.PlaySound(SoundID.Item34, Projectile.Center); } if (isActive == 1) { diff --git a/Projectiles/Healing/EarthHealOrb.cs b/Projectiles/Healing/EarthHealOrb.cs index 6daecfd29a..a16880d89a 100644 --- a/Projectiles/Healing/EarthHealOrb.cs +++ b/Projectiles/Healing/EarthHealOrb.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Projectiles.Healing public class EarthHealOrb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() @@ -24,11 +25,11 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 8f, 15f); - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.GreenFairy, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[dusty]; - dust.noGravity = true; - dust.position.X -= Projectile.velocity.X * 0.2f; - dust.position.Y += Projectile.velocity.Y * 0.2f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GreenFairy, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/EmpyreanHealOrb.cs b/Projectiles/Healing/EmpyreanHealOrb.cs index b63f48ca72..f876e0cf8a 100644 --- a/Projectiles/Healing/EmpyreanHealOrb.cs +++ b/Projectiles/Healing/EmpyreanHealOrb.cs @@ -8,30 +8,26 @@ namespace CalamityMod.Projectiles.Healing public class EmpyreanHealOrb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = 12; + Projectile.height = 12; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = false; - Projectile.timeLeft = 240; + Projectile.timeLeft = 300; Projectile.extraUpdates = 3; } public override void AI() { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5.5f, 15f); - float dustX = Projectile.velocity.X * 0.2f; - float dustY = -(Projectile.velocity.Y * 0.2f); - if (Projectile.timeLeft % 2 == 0) - { - int healDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.PurpleTorch, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[healDust]; - dust.noGravity = true; - dust.position.X -= dustX; - dust.position.Y -= dustY; - } + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 6f, 15f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleTorch, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/EssenceFlame.cs b/Projectiles/Healing/EssenceFlame.cs index 61c600a546..5dda7fe29e 100644 --- a/Projectiles/Healing/EssenceFlame.cs +++ b/Projectiles/Healing/EssenceFlame.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Healing public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item74, Projectile.position); + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 50; diff --git a/Projectiles/Healing/Exoheal.cs b/Projectiles/Healing/Exoheal.cs index bb18a214e1..386f1f457d 100644 --- a/Projectiles/Healing/Exoheal.cs +++ b/Projectiles/Healing/Exoheal.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Projectiles.Healing public class Exoheal : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() @@ -24,11 +25,11 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 8f, 15f); - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1f); - Dust dust = Main.dust[dusty]; - dust.noGravity = true; - dust.position.X -= Projectile.velocity.X * 0.2f; - dust.position.Y += Projectile.velocity.Y * 0.2f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255)); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/FungalHeal.cs b/Projectiles/Healing/FungalHeal.cs index 06ae646750..1dcb6e2a4f 100644 --- a/Projectiles/Healing/FungalHeal.cs +++ b/Projectiles/Healing/FungalHeal.cs @@ -7,35 +7,28 @@ namespace CalamityMod.Projectiles.Healing public class FungalHeal : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() { - Projectile.width = 6; - Projectile.height = 6; - Projectile.alpha = 255; + Projectile.width = 4; + Projectile.height = 4; + Projectile.penetrate = 1; + Projectile.friendly = true; Projectile.tileCollide = false; - Projectile.extraUpdates = 10; - Projectile.timeLeft = 600; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 300; } public override void AI() { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5f, 15f); - float dustX = Projectile.velocity.X * 0.334f; - float dustY = -(Projectile.velocity.Y * 0.334f); - int fungi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 0.5f); - Dust dust = Main.dust[fungi]; - dust.noGravity = true; - dust.position.X -= dustX; - dust.position.Y -= dustY; - float dustX2 = Projectile.velocity.X * 0.2f; - float dustY2 = -(Projectile.velocity.Y * 0.2f); - int fungi2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 0.7f); - Dust dust2 = Main.dust[fungi2]; - dust2.noGravity = true; - dust2.position.X -= dustX2; - dust2.position.Y -= dustY2; + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 3f, 15f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/GladiatorHealOrb.cs b/Projectiles/Healing/GladiatorHealOrb.cs index 8bff859ab0..1fc627f2a4 100644 --- a/Projectiles/Healing/GladiatorHealOrb.cs +++ b/Projectiles/Healing/GladiatorHealOrb.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Balancing; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,8 +12,11 @@ namespace CalamityMod.Projectiles.Healing public class GladiatorHealOrb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int target = -1; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailingMode[Projectile.type] = 0; @@ -52,6 +56,7 @@ namespace CalamityMod.Projectiles.Healing } else HealHome(); } + public void PassiveBehavior() { float maxYVelocity = 2f; @@ -61,6 +66,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.velocity.Y += 0.02f; if (Projectile.velocity.Y > maxYVelocity) { Projectile.velocity.Y = maxYVelocity; } } + public void HealHome() { Player player = Main.player[target]; @@ -69,20 +75,22 @@ namespace CalamityMod.Projectiles.Healing float playerDist = playerVector.Length(); if (playerDist < 50f && Projectile.position.X < player.position.X + player.width && Projectile.position.X + Projectile.width > player.position.X && Projectile.position.Y < player.position.Y + player.height && Projectile.position.Y + Projectile.height > player.position.Y) { - int healAmt = 10; - player.HealEffect(healAmt, false); - player.statLife += healAmt; + int heal = 10; + player.HealEffect(heal, false); + player.statLife += heal; if (player.statLife > player.statLifeMax2) - { player.statLife = player.statLifeMax2; - } + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/OrbHeal", 5) { Volume = 0.15f }, Projectile.Center); - NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, target, healAmt, 0f, 0f, 0, 0, 0); + + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, target, heal, 0f, 0f, 0, 0, 0); + Projectile.Kill(); } Projectile.velocity = (playerVector.SafeNormalize(Vector2.UnitY) * 3.5f) + (player.velocity / 4); } + public override bool PreDraw(ref Color lightColor) { Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value; diff --git a/Projectiles/Healing/HydrothermicHealOrb.cs b/Projectiles/Healing/HydrothermicHealOrb.cs index 5718f8dffb..e1df042f9f 100644 --- a/Projectiles/Healing/HydrothermicHealOrb.cs +++ b/Projectiles/Healing/HydrothermicHealOrb.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Projectiles.Healing public class HydrothermicHealOrb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() @@ -17,18 +18,18 @@ namespace CalamityMod.Projectiles.Healing Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = false; - Projectile.timeLeft = 240; + Projectile.timeLeft = 300; Projectile.extraUpdates = 3; } public override void AI() { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5.5f, 15f); - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[dusty]; - dust.noGravity = true; - dust.position.X -= Projectile.velocity.X * 0.2f; - dust.position.Y += Projectile.velocity.Y * 0.2f; + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5f, 15f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/ManaPolarizerHealOrb.cs b/Projectiles/Healing/ManaPolarizerHealOrb.cs index 120036570c..373c1b9518 100644 --- a/Projectiles/Healing/ManaPolarizerHealOrb.cs +++ b/Projectiles/Healing/ManaPolarizerHealOrb.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Projectiles.Healing public class ManaPolarizerHealOrb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() @@ -17,18 +18,18 @@ namespace CalamityMod.Projectiles.Healing Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = false; - Projectile.timeLeft = 180; + Projectile.timeLeft = 300; Projectile.extraUpdates = 3; } public override void AI() { Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 3f, 15f); - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 1.3f); - Dust dust = Main.dust[dusty]; - dust.noGravity = true; - dust.position.X -= Projectile.velocity.X * 0.2f; - dust.position.Y += Projectile.velocity.Y * 0.2f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpectreStaff, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/RainHeal.cs b/Projectiles/Healing/RainHeal.cs index 77fd20cb64..4b72eba2a6 100644 --- a/Projectiles/Healing/RainHeal.cs +++ b/Projectiles/Healing/RainHeal.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,37 +9,42 @@ namespace CalamityMod.Projectiles.Healing public class RainHeal : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private const int TimeLeft = 300; + + private const int HomingTime = TimeLeft - 120; + + private const int SlowDownTime = TimeLeft - 150; + public override void SetDefaults() { Projectile.width = 4; Projectile.height = 4; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.alpha = 255; Projectile.penetrate = 1; - Projectile.timeLeft = 180; + Projectile.timeLeft = TimeLeft; Projectile.tileCollide = false; + Projectile.extraUpdates = 3; } public override void AI() { - if (Projectile.timeLeft < 165) + if (Projectile.timeLeft < HomingTime) { - if (Projectile.timeLeft > 150) + if (Projectile.timeLeft > SlowDownTime) Projectile.velocity *= 0.9f; else - Projectile.HealingProjectile(8, Projectile.owner, 12f, 15f, false); + Projectile.HealingProjectile(GrandGuardian.HealPerOrb, Projectile.owner, 12f, 15f); } - float dustX = Projectile.velocity.X * 0.2f; - float dustY = -(Projectile.velocity.Y * 0.2f); - int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Dust dust = Main.dust[rainbow]; - dust.noGravity = true; - dust.position.X -= dustX; - dust.position.Y -= dustY; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/ReaverHealOrb.cs b/Projectiles/Healing/ReaverHealOrb.cs index 3aa8cf6258..23d5fb22c0 100644 --- a/Projectiles/Healing/ReaverHealOrb.cs +++ b/Projectiles/Healing/ReaverHealOrb.cs @@ -8,7 +8,9 @@ namespace CalamityMod.Projectiles.Healing public class ReaverHealOrb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() { Projectile.width = 4; @@ -16,18 +18,18 @@ namespace CalamityMod.Projectiles.Healing Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = false; - Projectile.timeLeft = 240; + Projectile.timeLeft = 300; Projectile.extraUpdates = 3; } public override void AI() { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5.5f, 15f); - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.GreenFairy, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[dusty]; - dust.noGravity = true; - dust.position.X -= Projectile.velocity.X * 0.2f; - dust.position.Y += Projectile.velocity.Y * 0.2f; + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5f, 15f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GreenFairy, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/RoyalHeal.cs b/Projectiles/Healing/RoyalHeal.cs index 9932177bd7..998e494146 100644 --- a/Projectiles/Healing/RoyalHeal.cs +++ b/Projectiles/Healing/RoyalHeal.cs @@ -8,40 +8,28 @@ namespace CalamityMod.Projectiles.Healing public class RoyalHeal : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() { - Projectile.width = 6; - Projectile.height = 6; - Projectile.alpha = 255; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; Projectile.tileCollide = false; - Projectile.extraUpdates = 10; + Projectile.extraUpdates = 3; } public override void AI() { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5.5f, 15f); - for (int i = 0; i < 3; i++) - { - float dustX = Projectile.velocity.X * 0.334f * (float)i; - float dustY = -(Projectile.velocity.Y * 0.334f) * (float)i; - int pureHeal = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.PurificationPowder, 0f, 0f, 100, default, 1.1f); - Dust dust = Main.dust[pureHeal]; - dust.noGravity = true; - dust.position.X -= dustX; - dust.position.Y -= dustY; - } - for (int j = 0; j < 5; j++) - { - float dustX2 = Projectile.velocity.X * 0.2f * (float)j; - float dustY2 = -(Projectile.velocity.Y * 0.2f) * (float)j; - int pureHeal2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.PurificationPowder, 0f, 0f, 100, default, 1.3f); - Dust dust2 = Main.dust[pureHeal2]; - dust2.noGravity = true; - dust2.position.X -= dustX2; - dust2.position.Y -= dustY2; - } + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 18f, 10f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.PurificationPowder, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/SilvaOrb.cs b/Projectiles/Healing/SilvaOrb.cs index 5b01972f8b..1d12d7230d 100644 --- a/Projectiles/Healing/SilvaOrb.cs +++ b/Projectiles/Healing/SilvaOrb.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Projectiles.Healing public class SilvaOrb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override void SetDefaults() { Projectile.width = 22; @@ -27,36 +28,28 @@ namespace CalamityMod.Projectiles.Healing { Projectile.scale += 0.05f; if (Projectile.scale > 1.2f) - { Projectile.localAI[0] = 1f; - } } else { Projectile.scale -= 0.05f; if (Projectile.scale < 0.8f) - { Projectile.localAI[0] = 0f; - } } Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 6f, 15f); return; } - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, 203, 103, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, 203, 103, Projectile.alpha); public override void OnKill(int timeLeft) { for (int i = 0; i < 5; i++) { - int silvaHeal = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.ChlorophyteWeapon, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); + int silvaHeal = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ChlorophyteWeapon, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1.5f); Main.dust[silvaHeal].noGravity = true; - Main.dust[silvaHeal].velocity *= 1.5f; - Main.dust[silvaHeal].scale = 1.5f; + Main.dust[silvaHeal].velocity *= 0f; } } } diff --git a/Projectiles/Healing/TransfusionTrail.cs b/Projectiles/Healing/TransfusionTrail.cs index 07dd922950..55d1326d47 100644 --- a/Projectiles/Healing/TransfusionTrail.cs +++ b/Projectiles/Healing/TransfusionTrail.cs @@ -8,37 +8,28 @@ namespace CalamityMod.Projectiles.Healing public class TransfusionTrail : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() { - Projectile.width = 6; - Projectile.height = 6; - Projectile.alpha = 255; + Projectile.width = 4; + Projectile.height = 4; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.friendly = true; Projectile.tileCollide = false; - Projectile.extraUpdates = 10; + Projectile.extraUpdates = 3; } public override void AI() { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 6.5f, 15f); - float dustX = Projectile.velocity.X * 0.334f; - float dustY = -(Projectile.velocity.Y * 0.334f); - int healRed = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.VampireHeal, 0f, 0f, 100, default, 0.7f); - Dust dust = Main.dust[healRed]; - dust.noGravity = true; - dust.position.X -= dustX; - dust.position.Y -= dustY; - for (int i = 0; i < 2; i++) - { - float dustyX = Projectile.velocity.X * 0.2f * (float)i; - float dustyY = -(Projectile.velocity.Y * 0.2f) * (float)i; - int healRedMore = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.VampireHeal, 0f, 0f, 100, default, 0.9f); - Dust dust2 = Main.dust[healRedMore]; - dust2.noGravity = true; - dust2.position.X -= dustyX; - dust2.position.Y -= dustyY; - } + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5f, 15f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.VampireHeal, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Magic/AcidicReed.cs b/Projectiles/Magic/AcidicReed.cs index cbf70d6fdd..60777f1222 100644 --- a/Projectiles/Magic/AcidicReed.cs +++ b/Projectiles/Magic/AcidicReed.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic { if (Projectile.ai[0] == 1f) { - SoundEngine.PlaySound(SaxSound, Projectile.position); + SoundEngine.PlaySound(SaxSound, Projectile.Center); Projectile.ai[0] = 0f; } if (Projectile.velocity.Y < 10f) diff --git a/Projectiles/Magic/AcidicSaxMist.cs b/Projectiles/Magic/AcidicSaxMist.cs index a6ce107250..e268e99d6b 100644 --- a/Projectiles/Magic/AcidicSaxMist.cs +++ b/Projectiles/Magic/AcidicSaxMist.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item111, Projectile.position); + SoundEngine.PlaySound(SoundID.Item111, Projectile.Center); } if (Projectile.velocity.X < 0f) { diff --git a/Projectiles/Magic/AnahitasArpeggioNote.cs b/Projectiles/Magic/AnahitasArpeggioNote.cs index 4c10c37fb8..eb160c34f5 100644 --- a/Projectiles/Magic/AnahitasArpeggioNote.cs +++ b/Projectiles/Magic/AnahitasArpeggioNote.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.ai[1] = 1f; Main.musicPitch = Projectile.ai[0]; - SoundEngine.PlaySound(SoundID.Item26, Projectile.position); + SoundEngine.PlaySound(SoundID.Item26, Projectile.Center); } Lighting.AddLight(Projectile.Center, 0f, 0f, 1.2f); diff --git a/Projectiles/Magic/ArtAttackStar.cs b/Projectiles/Magic/ArtAttackStar.cs index b3e400b48c..264e0d75a3 100644 --- a/Projectiles/Magic/ArtAttackStar.cs +++ b/Projectiles/Magic/ArtAttackStar.cs @@ -16,9 +16,13 @@ namespace CalamityMod.Projectiles.Magic public class ArtAttackStar : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; + public const int StarShapeCreationDelay = 12; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailingMode[Projectile.type] = 2; @@ -38,7 +42,6 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - // Die if the holdout is gone. if (Owner.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && Time >= 2f) { @@ -115,12 +118,10 @@ namespace CalamityMod.Projectiles.Magic public void EmitIdleDust() { - for (int i = 0; i < 3; i++) { Dust rainbowMagic = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8f, 8f), 261); - rainbowMagic.velocity = Main.rand.NextVector2Circular(6f, 6f) - ((Projectile.position - Projectile.oldPos[1])/3f).RotatedByRandom(0.51f); - + rainbowMagic.velocity = Main.rand.NextVector2Circular(6f, 6f) - ((Projectile.position - Projectile.oldPos[1]) / 3f).RotatedByRandom(0.51f); rainbowMagic.color = Main.hslToRgb(Main.rand.NextFloat(), 1f, Main.rand.NextFloat(0.5f, 0.9f)); rainbowMagic.color.A = 128; rainbowMagic.scale = Main.rand.NextFloat(1.3f, 1.6f); diff --git a/Projectiles/Magic/Asteroid.cs b/Projectiles/Magic/Asteroid.cs index 1a40ff1673..187d854c15 100644 --- a/Projectiles/Magic/Asteroid.cs +++ b/Projectiles/Magic/Asteroid.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item89, Projectile.position); + SoundEngine.PlaySound(SoundID.Item89, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = (int)(128f * Projectile.scale); diff --git a/Projectiles/Magic/AsteroidMolten.cs b/Projectiles/Magic/AsteroidMolten.cs index 4685966d7b..c9339ebb55 100644 --- a/Projectiles/Magic/AsteroidMolten.cs +++ b/Projectiles/Magic/AsteroidMolten.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item89, Projectile.position); + SoundEngine.PlaySound(SoundID.Item89, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = (int)(128f * Projectile.scale); diff --git a/Projectiles/Magic/AstralStarMagic.cs b/Projectiles/Magic/AstralStarMagic.cs index f57dc85e14..669f7ca602 100644 --- a/Projectiles/Magic/AstralStarMagic.cs +++ b/Projectiles/Magic/AstralStarMagic.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/Typeless/AstralStar"; - private int noTileHitCounter = 120; + private const int NoTileCollideTime = 30; public override void SetStaticDefaults() { @@ -29,7 +29,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = 24; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; - Projectile.alpha = 50; Projectile.penetrate = 1; Projectile.tileCollide = false; Projectile.ignoreWater = true; @@ -37,64 +36,85 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - int randomToSubtract = Main.rand.Next(1, 3); - noTileHitCounter -= randomToSubtract; - if (noTileHitCounter == 0) - { + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= NoTileCollideTime) Projectile.tileCollide = true; - } + if (Projectile.soundDelay == 0) { Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) - { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); - } - } - Projectile.alpha -= 15; - int opacity = 150; - if (Projectile.Center.Y >= Projectile.ai[1]) - { - opacity = 0; - } - if (Projectile.alpha < opacity) - { - Projectile.alpha = opacity; + SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); } + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; - if (Main.rand.NextBool(16)) + + if (Main.rand.NextBool(8)) { - Vector2 velocity = Vector2.UnitX.RotatedByRandom(Math.PI / 2D).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[idx].velocity = velocity * 0.66f; - Main.dust[idx].position = Projectile.Center + velocity * 12f; + int spawnDustAmount = 2; + for (int i = 0; i < spawnDustAmount; i++) + { + Color newColor = Main.hslToRgb(0.5f, 1f, 0.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowMk2, 0f, 0f, 0, newColor); + Main.dust[dust].position = Projectile.Center + Main.rand.NextVector2Circular((float)Projectile.width, (float)Projectile.height) * 0.5f; + Main.dust[dust].velocity *= Main.rand.NextFloat() * 0.8f; + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 0.6f + Main.rand.NextFloat(); + Main.dust[dust].velocity += Projectile.velocity.SafeNormalize(Vector2.UnitY) * 3f; + Main.dust[dust].scale = 0.7f; + if (dust != Main.maxDust) + { + Dust dust2 = Dust.CloneDust(dust); + dust2.scale /= 2f; + dust2.fadeIn *= 0.85f; + dust2.color = new Color(255, 255, 255, 255); + } + } + + Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.PiOver2).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150); + Main.dust[idx].velocity = velocity * 0.33f; + Main.dust[idx].position = Projectile.Center + velocity * 6f; } - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) + + if (Main.rand.NextBool(24) && Main.netMode != NetmodeID.Server) { - int idx = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); + int idx = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity * 0.1f, 16, 1f); Main.gore[idx].velocity *= 0.66f; - Main.gore[idx].velocity += Projectile.velocity * 0.3f; + Main.gore[idx].velocity += Projectile.velocity * 0.15f; } - if (Projectile.ai[1] == 1f) + + Projectile.light = 0.9f; + + if (Main.rand.NextBool(5)) { - Projectile.light = 0.9f; - if (Main.rand.NextBool(10)) + Color newColor = Main.hslToRgb(1f, 1f, 0.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowMk2, 0f, 0f, 0, newColor); + Main.dust[dust].position = Projectile.Center + Main.rand.NextVector2Circular((float)Projectile.width, (float)Projectile.height) * 0.5f; + Main.dust[dust].velocity *= Main.rand.NextFloat() * 0.8f; + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 0.6f + Main.rand.NextFloat(); + Main.dust[dust].velocity += Projectile.velocity * 0.25f; + Main.dust[dust].scale = 0.7f; + if (dust != Main.maxDust) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) - { - Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + Dust dust2 = Dust.CloneDust(dust); + dust2.scale /= 2f; + dust2.fadeIn *= 0.85f; + dust2.color = new Color(255, 255, 255, 255); } + + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150); } + + if (Main.rand.NextBool(10) && Main.netMode != NetmodeID.Server) + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * 0.1f, Main.rand.Next(16, 18), 1f); + if (Projectile.ai[0] == 1f) CalamityUtils.HomeInOnNPC(Projectile, Projectile.tileCollide, 500f, 15f, 20f); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); public override Color? GetAlpha(Color lightColor) => new Color(200, 100, 250, Projectile.alpha); @@ -105,12 +125,39 @@ namespace CalamityMod.Projectiles.Magic return false; } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); + return true; + } + public override void OnKill(int timeLeft) { Projectile.ExpandHitboxBy(50); - for (int i = 0; i < 5; i++) + + int spawnDustAmount = 3; + for (int i = 0; i < spawnDustAmount; i++) { - int idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.2f); + Color newColor = Main.hslToRgb(1f, 1f, 0.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowMk2, 0f, 0f, 0, newColor); + Main.dust[dust].position = Projectile.Center + Main.rand.NextVector2Circular((float)Projectile.width, (float)Projectile.height); + Main.dust[dust].velocity *= Main.rand.NextFloat() * 2.4f; + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 0.6f + Main.rand.NextFloat(); + Main.dust[dust].scale = 1.4f; + if (dust != Main.maxDust) + { + Dust dust2 = Dust.CloneDust(dust); + dust2.scale /= 2f; + dust2.fadeIn *= 0.85f; + dust2.color = new Color(255, 255, 255, 255); + } + } + + for (int i = 0; i < 3; i++) + { + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool()) { @@ -118,20 +165,20 @@ namespace CalamityMod.Projectiles.Magic Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int i = 0; i < 5; i++) + + for (int i = 0; i < 3; i++) { - int idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.7f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100); Main.dust[idx].velocity *= 2f; } + if (Main.netMode != NetmodeID.Server) { for (int i = 0; i < 3; i++) - { - Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, new Vector2(Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); - } + Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, Projectile.velocity * 0.05f, Main.rand.Next(16, 18), 1f); } } } diff --git a/Projectiles/Magic/AstralachneaFang.cs b/Projectiles/Magic/AstralachneaFang.cs index 7df46f342c..13bf333d7f 100644 --- a/Projectiles/Magic/AstralachneaFang.cs +++ b/Projectiles/Magic/AstralachneaFang.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); for (int k = 0; k < 3; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f); diff --git a/Projectiles/Magic/BeamingBolt.cs b/Projectiles/Magic/BeamingBolt.cs index 0b142b6765..a27139f9d4 100644 --- a/Projectiles/Magic/BeamingBolt.cs +++ b/Projectiles/Magic/BeamingBolt.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1), Projectile.knockBack, Projectile.owner, Projectile.ai[0]); } } - SoundEngine.PlaySound(SoundID.Item105, Projectile.position); + SoundEngine.PlaySound(SoundID.Item105, Projectile.Center); } } } diff --git a/Projectiles/Magic/BeastScythe.cs b/Projectiles/Magic/BeastScythe.cs index 78f28bf5c3..b28e8f0262 100644 --- a/Projectiles/Magic/BeastScythe.cs +++ b/Projectiles/Magic/BeastScythe.cs @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 100; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); diff --git a/Projectiles/Magic/BlackAnurianBubble.cs b/Projectiles/Magic/BlackAnurianBubble.cs index 344f697968..e1cb87a269 100644 --- a/Projectiles/Magic/BlackAnurianBubble.cs +++ b/Projectiles/Magic/BlackAnurianBubble.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item54, Projectile.position); + SoundEngine.PlaySound(SoundID.Item54, Projectile.Center); int inc; for (int i = 0; i < 25; i = inc + 1) { diff --git a/Projectiles/Magic/BrimstoneFireball.cs b/Projectiles/Magic/BrimstoneFireball.cs index 1c8c36d96c..3e53340932 100644 --- a/Projectiles/Magic/BrimstoneFireball.cs +++ b/Projectiles/Magic/BrimstoneFireball.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.penetrate--; if (Projectile.penetrate <= 0) { @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Magic/ClamorNoctusStar.cs b/Projectiles/Magic/ClamorNoctusStar.cs index fd26da23f6..895e3c6340 100644 --- a/Projectiles/Magic/ClamorNoctusStar.cs +++ b/Projectiles/Magic/ClamorNoctusStar.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); } } if (Main.rand.NextBool(3)) @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 50; diff --git a/Projectiles/Magic/DarkSparkPrism.cs b/Projectiles/Magic/DarkSparkPrism.cs index cf3a12ef66..df469351d0 100644 --- a/Projectiles/Magic/DarkSparkPrism.cs +++ b/Projectiles/Magic/DarkSparkPrism.cs @@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.soundDelay = 10; Projectile.soundDelay *= 2; if (Projectile.ai[0] != 1f) - SoundEngine.PlaySound(SoundID.Item15, Projectile.position); + SoundEngine.PlaySound(SoundID.Item15, Projectile.Center); } if (shouldHitChargedUp && Main.myPlayer == Projectile.owner) diff --git a/Projectiles/Magic/EventHorizonStar.cs b/Projectiles/Magic/EventHorizonStar.cs index 3aabdeaf06..2f83d555a1 100644 --- a/Projectiles/Magic/EventHorizonStar.cs +++ b/Projectiles/Magic/EventHorizonStar.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); } } diff --git a/Projectiles/Magic/FlareBoltProjectile.cs b/Projectiles/Magic/FlareBoltProjectile.cs index abff776316..d744d9eb4f 100644 --- a/Projectiles/Magic/FlareBoltProjectile.cs +++ b/Projectiles/Magic/FlareBoltProjectile.cs @@ -83,14 +83,14 @@ namespace CalamityMod.Projectiles.Magic { Projectile.velocity.Y = -oldVelocity.Y; } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); } return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); for (int k = 0; k < 5; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.InfernoFork, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); diff --git a/Projectiles/Magic/ForbiddenSunProjectile.cs b/Projectiles/Magic/ForbiddenSunProjectile.cs index 8d59020d13..5fb8696413 100644 --- a/Projectiles/Magic/ForbiddenSunProjectile.cs +++ b/Projectiles/Magic/ForbiddenSunProjectile.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic } if (Projectile.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.localAI[0] += 1f; } if (Main.rand.NextBool(4)) diff --git a/Projectiles/Magic/ForbiddenSunburst.cs b/Projectiles/Magic/ForbiddenSunburst.cs index aaf5827429..03785ec273 100644 --- a/Projectiles/Magic/ForbiddenSunburst.cs +++ b/Projectiles/Magic/ForbiddenSunburst.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic } if (Projectile.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.localAI[0] += 1f; } float projTimer = 25f; diff --git a/Projectiles/Magic/FrigidflashBoltProjectile.cs b/Projectiles/Magic/FrigidflashBoltProjectile.cs index cf7b7ee671..4caa6bf043 100644 --- a/Projectiles/Magic/FrigidflashBoltProjectile.cs +++ b/Projectiles/Magic/FrigidflashBoltProjectile.cs @@ -104,14 +104,14 @@ namespace CalamityMod.Projectiles.Magic { Projectile.velocity.Y = -oldVelocity.Y; } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); } return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(FrigidflashBolt.ProjDeathSound, Projectile.position); + SoundEngine.PlaySound(FrigidflashBolt.ProjDeathSound, Projectile.Center); for (int k = 0; k < 3; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.InfernoFork, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); diff --git a/Projectiles/Magic/FrostBoltProjectile.cs b/Projectiles/Magic/FrostBoltProjectile.cs index 5b38aa3471..06cadcc66d 100644 --- a/Projectiles/Magic/FrostBoltProjectile.cs +++ b/Projectiles/Magic/FrostBoltProjectile.cs @@ -84,14 +84,14 @@ namespace CalamityMod.Projectiles.Magic { Projectile.velocity.Y = -oldVelocity.Y; } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); } return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int k = 0; k < 5; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Frost, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); diff --git a/Projectiles/Magic/GhastlyBlast.cs b/Projectiles/Magic/GhastlyBlast.cs index 0bce9d5e14..e3c627d5c6 100644 --- a/Projectiles/Magic/GhastlyBlast.cs +++ b/Projectiles/Magic/GhastlyBlast.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Magic if (!goingSlow && !currentlyHoming) { // Spin at a certain rate - Projectile.rotation -= 0.104719758f; + Projectile.rotation -= MathHelper.Pi / 30f; // Dust, randomly if (Main.rand.NextBool(3)) @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Magic else { // Spin at the exact same rate anyway - Projectile.rotation -= 0.104719758f; + Projectile.rotation -= MathHelper.Pi / 30f; // Excessively complicated dust int inc; @@ -249,7 +249,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.maxPenetrate = -1; Projectile.penetrate = -1; Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int i = 0; i < 4; i++) { diff --git a/Projectiles/Magic/GhastlyExplosion.cs b/Projectiles/Magic/GhastlyExplosion.cs index cbb6d4cfb7..0c39d40733 100644 --- a/Projectiles/Magic/GhastlyExplosion.cs +++ b/Projectiles/Magic/GhastlyExplosion.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item50, Projectile.position); + SoundEngine.PlaySound(SoundID.Item50, Projectile.Center); int inc; for (int i = 0; i < 20; i = inc + 1) { diff --git a/Projectiles/Magic/GhastlyVisageProj.cs b/Projectiles/Magic/GhastlyVisageProj.cs index 16a64879c0..a83898ccb4 100644 --- a/Projectiles/Magic/GhastlyVisageProj.cs +++ b/Projectiles/Magic/GhastlyVisageProj.cs @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.soundDelay = soundDelayer - soundDelayMult * aiSoundDelay; if (isActive) - SoundEngine.PlaySound(SoundID.Item117, Projectile.position); + SoundEngine.PlaySound(SoundID.Item117, Projectile.Center); } else if (Projectile.soundDelay <= 0 && canUseItem) { @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.soundDelay = soundDelayer - soundDelayMult * aiSoundDelay; if (Projectile.ai[0] != 1f && isActive) { - SoundEngine.PlaySound(SoundID.Item117, Projectile.position); + SoundEngine.PlaySound(SoundID.Item117, Projectile.Center); } Projectile.localAI[0] = 12f; } diff --git a/Projectiles/Magic/GleamingBolt.cs b/Projectiles/Magic/GleamingBolt.cs index 13d6406861..1443b9062c 100644 --- a/Projectiles/Magic/GleamingBolt.cs +++ b/Projectiles/Magic/GleamingBolt.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); } } - SoundEngine.PlaySound(SoundID.Item105, Projectile.position); + SoundEngine.PlaySound(SoundID.Item105, Projectile.Center); } } } diff --git a/Projectiles/Magic/HadalUrnHoldout.cs b/Projectiles/Magic/HadalUrnHoldout.cs index 72a4c1e499..1a806f98cf 100644 --- a/Projectiles/Magic/HadalUrnHoldout.cs +++ b/Projectiles/Magic/HadalUrnHoldout.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic bool manaCostPaid = player.CheckMana(player.ActiveItem(), -1, true, false); if (manaCostPaid) { - SoundEngine.PlaySound(SoundID.Item111, Projectile.position); + SoundEngine.PlaySound(SoundID.Item111, Projectile.Center); int projcount = 3; for (int i = 0; i < projcount; ++i) { @@ -111,14 +111,14 @@ namespace CalamityMod.Projectiles.Magic } else { - SoundEngine.PlaySound(UrnSound, Projectile.position); + SoundEngine.PlaySound(UrnSound, Projectile.Center); Projectile.Kill(); } } } else { - SoundEngine.PlaySound(UrnSound, Projectile.position); + SoundEngine.PlaySound(UrnSound, Projectile.Center); Projectile.Kill(); } } diff --git a/Projectiles/Magic/HadalUrnIsopod.cs b/Projectiles/Magic/HadalUrnIsopod.cs index 6a0f8b50cf..1ac62e58f1 100644 --- a/Projectiles/Magic/HadalUrnIsopod.cs +++ b/Projectiles/Magic/HadalUrnIsopod.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); //Black Anurian bubble dust int inc; for (int i = 0; i < 25; i = inc + 1) diff --git a/Projectiles/Magic/HadalUrnStarfish.cs b/Projectiles/Magic/HadalUrnStarfish.cs index 0e22557642..d2043be509 100644 --- a/Projectiles/Magic/HadalUrnStarfish.cs +++ b/Projectiles/Magic/HadalUrnStarfish.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.frame = 0; Shards(); - SoundEngine.PlaySound(SoundID.Item42, Projectile.position); + SoundEngine.PlaySound(SoundID.Item42, Projectile.Center); Projectile.ai[1]++; Projectile.ai[0] = 0; } diff --git a/Projectiles/Magic/HellfireExplosionFriendly.cs b/Projectiles/Magic/HellfireExplosionFriendly.cs index 8ebd455549..dd34965370 100644 --- a/Projectiles/Magic/HellfireExplosionFriendly.cs +++ b/Projectiles/Magic/HellfireExplosionFriendly.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, 0.9f, 0f, 0f); if (Projectile.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.localAI[0] += 1f; } float projTimer = 25f; diff --git a/Projectiles/Magic/HolyFlame.cs b/Projectiles/Magic/HolyFlame.cs index 57afaaeeeb..9c18b09a94 100644 --- a/Projectiles/Magic/HolyFlame.cs +++ b/Projectiles/Magic/HolyFlame.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 50; diff --git a/Projectiles/Magic/IceCluster.cs b/Projectiles/Magic/IceCluster.cs index 7e6f1cc20f..c5a292e024 100644 --- a/Projectiles/Magic/IceCluster.cs +++ b/Projectiles/Magic/IceCluster.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.localAI[1] == 0f) { Projectile.localAI[1] = 1f; - SoundEngine.PlaySound(SoundID.Item120, Projectile.position); + SoundEngine.PlaySound(SoundID.Item120, Projectile.Center); } Projectile.ai[0] += 1f; diff --git a/Projectiles/Magic/Icicle.cs b/Projectiles/Magic/Icicle.cs index 3d002fd659..c9cf8e1009 100644 --- a/Projectiles/Magic/Icicle.cs +++ b/Projectiles/Magic/Icicle.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int index1 = 0; index1 < 5; ++index1) { int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueCrystalShard, 0f, 0f, 0, new Color(), 1f); diff --git a/Projectiles/Magic/IcicleStaffProj.cs b/Projectiles/Magic/IcicleStaffProj.cs index c17268a153..e97dbdb755 100644 --- a/Projectiles/Magic/IcicleStaffProj.cs +++ b/Projectiles/Magic/IcicleStaffProj.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int k = 0; k < 5; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); diff --git a/Projectiles/Magic/InfernadoFriendly.cs b/Projectiles/Magic/InfernadoFriendly.cs index 5aaadcf3eb..4965b30a35 100644 --- a/Projectiles/Magic/InfernadoFriendly.cs +++ b/Projectiles/Magic/InfernadoFriendly.cs @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Magic } if (Projectile.ai[0] <= 0f) { - float swaySize = 0.104719758f; + float swaySize = MathHelper.Pi / 30f; float smolWidth = (float)Projectile.width / 5f; smolWidth *= 2f; float projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; diff --git a/Projectiles/Magic/InfernadoMarkFriendly.cs b/Projectiles/Magic/InfernadoMarkFriendly.cs index 934a319c68..14ca4ee0ed 100644 --- a/Projectiles/Magic/InfernadoMarkFriendly.cs +++ b/Projectiles/Magic/InfernadoMarkFriendly.cs @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(FlareSound, Projectile.position); + SoundEngine.PlaySound(FlareSound, Projectile.Center); int dustAmt = 36; for (int i = 0; i < dustAmt; i++) { diff --git a/Projectiles/Magic/InfernalBlade.cs b/Projectiles/Magic/InfernalBlade.cs index 100c48f5b0..6e1b43bc05 100644 --- a/Projectiles/Magic/InfernalBlade.cs +++ b/Projectiles/Magic/InfernalBlade.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); int dustAmt = Main.rand.Next(4, 10); for (int d = 0; d < dustAmt; d++) { diff --git a/Projectiles/Magic/InfernalBlade2.cs b/Projectiles/Magic/InfernalBlade2.cs index 6fb29578c0..b9b9c880da 100644 --- a/Projectiles/Magic/InfernalBlade2.cs +++ b/Projectiles/Magic/InfernalBlade2.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); int randDustAmt = Main.rand.Next(4, 10); for (int i = 0; i < randDustAmt; i++) { diff --git a/Projectiles/Magic/LightBall.cs b/Projectiles/Magic/LightBall.cs index 386657ff76..e3190faf25 100644 --- a/Projectiles/Magic/LightBall.cs +++ b/Projectiles/Magic/LightBall.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 300; diff --git a/Projectiles/Magic/LightBlade.cs b/Projectiles/Magic/LightBlade.cs index 5932a71a4c..03db038dd8 100644 --- a/Projectiles/Magic/LightBlade.cs +++ b/Projectiles/Magic/LightBlade.cs @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.NPCHit3, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCHit3, Projectile.Center); int numDust = Main.rand.Next(4, 10); for (int i = 0; i < numDust; i++) { diff --git a/Projectiles/Magic/LiquidBlade.cs b/Projectiles/Magic/LiquidBlade.cs index b4bc6fe1cc..56f4066730 100644 --- a/Projectiles/Magic/LiquidBlade.cs +++ b/Projectiles/Magic/LiquidBlade.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Magic Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * 10f, 8f, DelegateMethods.CastLightOpen); if (Projectile.alpha > 0) { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); Projectile.alpha = 0; Projectile.scale = 1.1f; Projectile.frame = Main.rand.Next(14); @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); int randDustAmt = Main.rand.Next(4, 10); for (int j = 0; j < randDustAmt; j++) { diff --git a/Projectiles/Magic/LiquidBlade2.cs b/Projectiles/Magic/LiquidBlade2.cs index cb49d443b8..9c5fd6edee 100644 --- a/Projectiles/Magic/LiquidBlade2.cs +++ b/Projectiles/Magic/LiquidBlade2.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Magic Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * 10f, 8f, DelegateMethods.CastLightOpen); if (Projectile.alpha > 0) { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); Projectile.alpha = 0; Projectile.scale = 1.1f; Projectile.frame = Main.rand.Next(14); @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); int randDustAmt = Main.rand.Next(4, 10); for (int i = 0; i < randDustAmt; i++) { diff --git a/Projectiles/Magic/MadAlchemistsCocktailBlue.cs b/Projectiles/Magic/MadAlchemistsCocktailBlue.cs index e28be7875b..a1a816d07b 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailBlue.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailBlue.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item107, Projectile.position); + SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); if (Main.netMode != NetmodeID.Server) { diff --git a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs index abfd669837..6114267a51 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs @@ -37,8 +37,8 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item107, Projectile.position); - SoundEngine.PlaySound(SoundID.Item88, Projectile.position); + SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item88, Projectile.Center); if (Main.netMode != NetmodeID.Server) { diff --git a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs index 2d92f82c35..3fc98ecb6c 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item107, Projectile.position); + SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); if (Main.netMode != NetmodeID.Server) { diff --git a/Projectiles/Magic/ManaBolt.cs b/Projectiles/Magic/ManaBolt.cs index f4c95782a5..de520ad65e 100644 --- a/Projectiles/Magic/ManaBolt.cs +++ b/Projectiles/Magic/ManaBolt.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); } } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); } } } diff --git a/Projectiles/Magic/ManaBoltSmall.cs b/Projectiles/Magic/ManaBoltSmall.cs index 4fb43fa15d..9b8c894790 100644 --- a/Projectiles/Magic/ManaBoltSmall.cs +++ b/Projectiles/Magic/ManaBoltSmall.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Magic { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.MagicMirror, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); } } } diff --git a/Projectiles/Magic/ManaBoltSmall2.cs b/Projectiles/Magic/ManaBoltSmall2.cs index c1e81d42b1..7451c208ed 100644 --- a/Projectiles/Magic/ManaBoltSmall2.cs +++ b/Projectiles/Magic/ManaBoltSmall2.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); } } } diff --git a/Projectiles/Magic/NebulaCloudCore.cs b/Projectiles/Magic/NebulaCloudCore.cs index b404602b7e..bbb777d17b 100644 --- a/Projectiles/Magic/NebulaCloudCore.cs +++ b/Projectiles/Magic/NebulaCloudCore.cs @@ -287,7 +287,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = -1; Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int i = 0; i < 6; i++) { diff --git a/Projectiles/Magic/NebulousCataclysm_Held.cs b/Projectiles/Magic/NebulousCataclysm_Held.cs index 1d67377e96..6943c00178 100644 --- a/Projectiles/Magic/NebulousCataclysm_Held.cs +++ b/Projectiles/Magic/NebulousCataclysm_Held.cs @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Magic } if (ableToShoot) - SoundEngine.PlaySound(SoundID.Item117, Projectile.position); + SoundEngine.PlaySound(SoundID.Item117, Projectile.Center); } if (Main.myPlayer == Projectile.owner && ableToShoot) diff --git a/Projectiles/Magic/NuclearFuryProjectile.cs b/Projectiles/Magic/NuclearFuryProjectile.cs index 1eaa92d48a..6c38dbd006 100644 --- a/Projectiles/Magic/NuclearFuryProjectile.cs +++ b/Projectiles/Magic/NuclearFuryProjectile.cs @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); for (int k = 0; k < 5; k++) { int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BreatheBubble, 0f, 0f); diff --git a/Projectiles/Magic/PhantasmalFuryProj.cs b/Projectiles/Magic/PhantasmalFuryProj.cs index b815cf53bd..c07f55756e 100644 --- a/Projectiles/Magic/PhantasmalFuryProj.cs +++ b/Projectiles/Magic/PhantasmalFuryProj.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item43, Projectile.position); + SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); for (int j = 0; j <= 10; j++) { Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 1f); diff --git a/Projectiles/Magic/PlagueFang.cs b/Projectiles/Magic/PlagueFang.cs index cca722a48a..ce781e990d 100644 --- a/Projectiles/Magic/PlagueFang.cs +++ b/Projectiles/Magic/PlagueFang.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); for (int i = 0; i < 7; i++) { int killPlague = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.PoisonStaff, 0f, 0f, 100, default, 1f); diff --git a/Projectiles/Magic/PlasmaShot.cs b/Projectiles/Magic/PlasmaShot.cs index e171b0e358..d59a3bdedc 100644 --- a/Projectiles/Magic/PlasmaShot.cs +++ b/Projectiles/Magic/PlasmaShot.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); int cloudAmt = Main.rand.Next(20, 31); if (Projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Magic/PoseidonTyphoon.cs b/Projectiles/Magic/PoseidonTyphoon.cs index c3351a2bb9..7f725d14e7 100644 --- a/Projectiles/Magic/PoseidonTyphoon.cs +++ b/Projectiles/Magic/PoseidonTyphoon.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Magic/SHPB.cs b/Projectiles/Magic/SHPB.cs index 51a88fc610..f3f8019de3 100644 --- a/Projectiles/Magic/SHPB.cs +++ b/Projectiles/Magic/SHPB.cs @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item105, Projectile.position); + SoundEngine.PlaySound(SoundID.Item105, Projectile.Center); if (Projectile.owner == Main.myPlayer) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 98d9e0d6ac..e0fbdb16f6 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; @@ -65,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 10; @@ -94,12 +95,11 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) + int heal = (int)Math.Round(hit.Damage * 0.025); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - Player player = Main.player[Projectile.owner]; - player.statLife += 1; - player.HealEffect(1); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs index c36e6f1ca2..c5d649feb7 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } Projectile.velocity.X *= 1.03f; Projectile.velocity.Y *= 1.03f; @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); for (int dust = 0; dust <= 5; dust++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f); diff --git a/Projectiles/Magic/SerpentineHead.cs b/Projectiles/Magic/SerpentineHead.cs index b217c1aaf7..6d299bf7e3 100644 --- a/Projectiles/Magic/SerpentineHead.cs +++ b/Projectiles/Magic/SerpentineHead.cs @@ -159,7 +159,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); for (int k = 0; k < 8; k++) { int seaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.BlueCrystalShard, 0f, 0f, 100, default, 1.25f); diff --git a/Projectiles/Magic/ShadecrystalProjectile.cs b/Projectiles/Magic/ShadecrystalProjectile.cs index 7b5061dcef..2284b4a2da 100644 --- a/Projectiles/Magic/ShadecrystalProjectile.cs +++ b/Projectiles/Magic/ShadecrystalProjectile.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,13 +9,20 @@ namespace CalamityMod.Projectiles.Magic public class ShadecrystalProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + public override void SetDefaults() { Projectile.width = 6; Projectile.height = 6; - Projectile.scale = 1.5f; Projectile.friendly = true; Projectile.alpha = 50; + Projectile.MaxUpdates = 3; Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Magic; @@ -22,25 +30,43 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(Projectile.Center, 0.15f, 0f, 0.15f); + if (Projectile.ai[2] < 255f) + { + Projectile.ai[2] += 3f; + if (Projectile.ai[2] >= 255f) + Projectile.ai[2] = -255f; + } + + Lighting.AddLight(Projectile.Center, 0.15f * Projectile.scale, 0f, 0.15f * Projectile.scale); Projectile.rotation += Projectile.velocity.X * 0.2f; - if (Main.rand.NextBool(4)) + if (Main.rand.NextBool(6)) { - int crystalDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.PurpleCrystalShard, 0f, 0f, 0, default, 1f); + int crystalDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleCrystalShard, 0f, 0f, Projectile.alpha, new Color(Math.Abs(Projectile.ai[2]), 0, 255, Projectile.alpha)); Main.dust[crystalDust].noGravity = true; - Main.dust[crystalDust].velocity *= 0.2f; - Main.dust[crystalDust].scale *= 0.8f; + Main.dust[crystalDust].velocity = Projectile.velocity * 0.2f; + Main.dust[crystalDust].scale = Projectile.scale; } - Projectile.velocity *= 0.99f; - - Projectile.ai[1] += 1f; - if (Projectile.ai[1] > 90f) + float maxVelocity = 6f; + if (Projectile.velocity.Length() < maxVelocity) { - Projectile.scale -= 0.05f; - if (Projectile.scale <= 0.2) + Projectile.velocity *= Projectile.ai[1]; + if (Projectile.velocity.Length() > maxVelocity) + { + Projectile.velocity.Normalize(); + Projectile.velocity *= maxVelocity; + } + } + else + CalamityUtils.HomeInOnNPC(Projectile, false, 224f, maxVelocity * 1.25f, 30f); + + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 520f) + { + Projectile.scale -= 0.01f; + if (Projectile.scale <= 0.2f) { Projectile.scale = 0.2f; Projectile.Kill(); @@ -63,18 +89,23 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - for (int k = 0; k < 5; k++) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.PurpleCrystalShard, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + for (int k = 0; k < 3; k++) + { + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.PurpleCrystalShard, 0f, 0f, Projectile.alpha, new Color(Math.Abs(Projectile.ai[2]), 0, 255, Projectile.alpha)); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity = Projectile.oldVelocity * 0.5f; + Main.dust[dust].scale = Projectile.scale; + } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Frostburn2, 120); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Frostburn2, 120); - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) => new Color(Math.Abs(Projectile.ai[2]), 0, 255, Projectile.alpha); + + public override bool PreDraw(ref Color lightColor) { - return new Color(200, 200, 200, 0); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; } } } diff --git a/Projectiles/Magic/SmallSpirit.cs b/Projectiles/Magic/SmallSpirit.cs index f0083240c7..fb98eb148e 100644 --- a/Projectiles/Magic/SmallSpirit.cs +++ b/Projectiles/Magic/SmallSpirit.cs @@ -117,11 +117,11 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 6; i++) { - Dust polterplasm = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(12f, 12f), 261); - polterplasm.color = Color.Lerp(Color.LightPink, Color.Red, Main.rand.NextFloat(0.67f)); - polterplasm.scale = 1.2f; - polterplasm.fadeIn = 0.55f; - polterplasm.noGravity = true; + Dust necroplasm = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(12f, 12f), 261); + necroplasm.color = Color.Lerp(Color.LightPink, Color.Red, Main.rand.NextFloat(0.67f)); + necroplasm.scale = 1.2f; + necroplasm.fadeIn = 0.55f; + necroplasm.noGravity = true; } } } diff --git a/Projectiles/Magic/Snowball.cs b/Projectiles/Magic/Snowball.cs index 0f5d6f07c3..451b62000a 100644 --- a/Projectiles/Magic/Snowball.cs +++ b/Projectiles/Magic/Snowball.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); //crystal bullet shards for (int i = 0; i < 10; ++i) { diff --git a/Projectiles/Magic/Snowflake.cs b/Projectiles/Magic/Snowflake.cs index 0bc9a725b5..85f625591f 100644 --- a/Projectiles/Magic/Snowflake.cs +++ b/Projectiles/Magic/Snowflake.cs @@ -172,7 +172,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int k = 0; k < 5; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); diff --git a/Projectiles/Magic/SnowflakeIceStar.cs b/Projectiles/Magic/SnowflakeIceStar.cs index b5db9ce60f..e4457b9642 100644 --- a/Projectiles/Magic/SnowflakeIceStar.cs +++ b/Projectiles/Magic/SnowflakeIceStar.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); Projectile.ExpandHitboxBy(24); int dustAmt = 36; for (int j = 0; j < dustAmt; j++) diff --git a/Projectiles/Magic/SparklingLaser.cs b/Projectiles/Magic/SparklingLaser.cs index f61810e4fc..1adfe56d9c 100644 --- a/Projectiles/Magic/SparklingLaser.cs +++ b/Projectiles/Magic/SparklingLaser.cs @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Magic // Play a cool sound when fully charged. if (!playedSound) { - SoundEngine.PlaySound(SoundID.Item68, Projectile.position); + SoundEngine.PlaySound(SoundID.Item68, Projectile.Center); playedSound = true; } return true; diff --git a/Projectiles/Magic/StickyFeather.cs b/Projectiles/Magic/StickyFeather.cs index feeb0ae254..a81fafe0ce 100644 --- a/Projectiles/Magic/StickyFeather.cs +++ b/Projectiles/Magic/StickyFeather.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 50; diff --git a/Projectiles/Magic/Teslabeam.cs b/Projectiles/Magic/Teslabeam.cs index 19e3dc6b11..ba7bb2f167 100644 --- a/Projectiles/Magic/Teslabeam.cs +++ b/Projectiles/Magic/Teslabeam.cs @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Magic // Play zap sounds idly if (Projectile.ai[2] % 5 == 0) { - SoundEngine.PlaySound(SoundID.DD2_LightningBugZap with { Pitch = 1.1f }, Projectile.position); + SoundEngine.PlaySound(SoundID.DD2_LightningBugZap with { Pitch = 1.1f }, Projectile.Center); } // If the weapon's target hasn't just been hit, tick down the grace period timer if (decayGracePeriod > 0 && damageShouldDecay) diff --git a/Projectiles/Magic/ThunderstormShotSplit.cs b/Projectiles/Magic/ThunderstormShotSplit.cs index f204e61be5..bb8fd4fc86 100644 --- a/Projectiles/Magic/ThunderstormShotSplit.cs +++ b/Projectiles/Magic/ThunderstormShotSplit.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item125, Projectile.position); + SoundEngine.PlaySound(SoundID.Item125, Projectile.Center); Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 16; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); diff --git a/Projectiles/Magic/TridentIcicle.cs b/Projectiles/Magic/TridentIcicle.cs index 704552b1de..4fc8c59b59 100644 --- a/Projectiles/Magic/TridentIcicle.cs +++ b/Projectiles/Magic/TridentIcicle.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int i = 0; i < 10; i++) { int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemSapphire); diff --git a/Projectiles/Magic/UberBubble.cs b/Projectiles/Magic/UberBubble.cs index 66e0bc6934..2e77928b40 100644 --- a/Projectiles/Magic/UberBubble.cs +++ b/Projectiles/Magic/UberBubble.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item96, Projectile.position); + SoundEngine.PlaySound(SoundID.Item96, Projectile.Center); int randDustAmt = Main.rand.Next(4, 6); for (int i = 0; i < randDustAmt; i++) { diff --git a/Projectiles/Magic/UndinesRetributionSpear.cs b/Projectiles/Magic/UndinesRetributionSpear.cs index e1de59d851..584b433afb 100644 --- a/Projectiles/Magic/UndinesRetributionSpear.cs +++ b/Projectiles/Magic/UndinesRetributionSpear.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.localNPCHitCooldown = 10; Projectile.damage /= 2; Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item21, Projectile.position); + SoundEngine.PlaySound(SoundID.Item21, Projectile.Center); for (int i = 0; i < 4; i++) { Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); diff --git a/Projectiles/Magic/Vehemence.cs b/Projectiles/Magic/Vehemence.cs index 5d2766aab9..1cafa7da21 100644 --- a/Projectiles/Magic/Vehemence.cs +++ b/Projectiles/Magic/Vehemence.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item74, Projectile.position); + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); if (Main.myPlayer == Projectile.owner) { int skullID = ModContent.ProjectileType(); diff --git a/Projectiles/Magic/VenusianBolt.cs b/Projectiles/Magic/VenusianBolt.cs index 7d78489021..2fada07e04 100644 --- a/Projectiles/Magic/VenusianBolt.cs +++ b/Projectiles/Magic/VenusianBolt.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic } if (Projectile.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item73, Projectile.position); + SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); Projectile.localAI[0] += 1f; } for (int i = 0; i < 3; i++) diff --git a/Projectiles/Magic/VenusianExplosion.cs b/Projectiles/Magic/VenusianExplosion.cs index 82a9b0a5f3..12092ac7c9 100644 --- a/Projectiles/Magic/VenusianExplosion.cs +++ b/Projectiles/Magic/VenusianExplosion.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); if (Projectile.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item74, Projectile.position); + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); Projectile.localAI[0] += 1f; } float projTimer = 25f; diff --git a/Projectiles/Magic/VisceraBeam.cs b/Projectiles/Magic/VisceraBeam.cs index ec6f18ab38..c4d9e740eb 100644 --- a/Projectiles/Magic/VisceraBeam.cs +++ b/Projectiles/Magic/VisceraBeam.cs @@ -1,7 +1,14 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Graphics.Metaballs; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; +using CalamityMod.Balancing; +using System; namespace CalamityMod.Projectiles.Magic { @@ -10,70 +17,139 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public float healAmt = 1f; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = 9; + Projectile.height = 9; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; - Projectile.penetrate = 9; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 300; + Projectile.penetrate = 7; + Projectile.MaxUpdates = 100; + Projectile.timeLeft = 900; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 5; + Projectile.localNPCHitCooldown = -1; } public override bool OnTileCollide(Vector2 oldVelocity) { - healAmt *= 1.25f; - Projectile.penetrate--; - if (Projectile.penetrate <= 0) + if (Projectile.velocity.X != oldVelocity.X) { - Projectile.Kill(); + Projectile.velocity.X = -oldVelocity.X; } - else + if (Projectile.velocity.Y != oldVelocity.Y) { - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y; - } + Projectile.velocity.Y = -oldVelocity.Y; + } + for (int i = 0; i <= 15; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 60 : DustID.Blood); + dust.position = Projectile.Center; + dust.scale = Main.rand.NextFloat(0.8f, 1.3f); + dust.velocity = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.9f); + dust.noGravity = true; } return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) + if (Projectile.ai[1] > 0) + { + SoundStyle hitSound = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); + SoundEngine.PlaySound(hitSound with { Volume = 0.5f }, Projectile.Center); + for (int i = 0; i <= 14; i++) + { + BloodParticle blood = new BloodParticle(Projectile.Center, new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.9f) + new Vector2(0, -7), 60, Main.rand.NextFloat(0.4f, 0.65f), Color.Red); + GeneralParticleHandler.SpawnParticle(blood); + } + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack * 4, Projectile.owner, 0f, Projectile.ai[1]); + + Particle bloodsplosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkRed, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.16f, 0.87f, (int)(Viscera.BoomLifetime * 0.38f), false); + GeneralParticleHandler.SpawnParticle(bloodsplosion); + Particle bloodsplosion2 = new CustomPulse(Projectile.Center, Vector2.Zero, new Color(255, 32, 32), "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.03f, 0.155f, Viscera.BoomLifetime); + GeneralParticleHandler.SpawnParticle(bloodsplosion2); + } + else + { + SoundStyle hitSound = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); + SoundEngine.PlaySound(hitSound with { Volume = 0.7f }, Projectile.Center); + + for (int i = 0; i <= 6; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 60 : DustID.Blood); + dust.scale = Main.rand.NextFloat(0.7f, 1.4f); + dust.velocity = Projectile.velocity.RotatedByRandom(0.5) * Main.rand.NextFloat(0.8f, 1.9f); + dust.noGravity = true; + } + } + + int heal = (int)Math.Round(hit.Damage * 0.05); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - healAmt *= 1.25f; - Player player = Main.player[Projectile.owner]; - player.statLife += (int)healAmt; - player.HealEffect((int)healAmt); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override void AI() { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + if (Projectile.ai[1] > 0) + Projectile.penetrate = 1; + Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 9f) + if (Projectile.localAI[0] == 16f) { - for (int i = 0; i < 4; i++) + if (Projectile.ai[1] > 0) { - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * ((float)i * 0.25f); - int bloody = Dust.NewDust(projPos, 1, 1, DustID.Blood, 0f, 0f, 0, default, 1f); - Main.dust[bloody].position = projPos; - Main.dust[bloody].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[bloody].velocity *= 0.1f; + for (int i = 0; i <= 25; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 60 : DustID.Blood); + dust.scale = Main.rand.NextFloat(0.9f, 1.9f); + dust.velocity = Projectile.velocity.RotatedByRandom(0.6) * Main.rand.NextFloat(1.8f, 2.9f); + dust.noGravity = true; + } + } + else + { + for (int i = 0; i <= 10; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 60 : DustID.Blood); + dust.scale = Main.rand.NextFloat(0.7f, 1.4f); + dust.velocity = Projectile.velocity.RotatedByRandom(0.6) * Main.rand.NextFloat(0.8f, 1.9f); + dust.noGravity = true; + } + } + } + if (Projectile.localAI[0] > 16f) + { + int bloody = Dust.NewDust(Projectile.Center, 1, 1, DustID.Blood); + Main.dust[bloody].position = Projectile.Center + Main.rand.NextVector2Circular(8, 8); + Main.dust[bloody].scale = Main.rand.NextFloat(0.3f, 0.8f); + Main.dust[bloody].velocity = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.6f); + Main.dust[bloody].noGravity = true; + if (Projectile.localAI[0] % 3 == 0 && targetDist < 1400f) + { + AltSparkParticle spark = new AltSparkParticle(Projectile.Center - Projectile.velocity * 0.5f, Projectile.velocity * 0.01f, false, 7, 0.8f, Color.DarkRed); + GeneralParticleHandler.SpawnParticle(spark); + SparkParticle spark2 = new SparkParticle(Projectile.Center - Projectile.velocity * 0.5f, Projectile.velocity * 0.01f, false, 4, 0.65f, Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); } } } + + public override bool PreDraw(ref Color lightColor) + { + return false; + } } } diff --git a/Projectiles/Magic/VisceraBoom.cs b/Projectiles/Magic/VisceraBoom.cs new file mode 100644 index 0000000000..b347d6661c --- /dev/null +++ b/Projectiles/Magic/VisceraBoom.cs @@ -0,0 +1,46 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Projectiles.Magic +{ + public class VisceraBoom : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 250; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.timeLeft = Viscera.BoomLifetime; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + for (int i = 0; i <= 2; i++) + { + float speed = Projectile.ai[1] > 0 ? 25 : 15; + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 60 : DustID.Blood); + dust.scale = Main.rand.NextFloat(1f, 2f) * Utils.GetLerpValue(0, Viscera.BoomLifetime, Projectile.timeLeft, true); + dust.velocity = new Vector2(speed, speed).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.9f); + dust.noGravity = true; + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(ModContent.BuffType(), 180); + } + } +} diff --git a/Projectiles/Magic/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs index accc051ecf..02bf803ff3 100644 --- a/Projectiles/Magic/WaterLeechProj.cs +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.NPCDeath1 with { Volume = SoundID.NPCDeath1.Volume * 0.5f }, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath1 with { Volume = SoundID.NPCDeath1.Volume * 0.5f }, Projectile.Center); for (int i = 0; i < 5; i++) { int dust = Dust.NewDust(Projectile.Center, 1, 1, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 1.5f); diff --git a/Projectiles/Magic/WaywasherProj.cs b/Projectiles/Magic/WaywasherProj.cs index 901d66eec1..83e2a7f9b6 100644 --- a/Projectiles/Magic/WaywasherProj.cs +++ b/Projectiles/Magic/WaywasherProj.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); for (int k = 0; k < 10; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Water, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, new Color(0, 142, 255), 1f); diff --git a/Projectiles/Magic/WyvernFeatherGreen.cs b/Projectiles/Magic/WyvernFeatherGreen.cs index 1f8b783166..2876a50bf9 100644 --- a/Projectiles/Magic/WyvernFeatherGreen.cs +++ b/Projectiles/Magic/WyvernFeatherGreen.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 50; diff --git a/Projectiles/Magic/WyvernFeatherPink.cs b/Projectiles/Magic/WyvernFeatherPink.cs index 155d84a453..f114195e38 100644 --- a/Projectiles/Magic/WyvernFeatherPink.cs +++ b/Projectiles/Magic/WyvernFeatherPink.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 50; diff --git a/Projectiles/Magic/WyvernFeatherPurple.cs b/Projectiles/Magic/WyvernFeatherPurple.cs index 450bd0d6eb..e32b38ff08 100644 --- a/Projectiles/Magic/WyvernFeatherPurple.cs +++ b/Projectiles/Magic/WyvernFeatherPurple.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 50; diff --git a/Projectiles/Magic/YharimsCrystalPrism.cs b/Projectiles/Magic/YharimsCrystalPrism.cs index 09546b5ba5..350e3e519c 100644 --- a/Projectiles/Magic/YharimsCrystalPrism.cs +++ b/Projectiles/Magic/YharimsCrystalPrism.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.soundDelay = SoundInterval; // Don't play the continuous beam sound the first time around if (Projectile.ai[0] > 1f) - SoundEngine.PlaySound(SoundID.Item15, Projectile.position); + SoundEngine.PlaySound(SoundID.Item15, Projectile.Center); } // Once the crystal reaches a certain charge, start producing dust. More charge = more dust. diff --git a/Projectiles/Melee/AftershockRock.cs b/Projectiles/Melee/AftershockRock.cs index 9ee4733f24..8686851e54 100644 --- a/Projectiles/Melee/AftershockRock.cs +++ b/Projectiles/Melee/AftershockRock.cs @@ -1,23 +1,35 @@ using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class AftershockRock : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public override void SetDefaults() { - Projectile.width = 32; - Projectile.height = 34; + Projectile.width = 38; + Projectile.height = 38; Projectile.aiStyle = ProjAIStyleID.GroundProjectile; Projectile.friendly = true; - Projectile.penetrate = 6; - Projectile.extraUpdates = 1; + Projectile.penetrate = 3; + Projectile.MaxUpdates = 3; Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 300 * Projectile.MaxUpdates; Projectile.ignoreWater = true; AIType = ProjectileID.BoulderStaffOfEarth; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; + Projectile.tileCollide = false; + } + + public override void AI() + { + if (Projectile.Center.Y > Projectile.ai[2]) + Projectile.tileCollide = true; + else + Projectile.tileCollide = false; } } } diff --git a/Projectiles/Melee/AmidiasWhirlpool.cs b/Projectiles/Melee/AmidiasWhirlpool.cs index fa667c817c..c7809b793e 100644 --- a/Projectiles/Melee/AmidiasWhirlpool.cs +++ b/Projectiles/Melee/AmidiasWhirlpool.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee } if (homeTracker == 0) { - Projectile.rotation -= 0.104719758f; + Projectile.rotation -= MathHelper.Pi / 30f; if (Projectile.ai[0] >= 30f) { @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee else if (homeTracker == 1) { int inc; - Projectile.rotation -= 0.104719758f; + Projectile.rotation -= MathHelper.Pi / 30f; Vector2 projCenter = Projectile.Center; float homingRange = 150f; bool isHoming = false; diff --git a/Projectiles/Melee/AncientStar.cs b/Projectiles/Melee/AncientStar.cs index 3dec2f0cff..8da00d49e2 100644 --- a/Projectiles/Melee/AncientStar.cs +++ b/Projectiles/Melee/AncientStar.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 256f, 12f, 20f); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index 6aa272412f..edb3f9a73e 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -158,11 +158,11 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(BuffID.OnFire3, 240); if (Projectile.owner == Main.myPlayer) { - for (int k = 0; k < 2; k++) + int maxProjectiles = 2; + for (int k = 0; k < maxProjectiles; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.InfernoFork, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), - (int)(Projectile.damage * 0.35), Projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); + Vector2 flareVelocity = Main.rand.NextVector2CircularEdge(3.5f, 3.5f) + Projectile.oldVelocity; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, flareVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), Projectile.knockBack * 0.35f, Main.myPlayer); } } } diff --git a/Projectiles/Melee/BlazingPhantomBlade.cs b/Projectiles/Melee/BlazingPhantomBlade.cs index cfd9547d08..8fb59967d5 100644 --- a/Projectiles/Melee/BlazingPhantomBlade.cs +++ b/Projectiles/Melee/BlazingPhantomBlade.cs @@ -1,5 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.DataStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -8,58 +13,210 @@ namespace CalamityMod.Projectiles.Melee public class BlazingPhantomBlade : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + internal const int TimeLeft = 210; + + internal const float StartingScale = 1f; + public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.NoMeleeSpeedVelocityScaling[Projectile.type] = true; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - Projectile.width = 50; - Projectile.height = 50; - Projectile.aiStyle = ProjAIStyleID.Sickle; - Projectile.alpha = 100; + Projectile.width = 30; + Projectile.height = 30; + Projectile.alpha = 255; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; Projectile.penetrate = 5; Projectile.ignoreWater = true; - AIType = ProjectileID.DeathSickle; - Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20 * Projectile.MaxUpdates; - Projectile.timeLeft = 210 * Projectile.MaxUpdates; + Projectile.localNPCHitCooldown = 20; + Projectile.timeLeft = TimeLeft; + Projectile.noEnchantmentVisuals = true; + Projectile.scale = StartingScale; } public override void AI() { - Lighting.AddLight(Projectile.Center, 0.6f, 0f, 0f); + // True Night's Edge AI + float fadeInTime = 50f; + float fadeOutTime = 15f; + float timeBeforeFadeOut = Projectile.ai[1] + fadeInTime; + float projectileDuration = timeBeforeFadeOut + fadeOutTime; + float stopDealingDamageTime = TimeLeft - 20; - float homingSpeed = (Projectile.ai[0] == 1f ? 8f : 4f); - CalamityUtils.HomeInOnNPC(Projectile, true, 250f, homingSpeed, 20f); + if (Projectile.localAI[0] == 0f) + SoundEngine.PlaySound(SoundID.Item8, Projectile.Center); + + Projectile.localAI[0] += 1f; + if (Projectile.damage == 0 && Projectile.localAI[0] < MathHelper.Lerp(timeBeforeFadeOut, projectileDuration, 0.5f)) + Projectile.localAI[0] += 6f; + + Projectile.Opacity = Utils.Remap(Projectile.localAI[0], 0f, Projectile.ai[1], 0f, 1f) * Utils.Remap(Projectile.localAI[0], timeBeforeFadeOut, projectileDuration, 1f, 0f); + if (Projectile.localAI[0] >= projectileDuration) + { + Projectile.localAI[1] = 1f; + Projectile.Kill(); + return; + } + + Player player = Main.player[Projectile.owner]; + float fromValue = Projectile.localAI[0] / Projectile.ai[1]; + Projectile.direction = (Projectile.spriteDirection = (int)Projectile.ai[0]); + + if (Projectile.damage != 0 && Projectile.localAI[0] >= stopDealingDamageTime) + Projectile.damage = 0; + + fromValue = Projectile.localAI[0] / Projectile.ai[1]; + Projectile.localAI[1] += 1f; + Projectile.rotation += Projectile.ai[0] * MathHelper.TwoPi * (4f + Projectile.Opacity * 4f) / 90f; + Projectile.scale = Utils.Remap(Projectile.localAI[0], Projectile.ai[1] + 2f, projectileDuration, 1.12f, 1f) * Projectile.ai[2] * StartingScale; + float randomDustSpawnLocation = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; + Vector2 dustPosition = Projectile.Center + randomDustSpawnLocation.ToRotationVector2() * 84f * Projectile.scale; + if (Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustPerfect(dustPosition, DustID.Venom, null, 100, default, 1.4f); + dust.noGravity = true; + dust.velocity *= 0f; + dust.fadeIn = 1.5f; + } + + for (int i = 0; (float)i < 3f * Projectile.Opacity; i++) + { + Vector2 dustVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX); + int dustType = ((Main.rand.NextFloat() < Projectile.Opacity) ? DustID.CrimsonTorch : DustID.RedTorch); + Dust dust = Dust.NewDustPerfect(dustPosition, dustType, Projectile.velocity * 0.2f + dustVelocity * 3f, 100, default, 1.4f); + dust.noGravity = true; + dust.customData = Projectile.Opacity * 0.2f; + } + + // Home in on targets + CalamityUtils.HomeInOnNPC(Projectile, true, 250f, 8f, 15f); + + // Enchantment visual bullshit + Vector2 boxPosition = Projectile.position; + int boxWidth = Projectile.width; + int boxHeight = Projectile.height; + for (float i = -MathHelper.PiOver4; i <= MathHelper.PiOver4; i += MathHelper.PiOver2) + { + Rectangle rect = Utils.CenteredRectangle(Projectile.Center + (Projectile.rotation + i).ToRotationVector2() * 70f * Projectile.scale, new Vector2(60f * Projectile.scale, 60f * Projectile.scale)); + Projectile.EmitEnchantmentVisualsAt(rect.TopLeft(), rect.Width, rect.Height); + } } - public override Color? GetAlpha(Color lightColor) + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - if (Projectile.timeLeft < 85) - { - byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * (b2 / 255f)); - return new Color(b2, b2, b2, a2); - } - return new Color(255, 255, 255, 100); + Vector2 distanceFromTarget = targetHitbox.ClosestPointInRect(Projectile.Center) - Projectile.Center; + distanceFromTarget.SafeNormalize(Vector2.UnitX); + float projectileSize = 100f * Projectile.scale; + if (distanceFromTarget.Length() < projectileSize && Collision.CanHit(Projectile.Center, 0, 0, targetHitbox.Center.ToVector2(), 0, 0)) + return true; + + return null; + } + + public override void CutTiles() + { + Vector2 startPoint = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; + Vector2 endPoint = (Projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; + float projectileSize = 60f * Projectile.scale; + Utils.PlotTileLine(Projectile.Center + startPoint, Projectile.Center + endPoint, projectileSize, DelegateMethods.CutTiles); } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + Texture2D asset = TextureAssets.Projectile[Projectile.type].Value; + Microsoft.Xna.Framework.Rectangle rectangle = asset.Frame(1, 4); + Vector2 origin = rectangle.Size() / 2f; + float num = Projectile.scale * 1.1f; + SpriteEffects effects = ((!(Projectile.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None); + float num2 = 0.975f; + float fromValue = Lighting.GetColor(Projectile.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3D); + fromValue = Utils.Remap(fromValue, 0.2f, 1f, 0f, 1f); + float num3 = MathHelper.Min(0.15f + fromValue * 0.85f, Utils.Remap(Projectile.localAI[0], 30f, 96f, 1f, 0f)); + float num4 = 2f; + for (float num5 = num4; num5 >= 0f; num5 -= 1f) + { + if (!(Projectile.oldPos[(int)num5] == Vector2.Zero)) + { + Vector2 vectorScale = Projectile.Center - Projectile.velocity * 0.5f * num5; + float num6 = Projectile.oldRot[(int)num5] + Projectile.ai[0] * MathHelper.TwoPi * 0.1f * (0f - num5); + Vector2 position = vectorScale - Main.screenPosition; + float num7 = 1f - num5 / num4; + float num8 = Projectile.Opacity * num7 * num7 * 0.85f; + float amount = Projectile.Opacity * Projectile.Opacity; + Color colorOne = Color.Lerp(new Color(40, 60, 20, 120), new Color(225, 40, 25, 120), amount); + Main.spriteBatch.Draw(asset, position, rectangle, colorOne * num3 * num8, num6 + Projectile.ai[0] * MathHelper.PiOver4 * -1f, origin, num * num2, effects, 0f); + Color colorTwo = Color.Lerp(new Color(80, 180, 40), new Color(155, 100, 255), amount); + Color color3 = Color.White * num8 * 0.5f; + color3.A = (byte)((float)(int)color3.A * (1f - num3)); + Color color4 = color3 * num3 * 0.5f; + color4.R = (byte)((float)(int)color4.R * num3); + color4.G = (byte)((float)(int)color4.G * (0.25f + num3 * 0.75f)); + float num9 = 3f; + for (float num10 = -MathHelper.TwoPi + MathHelper.TwoPi / num9; num10 < 0f; num10 += MathHelper.TwoPi / num9) + { + float num11 = Utils.Remap(num10, -MathHelper.TwoPi, 0f, 0f, 0.5f); + Main.spriteBatch.Draw(asset, position, rectangle, color4 * 0.15f * num11, num6 + Projectile.ai[0] * 0.01f + num10, origin, num, effects, 0f); + Main.spriteBatch.Draw(asset, position, rectangle, Color.Lerp(new Color(80, 160, 30), new Color(200, 0, 255), amount) * fromValue * num8 * num11, num6 + num10, origin, num * 0.8f, effects, 0f); + Main.spriteBatch.Draw(asset, position, rectangle, colorTwo * fromValue * num8 * MathHelper.Lerp(0.05f, 0.4f, fromValue) * num11, num6 + num10, origin, num * num2, effects, 0f); + Main.spriteBatch.Draw(asset, position, asset.Frame(1, 4, 0, 3), new Color(200, 150, 255) * MathHelper.Lerp(0.05f, 0.5f, fromValue) * num8 * num11, num6 + num10, origin, num, effects, 0f); + } + + Main.spriteBatch.Draw(asset, position, rectangle, color4 * 0.15f, num6 + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); + Main.spriteBatch.Draw(asset, position, rectangle, Color.Lerp(new Color(80, 160, 30), new Color(255, 100, 0), amount) * num3 * num8, num6, origin, num * 0.8f, effects, 0f); + Main.spriteBatch.Draw(asset, position, rectangle, colorTwo * fromValue * num8 * MathHelper.Lerp(0.05f, 0.4f, num3), num6, origin, num * num2, effects, 0f); + Main.spriteBatch.Draw(asset, position, asset.Frame(1, 4, 0, 3), new Color(255, 75, 100) * MathHelper.Lerp(0.05f, 0.5f, num3) * num8, num6, origin, num, effects, 0f); + } + } + + float num12 = 1f - Projectile.localAI[0] * 1f / 80f; + if (num12 < 0.5f) + num12 = 0.5f; + + float num13 = MathHelper.Min(num3, MathHelper.Lerp(1f, fromValue, Utils.Remap(Projectile.localAI[0], 0f, 80f, 0f, 1f))); + + Texture2D value = TextureAssets.Extra[98].Value; + SpriteEffects dir = SpriteEffects.None; + Vector2 drawpos = Projectile.Center - Main.screenPosition + (Projectile.rotation + (MathHelper.Pi / (20f / 3f)) * Projectile.ai[0]).ToRotationVector2() * ((float)asset.Width * 0.5f - 4f) * num * num12; + Color drawColor = new Color(255, 255, 255, 0) * Projectile.Opacity * 0.5f * num13; + Color shineColor = new Color(255, 75, 50) * num13; + Color color = shineColor * Projectile.Opacity * 0.5f; + color.A = 0; + float flareCounter = Projectile.Opacity; + float fadeInStart = 0f; + float fadeInEnd = 1f; + float fadeOutStart = 1f; + float fadeOutEnd = 2f; + float rotation = MathHelper.PiOver4; + Vector2 scale = new Vector2(2f, 2f); + Vector2 fatness = Vector2.One; + Vector2 origin2 = value.Size() / 2f; + Color color2 = drawColor * 0.5f; + float num14 = Utils.GetLerpValue(fadeInStart, fadeInEnd, flareCounter, clamped: true) * Utils.GetLerpValue(fadeOutEnd, fadeOutStart, flareCounter, clamped: true); + Vector2 vector = new Vector2(fatness.X * 0.5f, scale.X) * num14; + Vector2 vector2 = new Vector2(fatness.Y * 0.5f, scale.Y) * num14; + color *= num14; + color2 *= num14; + Main.EntitySpriteDraw(value, drawpos, null, color, MathHelper.PiOver2 + rotation, origin2, vector, dir); + Main.EntitySpriteDraw(value, drawpos, null, color, 0f + rotation, origin2, vector2, dir); + Main.EntitySpriteDraw(value, drawpos, null, color2, MathHelper.PiOver2 + rotation, origin2, vector * 0.6f, dir); + Main.EntitySpriteDraw(value, drawpos, null, color2, 0f + rotation, origin2, vector2 * 0.6f, dir); + return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.OnFire3, 180); + target.AddBuff(BuffID.Venom, 120); + target.AddBuff(BuffID.OnFire3, 120); } } } diff --git a/Projectiles/Melee/BlazingPhantomBlade.png b/Projectiles/Melee/BlazingPhantomBlade.png index 2041e18546..9a31d6718a 100644 Binary files a/Projectiles/Melee/BlazingPhantomBlade.png and b/Projectiles/Melee/BlazingPhantomBlade.png differ diff --git a/Projectiles/Melee/Blood.cs b/Projectiles/Melee/Blood.cs index ac1fc56714..be9b9a34be 100644 --- a/Projectiles/Melee/Blood.cs +++ b/Projectiles/Melee/Blood.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Balancing; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -41,13 +43,11 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Player player = Main.player[Projectile.owner]; - if (player.moonLeech) + int heal = (int)Math.Round(hit.Damage * 0.075); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - int healAmt = 2; - player.statLife += healAmt; - player.HealEffect(healAmt); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Melee/BrinySpout.cs b/Projectiles/Melee/BrinySpout.cs index 65fabd5e9d..4af8381367 100644 --- a/Projectiles/Melee/BrinySpout.cs +++ b/Projectiles/Melee/BrinySpout.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Melee } if (Projectile.ai[0] <= 0f) { - float swaySize = 0.104719758f; + float swaySize = MathHelper.Pi / 30f; float smolWidth = (float)Projectile.width / 5f; smolWidth *= 2f; float projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; diff --git a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs index 3e9a5d3386..b93ecb467e 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee Owner.velocity = direction.SafeNormalize(Vector2.UnitX * Owner.direction) * LungeSpeed; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(!target.canGhostHeal || Main.player[Projectile.owner].moonLeech); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(Main.player[Projectile.owner].moonLeech); public override void OnHitPlayer(Player target, Player.HurtInfo info) => OnHitEffects(Main.player[Projectile.owner].moonLeech); private void OnHitEffects(bool cannotLifesteal) diff --git a/Projectiles/Melee/CometQuasherMeteor.cs b/Projectiles/Melee/CometQuasherMeteor.cs index d42aa62bcf..77dd35224d 100644 --- a/Projectiles/Melee/CometQuasherMeteor.cs +++ b/Projectiles/Melee/CometQuasherMeteor.cs @@ -4,11 +4,13 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class CometQuasherMeteor : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; @@ -27,6 +29,14 @@ namespace CalamityMod.Projectiles.Melee AIType = ProjectileID.Meteor1; } + public override void AI() + { + if (Projectile.Center.Y > Projectile.ai[2]) + Projectile.tileCollide = true; + else + Projectile.tileCollide = false; + } + public override bool PreDraw(ref Color lightColor) { Texture2D tex = ModContent.Request(Texture).Value; @@ -42,9 +52,12 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item89, Projectile.position); + Projectile.ExpandHitboxBy((int)(128f * Projectile.scale)); + for (int i = 0; i < 8; ++i) Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Smoke, 0.0f, 0.0f, 100, new Color(), 1.5f); + for (int j = 0; j < 32; ++j) { int fieryDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Torch, 0.0f, 0.0f, 100, new Color(), 2.5f); @@ -56,6 +69,7 @@ namespace CalamityMod.Projectiles.Melee dust2.velocity *= 2f; dust2.noGravity = true; } + if (Main.netMode != NetmodeID.Server) { for (int j = 0; j < 2; ++j) @@ -67,6 +81,7 @@ namespace CalamityMod.Projectiles.Melee gore.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; } } + if (Projectile.owner == Main.myPlayer) { Projectile.usesLocalNPCImmunity = true; @@ -75,6 +90,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.maxPenetrate = 0; Projectile.Damage(); } + for (int j = 0; j < 5; ++j) { int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Utils.SelectRandom(Main.rand, new int[3] { 6, 259, 158 }), 2.5f * (float)Projectile.direction, -2.5f, 0, new Color(), 1f); diff --git a/Projectiles/Melee/Cyclone.cs b/Projectiles/Melee/Cyclone.cs index 90e3be2f81..ffd4d3fa0e 100644 --- a/Projectiles/Melee/Cyclone.cs +++ b/Projectiles/Melee/Cyclone.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 56; - Projectile.height = 56; + Projectile.width = 36; + Projectile.height = 36; Projectile.alpha = 255; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; diff --git a/Projectiles/Melee/DNA.cs b/Projectiles/Melee/DNA.cs index 9ba88341f9..a3305715ba 100644 --- a/Projectiles/Melee/DNA.cs +++ b/Projectiles/Melee/DNA.cs @@ -9,8 +9,7 @@ namespace CalamityMod.Projectiles.Melee { public new string LocalizationCategory => "Projectiles.Melee"; - public static int OnHitIFrames = 3; - public static int TotalSegments = 6; + public static int TotalSegments = 10; public override void SetDefaults() { @@ -23,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = -1; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 12; + Projectile.idStaticNPCHitCooldown = 6; } public override void AI() @@ -83,10 +82,5 @@ namespace CalamityMod.Projectiles.Melee { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - Main.player[Projectile.owner].GiveIFrames(OnHitIFrames); - } } } diff --git a/Projectiles/Melee/DarkBeam.cs b/Projectiles/Melee/DarkBeam.cs index 2ad6608281..892b90beb5 100644 --- a/Projectiles/Melee/DarkBeam.cs +++ b/Projectiles/Melee/DarkBeam.cs @@ -1,5 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +10,17 @@ namespace CalamityMod.Projectiles.Melee public class DarkBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + public Player Owner => Main.player[Projectile.owner]; + + private const float MaxVelocity = DarklightGreatsword.ShootSpeed * 12f; + + private const int FadeOutTime = 85; + + private const int TimeLeft = 215 + FadeOutTime; + + private const int Alpha = 100; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; @@ -16,33 +29,52 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 74; - Projectile.height = 74; - Projectile.aiStyle = ProjAIStyleID.Sickle; - AIType = ProjectileID.DeathSickle; + Projectile.width = 36; + Projectile.height = 36; Projectile.friendly = true; + Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.penetrate = -1; // Actually only hits three times, set to infinite so the fade out works still + Projectile.timeLeft = TimeLeft; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 24; + Projectile.alpha = Alpha; } public override void AI() { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.2f / 255f, 0f, (255 - Projectile.alpha) * 0.6f / 255f); + float alphaLightScale = Projectile.alpha / (float)Alpha; + Lighting.AddLight(Projectile.Center, 0.4f * alphaLightScale, 0f, 1.2f * alphaLightScale); - if (Projectile.velocity.Length() < 12f) - Projectile.velocity *= 1.1f; + if (Projectile.timeLeft > FadeOutTime) + { + if (Projectile.velocity.Length() < MaxVelocity) + Projectile.velocity *= 1.055f; + } + else + Projectile.velocity *= 0.95f; + + if (Projectile.velocity.X < 0f) + Projectile.spriteDirection = -1; + + Projectile.rotation += Projectile.direction * 0.05f; + if (Projectile.timeLeft > FadeOutTime) + Projectile.rotation += Projectile.direction * 0.5f; + else + Projectile.rotation += Projectile.direction * 0.5f * (Projectile.timeLeft / (float)FadeOutTime); } public override Color? GetAlpha(Color lightColor) { - if (Projectile.timeLeft < 85) + if (Projectile.timeLeft < FadeOutTime) { byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * (b2 / 255f)); - return new Color(b2, b2, b2, a2); + byte a2 = (byte)(Alpha * ((float)b2 / byte.MaxValue)); + Projectile.alpha = a2; + return new Color(b2, b2, b2, Projectile.alpha); } - return new Color(255, 255, 255, 100); + Projectile.alpha = Alpha; + return new Color(byte.MaxValue, byte.MaxValue, byte.MaxValue, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) @@ -51,27 +83,36 @@ namespace CalamityMod.Projectiles.Melee return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override bool OnTileCollide(Vector2 oldVelocity) { - target.AddBuff(BuffID.Frostburn2, 180); + if (Projectile.timeLeft > FadeOutTime) + { + Projectile.velocity = Projectile.oldVelocity; + Projectile.tileCollide = false; + Projectile.timeLeft = FadeOutTime; + } + + return false; } - public override void OnKill(int timeLeft) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - for (int i = 0; i < 20; i++) + target.AddBuff(BuffID.Frostburn2, 120); + if (Projectile.numHits >= 2) // Fades out after the third hit + Projectile.timeLeft = FadeOutTime; + + int slashCreatorID = ModContent.ProjectileType(); + int damage = (int)(Projectile.damage * DarklightGreatsword.SlashProjectileDamageMultiplier); + float knockback = Projectile.knockBack * DarklightGreatsword.SlashProjectileDamageMultiplier; + if (Owner.ownedProjectileCounts[slashCreatorID] < DarklightGreatsword.SlashProjectileLimit) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 0, default, 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity += Projectile.velocity * 0.1f; - } - if (Projectile.owner == Main.myPlayer) - { - for (int k = 0; k < 3; k++) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), - (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.15f, Main.myPlayer); - } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, slashCreatorID, damage, knockback, Projectile.owner, target.whoAmI, Projectile.rotation, 0f); + Owner.ownedProjectileCounts[slashCreatorID]++; } } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Frostburn2, 120); + + public override bool? CanDamage() => Projectile.timeLeft < FadeOutTime ? false : null; } } diff --git a/Projectiles/Melee/DarklightGreatswordSlash.cs b/Projectiles/Melee/DarklightGreatswordSlash.cs new file mode 100644 index 0000000000..c305ad63cf --- /dev/null +++ b/Projectiles/Melee/DarklightGreatswordSlash.cs @@ -0,0 +1,74 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DarklightGreatswordSlash : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + + public override string Texture => "CalamityMod/Projectiles/Melee/ExobeamSlash"; + + public override void SetDefaults() + { + Projectile.width = 512; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 2; + Projectile.Opacity = 1f; + Projectile.timeLeft = 35; + Projectile.MaxUpdates = 2; + Projectile.scale = 0.75f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 12; + Projectile.noEnchantmentVisuals = true; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.Opacity = Projectile.timeLeft / 35f; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + + public override bool ShouldUpdatePosition() => true; + + public override Color? GetAlpha(Color lightColor) => Color.Lerp(Projectile.ai[2] == 0f ? Color.Cyan : Color.Pink, Projectile.ai[2] == 0f ? Color.DarkBlue : Color.DarkRed, Projectile.identity / 7f % 1f) * Projectile.Opacity; + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.timeLeft >= 34f) + return false; + + Main.spriteBatch.SetBlendState(BlendState.Additive); + + float progress = (33f - Projectile.timeLeft) / 33f; + + Texture2D texture = ModContent.Request(Texture).Value; + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 origin = texture.Size() * 0.5f; + Vector2 scale = new Vector2(MathHelper.Lerp(0.8f, 1.25f, (float)Math.Pow(progress, 0.45)), MathHelper.Lerp(0.6f, 0.24f, (float)Math.Pow(progress, 0.4))) * Projectile.scale; + + // Draw an inner bloom circle to signify power at the center of the strike along with two thinner lines. + Vector2 bloomScale = Projectile.Size / bloomTexture.Size() * new Vector2(1f, 2f); + Vector2 bloomOrigin = bloomTexture.Size() * 0.5f; + Color outerSlashColor = Projectile.ai[2] == 0f ? Color.DarkBlue : Color.DarkRed; + Color innerSlashColor = Projectile.ai[2] == 0f ? Color.Cyan : Color.Pink; + Main.spriteBatch.Draw(bloomTexture, drawPosition, null, outerSlashColor * Projectile.Opacity, Projectile.rotation, bloomOrigin, bloomScale, 0, 0f); + Main.spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, scale, 0, 0f); + Main.spriteBatch.Draw(texture, drawPosition, null, innerSlashColor * Projectile.Opacity, Projectile.rotation, origin, scale * new Vector2(1f, 0.6f), 0, 0f); + + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + return false; + } + } +} diff --git a/Projectiles/Melee/DarklightGreatswordSlashCreator.cs b/Projectiles/Melee/DarklightGreatswordSlashCreator.cs new file mode 100644 index 0000000000..a50f6c4765 --- /dev/null +++ b/Projectiles/Melee/DarklightGreatswordSlashCreator.cs @@ -0,0 +1,63 @@ +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DarklightGreatswordSlashCreator : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + + public NPC Target => Main.npc[(int)Projectile.ai[0]]; + + public float SlashDirection + { + get + { + if (Projectile.ai[1] > MathHelper.Pi) + return Main.rand.NextFloatDirection(); + + return Projectile.ai[1] + Main.rand.NextFloatDirection() * 0.2f; + } + } + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 2; + Projectile.height = 2; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 36; + Projectile.MaxUpdates = 2; + Projectile.noEnchantmentVisuals = true; + } + + public override void AI() + { + if (Projectile.timeLeft % DarklightGreatsword.SlashCreationRate == 0) + { + SoundEngine.PlaySound(CommonCalamitySounds.SwiftSliceSound with { Volume = CommonCalamitySounds.SwiftSliceSound.Volume * 0.5f }, Projectile.Center); + if (Main.myPlayer == Projectile.owner) + { + float maxOffset = Target.width * 0.4f; + if (maxOffset > 300f) + maxOffset = 300f; + + Vector2 spawnOffset = SlashDirection.ToRotationVector2() * Main.rand.NextFloatDirection() * maxOffset; + Vector2 sliceVelocity = spawnOffset.SafeNormalize(Vector2.UnitY) * 0.1f; + + int damage = Projectile.damage; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Target.Center + spawnOffset, sliceVelocity, ModContent.ProjectileType(), damage, 0f, Projectile.owner, 0f, 0f, Projectile.ai[2]); + } + } + } + + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Melee/Earth4.cs b/Projectiles/Melee/Earth4.cs index 06f11738f5..5b0fcb7f26 100644 --- a/Projectiles/Melee/Earth4.cs +++ b/Projectiles/Melee/Earth4.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Balancing; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Terraria; @@ -94,17 +95,11 @@ namespace CalamityMod.Projectiles.Melee { SoundEngine.PlaySound(SoundID.Item4, Projectile.position); - float healAmt = hit.Damage * 0.075f; - if ((int)healAmt == 0) + int heal = (int)Math.Round(hit.Damage * 0.075); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Melee/EmpyreanKnife.cs b/Projectiles/Melee/EmpyreanKnife.cs index 145690182e..60de120f37 100644 --- a/Projectiles/Melee/EmpyreanKnife.cs +++ b/Projectiles/Melee/EmpyreanKnife.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Balancing; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -78,32 +79,20 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - float healAmt = hit.Damage * 0.0075f; - if ((int)healAmt == 0) + int heal = (int)Math.Round(hit.Damage * 0.015); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - float healAmt = info.Damage * 0.005f; - if ((int)healAmt == 0) + int heal = (int)Math.Round(info.Damage * 0.015); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/EssenceScythe.cs b/Projectiles/Melee/EssenceScythe.cs index 9f7be541c7..a69c0b2829 100644 --- a/Projectiles/Melee/EssenceScythe.cs +++ b/Projectiles/Melee/EssenceScythe.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Balancing; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -76,10 +77,10 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); - if (target.life <= 0) + if (target.life <= 0 && target.lifeMax > 5) { if (Projectile.owner == Main.myPlayer) - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 8, ModContent.ProjectileType(), 1200f, 0f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 8, ModContent.ProjectileType(), BalancingConstants.LifeStealRange, 0f); } } } diff --git a/Projectiles/Melee/ExobladeProj.cs b/Projectiles/Melee/ExobladeProj.cs index f8de42349d..7a690b9718 100644 --- a/Projectiles/Melee/ExobladeProj.cs +++ b/Projectiles/Melee/ExobladeProj.cs @@ -2,11 +2,13 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using CalamityMod.Balancing; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; +using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -333,7 +335,7 @@ namespace CalamityMod.Projectiles.Melee // Create a bunch of homing beams. int beamShootStart = (int)(SwingTime * 0.6f); - int beamShootPeriod = (int)(SwingTime * 0.35f); + int beamShootPeriod = (int)(SwingTime * 0.4f); int beamShootEnd = beamShootStart + beamShootPeriod; beamShootPeriod /= (Exoblade.BeamsPerSwing - 1); @@ -615,6 +617,12 @@ namespace CalamityMod.Projectiles.Melee int explosionDamage = (int)(Projectile.damage * Exoblade.ExplosionDamageFactor); Projectile.NewProjectile(Projectile.GetSource_FromAI(), target.Center, Vector2.Zero, ModContent.ProjectileType(), explosionDamage, 0f, Projectile.owner); } + + if (target.lifeMax <= 5 || Owner.lifeSteal <= 0) + return; + + int healAmt = (int)Math.Round(hit.Damage * 0.04); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Owner, healAmt, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } } diff --git a/Projectiles/Melee/Exocomet.cs b/Projectiles/Melee/Exocomet.cs index c65bfe4173..260ef7ea9f 100644 --- a/Projectiles/Melee/Exocomet.cs +++ b/Projectiles/Melee/Exocomet.cs @@ -1,6 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Balancing; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -85,34 +87,22 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(ModContent.BuffType(), 300); - float healAmt = hit.Damage * 0.01f; - if ((int)healAmt == 0) + int heal = (int)Math.Round(hit.Damage * 0.01); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), 300); - float healAmt = info.Damage * 0.01f; - if ((int)healAmt == 0) + int heal = (int)Math.Round(info.Damage * 0.01); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/Feather.cs b/Projectiles/Melee/Feather.cs index eb6841277d..018f788305 100644 --- a/Projectiles/Melee/Feather.cs +++ b/Projectiles/Melee/Feather.cs @@ -3,13 +3,17 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class Feather : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/Magic/TradewindsProjectile"; + private const int TimeLeft = 150; + public override void SetDefaults() { Projectile.width = 14; @@ -17,22 +21,30 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = 1; - Projectile.timeLeft = 150; + Projectile.timeLeft = TimeLeft; Projectile.aiStyle = ProjAIStyleID.Arrow; } public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; + } + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.timeLeft > TimeLeft - 5) + return false; + + return true; } public override void OnKill(int timeLeft) { - int inc; - for (int i = 0; i < 10; i = inc + 1) + for (int i = 0; i < 10; i++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.YellowTorch, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 1f); - inc = i; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.YellowTorch, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; } } } diff --git a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs index 65bd2a9e57..638be16b0c 100644 --- a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs +++ b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +9,15 @@ namespace CalamityMod.Projectiles.Melee public class ForbiddenOathbladeProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const float MaxVelocity = ExaltedOathblade.ShootSpeed * 4f; + + private const int FadeOutTime = 85; + + private const int TimeLeft = 435 + FadeOutTime; + + private const int Alpha = 100; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; @@ -18,23 +28,51 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 46; Projectile.height = 46; - Projectile.aiStyle = ProjAIStyleID.Sickle; - Projectile.alpha = 100; + Projectile.alpha = Alpha; + Projectile.timeLeft = TimeLeft; + Projectile.ignoreWater = true; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = true; Projectile.penetrate = 3; + Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; - AIType = ProjectileID.DemonScythe; + Projectile.localNPCHitCooldown = 20 * Projectile.MaxUpdates; } public override void AI() { - Lighting.AddLight(Projectile.Center, 0.35f, 0f, 0.35f); + float alphaLightScale = Projectile.alpha / (float)Alpha; + Lighting.AddLight(Projectile.Center, 0.5f * alphaLightScale, 0f, 0.5f * alphaLightScale); - if (Main.rand.NextBool(3)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f); + if (Projectile.timeLeft > FadeOutTime) + { + if (Projectile.velocity.Length() < MaxVelocity) + Projectile.velocity *= 1.03f; + } + else + Projectile.velocity *= 0.95f; + + if (Projectile.velocity.X < 0f) + Projectile.spriteDirection = -1; + + Projectile.rotation += Projectile.direction * 0.025f; + if (Projectile.timeLeft > FadeOutTime) + Projectile.rotation += Projectile.direction * 0.25f; + else + Projectile.rotation += Projectile.direction * 0.25f * (Projectile.timeLeft / (float)FadeOutTime); + } + + public override Color? GetAlpha(Color lightColor) + { + if (Projectile.timeLeft < FadeOutTime) + { + byte b2 = (byte)(Projectile.timeLeft * 3); + byte a2 = (byte)(Alpha * ((float)b2 / byte.MaxValue)); + Projectile.alpha = a2; + return new Color(b2, b2, b2, Projectile.alpha); + } + Projectile.alpha = Alpha; + return new Color(byte.MaxValue, byte.MaxValue, byte.MaxValue, Projectile.alpha); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/GayBeam.cs b/Projectiles/Melee/GayBeam.cs index 69b5abc274..e54e028601 100644 --- a/Projectiles/Melee/GayBeam.cs +++ b/Projectiles/Melee/GayBeam.cs @@ -1,9 +1,13 @@ -using System; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.Audio; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -12,27 +16,37 @@ namespace CalamityMod.Projectiles.Melee public class GayBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - private int alpha = 50; - private bool playedSound = false; + + private const int Alpha = 100; + + private const int TimeLeft = 600; + + private const int TrailLength = 36; + + private const int TotalAfterimages = 12; + + private const int AfterimageOffset = TrailLength / TotalAfterimages; + + private const float MaxVelocity = 24f; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = TrailLength; } public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.ignoreWater = true; - Projectile.penetrate = 3; + Projectile.penetrate = 1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; - Projectile.timeLeft = 1200; - Projectile.extraUpdates = 3; + Projectile.localNPCHitCooldown = 10; + Projectile.timeLeft = TimeLeft; + Projectile.alpha = Alpha; } public override void SendExtraAI(BinaryWriter writer) @@ -50,89 +64,69 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - if (!playedSound) - { - SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); - playedSound = true; - } - if (Projectile.localAI[0] == 0f) - { - Projectile.scale -= 0.01f; - Projectile.alpha += 15; - if (Projectile.alpha >= 250) - { - Projectile.alpha = 255; - Projectile.localAI[0] = 1f; - } - } - else if (Projectile.localAI[0] == 1f) - { - Projectile.scale += 0.01f; - Projectile.alpha -= 15; - if (Projectile.alpha <= 0) - { - Projectile.alpha = 0; - Projectile.localAI[0] = 0f; - } - } - Color color = new Color(255, 0, 0, alpha); + if (Projectile.ai[2] == 0f) + SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); + + Color color = GetProjectileColor(); switch ((int)Projectile.ai[0]) { case 0: // Red, normal beam break; case 1: // Orange, curve back to player - color = new Color(255, 128, 0, alpha); - int p = (int)Player.FindClosest(Projectile.Center, 1, 1); + int player = (int)Player.FindClosest(Projectile.Center, 1, 1); Projectile.ai[1] += 1f; - if (Projectile.ai[1] < 220f && Projectile.ai[1] > 60f) + if (Projectile.ai[1] < 360f && Projectile.ai[1] > 60f) { float homeSpeed = Projectile.velocity.Length(); - Vector2 vecToPlayer = Main.player[p].Center - Projectile.Center; - vecToPlayer.Normalize(); + Vector2 vecToPlayer = Main.player[player].Center - Projectile.Center; + vecToPlayer = vecToPlayer.SafeNormalize(Vector2.UnitY); vecToPlayer *= homeSpeed; - Projectile.velocity = (Projectile.velocity * 24f + vecToPlayer) / 25f; - Projectile.velocity.Normalize(); + Projectile.velocity = (Projectile.velocity * 29f + vecToPlayer) / 30f; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); Projectile.velocity *= homeSpeed; } - if (Projectile.velocity.Length() < 24f) + if (Projectile.velocity.Length() < MaxVelocity) { - Projectile.velocity *= 1.02f; + Projectile.velocity *= 1.01f; + if (Projectile.velocity.Length() > MaxVelocity) + { + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); + Projectile.velocity *= MaxVelocity; + } } break; case 2: // Yellow, split after a certain time - color = new Color(255, 255, 0, alpha); Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] >= 180f) + if (Projectile.localAI[1] >= 45f) { - Projectile.localAI[1] = 0f; int numProj = 2; float rotation = MathHelper.ToRadians(10); if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed * 0.5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed * MaxVelocity, Projectile.type, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner); } } + Projectile.Kill(); } break; case 3: // Lime, home in on player within certain distance - color = new Color(128, 255, 0, alpha); - float inertia = 75f; - float homingSpeed = 7.5f; - float minDist = 80f; + float inertia = 30f; + float homingSpeed = MaxVelocity; + float minDist = 300f; if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { if (Projectile.Distance(Main.player[Projectile.owner].Center) > minDist) @@ -144,88 +138,81 @@ namespace CalamityMod.Projectiles.Melee else { if (Projectile.timeLeft > 30) - { Projectile.timeLeft = 30; - } } break; case 4: // Green, home in on enemies - color = new Color(0, 255, 0, alpha); - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 6f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, false, 600f, MaxVelocity, 30f); break; case 5: // Turquoise, speed up and don't collide with tiles - color = new Color(0, 255, 128, alpha); Projectile.tileCollide = false; - if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 28f) + if (Projectile.velocity.Length() < MaxVelocity) { - Projectile.velocity *= 1.035f; + Projectile.velocity *= 1.03f; + if (Projectile.velocity.Length() > MaxVelocity) + { + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); + Projectile.velocity *= MaxVelocity; + } } break; case 6: // Cyan, upon death create several turquoise swords - color = new Color(0, 255, 255, alpha); - break; - case 7: // Light Blue, slow down on hit - color = new Color(0, 128, 255, alpha); - break; - case 8: // Blue, bounce off of tiles and enemies - color = new Color(0, 0, 255, alpha); break; case 9: // Purple, speed up and slow down over and over - color = new Color(128, 0, 255, alpha); - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] <= 40f) - { + if (Projectile.localAI[1] < 30f) Projectile.velocity *= 0.95f; - } - else if (Projectile.localAI[1] > 40f && Projectile.localAI[1] <= 79f) - { - Projectile.velocity *= 1.05f; - } - else if (Projectile.localAI[1] == 80f) - { - Projectile.localAI[1] = 0f; - } + else if (Projectile.localAI[1] < 60f) + Projectile.velocity *= 1.07f; + else if (Projectile.localAI[1] == 60f) + Projectile.localAI[1] = -1f; + Projectile.localAI[1] += 1f; break; case 10: // Fuschia, start slow then get faster - color = new Color(255, 0, 255, alpha); if (Projectile.localAI[1] == 0f) { Projectile.velocity *= 0.1f; Projectile.localAI[1] += 1f; } - Projectile.velocity *= 1.01f; + + if (Projectile.velocity.Length() < MaxVelocity) + { + Projectile.velocity *= 1.05f; + if (Projectile.velocity.Length() > MaxVelocity) + { + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); + Projectile.velocity *= MaxVelocity; + } + } break; case 11: // Hot Pink, split into fuschia while travelling - color = new Color(255, 0, 128, alpha); if (Projectile.localAI[1] == 0f) + Projectile.velocity *= 0.333f; + + if (Projectile.localAI[1] >= 45f) { - Projectile.velocity *= 0.33f; + Projectile.localAI[1] = 0f; + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.oldVelocity, Projectile.velocity, Projectile.type, (int)Math.Round(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 10f, 0f); } Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] >= 181f) - { - Projectile.localAI[1] = 1f; - if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.velocity, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, 10f, 0f); - } break; @@ -233,39 +220,69 @@ namespace CalamityMod.Projectiles.Melee break; } - if (Main.rand.NextBool()) + Projectile.ai[2] += MathHelper.Lerp(1f, 2f, Projectile.ai[0] / 11f); + if (Projectile.ai[2] > 7f) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowMk2, 0f, 0f, alpha, color, 1.5f); - Main.dust[dust].noGravity = true; + Dust rainbow = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.RainbowMk2, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, 1.25f)]; + rainbow.velocity *= -0.25f; + rainbow.color = color; + rainbow.color.A = 100; + rainbow.scale = Main.rand.NextFloat(1f, 1.25f); + rainbow.fadeIn = Main.rand.NextFloat(0.4f, 1f); + rainbow.noGravity = true; + rainbow.noLightEmittence = true; + + rainbow = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.RainbowMk2, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, 1.25f)]; + rainbow.velocity *= -0.25f; + rainbow.color = color; + rainbow.color.A = 100; + rainbow.scale = Main.rand.NextFloat(1f, 1.25f); + rainbow.fadeIn = Main.rand.NextFloat(0.4f, 1f); + rainbow.noGravity = true; + rainbow.position -= Projectile.velocity * 0.5f; + rainbow.noLightEmittence = true; + + if (Projectile.localAI[0] == 0f) + { + Projectile.scale -= 0.02f; + Projectile.alpha += 5; + if (Projectile.alpha >= Alpha - 5) + { + Projectile.alpha = Alpha; + Projectile.localAI[0] = 1f; + } + } + else if (Projectile.localAI[0] == 1f) + { + Projectile.scale += 0.02f; + Projectile.alpha -= 5; + if (Projectile.alpha <= 0) + { + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; + } + } } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 600); + target.AddBuff(ModContent.BuffType(), 300); if (Projectile.ai[0] == 7f) - { - Projectile.velocity *= 0.25f; - } + Projectile.velocity *= 0.5f; else if (Projectile.ai[0] == 8f) - { Projectile.velocity *= -1f; - } } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), 600); + target.AddBuff(ModContent.BuffType(), 300); if (Projectile.ai[0] == 7f) - { - Projectile.velocity *= 0.25f; - } + Projectile.velocity *= 0.5f; else if (Projectile.ai[0] == 8f) - { Projectile.velocity *= -1f; - } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -273,153 +290,181 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.ai[0] == 8f) { if (Projectile.velocity.X != oldVelocity.X) - { Projectile.velocity.X = -oldVelocity.X; - } if (Projectile.velocity.Y != oldVelocity.Y) - { Projectile.velocity.Y = -oldVelocity.Y; - } + return false; } + return true; } - public override Color? GetAlpha(Color lightColor) + public Color TrailColor(float completionRatio) { - Color color = new Color(255, 0, 0, alpha); - switch ((int)Projectile.ai[0]) - { - case 0: // Red - break; - case 1: // Orange - color = new Color(255, 128, 0, alpha); - break; - case 2: // Yellow - color = new Color(255, 255, 0, alpha); - break; - case 3: // Lime - color = new Color(128, 255, 0, alpha); - break; - case 4: // Green - color = new Color(0, 255, 0, alpha); - break; - case 5: // Turquoise - color = new Color(0, 255, 128, alpha); - break; - case 6: // Cyan - color = new Color(0, 255, 255, alpha); - break; - case 7: // Light Blue - color = new Color(0, 128, 255, alpha); - break; - case 8: // Blue - color = new Color(0, 0, 255, alpha); - break; - case 9: // Purple - color = new Color(128, 0, 255, alpha); - break; - case 10: // Fuschia - color = new Color(255, 0, 255, alpha); - break; - case 11: // Hot Pink - color = new Color(255, 0, 128, alpha); - break; - default: - break; - } + float hue = (Main.GlobalTimeWrappedHourly * -0.62f + completionRatio * 1.5f) % 1f; + float brightness = MathHelper.SmoothStep(0.5f, 1f, Utils.GetLerpValue(0.3f, 0f, completionRatio, true)); + float opacity = Utils.GetLerpValue(1f, 0.8f, completionRatio, true) * ((255 - Projectile.alpha) / 255f); + Color color = GetProjectileColor() * opacity; + color.A = (byte)(int)(Utils.GetLerpValue(0f, 0.2f, completionRatio) * 128); return color; } + public float TrailWidth(float completionRatio) + { + float widthInterpolant = Utils.GetLerpValue(0f, 0.25f, completionRatio, true) * Utils.GetLerpValue(1.1f, 0.7f, completionRatio, true); + return MathHelper.SmoothStep(0f, 14f, widthInterpolant) * Projectile.scale; + } + + public override Color? GetAlpha(Color lightColor) => GetProjectileColor(); + public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 1195) + if (Projectile.timeLeft > TimeLeft - 5) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + Main.spriteBatch.EnterShaderRegion(); + + GameShaders.Misc["CalamityMod:ArtAttack"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:ArtAttack"].Apply(); + + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidth, TrailColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ArtAttack"]), TrailLength); + + Main.spriteBatch.ExitShaderRegion(); + + Texture2D texture = TextureAssets.Projectile[Projectile.type].Value; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int frameY = frameHeight * Projectile.frame; + float scale = Projectile.scale; + Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); + Vector2 origin = rectangle.Size() / 2f; + Color alphaColor = Projectile.GetAlpha(lightColor); + + if (CalamityConfig.Instance.Afterimages) + { + Vector2 centerOffset = Projectile.Size / 2f; + int totalAfterimages = TotalAfterimages; + for (int i = 0; i < totalAfterimages; i++) + { + int arrayPos = i * AfterimageOffset; + float afterimageRot = Projectile.oldRot[arrayPos]; + SpriteEffects sfxForThisAfterimage = Projectile.oldSpriteDirection[arrayPos] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 drawPos = Projectile.oldPos[arrayPos] + centerOffset - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + float colorAndSizeScalar = (float)(totalAfterimages - i) / (float)totalAfterimages; + Color color = alphaColor * colorAndSizeScalar; + float afterimageScale = scale * MathHelper.Lerp(0.5f, 1f, colorAndSizeScalar); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, origin, afterimageScale, sfxForThisAfterimage, 0f); + } + } + else + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (Projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), rectangle, alphaColor, Projectile.rotation, origin, scale, spriteEffects, 0f); + } + return false; } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - Projectile.ExpandHitboxBy(64); - Projectile.maxPenetrate = Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - Color color = new Color(255, 0, 0, alpha); + Color color = GetProjectileColor(); switch ((int)Projectile.ai[0]) { case 0: // Red - break; case 1: // Orange - color = new Color(255, 128, 0, alpha); - break; case 2: // Yellow - color = new Color(255, 255, 0, alpha); - break; case 3: // Lime - color = new Color(128, 255, 0, alpha); - break; case 4: // Green - color = new Color(0, 255, 0, alpha); - break; case 5: // Turquoise - color = new Color(0, 255, 128, alpha); break; case 6: // Cyan - color = new Color(0, 255, 255, alpha); - for (int x = 0; x < 3; x++) + for (int x = 0; x < 2; x++) { - bool fromRight = x == 1; - if (x == 2) - fromRight = Main.rand.NextBool(); if (Projectile.owner == Main.myPlayer) { var source = Projectile.GetSource_FromThis(); - CalamityUtils.ProjectileBarrage(source, Projectile.Center, Projectile.Center, fromRight, 500f, 500f, 0f, 500f, 5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.2), Projectile.knockBack * 0.2f, Projectile.owner, false, 0f).ai[0] = 5f; + CalamityUtils.ProjectileBarrage(source, Projectile.Center, Projectile.Center, x == 1, 500f, 500f, 0f, 500f, MaxVelocity, Projectile.type, (int)Math.Round(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, false, 0f).ai[0] = 5f; } } break; case 7: // Light Blue - color = new Color(0, 128, 255, alpha); - break; case 8: // Blue - color = new Color(0, 0, 255, alpha); - break; case 9: // Purple - color = new Color(128, 0, 255, alpha); - break; case 10: // Fuschia - color = new Color(255, 0, 255, alpha); - break; case 11: // Hot Pink - color = new Color(255, 0, 128, alpha); - break; default: break; } - for (int d = 0; d < 3; d++) + int totalDust = 60; + for (int i = 4; i < totalDust + 1; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowMk2, 0f, 0f, alpha, color, 1.5f); - Main.dust[dust].noGravity = true; + Vector2 oldVel = Projectile.oldVelocity * (totalDust / (float)i); + Dust rainbow = Main.dust[Dust.NewDust(Projectile.oldPosition - oldVel * 0.5f, 8, 8, DustID.RainbowMk2, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha)]; + rainbow.color = color; + rainbow.color.A = 100; + rainbow.scale = Main.rand.NextFloat(2.4f, 3.6f); + rainbow.fadeIn = Main.rand.NextFloat(0.4f, 1f); + rainbow.noGravity = true; + rainbow.velocity *= (Main.rand.NextBool() ? 0.05f : 0.5f); } - for (int d = 0; d < 30; d++) + } + + private Color GetProjectileColor() + { + Color rainbow = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Alpha); + Color color = Color.White; + switch ((int)Projectile.ai[0]) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowMk2, 0f, 0f, alpha, color, 2.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 3f; - dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowMk2, 0f, 0f, alpha, color, 1.5f); - Main.dust[dust].velocity *= 2f; - Main.dust[dust].noGravity = true; + case 0: // Red + color = new Color(255, 0, 0, Alpha); + break; + case 1: // Orange + color = new Color(255, 128, 0, Alpha); + break; + case 2: // Yellow + color = new Color(255, 255, 0, Alpha); + break; + case 3: // Lime + color = new Color(128, 255, 0, Alpha); + break; + case 4: // Green + color = new Color(0, 255, 0, Alpha); + break; + case 5: // Turquoise + color = new Color(0, 255, 128, Alpha); + break; + case 6: // Cyan + color = new Color(0, 255, 255, Alpha); + break; + case 7: // Light Blue + color = new Color(0, 128, 255, Alpha); + break; + case 8: // Blue + color = new Color(0, 0, 255, Alpha); + break; + case 9: // Purple + color = new Color(128, 0, 255, Alpha); + break; + case 10: // Fuschia + color = new Color(255, 0, 255, Alpha); + break; + case 11: // Hot Pink + color = new Color(255, 0, 128, Alpha); + break; + default: + break; } + return Color.Lerp(rainbow, color, (float)Math.Sqrt((MathF.Cos(Projectile.ai[2] / 90f) + 1f) * 0.5f)); } } } diff --git a/Projectiles/Melee/GhastlySoulLarge.cs b/Projectiles/Melee/GhastlySoulLarge.cs index a8165ed4b7..3fdd5216a3 100644 --- a/Projectiles/Melee/GhastlySoulLarge.cs +++ b/Projectiles/Melee/GhastlySoulLarge.cs @@ -1,7 +1,9 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,71 +14,83 @@ namespace CalamityMod.Projectiles.Melee public class GhastlySoulLarge : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 660; + private float HomingBuff = 1; + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { Projectile.width = 30; Projectile.height = 30; - Projectile.scale = 1.2f; Projectile.alpha = 100; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; - Projectile.extraUpdates = 1; Projectile.penetrate = 1; - Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; + Projectile.timeLeft = TimeLeft; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 0; } public override void AI() { + if (HomingBuff > 0) + HomingBuff -= 0.01f; + Projectile.frameCounter++; if (Projectile.frameCounter > 6) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame > 3) - { + if (Projectile.frame >= Main.projFrames[Projectile.type]) Projectile.frame = 0; - } - int ghostlyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[ghostlyDust]; - dust.velocity *= 0.1f; - Main.dust[ghostlyDust].scale = 1.3f; - Main.dust[ghostlyDust].noGravity = true; - float projVelocityFactor = 30f * Projectile.ai[1]; //100 - float scaleFactor = 6f * Projectile.ai[1]; //5 - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; + Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); + + if (Projectile.timeLeft % 2 == 0 && Projectile.timeLeft < TimeLeft - 10) + { + SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(15, 15) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * Main.rand.NextFloat(0.5f, 1.5f), false, Main.rand.Next(9, 12 + 1), 0.4f, Color.Plum); + GeneralParticleHandler.SpawnParticle(spark); + } + + float inertia = MathHelper.Lerp(20, 90, HomingBuff) * Projectile.ai[1]; + float velocity = VoidEdge.ShootSpeed * Projectile.ai[1]; if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (Projectile.Distance(Main.player[Projectile.owner].Center) > 900f) + float homingDistance = 900f; + NPC target = Projectile.FindTargetWithinRange(homingDistance); + if (Projectile.timeLeft < TimeLeft - VoidEdge.ProjectileSpreadOutTime && target != null) + { + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, homingDistance, velocity, inertia); + } + else if (Projectile.Distance(Main.player[Projectile.owner].Center) > homingDistance) { Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (projVelocityFactor - 1f) + moveDirection * scaleFactor) / projVelocityFactor; - return; + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * velocity) / inertia; } - - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); } else { if (Projectile.timeLeft > 30) - { Projectile.timeLeft = 30; - } } + + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.PiOver2; } public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 595) + if (Projectile.timeLeft > TimeLeft - 5) return false; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); @@ -94,33 +108,38 @@ namespace CalamityMod.Projectiles.Melee return new Color(255, 255, 255, 100); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - target.AddBuff(ModContent.BuffType(), 180); + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.88f); + if (Projectile.damage < 1) + Projectile.damage = 1; } public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 112; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.maxPenetrate = -1; + Projectile.damage = (int)(Projectile.damage / VoidEdge.TotalProjectilesPerSwing); Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.ExpandHitboxBy(230); Projectile.Damage(); - SoundEngine.PlaySound(SoulEdge.ProjectileDeathSound, Projectile.Center); - int dustAmt = 36; - for (int i = 0; i < dustAmt; i++) + SoundEngine.PlaySound(VoidEdge.ProjectileDeathSound with { Pitch = -0.3f }, Projectile.Center); + + int points = 25; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int k = 0; k < points; k++) { - Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - rotate = rotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; - Vector2 faceDirection = rotate - Projectile.Center; - int killedDust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.ShadowbeamStaff, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 2f); - Main.dust[killedDust].noGravity = true; - Main.dust[killedDust].noLight = true; - Main.dust[killedDust].velocity = faceDirection; + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando); + LineParticle subTrail = new LineParticle(Projectile.Center + velocity * 20.5f, velocity * 15, false, 30, 0.75f, Color.Plum); + GeneralParticleHandler.SpawnParticle(subTrail); + } + for (int k = 0; k < 17; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 66, new Vector2(14, 14).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.8f)); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + dust2.color = Color.Plum; } } } diff --git a/Projectiles/Melee/GhastlySoulMedium.cs b/Projectiles/Melee/GhastlySoulMedium.cs index 073d864e53..3adef4a491 100644 --- a/Projectiles/Melee/GhastlySoulMedium.cs +++ b/Projectiles/Melee/GhastlySoulMedium.cs @@ -1,7 +1,9 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,71 +14,83 @@ namespace CalamityMod.Projectiles.Melee public class GhastlySoulMedium : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 600; + private float HomingBuff = 1; + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { Projectile.width = 30; Projectile.height = 30; - Projectile.scale = 1.1f; Projectile.alpha = 100; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; - Projectile.extraUpdates = 1; Projectile.penetrate = 1; - Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; + Projectile.timeLeft = TimeLeft; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 0; } public override void AI() { + if (HomingBuff > 0) + HomingBuff -= 0.01f; + Projectile.frameCounter++; if (Projectile.frameCounter > 6) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame > 3) - { + if (Projectile.frame >= Main.projFrames[Projectile.type]) Projectile.frame = 0; - } - int ghostlyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[ghostlyDust]; - dust.velocity *= 0.1f; - Main.dust[ghostlyDust].scale = 1.3f; - Main.dust[ghostlyDust].noGravity = true; - float projVelocityFactor = 35f * Projectile.ai[1]; //100 - float scaleFactor = 7f * Projectile.ai[1]; //5 - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; + Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); + + if (Projectile.timeLeft % 2 == 0 && Projectile.timeLeft < TimeLeft - 10) + { + SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(15, 15) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * Main.rand.NextFloat(0.5f, 1.5f), false, Main.rand.Next(9, 12 + 1), 0.4f, Color.Plum); + GeneralParticleHandler.SpawnParticle(spark); + } + + float inertia = MathHelper.Lerp(20, 90, HomingBuff) * Projectile.ai[1]; + float velocity = VoidEdge.ShootSpeed * VoidEdge.MediumSoulStatMultiplier * Projectile.ai[1]; if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (Projectile.Distance(Main.player[Projectile.owner].Center) > 900f) + float homingDistance = 750f; + NPC target = Projectile.FindTargetWithinRange(homingDistance); + if (Projectile.timeLeft < TimeLeft - VoidEdge.ProjectileSpreadOutTime && target != null) + { + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, homingDistance, velocity, inertia); + } + else if (Projectile.Distance(Main.player[Projectile.owner].Center) > homingDistance) { Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (projVelocityFactor - 1f) + moveDirection * scaleFactor) / projVelocityFactor; - return; + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * velocity) / inertia; } - - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); } else { if (Projectile.timeLeft > 30) - { Projectile.timeLeft = 30; - } } + + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.PiOver2; } public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 595) + if (Projectile.timeLeft > TimeLeft - 5) return false; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); @@ -94,33 +108,38 @@ namespace CalamityMod.Projectiles.Melee return new Color(255, 255, 255, 100); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - target.AddBuff(ModContent.BuffType(), 120); + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.88f); + if (Projectile.damage < 1) + Projectile.damage = 1; } public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 96; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.maxPenetrate = -1; + Projectile.damage = (int)(Projectile.damage / VoidEdge.TotalProjectilesPerSwing); Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.ExpandHitboxBy(140); Projectile.Damage(); - SoundEngine.PlaySound(SoulEdge.ProjectileDeathSound, Projectile.Center); - int dustAmt = 36; - for (int i = 0; i < dustAmt; i++) + SoundEngine.PlaySound(VoidEdge.ProjectileDeathSound, Projectile.Center); + + int points = 20; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int k = 0; k < points; k++) { - Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - rotate = rotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; - Vector2 faceDirection = rotate - Projectile.Center; - int killedDust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.ShadowbeamStaff, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 2f); - Main.dust[killedDust].noGravity = true; - Main.dust[killedDust].noLight = true; - Main.dust[killedDust].velocity = faceDirection; + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando); + LineParticle subTrail = new LineParticle(Projectile.Center + velocity * 15.5f, velocity * 10, false, 25, 0.65f, Color.Plum); + GeneralParticleHandler.SpawnParticle(subTrail); + } + for (int k = 0; k < 12; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 66, new Vector2(9, 9).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.8f)); + dust2.scale = Main.rand.NextFloat(0.85f, 1.25f); + dust2.noGravity = true; + dust2.color = Color.Plum; } } } diff --git a/Projectiles/Melee/GhastlySoulSmall.cs b/Projectiles/Melee/GhastlySoulSmall.cs index fa285b62a8..85845b1d7c 100644 --- a/Projectiles/Melee/GhastlySoulSmall.cs +++ b/Projectiles/Melee/GhastlySoulSmall.cs @@ -1,7 +1,10 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Ammo; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,11 +15,15 @@ namespace CalamityMod.Projectiles.Melee public class GhastlySoulSmall : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 540; + private float HomingBuff = 1; + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() @@ -27,55 +34,64 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; - Projectile.extraUpdates = 1; Projectile.penetrate = 1; - Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; + Projectile.timeLeft = TimeLeft; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 0; } public override void AI() { + if (HomingBuff > 0) + HomingBuff -= 0.01f; + Projectile.frameCounter++; if (Projectile.frameCounter > 6) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame > 3) - { + if (Projectile.frame >= Main.projFrames[Projectile.type]) Projectile.frame = 0; - } - int ghostlyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[ghostlyDust]; - dust.velocity *= 0.1f; - Main.dust[ghostlyDust].scale = 1.3f; - Main.dust[ghostlyDust].noGravity = true; - float projVelocityFactor = 40f * Projectile.ai[1]; //100 - float scaleFactor = 8f * Projectile.ai[1]; //5 - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; + Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); + + if (Projectile.timeLeft % 2 == 0 && Projectile.timeLeft < TimeLeft - 10) + { + SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(15, 15) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * Main.rand.NextFloat(0.5f, 1.5f), false, Main.rand.Next(9, 12 + 1), 0.4f, Color.Plum); + GeneralParticleHandler.SpawnParticle(spark); + } + + float inertia = MathHelper.Lerp(20, 90, HomingBuff) * Projectile.ai[1]; + float velocity = VoidEdge.ShootSpeed * VoidEdge.SmallSoulStatMultiplier * Projectile.ai[1]; if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (Projectile.Distance(Main.player[Projectile.owner].Center) > 900f) + float homingDistance = 600f; + NPC target = Projectile.FindTargetWithinRange(homingDistance); + if (Projectile.timeLeft < TimeLeft - VoidEdge.ProjectileSpreadOutTime && target != null) + { + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, homingDistance, velocity, inertia); + } + else if (Projectile.Distance(Main.player[Projectile.owner].Center) > homingDistance) { Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (projVelocityFactor - 1f) + moveDirection * scaleFactor) / projVelocityFactor; - return; + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * velocity) / inertia; } - - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); } else { if (Projectile.timeLeft > 30) - { Projectile.timeLeft = 30; - } } + + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.PiOver2; } public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 595) + if (Projectile.timeLeft > TimeLeft - 5) return false; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); @@ -93,33 +109,38 @@ namespace CalamityMod.Projectiles.Melee return new Color(255, 255, 255, 100); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - target.AddBuff(ModContent.BuffType(), 60); + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.88f); + if (Projectile.damage < 1) + Projectile.damage = 1; } public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 64; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.maxPenetrate = -1; + Projectile.damage = (int)(Projectile.damage / VoidEdge.TotalProjectilesPerSwing); Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.ExpandHitboxBy(80); Projectile.Damage(); - SoundEngine.PlaySound(SoulEdge.ProjectileDeathSound, Projectile.Center); - int dustAmt = 36; - for (int i = 0; i < dustAmt; i++) + SoundEngine.PlaySound(VoidEdge.ProjectileDeathSound with { Pitch = 0.3f }, Projectile.Center); + + int points = 15; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int k = 0; k < points; k++) { - Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - rotate = rotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; - Vector2 faceDirection = rotate - Projectile.Center; - int killedDust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.ShadowbeamStaff, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 2f); - Main.dust[killedDust].noGravity = true; - Main.dust[killedDust].noLight = true; - Main.dust[killedDust].velocity = faceDirection; + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando); + LineParticle subTrail = new LineParticle(Projectile.Center + velocity * 10.5f, velocity * 5, false, 20, 0.55f, Color.Plum); + GeneralParticleHandler.SpawnParticle(subTrail); + } + for (int k = 0; k < 7; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 66, new Vector2(6, 6).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.8f)); + dust2.scale = Main.rand.NextFloat(0.65f, 0.85f); + dust2.noGravity = true; + dust2.color = Color.Plum; } } } diff --git a/Projectiles/Melee/GreenWater.cs b/Projectiles/Melee/GreenWater.cs index d61cbef0d8..bfbc3c344c 100644 --- a/Projectiles/Melee/GreenWater.cs +++ b/Projectiles/Melee/GreenWater.cs @@ -10,6 +10,9 @@ namespace CalamityMod.Projectiles.Melee public class GreenWater : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 300; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; @@ -24,28 +27,45 @@ namespace CalamityMod.Projectiles.Melee Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = 1; - Projectile.timeLeft = 150; + Projectile.timeLeft = TimeLeft; Projectile.DamageType = DamageClass.Melee; } public override void AI() { - Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0.5f); - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + if (Projectile.ai[1] == 0f) + { + if (Projectile.Center.Y > Projectile.ai[2]) + Projectile.tileCollide = true; + else + Projectile.tileCollide = false; + } + else + { + if (Projectile.Center.Y < Projectile.ai[2]) + Projectile.tileCollide = true; + else + Projectile.tileCollide = false; + } + + Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0f); + + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver4; + if (Projectile.localAI[0] == 0f) { SoundEngine.PlaySound(SoundID.Item21, Projectile.position); Projectile.localAI[0] += 1f; } - int hitDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1f); - Main.dust[hitDust].noGravity = true; - Main.dust[hitDust].velocity *= 0.5f; - Main.dust[hitDust].velocity += Projectile.velocity * 0.1f; + + int blood = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, Main.rand.NextFloat(1.6f, 2.4f)); + Main.dust[blood].noGravity = true; + Main.dust[blood].velocity *= 0.5f; } public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 145) + if (Projectile.timeLeft > TimeLeft - 5) return false; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); @@ -54,9 +74,9 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - int inc; - for (int i = 4; i < 31; i = inc + 1) + SoundEngine.PlaySound(SoundID.NPCDeath12, Projectile.Center); + + for (int i = 4; i < 31; i++) { float oldXPos = Projectile.oldVelocity.X * (30f / (float)i); float oldYPos = Projectile.oldVelocity.Y * (30f / (float)i); @@ -67,13 +87,9 @@ namespace CalamityMod.Projectiles.Melee killDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXPos, Projectile.oldPosition.Y - oldYPos), 8, 8, DustID.Blood, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust = Main.dust[killDust]; dust.velocity *= 0.05f; - inc = i; } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Venom, 90); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 90); } } diff --git a/Projectiles/Melee/IceBombFriendly.cs b/Projectiles/Melee/IceBombFriendly.cs index 2b386b3ec7..167db4a929 100644 --- a/Projectiles/Melee/IceBombFriendly.cs +++ b/Projectiles/Melee/IceBombFriendly.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; Projectile.timeLeft = 180; + Projectile.tileCollide = false; } public override bool? CanDamage() => Projectile.ai[0] >= 120f; diff --git a/Projectiles/Melee/IllustriousKnife.cs b/Projectiles/Melee/IllustriousKnife.cs index 954531adef..878aa9c94e 100644 --- a/Projectiles/Melee/IllustriousKnife.cs +++ b/Projectiles/Melee/IllustriousKnife.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; @@ -75,34 +76,22 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(ModContent.BuffType(), 180); - float healAmt = hit.Damage * 0.015f; - if ((int)healAmt == 0) + int heal = (int)Math.Round(hit.Damage * 0.015); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), 180); - float healAmt = info.Damage * 0.015f; - if ((int)healAmt == 0) + int heal = (int)Math.Round(info.Damage * 0.015); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/LightBeam.cs b/Projectiles/Melee/LightBeam.cs index 4202597662..7cda4ee00d 100644 --- a/Projectiles/Melee/LightBeam.cs +++ b/Projectiles/Melee/LightBeam.cs @@ -1,5 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +10,17 @@ namespace CalamityMod.Projectiles.Melee public class LightBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + public Player Owner => Main.player[Projectile.owner]; + + private const float MaxVelocity = DarklightGreatsword.ShootSpeed * 12f; + + private const int FadeOutTime = 85; + + private const int TimeLeft = 215 + FadeOutTime; + + private const int Alpha = 100; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; @@ -16,33 +29,52 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 74; - Projectile.height = 74; - Projectile.aiStyle = ProjAIStyleID.Sickle; - AIType = ProjectileID.DeathSickle; + Projectile.width = 36; + Projectile.height = 36; Projectile.friendly = true; + Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.penetrate = -1; // Actually only hits three times, set to infinite so the fade out works still + Projectile.timeLeft = TimeLeft; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 24; + Projectile.alpha = Alpha; } public override void AI() { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.6f / 255f, 0f, (255 - Projectile.alpha) * 0.2f / 255f); + float alphaLightScale = Projectile.alpha / (float)Alpha; + Lighting.AddLight(Projectile.Center, 1.2f * alphaLightScale, 0f, 0.4f * alphaLightScale); - if (Projectile.velocity.Length() < 18f) - Projectile.velocity *= 1.1f; + if (Projectile.timeLeft > FadeOutTime) + { + if (Projectile.velocity.Length() < MaxVelocity) + Projectile.velocity *= 1.055f; + } + else + Projectile.velocity *= 0.925f; + + if (Projectile.velocity.X < 0f) + Projectile.spriteDirection = -1; + + Projectile.rotation += Projectile.direction * 0.05f; + if (Projectile.timeLeft > FadeOutTime) + Projectile.rotation += Projectile.direction * 0.5f; + else + Projectile.rotation += Projectile.direction * 0.5f * (Projectile.timeLeft / (float)FadeOutTime); } public override Color? GetAlpha(Color lightColor) { - if (Projectile.timeLeft < 85) + if (Projectile.timeLeft < FadeOutTime) { byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * (b2 / 255f)); - return new Color(b2, b2, b2, a2); + byte a2 = (byte)(Alpha * ((float)b2 / byte.MaxValue)); + Projectile.alpha = a2; + return new Color(b2, b2, b2, Projectile.alpha); } - return new Color(255, 255, 255, 100); + Projectile.alpha = Alpha; + return new Color(byte.MaxValue, byte.MaxValue, byte.MaxValue, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) @@ -51,27 +83,36 @@ namespace CalamityMod.Projectiles.Melee return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override bool OnTileCollide(Vector2 oldVelocity) { - target.AddBuff(BuffID.OnFire, 240); + if (Projectile.timeLeft > FadeOutTime) + { + Projectile.velocity = Projectile.oldVelocity; + Projectile.tileCollide = false; + Projectile.timeLeft = FadeOutTime; + } + + return false; } - public override void OnKill(int timeLeft) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - for (int i = 0; i < 20; i++) + target.AddBuff(BuffID.OnFire3, 120); + if (Projectile.numHits >= 2) // Fades out after the third hit + Projectile.timeLeft = FadeOutTime; + + int slashCreatorID = ModContent.ProjectileType(); + int damage = (int)(Projectile.damage * DarklightGreatsword.SlashProjectileDamageMultiplier); + float knockback = Projectile.knockBack * DarklightGreatsword.SlashProjectileDamageMultiplier; + if (Owner.ownedProjectileCounts[slashCreatorID] < DarklightGreatsword.SlashProjectileLimit) { - int pinkish = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PinkFairy, 0f, 0f, 0, default, 1f); - Main.dust[pinkish].noGravity = true; - Main.dust[pinkish].velocity += Projectile.velocity * 0.1f; - } - if (Projectile.owner == Main.myPlayer) - { - for (int k = 0; k < 3; k++) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), - (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.15f, Main.myPlayer, 1f, 0f); - } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, slashCreatorID, damage, knockback, Projectile.owner, target.whoAmI, Projectile.rotation, 1f); + Owner.ownedProjectileCounts[slashCreatorID]++; } } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire3, 120); + + public override bool? CanDamage() => Projectile.timeLeft < FadeOutTime ? false : null; } } diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs index ecc17c9f5f..d1288ec255 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Melee Owner.GiveIFrames(TrueBiomeBlade.EvilAttunement_SlashIFrames); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(!target.canGhostHeal || Main.player[Projectile.owner].moonLeech); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(Main.player[Projectile.owner].moonLeech); public override void OnHitPlayer(Player target, Player.HurtInfo info) => OnHitEffects(Main.player[Projectile.owner].moonLeech); private void OnHitEffects(bool cannotLifesteal) diff --git a/Projectiles/Melee/MonstrousKnife.cs b/Projectiles/Melee/MonstrousKnife.cs index 34d9d1498e..6570a19aa9 100644 --- a/Projectiles/Melee/MonstrousKnife.cs +++ b/Projectiles/Melee/MonstrousKnife.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Balancing; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -48,46 +49,20 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Main.myPlayer != Projectile.owner) + int heal = (int)Math.Round(hit.Damage * Main.rand.NextFloat(0.05f, 0.1f)); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - if (target.lifeMax <= 5 || Main.player[Projectile.owner].moonLeech) - return; - - if (Main.player[Projectile.owner].lifeSteal <= 0f) - return; - - float healAmt = hit.Damage * Main.rand.NextFloat(0.075f, 0.9f); - if (healAmt < 1f) - healAmt = 1f; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - if (Main.rand.NextBool(3)) - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - if (Main.myPlayer != Projectile.owner) + int heal = (int)Math.Round(info.Damage * Main.rand.NextFloat(0.05f, 0.1f)); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - if (Main.player[Projectile.owner].moonLeech) - return; - - if (Main.player[Projectile.owner].lifeSteal <= 0f) - return; - - float healAmt = info.Damage * Main.rand.NextFloat(0.075f, 0.9f); - if (healAmt < 1f) - healAmt = 1f; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - if (Main.rand.NextBool(3)) - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Melee/RainBolt.cs b/Projectiles/Melee/RainBolt.cs index dded261f56..f5dac61a82 100644 --- a/Projectiles/Melee/RainBolt.cs +++ b/Projectiles/Melee/RainBolt.cs @@ -3,13 +3,19 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class RainBolt : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private const int TimeLeft = 180; + + private const int HomingTime = TimeLeft - 30; + public override void SetDefaults() { Projectile.width = 10; @@ -17,10 +23,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; - Projectile.timeLeft = 180; + Projectile.timeLeft = TimeLeft; } - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < HomingTime && target.CanBeChasedBy(Projectile); public override void AI() { @@ -34,7 +40,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[rainbow].noGravity = true; Main.dust[rainbow].velocity *= 0f; - if (Projectile.timeLeft < 150) + if (Projectile.timeLeft < HomingTime) CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 12f, 20f); else Projectile.velocity *= 0.95f; @@ -45,9 +51,8 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); for (int k = 0; k < 5; k++) { - int rain = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)); + int rain = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)); Main.dust[rain].noGravity = true; - Main.dust[rain].velocity *= 4f; } } } diff --git a/Projectiles/Melee/RainbowBoom.cs b/Projectiles/Melee/RainbowBoom.cs index a5bfc69ab9..bb7eda7abd 100644 --- a/Projectiles/Melee/RainbowBoom.cs +++ b/Projectiles/Melee/RainbowBoom.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.Melee public class RainbowBoom : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() @@ -27,38 +28,16 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - bool xflag = false; - bool yflag = false; - if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) - { - xflag = true; - } - if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) - { - xflag = true; - } - if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) - { - yflag = true; - } - if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) - { - yflag = true; - } - if (xflag && yflag) - { - Projectile.Kill(); - } float projTimer = 25f; if (Projectile.ai[0] > 180f) - { projTimer -= (Projectile.ai[0] - 180f) / 2f; - } + if (projTimer <= 0f) { projTimer = 0f; Projectile.Kill(); } + projTimer *= 0.7f; Projectile.ai[0] += 4f; int timerCounter = 0; @@ -75,19 +54,12 @@ namespace CalamityMod.Projectiles.Melee Main.dust[rainbow].noGravity = true; Main.dust[rainbow].position.X = Projectile.Center.X; Main.dust[rainbow].position.Y = Projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[rainbow]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[rainbow]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[rainbow].position.X += (float)Main.rand.Next(-10, 11); + Main.dust[rainbow].position.Y += (float)Main.rand.Next(-10, 11); Main.dust[rainbow].velocity.X = rando1; Main.dust[rainbow].velocity.Y = rando2; timerCounter++; } } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - Projectile.damage = (int)(Projectile.damage * 0.9); - } } } diff --git a/Projectiles/Melee/SeashineSwordProj.cs b/Projectiles/Melee/SeashineSwordProj.cs index 73b6a2ca25..91b63de8bb 100644 --- a/Projectiles/Melee/SeashineSwordProj.cs +++ b/Projectiles/Melee/SeashineSwordProj.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -9,37 +10,108 @@ namespace CalamityMod.Projectiles.Melee public class SeashineSwordProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 600; + + private const int MaxAlpha = 255; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; - Projectile.aiStyle = ProjAIStyleID.Beam; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = true; Projectile.DamageType = DamageClass.Melee; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(127, 255, 253); + Projectile.timeLeft = TimeLeft; + Projectile.alpha = MaxAlpha; } public override void AI() { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); - if (Main.rand.NextBool()) + Lighting.AddLight(Projectile.Center, 0f, (byte.MaxValue - Projectile.alpha) * 0.5f / byte.MaxValue, (byte.MaxValue - Projectile.alpha) * 0.5f / byte.MaxValue); + + if (Projectile.localAI[1] < 7f) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Flare_Blue, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 1.2f); + Projectile.localAI[1] += 1f; } + else + { + float dustScale = 1.8f * Projectile.scale; + int dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= -0.25f; + + dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= -0.25f; + Main.dust[dust].position -= Projectile.velocity * 0.5f; + + if (Projectile.localAI[0] == 0f) + { + Projectile.scale -= 0.02f; + Projectile.alpha += 10; + if (Projectile.alpha >= MaxAlpha - 5) + { + Projectile.alpha = MaxAlpha; + Projectile.localAI[0] = 1f; + } + } + else if (Projectile.localAI[0] == 1f) + { + Projectile.scale += 0.02f; + Projectile.alpha -= 10; + if (Projectile.alpha <= 0) + { + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; + } + } + } + + if (Projectile.ai[1] == 0f) + { + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item8, Projectile.Center); + } + + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; } + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.timeLeft > TimeLeft - 5) + return false; + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + return false; + } + + public override Color? GetAlpha(Color lightColor) => new Color(128, byte.MaxValue, byte.MaxValue); + public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - for (int k = 0; k < 5; k++) + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + + for (int i = 4; i < 31; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 0, new Color(255, 255, 255), 1.5f); + float oldXVel = Projectile.oldVelocity.X * (30f / (float)i); + float oldYVel = Projectile.oldVelocity.Y * (30f / (float)i); + + float dustScale = 3.6f * Projectile.scale; + int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + + dustScale = 3f * Projectile.scale; + dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; } } } diff --git a/Projectiles/Melee/Shortswords/LucreciaProj.cs b/Projectiles/Melee/Shortswords/LucreciaProj.cs index e666eb5412..2517332b34 100644 --- a/Projectiles/Melee/Shortswords/LucreciaProj.cs +++ b/Projectiles/Melee/Shortswords/LucreciaProj.cs @@ -11,7 +11,6 @@ namespace CalamityMod.Projectiles.Melee.Shortswords { public class LucreciaProj : BaseShortswordProjectile { - public const int OnHitIFrames = 5; public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/Lucrecia"; @@ -32,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords public override Action EffectBeforePullback => (proj) => { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 12f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 10f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); }; @@ -54,25 +53,5 @@ namespace CalamityMod.Projectiles.Melee.Shortswords if (Main.rand.NextBool(5)) Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch); } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - Main.player[Projectile.owner].GiveIFrames(OnHitIFrames, false); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - Player player = Main.player[Projectile.owner]; - bool isImmune = false; - for (int j = 0; j < player.hurtCooldowns.Length; j++) - { - if (player.hurtCooldowns[j] > 0) - isImmune = true; - } - if (!isImmune) - { - Owner.GiveIFrames(OnHitIFrames, true); - } - } } } diff --git a/Projectiles/Melee/SpatialSpear.cs b/Projectiles/Melee/SpatialSpear.cs index 4ccf540770..0d3f9d7f29 100644 --- a/Projectiles/Melee/SpatialSpear.cs +++ b/Projectiles/Melee/SpatialSpear.cs @@ -12,34 +12,48 @@ namespace CalamityMod.Projectiles.Melee public class SpatialSpear : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 300; + + private const int TimeToFall = TimeLeft / 2; + + private const int TotalSplits = 30; + + private const int SplitTime = TimeLeft / TotalSplits; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 90; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; + Projectile.timeLeft = TimeLeft; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { Lighting.AddLight(Projectile.Center, 0.05f, 1f, 0.05f); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 30f) + + if (Projectile.timeLeft < TimeToFall) { - Projectile.ai[0] = 30f; - Projectile.velocity.Y += 0.1f; + Projectile.velocity.Y += 0.16f; if (Projectile.velocity.Y > 16f) - { Projectile.velocity.Y = 16f; - } - Projectile.velocity.X *= 0.98f; + + Projectile.velocity.X *= 0.995f; } + if (Projectile.localAI[1] == 0f) { Projectile.scale -= 0.01f; @@ -60,54 +74,61 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[1] = 0f; } } - if (Main.rand.NextBool(8)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); - } + + int dust = Dust.NewDust(Projectile.oldPosition + Projectile.oldVelocity, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, default, 1.25f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noLightEmittence = true; + Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 30f) + if (Projectile.localAI[0] >= SplitTime) { Projectile.localAI[0] = 0f; int numProj = 2; - float rotation = MathHelper.ToRadians(10); + float rotation = MathHelper.ToRadians(5); + float velocity = 16f; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed * velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.5f, Projectile.owner); } } } } + public override Color? GetAlpha(Color lightColor) => new Color(128, byte.MaxValue, 128); + public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 85) + if (Projectile.timeLeft > TimeLeft - 5) return false; - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 30); } + public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - for (int i = 4; i < 12; i++) + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + for (int i = 4; i < 31; i++) { float projOldX = Projectile.oldVelocity.X * (30f / i); float projOldY = Projectile.oldVelocity.Y * (30f / i); - int spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.TerraBlade, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[spatial].noGravity = true; - Dust dust = Main.dust[spatial]; - dust.velocity *= 0.5f; - spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.TerraBlade, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[spatial]; - dust.velocity *= 0.05f; + int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.TerraBlade, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLightEmittence = true; + + dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.TerraBlade, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; + Main.dust[dust].noLightEmittence = true; } } } diff --git a/Projectiles/Melee/SpatialSpear2.cs b/Projectiles/Melee/SpatialSpear2.cs index 315902bcb2..013bdb2914 100644 --- a/Projectiles/Melee/SpatialSpear2.cs +++ b/Projectiles/Melee/SpatialSpear2.cs @@ -3,30 +3,57 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class SpatialSpear2 : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 100; + + private const int TimeToFall = TimeLeft / 2; + + private const int TotalSplits = 4; + + private const int SplitTime = TimeLeft / TotalSplits; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - Projectile.penetrate = 2; - Projectile.timeLeft = 60; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; + Projectile.penetrate = 3; + Projectile.timeLeft = TimeLeft; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { Lighting.AddLight(Projectile.Center, 0.05f, 0.05f, 1f); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; + + if (Projectile.timeLeft < TimeToFall) + { + Projectile.velocity.Y += 0.16f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + + Projectile.velocity.X *= 0.995f; + } + if (Projectile.localAI[1] == 0f) { Projectile.scale -= 0.01f; @@ -47,53 +74,61 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[1] = 0f; } } - if (Main.rand.NextBool(8)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BlueFairy, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); - } + + int dust = Dust.NewDust(Projectile.oldPosition + Projectile.oldVelocity, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1.25f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noLightEmittence = true; + Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 30f) + if (Projectile.localAI[0] >= SplitTime) { Projectile.localAI[0] = 0f; int numProj = 2; float rotation = MathHelper.ToRadians(10); + float velocity = 16f; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed * velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.5f, Projectile.owner); } } } } + public override Color? GetAlpha(Color lightColor) => new Color(128, 128, byte.MaxValue); + public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 55) + if (Projectile.timeLeft > TimeLeft - 5) return false; - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 30); } + public override void OnKill(int timeLeft) { - for (int i = 4; i < 12; i++) + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + for (int i = 4; i < 31; i++) { float projOldX = Projectile.oldVelocity.X * (30f / i); float projOldY = Projectile.oldVelocity.Y * (30f / i); - int spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.BlueFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[spatial].noGravity = true; - Dust dust = Main.dust[spatial]; - dust.velocity *= 0.5f; - spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.BlueFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[spatial]; - dust.velocity *= 0.05f; + int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.BlueFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLightEmittence = true; + + dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.BlueFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; + Main.dust[dust].noLightEmittence = true; } } } diff --git a/Projectiles/Melee/SpatialSpear3.cs b/Projectiles/Melee/SpatialSpear3.cs index 2e777522bd..db84085d23 100644 --- a/Projectiles/Melee/SpatialSpear3.cs +++ b/Projectiles/Melee/SpatialSpear3.cs @@ -3,28 +3,57 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class SpatialSpear3 : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 75; + + private const int TimeToFall = TimeLeft / 2; + + private const int TotalSplits = 2; + + private const int SplitTime = TimeLeft / TotalSplits; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - Projectile.penetrate = 1; - Projectile.timeLeft = 40; + Projectile.penetrate = 2; + Projectile.timeLeft = TimeLeft; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { Lighting.AddLight(Projectile.Center, 1f, 0.05f, 0.05f); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; + + if (Projectile.timeLeft < TimeToFall) + { + Projectile.velocity.Y += 0.16f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + + Projectile.velocity.X *= 0.995f; + } + if (Projectile.localAI[1] == 0f) { Projectile.scale -= 0.01f; @@ -45,53 +74,60 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[1] = 0f; } } - if (Main.rand.NextBool(8)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.PinkFairy, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); - } + + int dust = Dust.NewDust(Projectile.oldPosition + Projectile.oldVelocity, Projectile.width, Projectile.height, DustID.PinkFairy, 0f, 0f, 100, default, 1.25f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noLightEmittence = true; + Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 30f) + if (Projectile.localAI[0] >= SplitTime) { Projectile.localAI[0] = 0f; int numProj = 2; float rotation = MathHelper.ToRadians(20); + float velocity = 16f; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed * velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.5f, Projectile.owner); } } } } + public override Color? GetAlpha(Color lightColor) => new Color(byte.MaxValue, 128, 128); + public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 35) + if (Projectile.timeLeft > TimeLeft - 5) return false; - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 30); } + public override void OnKill(int timeLeft) { - for (int i = 4; i < 12; i++) + for (int i = 4; i < 31; i++) { float projOldX = Projectile.oldVelocity.X * (30f / i); float projOldY = Projectile.oldVelocity.Y * (30f / i); - int spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.PinkFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[spatial].noGravity = true; - Dust dust = Main.dust[spatial]; - dust.velocity *= 0.5f; - spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.PinkFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[spatial]; - dust.velocity *= 0.05f; + int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.PinkFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLightEmittence = true; + + dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.PinkFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; + Main.dust[dust].noLightEmittence = true; } } } diff --git a/Projectiles/Melee/SpatialSpear4.cs b/Projectiles/Melee/SpatialSpear4.cs index 54d97d2598..85754074fa 100644 --- a/Projectiles/Melee/SpatialSpear4.cs +++ b/Projectiles/Melee/SpatialSpear4.cs @@ -3,28 +3,52 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class SpatialSpear4 : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 60; + + private const int TimeToFall = TimeLeft / 2; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - Projectile.penetrate = 1; - Projectile.timeLeft = 25; + Projectile.timeLeft = TimeLeft; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 0.05f); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; + + if (Projectile.timeLeft < TimeToFall) + { + Projectile.velocity.Y += 0.16f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + + Projectile.velocity.X *= 0.995f; + } + if (Projectile.localAI[1] == 0f) { Projectile.scale -= 0.01f; @@ -45,38 +69,43 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[1] = 0f; } } - if (Main.rand.NextBool(8)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); - } + + int dust = Dust.NewDust(Projectile.oldPosition + Projectile.oldVelocity, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1.25f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noLightEmittence = true; } + public override Color? GetAlpha(Color lightColor) => new Color(byte.MaxValue, byte.MaxValue, 128); + public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 20) + if (Projectile.timeLeft > TimeLeft - 5) return false; - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 30); } + public override void OnKill(int timeLeft) { - for (int i = 4; i < 12; i++) + for (int i = 4; i < 31; i++) { float projOldX = Projectile.oldVelocity.X * (30f / i); float projOldY = Projectile.oldVelocity.Y * (30f / i); - int spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.CopperCoin, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[spatial].noGravity = true; - Dust dust = Main.dust[spatial]; - dust.velocity *= 0.5f; - spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.CopperCoin, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[spatial]; - dust.velocity *= 0.05f; + int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.CopperCoin, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLightEmittence = true; + + dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.CopperCoin, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; + Main.dust[dust].noLightEmittence = true; } } } diff --git a/Projectiles/Melee/Spears/AstralPikeProj.cs b/Projectiles/Melee/Spears/AstralPikeProj.cs index 0b1c511d4d..ac989bd044 100644 --- a/Projectiles/Melee/Spears/AstralPikeProj.cs +++ b/Projectiles/Melee/Spears/AstralPikeProj.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override void ExtraBehavior() { if (Main.rand.NextBool(5)) diff --git a/Projectiles/Melee/Spears/BrimlanceProj.cs b/Projectiles/Melee/Spears/BrimlanceProj.cs index 07d0b2f5d9..0dc86176b8 100644 --- a/Projectiles/Melee/Spears/BrimlanceProj.cs +++ b/Projectiles/Melee/Spears/BrimlanceProj.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.7f; public override void ExtraBehavior() { if (Main.rand.NextBool(4)) diff --git a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs index 21e422a958..6446641068 100644 --- a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs +++ b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override void ExtraBehavior() { if (Main.rand.NextBool(4)) diff --git a/Projectiles/Melee/Spears/EarthenPikeSpear.cs b/Projectiles/Melee/Spears/EarthenPikeSpear.cs index 080dde6f4b..54416b823f 100644 --- a/Projectiles/Melee/Spears/EarthenPikeSpear.cs +++ b/Projectiles/Melee/Spears/EarthenPikeSpear.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -29,12 +30,9 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.4f; public override void ExtraBehavior() { - if (Main.rand.NextBool(4)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Sand, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - Projectile.localAI[0] += 1f; if (Projectile.localAI[0] >= 6f) { @@ -44,8 +42,8 @@ namespace CalamityMod.Projectiles.Melee.Spears float velocityY = Projectile.velocity.Y * 1.25f; if (velocityY < 0.1f) velocityY = 0.1f; - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, - Projectile.velocity.X * 1.25f, velocityY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(Projectile.velocity.X * 1.25f, velocityY), + ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.2f, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].DamageType = DamageClass.Melee; } diff --git a/Projectiles/Melee/Spears/ElementalLanceProjectile.cs b/Projectiles/Melee/Spears/ElementalLanceProjectile.cs index 2359fec3f7..ddba5e6980 100644 --- a/Projectiles/Melee/Spears/ElementalLanceProjectile.cs +++ b/Projectiles/Melee/Spears/ElementalLanceProjectile.cs @@ -7,15 +7,17 @@ using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee.Spears { public class ElementalLanceProjectile : BaseSpearProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override void SetDefaults() { Projectile.width = Projectile.height = 40; - Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. + Projectile.DamageType = DamageClass.Melee; Projectile.timeLeft = 90; Projectile.friendly = true; Projectile.hostile = false; @@ -24,16 +26,17 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.penetrate = -1; Projectile.ownerHitCheck = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 7; + Projectile.localNPCHitCooldown = 6; } public override float InitialSpeed => 3f; public override float ReelbackSpeed => 1.1f; - public override float ForwardSpeed => 0.6f; + public override float ForwardSpeed => 0.5f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.velocity, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 16f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); }; + public override void ExtraBehavior() { if (Main.rand.NextBool(5)) @@ -42,6 +45,7 @@ namespace CalamityMod.Projectiles.Melee.Spears Main.dust[idx].noGravity = true; } } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 60); diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index 3c4440e6d6..97f77b041f 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -1,4 +1,6 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Balancing; +using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Terraria; using Terraria.ID; @@ -28,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee.Spears // These numbers sure are common, huh? yeah, they are public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override void ExtraBehavior() { if (Main.rand.NextBool(4)) @@ -40,12 +42,11 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) + int heal = (int)Math.Round(hit.Damage * 0.01); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - Player player = Main.player[Projectile.owner]; - player.statLife += 1; - player.HealEffect(1); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs index 96308e8f58..781422fe62 100644 --- a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs +++ b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs @@ -4,11 +4,13 @@ using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee.Spears { public class GoldplumeSpearProjectile : BaseSpearProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override void SetDefaults() { Projectile.width = Projectile.height = 40; @@ -26,17 +28,18 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 1.1f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.4f; public override void ExtraBehavior() { if (Main.rand.NextBool(5)) Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BlueTorch, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Projectile.localAI[0] += 1f; if (Projectile.localAI[0] >= 6f) { Projectile.localAI[0] = 0f; if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.velocity, Projectile.velocity * 2, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - Projectile.velocity * 4f, Projectile.velocity * 2f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner); } } } diff --git a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs index acc164d40d..88f394f1cc 100644 --- a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs +++ b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs @@ -29,10 +29,10 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 2.4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.65), Projectile.knockBack * 0.85f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 2.4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.65), Projectile.knockBack * 0.85f, Projectile.owner); }; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/Spears/NadirSpear.cs b/Projectiles/Melee/Spears/NadirSpear.cs index af98819111..51c1f30f62 100644 --- a/Projectiles/Melee/Spears/NadirSpear.cs +++ b/Projectiles/Melee/Spears/NadirSpear.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 5.5f; public override float ReelbackSpeed => 2.1f; - public override float ForwardSpeed => 1.1f; + public override float ForwardSpeed => 1f; public override Action EffectBeforeReelback => (proj) => { int damage = (int)(Projectile.damage * 0.5f); diff --git a/Projectiles/Melee/Spears/SausageMakerSpear.cs b/Projectiles/Melee/Spears/SausageMakerSpear.cs index 90176aa7c0..57703977df 100644 --- a/Projectiles/Melee/Spears/SausageMakerSpear.cs +++ b/Projectiles/Melee/Spears/SausageMakerSpear.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 1.1f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override void ExtraBehavior() { if (Main.rand.NextBool(5)) diff --git a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs index bb646f8574..8c49023cac 100644 --- a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs +++ b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs @@ -28,12 +28,13 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.7f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, - Projectile.velocity.X * 2.4f, Projectile.velocity.Y * 2.4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.85f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - Projectile.velocity * 4f, Projectile.velocity * 2.4f, + ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.85f, Projectile.owner); }; + public override void ExtraBehavior() { if (Main.rand.NextBool(5)) diff --git a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs index 629afa3857..5bec1dd0cb 100644 --- a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs +++ b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override Action EffectBeforeReelback => (proj) => { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, Projectile.velocity.X * 2.4f, Projectile.velocity.Y * 2.4f, diff --git a/Projectiles/Melee/Spears/TerraLanceProjectile.cs b/Projectiles/Melee/Spears/TerraLanceProjectile.cs index e0577bc994..ae700c75e2 100644 --- a/Projectiles/Melee/Spears/TerraLanceProjectile.cs +++ b/Projectiles/Melee/Spears/TerraLanceProjectile.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee.Spears { public class TerraLanceProjectile : BaseSpearProjectile @@ -27,12 +28,13 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, - Projectile.velocity.X * 1.4f, Projectile.velocity.Y * 1.4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.7f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - Projectile.velocity * 4f, Projectile.velocity * 1.4f, + ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.7f, Projectile.owner); }; + public override void ExtraBehavior() { if (Main.rand.NextBool(5)) diff --git a/Projectiles/Melee/Spears/VulcaniteLanceProj.cs b/Projectiles/Melee/Spears/VulcaniteLanceProj.cs index a10ef27f09..014132bc87 100644 --- a/Projectiles/Melee/Spears/VulcaniteLanceProj.cs +++ b/Projectiles/Melee/Spears/VulcaniteLanceProj.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public class VulcaniteLanceProj : BaseSpearProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override void SetDefaults() { Projectile.width = Projectile.height = 44; @@ -26,9 +27,10 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 12; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override void ExtraBehavior() { if (Main.rand.NextBool(5)) diff --git a/Projectiles/Melee/Spears/YateveoBloomSpear.cs b/Projectiles/Melee/Spears/YateveoBloomSpear.cs index b676cdd924..5acc6d3ecc 100644 --- a/Projectiles/Melee/Spears/YateveoBloomSpear.cs +++ b/Projectiles/Melee/Spears/YateveoBloomSpear.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public class YateveoBloomSpear : BaseSpearProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override void SetDefaults() { Projectile.width = Projectile.height = 40; @@ -25,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override void ExtraBehavior() { if (Main.rand.NextBool(3)) diff --git a/Projectiles/Melee/StarnightBeam.cs b/Projectiles/Melee/StarnightBeam.cs index 15351499d8..305f72a60a 100644 --- a/Projectiles/Melee/StarnightBeam.cs +++ b/Projectiles/Melee/StarnightBeam.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 14; - Projectile.height = 14; + Projectile.width = 16; + Projectile.height = 16; Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, Projectile.alpha); + return new Color(byte.MaxValue, 50, 128, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) @@ -51,18 +51,16 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - int inc; - for (int i = 4; i < 31; i = inc + 1) + for (int i = 4; i < 31; i++) { float projOldX = Projectile.oldVelocity.X * (30f / (float)i); float projOldY = Projectile.oldVelocity.Y * (30f / (float)i); int starnight = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.PinkFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Dust dust = Main.dust[starnight]; dust.noGravity = true; - dust.velocity *= 0.5f; + dust.velocity *= 0.1f; starnight = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.PinkFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust.velocity *= 0.05f; - inc = i; + dust.velocity *= 0.01f; } } diff --git a/Projectiles/Melee/TerraSpear.cs b/Projectiles/Melee/TerraSpear.cs index 0486fb3b90..8e9aeb8c6f 100644 --- a/Projectiles/Melee/TerraSpear.cs +++ b/Projectiles/Melee/TerraSpear.cs @@ -11,23 +11,33 @@ namespace CalamityMod.Projectiles.Melee public class TerraSpear : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 180; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 180; + Projectile.timeLeft = TimeLeft; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 1f / 255f, 0f); - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + Lighting.AddLight(Projectile.Center, 0f, 1f, 0f); + + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver4; + if (Projectile.localAI[1] == 0f) { Projectile.scale -= 0.01f; @@ -48,38 +58,39 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[1] = 0f; } } - if (Main.rand.NextBool(3)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); - } + + int dust = Dust.NewDust(Projectile.oldPosition + Projectile.oldVelocity, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, default, 1.25f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noLightEmittence = true; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - int inc; - for (int i = 4; i < 31; i = inc + 1) + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + for (int i = 4; i < 31; i++) { - float projOldX = Projectile.oldVelocity.X * (30f / (float)i); - float projOldY = Projectile.oldVelocity.Y * (30f / (float)i); - int terraDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.TerraBlade, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[terraDust].noGravity = true; - Dust dust = Main.dust[terraDust]; - dust.velocity *= 0.5f; - terraDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.TerraBlade, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[terraDust]; - dust.velocity *= 0.05f; - inc = i; + float projOldX = Projectile.oldVelocity.X * (30f / i); + float projOldY = Projectile.oldVelocity.Y * (30f / i); + int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.TerraBlade, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLightEmittence = true; + + dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.TerraBlade, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; + Main.dust[dust].noLightEmittence = true; } } + public override Color? GetAlpha(Color lightColor) => new Color(128, byte.MaxValue, 128); + public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 175) + if (Projectile.timeLeft > TimeLeft - 5) return false; - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/TerratomereBigSlash.cs b/Projectiles/Melee/TerratomereBigSlash.cs index 084507e0cd..0e339a35e8 100644 --- a/Projectiles/Melee/TerratomereBigSlash.cs +++ b/Projectiles/Melee/TerratomereBigSlash.cs @@ -34,9 +34,14 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; + Projectile.extraUpdates = 1; } - public override void AI() => Projectile.scale = Utils.GetLerpValue(0f, 8f, Projectile.timeLeft, true); + public override void AI() + { + CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 24f, 20f); + Projectile.scale = Utils.GetLerpValue(0f, 8f, Projectile.timeLeft, true); + } public float SlashWidthFunction(float _) => Projectile.width * Projectile.scale * Utils.GetLerpValue(0f, 0.1f, _, true); @@ -45,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { TargetIndex = target.whoAmI; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner); if (Projectile.timeLeft > 12) Projectile.timeLeft = 12; @@ -69,6 +74,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 4; i++) PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(SlashWidthFunction, SlashColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30); + return false; } diff --git a/Projectiles/Melee/TerratomereExplosion.cs b/Projectiles/Melee/TerratomereExplosion.cs index d23957cbcd..23f9283b77 100644 --- a/Projectiles/Melee/TerratomereExplosion.cs +++ b/Projectiles/Melee/TerratomereExplosion.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee // Determine frames. Once the maximum frame is reached the projectile dies. Projectile.frameCounter++; - if (Projectile.frameCounter % 8 == 7) + if (Projectile.frameCounter % 5 == 4) Projectile.frame++; if (Projectile.frame >= 18) Projectile.Kill(); diff --git a/Projectiles/Melee/TerratomereHoldoutProj.cs b/Projectiles/Melee/TerratomereHoldoutProj.cs index e1748ece0a..64ebd4ba56 100644 --- a/Projectiles/Melee/TerratomereHoldoutProj.cs +++ b/Projectiles/Melee/TerratomereHoldoutProj.cs @@ -1,9 +1,11 @@ using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.Balancing; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -153,17 +155,25 @@ namespace CalamityMod.Projectiles.Melee // Create the slash. if (Time == (int)(Terratomere.SwingTime * (SwingCompletionRatio + 0.15f))) SoundEngine.PlaySound(Terratomere.SwingSound, Projectile.Center); - + + // Create 4 beams. + bool createBeams = Time == (int)(Terratomere.SwingTime * RecoveryCompletionRatio) + 5f; if (Main.myPlayer == Projectile.owner && Time == (int)(Terratomere.SwingTime * (SwingCompletionRatio + 0.34f))) { - Vector2 bigSlashVelocity = Projectile.SafeDirectionTo(Main.MouseWorld) * Owner.ActiveItem().shootSpeed; + Vector2 bigSlashVelocity = Projectile.SafeDirectionTo(Main.MouseWorld) * Owner.ActiveItem().shootSpeed / 2f; if (bigSlashVelocity.AngleBetween(InitialRotation.ToRotationVector2()) > 1.456f) bigSlashVelocity = InitialRotation.ToRotationVector2() * bigSlashVelocity.Length(); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - bigSlashVelocity * 0.4f, bigSlashVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + int totalBeams = 4; + float randomVelocityLimit = bigSlashVelocity.Length() * 0.2f; + for (int i = 0; i < totalBeams; i++) + { + Vector2 randomVelocity = Main.rand.NextVector2CircularEdge(randomVelocityLimit, randomVelocityLimit); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - bigSlashVelocity * 0.4f, bigSlashVelocity + randomVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + } } - // Create a terra blade-like beam when the slash terminates. + // This is a slash, not a beam. if (Main.myPlayer == Projectile.owner && Time == (int)(Terratomere.SwingTime * RecoveryCompletionRatio) + 5f) { Vector2 bigSlashVelocity = InitialRotation.ToRotationVector2() * Owner.ActiveItem().shootSpeed / 6f; @@ -267,27 +277,28 @@ namespace CalamityMod.Projectiles.Melee #region Hit Effects and Collision - public void OnHitHealEffect() + public void OnHitHealEffect(int damage) { - if (Owner.moonLeech) + int heal = (int)Math.Round(damage * 0.025); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - - Owner.statLife += Terratomere.TrueMeleeHitHeal; - Owner.HealEffect(Terratomere.TrueMeleeHitHeal); + + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - float _ = 0f; + float point = 0f; Vector2 direction = (InitialRotation + GetSwingOffsetAngle(SwingCompletion)).ToRotationVector2() * new Vector2(Projectile.spriteDirection, 1f); - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + direction * Projectile.height * Projectile.scale, Projectile.width * 0.25f, ref _); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + direction * Projectile.height * Projectile.scale, Projectile.width * 0.25f, ref point); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), Terratomere.TrueMeleeGlacialStateTime); - if (target.canGhostHeal) - OnHitHealEffect(); + + if (target.lifeMax > 5) + OnHitHealEffect(hit.Damage); // Create a slash creator on top of the hit target. int slashCreatorID = ModContent.ProjectileType(); @@ -301,7 +312,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), Terratomere.TrueMeleeGlacialStateTime); - OnHitHealEffect(); + OnHitHealEffect(info.Damage); } #endregion Hit Effects and Collision } diff --git a/Projectiles/Melee/TerratomereSlashCreator.cs b/Projectiles/Melee/TerratomereSlashCreator.cs index 33dbdb01ed..f5750cb653 100644 --- a/Projectiles/Melee/TerratomereSlashCreator.cs +++ b/Projectiles/Melee/TerratomereSlashCreator.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ignoreWater = false; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 45; + Projectile.timeLeft = 36; Projectile.MaxUpdates = 2; Projectile.noEnchantmentVisuals = true; } diff --git a/Projectiles/Melee/TinyCrystal.cs b/Projectiles/Melee/TinyCrystal.cs deleted file mode 100644 index 6820563a82..0000000000 --- a/Projectiles/Melee/TinyCrystal.cs +++ /dev/null @@ -1,73 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class TinyCrystal : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 8; - Projectile.height = 8; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 1; - Projectile.alpha = 255; - Projectile.timeLeft = 90; - } - - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 75 && target.CanBeChasedBy(Projectile); - - public override void AI() - { - int dustType = Projectile.ai[0] == 0f ? 56 : 73; - for (int i = 0; i < 2; i++) - { - float shortXVel = Projectile.velocity.X / 3f * (float)i; - float shortYVel = Projectile.velocity.Y / 3f * (float)i; - int dustPosModifier = 4; - int crystalDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)dustPosModifier, Projectile.position.Y + (float)dustPosModifier), Projectile.width - dustPosModifier * 2, Projectile.height - dustPosModifier * 2, dustType, 0f, 0f, 100, default, 1.2f); - Main.dust[crystalDust].noGravity = true; - Main.dust[crystalDust].velocity *= 0.1f; - Main.dust[crystalDust].velocity += Projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[crystalDust]; - expr_47FA_cp_0.position.X -= shortXVel; - Dust expr_4815_cp_0 = Main.dust[crystalDust]; - expr_4815_cp_0.position.Y -= shortYVel; - } - - if (Main.rand.NextBool(10)) - { - int dustPosModifierAgain = 4; - int extraCrystalDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)dustPosModifierAgain, Projectile.position.Y + (float)dustPosModifierAgain), Projectile.width - dustPosModifierAgain * 2, Projectile.height - dustPosModifierAgain * 2, dustType, 0f, 0f, 100, default, 0.6f); - Main.dust[extraCrystalDust].velocity *= 0.25f; - Main.dust[extraCrystalDust].velocity += Projectile.velocity * 0.5f; - } - - if (Projectile.timeLeft < 75) - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 9f, 20f); - } - - public override void OnKill(int timeLeft) - { - int dustType = Projectile.ai[0] == 0f ? 56 : 73; - for (int k = 0; k < 5; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - int buffType = Projectile.ai[0] == 0f ? BuffID.Frostburn2 : BuffID.OnFire; - target.AddBuff(buffType, 90); - } - } -} diff --git a/Projectiles/Melee/TinyFlare.cs b/Projectiles/Melee/TinyFlare.cs index f0467f4ab9..325ec784cf 100644 --- a/Projectiles/Melee/TinyFlare.cs +++ b/Projectiles/Melee/TinyFlare.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 3; i++) { - int fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.InfernoFork, 0f, 0f, 100, default, 0.75f); + int fiery = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.InfernoFork, 0f, 0f, 100, default, Main.rand.NextFloat(1.5f, 2.5f)); Main.dust[fiery].noGravity = true; Main.dust[fiery].velocity *= 0f; } diff --git a/Projectiles/Melee/TrueAncientBeam.cs b/Projectiles/Melee/TrueAncientBeam.cs index 7b43f654d3..ac70351edc 100644 --- a/Projectiles/Melee/TrueAncientBeam.cs +++ b/Projectiles/Melee/TrueAncientBeam.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } - const float MaxTime = 40; + const float MaxTime = 75; public float Timer => MaxTime - Projectile.timeLeft; public override void SetDefaults() @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 35) + if (Projectile.timeLeft > 70) return false; DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D starTexture = Request("CalamityMod/Particles/Sparkle").Value; Texture2D bloomTexture = Request("CalamityMod/Particles/BloomCircle").Value; - //Ajust the bloom's texture to be the same size as the star's + //Adjust the bloom's texture to be the same size as the star's float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height; Color color = Main.hslToRgb((Main.GlobalTimeWrappedHourly * 0.6f) % 1, 1, 0.85f); diff --git a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs index f644199571..e3b784cf55 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee public ref float Charge => ref Projectile.ai[1]; public ref float HasFired => ref Projectile.localAI[0]; - const float MaxTime = 35; + const float MaxTime = 40; private float SwingWidth = MathHelper.PiOver2 * 1.5f; public Vector2 DistanceFromPlayer => direction * 30; public float Timer => MaxTime - Projectile.timeLeft; @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Lerp(SwingWidth / 2 * SwingDirection, -SwingWidth / 2 * SwingDirection, SwingRatio()); - Projectile.scale = 1.4f + ((float)Math.Sin(SwingRatio() * MathHelper.Pi) * 0.6f) + (Charge / 10f) * 0.6f; + Projectile.scale = 1.6f + ((float)Math.Sin(SwingRatio() * MathHelper.Pi) * 0.65f) + (Charge > 0 ? 0.6f : 0f); if (Owner.whoAmI == Main.myPlayer && SwingRatio() > 0.5f && HasFired == 0f && Charge > 0) { @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Melee float rotation = (-MathHelper.PiOver4 * 0.5f + MathHelper.PiOver4 * 0.5f * Timer / MaxTime) * SwingDirection; Color smearColor = Main.hslToRgb(((Timer - MaxTime * 0.5f) / (MaxTime * 0.5f)) * 0.7f, 1, 0.6f); - Main.EntitySpriteDraw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 1.4f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 1.5f, SpriteEffects.None, 0); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs index 224fac879f..0d2290995c 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(Spark); } - if (!target.canGhostHeal || Owner.moonLeech) + if (Owner.moonLeech) return; Owner.statLife += OmegaBiomeBlade.SuperPogoAttunementSlashLifesteal; diff --git a/Projectiles/Melee/TrueCausticEdgeProjectile.cs b/Projectiles/Melee/TrueCausticEdgeProjectile.cs index f8eb063f06..fbe2381d5f 100644 --- a/Projectiles/Melee/TrueCausticEdgeProjectile.cs +++ b/Projectiles/Melee/TrueCausticEdgeProjectile.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -9,6 +10,13 @@ namespace CalamityMod.Projectiles.Melee public class TrueCausticEdgeProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const float ColorAlternateTime = 30f; + + private const int TimeLeft = 600; + + private const int MaxAlpha = 128; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; @@ -17,25 +25,90 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; - Projectile.aiStyle = ProjAIStyleID.Beam; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; - Projectile.timeLeft = 600; + Projectile.timeLeft = TimeLeft; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; + Projectile.alpha = MaxAlpha; } public override void AI() { - Lighting.AddLight(Projectile.Center, 0f, 0.35f, 0f); + Projectile.ai[2] += 1f; + if (Projectile.ai[2] >= ColorAlternateTime) + Projectile.ai[2] = -ColorAlternateTime; + + Vector3 colorOne = new Vector3(0.9f, 0f, 0.9f); + Vector3 colorTwo = new Vector3(0.6f, 1.2f, 0f); + float colorScalar = Math.Abs(Projectile.ai[2]) / ColorAlternateTime; + Vector3 lightColor = Vector3.Lerp(colorOne, colorTwo, colorScalar); + Lighting.AddLight(Projectile.Center, lightColor.X, lightColor.Y, lightColor.Z); + + if (Projectile.localAI[1] > 7f) + { + float dustScale = 1.25f * Projectile.scale; + int maxRandom = 10; + int chanceOfGreenDust = (int)Math.Round(MathHelper.Lerp(0f, (float)maxRandom, colorScalar)); + int dustType = Main.rand.Next(maxRandom) < chanceOfGreenDust ? DustID.GreenFairy : DustID.Venom; + int dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= -0.25f; + if (dustType == DustID.Venom) + Main.dust[dust].fadeIn = 1.5f; + + dustType = Main.rand.Next(maxRandom) < chanceOfGreenDust ? DustID.GreenFairy : DustID.Venom; + dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= -0.25f; + Main.dust[dust].position -= Projectile.velocity * 0.5f; + if (dustType == DustID.Venom) + Main.dust[dust].fadeIn = 1.5f; + } + + if (Projectile.localAI[1] < 15f) + { + Projectile.localAI[1] += 1f; + } + else + { + if (Projectile.localAI[0] == 0f) + { + Projectile.scale -= 0.02f; + Projectile.alpha += 15; + if (Projectile.alpha >= MaxAlpha - 5) + { + Projectile.alpha = MaxAlpha; + Projectile.localAI[0] = 1f; + } + } + else if (Projectile.localAI[0] == 1f) + { + Projectile.scale += 0.02f; + Projectile.alpha -= 15; + if (Projectile.alpha <= 0) + { + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; + } + } + } + + if (Projectile.ai[1] == 0f) + { + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item8, Projectile.Center); + } + + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; } public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 595) + if (Projectile.timeLeft > TimeLeft - 5) return false; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); @@ -44,7 +117,10 @@ namespace CalamityMod.Projectiles.Melee public override Color? GetAlpha(Color lightColor) { - return new Color(0, 100, 0, 0); + Vector3 colorOne = new Vector3(100f, 0f, 100f); + Vector3 colorTwo = new Vector3(67f, 133f, 0f); + Vector3 newLightColor = Vector3.Lerp(colorOne, colorTwo, Math.Abs(Projectile.ai[2]) / ColorAlternateTime); + return new Color((int)newLightColor.X, (int)newLightColor.Y, (int)newLightColor.Z, 0); } public override bool OnTileCollide(Vector2 oldVelocity) @@ -57,36 +133,47 @@ namespace CalamityMod.Projectiles.Melee else { if (Projectile.velocity.X != oldVelocity.X) - { Projectile.velocity.X = -oldVelocity.X; - } if (Projectile.velocity.Y != oldVelocity.Y) - { Projectile.velocity.Y = -oldVelocity.Y; - } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + + Projectile.velocity *= 0.5f; + + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); } + return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 90); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Venom, 60); + Projectile.velocity *= 0.5f; + } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - int inc; - for (int i = 4; i < 31; i = inc + 1) + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + + for (int i = 4; i < 31; i++) { float oldXVel = Projectile.oldVelocity.X * (30f / (float)i); float oldYVel = Projectile.oldVelocity.Y * (30f / (float)i); - int causticDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel, Projectile.oldPosition.Y - oldYVel), 8, 8, DustID.JungleSpore, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[causticDust].noGravity = true; - Dust dust = Main.dust[causticDust]; - dust.velocity *= 0.5f; - causticDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel, Projectile.oldPosition.Y - oldYVel), 8, 8, DustID.JungleSpore, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[causticDust]; - dust.velocity *= 0.05f; - inc = i; + + float dustScale = 1.8f * Projectile.scale; + int dustType = Main.rand.NextBool() ? DustID.GreenFairy : DustID.Venom; + int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + if (dustType == DustID.Venom) + Main.dust[dust].fadeIn = 1.5f; + + dustScale = 1.4f * Projectile.scale; + dustType = Main.rand.NextBool() ? DustID.GreenFairy : DustID.Venom; + dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; + if (dustType == DustID.Venom) + Main.dust[dust].fadeIn = 1.5f; } } } diff --git a/Projectiles/Melee/UrchinSpikeFugu.cs b/Projectiles/Melee/UrchinSpikeFugu.cs index fc7fd7dc9b..d76ba18e0e 100644 --- a/Projectiles/Melee/UrchinSpikeFugu.cs +++ b/Projectiles/Melee/UrchinSpikeFugu.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; if (Projectile.ai[0] == 0f) { - float maxRange = 100f; + float maxRange = Projectile.ai[1] == 1f ? 256f : 100f; // Increased homing range for Lionfish int npcIndex = -1; for (int i = 0; i < Main.maxNPCs; i++) { diff --git a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs index e605cf946d..e68a6592f6 100644 --- a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) + if (Main.player[Projectile.owner].moonLeech) return; Player player = Main.player[Projectile.owner]; diff --git a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs index f056f298fd..5ad15261b8 100644 --- a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs @@ -1,9 +1,12 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -14,6 +17,9 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); private const int FramesPerShot = 5; + public SlotId GFB; + public int GFBCounter = 0; + public int time = 0; // Ensures that the main AI only runs once per frame, despite the projectile's multiple updates private int extraUpdateCounter = 0; @@ -36,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; - Projectile.MaxUpdates = UpdatesPerFrame; + Projectile.MaxUpdates = 8; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 6 * UpdatesPerFrame; } @@ -46,6 +52,30 @@ namespace CalamityMod.Projectiles.Melee.Yoyos // localAI[1] counts up to 19 (4 x 5 - 1), then resets back to 0 for a 20-frame cycle. public override void AI() { + time++; + if (Main.zenithWorld) + { + if (time == 1) + { + GFB = SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/BoomBoomKawaii") with { IsLooped = true }); + GFBCounter++; + } + if (time % 30 == 0 && GFBCounter > 0) + GFBCounter--; + for (int i = 0; i < 13; i++) + { + Vector2 dustPos = Projectile.Center + (i * MathHelper.Pi + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 2f; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.Next(130, 134 + 1), (i * MathHelper.Pi + Projectile.rotation * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * Main.rand.NextFloat(1f, 90f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.1f, 1.7f); + } + if (SoundEngine.TryGetActiveSound(GFB, out var RumblePitch) && RumblePitch.IsPlaying) + { + RumblePitch.Pitch = MathHelper.Lerp(0f, 1f, MathHelper.Clamp(GFBCounter * 0.1f, 0, 1)); + RumblePitch.Volume = MathHelper.Lerp(1f, 1.5f, GFBCounter * 0.1f); + } + } + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks Projectile.Kill(); @@ -120,7 +150,17 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Vector2 origin = new Vector2(10f, 10f); Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/ObliteratorYoyoGlow").Value, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 2f, SpriteEffects.None, 0); } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnKill(int timeLeft) + { + if (Main.zenithWorld && SoundEngine.TryGetActiveSound(GFB, out var RumblePlaying) && RumblePlaying.IsPlaying) + { + RumblePlaying?.Stop(); + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + GFBCounter = 15; + target.AddBuff(ModContent.BuffType(), 180); + } } } diff --git a/Projectiles/Ranged/AMRShot.cs b/Projectiles/Ranged/AMRShot.cs index f465bf59a6..d1c7e80d46 100644 --- a/Projectiles/Ranged/AMRShot.cs +++ b/Projectiles/Ranged/AMRShot.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); return true; } diff --git a/Projectiles/Ranged/BloodBoilerFire.cs b/Projectiles/Ranged/BloodBoilerFire.cs index f0c0684ba3..52af9cd48f 100644 --- a/Projectiles/Ranged/BloodBoilerFire.cs +++ b/Projectiles/Ranged/BloodBoilerFire.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Projectiles.Ranged public bool improvedHeal = false; public bool setHomingVelocity = false; public float HomingVelocity = 0.18f; + public override void SetDefaults() { Projectile.width = 43; @@ -36,6 +37,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localNPCHitCooldown = -1; Projectile.timeLeft = 300; } + public override void AI() { if (Projectile.timeLeft > 220) // Main visual size changes @@ -56,6 +58,7 @@ namespace CalamityMod.Projectiles.Ranged BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); GeneralParticleHandler.SpawnParticle(blood); } + if (Projectile.timeLeft < 296) // The main visual of the projectile and the blood mist it produces before turning around { BloodBoilerMetaball2.SpawnParticle(Projectile.Center, particleSize * 2.3f); @@ -80,6 +83,7 @@ namespace CalamityMod.Projectiles.Ranged GeneralParticleHandler.SpawnParticle(pulse); } } + if (!playedSound) { SoundEngine.PlaySound(SoundID.Item34, Projectile.position); @@ -91,8 +95,10 @@ namespace CalamityMod.Projectiles.Ranged // A bunch of small things mostly for visuals when the projectile starts turning around before it homes on the player if (Projectile.timeLeft == 235) bloodCloudReturn = Projectile.velocity; + if (Projectile.timeLeft <= 235 && Projectile.ai[1] == 0f) Projectile.velocity *= 0.98f; + if (Projectile.timeLeft == 220) { Projectile.velocity = -bloodCloudReturn.RotatedBy(Projectile.ai[2] == 5 ? -0.7f : 0.7f) * 1.2f; @@ -106,6 +112,7 @@ namespace CalamityMod.Projectiles.Ranged dust2.scale = Main.rand.NextFloat(1.2f, 2f); } } + if (Projectile.timeLeft == 209) // Begin returning to player { Projectile.ai[1] = 1f; @@ -118,6 +125,7 @@ namespace CalamityMod.Projectiles.Ranged HomingVelocity = Main.rand.NextFloat(0.29f, 0.32f); setHomingVelocity = true; } + Projectile.extraUpdates = 5; bool dustEffect = Main.rand.NextBool(3) ? false : true; int dustColor = dustEffect ? 296 : 60; @@ -167,19 +175,33 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.velocity.Y > 0f && yDist < 0f) Projectile.velocity.Y -= HomingVelocity; } + if (Projectile.timeLeft == 5) // Absolutely make sure the player gets the chance to heal Projectile.Center = playerCenter; + // Delete the projectile if it touches its owner. Has a chance to heal the player again if (Main.myPlayer == Projectile.owner) { if (Projectile.Hitbox.Intersects(player.Hitbox)) { - if (Main.rand.NextBool(4) && !Main.player[Projectile.owner].moonLeech) + if (!Main.player[Projectile.owner].moonLeech) { - int bonusHeal = Main.rand.NextBool(3) ? 3 : 2; - player.statLife += improvedHeal ? bonusHeal : 1; - player.HealEffect(improvedHeal ? bonusHeal : 1); + int bonusHeal = Main.rand.NextBool(3) ? 6 : 4; + int heal = improvedHeal ? bonusHeal : 2; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + Projectile.Kill(); + return; + } + + Main.player[Main.myPlayer].lifeSteal -= heal; + player.statLife += heal; + player.HealEffect(heal); + if (Main.player[Projectile.owner].statLife > Main.player[Projectile.owner].statLifeMax2) + Main.player[Projectile.owner].statLife = Main.player[Projectile.owner].statLifeMax2; } + Projectile.Kill(); } } @@ -191,6 +213,7 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(ModContent.BuffType(), 600); improvedHeal = true; } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Projectile.numHits > 0) diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index 7c06863739..00d8ef2188 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Ranged; @@ -15,6 +16,7 @@ namespace CalamityMod.Projectiles.Ranged public class BloodfireArrowProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Items/Ammo/BloodfireArrow"; public override void SetStaticDefaults() @@ -35,6 +37,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 1200; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } + public override void AI() { Player player = Main.player[Projectile.owner]; @@ -94,10 +97,10 @@ namespace CalamityMod.Projectiles.Ranged Player player = Main.player[Projectile.owner]; player.lifeRegenTime += 2; - if (!target.canGhostHeal || player.moonLeech) + if (player.moonLeech) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) + if (Main.player[Main.myPlayer].lifeSteal <= 0f || target.lifeMax <= 5) return; float lifeRatio = (float)player.statLife / player.statLifeMax2; @@ -108,10 +111,7 @@ namespace CalamityMod.Projectiles.Ranged bool bonusHeal = Main.rand.NextFloat() < chanceOfOneMoreHP; int finalHeal = guaranteedHeal + (bonusHeal ? 1 : 0); if (finalHeal > 0) - { - player.HealEffect(finalHeal); - player.statLife += finalHeal; - } + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], finalHeal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/BubonicRoundProj.cs b/Projectiles/Ranged/BubonicRoundProj.cs index 92f9e0b9b1..5c9a9c260d 100644 --- a/Projectiles/Ranged/BubonicRoundProj.cs +++ b/Projectiles/Ranged/BubonicRoundProj.cs @@ -68,12 +68,12 @@ namespace CalamityMod.Projectiles.Ranged return new Color(1f, 1f, 1f, 0f); } - // Ignores 20% of armor - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.ScalingArmorPenetration += 0.2f; - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => modifiers.ScalingArmorPenetration += 0.2f; + // Ignores 10% of armor + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.ScalingArmorPenetration += 0.1f; + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => modifiers.ScalingArmorPenetration += 0.1f; // Inflicts Plague for 0.75 seconds - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 45); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); public override void OnKill(int timeLeft) { diff --git a/Projectiles/Ranged/CardHeart.cs b/Projectiles/Ranged/CardHeart.cs index df258e9137..054c4feff1 100644 --- a/Projectiles/Ranged/CardHeart.cs +++ b/Projectiles/Ranged/CardHeart.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Balancing; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -59,12 +61,11 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Player player = Main.player[Projectile.owner]; - if (player.moonLeech) + int heal = (int)Math.Round(hit.Damage * 0.01); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - player.statLife += 1; - player.HealEffect(1); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/ChargedBlast.cs b/Projectiles/Ranged/ChargedBlast.cs index f758525d69..caacfc330d 100644 --- a/Projectiles/Ranged/ChargedBlast.cs +++ b/Projectiles/Ranged/ChargedBlast.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class ChargedBlast : ModProjectile, ILocalizedModType @@ -17,59 +18,42 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.extraUpdates = 3; + Projectile.MaxUpdates = 2; Projectile.alpha = 255; - Projectile.timeLeft = 600; + Projectile.timeLeft = 360; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() { if (Projectile.alpha > 0) - { Projectile.alpha -= 25; - } if (Projectile.alpha < 0) - { Projectile.alpha = 0; - } - Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0f, 0.3f, 0.7f); - float num55 = 100f; - float num56 = 3f; - if (Projectile.ai[1] == 0f) - { - Projectile.localAI[0] += num56; - if (Projectile.localAI[0] > num55) - { - Projectile.localAI[0] = num55; - } - } - else - { - Projectile.localAI[0] -= num56; - if (Projectile.localAI[0] <= 0f) - { - Projectile.Kill(); - return; - } - } + + float lightScale = 1f - Projectile.alpha / 255f; + Projectile.ai[2] = lightScale; + Lighting.AddLight(Projectile.Center, 0f, 0.3f * lightScale, 0.7f * lightScale); + + float beamLength = 60f; + float beamLengthGrowth = 1f; + Projectile.localAI[0] += beamLengthGrowth; + if (Projectile.localAI[0] > beamLength) + Projectile.localAI[0] = beamLength; } - public override Color? GetAlpha(Color lightColor) => new Color(100, 100, 255, 0); + public override Color? GetAlpha(Color lightColor) => new Color(100, 100, 255, 0) * Projectile.ai[2]; public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(100f, 3f, lightColor); public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item62, Projectile.position); - int projectiles = Main.rand.Next(2, 3 + 1); + int projectiles = 2; if (Projectile.owner == Main.myPlayer) { for (int k = 0; k < projectiles; k++) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, (float)Main.rand.Next(-10, 11) * 2f, (float)Main.rand.Next(-10, 11) * 2f, ModContent.ProjectileType(), - (int)((double)Projectile.damage * 0.45), (float)(int)((double)Projectile.knockBack * 0.5), Main.myPlayer, 0f, 0f); - } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2CircularEdge(5f, 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.8f, Main.myPlayer); } } } diff --git a/Projectiles/Ranged/ChargedBlast2.cs b/Projectiles/Ranged/ChargedBlast2.cs index d28b5d3402..89318cc187 100644 --- a/Projectiles/Ranged/ChargedBlast2.cs +++ b/Projectiles/Ranged/ChargedBlast2.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class ChargedBlast2 : ModProjectile, ILocalizedModType @@ -17,52 +18,48 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 3; - Projectile.extraUpdates = 2; + Projectile.MaxUpdates = 2; Projectile.alpha = 255; - Projectile.timeLeft = 200; + Projectile.timeLeft = 180; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } public override void AI() { - if (Projectile.alpha > 0) + if (Projectile.timeLeft < 60) { - Projectile.alpha -= 25; - } - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0f, 0.3f, 0.7f); - float thirty = 30f; - float inc = 1f; - if (Projectile.ai[1] == 0f) - { - Projectile.localAI[0] += inc; - if (Projectile.localAI[0] > thirty) - { - Projectile.localAI[0] = thirty; - } + Projectile.alpha += 5; + if (Projectile.alpha >= 255) + Projectile.Kill(); } else { - Projectile.localAI[0] -= inc; - if (Projectile.localAI[0] <= 0f) - { - Projectile.Kill(); - return; - } + if (Projectile.alpha > 0) + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; } + + float lightScale = 1f - Projectile.alpha / 255f; + Projectile.ai[2] = lightScale; + Lighting.AddLight(Projectile.Center, 0f, 0.3f * lightScale, 0.7f * lightScale); + + float beamLength = 30f; + float beamLengthGrowth = 0.5f; + Projectile.localAI[0] += beamLengthGrowth; + if (Projectile.localAI[0] > beamLength) + Projectile.localAI[0] = beamLength; } - public override Color? GetAlpha(Color lightColor) => new Color(100, 100, 255, 0); + public override Color? GetAlpha(Color lightColor) => new Color(100, 100, 255, 0) * Projectile.ai[2]; public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(100f, 3f, lightColor); public override bool OnTileCollide(Vector2 oldVelocity) { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + Projectile.penetrate--; if (Projectile.penetrate <= 0) { @@ -71,20 +68,12 @@ namespace CalamityMod.Projectiles.Ranged else { if (Projectile.velocity.X != oldVelocity.X) - { Projectile.velocity.X = -oldVelocity.X; - } if (Projectile.velocity.Y != oldVelocity.Y) - { Projectile.velocity.Y = -oldVelocity.Y; - } } - return false; - } - public override void OnKill(int timeLeft) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.MagnetSphere, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + return false; } } } diff --git a/Projectiles/Ranged/CinderArrowProj.cs b/Projectiles/Ranged/CinderArrowProj.cs index 3751bcfd95..95557a92c8 100644 --- a/Projectiles/Ranged/CinderArrowProj.cs +++ b/Projectiles/Ranged/CinderArrowProj.cs @@ -92,12 +92,12 @@ namespace CalamityMod.Projectiles.Ranged for (int b = 0; b < 3; b++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(0, -10).RotatedByRandom(0.8f) * Main.rand.NextFloat(0.9f, 1.1f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.05f), 0f, Projectile.owner, 0f, 0f, 1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(0, -10).RotatedByRandom(0.8f) * Main.rand.NextFloat(0.9f, 1.1f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), 0f, Projectile.owner, 0f, 0f, 1f); } if (Projectile.owner == Main.myPlayer) { - Projectile.damage = (int)(Projectile.damage * 0.3f); + Projectile.damage = (int)(Projectile.damage * 0.5f); Projectile.penetrate = -1; Projectile.ExpandHitboxBy(110); Projectile.Damage(); diff --git a/Projectiles/Ranged/ClaretCannonProj.cs b/Projectiles/Ranged/ClaretCannonProj.cs index 4302e769fe..08271b653a 100644 --- a/Projectiles/Ranged/ClaretCannonProj.cs +++ b/Projectiles/Ranged/ClaretCannonProj.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Balancing; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; @@ -54,15 +56,11 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) + int heal = (int)Math.Round(hit.Damage * 0.02); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - Player player = Main.player[Projectile.owner]; - if (Main.rand.NextBool()) - { - player.statLife += 1; - player.HealEffect(1); - } + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/ElysianArrowProj.cs b/Projectiles/Ranged/ElysianArrowProj.cs index 55b028dcc9..57b5a81cfd 100644 --- a/Projectiles/Ranged/ElysianArrowProj.cs +++ b/Projectiles/Ranged/ElysianArrowProj.cs @@ -51,7 +51,11 @@ namespace CalamityMod.Projectiles.Ranged Vector2 targetPosition = target == null ? Projectile.Center : target.Center; Vector2 spawnSpot = (target == null ? Projectile.Center : target.Center) + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-750, -950)); - Vector2 velocity = (targetPosition - spawnSpot).SafeNormalize(Vector2.UnitX) * 20; + Vector2 velocity; + if (target == null) + velocity = (targetPosition - spawnSpot).SafeNormalize(Vector2.UnitX) * 20; + else + velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(spawnSpot, target, 20f, ElysianArrowRain.MaxUpdate); if (targetDist < 1400f) { diff --git a/Projectiles/Ranged/ElysianArrowRain.cs b/Projectiles/Ranged/ElysianArrowRain.cs index 383d8415cf..3053e14814 100644 --- a/Projectiles/Ranged/ElysianArrowRain.cs +++ b/Projectiles/Ranged/ElysianArrowRain.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public static int MaxUpdate = 7; private int Lifetime = 110; private static Color ShaderColorOne = Color.Khaki; private static Color ShaderColorTwo = Color.White; @@ -37,7 +38,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = Lifetime; - Projectile.extraUpdates = 6; + Projectile.MaxUpdates = MaxUpdate; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -126,7 +127,11 @@ namespace CalamityMod.Projectiles.Ranged Vector2 targetPosition = Projectile.numHits == 1 ? (target == null ? Projectile.Center : target.Center) : altSpawn; Vector2 spawnSpot = (Projectile.numHits == 1 ? (target == null ? Projectile.Center : target.Center) : altSpawn) + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(750, 950)); - Vector2 velocity = (targetPosition - spawnSpot).SafeNormalize(Vector2.UnitX) * 20; + Vector2 velocity; + if (target == null) + velocity = (targetPosition - spawnSpot).SafeNormalize(Vector2.UnitX) * 20; + else + velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(spawnSpot, target, 20f, MaxUpdate); if (targetDist < 1400f) { diff --git a/Projectiles/Ranged/HailstormBulletProj.cs b/Projectiles/Ranged/HailstormBulletProj.cs index 12e7756110..4d8c89904c 100644 --- a/Projectiles/Ranged/HailstormBulletProj.cs +++ b/Projectiles/Ranged/HailstormBulletProj.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.coldDamage = true; - Projectile.penetrate = 3; + Projectile.penetrate = 2; Projectile.extraUpdates = 15; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Ranged WaterFlavoredParticle subTrail = new WaterFlavoredParticle(Projectile.Center + velocity * 4.5f + addedPlacement, velocity * 7, false, 6, 0.65f, Color.SkyBlue); GeneralParticleHandler.SpawnParticle(subTrail); } - int onHitDamage = Owner.CalcIntDamage(0.5f * Projectile.damage); + int onHitDamage = Owner.CalcIntDamage(0.33f * Projectile.damage); Owner.ApplyDamageToNPC(target, onHitDamage, 0f, 0, false); } } diff --git a/Projectiles/Ranged/HallowPointRoundProj.cs b/Projectiles/Ranged/HallowPointRoundProj.cs index d1131b63c3..38bc347b06 100644 --- a/Projectiles/Ranged/HallowPointRoundProj.cs +++ b/Projectiles/Ranged/HallowPointRoundProj.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.Items.Ammo; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -58,6 +59,16 @@ namespace CalamityMod.Projectiles.Ranged return false; } + // Deal bonus flat damage on hit. + // This is a flat addition to the source damage of the hit, meaning the following: + // - The bonus damage is pre-mitigation + // - The bonus damage transfers to on-hit effects, if any + // - It is applied in a different way than whip tag bonus damage, preventing interference + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage.Flat += HallowPointRound.BonusDamageOnHit; + } + // On impact, make impact sparkle and play a sound. public override void OnKill(int timeLeft) { diff --git a/Projectiles/Ranged/HiveBomb.cs b/Projectiles/Ranged/HiveBomb.cs deleted file mode 100644 index 3c4e051eb2..0000000000 --- a/Projectiles/Ranged/HiveBomb.cs +++ /dev/null @@ -1,191 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Ranged -{ - public class HiveBomb : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - private ref float RocketType => ref Projectile.ai[0]; - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 95; - Projectile.DamageType = DamageClass.Ranged; - } - - public override void AI() - { - if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) - { - for (int i = 0; i < 2; i++) - { - float halfX = 0f; - float halfY = 0f; - if (i == 1) - { - halfX = Projectile.velocity.X * 0.5f; - halfY = Projectile.velocity.Y * 0.5f; - } - int dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 1f); - Main.dust[dust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[dust].velocity *= 0.2f; - Main.dust[dust].noGravity = true; - dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Smoke, 0f, 0f, 100, default, 0.5f); - Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust].velocity *= 0.05f; - } - } - if (Math.Abs(Projectile.velocity.X) < 15f && Math.Abs(Projectile.velocity.Y) < 15f) - { - Projectile.velocity *= 1.1f; - } - else if (Main.rand.NextBool()) - { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1f); - Main.dust[dust2].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust2].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust2].noGravity = true; - Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; - Main.rand.Next(2); - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); - Main.dust[dust2].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust2].noGravity = true; - Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; - } - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); - - if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) - { - if (Projectile.wet) - Projectile.timeLeft = 1; - } - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; - } - - public override void OnKill(int timeLeft) - { - var info = new CalamityUtils.RocketBehaviorInfo((int)RocketType) - { - smallRadius = 4, - mediumRadius = 7, - largeRadius = 10 - }; - int blastRadius = Projectile.RocketBehavior(info); - Projectile.ExpandHitboxBy(64); - Projectile.Damage(); - - if (Projectile.owner == Main.myPlayer) - { - for (int j = 0; j < 6; j++) - { - if (j % 2 != 1 || Main.rand.NextBool(3)) - { - Vector2 projPos = Projectile.position; - Vector2 projVel = Projectile.oldVelocity; - projVel.Normalize(); - projVel *= 8f; - float beeVelX = (float)Main.rand.Next(-35, 36) * 0.01f; - float beeVelY = (float)Main.rand.Next(-35, 36) * 0.01f; - projPos -= projVel * (float)j; - beeVelX += Projectile.oldVelocity.X / 6f; - beeVelY += Projectile.oldVelocity.Y / 6f; - int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), projPos.X, projPos.Y, beeVelX, beeVelY, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 3), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); - if (bee.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[bee].penetrate = 2; - Main.projectile[bee].DamageType = DamageClass.Ranged; - } - } - } - } - - if (Main.dedServ) - return; - - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int i = 0; i < 20; i++) - { - int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); - Main.dust[dusty].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[dusty].scale = 0.5f; - Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 30; j++) - { - int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 3f); - Main.dust[dusty2].noGravity = true; - Main.dust[dusty2].velocity *= 5f; - dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); - Main.dust[dusty2].velocity *= 2f; - } - - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } - } -} diff --git a/Projectiles/Ranged/HiveMissile.cs b/Projectiles/Ranged/HiveMissile.cs index 32f7c0661c..f85d0e7d92 100644 --- a/Projectiles/Ranged/HiveMissile.cs +++ b/Projectiles/Ranged/HiveMissile.cs @@ -1,74 +1,96 @@ using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.Projectiles.Ranged.TheHiveHoldout; namespace CalamityMod.Projectiles.Ranged { public class HiveMissile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - private ref float RocketType => ref Projectile.ai[0]; + public ref float RocketID => ref Projectile.ai[0]; + public ref float ProjectileSpeed => ref Projectile.ai[1]; + public ref float Time => ref Projectile.ai[2]; + public bool HasHit = false; public override void SetDefaults() { - Projectile.width = 14; - Projectile.height = 14; - Projectile.scale = 0.75f; + Projectile.width = 25; + Projectile.height = 25; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.timeLeft = 95; + Projectile.timeLeft = 100; Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) + // Rotates towards its velocity. + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) { - for (int i = 0; i < 2; i++) + HasHit = true; + Projectile.Kill(); + } + + Time++; + + if (Projectile.timeLeft <= 50) + { + Projectile.velocity *= 0.965f; + if (Time % 5 == 0) { - float halfX = 0f; - float halfY = 0f; - if (i == 1) - { - halfX = Projectile.velocity.X * 0.5f; - halfY = Projectile.velocity.Y * 0.5f; - } - int dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 1f); - Main.dust[dust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[dust].velocity *= 0.2f; - Main.dust[dust].noGravity = true; - dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Smoke, 0f, 0f, 100, default, 0.5f); - Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust].velocity *= 0.05f; + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10) - Projectile.velocity * 3.5f, Main.rand.NextBool(3) ? DustEffectsID : 303, Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.4f, 0.9f), 0, default, Main.rand.NextFloat(0.5f, 0.9f)); + dust.noGravity = false; + if (dust.type != DustEffectsID) + dust.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor; } } - if (Math.Abs(Projectile.velocity.X) < 15f && Math.Abs(Projectile.velocity.Y) < 15f) - { - Projectile.velocity *= 1.5f; - } - else if (Main.rand.NextBool()) - { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1f); - Main.dust[dust2].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust2].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust2].noGravity = true; - Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; - Main.rand.Next(2); - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); - Main.dust[dust2].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust2].noGravity = true; - Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; - } - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); - if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) + if (Main.dedServ) + return; + + // The projectile will fade away as its time alive is ending. + Projectile.alpha = (int)Utils.Remap(Projectile.timeLeft, 40f, 0f, 0f, 255f); + + if (Time % 3 == 0) { - if (Projectile.wet) - Projectile.timeLeft = 1; + Dust trailDust = Dust.NewDustDirect(Projectile.Center, Projectile.width, Projectile.height, Main.rand.NextBool() ? 303 : DustEffectsID, Scale: Main.rand.NextFloat(0.3f, 0.6f)); + trailDust.noGravity = true; + trailDust.noLight = true; + trailDust.noLightEmittence = true; + trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f); + if (trailDust.type != DustEffectsID) + trailDust.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor; } + if (Time > 5f) + { + float sizeBonus = Projectile.timeLeft < 30 ? Time * 0.003f : 0; + Color smokeColor = Color.Lerp(Color.Black, Color.Lime, 0.25f); + Particle smoke = new HeavySmokeParticle(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity.RotatedByRandom(sizeBonus) * Main.rand.NextFloat(0.2f, 0.6f), smokeColor * 0.65f, 6, Main.rand.NextFloat(0.3f, 0.45f) + sizeBonus, 0.23f - (sizeBonus * 0.3f), Main.rand.NextFloat(-0.2f, 0.2f), false); + GeneralParticleHandler.SpawnParticle(smoke); + + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10) - Projectile.velocity * 2.5f, 303, -Projectile.velocity.RotatedByRandom(0.05f) * Main.rand.NextFloat(0.05f, 0.4f), 0, default, Main.rand.NextFloat(0.8f, 1.4f)); + dust.noGravity = false; + dust.color = Color.Black; + dust.alpha = Main.rand.Next(90, 220 + 1); + } + } + + Lighting.AddLight(Projectile.Center, StaticEffectsColor.ToVector3() * 0.7f); } public override bool PreDraw(ref Color lightColor) @@ -77,108 +99,73 @@ namespace CalamityMod.Projectiles.Ranged Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } - + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + HasHit = true; + target.AddBuff(ModContent.BuffType(), 90); + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + HasHit = true; + return true; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 1) + Projectile.damage = (int)(Projectile.damage * 0.8f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } public override void OnKill(int timeLeft) { - var info = new CalamityUtils.RocketBehaviorInfo((int)RocketType) + if (HasHit == true) { - smallRadius = 5, - mediumRadius = 8, - largeRadius = 11 - }; - int blastRadius = Projectile.RocketBehavior(info); - Projectile.ExpandHitboxBy(80); - Projectile.Damage(); - - if (Projectile.owner == Main.myPlayer) - { - for (int j = 0; j < 3; j++) + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID) { - if (j % 2 != 1 || Main.rand.NextBool(3)) - { - Vector2 projPos = Projectile.position; - Vector2 projVel = Projectile.oldVelocity; - projVel.Normalize(); - projVel *= 8f; - float beeVelX = (float)Main.rand.Next(-35, 36) * 0.01f; - float beeVelY = (float)Main.rand.Next(-35, 36) * 0.01f; - projPos -= projVel * (float)j; - beeVelX += Projectile.oldVelocity.X / 6f; - beeVelY += Projectile.oldVelocity.Y / 6f; - int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), projPos.X, projPos.Y, beeVelX, beeVelY, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 2), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); - if (bee.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[bee].penetrate = 2; - Main.projectile[bee].DamageType = DamageClass.Ranged; - } - } + // Since we use our own spawning method for the cluster rockets, we don't need them to shoot anything, + // we'll do it ourselves. + clusterProjectileID = ProjectileID.None, + destructiveClusterProjectileID = ProjectileID.None, + }; + + bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII); + SoundStyle fire = new("CalamityMod/Sounds/Custom/PlagueSounds/PlagueBoom", 4); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = -0.3f }, Projectile.Center); + + int blastRadius = (int)(Projectile.RocketBehavior(info) * 0.7f); + Projectile.ExpandHitboxBy((float)blastRadius); + Projectile.damage = (int)(Projectile.damage * 0.5f); + Projectile.penetrate = -1; + Projectile.Damage(); + + Particle blastRing = new CustomPulse( + Projectile.Center, + Vector2.Zero, + StaticEffectsColor * 0.8f, + "CalamityMod/Particles/FlameExplosion", + Vector2.One, + Main.rand.NextFloat(-10, 10), + Projectile.width / 22815f, + Projectile.width / 2275f, + 10); + GeneralParticleHandler.SpawnParticle(blastRing); + + for (int k = 0; k < 15; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 303, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f)); + dust2.scale = Main.rand.NextFloat(0.75f, 0.95f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor; } - } - if (Main.dedServ) - return; - - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int i = 0; i < 20; i++) - { - int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemRuby, 0f, 0f, 100, default, 2f); - Main.dust[dusty].velocity *= 3f; - if (Main.rand.NextBool()) + for (int k = 0; k < (isClusterRocket ? 3f : 2f); k++) { - Main.dust[dusty].scale = 0.5f; - Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 30; j++) - { - int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemRuby, 0f, 0f, 100, default, 3f); - Main.dust[dusty2].noGravity = true; - Main.dust[dusty2].velocity *= 5f; - dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemRuby, 0f, 0f, 100, default, 2f); - Main.dust[dusty2].velocity *= 2f; - } - - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) + int BEES = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(4, 10).RotatedByRandom(4) * Main.rand.NextFloat(0.2f, 0.8f), ModContent.ProjectileType(), (int)(Projectile.damage * (isClusterRocket ? 0.2f : 0.4f)), 0f, Projectile.owner, 0f, 0f, isClusterRocket ? 2f : 1f); + if (BEES.WithinBounds(Main.maxProjectiles)) { - velocityMult = 0.66f; + Main.projectile[BEES].penetrate = 1; + Main.projectile[BEES].DamageType = DamageClass.Ranged; } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; } } } diff --git a/Projectiles/Ranged/HiveNuke.cs b/Projectiles/Ranged/HiveNuke.cs new file mode 100644 index 0000000000..0c50836ddb --- /dev/null +++ b/Projectiles/Ranged/HiveNuke.cs @@ -0,0 +1,259 @@ +using System; +using System.Net.Sockets; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.Projectiles.Ranged.TheHiveHoldout; +namespace CalamityMod.Projectiles.Ranged +{ + public class HiveNuke : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public ref float RocketID => ref Projectile.ai[0]; + public ref float ProjectileSpeed => ref Projectile.ai[1]; + public bool HasHit = false; + public float Time = 0; + public bool BonusEffectMode; + public bool SetLifetime = false; + private Player Owner => Main.player[Projectile.owner]; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 25; + Projectile.height = 25; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 1500; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 15; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + BonusEffectMode = Projectile.ai[2] == 2; + if (BonusEffectMode) + { + if (RocketID == ItemID.RocketII || RocketID == ItemID.RocketIV || RocketID == ItemID.MiniNukeII) + { + if (!SetLifetime) + { + Projectile.timeLeft = 60; + Projectile.extraUpdates = 0; + Projectile.damage = 0; + Projectile.alpha = 255; + SetLifetime = true; + } + + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID); + int blastRadius = (int)(Projectile.RocketBehavior(info) * 5f); + if (Time % 5 == 0) + { + Projectile.ExplodeTiles((int)(blastRadius * Utils.Remap(Time, 60f, 1f, 1f, 0f, true)), info.respectStandardBlastImmunity, info.tilesToCheck, info.wallsToCheck); + } + } + else + { + Point center = Projectile.Center.ToTileCoordinates(); + if (RocketID == ItemID.DryRocket) + { + DelegateMethods.f_1 = 10.5f * Utils.Remap(Time, 60f, 1f, 1f, 0f, true); + if (Time == 0) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); + } + } + if (RocketID == ItemID.WetRocket) + { + DelegateMethods.f_1 = 10.5f * Utils.Remap(Time, 60f, 1f, 1f, 0f, true); + if (Time == 0) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); + } + } + if (RocketID == ItemID.LavaRocket) + { + DelegateMethods.f_1 = 10.5f * Utils.Remap(Time, 60f, 1f, 1f, 0f, true); + if (Time == 0) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); + } + } + if (RocketID == ItemID.HoneyRocket) + { + DelegateMethods.f_1 = 10.5f * Utils.Remap(Time, 60f, 1f, 1f, 0f, true); + if (Time == 0) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); + } + } + } + Time++; + } + else + { + // Rotates towards its velocity. + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) + Projectile.Kill(); + + Time++; + + if (Projectile.timeLeft <= 30) + Projectile.velocity *= 0.95f; + + if (Main.dedServ) + return; + + // The projectile will fade away as its time alive is ending. + Projectile.alpha = (int)Utils.Remap(Projectile.timeLeft, 10f, 0f, 0f, 255f); + + if (Time % 3 == 0) + { + Dust trailDust = Dust.NewDustDirect(Projectile.Center, Projectile.width, Projectile.height, Main.rand.NextBool() ? 303 : DustEffectsID, Scale: Main.rand.NextFloat(0.3f, 0.6f)); + trailDust.noGravity = true; + trailDust.noLight = true; + trailDust.noLightEmittence = true; + trailDust.velocity = -Projectile.velocity.RotatedByRandom(0.5) * Main.rand.NextFloat(0.2f, 0.8f); + if (trailDust.type != DustEffectsID) + trailDust.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor; + } + if (Time > 5f) + { + Color smokeColor = Color.Lerp(Color.Black, Color.Lime, 0.25f); + Particle smoke = new HeavySmokeParticle(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.6f), smokeColor * 0.65f, 9, Main.rand.NextFloat(0.45f, 0.6f), 0.23f, Main.rand.NextFloat(-0.2f, 0.2f), false); + GeneralParticleHandler.SpawnParticle(smoke); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10) - Projectile.velocity * 2.5f, 303, -Projectile.velocity.RotatedByRandom(0.05f) * Main.rand.NextFloat(0.2f, 0.9f), 0, default, Main.rand.NextFloat(0.9f, 1.6f)); + dust.noGravity = false; + dust.color = Color.Black; + dust.alpha = Main.rand.Next(90, 220 + 1); + } + + Lighting.AddLight(Projectile.Center, StaticEffectsColor.ToVector3() * 0.7f); + } + + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.4f, targetHitbox); + + public override bool PreDraw(ref Color lightColor) + { + if (BonusEffectMode) { return false; } + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/StarProj").Value; + if (Time > 6) + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], EffectsColor * 0.4f, 1, texture); + Texture2D tex = ModContent.Request(Texture).Value; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + return false; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + HasHit = true; + target.AddBuff(ModContent.BuffType(), 60); + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + HasHit = true; + return true; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 1) + Projectile.damage = (int)(Projectile.damage * 0.90f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override void OnKill(int timeLeft) + { + bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII); + if (HasHit == true && !BonusEffectMode) + { + if (Main.zenithWorld) + { + SoundStyle bees = new("CalamityMod/Sounds/Custom/BEES/bees", 11); + SoundEngine.PlaySound(bees with { Volume = 1.5f }, Projectile.Center); + SoundStyle fire = new("CalamityMod/Sounds/Item/TheHiveNuke"); + SoundEngine.PlaySound(fire with { Volume = 0.35f }, Projectile.Center); + } + else + { + SoundStyle fire = new("CalamityMod/Sounds/Item/TheHiveNuke"); + SoundEngine.PlaySound(fire with { Volume = 0.9f }, Projectile.Center); + } + + Owner.Calamity().GeneralScreenShakePower = 9.5f; + + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID); + int blastRadius = (int)(Projectile.RocketBehavior(info) * 5f); + Projectile.ExpandHitboxBy((float)blastRadius); + if (RocketID == ItemID.RocketII || RocketID == ItemID.RocketIV || RocketID == ItemID.MiniNukeII || RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Projectile.owner, RocketID, 0f, 2f); + Projectile.damage = (int)(Projectile.damage * 0.7f); + Projectile.penetrate = -1; + Projectile.Damage(); + + for (int k = 0; k < 3; k++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, StaticEffectsColor * 0.8f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), Projectile.width / 22815f, Projectile.width / (2275f + 520 * k), 20 + 4 * k); + GeneralParticleHandler.SpawnParticle(blastRing); + } + + for (int k = 0; k < 30; k++) + { + GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f), false, 60, Main.rand.NextFloat(0.8f, 1.4f), StaticEffectsColor, true, true); + GeneralParticleHandler.SpawnParticle(orb); + } + + for (int k = 0; k < 45; k++) + { + if (Main.rand.NextBool(5)) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? DustEffectsID : 303, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f)); + dust2.scale = Main.rand.NextFloat(0.85f, 1.25f); + dust2.noGravity = true; + if (dust2.type != DustEffectsID) + dust2.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor; + } + else + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 303, new Vector2(35, 35).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f), 0, default, Main.rand.NextFloat(0.9f, 1.7f)); + dust.noGravity = false; + dust.color = Color.Black; + dust.alpha = Main.rand.Next(90, 220 + 1); + } + } + for (int k = 0; k < (int)((Main.zenithWorld ? 100 : 20) * (isClusterRocket ? 1.5f : 1)); k++) + { + int BEES = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 0.8f), ModContent.ProjectileType(), (int)(Projectile.damage * (isClusterRocket ? 0.1f : 0.15f)), 0f, Projectile.owner, 0f, 0f, isClusterRocket ? 2f : 1f); + if (BEES.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[BEES].penetrate = 1; + Main.projectile[BEES].DamageType = DamageClass.Ranged; + } + } + } + else if (!BonusEffectMode) + { + for (int i = 0; i <= 15; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10) - Projectile.velocity * 3.5f, Main.rand.NextBool(3) ? DustEffectsID : 303, Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.4f, 0.9f), 0, default, Main.rand.NextFloat(0.5f, 0.9f)); + dust.noGravity = false; + if (dust.type != DustEffectsID) + dust.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor; + } + } + } + } +} diff --git a/Projectiles/Ranged/HiveBomb.png b/Projectiles/Ranged/HiveNuke.png similarity index 100% rename from Projectiles/Ranged/HiveBomb.png rename to Projectiles/Ranged/HiveNuke.png diff --git a/Projectiles/Ranged/HyperiusBulletProj.cs b/Projectiles/Ranged/HyperiusBulletProj.cs index 3705c029eb..6becd523e2 100644 --- a/Projectiles/Ranged/HyperiusBulletProj.cs +++ b/Projectiles/Ranged/HyperiusBulletProj.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; Projectile.timeLeft = 1200; - Projectile.extraUpdates = 10; + Projectile.extraUpdates = 5; AIType = ProjectileID.Bullet; Projectile.ignoreWater = true; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged dustAngle += (growing ? 0.07f * variance : -0.07f * variance); Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 12f && targetDist < 1400f) + if (Projectile.localAI[0] > 12f && targetDist < 1200f) { GlowOrbParticle orb = new GlowOrbParticle((Projectile.Center + Projectile.velocity.RotatedBy((dustWave ? 1 : -1) * dustAngle) * 4.5f) - Projectile.velocity * 5, Vector2.Zero, false, 5, 0.55f + MathF.Abs(dustAngle * 0.5f), currentColor, true, true); GeneralParticleHandler.SpawnParticle(orb); @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int b = 0; b < 3; b++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -oldVelocity.RotatedByRandom(0.5f) * 0.7f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), 0f, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -oldVelocity.RotatedByRandom(0.5f) * 0.7f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), 0f, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); } } return true; @@ -130,14 +130,14 @@ namespace CalamityMod.Projectiles.Ranged for (int b = 0; b < 3; b++) { Vector2 velocity = Projectile.velocity.RotatedByRandom(0.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity * 0.7f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), Projectile.knockBack * 2f, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity * 0.7f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.15), Projectile.knockBack * 2f, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); } } } public override void OnKill(int timeLeft) { - for (int b = 0; b < 9; b++) + for (int b = 0; b < 4; b++) { Dust dust = Dust.NewDustPerfect(Projectile.Center, 66, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f)); dust.noGravity = true; diff --git a/Projectiles/Ranged/HyperiusSplit.cs b/Projectiles/Ranged/HyperiusSplit.cs index 7866105cfe..7cd32b9906 100644 --- a/Projectiles/Ranged/HyperiusSplit.cs +++ b/Projectiles/Ranged/HyperiusSplit.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.Items.Ammo; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -24,12 +25,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.penetrate = 2; Projectile.timeLeft = 500; - Projectile.extraUpdates = 8; + Projectile.extraUpdates = 4; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10 * Projectile.extraUpdates; Projectile.alpha = 255; Projectile.ignoreWater = true; - AIType = ProjectileID.Bullet; } @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Ranged break; } } - if (targetDist < 1400f) + if (targetDist < 1200f) { GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center - Projectile.velocity, -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.9f), false, 3, 0.55f, currentColor, true, true); GeneralParticleHandler.SpawnParticle(orb); @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Ranged } public override void OnKill(int timeLeft) { - for (int b = 0; b < 3; b++) + for (int b = 0; b < 2; b++) { Dust dust = Dust.NewDustPerfect(Projectile.Center, 66, new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f)); dust.noGravity = true; @@ -96,5 +96,7 @@ namespace CalamityMod.Projectiles.Ranged } } public override bool? CanDamage() => Projectile.localAI[0] < 20 ? false : null; + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage.Flat += HyperiusBullet.SplitBulletBonusDamage; } } diff --git a/Projectiles/Ranged/IcicleArrowProj.cs b/Projectiles/Ranged/IcicleArrowProj.cs index 794514b943..4e18f69b08 100644 --- a/Projectiles/Ranged/IcicleArrowProj.cs +++ b/Projectiles/Ranged/IcicleArrowProj.cs @@ -68,6 +68,9 @@ namespace CalamityMod.Projectiles.Ranged } else { + if (Projectile.Calamity().allProjectilesHome) + Projectile.Calamity().allProjectilesHome = false; // Prevent the icicle effect from breaking with Arterial Assault + if (targetDist < 1400f) { SparkParticle Visual = new SparkParticle(Projectile.Center, Projectile.velocity * 0.1f, false, 2, 1.2f, Color.SkyBlue); @@ -91,6 +94,8 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Frostburn2, 180); + if (Projectile.Calamity().allProjectilesHome) + Projectile.Calamity().allProjectilesHome = false; // Prevent the icicle effect from breaking with Arterial Assault if (!falling) { SoundEngine.PlaySound(SoundID.Item50 with { Volume = 0.35f, Pitch = -0.2f, PitchVariance = 0.2f }, Projectile.Center); diff --git a/Projectiles/Ranged/PumplerGrenade.cs b/Projectiles/Ranged/PumplerGrenade.cs index f94b702925..04ff44cbea 100644 --- a/Projectiles/Ranged/PumplerGrenade.cs +++ b/Projectiles/Ranged/PumplerGrenade.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Ranged { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - int size = NPCHit ? 50 : 70; //Bigger explosion if no npc is hit + int size = NPCHit ? 60 : 90; //Bigger explosion if no npc is hit Projectile.scale = (size / (float)Projectile.height) * Projectile.scale; Projectile.position -= Vector2.One * (size - Projectile.width) * 0.5f; diff --git a/Projectiles/Ranged/SeasSearingSpout.cs b/Projectiles/Ranged/SeasSearingSpout.cs index 24e4ba3c5b..edb536ff36 100644 --- a/Projectiles/Ranged/SeasSearingSpout.cs +++ b/Projectiles/Ranged/SeasSearingSpout.cs @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Ranged } if (Projectile.ai[0] <= 0f) { - float swaySize = 0.104719758f; + float swaySize = MathHelper.Pi / 30f; float smolWidth = (float)Projectile.width / 5f; float projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; Projectile.position.X = Projectile.position.X - projXChange * (float)-(float)Projectile.direction; diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index ec93bbdca4..f171e2fcb0 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Healing; +using System; +using CalamityMod.Balancing; +using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -80,20 +82,11 @@ namespace CalamityMod.Projectiles.Ranged Main.projectile[proj].scale = (Projectile.ai[1] * 0.5f) + 1f; } - if (Main.player[Projectile.owner].moonLeech) + int heal = (int)Math.Round(hit.Damage * 0.05); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - float healAmt = hit.Damage * 0.05f; - if ((int)healAmt == 0) - return; - - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Ranged/SpeedBlasterShot.cs b/Projectiles/Ranged/SpeedBlasterShot.cs index 5a5d5f816b..d5258593dc 100644 --- a/Projectiles/Ranged/SpeedBlasterShot.cs +++ b/Projectiles/Ranged/SpeedBlasterShot.cs @@ -16,6 +16,8 @@ namespace CalamityMod.Projectiles.Ranged public bool DashShot => Projectile.ai[1] == 3f; // the big shot public bool PostDashShot => Projectile.ai[1] == 2f; // the higher velocity post dash shots + public Color MainColor; + public bool PostHit = false; public static readonly SoundStyle ShotImpact = new("CalamityMod/Sounds/Item/SplatshotImpact") { PitchVariance = 0.3f, Volume = 2.5f }; public static readonly SoundStyle ShotImpactBig = new("CalamityMod/Sounds/Item/SplatshotBigImpact") { PitchVariance = 0.3f, Volume = 4f }; @@ -30,25 +32,52 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = Projectile.height = 14; Projectile.friendly = true; - Projectile.penetrate = 1; + Projectile.penetrate = -1; Projectile.MaxUpdates = 2; Projectile.timeLeft = 150 * Projectile.MaxUpdates; Projectile.DamageType = DamageClass.Ranged; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { + if (PostHit) + { + Projectile.velocity = Projectile.velocity * 0.01f; + Projectile.scale *= 0.95f; + Projectile.tileCollide = false; + } + switch (Projectile.ai[0]) + { + case 0: + default: + MainColor = Color.Cyan; + break; + case 1: + MainColor = Color.Blue; + break; + case 2: + MainColor = Color.Magenta; + break; + case 3: + MainColor = Color.Lime; + break; + case 4: + MainColor = Color.Yellow; + break; + } + if (Projectile.ai[2] != 1f) { if (DashShot) { Projectile.scale = 2f; Projectile.penetrate = 4; - Projectile.MaxUpdates = 30; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.timeLeft = 60 * Projectile.MaxUpdates; + Projectile.extraUpdates = 90; + Projectile.timeLeft = 120 * Projectile.extraUpdates; + Projectile.velocity *= 0.3f; } else if (PostDashShot) Projectile.MaxUpdates = 3; @@ -57,11 +86,14 @@ namespace CalamityMod.Projectiles.Ranged } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Projectile.velocity *= (DashShot ? 1f : PostDashShot ? 0.985f : 0.97f); - Projectile.velocity.Y += (DashShot ? 0f : PostDashShot ? 0.15f : 0.25f); + if (!PostHit) + { + Projectile.velocity *= (DashShot ? 1f : PostDashShot ? 0.985f : 0.97f); + Projectile.velocity.Y += (DashShot ? 0f : PostDashShot ? 0.15f : 0.25f); + } Color ColorUsed = GetColor(Projectile.ai[0]); - if (Main.rand.NextBool(20) && !DashShot) + if (Main.rand.NextBool(20) && !DashShot && !PostHit) { Dust dust = Dust.NewDustPerfect(Projectile.Center, 192); dust.noLight = true; @@ -73,24 +105,26 @@ namespace CalamityMod.Projectiles.Ranged } if (DashShot) { - Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(Main.rand.Next(-5, 5), Main.rand.Next(-5, 5)), 279); - dust2.noLightEmittence = true; - dust2.noGravity = true; - dust2.scale = Main.rand.NextFloat(2.5f, 3.8f); - dust2.velocity = Vector2.Zero; - dust2.color = ColorUsed; - dust2.alpha = 15; - - for (int i = 0; i <= 2; i++) + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (targetDist < 1400f) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 192); - dust.noLight = true; - dust.noGravity = false; - dust.scale = Main.rand.NextFloat(1.3f, 1.5f); - dust.velocity = new Vector2(Main.rand.Next(-1, 1), Main.rand.Next(0, 8)).RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.05f, 0.3f); - dust.color = ColorUsed; - dust.alpha = Main.rand.Next(145, 240); + GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 15, 1.35f, MainColor, true, false, false); + GeneralParticleHandler.SpawnParticle(spark); } + if (targetDist < 1400f && Main.rand.NextBool()) + { + GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2f, 2f), -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 15, 1.35f, MainColor, true, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + + Dust dust = Dust.NewDustPerfect(Projectile.Center, 192); + dust.noLight = true; + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(1.3f, 1.5f); + dust.velocity = new Vector2(Main.rand.Next(-1, 1), Main.rand.Next(0, 8)).RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.05f, 0.3f); + dust.color = ColorUsed; + dust.alpha = Main.rand.Next(145, 240); } if (Projectile.timeLeft == 300 && DashShot) { @@ -118,6 +152,7 @@ namespace CalamityMod.Projectiles.Ranged } } + public override bool? CanHitNPC(NPC target) => !PostHit ? null : false; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { Color ColorUsed = GetColor(Projectile.ai[0]); @@ -126,31 +161,43 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.numHits == 0) SoundEngine.PlaySound(ShotImpactBig, Projectile.position); + Vector2 BurstFXDirection = new Vector2(5, 0).RotatedByRandom(100); for (int i = 0; i < 2; i++) { - CritSpark spark = new CritSpark(Projectile.Center, Vector2.Zero, Color.White, ColorUsed, 5.5f, 7, 10f, 4.5f); + SparkParticle spark = new SparkParticle(Projectile.Center, (BurstFXDirection) * (i + 1), false, 7, 1.5f - i * 0.6f, MainColor * 0.8f); GeneralParticleHandler.SpawnParticle(spark); } + for (int i = 0; i < 2; i++) + { + SparkParticle spark = new SparkParticle(Projectile.Center, (-BurstFXDirection) * (i + 1), false, 7, 1.5f - i * 0.6f, MainColor * 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + + Particle orb = new GenericBloom(Projectile.Center, Vector2.Zero, MainColor, 0.6f, 13, false); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new GenericBloom(Projectile.Center, Vector2.Zero, Color.White, 0.5f, 12, false); + GeneralParticleHandler.SpawnParticle(orb2); + } + else + { + for (int i = 0; i <= 8; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(7, 7), 192, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(20f)) * Main.rand.NextFloat(0.05f, 0.45f), 0, default, Main.rand.NextFloat(0.6f, 1.2f)); + dust.noLight = true; + dust.noGravity = false; + dust.color = GetColor(Projectile.ai[0]); + dust.alpha = 75; + } + Projectile.timeLeft = 15; + PostHit = true; } } - public override void OnKill(int timeLeft) + public override bool OnTileCollide(Vector2 oldVelocity) { - if (!DashShot) - SoundEngine.PlaySound(ShotImpact, Projectile.position); - - for (int i = 0; i <= 8; i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.position, 192, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(20f)) * Main.rand.NextFloat(0.05f, 0.3f), 0, default, Main.rand.NextFloat(0.6f, 1.2f)); - dust.noLight = true; - dust.noGravity = false; - dust.color = GetColor(Projectile.ai[0]); - dust.alpha = 75; - } - for (int i = 0; i < 3; i++) { Vector2 paintPos = Projectile.Center + Main.rand.NextVector2Circular(12f, 12f) + (Projectile.velocity.SafeNormalize(Vector2.UnitY)).RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(4f, 20f); - float paintSize = Main.rand.NextFloat(60f, 100f); + float paintSize = Main.rand.NextFloat(40f, 70f); switch (Projectile.ai[0]) { case 0: @@ -171,6 +218,14 @@ namespace CalamityMod.Projectiles.Ranged break; } } + Projectile.timeLeft = 15; + PostHit = true; + return false; + } + public override void OnKill(int timeLeft) + { + if (!DashShot) + SoundEngine.PlaySound(ShotImpact, Projectile.position); } public static Color GetColor(float type) => type == 0 ? Color.Aqua : type == 1 ? Color.Blue : type == 2 ? Color.Fuchsia : type == 3 ? Color.Lime : Color.Yellow; diff --git a/Projectiles/Ranged/TerraArrowMain.cs b/Projectiles/Ranged/TerraArrowMain.cs index aad9ff189e..9560e5d5d5 100644 --- a/Projectiles/Ranged/TerraArrowMain.cs +++ b/Projectiles/Ranged/TerraArrowMain.cs @@ -52,8 +52,13 @@ namespace CalamityMod.Projectiles.Ranged Vector2 vel1 = (Projectile.velocity * 0.4f).RotatedBy(Main.rand.NextFloat(0.015f, 0.04f)); Vector2 vel2 = (Projectile.velocity * 0.4f).RotatedBy(Main.rand.NextFloat(-0.015f, -0.04f)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel1 * Main.rand.NextFloat(0.95f, 1.05f), ModContent.ProjectileType(), (int)(Projectile.damage * 3), 0f, Projectile.owner, 0f, hitDirect ? 1f : 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel2 * Main.rand.NextFloat(0.95f, 1.05f), ModContent.ProjectileType(), (int)(Projectile.damage * 3), 0f, Projectile.owner, 0f, hitDirect ? 1f : 0f); + int split1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel1 * Main.rand.NextFloat(0.95f, 1.05f), ModContent.ProjectileType(), (int)(Projectile.damage * 3), 0f, Projectile.owner, 0f, hitDirect ? 1f : 0f); + int split2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel2 * Main.rand.NextFloat(0.95f, 1.05f), ModContent.ProjectileType(), (int)(Projectile.damage * 3), 0f, Projectile.owner, 0f, hitDirect ? 1f : 0f); + if (Projectile.Calamity().allProjectilesHome) // Allows the split arrows to home when using Arterial Assault as well + { + Main.projectile[split1].Calamity().allProjectilesHome = true; + Main.projectile[split2].Calamity().allProjectilesHome = true; + } PointParticle spark = new PointParticle(Projectile.Center - Projectile.velocity + Projectile.velocity.RotatedBy(2.3f), Projectile.velocity.RotatedBy(2.3f) * 0.5f, false, 5, 1.1f, Color.LimeGreen); GeneralParticleHandler.SpawnParticle(spark); diff --git a/Projectiles/Ranged/TheHiveHoldout.cs b/Projectiles/Ranged/TheHiveHoldout.cs new file mode 100644 index 0000000000..9a3de185a6 --- /dev/null +++ b/Projectiles/Ranged/TheHiveHoldout.cs @@ -0,0 +1,341 @@ +using System; +using System.Runtime.InteropServices; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Mono.Cecil; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TheHiveHoldout : ModProjectile, ILocalizedModType + { + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + + public override string Texture => "CalamityMod/Items/Weapons/Ranged/TheHive"; + + // The type of dust used in the effects and the color of the particles that it'll use depending on the type of rocket used. + // It'll carry over to the projectiles that it shoots. + public static int DustEffectsID { get; set; } + public static Color EffectsColor { get; set; } + public static Color StaticEffectsColor = Color.Lime; + private ref float ShootingTimer => ref Projectile.ai[0]; + private bool FireNuke; + private float PostFireCooldown = 0; + private bool HasLetGo = false; + private SlotId HiveHum; + + private ref float OffsetLength => ref Projectile.localAI[0]; + + private Player Owner; + + private const float MaxOffsetLength = 15f; + private const float MaxCharge = 90f; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 66; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.netImportant = true; + } + + public override void AI() + { + FireNuke = ShootingTimer > MaxCharge; + Item heldItem = Owner.ActiveItem(); + + if (ShootingTimer == 0) + { + SoundStyle charge = new("CalamityMod/Sounds/Item/LowHum"); + HiveHum = SoundEngine.PlaySound(charge with { Volume = 1.6f, IsLooped = true }, Projectile.Center); + } + // If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout. + if (Owner.CantUseHoldout() && !HasLetGo || heldItem.type != ItemType()) + { + if (SoundEngine.TryGetActiveSound(HiveHum, out var hum) && hum.IsPlaying) + { + hum?.Stop(); + } + ShootRocket(heldItem); + NetUpdate(); + HasLetGo = true; + } + if (HasLetGo) + { + PostFiringCooldown(); + } + + // The center of the player, taking into account if they have a mount or not. + Vector2 ownerPosition = Owner.MountedCenter; + + // The vector between the player and the mouse. + Vector2 ownerToMouse = Owner.Calamity().mouseWorld - ownerPosition; + + // Deals with the holdout's rotation and direction, the owner's arms, etc. + ManageHoldout(ownerPosition, ownerToMouse); + + // When we change the distance of the gun from the arms for the recoil, + // recover to the original position smoothly. + if (OffsetLength != MaxOffsetLength) + OffsetLength = MathHelper.Lerp(OffsetLength, MaxOffsetLength, 0.1f); + + if (!HasLetGo) + { + ShootingTimer++; + if (SoundEngine.TryGetActiveSound(HiveHum, out var hum) && hum.IsPlaying) + { + hum.Position = Projectile.Center; + hum.Pitch = MathHelper.Lerp(0f, 0.8f, Utils.GetLerpValue(0f, MaxCharge, ShootingTimer, true)); + } + } + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero) * 33f; + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero) * 20; + if (ShootingTimer >= MaxCharge && !HasLetGo) + { + for (int k = 0; k < 2; k++) + { + GlowOrbParticle spark = new GlowOrbParticle(tipPosition + Projectile.velocity * 1.5f, Vector2.Zero, false, 2, Main.rand.NextFloat(0.5f, 1.1f), Color.Red); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int e = 0; e < 2; e++) + { + Dust dust2 = Dust.NewDustPerfect(tipPosition + Projectile.velocity * 1.5f, 90, shootDirection * Main.rand.NextFloat(0.01f, 0.8f)); + dust2.scale = Main.rand.NextFloat(0.45f, 0.75f); + dust2.noGravity = true; + } + } + + if (ShootingTimer == MaxCharge && !HasLetGo) + { + SoundStyle fullCharge = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGAttackSwitchShort"); + SoundEngine.PlaySound(fullCharge with { Volume = 0.9f}, Projectile.Center); + for (int k = 0; k < 15; k++) + { + Dust dust2 = Dust.NewDustPerfect(tipPosition, 90, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f)); + dust2.scale = Main.rand.NextFloat(0.85f, 1.15f); + dust2.noGravity = true; + } + } + } + + private void ManageHoldout(Vector2 mountedCenter, Vector2 ownerToMouse) + { + Vector2 rotationVector = Projectile.rotation.ToRotationVector2(); + float velocityRotation = Projectile.velocity.ToRotation(); + float proximityLookingUpwards = Vector2.Dot(ownerToMouse.SafeNormalize(Vector2.Zero), -Vector2.UnitY); + int direction = MathF.Sign(ownerToMouse.X); + + Vector2 armPosition = Owner.RotatedRelativePoint(mountedCenter, true); + Vector2 lengthOffset = rotationVector * OffsetLength; + Vector2 armOffset = new Vector2(Utils.Remap(proximityLookingUpwards, -1f, 1f, 0f, -12f) * direction, -10f + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? 15f : 0f)); + Projectile.Center = armPosition + lengthOffset + armOffset; + Projectile.velocity = velocityRotation.AngleTowards(ownerToMouse.ToRotation(), 0.2f).ToRotationVector2(); + Projectile.rotation = velocityRotation; + Projectile.timeLeft = 2; + + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = Owner.itemAnimation = 2; + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + + Projectile.spriteDirection = Projectile.direction = direction; + Owner.ChangeDir(direction); + + float armRotation = Projectile.rotation - MathHelper.PiOver2; // -Pi/2 because the arms rotation starts with arms pointing down. + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Quarter, armRotation); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armRotation + MathHelper.ToRadians(15f) * direction); + + // Rumble (only while channeling) + float rumble = Utils.GetLerpValue(0f, MaxCharge, ShootingTimer, true) * ShootingTimer >= MaxCharge ? 2 : 0.8f; + if (!Owner.CantUseHoldout()) + Projectile.Center += Main.rand.NextVector2Circular(rumble, rumble); + } + + private void ShootRocket(Item item) + { + // We use the velocity of this projectile as its direction vector. + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + float VelocityMultiplier = MathHelper.Lerp(0.5f, 1.5f, Utils.GetLerpValue(0f, MaxCharge, ShootingTimer, true)); + + // The position of the tip of the gun. + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero) * 33f; + + // Every time we shoot we use ammo. + // With this method we also use the item's stats, like the shoot speed, or the type of ammo it was used. + Owner.PickAmmo(item, out _, out float projSpeed, out int damage, out float knockback, out int rocketType); + + // Decides the color of the effects depending on the type of rocket used. + switch (rocketType) + { + case ItemID.WetRocket: + DustEffectsID = 45; + EffectsColor = Color.RoyalBlue; + break; + case ItemID.LavaRocket: + DustEffectsID = DustID.Torch; + EffectsColor = Color.Red; + break; + case ItemID.HoneyRocket: + DustEffectsID = DustID.Honey; + EffectsColor = Color.Yellow; + break; + default: + DustEffectsID = 131; + EffectsColor = Color.LawnGreen; + break; + } + + // Spawns the projectile. + if (FireNuke) + { + SoundStyle fire = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGBarrageLaunch"); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = 0.1f }, Projectile.Center); + + Projectile.NewProjectileDirect( + Projectile.GetSource_FromThis(), + tipPosition, + shootDirection * projSpeed * 0.3f, + ProjectileType(), + damage, + knockback, + Projectile.owner, + rocketType); + PostFireCooldown = 75; + } + else + { + SoundStyle fire = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGBarrageLaunch"); + SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = 0.7f }, Projectile.Center); + + int numProj = 4; + float rotation = MathHelper.ToRadians(MathHelper.Clamp(35 - VelocityMultiplier * 26, 2, 25)); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = (shootDirection).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectileDirect( + Projectile.GetSource_FromThis(), + tipPosition, + perturbedSpeed * projSpeed * VelocityMultiplier, + ProjectileType(), + damage / 4, + knockback, + Projectile.owner, + rocketType); + } + PostFireCooldown = 30; + } + + NetUpdate(); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + if (FireNuke) + { + for (int k = 0; k < 10; k++) + { + float pulseScale = Main.rand.NextFloat(0.35f, 0.55f); + DirectionalPulseRing pulse = new DirectionalPulseRing(tipPosition, (shootDirection * 25).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.5f, 1.2f), (Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor) * 0.8f, new Vector2(1, 1), pulseScale - 0.25f, pulseScale, 0f, 20); + GeneralParticleHandler.SpawnParticle(pulse); + } + for (int i = 0; i <= 15; i++) + { + Dust dust = Dust.NewDustPerfect(tipPosition, Main.rand.NextBool(3) ? DustEffectsID : 303, (shootDirection * 20).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.5f, 1.2f), 0, default, Main.rand.NextFloat(0.5f, 0.9f)); + dust.noGravity = false; + if (dust.type != DustEffectsID) + dust.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor; + } + } + else + { + for (int k = 0; k < 6; k++) + { + float pulseScale = Main.rand.NextFloat(0.2f, 0.4f); + DirectionalPulseRing pulse = new DirectionalPulseRing(tipPosition, (shootDirection * 20).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.5f, 1.2f), (Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor) * 0.8f, new Vector2(1, 1), pulseScale - 0.25f, pulseScale, 0f, 20); + GeneralParticleHandler.SpawnParticle(pulse); + } + } + + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + OffsetLength -= FireNuke ? 16f : 6f; + } + private void PostFiringCooldown() + { + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero) * 33f; + + if (PostFireCooldown > 0) + { + PostFireCooldown--; + Vector2 smokeVel = new Vector2(0, -8) * Main.rand.NextFloat(0.1f, 1.1f); + Particle smoke = new HeavySmokeParticle(tipPosition, smokeVel, StaticEffectsColor, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + + Dust dust = Dust.NewDustPerfect(tipPosition, 303, smokeVel.RotatedByRandom(0.1f), 80, default, Main.rand.NextFloat(0.4f, 1.3f)); + dust.noGravity = false; + dust.color = StaticEffectsColor; + } + else + { + if (SoundEngine.TryGetActiveSound(HiveHum, out var hum) && hum.IsPlaying) + { + hum?.Stop(); + } + Projectile.Kill(); + NetUpdate(); + } + } + + private void NetUpdate() + { + Projectile.netUpdate = true; + if (Projectile.netSpam >= 10) + Projectile.netSpam = 9; + } + + public override void OnSpawn(IEntitySource source) + { + Owner = Main.player[Projectile.owner]; + OffsetLength = MaxOffsetLength; + } + + // Because we use the velocity as a direction, we don't need it to change its position. + public override bool ShouldUpdatePosition() => false; + + public override bool? CanDamage() => false; + + public override bool PreDraw(ref Color lightColor) + { + if (ShootingTimer <= 0) + return false; + + Texture2D texture = Request(Texture).Value; + Texture2D glowTexture = Request(Texture + "_Glow").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + 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; + + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + Main.EntitySpriteDraw(glowTexture, drawPosition, null, Color.White, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + return false; + } + } +} diff --git a/Projectiles/Ranged/VeriumBulletProj.cs b/Projectiles/Ranged/VeriumBulletProj.cs index a7a5a59e0d..0e7622e76c 100644 --- a/Projectiles/Ranged/VeriumBulletProj.cs +++ b/Projectiles/Ranged/VeriumBulletProj.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.extraUpdates = 1; AIType = ProjectileID.Bullet; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 12; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } diff --git a/Projectiles/Ranged/WaterSpout.cs b/Projectiles/Ranged/WaterSpout.cs index 24883fa225..1793c7087d 100644 --- a/Projectiles/Ranged/WaterSpout.cs +++ b/Projectiles/Ranged/WaterSpout.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Ranged } if (Projectile.ai[0] <= 0f) { - float swaySize = 0.104719758f; + float swaySize = MathHelper.Pi / 30f; float smolWidth = (float)Projectile.width / 5f; float projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; Projectile.position.X = Projectile.position.X - projXChange * (float)-(float)Projectile.direction; diff --git a/Projectiles/Rogue/AcidBarrelDrop.cs b/Projectiles/Rogue/AcidBarrelDrop.cs index 5f938fd6ca..0591f2951a 100644 --- a/Projectiles/Rogue/AcidBarrelDrop.cs +++ b/Projectiles/Rogue/AcidBarrelDrop.cs @@ -24,30 +24,46 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.tileCollide = true; Projectile.ignoreWater = false; - Projectile.timeLeft = 420; + Projectile.timeLeft = 840; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; Projectile.DamageType = RogueDamageClass.Instance; } public override void AI() { - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (Projectile.velocity.Y <= 8f) + if (Main.rand.NextBool()) { - Projectile.velocity.Y += 0.15f; + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.JungleTorch); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.65f, 0.8f); + dust.velocity = -Projectile.velocity * 0.4f; + } + + if (Projectile.ai[0] < 3) + { + if (Projectile.timeLeft == 839) + Projectile.velocity *= 0.5f; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + if (Projectile.velocity.Y <= 12f) + { + Projectile.velocity.Y += 0.15f; + } + Projectile.tileCollide = Projectile.timeLeft <= 300; } - Projectile.tileCollide = Projectile.timeLeft <= 300; } public override bool OnTileCollide(Vector2 oldVelocity) { // Water drip for (int i = 0; i < 4; i++) { - int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, DustID.Rain, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); + int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, DustID.JungleTorch, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); Dust dust = Main.dust[idx]; dust.position.X -= 2f; Main.dust[idx].alpha = 38; - Main.dust[idx].velocity *= 0.1f; + Main.dust[idx].velocity *= Projectile.velocity.RotatedByRandom(0.3f) * 0.4f; Main.dust[idx].velocity -= Projectile.velocity * 0.025f; - Main.dust[idx].scale = 0.75f; + Main.dust[idx].scale = 0.85f; } return true; } diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.cs b/Projectiles/Rogue/BallisticPoisonBombProj.cs index 47115fe94a..1085f9f558 100644 --- a/Projectiles/Rogue/BallisticPoisonBombProj.cs +++ b/Projectiles/Rogue/BallisticPoisonBombProj.cs @@ -1,5 +1,4 @@ using System; -using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -59,19 +58,19 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.ExpandHitboxBy(128); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - int projAmt = Main.rand.Next(3, 5); + int spikeAmt = Main.rand.Next(3, 4+1); if (Projectile.owner == Main.myPlayer) { - for (int s = 0; s < projAmt; s++) + for (int s = 0; s < spikeAmt; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner); } - int cloudAmt = Main.rand.Next(8, 13); + int cloudAmt = Projectile.Calamity().stealthStrike ? Main.rand.Next(8, 12+1) : Main.rand.Next(3, 5+1); for (int c = 0; c < cloudAmt; c++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, Projectile.Calamity().stealthStrike ? 1f : 0f); } } for (int d = 0; d < 5; d++) diff --git a/Projectiles/Typeless/BallisticPoisonCloud.cs b/Projectiles/Rogue/BallisticPoisonCloud.cs similarity index 90% rename from Projectiles/Typeless/BallisticPoisonCloud.cs rename to Projectiles/Rogue/BallisticPoisonCloud.cs index 49593f016c..47f612c1ef 100644 --- a/Projectiles/Typeless/BallisticPoisonCloud.cs +++ b/Projectiles/Rogue/BallisticPoisonCloud.cs @@ -3,7 +3,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Typeless +namespace CalamityMod.Projectiles.Rogue { public class BallisticPoisonCloud : ModProjectile, ILocalizedModType { @@ -62,8 +62,8 @@ namespace CalamityMod.Projectiles.Typeless } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 120); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, Projectile.ai[1] == 1f ? 240 : 120); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Venom, 120); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Venom, Projectile.ai[1] == 1f ? 240 : 120); } } diff --git a/Projectiles/Typeless/BallisticPoisonCloud.png b/Projectiles/Rogue/BallisticPoisonCloud.png similarity index 100% rename from Projectiles/Typeless/BallisticPoisonCloud.png rename to Projectiles/Rogue/BallisticPoisonCloud.png diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index 377d4ce7fe..ac23376dd9 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Balancing; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -85,15 +87,16 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - OnHitEffects(!target.canGhostHeal || Main.player[Projectile.owner].moonLeech); + if (target.lifeMax > 5) + OnHitEffects(hit.Damage); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - OnHitEffects(Main.player[Projectile.owner].moonLeech); + OnHitEffects(info.Damage); } - private void OnHitEffects(bool cannotLifesteal) + private void OnHitEffects(int damage) { grind += 5; //THE GRIND NEVER STOPS if (grind > 15) @@ -112,12 +115,11 @@ namespace CalamityMod.Projectiles.Rogue } } - if (cannotLifesteal || Main.rand.NextBool()) //canGhostHeal be like lol + int heal = (int)Math.Round(damage * 0.01); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - Player player = Main.player[Projectile.owner]; - player.statLife += 1; - player.HealEffect(1); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) //afterimages diff --git a/Projectiles/Rogue/CorpusAvertorClone.cs b/Projectiles/Rogue/CorpusAvertorClone.cs index becb2aef19..2375e037c7 100644 --- a/Projectiles/Rogue/CorpusAvertorClone.cs +++ b/Projectiles/Rogue/CorpusAvertorClone.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Balancing; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -70,32 +71,20 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - float heal = hit.Damage * 0.05f; - if ((int)heal == 0) + int heal = (int)Math.Round(hit.Damage * 0.05); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - float heal = info.Damage * 0.05f; - if ((int)heal == 0) + int heal = (int)Math.Round(info.Damage * 0.05); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Rogue/CorpusAvertorProj.cs b/Projectiles/Rogue/CorpusAvertorProj.cs index 9671098f81..e358b1a786 100644 --- a/Projectiles/Rogue/CorpusAvertorProj.cs +++ b/Projectiles/Rogue/CorpusAvertorProj.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Balancing; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -77,32 +78,20 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - float heal = hit.Damage * 0.05f; - if ((int)heal == 0) + int heal = (int)Math.Round(hit.Damage * 0.05); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - float heal = info.Damage * 0.05f; - if ((int)heal == 0) + int heal = ((int)Math.Round(info.Damage * 0.05)); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Rogue/CorpusAvertorStealth.cs b/Projectiles/Rogue/CorpusAvertorStealth.cs index 27e50bfe52..5e43c7cb12 100644 --- a/Projectiles/Rogue/CorpusAvertorStealth.cs +++ b/Projectiles/Rogue/CorpusAvertorStealth.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Balancing; using CalamityMod.Buffs.StatBuffs; using Microsoft.Xna.Framework; using Terraria; @@ -55,7 +56,8 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - OnHitEffects(hit.Damage); + if (target.lifeMax > 5) + OnHitEffects(hit.Damage); } public override void OnHitPlayer(Player target, Player.HurtInfo info) @@ -80,17 +82,11 @@ namespace CalamityMod.Projectiles.Rogue Main.LocalPlayer.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(20f), true); player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(20f), true); - float heal = damage * 0.025f; - if ((int)heal == 0) + int heal = (int)Math.Round(damage * 0.025); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, player, heal, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, player, heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Rogue/DragonScalesInfernado.cs b/Projectiles/Rogue/DragonScalesInfernado.cs index 7d8f94c44a..dfdf80fe30 100644 --- a/Projectiles/Rogue/DragonScalesInfernado.cs +++ b/Projectiles/Rogue/DragonScalesInfernado.cs @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Rogue } if (Projectile.ai[0] <= 0f) { - float constant = 0.104719758f; + float constant = MathHelper.Pi / 30f; float smallWidth = (float)Projectile.width / 5f; smallWidth *= 2f; float xFluctuation = (float)(Math.Cos((double)(constant * -(double)Projectile.ai[0])) - 0.5) * smallWidth; diff --git a/Projectiles/Rogue/LionfishProj.cs b/Projectiles/Rogue/LionfishProj.cs index 7e83aabb55..ba42808e90 100644 --- a/Projectiles/Rogue/LionfishProj.cs +++ b/Projectiles/Rogue/LionfishProj.cs @@ -50,12 +50,12 @@ namespace CalamityMod.Projectiles.Rogue } if (Projectile.Calamity().stealthStrike) { - if (Projectile.timeLeft % 8 == 0 && Projectile.owner == Main.myPlayer) + if (Projectile.timeLeft % 7 == 0 && Projectile.owner == Main.myPlayer) { Vector2 velocity = Projectile.DirectionFrom(Main.player[Projectile.owner].Center); velocity *= Main.rand.NextFloat(4.5f, 6.5f); velocity = velocity.RotatedBy((Main.rand.NextDouble() - 0.5) * Math.PI * 0.5, default); - int spike = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, -10f, 0f); + int spike = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, -10f, 1f); if (spike.WithinBounds(Main.maxProjectiles)) Main.projectile[spike].DamageType = RogueDamageClass.Instance; } @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.StickyProjAI(15); } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(6); + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(3); public override bool? CanDamage() => Projectile.ai[0] == 1f ? false : base.CanDamage(); public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Rogue/PhantasmalSoul.cs b/Projectiles/Rogue/PhantasmalSoul.cs index 166589346e..263c73a0dd 100644 --- a/Projectiles/Rogue/PhantasmalSoul.cs +++ b/Projectiles/Rogue/PhantasmalSoul.cs @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Rogue } // Special quieter version of this noise used by Soul Edge and similar - SoundEngine.PlaySound(SoulEdge.ProjectileDeathSound, Projectile.Center); + SoundEngine.PlaySound(VoidEdge.ProjectileDeathSound, Projectile.Center); } // Cannot deal damage for the first several frames of existence. diff --git a/Projectiles/Rogue/RegulusRiotProj.cs b/Projectiles/Rogue/RegulusRiotProj.cs index ca47d5ad38..691617289c 100644 --- a/Projectiles/Rogue/RegulusRiotProj.cs +++ b/Projectiles/Rogue/RegulusRiotProj.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue } if (behaviorInt == 0) { - Projectile.rotation -= 0.104719758f; + Projectile.rotation -= MathHelper.Pi / 30f; if (Projectile.ai[0] >= 30f) { @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Rogue } else if (behaviorInt == 1) { - Projectile.rotation -= 0.104719758f; + Projectile.rotation -= MathHelper.Pi / 30f; Vector2 targetCenter = Projectile.Center; float homingRange = 300f; bool homeIn = false; diff --git a/Projectiles/Rogue/SacrificeProjectile.cs b/Projectiles/Rogue/SacrificeProjectile.cs index 69b1b7e32a..2c946b43b3 100644 --- a/Projectiles/Rogue/SacrificeProjectile.cs +++ b/Projectiles/Rogue/SacrificeProjectile.cs @@ -55,10 +55,17 @@ namespace CalamityMod.Projectiles.Rogue { if (!Owner.moonLeech && AbleToHealOwner) { - int healAmount = Projectile.Calamity().stealthStrike ? 40 : 3; + int heal = Projectile.Calamity().stealthStrike ? 40 : 3; - Owner.HealEffect(healAmount); - Owner.statLife += healAmount; + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + Projectile.Kill(); + return; + } + + Main.player[Main.myPlayer].lifeSteal -= heal; + Owner.HealEffect(heal); + Owner.statLife += heal; if (Owner.statLife > Owner.statLifeMax2) Owner.statLife = Owner.statLifeMax2; } diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index 33b3450ea2..95cfbaa567 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Balancing; using CalamityMod.Graphics.Primitives; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -126,12 +127,12 @@ namespace CalamityMod.Projectiles.Rogue if (!Projectile.Calamity().stealthStrike) return; - if (!Main.player[Projectile.owner].moonLeech) - { - // Give on-heal effects from stealth strikes. - Main.player[Projectile.owner].statLife += 90; - Main.player[Projectile.owner].HealEffect(90); - } + // Give on-heal effects from stealth strikes. + int heal = (int)Math.Round(hit.Damage * 0.01); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); // And spawn a bloom of bullets. SpawnOnStealthStrikeBullets(); @@ -145,8 +146,11 @@ namespace CalamityMod.Projectiles.Rogue return; // Give on-heal effects from stealth strikes. - Main.player[Projectile.owner].statLife += 120; - Main.player[Projectile.owner].HealEffect(120); + int heal = (int)Math.Round(info.Damage * 0.01); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); // And spawn a bloom of bullets. SpawnOnStealthStrikeBullets(); diff --git a/Projectiles/Rogue/ShinobiBladeProjectile.cs b/Projectiles/Rogue/ShinobiBladeProjectile.cs index 6d55405b97..2b457f6bdb 100644 --- a/Projectiles/Rogue/ShinobiBladeProjectile.cs +++ b/Projectiles/Rogue/ShinobiBladeProjectile.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Healing; +using CalamityMod.Balancing; +using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -60,14 +61,14 @@ namespace CalamityMod.Projectiles.Rogue echo.Calamity().stealthStrike = true; } - if (target.life <= 0) - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 10, ModContent.ProjectileType(), 1200f, 0f); + if (target.life <= 0 && target.lifeMax > 5) + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 10, ModContent.ProjectileType(), BalancingConstants.LifeStealRange, 0f); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { if (target.statLife <= 0) - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 10, ModContent.ProjectileType(), 1200f, 0f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 10, ModContent.ProjectileType(), BalancingConstants.LifeStealRange, 0f); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Rogue/SpentFuelContainerProjectile.cs b/Projectiles/Rogue/SpentFuelContainerProjectile.cs index adcad4f39c..8b23258ac2 100644 --- a/Projectiles/Rogue/SpentFuelContainerProjectile.cs +++ b/Projectiles/Rogue/SpentFuelContainerProjectile.cs @@ -19,23 +19,13 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 34; Projectile.friendly = true; Projectile.penetrate = 1; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 200; Projectile.tileCollide = true; Projectile.alpha = 0; + AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; } - public override void AI() - { - Projectile.ai[0] += 1f; //arbitrary timer - if (Projectile.ai[0] > 75f) - { - if (Projectile.velocity.Y < 10f) - { - Projectile.velocity.Y += 0.15f; - } - } - Projectile.rotation += MathHelper.ToRadians(Projectile.velocity.Length()); - } public override void OnKill(int timeLeft) { //Dust @@ -49,7 +39,7 @@ namespace CalamityMod.Projectiles.Rogue Point result; if (WorldUtils.Find(Projectile.Top.ToTileCoordinates(), Searches.Chain((GenSearch)new Searches.Down(80), (GenCondition)new Conditions.IsSolid()), out result)) { - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), result.ToVector2() * 16f, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 2f, Projectile.owner); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), result.ToVector2() * 16f, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * .5f), 2f, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = Projectile.Calamity().stealthStrike; } diff --git a/Projectiles/Rogue/SulphuricNukesplosion.cs b/Projectiles/Rogue/SulphuricNukesplosion.cs index bbb053492d..5280cd8d07 100644 --- a/Projectiles/Rogue/SulphuricNukesplosion.cs +++ b/Projectiles/Rogue/SulphuricNukesplosion.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.alpha = 255; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 11; + Projectile.idStaticNPCHitCooldown = 15; } public override bool PreAI() diff --git a/Projectiles/Summon/BloodSpit.cs b/Projectiles/Summon/BloodSpit.cs index 87d6a92e31..576fe6f59c 100644 --- a/Projectiles/Summon/BloodSpit.cs +++ b/Projectiles/Summon/BloodSpit.cs @@ -1,13 +1,15 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Balancing; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class BloodSpit : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; - public const int OnDeathHealValue = 1; public Player Owner => Main.player[Projectile.owner]; @@ -39,7 +41,7 @@ namespace CalamityMod.Projectiles.Summon } } - public override void OnKill(int timeLeft) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { for (int i = 0; i < 15; i++) { @@ -48,10 +50,11 @@ namespace CalamityMod.Projectiles.Summon blood.noGravity = true; } - Owner.HealEffect(OnDeathHealValue, false); - Owner.statLife += OnDeathHealValue; - if (Owner.statLife > Owner.statLifeMax2) - Owner.statLife = Owner.statLifeMax2; + int heal = (int)Math.Round(hit.Damage * 0.01); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Summon/HarvestStaffMinion.cs b/Projectiles/Summon/HarvestStaffMinion.cs index d87c206c15..34813bebac 100644 --- a/Projectiles/Summon/HarvestStaffMinion.cs +++ b/Projectiles/Summon/HarvestStaffMinion.cs @@ -169,6 +169,8 @@ namespace CalamityMod.Projectiles.Summon private SoundStyle _boomSound = new("CalamityMod/Sounds/Custom/PumpkinExplode", 2) { Volume = 0.6f }; + private SoundStyle _boomSoundGFB = new("CalamityMod/Sounds/Custom/PumpkinExplodeGFB", 2); + /// /// The owner of this minion. /// @@ -321,8 +323,10 @@ namespace CalamityMod.Projectiles.Summon dust.color = Color.Chocolate; } } - - SoundEngine.PlaySound(_boomSound, Projectile.Center); + if (Main.zenithWorld) + SoundEngine.PlaySound(_boomSoundGFB, Projectile.Center); + else + SoundEngine.PlaySound(_boomSound, Projectile.Center); } /// diff --git a/Projectiles/Summon/PinkButterfly.cs b/Projectiles/Summon/PinkButterfly.cs index e8155aa7fa..9f4b805ffc 100644 --- a/Projectiles/Summon/PinkButterfly.cs +++ b/Projectiles/Summon/PinkButterfly.cs @@ -226,7 +226,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projDirectionAgain.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, projectileType, (int)(Projectile.damage * 0.8f), Projectile.knockBack * 0.5f, Projectile.owner, targetIndex, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, projectileType, (int)(Projectile.damage * 0.85f), Projectile.knockBack * 0.5f, Projectile.owner, targetIndex, 0f); } Projectile.netUpdate = true; } diff --git a/Projectiles/Summon/VileFeederSummon.cs b/Projectiles/Summon/VileFeederSummon.cs index f304c57678..45fff4b185 100644 --- a/Projectiles/Summon/VileFeederSummon.cs +++ b/Projectiles/Summon/VileFeederSummon.cs @@ -17,14 +17,14 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Projectile.type] = 3; ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - Projectile.width = Projectile.height = 30; + Projectile.width = Projectile.height = 32; Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; @@ -93,12 +93,12 @@ namespace CalamityMod.Projectiles.Summon eaterCooldown--; Projectile.ChargingMinionAI(640f, 1100f, 2400f, 150f, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 8f, false, false); Projectile.frameCounter++; - if (Projectile.frameCounter > 3) + if (Projectile.frameCounter > 4) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= 4) + if (Projectile.frame >= 3) { Projectile.frame = 0; } diff --git a/Projectiles/Summon/VileFeederSummon.png b/Projectiles/Summon/VileFeederSummon.png index e036795029..60e3a27d98 100644 Binary files a/Projectiles/Summon/VileFeederSummon.png and b/Projectiles/Summon/VileFeederSummon.png differ diff --git a/Projectiles/Typeless/BasicPlagueBee.cs b/Projectiles/Typeless/BasicPlagueBee.cs new file mode 100644 index 0000000000..c0d4d88fed --- /dev/null +++ b/Projectiles/Typeless/BasicPlagueBee.cs @@ -0,0 +1,211 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BasicPlagueBee : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/Rogue/PlaguenadeBee"; + + public int time = 0; + public float projRotValue; + public NPC npc; + public int tileCollisions = 0; + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 5; + } + + public override void AI() + { + Color trailColor = Color.Lime; + if (time == 0) + trailColor = Main.rand.NextBool() ? Color.LawnGreen : Color.Lime; + time++; + + // If you would like the bees to home in sooner or later than normal, change Projectile.ai[0]! You can set it to anything above 30 to make them home in and damage immediately. + // If you set Projectile.ai[0] to a negative number, it will take longer before they begin homing. + + // You can set Projectile.ai[1] when spawning these bees to determine how long they inflict the plague debuff, default is 90 frames. + if (Projectile.ai[1] <= 0) + Projectile.ai[1] = 90; + + // You can set Projectile.ai[2] to change how detailed the bee's particle trail is. Higher is less detailed, default is 2. + // If you are spawning a lot of bees, consider raising the value to 3 or 4. + if (Projectile.ai[2] <= 0) + Projectile.ai[2] = 2; + + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.rotation += Projectile.spriteDirection * MathHelper.ToRadians(45f); + + Projectile.frameCounter++; + if (Projectile.frameCounter >= 3) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + { + Projectile.frame = 0; + } + + // If a bee bounces around a fuckload (probably got stuck in a tile) stop it from doing visuals and kill it, that bee is doomed anyways. + if (tileCollisions < 7) + { + if (time % Projectile.ai[2] == 0) + { + PointParticle orb = new PointParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 7, 0.35f, trailColor * 0.45f); + GeneralParticleHandler.SpawnParticle(orb); + + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 303, -Projectile.velocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.2f, 0.6f), 0, default, Main.rand.NextFloat(0.35f, 0.55f)); + dust.noGravity = true; + dust.color = Color.Black; + dust.alpha = Main.rand.Next(90, 220 + 1); + } + } + } + else + Projectile.Kill(); + + Vector2 center = Projectile.Center; + float maxDistance = 800f; + bool homeIn = false; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 30f) + { + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + if (time % 10 == 0 && npc == null) + npc = Projectile.Center.ClosestNPCAt(1000, false); + if (npc == null || !npc.CanBeChasedBy(Projectile, false)) + return; + if (npc.CanBeChasedBy(Projectile, false)) + { + float extraDistance = (npc.width / 2) + (npc.height / 2); + + bool canHit = true; + if (extraDistance < maxDistance) + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); + + if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance) && canHit) + { + center = npc.Center; + homeIn = true; + break; + } + } + } + } + if (!homeIn) + { + center.X = Projectile.Center.X + Projectile.velocity.X * 100f; + center.Y = Projectile.Center.Y + Projectile.velocity.Y * 100f; + } + float speed = 10f; + float velocityTweak = 0.30f; + Vector2 projPos = Projectile.Center; + Vector2 velocity = center - projPos; + float targetDist = velocity.Length(); + targetDist = speed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; + if (Projectile.velocity.X < velocity.X) + { + Projectile.velocity.X += velocityTweak; + if (Projectile.velocity.X < 0f && velocity.X > 0f) + { + Projectile.velocity.X += velocityTweak * 2f; + } + } + else if (Projectile.velocity.X > velocity.X) + { + Projectile.velocity.X -= velocityTweak; + if (Projectile.velocity.X > 0f && velocity.X < 0f) + { + Projectile.velocity.X -= velocityTweak * 2f; + } + } + if (Projectile.velocity.Y < velocity.Y) + { + Projectile.velocity.Y += velocityTweak; + if (Projectile.velocity.Y < 0f && velocity.Y > 0f) + { + Projectile.velocity.Y += velocityTweak * 2f; + } + } + else if (Projectile.velocity.Y > velocity.Y) + { + Projectile.velocity.Y -= velocityTweak; + if (Projectile.velocity.Y > 0f && velocity.Y < 0f) + { + Projectile.velocity.Y -= velocityTweak * 2f; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + tileCollisions++; + return false; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int drawStart = frameHeight * Projectile.frame; + SpriteEffects spriteEffects = SpriteEffects.None; + if (Projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), Projectile.scale, spriteEffects, 0); + return false; + } + + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 5; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 89, Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.7f, 0.85f)); + dust.noGravity = true; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), (int)(Projectile.ai[1])); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), (int)(Projectile.ai[1])); + + public override bool? CanDamage() => Projectile.ai[0] <= 30f ? false : null; + } +} diff --git a/Projectiles/Typeless/BlazingStarHeal.cs b/Projectiles/Typeless/BlazingStarHeal.cs index 27751acd4f..80e5d3a59c 100644 --- a/Projectiles/Typeless/BlazingStarHeal.cs +++ b/Projectiles/Typeless/BlazingStarHeal.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Typeless public class BlazingStarHeal : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/StarProj"; public override void SetDefaults() @@ -48,10 +49,10 @@ namespace CalamityMod.Projectiles.Typeless player.HealEffect(healAmt, false); player.statLife += healAmt; if (player.statLife > player.statLifeMax2) - { player.statLife = player.statLifeMax2; - } + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, index, healAmt); + Projectile.Kill(); } } diff --git a/Projectiles/Typeless/ChlorophyteLifePulse.cs b/Projectiles/Typeless/ChlorophyteLifePulse.cs index fcfcf917ff..0ee8f1d45a 100644 --- a/Projectiles/Typeless/ChlorophyteLifePulse.cs +++ b/Projectiles/Typeless/ChlorophyteLifePulse.cs @@ -13,8 +13,11 @@ namespace CalamityMod.Projectiles.Typeless public class ChlorophyteLifePulse : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; + public const int Lifetime = 60; + public float LifetimeCompletion => 1f - Projectile.timeLeft / (float)Lifetime; + public override void SetDefaults() { Projectile.width = 96; @@ -29,6 +32,7 @@ namespace CalamityMod.Projectiles.Typeless } public override bool? CanHitNPC(NPC target) => !target.CountsAsACritter && !target.friendly && target.chaseable; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => Projectile.damage = (int)(Projectile.damage * 0.8f); public override void AI() @@ -80,10 +84,7 @@ namespace CalamityMod.Projectiles.Typeless return false; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.scale * 48f, targetHitbox); - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.scale * 48f, targetHitbox); public override bool OnTileCollide(Vector2 oldVelocity) => false; } diff --git a/Projectiles/Typeless/FungalClumpMinion.cs b/Projectiles/Typeless/FungalClumpMinion.cs index 80e1a31ecf..dc99765b50 100644 --- a/Projectiles/Typeless/FungalClumpMinion.cs +++ b/Projectiles/Typeless/FungalClumpMinion.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Balancing; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; @@ -230,20 +231,14 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!target.canGhostHeal) + if (Main.player[Projectile.owner].moonLeech) return; - float healAmt = damageDone * 0.25f; - if ((int)healAmt == 0) + int heal = (int)Math.Round(damageDone * 0.25); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealAccessoryCooldownMultiplier); } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Typeless/MagnusBeam.cs b/Projectiles/Typeless/MagnusBeam.cs index f930085828..df56addd40 100644 --- a/Projectiles/Typeless/MagnusBeam.cs +++ b/Projectiles/Typeless/MagnusBeam.cs @@ -1,5 +1,7 @@ using System; +using CalamityMod.Balancing; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -200,14 +202,15 @@ namespace CalamityMod.Projectiles.Typeless { target.AddBuff(ModContent.BuffType(), 480); - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) + Player player = Main.player[Projectile.owner]; + player.statMana += 25; + player.ManaEffect(25); + + int heal = (int)Math.Round(hit.Damage * 0.1); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - Player player = Main.player[Projectile.owner]; - player.statLife += 1; - player.statMana += 25; - player.HealEffect(1); - player.ManaEffect(25); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Typeless/OmegaBlueTentacle.cs b/Projectiles/Typeless/OmegaBlueTentacle.cs index 6a51443164..0709d39abd 100644 --- a/Projectiles/Typeless/OmegaBlueTentacle.cs +++ b/Projectiles/Typeless/OmegaBlueTentacle.cs @@ -183,7 +183,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].lifeSteal > 0f && !Main.player[Projectile.owner].moonLeech) + if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].lifeSteal > 0f && !Main.player[Projectile.owner].moonLeech && target.lifeMax > 5) { int healAmount = 10 * damageDone / Projectile.damage; //should always be around max, less if enemy has defense/DR if (healAmount > 0) diff --git a/Skies/SCalScreenShaderData.cs b/Skies/SCalScreenShaderData.cs index c8541d92ea..92f0b5ca3a 100644 --- a/Skies/SCalScreenShaderData.cs +++ b/Skies/SCalScreenShaderData.cs @@ -54,8 +54,6 @@ namespace CalamityMod.Skies if (Main.npc[SCalIndex].ModNPC().cirrus) Filters.Scene["CalamityMod:SupremeCalamitas"].GetShader().UseColor(0.9f, 0.3f, 0.9f); - else - Filters.Scene["CalamityMod:SupremeCalamitas"].GetShader().UseColor(1.1f, 0.3f, 0.3f); } base.Apply(); } diff --git a/Sounds/Custom/BEES/Names.txt b/Sounds/Custom/BEES/Names.txt new file mode 100644 index 0000000000..440c8bb183 --- /dev/null +++ b/Sounds/Custom/BEES/Names.txt @@ -0,0 +1,12 @@ +Names: +1 - Aqua +2 - CIT +3 - Lilac +4 - Metarex +5 - moonburn +6 - Ozzatron +7 - Rebecca +8 - Shayy +9 - StipulatedVenus +10 - Xyk +11 - Shade \ No newline at end of file diff --git a/Sounds/Custom/BEES/bees1.ogg b/Sounds/Custom/BEES/bees1.ogg new file mode 100644 index 0000000000..274f40e28e Binary files /dev/null and b/Sounds/Custom/BEES/bees1.ogg differ diff --git a/Sounds/Custom/BEES/bees10.ogg b/Sounds/Custom/BEES/bees10.ogg new file mode 100644 index 0000000000..0889776deb Binary files /dev/null and b/Sounds/Custom/BEES/bees10.ogg differ diff --git a/Sounds/Custom/BEES/bees11.ogg b/Sounds/Custom/BEES/bees11.ogg new file mode 100644 index 0000000000..e81ebe6c9b Binary files /dev/null and b/Sounds/Custom/BEES/bees11.ogg differ diff --git a/Sounds/Custom/BEES/bees2.ogg b/Sounds/Custom/BEES/bees2.ogg new file mode 100644 index 0000000000..ce687af023 Binary files /dev/null and b/Sounds/Custom/BEES/bees2.ogg differ diff --git a/Sounds/Custom/BEES/bees3.ogg b/Sounds/Custom/BEES/bees3.ogg new file mode 100644 index 0000000000..ab9ebec9bc Binary files /dev/null and b/Sounds/Custom/BEES/bees3.ogg differ diff --git a/Sounds/Custom/BEES/bees4.ogg b/Sounds/Custom/BEES/bees4.ogg new file mode 100644 index 0000000000..739b488905 Binary files /dev/null and b/Sounds/Custom/BEES/bees4.ogg differ diff --git a/Sounds/Custom/BEES/bees5.ogg b/Sounds/Custom/BEES/bees5.ogg new file mode 100644 index 0000000000..89c30e1b0e Binary files /dev/null and b/Sounds/Custom/BEES/bees5.ogg differ diff --git a/Sounds/Custom/BEES/bees6.ogg b/Sounds/Custom/BEES/bees6.ogg new file mode 100644 index 0000000000..4927be0c9d Binary files /dev/null and b/Sounds/Custom/BEES/bees6.ogg differ diff --git a/Sounds/Custom/BEES/bees7.ogg b/Sounds/Custom/BEES/bees7.ogg new file mode 100644 index 0000000000..54d3edf5a2 Binary files /dev/null and b/Sounds/Custom/BEES/bees7.ogg differ diff --git a/Sounds/Custom/BEES/bees8.ogg b/Sounds/Custom/BEES/bees8.ogg new file mode 100644 index 0000000000..677b47fc65 Binary files /dev/null and b/Sounds/Custom/BEES/bees8.ogg differ diff --git a/Sounds/Custom/BEES/bees9.ogg b/Sounds/Custom/BEES/bees9.ogg new file mode 100644 index 0000000000..094a103a5b Binary files /dev/null and b/Sounds/Custom/BEES/bees9.ogg differ diff --git a/Sounds/Custom/BoomBoomKawaii.ogg b/Sounds/Custom/BoomBoomKawaii.ogg new file mode 100644 index 0000000000..da9529eb90 Binary files /dev/null and b/Sounds/Custom/BoomBoomKawaii.ogg differ diff --git a/Sounds/Custom/Codebreaker/ArtemisApolloIconHover.ogg b/Sounds/Custom/Codebreaker/ArtemisApolloIconHover.ogg index 8af3763f64..b334f9e6c8 100644 Binary files a/Sounds/Custom/Codebreaker/ArtemisApolloIconHover.ogg and b/Sounds/Custom/Codebreaker/ArtemisApolloIconHover.ogg differ diff --git a/Sounds/Custom/PlagueSounds/PBGAttackSwitchShort.ogg b/Sounds/Custom/PlagueSounds/PBGAttackSwitchShort.ogg new file mode 100644 index 0000000000..1e957a38c3 Binary files /dev/null and b/Sounds/Custom/PlagueSounds/PBGAttackSwitchShort.ogg differ diff --git a/Sounds/Custom/PumpkinExplodeGFB1.ogg b/Sounds/Custom/PumpkinExplodeGFB1.ogg new file mode 100644 index 0000000000..4ac22589d0 Binary files /dev/null and b/Sounds/Custom/PumpkinExplodeGFB1.ogg differ diff --git a/Sounds/Custom/PumpkinExplodeGFB2.ogg b/Sounds/Custom/PumpkinExplodeGFB2.ogg new file mode 100644 index 0000000000..9e1b31d931 Binary files /dev/null and b/Sounds/Custom/PumpkinExplodeGFB2.ogg differ diff --git a/Sounds/Custom/SCalSounds/BrimstoneMonsterDrone.ogg b/Sounds/Custom/SCalSounds/BrimstoneMonsterDrone.ogg index 4dc6b63415..26afb38c27 100644 Binary files a/Sounds/Custom/SCalSounds/BrimstoneMonsterDrone.ogg and b/Sounds/Custom/SCalSounds/BrimstoneMonsterDrone.ogg differ diff --git a/Sounds/Custom/SCalSounds/BrothersDeath1.ogg b/Sounds/Custom/SCalSounds/BrothersDeath1.ogg new file mode 100644 index 0000000000..87ee3d42b3 Binary files /dev/null and b/Sounds/Custom/SCalSounds/BrothersDeath1.ogg differ diff --git a/Sounds/Custom/SCalSounds/BrothersDeath2.ogg b/Sounds/Custom/SCalSounds/BrothersDeath2.ogg new file mode 100644 index 0000000000..75215c094c Binary files /dev/null and b/Sounds/Custom/SCalSounds/BrothersDeath2.ogg differ diff --git a/Sounds/Custom/SCalSounds/BrothersHurt1.ogg b/Sounds/Custom/SCalSounds/BrothersHurt1.ogg new file mode 100644 index 0000000000..8aa9efd153 Binary files /dev/null and b/Sounds/Custom/SCalSounds/BrothersHurt1.ogg differ diff --git a/Sounds/Custom/SCalSounds/BrothersHurt2.ogg b/Sounds/Custom/SCalSounds/BrothersHurt2.ogg new file mode 100644 index 0000000000..81784fe35e Binary files /dev/null and b/Sounds/Custom/SCalSounds/BrothersHurt2.ogg differ diff --git a/Sounds/Custom/SCalSounds/GFBDrone.ogg b/Sounds/Custom/SCalSounds/GFBDrone.ogg new file mode 100644 index 0000000000..bfabb1a582 Binary files /dev/null and b/Sounds/Custom/SCalSounds/GFBDrone.ogg differ diff --git a/Sounds/Custom/SCalSounds/SCalEndBH.ogg b/Sounds/Custom/SCalSounds/SCalEndBH.ogg new file mode 100644 index 0000000000..6c5860b3cb Binary files /dev/null and b/Sounds/Custom/SCalSounds/SCalEndBH.ogg differ diff --git a/Sounds/Custom/SCalSounds/SCalRumble.ogg b/Sounds/Custom/SCalSounds/SCalRumble.ogg new file mode 100644 index 0000000000..0ed9a09f26 Binary files /dev/null and b/Sounds/Custom/SCalSounds/SCalRumble.ogg differ diff --git a/Sounds/Item/LowHum.ogg b/Sounds/Item/LowHum.ogg new file mode 100644 index 0000000000..4dc6b63415 Binary files /dev/null and b/Sounds/Item/LowHum.ogg differ diff --git a/Sounds/Item/TheHiveNuke.ogg b/Sounds/Item/TheHiveNuke.ogg new file mode 100644 index 0000000000..ffd8ffea1e Binary files /dev/null and b/Sounds/Item/TheHiveNuke.ogg differ diff --git a/Systems/WorldMiscUpdateSystem.cs b/Systems/WorldMiscUpdateSystem.cs index 7cd2832ad7..5d3ecf9f98 100644 --- a/Systems/WorldMiscUpdateSystem.cs +++ b/Systems/WorldMiscUpdateSystem.cs @@ -320,7 +320,7 @@ namespace CalamityMod.Systems public static bool CanPlaceBasedOnProximity(int x, int y, int tileType) { - if (tileType == ModContent.TileType() && !DownedBossSystem.downedCalamitasClone) + if (tileType == ModContent.TileType() && !DownedBossSystem.downedLeviathan) return false; int minDistanceFromOtherTiles = 10; diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index e5bdd34868..80bd92fc32 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -216,7 +216,7 @@ namespace CalamityMod.Systems tasks.Insert(++currentFinalIndex, new PassLegacy("Aerialite", (progress, config) => { progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.Aerialite").Value; - AerialiteOreGen.Generate(false); + AerialiteOreGen.Generate(); })); // Draedon Labs diff --git a/Tiles/Abyss/PlantyMush.cs b/Tiles/Abyss/PlantyMush.cs index 6ba73b5bae..bb9c985a8a 100644 --- a/Tiles/Abyss/PlantyMush.cs +++ b/Tiles/Abyss/PlantyMush.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -25,6 +26,7 @@ namespace CalamityMod.Tiles.Abyss Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Organic"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithAbyss(Type); diff --git a/Tiles/Abyss/SulphurousSand.cs b/Tiles/Abyss/SulphurousSand.cs index f8732559ea..6fb2c179e3 100644 --- a/Tiles/Abyss/SulphurousSand.cs +++ b/Tiles/Abyss/SulphurousSand.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -25,6 +26,7 @@ namespace CalamityMod.Tiles.Abyss { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithAbyss(Type); diff --git a/Tiles/Abyss/ViperVines.cs b/Tiles/Abyss/ViperVines.cs index d714aaedb5..3e26bd5505 100644 --- a/Tiles/Abyss/ViperVines.cs +++ b/Tiles/Abyss/ViperVines.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Metadata; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.Abyss @@ -15,6 +15,7 @@ namespace CalamityMod.Tiles.Abyss Main.tileBlockLight[Type] = true; Main.tileLavaDeath[Type] = true; Main.tileNoFail[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); AddMapEntry(new Color(0, 50, 0)); HitSound = SoundID.Grass; DustType = 2; diff --git a/Tiles/Astral/NovaeSlag.cs b/Tiles/Astral/NovaeSlag.cs index 01539703e5..51265047de 100644 --- a/Tiles/Astral/NovaeSlag.cs +++ b/Tiles/Astral/NovaeSlag.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -18,6 +19,7 @@ namespace CalamityMod.Tiles.Astral { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeAstralTiles(Type); diff --git a/Tiles/Furniture/CirrusCouch.cs b/Tiles/Furniture/CirrusCouch.cs new file mode 100644 index 0000000000..29551f8bb3 --- /dev/null +++ b/Tiles/Furniture/CirrusCouch.cs @@ -0,0 +1,37 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Furniture +{ + public class CirrusCouch : ModTile + { + public override void SetStaticDefaults() => this.SetUpSofa(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkFairy); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + } +} diff --git a/Tiles/Furniture/CirrusCouch.png b/Tiles/Furniture/CirrusCouch.png new file mode 100644 index 0000000000..b494def714 Binary files /dev/null and b/Tiles/Furniture/CirrusCouch.png differ diff --git a/Tiles/Furniture/CirrusCouch_Highlight.png b/Tiles/Furniture/CirrusCouch_Highlight.png new file mode 100644 index 0000000000..37368baef2 Binary files /dev/null and b/Tiles/Furniture/CirrusCouch_Highlight.png differ diff --git a/Tiles/Furniture/CraftingStations/SCalAltar.cs b/Tiles/Furniture/CraftingStations/SCalAltar.cs index a09992618f..36ab9cef5e 100644 --- a/Tiles/Furniture/CraftingStations/SCalAltar.cs +++ b/Tiles/Furniture/CraftingStations/SCalAltar.cs @@ -108,7 +108,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations bool usingSpecialItem = Main.LocalPlayer.HasItem(ModContent.ItemType()); Vector2 ritualSpawnPosition = new Vector2(left + Width / 2, top).ToWorldCoordinates(); - ritualSpawnPosition += new Vector2(-10f, -24f); + ritualSpawnPosition += new Vector2(0f, -24f); SoundEngine.PlaySound(SummonSound, ritualSpawnPosition); Projectile.NewProjectile(new EntitySource_WorldEvent(), ritualSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0, vodka.ToInt()); diff --git a/Tiles/FurnitureStatigel/StatigelBlock.cs b/Tiles/FurnitureStatigel/StatigelBlock.cs index 2764c90c12..29b9d1714f 100644 --- a/Tiles/FurnitureStatigel/StatigelBlock.cs +++ b/Tiles/FurnitureStatigel/StatigelBlock.cs @@ -1,6 +1,7 @@  using Microsoft.Xna.Framework; using Terraria; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +14,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["PinkSlime"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeDecorativeTiles(Type); diff --git a/Tiles/GiantPlanteraBulb.cs b/Tiles/GiantPlanteraBulb.cs index c87d3d0ef4..4ab0491284 100644 --- a/Tiles/GiantPlanteraBulb.cs +++ b/Tiles/GiantPlanteraBulb.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -31,6 +32,8 @@ namespace CalamityMod.Tiles Main.tileFrameImportant[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + // Various data sets to protect this tile from premature death TileID.Sets.PreventsTileRemovalIfOnTopOfIt[Type] = true; TileID.Sets.PreventsTileReplaceIfOnTopOfIt[Type] = true; diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index deb7297ee2..b1a264a1b7 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index 0a58e326ce..9956357a86 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -18,6 +19,7 @@ namespace CalamityMod.Tiles.SunkenSea { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); // Tile blends with sandstone, which it is set to merge with here diff --git a/Tiles/UelibloomBrick.cs b/Tiles/UelibloomBrick.cs index 138e79e700..654fb1b1b5 100644 --- a/Tiles/UelibloomBrick.cs +++ b/Tiles/UelibloomBrick.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -22,6 +23,7 @@ namespace CalamityMod.Tiles Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Organic"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeDecorativeTiles(Type); diff --git a/Tiles/VernalSoil.cs b/Tiles/VernalSoil.cs index 80eceb4814..145e6acf38 100644 --- a/Tiles/VernalSoil.cs +++ b/Tiles/VernalSoil.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -18,6 +19,7 @@ namespace CalamityMod.Tiles { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Organic"]); CalamityUtils.MergeWithGeneral(Type); diff --git a/UI/DraedonSummoning/CodebreakerUI.Communication.cs b/UI/DraedonSummoning/CodebreakerUI.Communication.cs index 898817b3a0..c301e33376 100644 --- a/UI/DraedonSummoning/CodebreakerUI.Communication.cs +++ b/UI/DraedonSummoning/CodebreakerUI.Communication.cs @@ -297,7 +297,7 @@ namespace CalamityMod.UI.DraedonSummoning DisplayTextSelectionOptions(panelArea, panelScale); DisplayDialogHistory(panelArea, panelScale); if (OptionsTextOpacity > 0f && DraedonScreenStaticInterpolant <= 0f) - DrawExitButton(panelCenter + new Vector2(-16f, 138f) * GeneralScale, OptionsTextOpacity); + DrawExitButton(panelCenter + new Vector2(0f, 150f) * GeneralScale, OptionsTextOpacity); } public static void DisplayDraedonFacePanel(Vector2 panelCenter, Vector2 panelScale) @@ -306,7 +306,7 @@ namespace CalamityMod.UI.DraedonSummoning Texture2D iconTexture = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonIconBorder").Value; Texture2D iconTextureInner = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonIconBorderInner").Value; float draedonIconDrawInterpolant = Utils.GetLerpValue(0.51f, 0.36f, DraedonScreenStaticInterpolant, true); - Vector2 draedonIconDrawTopRight = panelCenter + new Vector2(-218f, -130f) * panelScale; + Vector2 draedonIconDrawTopRight = panelCenter + new Vector2(-204f, -125f) * panelScale; draedonIconDrawTopRight += new Vector2(24f, 4f) * panelScale; Vector2 draedonIconScale = panelScale * 0.5f; @@ -350,7 +350,7 @@ namespace CalamityMod.UI.DraedonSummoning // Draw the outline for the text selection options. float selectionOptionsDrawInterpolant = Utils.GetLerpValue(0.3f, 0f, DraedonScreenStaticInterpolant, true); Texture2D selectionOutline = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonSelectionOutline").Value; - Vector2 selectionCenter = panelArea.BottomLeft() - new Vector2(selectionOutline.Width * -0.5f - 24f, selectionOutline.Height * 0.5f + 24f) * panelScale; + Vector2 selectionCenter = panelArea.BottomLeft() - new Vector2(selectionOutline.Width * -0.5f - 42f, selectionOutline.Height * 0.5f + 13f) * panelScale; Rectangle selectionArea = Utils.CenteredRectangle(selectionCenter, selectionOutline.Size() * panelScale); Main.spriteBatch.Draw(selectionOutline, selectionCenter, null, Color.White * selectionOptionsDrawInterpolant, 0f, selectionOutline.Size() * 0.5f, panelScale, 0, 0f); @@ -394,7 +394,7 @@ namespace CalamityMod.UI.DraedonSummoning { // Skip/isolate the introduction text as needed. string inquiry = dialog.Inquiry; - if (!Main.LocalPlayer.Calamity().HasTalkedAtCodebreaker && !DialogHistory.Any(d => d.Dialog == DialogOptions[0].Response)) + if (!Main.LocalPlayer.Calamity().HasCraftedDraedonsForge) { if (inquiry != DialogOptions[0].Inquiry) continue; @@ -402,7 +402,15 @@ namespace CalamityMod.UI.DraedonSummoning while (DialogHistory.Count < 1) DialogHistory.Add(new(string.Empty, true)); } - else if (inquiry == DialogOptions[0].Inquiry) + else if (!DialogOptions[1].HasBeenSeen) + { + if (inquiry != DialogOptions[1].Inquiry) + continue; + + while (DialogHistory.Count < 1) + DialogHistory.Add(new(string.Empty, true)); + } + else if (inquiry == DialogOptions[0].Inquiry || inquiry == DialogOptions[1].Inquiry) continue; // Draw the text marker. @@ -509,7 +517,7 @@ namespace CalamityMod.UI.DraedonSummoning // Draw the outline for the dialog history. float dialogHistoryDrawInterpolant = Utils.GetLerpValue(0.3f, 0f, DraedonScreenStaticInterpolant, true); Texture2D dialogOutline = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonDialogOutline").Value; - Vector2 selectionCenter = panelArea.TopRight() - new Vector2(dialogOutline.Width * 0.5f + 16f, dialogOutline.Height * -0.5f - 6.5f) * panelScale; + Vector2 selectionCenter = panelArea.TopRight() - new Vector2(dialogOutline.Width * 0.5f + 12f, dialogOutline.Height * -0.5f - 12f) * panelScale; Rectangle dialogArea = Utils.CenteredRectangle(selectionCenter, dialogOutline.Size() * panelScale); Main.spriteBatch.Draw(dialogOutline, selectionCenter, null, Color.White * dialogHistoryDrawInterpolant, 0f, dialogOutline.Size() * 0.5f, panelScale, 0, 0f); diff --git a/UI/DraedonSummoning/DraedonContactPanel.png b/UI/DraedonSummoning/DraedonContactPanel.png index 8a5e54519b..35f722036b 100644 Binary files a/UI/DraedonSummoning/DraedonContactPanel.png and b/UI/DraedonSummoning/DraedonContactPanel.png differ diff --git a/UI/DraedonSummoning/DraedonDialogRegistry.cs b/UI/DraedonSummoning/DraedonDialogRegistry.cs index 2cd6134ac9..871950a24d 100644 --- a/UI/DraedonSummoning/DraedonDialogRegistry.cs +++ b/UI/DraedonSummoning/DraedonDialogRegistry.cs @@ -9,26 +9,64 @@ namespace CalamityMod.UI.DraedonSummoning public static readonly DraedonDialogEntry WhoAreYou = CreateFromKey("WhoAreYou"); - public static readonly DraedonDialogEntry CalamitasBeforeHerDefeat = CreateFromKey("CalamitasBeforeDefeat", () => !DownedBossSystem.downedCalamitas); + public static readonly DraedonDialogEntry WhoAreYouPart2 = CreateFromKey("WhoAreYouPart2"); - public static readonly DraedonDialogEntry CalamitasAfterHerDefeat = CreateFromKey("CalamitasAfterDefeat", () => DownedBossSystem.downedCalamitas); + public static readonly DraedonDialogEntry Origins = CreateFromKey("Origins"); - public static readonly DraedonDialogEntry Plague = CreateFromKey("Plague", () => DownedBossSystem.downedPlaguebringer); + public static readonly DraedonDialogEntry Crusade = CreateFromKey("Crusade"); - public static readonly DraedonDialogEntry SulphurousSea = CreateFromKey("SulphuricSea"); + public static readonly DraedonDialogEntry Goals = CreateFromKey("Goals"); - public static readonly DraedonDialogEntry TheTyrant = CreateFromKey("TheTyrant", () => DownedBossSystem.downedCalamitas); + public static readonly DraedonDialogEntry ExoMechs = CreateFromKey("ExoMechs"); + + public static readonly DraedonDialogEntry Exotech = CreateFromKey("Exotech"); + + public static readonly DraedonDialogEntry MiracleMatter = CreateFromKey("MiracleMatter"); + + public static readonly DraedonDialogEntry Forge = CreateFromKey("Forge"); + + public static readonly DraedonDialogEntry Yharim = CreateFromKey("Yharim"); + + public static readonly DraedonDialogEntry Aerie = CreateFromKey("Aerie"); + + public static readonly DraedonDialogEntry Calamitas = CreateFromKey("Calamitas"); + + public static readonly DraedonDialogEntry Dog = CreateFromKey("Dog"); + + public static readonly DraedonDialogEntry Distortion = CreateFromKey("Distortion"); + + public static readonly DraedonDialogEntry Mechs = CreateFromKey("Mechs"); + + public static readonly DraedonDialogEntry Plague = CreateFromKey("Plague"); + + public static readonly DraedonDialogEntry Astral = CreateFromKey("Astral"); + + public static readonly DraedonDialogEntry Sulphur = CreateFromKey("Sulphur"); internal static List DialogOptions = new() { // The first index is assumed to be the "who are you?" dialog by the UI. All other indices can be freely swapped around, however. WhoAreYou, + WhoAreYouPart2, - CalamitasBeforeHerDefeat, - CalamitasAfterHerDefeat, + Origins, + Crusade, + Goals, + MiracleMatter, + + ExoMechs, + Exotech, + Forge, + Mechs, Plague, - SulphurousSea, - TheTyrant + + Calamitas, + Yharim, + Dog, + Sulphur, + Distortion, + Astral, + Aerie }; internal static DraedonDialogEntry CreateFromKey(string key, Func condition = null) => diff --git a/UI/MiscTextures/StealthMeter.png b/UI/MiscTextures/StealthMeter.png index f538d274b8..1f5a57a73d 100644 Binary files a/UI/MiscTextures/StealthMeter.png and b/UI/MiscTextures/StealthMeter.png differ diff --git a/UI/MiscTextures/StealthMeterBar.png b/UI/MiscTextures/StealthMeterBar.png index d67980a4a2..36d0552574 100644 Binary files a/UI/MiscTextures/StealthMeterBar.png and b/UI/MiscTextures/StealthMeterBar.png differ diff --git a/UI/MiscTextures/StealthMeterBarFull.png b/UI/MiscTextures/StealthMeterBarFull.png index 84ee93fa8d..86048fd097 100644 Binary files a/UI/MiscTextures/StealthMeterBarFull.png and b/UI/MiscTextures/StealthMeterBarFull.png differ diff --git a/UI/MiscTextures/StealthMeterStrikeIndicator.png b/UI/MiscTextures/StealthMeterStrikeIndicator.png index 8e0ef573e6..75c8412fd4 100644 Binary files a/UI/MiscTextures/StealthMeterStrikeIndicator.png and b/UI/MiscTextures/StealthMeterStrikeIndicator.png differ diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index 661a2a2472..b2a28a61e9 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -4,6 +4,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Text; using CalamityMod.Graphics; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -397,8 +398,13 @@ namespace CalamityMod public static void DrawItemGlowmaskSingleFrame(this Item item, SpriteBatch spriteBatch, float rotation, Texture2D glowmaskTexture) { - Vector2 origin = new Vector2(glowmaskTexture.Width / 2f, glowmaskTexture.Height / 2f - 2f); - spriteBatch.Draw(glowmaskTexture, item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + Vector2 origin = new Vector2(glowmaskTexture.Width / 2f, glowmaskTexture.Height / 2f); + + Color color = new Color(250, 250, 250, item.alpha); + if (item.type == ModContent.ItemType()) + color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, item.alpha); + + spriteBatch.Draw(glowmaskTexture, item.Center - Main.screenPosition, null, color, rotation, origin, 1f, SpriteEffects.None, 0f); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index 454f36258d..5cbc22d183 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -595,7 +595,6 @@ namespace CalamityMod public static IItemDropRuleCondition Post3Mechs(bool ui = true) => If(() => NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3, ui, CalamityUtils.GetTextValue("Condition.Drops.Downed3Mechs")); public static IItemDropRuleCondition PostCal(bool ui = true) => If(() => DownedBossSystem.downedCalamitasClone, ui, CalamityUtils.GetTextValue("Condition.Drops.DownedCal")); public static IItemDropRuleCondition PostPlant(bool ui = true) => If(() => NPC.downedPlantBoss, ui, CalamityUtils.GetTextValue("Condition.Drops.DownedPlant")); - public static IItemDropRuleCondition PostCalPlant(bool ui = true) => If(() => DownedBossSystem.downedCalamitasClone || NPC.downedPlantBoss, ui, CalamityUtils.GetTextValue("Condition.Drops.DownedCalPlant")); public static IItemDropRuleCondition PostLevi(bool ui = true) => If(() => DownedBossSystem.downedLeviathan, ui, CalamityUtils.GetTextValue("Condition.Drops.DownedLebi")); public static IItemDropRuleCondition PostAureus(bool ui = true) => If(() => DownedBossSystem.downedAstrumAureus, ui, CalamityUtils.GetTextValue("Condition.Drops.DownedAureus")); public static IItemDropRuleCondition PostGolem(bool ui = true) => If(() => NPC.downedGolemBoss, ui, CalamityUtils.GetTextValue("Condition.Drops.DownedGolem")); diff --git a/Utilities/GenericAIUtils.cs b/Utilities/GenericAIUtils.cs index eeac17b7b4..265c83daf3 100644 --- a/Utilities/GenericAIUtils.cs +++ b/Utilities/GenericAIUtils.cs @@ -345,7 +345,7 @@ namespace CalamityMod projectile.rotation = projectile.velocity.X * tiltFloat; } - public static void HealingProjectile(this Projectile projectile, int healing, int playerToHeal, float homingVelocity, float N, bool autoHomes = true, int timeCheck = 120) + public static void HealingProjectile(this Projectile projectile, int healing, int playerToHeal, float homingVelocity, float inertia, bool autoHomes = true, int timeCheck = 120) { int target = playerToHeal; Player player = Main.player[target]; @@ -375,16 +375,16 @@ namespace CalamityMod playerDist = homingSpeed / playerDist; playerVector.X *= playerDist; playerVector.Y *= playerDist; - projectile.velocity.X = (projectile.velocity.X * N + playerVector.X) / (N + 1f); - projectile.velocity.Y = (projectile.velocity.Y * N + playerVector.Y) / (N + 1f); + projectile.velocity.X = (projectile.velocity.X * inertia + playerVector.X) / (inertia + 1f); + projectile.velocity.Y = (projectile.velocity.Y * inertia + playerVector.Y) / (inertia + 1f); } else if (player.lifeMagnet && projectile.timeLeft < timeCheck) { playerDist = homingVelocity / playerDist; playerVector.X *= playerDist; playerVector.Y *= playerDist; - projectile.velocity.X = (projectile.velocity.X * N + playerVector.X) / (N + 1f); - projectile.velocity.Y = (projectile.velocity.Y * N + playerVector.Y) / (N + 1f); + projectile.velocity.X = (projectile.velocity.X * inertia + playerVector.X) / (inertia + 1f); + projectile.velocity.Y = (projectile.velocity.Y * inertia + playerVector.Y) / (inertia + 1f); } } diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 839b7f6ea0..b738d34df0 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -47,11 +47,11 @@ namespace CalamityMod // This makes sense to be here but also not case -1: if (DownedBossSystem.downedDoG) - return 20; + return 14; else if (NPC.downedMoonlord) - return 16; - else if (Main.hardMode) return 12; + else if (Main.hardMode) + return 10; return 8; case PrefixID.Hard: @@ -65,7 +65,7 @@ namespace CalamityMod case PrefixID.Guarding: if (DownedBossSystem.downedDoG) - return 6; + return 5; else if (NPC.downedMoonlord) return 4; else if (Main.hardMode) @@ -74,20 +74,20 @@ namespace CalamityMod case PrefixID.Armored: if (DownedBossSystem.downedDoG) - return 8; - else if (NPC.downedMoonlord) return 6; - else if (Main.hardMode) + else if (NPC.downedMoonlord) return 5; + else if (Main.hardMode) + return 4; return 3; case PrefixID.Warding: if (DownedBossSystem.downedDoG) - return 10; + return 7; else if (NPC.downedMoonlord) - return 8; - else if (Main.hardMode) return 6; + else if (Main.hardMode) + return 5; return 4; } } diff --git a/Utilities/NPCUtils.cs b/Utilities/NPCUtils.cs index 4c4ff6b994..84aa4a19d2 100644 --- a/Utilities/NPCUtils.cs +++ b/Utilities/NPCUtils.cs @@ -191,6 +191,23 @@ namespace CalamityMod return FindFirstProjectile(ProjectileType()) != -1; } + /// + /// Syncs . This exists to sync the Destroyer's lasers so that the telegraphs and segment colors display properly. + /// + /// + public static void SyncDestroyerLaserColor(this NPC npc) + { + // Don't bother attempting to send packets in singleplayer. + if (Main.netMode == NetmodeID.SinglePlayer) + return; + + ModPacket packet = CalamityMod.Instance.GetPacket(); + packet.Write((byte)CalamityModMessageType.SyncDestroyerLaserColor); + packet.Write((byte)npc.whoAmI); + packet.Write(npc.Calamity().destroyerLaserColor); + packet.Send(); + } + /// /// Syncs . This exists specifically for AIs manipulated in a global context, as has no netUpdate related hooks. /// diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index ce3f29870b..a42f871bb0 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -520,15 +520,12 @@ namespace CalamityMod /// A reference to the current in-use damage multiplier. This will be increased in-place. public static void ApplyRippersToDamage(CalamityPlayer mp, bool trueMelee, ref float damageMult) { - // Reduce how much true melee benefits from Rage and Adrenaline. - float rageAndAdrenalineTrueMeleeDamageMult = 0.5f; - // Rage and Adrenaline now stack additively with no special cases. if (mp.rageModeActive) - damageMult += trueMelee ? mp.RageDamageBoost * rageAndAdrenalineTrueMeleeDamageMult : mp.RageDamageBoost; + damageMult += trueMelee ? mp.RageDamageBoost * BalancingConstants.TrueMeleeRipperReductionFactor : mp.RageDamageBoost; // Draedon's Heart disables Adrenaline damage. if (mp.adrenalineModeActive && !mp.draedonsHeart) - damageMult += trueMelee ? mp.GetAdrenalineDamage() * rageAndAdrenalineTrueMeleeDamageMult : mp.GetAdrenalineDamage(); + damageMult += trueMelee ? mp.GetAdrenalineDamage() * BalancingConstants.TrueMeleeRipperReductionFactor : mp.GetAdrenalineDamage(); } #endregion diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index 4e21ff911f..0a34629ef5 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -93,7 +93,7 @@ namespace CalamityMod public static void ExpandHitboxBy(this Projectile projectile, Vector2 newSize) => projectile.ExpandHitboxBy((int)newSize.X, (int)newSize.Y); public static void ExpandHitboxBy(this Projectile projectile, float expandRatio) => projectile.ExpandHitboxBy((int)(projectile.width * expandRatio), (int)(projectile.height * expandRatio)); - public static void HomeInOnNPC(Projectile projectile, bool ignoreTiles, float distanceRequired, float homingVelocity, float N) + public static void HomeInOnNPC(Projectile projectile, bool ignoreTiles, float distanceRequired, float homingVelocity, float inertia) { if (!projectile.friendly) return; @@ -136,7 +136,7 @@ namespace CalamityMod // Home in on the target. Vector2 homeDirection = (destination - projectile.Center).SafeNormalize(Vector2.UnitY); - projectile.velocity = (projectile.velocity * N + homeDirection * homingVelocity) / (N + 1f); + projectile.velocity = (projectile.velocity * inertia + homeDirection * homingVelocity) / (inertia + 1f); } else { @@ -440,7 +440,8 @@ namespace CalamityMod // Explosion radii for various rocket ammos. Defaults to the sizes used in vanilla launchers. public int smallRadius = 3; // Rocket I and II public int mediumRadius = 6; // Rocket III and IV - public int largeRadius = 9; // Mini Nuke and Cluster Rockets + public int bigRadius = 7; // Cluster Rockets + public int largeRadius = 9; // Mini Nukes public bool respectStandardBlastImmunity = true; public List tilesToCheck = null; @@ -523,12 +524,12 @@ namespace CalamityMod break; case ItemID.ClusterRocketI: - explosionRadius = info.largeRadius; + explosionRadius = info.bigRadius; SpawnClusterFragments(false); break; case ItemID.ClusterRocketII: - explosionRadius = info.largeRadius; + explosionRadius = info.bigRadius; SpawnClusterFragments(true); break; diff --git a/World/AerialiteOreGen.cs b/World/AerialiteOreGen.cs index 3e2fc834f8..497e2d6017 100644 --- a/World/AerialiteOreGen.cs +++ b/World/AerialiteOreGen.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using CalamityMod.DataStructures; +using CalamityMod.Tiles.Ores; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.GameContent.Generation; @@ -15,61 +11,87 @@ namespace CalamityMod.World { public class AerialiteOreGen { - public static void Generate(bool Convert) + /// + /// The chance for a cloud tile the be randomly changed into a blotch of disenchanted aerialite ore during world generation. + /// + public const int CloudOreConversionChance = 365; + + public static void Generate() { - if (Main.netMode != NetmodeID.MultiplayerClient) + // Don't attempt to generate anything client-side. Only the server is allowed to do that. + if (Main.netMode == NetmodeID.MultiplayerClient) + return; + + // Loop through every tile above the world's surface, searching for potential candidates for aerialite generation. + for (int x = 5; x < Main.maxTilesX - 5; x++) { - for (int x = 5; x < Main.maxTilesX - 5; x++) + for (int y = 5; y < Main.worldSurface; y++) { - for (int y = 5; y < Main.worldSurface; y++) + Tile tile = Main.tile[x, y]; + + // The following conditions must happen in order for aerialite to generate: + // 1. The original tile ID must be that of a cloud. + // 2. The original tile must not be empty air. + // 3. A random dice-roll must land correctly, to ensure that patches of ore are occasional. + // If any of these conditions are not met, this loop iteration is skipped. + if (tile.TileType != TileID.Cloud || !tile.HasTile || !WorldGen.genRand.NextBool(CloudOreConversionChance)) + continue; + + int radius = (int)(WorldGen.genRand.Next(3, 5) * WorldGen.genRand.NextFloat(0.74f, 0.82f)); + ShapeData circle = new ShapeData(); + ShapeData biggerCircle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + // Big cloud circle. + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(radius + 1), Actions.Chain(new GenAction[] { - if (!Convert) - { - Tile tile = Main.tile[x, y]; + blotchMod.Output(biggerCircle) + })); - if (WorldGen.genRand.NextBool(365)&& tile.TileType == TileID.Cloud && tile.HasTile) - { - ShapeData circle = new ShapeData(); - ShapeData biggerCircle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + WorldUtils.Gen(new Point(x, y), new ModShapes.All(biggerCircle), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)TileID.Cloud) + })); - int radius = (int)(WorldGen.genRand.Next(3, 5) * WorldGen.genRand.NextFloat(0.74f, 0.82f)); + // Circle of ore. + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); - //big cloud circle - WorldUtils.Gen(new Point(x, y), new Shapes.Circle(radius + 1), Actions.Chain(new GenAction[] - { - blotchMod.Output(biggerCircle) - })); + WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + } + } + } - WorldUtils.Gen(new Point(x, y), new ModShapes.All(biggerCircle), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)TileID.Cloud) - })); + public static void Enchant() + { + // Don't attempt to change tile states client-side. + if (Main.netMode == NetmodeID.MultiplayerClient) + return; - //circle of ore - WorldUtils.Gen(new Point(x, y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); + // Loop through every tile above the world's surface, searching for aerialite to generate. + ushort disenchantedOreID = (ushort)ModContent.TileType(); + ushort enchantedOreID = (ushort)ModContent.TileType(); + for (int x = 5; x < Main.maxTilesX - 5; x++) + { + for (int y = 5; y < Main.worldSurface; y++) + { + if (Main.tile[x, y].TileType != disenchantedOreID) + continue; - WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - } - } + // Enchant the ore and re-evaluate nearby framing. + Main.tile[x, y].TileType = enchantedOreID; + WorldGen.SquareTileFrame(x, y); - if (Convert) - { - if (Main.tile[x, y].TileType == ModContent.TileType()) - { - WorldGen.SquareTileFrame(x, y, true); - Main.tile[x, y].TileType = (ushort)ModContent.TileType(); - } - } - } + // Inform all clients of the tile change. + if (Main.netMode == NetmodeID.Server) + NetMessage.SendTileSquare(-1, x, y); } } } diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs index 68a8ef2b76..dd83cb6b9d 100644 --- a/World/AstralBiome.cs +++ b/World/AstralBiome.cs @@ -119,7 +119,11 @@ namespace CalamityMod.World "Depthice", }; foreach (string tileName in aaTileNames) - aaTilesToAvoid.Add(ancientsAwakened.Find(tileName).Type); + { + //Defensive coding + if (ancientsAwakened.TryFind(tileName, out ModTile value)) + aaTilesToAvoid.Add(value.Type); + } } while (!meteorDropped) @@ -225,11 +229,23 @@ namespace CalamityMod.World IList MSTilesToAvoid = new List(16); if (magicStorage is not null) { + //yes I added the combined stations and fake altars due to them having tiles (despite no one actually placing em since MS Crafting UI exists) + //also thank fuck MS makes all Storage Units the same tile cuz otherwise the list would be massive + //decrafter may or may not exist by the time I added the new tiles, saw it while snooping around the MS github repo + //Idk what the TE tiles are for and they dont seem to have a tile string[] MSTileNames = new string[] { + "CombinedFurnitureStations1Tile", + "CombinedFurnitureStations2Tile", + "CombinedStations1Tile", + "CombinedStations2Tile", + "CombinedStations3Tile", + "CombinedStations4Tile", "CraftingAccess", "CreativeStorageUnit", + "DecraftingAccess", "EnvironmentAccess", + "EvilAltarTile", "RemoteAccess", "StorageAccess", "StorageComponent", @@ -238,7 +254,11 @@ namespace CalamityMod.World "StorageUnit", }; foreach (string tileName in MSTileNames) - MSTilesToAvoid.Add(magicStorage.Find(tileName).Type); + { + //Defensive coding + if (magicStorage.TryFind(tileName, out ModTile value)) + MSTilesToAvoid.Add(value.Type); + } } UnifiedRandom rand = WorldGen.genRand;