Files
CalamityModPublic/Projectiles/Typeless/FlareExplosion.cs
T

55 lines
1.9 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 string Texture => "CalamityMod/Projectiles/InvisibleProj";
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);
}
}
}