diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 9e90a3ee2f..ba547b2775 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; @@ -2280,7 +2279,6 @@ namespace CalamityMod.CalPlayer silvaMageCooldown = 0; bloodflareMageCooldown = 0; tarraRangedCooldown = 0; - tarraMageHealCooldown = 0; hideOfDeusMeleeBoostTimer = 0; externalAbyssLight = 0; externalColdImmunity = externalHeatImmunity = false; @@ -3586,7 +3584,7 @@ namespace CalamityMod.CalPlayer { 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; + float lifeStealNerf = BossRushEvent.BossRushActive ? 0.25f : CalamityWorld.death ? 0.2f : CalamityWorld.revenge ? 0.15f : 0.1f; duration /= baseCooldown - lifeStealNerf; duration *= -1f; 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..a3a7afd152 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -893,11 +893,11 @@ 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; + // Reduces Expert Mode life steal recovery rate from 0.5/s to 0.4/s + // Revengeance Mode recovery rate is 0.35/s + // Death Mode recovery rate is 0.3/s + // Boss Rush recovery rate is 0.25/s + float lifeStealCooldown = BossRushEvent.BossRushActive ? 0.25f : CalamityWorld.death ? 0.2f : CalamityWorld.revenge ? 0.15f : 0.1f; Player.lifeSteal -= lifeStealCooldown; // Bool for drawing boss health bar small text or not @@ -1364,8 +1364,6 @@ namespace CalamityMod.CalPlayer bloodflareMageCooldown--; if (silvaMageCooldown > 0) silvaMageCooldown--; - if (tarraMageHealCooldown > 0) - tarraMageHealCooldown--; if (scuttlerCooldown > 0) scuttlerCooldown--; if (rogueCrownCooldown > 0) @@ -2497,7 +2495,7 @@ namespace CalamityMod.CalPlayer if (rRage) { - Player.GetDamage() += 0.3f; + Player.GetDamage() += 0.1f; Player.statDefense += 5; } @@ -2817,7 +2815,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) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 97ce4281bb..c1235cadd7 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; @@ -1130,9 +1131,7 @@ namespace CalamityMod.CalPlayer if (!target.canGhostHeal) { if (Player.ghostHurt) - { proj.ghostHurt(damage, target.Center, target); - } if (Player.setNebula && Player.nebulaCD == 0 && Main.rand.NextBool(3)) { @@ -1143,14 +1142,13 @@ namespace CalamityMod.CalPlayer 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); - } } } @@ -1205,72 +1203,32 @@ 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.011); + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(1f, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileID.VampireHeal, 1200f, 6f); } 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, 1200f, 10f); 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, 1200f, 3f); if (bloodflareMelee && proj.IsTrueMelee()) - { - int healAmount = Main.rand.Next(2) + 1; - Player.statLife += healAmount; - Player.HealEffect(healAmount); - } + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, 2, ProjectileID.VampireHeal, 1200f, 3f); } - 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); - } + float healMult = 0.2f; + healMult -= proj.numHits * 0.05f; + float heal = damage * healMult * (Player.statMana / (float)Player.statManaMax2); + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 4f); } } @@ -1279,71 +1237,26 @@ namespace CalamityMod.CalPlayer 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); + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 2f); } 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; - } + float healMult = 0.1f; + healMult -= proj.numHits * 0.05f; + float heal = damage * healMult; + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); } 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); + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); } } @@ -1352,16 +1265,8 @@ namespace CalamityMod.CalPlayer 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); + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); } if (proj.CountsAsClass()) @@ -1371,14 +1276,8 @@ namespace CalamityMod.CalPlayer 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); + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); } } } @@ -1395,20 +1294,42 @@ 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 && target.canGhostHeal && !Player.moonLeech) { - int healAmount = Main.rand.Next(2) + 1; - Player.statLife += healAmount; - Player.HealEffect(healAmount); + int heal = 4; + if ((int)heal > 0 && !Main.player[Main.myPlayer].moonLeech) + { + Main.player[Main.myPlayer].lifeSteal -= heal * 3f; + + 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 < 1200f && (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.X, target.Center.Y, target.velocity.X / 2, target.velocity.Y / 2, ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ModContent.ProjectileType(), 0, 0f); } if (reaverDefense) @@ -1417,12 +1338,6 @@ namespace CalamityMod.CalPlayer { 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) { Main.player[Main.myPlayer].lifeSteal -= heal * 3f; diff --git a/CalamityMod.cs b/CalamityMod.cs index 7cc42e1015..b5bf045a5a 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/Items/Armor/Reaver/ReaverHeadTank.cs b/Items/Armor/Reaver/ReaverHeadTank.cs index a05e04bbd7..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/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/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/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 5aeca26940..9ebe22fbdd 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -4165,13 +4165,7 @@ namespace CalamityMod.Projectiles #endregion #region Life Steal - public static bool CanSpawnLifeStealProjectile(float healMultiplier, float healAmount) - { - if (healMultiplier <= 0f || (int)healAmount <= 0) - return false; - - return true; - } + public static bool CanSpawnLifeStealProjectile(float healMultiplier, float healAmount) => healMultiplier > 0f && (int)healAmount > 0; public static void SpawnLifeStealProjectile(Projectile projectile, Player player, float healAmount, int healProjectileType, float distanceRequired, float cooldownMultiplier) { 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/Melee/Earth4.cs b/Projectiles/Melee/Earth4.cs index 06f11738f5..6a40461c9a 100644 --- a/Projectiles/Melee/Earth4.cs +++ b/Projectiles/Melee/Earth4.cs @@ -94,17 +94,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(), 1200f, 2f); } } } diff --git a/Projectiles/Melee/EmpyreanKnife.cs b/Projectiles/Melee/EmpyreanKnife.cs index 145690182e..792cdd276b 100644 --- a/Projectiles/Melee/EmpyreanKnife.cs +++ b/Projectiles/Melee/EmpyreanKnife.cs @@ -78,32 +78,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, 1200f, 2f); } 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, 1200f, 2f); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/Exocomet.cs b/Projectiles/Melee/Exocomet.cs index c65bfe4173..26f8737c1a 100644 --- a/Projectiles/Melee/Exocomet.cs +++ b/Projectiles/Melee/Exocomet.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -85,34 +86,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(), 1200f, 2f); } 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(), 1200f, 2f); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/IllustriousKnife.cs b/Projectiles/Melee/IllustriousKnife.cs index 954531adef..31cfefc3a4 100644 --- a/Projectiles/Melee/IllustriousKnife.cs +++ b/Projectiles/Melee/IllustriousKnife.cs @@ -75,34 +75,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(), 1200f, 2f); } 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(), 1200f, 2f); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/MonstrousKnife.cs b/Projectiles/Melee/MonstrousKnife.cs index 34d9d1498e..9706d761f7 100644 --- a/Projectiles/Melee/MonstrousKnife.cs +++ b/Projectiles/Melee/MonstrousKnife.cs @@ -48,46 +48,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, 1200f, 4f); } 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, 1200f, 4f); } } } diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index ec93bbdca4..a34c4c7bf5 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Healing; +using System; +using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -80,20 +81,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(), 1200f, 3f); } } } diff --git a/Projectiles/Rogue/CorpusAvertorClone.cs b/Projectiles/Rogue/CorpusAvertorClone.cs index becb2aef19..acd57275db 100644 --- a/Projectiles/Rogue/CorpusAvertorClone.cs +++ b/Projectiles/Rogue/CorpusAvertorClone.cs @@ -70,31 +70,19 @@ 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); } 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); } } diff --git a/Projectiles/Rogue/CorpusAvertorProj.cs b/Projectiles/Rogue/CorpusAvertorProj.cs index 9671098f81..4b65323e6b 100644 --- a/Projectiles/Rogue/CorpusAvertorProj.cs +++ b/Projectiles/Rogue/CorpusAvertorProj.cs @@ -77,31 +77,19 @@ 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); } 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); } } diff --git a/Projectiles/Rogue/CorpusAvertorStealth.cs b/Projectiles/Rogue/CorpusAvertorStealth.cs index 27e50bfe52..03f8a61871 100644 --- a/Projectiles/Rogue/CorpusAvertorStealth.cs +++ b/Projectiles/Rogue/CorpusAvertorStealth.cs @@ -80,16 +80,10 @@ 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); } } diff --git a/Projectiles/Typeless/FungalClumpMinion.cs b/Projectiles/Typeless/FungalClumpMinion.cs index 80e1a31ecf..4806ce9d8b 100644 --- a/Projectiles/Typeless/FungalClumpMinion.cs +++ b/Projectiles/Typeless/FungalClumpMinion.cs @@ -233,17 +233,11 @@ namespace CalamityMod.Projectiles.Typeless if (!target.canGhostHeal) 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(), 1200f, 4f); } public override bool OnTileCollide(Vector2 oldVelocity) => false;