diff --git a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs index cdaede6260..0d6c75b87d 100644 --- a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs +++ b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs @@ -1,4 +1,6 @@ using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue @@ -8,6 +10,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Adamantite Throwing Axe"); + Tooltip.SetDefault("Stealth strikes summon lightning bolts on enemy hits"); } public override void SafeSetDefaults() @@ -32,6 +35,18 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = true; } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.Calamity().StealthStrikeAvailable()) + { + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].usesLocalNPCImmunity = true; + return false; + } + return true; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/MythrilKnife.cs b/Items/Weapons/Rogue/MythrilKnife.cs index d58418a01c..0605e802d0 100644 --- a/Items/Weapons/Rogue/MythrilKnife.cs +++ b/Items/Weapons/Rogue/MythrilKnife.cs @@ -1,4 +1,6 @@ using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue @@ -8,6 +10,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Mythril Knife"); + Tooltip.SetDefault("Stealth strikes inflict a wide assortment of debuffs"); } public override void SafeSetDefaults() @@ -32,6 +35,17 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = true; } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.Calamity().StealthStrikeAvailable()) + { + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = true; + return false; + } + return true; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs index ee62d90031..f8fbdadc74 100644 --- a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs +++ b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 600; aiType = ProjectileID.Shuriken; projectile.Calamity().rogue = true; + projectile.localNPCHitCooldown = 10; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -39,5 +40,47 @@ namespace CalamityMod.Projectiles.Rogue Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); } } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.Calamity().stealthStrike && Main.myPlayer == projectile.owner) + { + for (int n = 0; n < 3; n++) + { + float xStart = projectile.position.X + Main.rand.Next(-400, 400); + float yStart = projectile.position.Y + Main.rand.Next(500, 800); + Vector2 startPos = new Vector2(xStart, yStart); + Vector2 velocity = projectile.Center - startPos; + velocity.X += (float)Main.rand.Next(-100, 101); + float travelDist = velocity.Length(); + float lightningSpeed = 8f; + travelDist = lightningSpeed / travelDist; + velocity.X *= travelDist; + velocity.Y *= travelDist; + Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, Main.rand.Next(2), 0f); + } + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (projectile.Calamity().stealthStrike && Main.myPlayer == projectile.owner) + { + for (int n = 0; n < Main.rand.Next(3,6); n++) + { + float xStart = projectile.position.X + Main.rand.Next(-400, 400); + float yStart = projectile.position.Y + Main.rand.Next(500, 800); + Vector2 startPos = new Vector2(xStart, yStart); + Vector2 velocity = projectile.Center - startPos; + velocity.X += (float)Main.rand.Next(-100, 101); + float travelDist = velocity.Length(); + float lightningSpeed = 16f; + travelDist = lightningSpeed / travelDist; + velocity.X *= travelDist; + velocity.Y *= travelDist; + Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, Main.rand.Next(2), 1f); + } + } + } } } diff --git a/Projectiles/Rogue/BlunderBoosterLightning.cs b/Projectiles/Rogue/BlunderBoosterLightning.cs index 8b34244a4e..6808e31235 100644 --- a/Projectiles/Rogue/BlunderBoosterLightning.cs +++ b/Projectiles/Rogue/BlunderBoosterLightning.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.timeLeft < 55) + if (projectile.timeLeft < 55 && projectile.ai[1] != 1f) { projectile.tileCollide = true; } diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index 53dc9af121..f2a28866f3 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -48,8 +48,8 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocity = projectile.Center - startPos; velocity.X += (float)Main.rand.Next(-100, 101); float travelDist = velocity.Length(); - float starSpeed = 29f; - travelDist = starSpeed / travelDist; + float spearSpeed = 29f; + travelDist = spearSpeed / travelDist; velocity.X *= travelDist; velocity.Y *= travelDist; Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), (int)(projectile.damage * dmgKBMult), projectile.knockBack * dmgKBMult, projectile.owner, 0f, 0f); diff --git a/Projectiles/Rogue/MythrilKnifeProjectile.cs b/Projectiles/Rogue/MythrilKnifeProjectile.cs index 3345eb61d3..76e38e5a82 100644 --- a/Projectiles/Rogue/MythrilKnifeProjectile.cs +++ b/Projectiles/Rogue/MythrilKnifeProjectile.cs @@ -1,4 +1,6 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -64,7 +66,26 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Venom, 200); + if (!projectile.Calamity().stealthStrike) + return; + + target.AddBuff(BuffID.CursedInferno, 300); + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (!projectile.Calamity().stealthStrike) + return; + + target.AddBuff(BuffID.CursedInferno, 300); + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); } } }