Files
CalamityModPublic/Projectiles/Ranged/MeowFire2.cs
T
termigator1359 1b22071cf4 squash merge: Removed all unused textures
Removed nearly all unused textures in the entire mod, especially focusing on projectiles.
Apotheosis & the Death Valley Duster weapon line were ignored to prevent merge conflicts.
2020-11-15 14:25:46 -05:00

112 lines
4.0 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class MeowFire2 : ModProjectile
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
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.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 = 73;
for (int num298 = 0; num298 < 2; 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);
Dust dust = Main.dust[num299];
if (Main.rand.NextBool(3))
{
dust.noGravity = true;
dust.scale *= 1.75f;
dust.velocity.X *= 2f;
dust.velocity.Y *= 2f;
}
else
{
dust.scale *= 0.5f;
}
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, int damage, float knockback, bool crit)
{
target.immune[projectile.owner] = 8;
Main.PlaySound(SoundID.Item58, projectile.position);
projectile.position.X = projectile.position.X + (float)(projectile.width / 2);
projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2);
projectile.width = 10;
projectile.height = 10;
projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);
for (int num621 = 0; num621 < 10; num621++)
{
int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1f);
Main.dust[num622].velocity *= 3f;
if (Main.rand.NextBool(2))
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 20; num623++)
{
int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1.5f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1f);
Main.dust[num624].velocity *= 2f;
}
target.AddBuff(BuffID.OnFire, 180);
}
}
}