78 lines
2.8 KiB
C#
78 lines
2.8 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Melee
|
|
{
|
|
public class DarkBeam : ModProjectile, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Melee";
|
|
public override void SetStaticDefaults()
|
|
{
|
|
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10;
|
|
ProjectileID.Sets.TrailingMode[Projectile.type] = 1;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 74;
|
|
Projectile.height = 74;
|
|
Projectile.aiStyle = ProjAIStyleID.Sickle;
|
|
AIType = ProjectileID.DeathSickle;
|
|
Projectile.friendly = true;
|
|
Projectile.DamageType = DamageClass.Melee;
|
|
Projectile.penetrate = 1;
|
|
Projectile.timeLeft = 300;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.2f / 255f, 0f, (255 - Projectile.alpha) * 0.6f / 255f);
|
|
|
|
if (Projectile.velocity.Length() < 12f)
|
|
Projectile.velocity *= 1.1f;
|
|
}
|
|
|
|
public override Color? GetAlpha(Color lightColor)
|
|
{
|
|
if (Projectile.timeLeft < 85)
|
|
{
|
|
byte b2 = (byte)(Projectile.timeLeft * 3);
|
|
byte a2 = (byte)(100f * (b2 / 255f));
|
|
return new Color(b2, b2, b2, a2);
|
|
}
|
|
return new Color(255, 255, 255, 100);
|
|
}
|
|
|
|
public override bool PreDraw(ref Color lightColor)
|
|
{
|
|
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2);
|
|
return false;
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
|
{
|
|
target.AddBuff(BuffID.Frostburn, 180);
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
for (int num105 = 0; num105 < 20; num105++)
|
|
{
|
|
int num102 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 56, 0f, 0f, 0, default, 1f);
|
|
Main.dust[num102].noGravity = true;
|
|
Main.dust[num102].velocity += Projectile.velocity * 0.1f;
|
|
}
|
|
if (Projectile.owner == Main.myPlayer)
|
|
{
|
|
for (int k = 0; k < 3; k++)
|
|
{
|
|
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType<TinyCrystal>(),
|
|
(int)(Projectile.damage * 0.5), Projectile.knockBack * 0.15f, Main.myPlayer);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|