Files
CalamityModPublic/Projectiles/Melee/SunlightBlade.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

63 lines
2.0 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class SunlightBlade : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Blade");
ProjectileID.Sets.TrailCacheLength[projectile.type] = 6;
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
}
public override void SetDefaults()
{
projectile.width = 50;
projectile.height = 50;
projectile.aiStyle = 18;
projectile.alpha = 100;
projectile.friendly = true;
projectile.tileCollide = false;
projectile.melee = true;
projectile.penetrate = 5;
projectile.timeLeft = 180;
projectile.ignoreWater = true;
aiType = ProjectileID.DeathSickle;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 3;
}
public override void AI()
{
Lighting.AddLight(projectile.Center, 0.25f, 0.25f, 0f);
}
public override Color? GetAlpha(Color lightColor)
{
if (projectile.timeLeft < 85)
{
byte b2 = (byte)(projectile.timeLeft * 3);
byte a2 = (byte)(100f * ((float)b2 / 255f));
return new Color((int)b2, (int)b2, (int)b2, (int)a2);
}
return new Color(255, 255, 255, 100);
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
return false;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 300);
}
}
}