Files
CalamityModPublic/Projectiles/Melee/BlazingPhantomBlade.cs
T
2023-08-01 06:22:24 +07:00

66 lines
2.2 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class BlazingPhantomBlade : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 50;
Projectile.height = 50;
Projectile.aiStyle = ProjAIStyleID.Sickle;
Projectile.alpha = 100;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.tileCollide = false;
Projectile.penetrate = 3;
Projectile.ignoreWater = true;
AIType = ProjectileID.DeathSickle;
Projectile.MaxUpdates = 2;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 20 * Projectile.MaxUpdates;
Projectile.timeLeft = 180 * Projectile.MaxUpdates;
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, 0.6f, 0f, 0f);
float homingSpeed = (Projectile.ai[0] == 1f ? 8f : 4f);
CalamityUtils.HomeInOnNPC(Projectile, true, 250f, homingSpeed, 20f);
}
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, 1);
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(BuffID.OnFire, 180);
}
}
}