91 lines
3.2 KiB
C#
91 lines
3.2 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Ranged
|
|
{
|
|
public class TerraFireGreen : ModProjectile, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Ranged";
|
|
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 12;
|
|
Projectile.height = 12;
|
|
Projectile.friendly = true;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.DamageType = DamageClass.Ranged;
|
|
Projectile.penetrate = -1;
|
|
Projectile.extraUpdates = 3;
|
|
Projectile.timeLeft = 120;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.45f / 255f, (255 - Projectile.alpha) * 0.05f / 255f);
|
|
if (Projectile.timeLeft > 120)
|
|
{
|
|
Projectile.timeLeft = 120;
|
|
}
|
|
if (Projectile.ai[0] > 7f)
|
|
{
|
|
float num296 = 1f;
|
|
if (Projectile.ai[0] == 8f)
|
|
{
|
|
num296 = 0.25f;
|
|
}
|
|
else if (Projectile.ai[0] == 9f)
|
|
{
|
|
num296 = 0.5f;
|
|
}
|
|
else if (Projectile.ai[0] == 10f)
|
|
{
|
|
num296 = 0.75f;
|
|
}
|
|
Projectile.ai[0] += 1f;
|
|
int num297 = 107;
|
|
if (Main.rand.NextBool(2))
|
|
{
|
|
for (int num298 = 0; num298 < 3; num298++)
|
|
{
|
|
int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 0.75f);
|
|
Dust dust = Main.dust[num299];
|
|
if (Main.rand.NextBool(3))
|
|
{
|
|
dust.noGravity = true;
|
|
dust.scale *= 2f;
|
|
dust.velocity.X *= 2f;
|
|
dust.velocity.Y *= 2f;
|
|
}
|
|
else
|
|
{
|
|
dust.scale *= 0.75f;
|
|
}
|
|
dust.velocity.X *= 1.2f;
|
|
dust.velocity.Y *= 1.2f;
|
|
dust.scale *= num296;
|
|
dust.velocity += Projectile.velocity;
|
|
if (!dust.noGravity)
|
|
{
|
|
dust.velocity *= 0.5f;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Projectile.ai[0] += 1f;
|
|
}
|
|
Projectile.rotation += 0.3f * (float)Projectile.direction;
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
|
{
|
|
target.immune[Projectile.owner] = 5;
|
|
target.AddBuff(BuffID.CursedInferno, 90);
|
|
}
|
|
}
|
|
}
|