diff --git a/Items/Weapons/Rogue/CorpusAvertor.cs b/Items/Weapons/Rogue/CorpusAvertor.cs index 210c235930..bfad290128 100644 --- a/Items/Weapons/Rogue/CorpusAvertor.cs +++ b/Items/Weapons/Rogue/CorpusAvertor.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using System; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -16,9 +17,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 98; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 15; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -26,10 +26,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 8.5f; + Item.shootSpeed = 14f; Item.DamageType = RogueDamageClass.Instance; } + public override float StealthDamageMultiplier => 2.5f; + public override float StealthKnockbackMultiplier => 2f; + // Gains 10% of missing health as base damage. public override void ModifyWeaponDamage(Player player, ref StatModifier damage) { @@ -37,22 +40,20 @@ namespace CalamityMod.Items.Weapons.Rogue damage.Base += lifeAmount * 0.1f; } - public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { - if (player.Calamity().StealthStrikeAvailable()) - type = ModContent.ProjectileType(); - } - - public override float StealthDamageMultiplier => 3.5f; - public override float StealthKnockbackMultiplier => 2f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int dagger = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + int dagger = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (dagger.WithinBounds(Main.maxProjectiles)) Main.projectile[dagger].Calamity().stealthStrike = true; + + // Take 6 HP every time the stealth strike is used + player.statLife -= 6; + if (Main.myPlayer == player.whoAmI) + player.HealEffect(-6); + if (player.statLife <= 0) + player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CorpusAvertor").Format(player.name)), 1000.0, 0, false); return false; } return true; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 0dac444a63..31b101f9cf 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -162,11 +162,10 @@ CorpusAvertor: { DisplayName: Corpus Avertor Tooltip: ''' - Attacks grant lifesteal based on damage dealt - The lower your HP the more damage this weapon does and heals the player on enemy hits - Stealth strikes throw a single rainbow outlined dagger - On enemy hits, this dagger grants 10% damage and +2 HP/s life regen to all members of your team - However, there is a small chance it will cut your health in half instead + Throws a spinning dagger that spawns a rebounding clone + Deals more damage the lower your health, and grants lifesteal + Stealth strikes throw a piercing rainbow dagger which spawns an extra slash in its wake, with a blood cost + This dagger grants players on your team 10% damage and +2 HP/s life regen on hit, and heals them for a portion of damage dealt 'Seems like it has worn down over time' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index f625651d55..1ee76f6ef7 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -40,7 +40,7 @@ CobaltEnergy.DisplayName: Cobalt Energy CobaltKunaiProjectile.DisplayName: Cobalt Kunai ConsecratedWaterProjectile.DisplayName: Consecrated Water ContaminatedBileFlask.DisplayName: Contaminated Bile -CorpusAvertorClone.DisplayName: Corpus Avertor +CorpusAvertorClone.DisplayName: Corpus Avertor Clone CorpusAvertorProj.DisplayName: Corpus Avertor CorpusAvertorStealth.DisplayName: Corpus Avertor Corrocloud1.DisplayName: Corrocloud diff --git a/Projectiles/Rogue/CorpusAvertorClone.cs b/Projectiles/Rogue/CorpusAvertorClone.cs index 81feb58e95..561260ec7a 100644 --- a/Projectiles/Rogue/CorpusAvertorClone.cs +++ b/Projectiles/Rogue/CorpusAvertorClone.cs @@ -13,6 +13,9 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/CorpusAvertor"; + public const int MaxClones = 3; + private ref float CloneNum => ref Projectile.ai[0]; + public override void SetStaticDefaults() { ProjectileID.Sets.CultistIsResistantTo[Type] = true; @@ -36,26 +39,8 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.04f; - Projectile.velocity.X *= 1.005f; - Projectile.velocity.Y *= 1.005f; - - switch ((int)Projectile.ai[0]) - { - case 20: - Projectile.scale = 0.7f; - break; - case 40: - Projectile.scale = 0.8f; - break; - case 60: - Projectile.scale = 0.9f; - break; - default: - break; - } - Projectile.width = Projectile.height = (int)(24f * Projectile.scale); - - CalamityUtils.HomeInOnNPC(Projectile, true, 150f, 12f, 20f); + if (Projectile.timeLeft < 165) + CalamityUtils.HomeInOnNPC(Projectile, true, 480f, 14f, 20f); } public override Color? GetAlpha(Color lightColor) @@ -71,30 +56,14 @@ namespace CalamityMod.Projectiles.Rogue return false; } + public override bool? CanDamage() => Projectile.timeLeft > 165 ? false : null; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); - int heal = (int)Math.Round(hit.Damage * 0.05); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 180); - int heal = (int)Math.Round(info.Damage * 0.05); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); + if (CloneNum < MaxClones && Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -Projectile.velocity.RotatedByRandom(MathHelper.Pi / 8f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, CloneNum + 1); } + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Rogue/CorpusAvertorProj.cs b/Projectiles/Rogue/CorpusAvertorProj.cs index 81d6599c18..7c00bf1283 100644 --- a/Projectiles/Rogue/CorpusAvertorProj.cs +++ b/Projectiles/Rogue/CorpusAvertorProj.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/CorpusAvertor"; + private ref float Timer => ref Projectile.ai[0]; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Type] = 6; @@ -32,29 +34,22 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.03f; - if (Projectile.ai[0] < 120f) - Projectile.ai[0] += 1f; + if (Timer < 120f) + Timer += 1f; - if (Projectile.ai[0] < 61f) + if (Timer == 20f) { - if (Projectile.ai[0] % 20f == 0f) - { - Vector2 velocity = new Vector2(Projectile.velocity.X, Projectile.velocity.Y); - float mult = Projectile.ai[0] / 80f; // Ranges from 0.25 to 0.5 to 0.75 - velocity *= mult; - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), - (int)(Projectile.damage * mult), Projectile.knockBack * mult, Projectile.owner, Projectile.ai[0]); - } + Vector2 cloneVel = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(1f, 1.75f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, cloneVel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, 1f); } - else - { - Projectile.velocity.X *= 1.01f; - Projectile.velocity.Y *= 1.01f; - int scale = (int)((Projectile.ai[0] - 60f) * 4.25f); + if (Timer > 60f) + { + Projectile.velocity *= 1.01f; + + int scale = (int)((Timer - 60f) * 3f); int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; @@ -63,12 +58,16 @@ namespace CalamityMod.Projectiles.Rogue public override Color? GetAlpha(Color lightColor) { - if (Projectile.ai[0] >= 61f) + Color returnColor; + if (Timer >= 61f) { - int scale = (int)((Projectile.ai[0] - 60f) * 4.25f); - return new Color(scale, 0, 0, 50); + returnColor = Color.Lerp(Color.White, Color.Red, Math.Min((Timer - 60f) / 120f * 3f, 1f)); + returnColor.A = 50; + return returnColor; } - return new Color(0, 0, 0, 50); + returnColor = Color.White; + returnColor.A = 50; + return returnColor; } public override bool PreDraw(ref Color lightColor) @@ -80,11 +79,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); + int heal = (int)Math.Round(hit.Damage * 0.05); if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.player[Projectile.owner].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); @@ -93,11 +93,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), 180); - int heal = ((int)Math.Round(info.Damage * 0.05)); + + int heal = (int)Math.Round(info.Damage * 0.05); if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.player[Projectile.owner].lifeSteal <= 0f || heal <= 0) return; 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 0d3ed9beac..99f36ef71e 100644 --- a/Projectiles/Rogue/CorpusAvertorStealth.cs +++ b/Projectiles/Rogue/CorpusAvertorStealth.cs @@ -1,10 +1,12 @@ -using System; -using CalamityMod.Balancing; +using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.DataStructures; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -15,6 +17,10 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/CorpusAvertor"; + private ref float Timer => ref Projectile.ai[0]; + private ref float Slash => ref Projectile.ai[1]; // If set to 1, this is the slash projectile + private Vector2 startPos = Vector2.Zero; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Type] = 10; @@ -23,34 +29,61 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - Projectile.width = 24; - Projectile.height = 24; + Projectile.width = 32; + Projectile.height = 32; Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 4; + Projectile.timeLeft = 300; } public override void AI() { - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f; + if (startPos == Vector2.Zero) + startPos = Projectile.Center; - if (Projectile.ai[0] < 120f) - Projectile.ai[0] += 1f; + if (Timer < 120f) + Timer += 1f; - Projectile.velocity.X *= 1.01f; - Projectile.velocity.Y *= 1.01f; + Projectile.rotation = Projectile.velocity.ToRotation() + (MathHelper.Pi / 3f); + Projectile.velocity *= 1.01f; - int scale = (int)((Projectile.ai[0] - 60f) * 4.25f); - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); - Main.dust[dust].velocity *= 0f; - Main.dust[dust].noGravity = true; + if (Slash == 1f) + { + if (Timer > 4f) + { + GlowSparkParticle glow = new(Projectile.Center, Vector2.Normalize(Projectile.velocity), false, 10, 0.055f, Color.DarkRed, new Vector2(0.66f, 1.5f), true, false); + GeneralParticleHandler.SpawnParticle(glow); + } + } + else + { + int scale = (int)((Timer - 60f) * 4.25f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; + } + + if (Timer == 60f && Slash == 0f) + { + SoundEngine.PlaySound(CommonCalamitySounds.MeatySlashSound with { Volume = 0.4f, PitchVariance = 0.06f }, startPos); + if (Main.myPlayer == Projectile.owner) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), startPos, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 1f); + } + Projectile.tileCollide = true; + } } public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha); public override bool PreDraw(ref Color lightColor) { + if (Slash == 1f) + return false; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -58,41 +91,37 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); - if (target.lifeMax > 5) + if (target.lifeMax > 5 && Projectile.numHits == 0 && Slash == 0f) OnHitEffects(hit.Damage); + + if (Projectile.numHits > 0 && !(target.life <= 0 && target.realLife == -1)) + Projectile.damage = (int)(Projectile.damage * 0.9f); + if (Projectile.damage < 1) + Projectile.damage = 1; } public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), 180); - OnHitEffects(info.Damage); + if (Projectile.numHits == 0 && Slash == 0f) + OnHitEffects(info.Damage); } private void OnHitEffects(int damage) { Player player = Main.player[Projectile.owner]; - if (Main.rand.NextBool(7)) - { - int lifeLossAmt = (int)Math.Ceiling(player.statLife * 0.5); - player.statLife -= lifeLossAmt; - if (Main.myPlayer == player.whoAmI) - player.HealEffect(-lifeLossAmt, true); - if (player.statLife <= 0) - player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CorpusAvertor").Format(player.name)), 1000.0, 0, false); - } - else if (Main.LocalPlayer.team == player.team && player.team != 0) + if (Main.LocalPlayer.team == player.team && player.team != 0) { Main.LocalPlayer.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(20f), true); - player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(20f), true); int heal = (int)Math.Round(damage * 0.025); if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) return; - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, player, heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.LocalPlayer, heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } }