Files
CalamityModPublic/Projectiles/Magic/LightBall.cs
T
DominicKarma42 55e89c9b98 Replaced (hopefully) every magic number with a constant
Note: Does not include item rarities, and appears to shown nonexistant using directive movement in the commit. This does not really affect anything, however.
2020-05-30 17:56:36 -04:00

69 lines
3.0 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class LightBall : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Light Ball");
}
public override void SetDefaults()
{
projectile.width = 28;
projectile.height = 28;
projectile.friendly = true;
projectile.alpha = 60;
projectile.penetrate = 1;
projectile.timeLeft = 300;
projectile.magic = true;
}
public override void AI()
{
Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f);
projectile.velocity.X *= 0.995f;
projectile.velocity.Y *= 0.995f;
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(255, 255, 200, projectile.alpha);
}
public override void Kill(int timeLeft)
{
Main.PlaySound(SoundID.Item14, projectile.position);
projectile.position.X = projectile.position.X + (float)(projectile.width / 2);
projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2);
projectile.width = 300;
projectile.height = 300;
projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<LightBallExplosion>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
for (int num621 = 0; num621 < 10; num621++)
{
int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.2f);
Main.dust[num622].velocity *= 3f;
if (Main.rand.NextBool(2))
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 20; num623++)
{
int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.7f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f);
Main.dust[num624].velocity *= 2f;
}
}
}
}