Files
CalamityModPublic/Projectiles/Magic/MagnaBlast.cs
T

53 lines
2.0 KiB
C#

using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class MagnaBlast : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Magic";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 32;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Magic;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
}
public override void AI()
{
if (Projectile.scale <= 1.6f)
{
Projectile.scale *= 1.01f;
Projectile.width = (int)(16f * Projectile.scale);
Projectile.height = (int)(32f * Projectile.scale);
}
Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f;
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.1f / 255f, (255 - Projectile.alpha) * 0.1f / 255f, (255 - Projectile.alpha) * 1f / 255f);
Projectile.localAI[0] += 1f;
if (Projectile.localAI[0] > 4f)
{
for (int num468 = 0; num468 < 3; num468++)
{
int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 59, 0f, 0f, 100, default, Projectile.scale);
Main.dust[num469].noGravity = true;
Main.dust[num469].velocity *= 0f;
}
}
}
public override void Kill(int timeLeft)
{
for (int k = 0; k < 10; k++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 59, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f);
}
}
}
}