52 lines
1.6 KiB
C#
52 lines
1.6 KiB
C#
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using CalamityMod.Buffs.StatDebuffs;
|
|
using Terraria.Audio;
|
|
|
|
namespace CalamityMod.Projectiles.Ranged
|
|
{
|
|
public class FlurrystormIceShard : ModProjectile, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Ranged";
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.friendly = true;
|
|
Projectile.width = 10;
|
|
Projectile.height = 10;
|
|
Projectile.DamageType = DamageClass.Ranged;
|
|
Projectile.coldDamage = true;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
//Rotation and gravity
|
|
Projectile.rotation += 0.6f * Projectile.direction;
|
|
Projectile.velocity.Y = Projectile.velocity.Y + 0.27f;
|
|
if (Projectile.velocity.Y > 16f)
|
|
{
|
|
Projectile.velocity.Y = 16f;
|
|
}
|
|
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
|
{
|
|
target.AddBuff(BuffID.Frostburn, 120);
|
|
target.AddBuff(ModContent.BuffType<GlacialState>(), 30);
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Item27, Projectile.position);
|
|
//Dust effect
|
|
int splash = 0;
|
|
while (splash < 4)
|
|
{
|
|
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f);
|
|
splash += 1;
|
|
}
|
|
}
|
|
}
|
|
}
|