Files
CalamityModPublic/Projectiles/Typeless/FlareExplosion.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

53 lines
1.8 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class FlareExplosion : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Explosion");
}
public override void SetDefaults()
{
projectile.width = 100;
projectile.height = 100;
projectile.friendly = true;
projectile.ignoreWater = true;
projectile.tileCollide = false;
projectile.penetrate = -1;
projectile.timeLeft = 10;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 10;
}
public override void AI()
{
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 3f / 255f, (255 - projectile.alpha) * 3f / 255f, (255 - projectile.alpha) * 0f / 255f);
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 4f)
{
for (int num468 = 0; num468 < 5; num468++)
{
int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 0.5f);
Main.dust[num469].noGravity = true;
Main.dust[num469].velocity *= 0f;
}
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 60);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 60);
}
}
}