Added Ice Star Stealth Strike
This commit is contained in:
1 parent
6b6094d1b6
commit
ecb3332216
3 files changed
+56
-3
No files matched your search
@@ -1,5 +1,6 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Rogue;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -12,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
DisplayName.SetDefault("Ice Star");
|
||||
Tooltip.SetDefault("Throws homing ice stars\n" +
|
||||
"Stealth strikes pierce infinitely and spawn ice shards on hit" +
|
||||
"Ice Stars are too brittle to be recovered after being thrown");
|
||||
}
|
||||
|
||||
@@ -46,5 +48,16 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
recipe.SetResult(this, 50);
|
||||
recipe.AddRecipe();
|
||||
}
|
||||
|
||||
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 proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f);
|
||||
Main.projectile[proj].Calamity().stealthStrike = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -890,7 +890,7 @@ namespace CalamityMod.Projectiles
|
||||
if (Main.player[Main.myPlayer].lifeSteal <= 0f)
|
||||
return;
|
||||
|
||||
Main.player[Main.myPlayer].lifeSteal -= heal * 1.5f;
|
||||
Main.player[Main.myPlayer].lifeSteal -= heal * 2f;
|
||||
int owner = projectile.owner;
|
||||
Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ProjectileID.VampireHeal, 0, 0f, projectile.owner, (float)owner, heal);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
@@ -7,6 +8,9 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
public class IceStarProjectile : ModProjectile
|
||||
{
|
||||
private bool initStealth = false;
|
||||
private Vector2 initialVelocity;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Star");
|
||||
@@ -27,6 +31,16 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (!initStealth && projectile.Calamity().stealthStrike)
|
||||
{
|
||||
projectile.penetrate = -1;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 9;
|
||||
projectile.tileCollide = false;
|
||||
initialVelocity = projectile.velocity;
|
||||
initStealth = true;
|
||||
}
|
||||
|
||||
projectile.rotation += 0.5f;
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
@@ -34,7 +48,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
}
|
||||
float num472 = projectile.Center.X;
|
||||
float num473 = projectile.Center.Y;
|
||||
float num474 = 400f;
|
||||
float num474 = projectile.Calamity().stealthStrike ? 800f : 400f;
|
||||
bool flag17 = false;
|
||||
for (int num475 = 0; num475 < 200; num475++)
|
||||
{
|
||||
@@ -65,6 +79,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
|
||||
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
|
||||
}
|
||||
projectile.velocity = initStealth && !flag17 ? initialVelocity : projectile.velocity;
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
@@ -82,5 +97,30 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
if(initStealth)
|
||||
{
|
||||
if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType<KelvinCatalystStar>()] < 15)
|
||||
{
|
||||
float spread = 45f * 0.0174f;
|
||||
double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2;
|
||||
double deltaAngle = spread / 8f;
|
||||
double offsetAngle;
|
||||
int i;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
|
||||
|
||||
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 4f), (float)(Math.Cos(offsetAngle) * 4f),
|
||||
ModContent.ProjectileType<KelvinCatalystStar>(), projectile.damage / 8, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f);
|
||||
|
||||
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 4f), (float)(-Math.Cos(offsetAngle) * 4f),
|
||||
ModContent.ProjectileType<KelvinCatalystStar>(), projectile.damage / 8, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user