100 lines
3.5 KiB
C#
100 lines
3.5 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Ranged
|
|
{
|
|
public class CosmicFire : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Fire");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = 6;
|
|
projectile.height = 6;
|
|
projectile.friendly = true;
|
|
projectile.ignoreWater = true;
|
|
projectile.ranged = true;
|
|
projectile.penetrate = -1;
|
|
projectile.extraUpdates = 3;
|
|
projectile.timeLeft = 90;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
if (projectile.scale <= 1.5f)
|
|
{
|
|
projectile.scale *= 1.01f;
|
|
}
|
|
Lighting.AddLight(projectile.Center, 0.25f, 0f, 0.1f);
|
|
if (projectile.timeLeft > 90)
|
|
{
|
|
projectile.timeLeft = 90;
|
|
}
|
|
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 = 58;
|
|
if (Main.rand.NextBool(2))
|
|
{
|
|
for (int num298 = 0; num298 < 1; 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, 1f);
|
|
if (Main.rand.NextBool(3))
|
|
{
|
|
Main.dust[num299].noGravity = true;
|
|
Main.dust[num299].scale *= 3f;
|
|
Dust expr_DBEF_cp_0 = Main.dust[num299];
|
|
expr_DBEF_cp_0.velocity.X *= 2f;
|
|
Dust expr_DC0F_cp_0 = Main.dust[num299];
|
|
expr_DC0F_cp_0.velocity.Y *= 2f;
|
|
}
|
|
else
|
|
{
|
|
Main.dust[num299].scale *= 1.5f;
|
|
}
|
|
Dust expr_DC74_cp_0 = Main.dust[num299];
|
|
expr_DC74_cp_0.velocity.X *= 1.2f;
|
|
Dust expr_DC94_cp_0 = Main.dust[num299];
|
|
expr_DC94_cp_0.velocity.Y *= 1.2f;
|
|
Main.dust[num299].scale *= num296;
|
|
Main.dust[num299].velocity += projectile.velocity;
|
|
if (!Main.dust[num299].noGravity)
|
|
{
|
|
Main.dust[num299].velocity *= 0.5f;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
projectile.ai[0] += 1f;
|
|
}
|
|
projectile.rotation += 0.3f * (float)projectile.direction;
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
target.immune[projectile.owner] = 3;
|
|
target.AddBuff(BuffID.CursedInferno, 300);
|
|
}
|
|
}
|
|
}
|