fixed terra arrows

This commit is contained in:
termigator1359 authored and Cameron Ewell committed 2020-11-12 15:25:24 -05:00
1 parent 3998f0874f
commit 87911531c8
1 file changed
+17 -10
+17 -10
View File
@@ -7,6 +7,7 @@ namespace CalamityMod.Projectiles.Ranged
{
public class TerraArrowMain : ModProjectile
{
private bool initialized = false;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Arrow");
@@ -21,25 +22,31 @@ namespace CalamityMod.Projectiles.Ranged
projectile.arrow = true;
projectile.penetrate = 1;
projectile.timeLeft = 600;
projectile.extraUpdates = 1;
}
public override void AI()
{
projectile.velocity *= 1.005f;
if (projectile.velocity.Length() >= 20f)
{
projectile.Kill();
}
if (!initialized)
{
projectile.velocity *= 0.5f;
initialized = true;
}
if (projectile.FinalExtraUpdate() && initialized)
{
projectile.velocity *= 1.003f;
if (projectile.velocity.Length() >= 22f)
{
projectile.Kill();
}
}
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2;
}
public override void Kill(int timeLeft)
{
projectile.position = projectile.Center;
projectile.width = projectile.height = 32;
projectile.position.X -= (float)(projectile.width / 2);
projectile.position.Y -= (float)(projectile.height / 2);
Main.PlaySound(SoundID.Item60, projectile.position);
CalamityGlobalProjectile.ExpandHitboxBy(projectile, 32);
Main.PlaySound(SoundID.Item60, projectile.Center);
for (int d = 0; d < 3; d++)
{
int terra = Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 100, default, 2f);