diff --git a/Balancing/BalancingConstants.cs b/Balancing/BalancingConstants.cs index 6d211d33c7..876212737a 100644 --- a/Balancing/BalancingConstants.cs +++ b/Balancing/BalancingConstants.cs @@ -85,6 +85,45 @@ // 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 multiplier used for armor set bonuses + internal static readonly float LifeStealSetBonusCooldownMultiplier = 2f; + + // 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 = 80f; + internal static readonly float LifeStealCap_Expert = 70f; + internal static readonly float LifeStealCap_Revengeance = 60f; + internal static readonly float LifeStealCap_Death = 50f; + + // Master nerfs the life steal cap by 10, resulting in 60 in non-Rev Master, 50 in Rev Master, and 40 in Death Master + internal static readonly float LifeStealCapReduction_Master = 10f; + + // The base life steal cooldowns from vanilla + internal static readonly float LifeStealRecoveryRate_Classic = 0.8f; + internal static readonly float LifeStealRecoveryRate_Expert = 0.7f; + + // Nerfs the life steal recovery rate in Classic from 0.8/s to 0.4/s + internal static readonly float LifeStealRecoveryRateReduction_Classic = 0.4f; + + // Nerfs the life steal recovery rate in Expert from 0.7/s to 0.35/s + internal static readonly float LifeStealRecoveryRateReduction_Expert = 0.35f; + + // Nerfs the life steal recovery rate in Revengeance from 0.7/s to 0.3/s + internal static readonly float LifeStealRecoveryRateReduction_Revengeance = 0.4f; + + // Nerfs the life steal recovery rate in Death from 0.7/s to 0.25/s + internal static readonly float LifeStealRecoveryRateReduction_Death = 0.45f; + + // Nerfs the life steal recovery rate in Master by 0.05/s, resulting in 0.3/s in non-Rev Master, 0.25/s in Rev Master, and 0.2/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. @@ -149,8 +188,8 @@ 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 diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index aac01bcac9..6978ff6d00 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -723,7 +723,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 +962,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; @@ -2279,7 +2279,6 @@ namespace CalamityMod.CalPlayer silvaMageCooldown = 0; bloodflareMageCooldown = 0; tarraRangedCooldown = 0; - tarraMageHealCooldown = 0; hideOfDeusMeleeBoostTimer = 0; externalAbyssLight = 0; externalColdImmunity = externalHeatImmunity = false; @@ -2450,6 +2449,7 @@ namespace CalamityMod.CalPlayer pinkCandleHealFraction = 0D; yellowCandle = false; trippy = false; + trippyLevel = 1; amidiasBlessing = false; bloodfinBoost = false; bloodfinTimer = 0; @@ -3579,17 +3579,33 @@ 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; + + // This value is here to somewhat prevent the rapid cooldown flashing that happens sometimes. + float cooldownDisplayGateValue = 12f; + float displayLifeStealCooldownGateValue = lifeStealRecoveryRate * cooldownDisplayGateValue; + if (Player.lifeSteal < -displayLifeStealCooldownGateValue) + { + float duration = Math.Abs(Player.lifeSteal); + duration /= lifeStealRecoveryRate; + + if (!Player.HasCooldown(LifeSteal.ID) || (cooldowns[LifeSteal.ID].duration < (int)duration)) + Player.AddCooldown(LifeSteal.ID, (int)duration); + } } ForceVariousEffects(); @@ -3601,7 +3617,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 +3627,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 @@ -4669,7 +4683,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/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 91da6b2abe..b1207c6646 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) diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 97abe9c107..f0934abfd0 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -2254,8 +2254,7 @@ namespace CalamityMod.CalPlayer if (tarraMelee) { - if (Main.rand.NextBool(4)) - Player.AddBuff(ModContent.BuffType(), 120); + Player.AddBuff(ModContent.BuffType(), 120); } else if (xerocSet) { @@ -2264,8 +2263,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) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 6a51852dd3..5656e0bd73 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -364,11 +364,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 @@ -891,14 +886,36 @@ 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.4/s + // Expert Mode life steal recovery rate is 0.35/s + // Revengeance Mode life steal recovery rate is 0.3/s + // Death Mode life steal recovery rate is 0.25/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; + + Player.lifeSteal -= lifeStealRecoveryRateReduction; // Bool for drawing boss health bar small text or not if (Main.myPlayer == Player.whoAmI) @@ -1364,8 +1381,6 @@ namespace CalamityMod.CalPlayer bloodflareMageCooldown--; if (silvaMageCooldown > 0) silvaMageCooldown--; - if (tarraMageHealCooldown > 0) - tarraMageHealCooldown--; if (scuttlerCooldown > 0) scuttlerCooldown--; if (rogueCrownCooldown > 0) @@ -2497,7 +2512,7 @@ namespace CalamityMod.CalPlayer if (rRage) { - Player.GetDamage() += 0.3f; + Player.GetDamage() += 0.1f; Player.statDefense += 5; } @@ -2817,7 +2832,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) @@ -4180,7 +4195,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..d07b2d48f9 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,7 +111,7 @@ namespace CalamityMod.CalPlayer break; case ItemID.CandyCaneSword: - if (!target.canGhostHeal || Player.moonLeech) + if (Player.moonLeech) return; Player.statLife += 2; Player.HealEffect(2); @@ -210,7 +211,7 @@ namespace CalamityMod.CalPlayer break; case ProjectileID.PalladiumPike: - if (!target.canGhostHeal || Player.moonLeech) + if (Player.moonLeech) return; Player.lifeRegenTime += 2; break; @@ -232,7 +233,7 @@ namespace CalamityMod.CalPlayer break; case ProjectileID.FruitcakeChakram: - if (!target.canGhostHeal || Player.moonLeech) + if (Player.moonLeech) return; Player.statLife += 2; Player.HealEffect(2); @@ -1126,34 +1127,6 @@ 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 ((target.life < target.lifeMax * 0.5) && bloodflareHeartTimer <= 0) @@ -1169,11 +1142,12 @@ namespace CalamityMod.CalPlayer 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) { // 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,20 +1157,10 @@ 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; + float cooldown = 6f; if (cooldown < 0f) cooldown = 0f; @@ -1205,180 +1169,81 @@ namespace CalamityMod.CalPlayer 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.LifeStealSetBonusCooldownMultiplier); } 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); } } } @@ -1395,37 +1260,14 @@ namespace CalamityMod.CalPlayer } } - if (target.IsAnEnemy(false) && target.canGhostHeal && !Player.moonLeech) + if (bloodflareMelee && item.CountsAsClass()) { - 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 +1277,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.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) + { + 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.LifeStealSetBonusCooldownMultiplier; + + 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/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 91dbff3ca3..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(), @@ -2812,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 3bb41dc14a..aa737b1d66 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -114,9 +114,6 @@ namespace CalamityMod // 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(); 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/ILEditing/BalancingILChanges.cs b/ILEditing/BalancingILChanges.cs index fbc3a529d0..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."); diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index 8ccdcd159f..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; 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/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/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/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 9de67bae96..400164f9c9 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); diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index 6941199403..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; diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 16c69db0be..3f59f0aa74 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items { 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)) }, 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/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/Weapons/Magic/Viscera.cs b/Items/Weapons/Magic/Viscera.cs index 9142ff11fc..e1c0ef6ad5 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 = 200; Item.DamageType = DamageClass.Magic; - Item.mana = 15; - Item.useTime = 14; - Item.useAnimation = 14; + Item.mana = 18; + Item.useTime = 7; + Item.useAnimation = 22; + Item.reuseDelay = 45; 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, damage, 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/Melee/Earth.cs b/Items/Weapons/Melee/Earth.cs index 0a49fdac72..3d8eaef99e 100644 --- a/Items/Weapons/Melee/Earth.cs +++ b/Items/Weapons/Melee/Earth.cs @@ -84,10 +84,10 @@ namespace CalamityMod.Items.Weapons.Melee if (target.Calamity().miscDefenseLoss < target.defense) target.Calamity().miscDefenseLoss += 1; - if (!target.canGhostHeal || player.moonLeech) + if (player.moonLeech) return; - int heal = Main.rand.Next(1, 69); + int heal = Main.rand.Next(1, 70); player.statLife += heal; player.HealEffect(heal); } 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/GrandGuardian.cs b/Items/Weapons/Melee/GrandGuardian.cs index 01aec5f549..72c776e05a 100644 --- a/Items/Weapons/Melee/GrandGuardian.cs +++ b/Items/Weapons/Melee/GrandGuardian.cs @@ -38,7 +38,7 @@ 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) + if (target.Calamity().miscDefenseLoss >= target.defense && !player.moonLeech) { player.statLife += 4; player.HealEffect(4); diff --git a/Items/Weapons/Melee/IridescentExcalibur.cs b/Items/Weapons/Melee/IridescentExcalibur.cs index c1c7e8c7d6..170545d90a 100644 --- a/Items/Weapons/Melee/IridescentExcalibur.cs +++ b/Items/Weapons/Melee/IridescentExcalibur.cs @@ -142,7 +142,7 @@ namespace CalamityMod.Items.Weapons.Melee { target.AddBuff(ModContent.BuffType(), 600); - if (!target.canGhostHeal || player.moonLeech) + if (player.moonLeech) return; int healAmount = Main.rand.Next(3) + 10; diff --git a/Items/Weapons/Melee/LifehuntScythe.cs b/Items/Weapons/Melee/LifehuntScythe.cs index b08c609830..81d594ee90 100644 --- a/Items/Weapons/Melee/LifehuntScythe.cs +++ b/Items/Weapons/Melee/LifehuntScythe.cs @@ -39,7 +39,7 @@ 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) return; player.statLife += 5; diff --git a/Items/Weapons/Melee/MajesticGuard.cs b/Items/Weapons/Melee/MajesticGuard.cs index 04a8351996..c83b36352b 100644 --- a/Items/Weapons/Melee/MajesticGuard.cs +++ b/Items/Weapons/Melee/MajesticGuard.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee if (player.moonLeech) return; - if (target.Calamity().miscDefenseLoss >= target.defense && target.canGhostHeal) + if (target.Calamity().miscDefenseLoss >= target.defense) { player.statLife += 3; player.HealEffect(3); 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/TheMutilator.cs b/Items/Weapons/Melee/TheMutilator.cs index dc7c74f116..8cdf99cdb0 100644 --- a/Items/Weapons/Melee/TheMutilator.cs +++ b/Items/Weapons/Melee/TheMutilator.cs @@ -33,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/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index dad4eaa719..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) - { - 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); - } - } 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/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/Localization/en-US/Mods.CalamityMod.Configs.hjson b/Localization/en-US/Mods.CalamityMod.Configs.hjson index abd3f95489..9ec4f652a4 100644 --- a/Localization/en-US/Mods.CalamityMod.Configs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Configs.hjson @@ -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 9a8833abc9..9fbfe64ae1 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1636,7 +1636,7 @@ 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 @@ -1650,7 +1650,7 @@ 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 Attacks that deal less than 5% of your max life in damage will not be dodged diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson index 7c71c5929a..acaa9dcab4 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson @@ -497,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..857dbe4a47 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 ''' } @@ -527,7 +527,7 @@ TarragonHeadMelee: { ''' 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.Lore.hjson b/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson index 2d9a09244e..90e1bb38a2 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson @@ -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.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.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index 3e51a4bd18..c86387da66 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -302,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' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index 54733ffdde..ea00c00b7f 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -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 piercing of blood beams +The last beam of the barrage explodes upon hitting an enemy + Blood beams heal you on enemy hit ''' } 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/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/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/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/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 0f10da2ef5..3c8439e0e4 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -43,7 +43,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; diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index 5ad2a271f0..cee87a5536 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -52,7 +52,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; diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index 697b4080b7..881e8ee4f2 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -52,7 +52,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; 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/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/SoulSeeker.cs b/NPCs/CalClone/SoulSeeker.cs index 9123593666..7c5477d74e 100644 --- a/NPCs/CalClone/SoulSeeker.cs +++ b/NPCs/CalClone/SoulSeeker.cs @@ -33,7 +33,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); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 02bea30cea..d36f96e13e 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1119,6 +1119,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; @@ -1482,11 +1489,6 @@ namespace CalamityMod.NPCs { npc.knockBackResist = 0f; } - - if (CalamityLists.revengeanceLifeStealExceptionList.Contains(npc.type)) - { - npc.canGhostHeal = false; - } } #endregion @@ -6306,21 +6308,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); @@ -6533,41 +6535,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 @@ -7086,6 +7166,84 @@ namespace CalamityMod.NPCs 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 (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; + + 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; + + bool phase2 = lifeRatio <= 0.5f; + if (!phase2) + { + 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) + { + 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); + } + } + else + { + float telegraphTimer = Math.Abs(npc.ai[3]); + bool startChargeTelegraph = npc.ai[3] > PlanteraAI.ChargeTelegraphColorChangeGateValue; + bool endChargeTelegraph = npc.ai[3] <= -2f; + if (startChargeTelegraph) + { + 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) + { + 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); + } + } + + 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 dd1195ff83..f4b101e5a1 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1175,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); diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index b7f04b99dc..3c1a4827d6 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -50,7 +50,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; diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index 730635427e..47b079b94b 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -40,7 +40,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; diff --git a/NPCs/Cryogen/CryogenShield.cs b/NPCs/Cryogen/CryogenShield.cs index e031360953..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(); 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/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/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..22df16f5e1 100644 --- a/NPCs/DevourerofGods/CosmicGuardianBody.cs +++ b/NPCs/DevourerofGods/CosmicGuardianBody.cs @@ -40,7 +40,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; diff --git a/NPCs/DevourerofGods/CosmicGuardianHead.cs b/NPCs/DevourerofGods/CosmicGuardianHead.cs index d40e41098c..d4d809eb7d 100644 --- a/NPCs/DevourerofGods/CosmicGuardianHead.cs +++ b/NPCs/DevourerofGods/CosmicGuardianHead.cs @@ -54,7 +54,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; diff --git a/NPCs/DevourerofGods/CosmicGuardianTail.cs b/NPCs/DevourerofGods/CosmicGuardianTail.cs index eebc906c3c..4308471905 100644 --- a/NPCs/DevourerofGods/CosmicGuardianTail.cs +++ b/NPCs/DevourerofGods/CosmicGuardianTail.cs @@ -37,7 +37,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; diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index e9e58b8136..ddbb093225 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -55,7 +55,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; diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index 0bd4d1858f..1f51ff5ea0 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -67,7 +67,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; diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 58c27cd60f..c85886d59f 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -92,7 +92,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; diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 31c2cf3702..431a174cdb 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -95,7 +95,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; diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index e4b9a41c25..b569a0c639 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -89,7 +89,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; diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index 12dc2ff4d1..19eead6a22 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -90,7 +90,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; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index 8a0dba7614..f5f2f9721f 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -73,7 +73,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; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index ddb8ed59b3..78170efcf5 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -71,7 +71,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; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index 31254ed0ff..6d1ed1dcab 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -71,7 +71,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; 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/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/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/SkeletronPrime2.cs b/NPCs/NormalNPCs/SkeletronPrime2.cs index 786146c880..fee91ac879 100644 --- a/NPCs/NormalNPCs/SkeletronPrime2.cs +++ b/NPCs/NormalNPCs/SkeletronPrime2.cs @@ -656,8 +656,7 @@ namespace CalamityMod.NPCs.NormalNPCs 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; } @@ -691,8 +690,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); @@ -735,7 +734,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/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..d1cf93c6a6 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -127,9 +127,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 +137,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 +146,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 +167,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 +189,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; - } } } } diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index 34bc115a9b..c5a2f6056c 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -43,7 +43,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; diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 9aef865bdd..88c2e048e3 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -46,7 +46,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; diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index 183e7ebbc1..580b82d6f7 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -43,7 +43,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; diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index b5e9ce7611..a66ffd806b 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -43,7 +43,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; diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index e918cfe157..39a8984455 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -46,7 +46,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; diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index 63932a1536..6a0df33e00 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -43,7 +43,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; diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index 7320b57fde..ca383549b6 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -39,7 +39,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; diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index 2b708fd477..2d2f1d0164 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -36,7 +36,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; diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index b8ba19d93d..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; diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index 53e7d35425..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; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index 76a9932dc8..d0217c4cbd 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -63,7 +63,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; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs index 84a73540f9..7354c06280 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs @@ -73,7 +73,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; diff --git a/NPCs/ProfanedGuardians/ProfanedRocks.cs b/NPCs/ProfanedGuardians/ProfanedRocks.cs index eb13ecf041..4320634dcd 100644 --- a/NPCs/ProfanedGuardians/ProfanedRocks.cs +++ b/NPCs/ProfanedGuardians/ProfanedRocks.cs @@ -47,7 +47,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; diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 9f2305b06d..b965df0767 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -182,7 +182,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 +208,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 +521,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) diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index f5734341db..61e958a4e2 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -28,7 +28,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); diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index 27c43336b8..a801996201 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; diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index 6194b94953..83f9bfe777 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; 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 feaf02d7d7..7f274230b6 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -27,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); diff --git a/NPCs/Signus/CosmicLantern.cs b/NPCs/Signus/CosmicLantern.cs index 469445932f..8118069eda 100644 --- a/NPCs/Signus/CosmicLantern.cs +++ b/NPCs/Signus/CosmicLantern.cs @@ -36,7 +36,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; 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/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index c81508e3e7..6b5b8895af 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -51,7 +51,6 @@ namespace CalamityMod.NPCs.StormWeaver NPC.noGravity = true; NPC.boss = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.netAlways = true; NPC.dontCountMe = true; diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 53648c08dd..8dc73957d0 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -48,7 +48,6 @@ namespace CalamityMod.NPCs.StormWeaver NPC.noGravity = true; NPC.boss = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.netAlways = true; NPC.dontCountMe = true; 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/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index 47ba0bb9ff..3e1e36f1dc 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -57,7 +57,6 @@ 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); diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index f744fdd498..a67749ec37 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -256,7 +256,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; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs index c2ffacd734..bc5814d247 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; @@ -18,6 +19,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; @@ -483,6 +485,43 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) @@ -1186,6 +1225,43 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs index 7748032f72..09b8e75866 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs @@ -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 ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio); + float velocityX = (masterMode ? 12f : 8f) + velocityBoost; if (enrage) velocityX *= 1.5f; @@ -373,10 +372,10 @@ 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(-2f, 2f)); if (death) - velocity *= 1.5f; + velocity *= 1.25f; if (enrage) 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; } @@ -417,14 +416,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else { - float velocityXChange = death ? (masterMode ? 0.5f : 0.3f) : (masterMode ? 0.3f : 0.2f); + float velocityXChange = death ? (masterMode ? 0.54f : 0.36f) : (masterMode ? 0.36f : 0.24f); 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; @@ -533,10 +532,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 +614,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 +816,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 ? 20f : enrage ? 16f : 12f; 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 +870,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 ? 24f : enrage ? 20f : 16f; 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 +899,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 +932,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 +940,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 +961,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 +969,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 +1072,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 +1084,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 +1099,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 +1119,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 +1150,19 @@ 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 = turboEnrage ? 4f : enrage ? 3f : phase3 ? 1.6f : 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); + CalamityUtils.SmoothMovement(npc, 80f, distanceFromDestination, velocity, acceleration, true); if (death && calamityGlobalNPC.newAI[2] < 120f) { @@ -1176,25 +1178,26 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Fireballs - float shootBoost = death ? 3f * (2f - (lifeRatio + golemLifeRatio)) : 2f * (2f - (lifeRatio + golemLifeRatio)); - npc.ai[1] += 1f + shootBoost; - - if (npc.ai[1] < 20f || npc.ai[1] > 340) + npc.ai[1] += 1f; + 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 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) { npc.TargetClosest(); npc.ai[1] = 0f; Vector2 freeHeadCenter = new Vector2(npc.Center.X, npc.Center.Y + 20f * npc.scale); - float freeHeadSpeed = turboEnrage ? 8f : enrage ? 6.5f : 5f; + float freeHeadSpeed = turboEnrage ? 18f : enrage ? 12f : 6f; if (masterMode) freeHeadSpeed *= 1.25f; @@ -1216,13 +1219,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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) + npc.ai[2] += 1f; + float laserGateValue = 300f - (death ? 240f * (1f - combinedLifeRatio) : 180f * (1f - combinedLifeRatio)); + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] >= laserGateValue && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) { npc.TargetClosest(); @@ -1238,7 +1244,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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 +1270,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 +1286,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; @@ -1994,11 +1999,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; } } @@ -2018,11 +2023,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; } } @@ -2208,11 +2213,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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; } } @@ -2223,7 +2228,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/PlanteraAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs index e407d1b032..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); @@ -1431,9 +1443,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses 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/SkeletronPrimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs index 08dde4b380..5e55c7463f 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs @@ -679,13 +679,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = npc.velocity.X / 15f; - float flightVelocity = bossRush ? 30f : death ? 24f : 18f; - float flightAcceleration = bossRush ? 0.5f : death ? 0.4f : 0.3f; + float flightVelocity = bossRush ? 28f : death ? 24f : 20f; + float flightAcceleration = bossRush ? 1.12f : death ? 0.96f : 0.8f; if (masterMode) { - flightVelocity += 5f; - flightAcceleration += 0.1f; + flightVelocity += 4f; + flightAcceleration += 0.16f; } Vector2 destination = new Vector2(Main.player[npc.target].Center.X, Main.player[npc.target].Center.Y - 500f); diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs index 5a281b952b..f9476e1bbd 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs @@ -9399,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; 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/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/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 cfac3f49b5..c97c17d961 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1432,6 +1432,20 @@ namespace CalamityMod.Projectiles 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; + } + else if (projectile.type == ProjectileID.NurseSyringeHeal) { ref float initialSpeed = ref projectile.localAI[1]; @@ -2181,17 +2195,26 @@ namespace CalamityMod.Projectiles { bool primeCannonProjectile = projectile.ai[1] == 2f; bool homeIn = false; - float homingTime = masterMode ? 210f : 150f; + float homingTime = masterMode ? 240f : 180f; float spreadOutCutoffTime = 555f; float homeInCutoffTime = spreadOutCutoffTime - homingTime; - float minAcceleration = 0.05f; - float maxAcceleration = 0.1f; - float homingVelocity = 27f; + 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 && !primeCannonProjectile) - homeIn = true; - else if (projectile.velocity.Length() < (masterMode ? 20f : 15f)) - projectile.velocity *= 1.01f; + 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) { @@ -2209,10 +2232,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; } @@ -2253,6 +2274,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) { @@ -2925,7 +2954,7 @@ 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); @@ -3717,7 +3746,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) { @@ -3763,10 +3792,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; @@ -3817,37 +3845,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); } } @@ -4065,15 +4179,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/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/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/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/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/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 34db2466b1..7db28e11e4 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Magic 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/Magic/VisceraBeam.cs b/Projectiles/Magic/VisceraBeam.cs index ec6f18ab38..a9445f9540 100644 --- a/Projectiles/Magic/VisceraBeam.cs +++ b/Projectiles/Magic/VisceraBeam.cs @@ -1,7 +1,12 @@ -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; namespace CalamityMod.Projectiles.Magic { @@ -10,70 +15,137 @@ 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 = 6; + 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.85f), 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; + } + } + + if (Main.player[Projectile.owner].moonLeech) return; - healAmt *= 1.25f; Player player = Main.player[Projectile.owner]; - player.statLife += (int)healAmt; - player.HealEffect((int)healAmt); + player.statLife += 1; + player.HealEffect(1); } - 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..2702389da8 --- /dev/null +++ b/Projectiles/Magic/VisceraBoom.cs @@ -0,0 +1,50 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using static System.TimeZoneInfo; + +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(), 90); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(ModContent.BuffType(), 90); + } + } +} 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/Earth4.cs b/Projectiles/Melee/Earth4.cs index 06f11738f5..14a6f32377 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) 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..bb77a99480 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.0075); + 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 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..3567269108 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; @@ -79,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee if (target.life <= 0) { 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/Exocomet.cs b/Projectiles/Melee/Exocomet.cs index c65bfe4173..087c0d671b 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) 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/IllustriousKnife.cs b/Projectiles/Melee/IllustriousKnife.cs index 954531adef..846b372f39 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) 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/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..4ecfeb506e 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) 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/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index 3c4440e6d6..772f22652d 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Melee.Spears 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/TerratomereHoldoutProj.cs b/Projectiles/Melee/TerratomereHoldoutProj.cs index cc2d79a879..917bbccbad 100644 --- a/Projectiles/Melee/TerratomereHoldoutProj.cs +++ b/Projectiles/Melee/TerratomereHoldoutProj.cs @@ -294,7 +294,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), Terratomere.TrueMeleeGlacialStateTime); - if (target.canGhostHeal) + if (!Owner.moonLeech) OnHitHealEffect(); // Create a slash creator on top of the hit target. 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/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/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index 7c06863739..ce46ba9b5f 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -15,6 +15,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 +36,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 1200; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } + public override void AI() { Player player = Main.player[Projectile.owner]; @@ -94,7 +96,7 @@ 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) diff --git a/Projectiles/Ranged/ClaretCannonProj.cs b/Projectiles/Ranged/ClaretCannonProj.cs index 4302e769fe..ac86898a4c 100644 --- a/Projectiles/Ranged/ClaretCannonProj.cs +++ b/Projectiles/Ranged/ClaretCannonProj.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged 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/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index ec93bbdca4..e81060900a 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) 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/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/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index 377d4ce7fe..9561221194 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - OnHitEffects(!target.canGhostHeal || Main.player[Projectile.owner].moonLeech); + OnHitEffects(Main.player[Projectile.owner].moonLeech); } public override void OnHitPlayer(Player target, Player.HurtInfo info) @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Rogue } } - if (cannotLifesteal || Main.rand.NextBool()) //canGhostHeal be like lol + if (cannotLifesteal) return; Player player = Main.player[Projectile.owner]; diff --git a/Projectiles/Rogue/CorpusAvertorClone.cs b/Projectiles/Rogue/CorpusAvertorClone.cs index becb2aef19..25a47029da 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) 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..8667eb16e3 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) 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..f361fed7a2 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; @@ -80,17 +81,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/ShinobiBladeProjectile.cs b/Projectiles/Rogue/ShinobiBladeProjectile.cs index 6d55405b97..39682acefb 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; @@ -61,13 +62,13 @@ namespace CalamityMod.Projectiles.Rogue } if (target.life <= 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 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/Typeless/FungalClumpMinion.cs b/Projectiles/Typeless/FungalClumpMinion.cs index 80e1a31ecf..e0c2dab98d 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) 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..e1ceb1c8fa 100644 --- a/Projectiles/Typeless/MagnusBeam.cs +++ b/Projectiles/Typeless/MagnusBeam.cs @@ -200,7 +200,7 @@ namespace CalamityMod.Projectiles.Typeless { target.AddBuff(ModContent.BuffType(), 480); - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) + if (Main.player[Projectile.owner].moonLeech) return; Player player = Main.player[Projectile.owner]; diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index deb7297ee2..d6dcfe75cb 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ 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/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;