Files
CalamityModPublic/Projectiles/Melee/TerratomereProjectile.cs
T

65 lines
2.3 KiB
C#

using CalamityMod.Buffs.StatDebuffs;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class TerratomereProjectile : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Bolt");
}
public override void SetDefaults()
{
projectile.width = 30;
projectile.height = 30;
projectile.aiStyle = 27;
projectile.friendly = true;
projectile.melee = true;
projectile.penetrate = 1;
projectile.timeLeft = 180;
projectile.tileCollide = false;
aiType = ProjectileID.TerraBeam;
}
public override void AI()
{
CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f);
Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.75f / 255f, 0f);
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(0, 200, 0, 0);
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<GlacialState>(), 30);
}
public override void Kill(int timeLeft)
{
Main.PlaySound(SoundID.Item10, projectile.position);
int num3;
for (int num795 = 4; num795 < 31; num795 = num3 + 1)
{
float num796 = projectile.oldVelocity.X * (30f / (float)num795);
float num797 = projectile.oldVelocity.Y * (30f / (float)num795);
int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f);
Main.dust[num798].noGravity = true;
Dust dust = Main.dust[num798];
dust.velocity *= 0.5f;
num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f);
dust = Main.dust[num798];
dust.velocity *= 0.05f;
num3 = num795;
}
}
}
}