81 lines
2.6 KiB
C#
81 lines
2.6 KiB
C#
using CalamityMod.Buffs.StatDebuffs;
|
|
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using Terraria.Audio;
|
|
|
|
namespace CalamityMod.Projectiles.Typeless
|
|
{
|
|
public class DarkIce : ModProjectile
|
|
{
|
|
public override string Texture => "CalamityMod/Projectiles/Melee/DarkIceZero";
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 28;
|
|
Projectile.height = 28;
|
|
Projectile.aiStyle = ProjAIStyleID.Arrow;
|
|
AIType = ProjectileID.Bullet;
|
|
Projectile.friendly = true;
|
|
Projectile.penetrate = -1;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.extraUpdates = 1;
|
|
Projectile.coldDamage = true;
|
|
Projectile.npcProj = true;
|
|
}
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Dark Ice");
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
if (Projectile.localAI[0] != 1f)
|
|
{
|
|
Projectile.localAI[0] = 1f;
|
|
SoundEngine.PlaySound(SoundID.Item8, Projectile.Center);
|
|
}
|
|
|
|
if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 16f)
|
|
{
|
|
Projectile.velocity *= 1.04f;
|
|
}
|
|
|
|
//make pretty dust
|
|
int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.25f);
|
|
Main.dust[index2].noGravity = true;
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
target.AddBuff(BuffID.Frostburn2, 180);
|
|
target.AddBuff(ModContent.BuffType<GlacialState>(), 30);
|
|
}
|
|
|
|
public override void OnHitPvp(Player target, int damage, bool crit)
|
|
{
|
|
target.AddBuff(BuffID.Frostburn2, 180);
|
|
target.AddBuff(ModContent.BuffType<GlacialState>(), 30);
|
|
}
|
|
|
|
public override Color? GetAlpha(Color lightColor)
|
|
{
|
|
return new Color(198, 197, 246);
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Item27, Projectile.position);
|
|
for (int i = 0; i < 30; i++)
|
|
{
|
|
int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172, 0f, 0f, 0, default, Main.rand.NextFloat(1f, 2f));
|
|
Main.dust[index2].noGravity = true;
|
|
Main.dust[index2].velocity *= 4f;
|
|
}
|
|
}
|
|
}
|
|
}
|