Files
CalamityModPublic/Projectiles/Ranged/Aquashard.cs
T

59 lines
2.2 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class Aquashard : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Aquashard");
}
public override void SetDefaults()
{
projectile.width = 10;
projectile.height = 16;
projectile.friendly = true;
projectile.ranged = true;
projectile.penetrate = 1;
projectile.timeLeft = 300;
projectile.aiStyle = 1;
}
public override void AI()
{
projectile.velocity.X *= 0.9995f;
projectile.velocity.Y = projectile.velocity.Y + 0.01f;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
int num251 = Main.rand.Next(2, 4);
if (projectile.owner == Main.myPlayer)
{
for (int num252 = 0; num252 < num251; num252++)
{
Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
while (value15.X == 0f && value15.Y == 0f)
{
value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
}
value15.Normalize();
value15 *= (float)Main.rand.Next(70, 101) * 0.1f;
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType<AquashardSplit>(), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f);
}
}
}
public override void Kill(int timeLeft)
{
Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27);
for (int k = 0; k < 5; k++)
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f);
}
}
}
}