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

53 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 GodSlayerShrapnelRound : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetDefaults()
{
Projectile.width = 8;
Projectile.height = 8;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.extraUpdates = 1;
Projectile.timeLeft = 300;
}
public override void AI()
{
if (Projectile.localAI[0] == 0f)
{
SoundEngine.PlaySound(SoundID.Item73, Projectile.position);
Projectile.localAI[0] += 1f;
}
for (int d = 0; d < 3; d++)
{
int cosmilite = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1.2f);
Main.dust[cosmilite].noGravity = true;
Main.dust[cosmilite].velocity *= 0.5f;
Main.dust[cosmilite].velocity += Projectile.velocity * 0.1f;
}
}
public override void OnKill(int timeLeft)
{
if (Projectile.owner == Main.myPlayer)
{
int shrapnelAmt = Main.rand.Next(4, 7);
for (int s = 0; s < shrapnelAmt; s++)
{
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<GodSlayerShrapnel>(), (int)(Projectile.damage * 0.3), 0f, Projectile.owner, 0f, 0f);
}
}
}
}
}