Files
CalamityModPublic/Projectiles/Melee/Brimblast.cs
T
tomat 67bceff6e7 Initial dotnet format pass.
This commit formats the entire codebase according to `dotnet format` and its limited understanding of our provided `.editorconfig`.
2024-02-28 21:49:50 -08:00

88 lines
3.5 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class Brimblast : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetDefaults()
{
Projectile.width = 6;
Projectile.height = 24;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.penetrate = 5;
Projectile.timeLeft = 120;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
if (Projectile.velocity.X != Projectile.velocity.X)
{
Projectile.velocity.X = Projectile.velocity.X * -0.1f;
}
if (Projectile.velocity.X != Projectile.velocity.X)
{
Projectile.velocity.X = Projectile.velocity.X * -0.5f;
}
if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f)
{
Projectile.velocity.Y = Projectile.velocity.Y * -0.5f;
}
Projectile.ai[0] += 1f;
if (Projectile.ai[0] > 5f)
{
Projectile.ai[0] = 5f;
if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f)
{
Projectile.velocity.X = Projectile.velocity.X * 0.97f;
if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01)
{
Projectile.velocity.X = 0f;
Projectile.netUpdate = true;
}
}
Projectile.velocity.Y = Projectile.velocity.Y + 0.2f;
}
Projectile.rotation += Projectile.velocity.X * 0.1f;
int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f);
Dust dust = Main.dust[brimDust];
dust.position.X -= 2f;
dust.position.Y += 2f;
dust.scale += (float)Main.rand.Next(50) * 0.01f;
dust.noGravity = true;
dust.velocity.Y -= 4f;
if (Main.rand.NextBool())
{
int brimDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f);
Dust dust2 = Main.dust[brimDust2];
dust2.position.X -= 2f;
dust2.position.Y += 2f;
dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f;
dust2.noGravity = true;
dust2.velocity *= 0.2f;
}
if (Projectile.velocity.Y < 0.25f && Projectile.velocity.Y > 0.15f)
{
Projectile.velocity.X = Projectile.velocity.X * 0.8f;
}
Projectile.rotation = -Projectile.velocity.X * 0.05f;
if (Projectile.velocity.Y > 16f)
{
Projectile.velocity.Y = 16f;
}
}
public override bool OnTileCollide(Vector2 oldVelocity) => false;
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 180);
}
}