Files
CalamityModPublic/Projectiles/Magic/SupremeDustProjectile.cs
T

96 lines
3.5 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class SupremeDustProjectile : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Dust");
}
public override void SetDefaults()
{
Projectile.width = 200;
Projectile.height = 200;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.DamageType = DamageClass.Magic;
Projectile.penetrate = 4;
Projectile.extraUpdates = 3;
Projectile.timeLeft = 200;
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.95f / 255f, (255 - Projectile.alpha) * 0.85f / 255f, (255 - Projectile.alpha) * 0.01f / 255f);
if (Projectile.ai[0] > 7f)
{
float num296 = 1f;
if (Projectile.ai[0] == 8f)
{
num296 = 0.25f;
}
else if (Projectile.ai[0] == 9f)
{
num296 = 0.5f;
}
else if (Projectile.ai[0] == 10f)
{
num296 = 0.75f;
}
Projectile.ai[0] += 1f;
int num297 = 32;
int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f);
Dust dust = Main.dust[num299];
if (Main.rand.NextBool(2))
{
dust.noGravity = true;
dust.scale *= 4f;
dust.velocity.X *= 2f;
dust.velocity.Y *= 2f;
}
else
{
dust.scale *= 2.5f;
}
dust.velocity.X *= 1.2f;
dust.velocity.Y *= 1.2f;
dust.scale *= num296;
int num399 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f);
Dust dust2 = Main.dust[num399];
if (Main.rand.NextBool(3))
{
dust2.noGravity = true;
dust2.scale *= 6f;
dust2.velocity.X *= 2f;
dust2.velocity.Y *= 2f;
}
else
{
dust2.scale *= 2.5f;
}
dust2.velocity.X *= 1.2f;
dust2.velocity.Y *= 1.2f;
dust2.scale *= num296;
}
else
{
Projectile.ai[0] += 1f;
}
Projectile.rotation += 0.3f * (float)Projectile.direction;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.immune[Projectile.owner] = 6;
if (Projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<SupremeDustFlakProjectile>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
}
}
}
}