Files
CalamityModPublic/Projectiles/Typeless/BloodBomb.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

50 lines
1.9 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class BloodBomb : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetDefaults()
{
Projectile.width = 20;
Projectile.height = 20;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.extraUpdates = 1;
Projectile.timeLeft = 600;
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.4f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f);
if (Projectile.localAI[0] == 0f)
{
SoundEngine.PlaySound(SoundID.Item73, Projectile.position);
Projectile.localAI[0] += 1f;
}
for (int j = 0; j < 3; j++)
{
int bloody = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1.2f);
Main.dust[bloody].noGravity = true;
Main.dust[bloody].velocity *= 0.5f;
Main.dust[bloody].velocity += Projectile.velocity * 0.1f;
}
}
public override void OnKill(int timeLeft)
{
if (Projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<BloodBombExplosion>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
}
}
}
}