Files
CalamityModPublic/Projectiles/Typeless/GodSlayerShrapnelRound.cs
T
DominicKarma42 55e89c9b98 Replaced (hopefully) every magic number with a constant
Note: Does not include item rarities, and appears to shown nonexistant using directive movement in the commit. This does not really affect anything, however.
2020-05-30 17:56:36 -04:00

60 lines
2.3 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class GodSlayerShrapnelRound : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Round");
}
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)
{
Main.PlaySound(SoundID.Item73, projectile.position);
projectile.localAI[0] += 1f;
}
for (int num457 = 0; num457 < 3; num457++)
{
int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f);
Main.dust[num458].noGravity = true;
Main.dust[num458].velocity *= 0.5f;
Main.dust[num458].velocity += projectile.velocity * 0.1f;
}
}
public override void Kill(int timeLeft)
{
if (projectile.owner == Main.myPlayer)
{
int num251 = Main.rand.Next(4, 7);
for (int num252 = 0; num252 < num251; num252++)
{
Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
while (value15.X == 0f && value15.Y == 0f)
{
value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
}
value15.Normalize();
value15 *= (float)Main.rand.Next(70, 101) * 0.1f;
Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, ModContent.ProjectileType<GodSlayerShrapnel>(), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f);
}
}
}
}
}