Files
CalamityModPublic/Projectiles/Typeless/StandingFire.cs
T
Xyk 7aa44ad7d9 Changed all ~640 instances of Main.rand.NextBool(2) to remove the unnecessary 2
Also I forgot to push my reality rupture and ichor spear minor tweaks before hand so they're in here too.
Reality rupture stealth hit sound is louder.
Reality rupture stealth visual always has at least one big crack, cracks fade out.
There's more consistency in the spark particles on realty rupture stealth and ichor spear on hit sparks.
Reality Rupture stealth produces light.
2023-09-26 01:58:55 -07:00

96 lines
3.9 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Typeless
{
public class StandingFire : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetDefaults()
{
Projectile.width = 6;
Projectile.height = 12;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.timeLeft = 240;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 7;
}
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;
if (Projectile.ai[1] == 0f && Projectile.type >= 326 && Projectile.type <= 328)
{
Projectile.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item13, Projectile.position);
}
int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f);
Dust dust = Main.dust[num199];
dust.position.X -= 2f;
dust.position.Y += 2f;
dust.scale += (float)Main.rand.Next(50) * 0.01f;
dust.noGravity = true;
dust.velocity.Y -= 2f;
if (Main.rand.NextBool())
{
int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f);
Dust dust2 = Main.dust[num200];
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.1f;
}
if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15)
{
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>(), 120);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
}
}