Files
CalamityModPublic/Projectiles/Magic/PrinceFlameSmall.cs
T
Ozzatron d4b5160f98 1 - Fully replaced Momentum Capacitor. It is now a channeled Burden Breaker.
2 - Stealth no longer gives movement speed.
3 - Moved a bunch of CalamityGlobalProjectile utilities to CalamityUtils where they belong.
4 - Renamed several things in CalamityGlobalProjectile
2022-07-02 19:42:56 -04:00

65 lines
2.1 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class PrinceFlameSmall : ModProjectile
{
public ref float Time => ref Projectile.ai[0];
public const int AttackDelay = 12;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Holy Fire");
Main.projFrames[Projectile.type] = 4;
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3;
}
public override void SetDefaults()
{
Projectile.width = Projectile.height = 16;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.timeLeft = 240;
Projectile.penetrate = 1;
Projectile.DamageType = DamageClass.Magic;
Projectile.extraUpdates = 2;
}
public override void AI()
{
Time++;
Projectile.frameCounter++;
Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type];
Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2;
Projectile.Opacity = Utils.GetLerpValue(0f, 15f, Projectile.timeLeft, true);
if (Time > AttackDelay)
CalamityUtils.HomeInOnNPC(Projectile, false, 600f, 14f, 32f);
}
public override bool PreDraw(ref Color lightColor)
{
lightColor = Color.Lerp(lightColor, Color.White, 0.8f);
lightColor.A /= 3;
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
public override bool? CanHitNPC(NPC target)
{
if (Time > AttackDelay)
return null;
return false;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 60);
}
}
}