diff --git a/Items/Weapons/Melee/EssenceFlayer.cs b/Items/Weapons/Melee/EssenceFlayer.cs index 5e7c55a483..790801310d 100644 --- a/Items/Weapons/Melee/EssenceFlayer.cs +++ b/Items/Weapons/Melee/EssenceFlayer.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee public class EssenceFlayer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { Item.width = 100; @@ -43,6 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee if (Main.rand.NextBool(3)) { int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.ShadowbeamStaff); + Main.dust[dust].velocity *= 0f; } } diff --git a/Items/Weapons/Melee/IridescentExcalibur.cs b/Items/Weapons/Melee/IridescentExcalibur.cs index 69ddb4bb54..6d5de187c3 100644 --- a/Items/Weapons/Melee/IridescentExcalibur.cs +++ b/Items/Weapons/Melee/IridescentExcalibur.cs @@ -6,6 +6,7 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -51,6 +52,11 @@ namespace CalamityMod.Items.Weapons.Melee Item.rare = ModContent.RarityType(); } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/IridescentExcaliburGlow").Value); + } + // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 10; @@ -101,7 +107,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool()) { - Color rainbowColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + Color rainbowColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Alpha); Color color = Color.White; int dustChoice = player.altFunctionUse == 2 ? Main.rand.Next(12) : BeamType; switch (dustChoice) diff --git a/Items/Weapons/Melee/IridescentExcaliburGlow.png b/Items/Weapons/Melee/IridescentExcaliburGlow.png new file mode 100644 index 0000000000..58b3444daf Binary files /dev/null and b/Items/Weapons/Melee/IridescentExcaliburGlow.png differ diff --git a/Projectiles/Healing/GladiatorHealOrb.cs b/Projectiles/Healing/GladiatorHealOrb.cs index 8bff859ab0..20ae946f0e 100644 --- a/Projectiles/Healing/GladiatorHealOrb.cs +++ b/Projectiles/Healing/GladiatorHealOrb.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Balancing; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,8 +12,11 @@ namespace CalamityMod.Projectiles.Healing public class GladiatorHealOrb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int target = -1; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailingMode[Projectile.type] = 0; @@ -52,6 +56,7 @@ namespace CalamityMod.Projectiles.Healing } else HealHome(); } + public void PassiveBehavior() { float maxYVelocity = 2f; @@ -61,28 +66,38 @@ namespace CalamityMod.Projectiles.Healing Projectile.velocity.Y += 0.02f; if (Projectile.velocity.Y > maxYVelocity) { Projectile.velocity.Y = maxYVelocity; } } + public void HealHome() { + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + Projectile.Kill(); + return; + } + Player player = Main.player[target]; //Code snippet taken from the HealingProjectile utility, to do what I want with it easier. Vector2 playerVector = player.Center - Projectile.Center; float playerDist = playerVector.Length(); if (playerDist < 50f && Projectile.position.X < player.position.X + player.width && Projectile.position.X + Projectile.width > player.position.X && Projectile.position.Y < player.position.Y + player.height && Projectile.position.Y + Projectile.height > player.position.Y) { - int healAmt = 10; - player.HealEffect(healAmt, false); - player.statLife += healAmt; + int heal = 10; + Main.player[Main.myPlayer].lifeSteal -= heal * BalancingConstants.LifeStealAccessoryCooldownMultiplier; + player.HealEffect(heal, false); + player.statLife += heal; if (player.statLife > player.statLifeMax2) - { player.statLife = player.statLifeMax2; - } + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/OrbHeal", 5) { Volume = 0.15f }, Projectile.Center); - NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, target, healAmt, 0f, 0f, 0, 0, 0); + + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, target, heal, 0f, 0f, 0, 0, 0); + Projectile.Kill(); } Projectile.velocity = (playerVector.SafeNormalize(Vector2.UnitY) * 3.5f) + (player.velocity / 4); } + public override bool PreDraw(ref Color lightColor) { Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value; diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 7db28e11e4..0c0386ab52 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; @@ -94,12 +95,11 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Main.player[Projectile.owner].moonLeech) + int heal = (int)Math.Round(hit.Damage * 0.025); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - Player player = Main.player[Projectile.owner]; - player.statLife += 1; - player.HealEffect(1); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Magic/VisceraBeam.cs b/Projectiles/Magic/VisceraBeam.cs index 8d04ed6d15..a5406f895e 100644 --- a/Projectiles/Magic/VisceraBeam.cs +++ b/Projectiles/Magic/VisceraBeam.cs @@ -7,6 +7,8 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Balancing; +using System; namespace CalamityMod.Projectiles.Magic { @@ -20,6 +22,7 @@ namespace CalamityMod.Projectiles.Magic ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } + public override void SetDefaults() { Projectile.width = 9; @@ -88,13 +91,13 @@ namespace CalamityMod.Projectiles.Magic } } - 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; - Player player = Main.player[Projectile.owner]; - player.statLife += 1; - player.HealEffect(1); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } + public override void AI() { Player Owner = Main.player[Projectile.owner]; @@ -143,6 +146,7 @@ namespace CalamityMod.Projectiles.Magic } } } + public override bool PreDraw(ref Color lightColor) { return false; diff --git a/Projectiles/Melee/Blood.cs b/Projectiles/Melee/Blood.cs index ac1fc56714..9dbc765a9c 100644 --- a/Projectiles/Melee/Blood.cs +++ b/Projectiles/Melee/Blood.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Balancing; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -41,13 +43,11 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Player player = Main.player[Projectile.owner]; - if (player.moonLeech) + int heal = (int)Math.Round(hit.Damage * 0.075); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - int healAmt = 2; - player.statLife += healAmt; - player.HealEffect(healAmt); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index 772f22652d..d9a38a8bcb 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -1,4 +1,6 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Balancing; +using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Terraria; using Terraria.ID; @@ -40,12 +42,11 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Main.player[Projectile.owner].moonLeech) + int heal = (int)Math.Round(hit.Damage * 0.01); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - Player player = Main.player[Projectile.owner]; - player.statLife += 1; - player.HealEffect(1); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Melee/TerratomereHoldoutProj.cs b/Projectiles/Melee/TerratomereHoldoutProj.cs index 917bbccbad..07793346f9 100644 --- a/Projectiles/Melee/TerratomereHoldoutProj.cs +++ b/Projectiles/Melee/TerratomereHoldoutProj.cs @@ -1,9 +1,11 @@ using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.Balancing; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -275,13 +277,13 @@ namespace CalamityMod.Projectiles.Melee #region Hit Effects and Collision - public void OnHitHealEffect() + public void OnHitHealEffect(int damage) { - if (Owner.moonLeech) + int heal = (int)Math.Round(damage * 0.025); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - - Owner.statLife += Terratomere.TrueMeleeHitHeal; - Owner.HealEffect(Terratomere.TrueMeleeHitHeal); + + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -295,7 +297,7 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(ModContent.BuffType(), Terratomere.TrueMeleeGlacialStateTime); if (!Owner.moonLeech) - OnHitHealEffect(); + OnHitHealEffect(hit.Damage); // Create a slash creator on top of the hit target. int slashCreatorID = ModContent.ProjectileType(); @@ -309,7 +311,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), Terratomere.TrueMeleeGlacialStateTime); - OnHitHealEffect(); + OnHitHealEffect(info.Damage); } #endregion Hit Effects and Collision } diff --git a/Projectiles/Ranged/BloodBoilerFire.cs b/Projectiles/Ranged/BloodBoilerFire.cs index f0c0684ba3..52af9cd48f 100644 --- a/Projectiles/Ranged/BloodBoilerFire.cs +++ b/Projectiles/Ranged/BloodBoilerFire.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Projectiles.Ranged public bool improvedHeal = false; public bool setHomingVelocity = false; public float HomingVelocity = 0.18f; + public override void SetDefaults() { Projectile.width = 43; @@ -36,6 +37,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localNPCHitCooldown = -1; Projectile.timeLeft = 300; } + public override void AI() { if (Projectile.timeLeft > 220) // Main visual size changes @@ -56,6 +58,7 @@ namespace CalamityMod.Projectiles.Ranged BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); GeneralParticleHandler.SpawnParticle(blood); } + if (Projectile.timeLeft < 296) // The main visual of the projectile and the blood mist it produces before turning around { BloodBoilerMetaball2.SpawnParticle(Projectile.Center, particleSize * 2.3f); @@ -80,6 +83,7 @@ namespace CalamityMod.Projectiles.Ranged GeneralParticleHandler.SpawnParticle(pulse); } } + if (!playedSound) { SoundEngine.PlaySound(SoundID.Item34, Projectile.position); @@ -91,8 +95,10 @@ namespace CalamityMod.Projectiles.Ranged // A bunch of small things mostly for visuals when the projectile starts turning around before it homes on the player if (Projectile.timeLeft == 235) bloodCloudReturn = Projectile.velocity; + if (Projectile.timeLeft <= 235 && Projectile.ai[1] == 0f) Projectile.velocity *= 0.98f; + if (Projectile.timeLeft == 220) { Projectile.velocity = -bloodCloudReturn.RotatedBy(Projectile.ai[2] == 5 ? -0.7f : 0.7f) * 1.2f; @@ -106,6 +112,7 @@ namespace CalamityMod.Projectiles.Ranged dust2.scale = Main.rand.NextFloat(1.2f, 2f); } } + if (Projectile.timeLeft == 209) // Begin returning to player { Projectile.ai[1] = 1f; @@ -118,6 +125,7 @@ namespace CalamityMod.Projectiles.Ranged HomingVelocity = Main.rand.NextFloat(0.29f, 0.32f); setHomingVelocity = true; } + Projectile.extraUpdates = 5; bool dustEffect = Main.rand.NextBool(3) ? false : true; int dustColor = dustEffect ? 296 : 60; @@ -167,19 +175,33 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.velocity.Y > 0f && yDist < 0f) Projectile.velocity.Y -= HomingVelocity; } + if (Projectile.timeLeft == 5) // Absolutely make sure the player gets the chance to heal Projectile.Center = playerCenter; + // Delete the projectile if it touches its owner. Has a chance to heal the player again if (Main.myPlayer == Projectile.owner) { if (Projectile.Hitbox.Intersects(player.Hitbox)) { - if (Main.rand.NextBool(4) && !Main.player[Projectile.owner].moonLeech) + if (!Main.player[Projectile.owner].moonLeech) { - int bonusHeal = Main.rand.NextBool(3) ? 3 : 2; - player.statLife += improvedHeal ? bonusHeal : 1; - player.HealEffect(improvedHeal ? bonusHeal : 1); + int bonusHeal = Main.rand.NextBool(3) ? 6 : 4; + int heal = improvedHeal ? bonusHeal : 2; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + Projectile.Kill(); + return; + } + + Main.player[Main.myPlayer].lifeSteal -= heal; + player.statLife += heal; + player.HealEffect(heal); + if (Main.player[Projectile.owner].statLife > Main.player[Projectile.owner].statLifeMax2) + Main.player[Projectile.owner].statLife = Main.player[Projectile.owner].statLifeMax2; } + Projectile.Kill(); } } @@ -191,6 +213,7 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(ModContent.BuffType(), 600); improvedHeal = true; } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Projectile.numHits > 0) diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index ce46ba9b5f..35c8f5f01b 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Ranged; @@ -110,10 +111,7 @@ namespace CalamityMod.Projectiles.Ranged bool bonusHeal = Main.rand.NextFloat() < chanceOfOneMoreHP; int finalHeal = guaranteedHeal + (bonusHeal ? 1 : 0); if (finalHeal > 0) - { - player.HealEffect(finalHeal); - player.statLife += finalHeal; - } + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], finalHeal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/CardHeart.cs b/Projectiles/Ranged/CardHeart.cs index df258e9137..77036af036 100644 --- a/Projectiles/Ranged/CardHeart.cs +++ b/Projectiles/Ranged/CardHeart.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Balancing; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -59,12 +61,11 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Player player = Main.player[Projectile.owner]; - if (player.moonLeech) + int heal = (int)Math.Round(hit.Damage * 0.01); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - player.statLife += 1; - player.HealEffect(1); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/ClaretCannonProj.cs b/Projectiles/Ranged/ClaretCannonProj.cs index ac86898a4c..ca14c3b6c6 100644 --- a/Projectiles/Ranged/ClaretCannonProj.cs +++ b/Projectiles/Ranged/ClaretCannonProj.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Balancing; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; @@ -54,15 +56,11 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Main.player[Projectile.owner].moonLeech) + int heal = (int)Math.Round(hit.Damage * 0.02); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - Player player = Main.player[Projectile.owner]; - if (Main.rand.NextBool()) - { - player.statLife += 1; - player.HealEffect(1); - } + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index 9561221194..d48c2eee6d 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Balancing; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -85,15 +87,15 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - OnHitEffects(Main.player[Projectile.owner].moonLeech); + OnHitEffects(hit.Damage); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - OnHitEffects(Main.player[Projectile.owner].moonLeech); + OnHitEffects(info.Damage); } - private void OnHitEffects(bool cannotLifesteal) + private void OnHitEffects(int damage) { grind += 5; //THE GRIND NEVER STOPS if (grind > 15) @@ -112,12 +114,11 @@ namespace CalamityMod.Projectiles.Rogue } } - if (cannotLifesteal) + int heal = (int)Math.Round(damage * 0.01); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - Player player = Main.player[Projectile.owner]; - player.statLife += 1; - player.HealEffect(1); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) //afterimages diff --git a/Projectiles/Rogue/SacrificeProjectile.cs b/Projectiles/Rogue/SacrificeProjectile.cs index 69b1b7e32a..2c946b43b3 100644 --- a/Projectiles/Rogue/SacrificeProjectile.cs +++ b/Projectiles/Rogue/SacrificeProjectile.cs @@ -55,10 +55,17 @@ namespace CalamityMod.Projectiles.Rogue { if (!Owner.moonLeech && AbleToHealOwner) { - int healAmount = Projectile.Calamity().stealthStrike ? 40 : 3; + int heal = Projectile.Calamity().stealthStrike ? 40 : 3; - Owner.HealEffect(healAmount); - Owner.statLife += healAmount; + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + Projectile.Kill(); + return; + } + + Main.player[Main.myPlayer].lifeSteal -= heal; + Owner.HealEffect(heal); + Owner.statLife += heal; if (Owner.statLife > Owner.statLifeMax2) Owner.statLife = Owner.statLifeMax2; } diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index 33b3450ea2..af953c8c46 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Balancing; using CalamityMod.Graphics.Primitives; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -126,12 +127,12 @@ namespace CalamityMod.Projectiles.Rogue if (!Projectile.Calamity().stealthStrike) return; - if (!Main.player[Projectile.owner].moonLeech) - { - // Give on-heal effects from stealth strikes. - Main.player[Projectile.owner].statLife += 90; - Main.player[Projectile.owner].HealEffect(90); - } + // Give on-heal effects from stealth strikes. + int heal = (int)Math.Round(hit.Damage * 0.01); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); // And spawn a bloom of bullets. SpawnOnStealthStrikeBullets(); @@ -145,8 +146,11 @@ namespace CalamityMod.Projectiles.Rogue return; // Give on-heal effects from stealth strikes. - Main.player[Projectile.owner].statLife += 120; - Main.player[Projectile.owner].HealEffect(120); + int heal = (int)Math.Round(info.Damage * 0.01); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); // And spawn a bloom of bullets. SpawnOnStealthStrikeBullets(); diff --git a/Projectiles/Summon/BloodSpit.cs b/Projectiles/Summon/BloodSpit.cs index 87d6a92e31..4935c9db2c 100644 --- a/Projectiles/Summon/BloodSpit.cs +++ b/Projectiles/Summon/BloodSpit.cs @@ -1,13 +1,15 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Balancing; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class BloodSpit : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; - public const int OnDeathHealValue = 1; public Player Owner => Main.player[Projectile.owner]; @@ -39,7 +41,7 @@ namespace CalamityMod.Projectiles.Summon } } - public override void OnKill(int timeLeft) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { for (int i = 0; i < 15; i++) { @@ -48,10 +50,11 @@ namespace CalamityMod.Projectiles.Summon blood.noGravity = true; } - Owner.HealEffect(OnDeathHealValue, false); - Owner.statLife += OnDeathHealValue; - if (Owner.statLife > Owner.statLifeMax2) - Owner.statLife = Owner.statLifeMax2; + int heal = (int)Math.Round(hit.Damage * 0.01); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Typeless/BlazingStarHeal.cs b/Projectiles/Typeless/BlazingStarHeal.cs index 27751acd4f..224be3a693 100644 --- a/Projectiles/Typeless/BlazingStarHeal.cs +++ b/Projectiles/Typeless/BlazingStarHeal.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Typeless public class BlazingStarHeal : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/StarProj"; public override void SetDefaults() @@ -27,6 +28,12 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + Projectile.Kill(); + return; + } + if (Projectile.timeLeft % 4 == 0) //only once per 4 frames Lighting.AddLight(Projectile.Center, 0f, 0.6f, 0f); if (Projectile.timeLeft > 190) @@ -45,13 +52,14 @@ namespace CalamityMod.Projectiles.Typeless if (!player.immune && playerDist < 50f && !player.dead && Projectile.position.X < player.position.X + player.width && Projectile.position.X + Projectile.width > player.position.X && Projectile.position.Y < player.position.Y + player.height && Projectile.position.Y + Projectile.height > player.position.Y) { int healAmt = Utils.Clamp((200 - Projectile.timeLeft) / 10, 1, 10); //min heal is 5, max heal is 10, achievable after 2 seconds + Main.player[Main.myPlayer].lifeSteal -= healAmt; player.HealEffect(healAmt, false); player.statLife += healAmt; if (player.statLife > player.statLifeMax2) - { player.statLife = player.statLifeMax2; - } + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, index, healAmt); + Projectile.Kill(); } } diff --git a/Projectiles/Typeless/ChlorophyteLifePulse.cs b/Projectiles/Typeless/ChlorophyteLifePulse.cs index fcfcf917ff..90d3ef4416 100644 --- a/Projectiles/Typeless/ChlorophyteLifePulse.cs +++ b/Projectiles/Typeless/ChlorophyteLifePulse.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.Balancing; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Projectiles.VanillaProjectileOverrides; using Microsoft.Xna.Framework; @@ -49,10 +50,11 @@ namespace CalamityMod.Projectiles.Typeless foreach (Player player in membersOfSameTeam) { - if (player.Calamity().ChlorophyteHealDelay > 0) + if (player.Calamity().ChlorophyteHealDelay > 0 || Main.player[Main.myPlayer].lifeSteal <= 0f) continue; int healQuantity = (int)owner.GetBestClassDamage().ApplyTo(ChlorophyteArmorSetChange.AmountToHealPerPulse); + Main.player[Main.myPlayer].lifeSteal -= healQuantity * BalancingConstants.LifeStealSetBonusCooldownMultiplier; player.statLife += healQuantity; player.HealEffect(healQuantity); player.Calamity().ChlorophyteHealDelay = ChlorophyteArmorSetChange.DelayBetweenHeals;