Files
CalamityModPublic/Projectiles/Ranged/Aquashard.cs
T

53 lines
1.9 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Ranged
{
public class Aquashard : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = 1;
Projectile.timeLeft = 300;
Projectile.aiStyle = ProjAIStyleID.Arrow;
Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration;
}
public override void AI()
{
Projectile.velocity.X *= 0.9995f;
Projectile.velocity.Y += 0.01f;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
int projAmt = Main.rand.Next(1, 3);
if (Projectile.owner == Main.myPlayer)
{
for (int i = 0; i < projAmt; i++)
{
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<AquashardSplit>(), (int)(Projectile.damage * 0.4), 0f, Projectile.owner);
}
}
}
public override void Kill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item27, Projectile.position);
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);
}
}
}
}