Files
CalamityModPublic/Projectiles/Typeless/ExoTankHoverThrust.cs
T
Altixal 58dab0812c buffed the ram damage to 6000. fuck em up
may seem like a lot but you lose a few gun attacks when you ram something
2024-11-18 11:14:07 -05:00

63 lines
2.4 KiB
C#

using CalamityMod.Items.Mounts;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class ExoTankHoverThrust : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public Player Owner => Main.player[Projectile.owner];
public override void SetStaticDefaults() => Main.projFrames[Type] = 5;
public override void SetDefaults()
{
Projectile.width = 186;
Projectile.height = 74;
Projectile.friendly = true;
}
public override void AI()
{
if (Owner is null || Owner.dead || Owner.mount is null || !Owner.mount.Active)
Projectile.Kill();
if (Owner.mount._type != ModContent.MountType<ExoTank>())
Projectile.Kill();
var data = (ExoTank.ExoTankData)Owner.mount._mountSpecificData;
if (!data.Hovering)
Projectile.Kill();
Projectile.frameCounter++;
Projectile.frame = Projectile.frameCounter / 3 % Main.projFrames[Type];
Projectile.Center = Owner.Bottom + Vector2.UnitY * (Projectile.height / 2);
Projectile.spriteDirection = Projectile.direction = Owner.direction;
Projectile.timeLeft = 2;
// Left thruster
Dust flame = Dust.NewDustPerfect(Projectile.Top - Vector2.UnitX * Main.rand.NextFloat(44f, 64f) * Owner.direction, DustID.BlueTorch);
flame.noGravity = true;
flame.noLight = true;
flame.velocity = Owner.velocity + Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(6f)) * Main.rand.NextFloat(5f, 12f);
flame.scale = Main.rand.NextFloat(0.5f, 1.5f);
// Right thruster
flame = Dust.NewDustPerfect(Projectile.Top + Vector2.UnitX * Main.rand.NextFloat(30f, 50f) * Owner.direction, DustID.BlueTorch);
flame.noGravity = true;
flame.noLight = true;
flame.velocity = Owner.velocity + Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(6f)) * Main.rand.NextFloat(5f, 12f);
flame.scale = Main.rand.NextFloat(0.5f, 1.5f);
}
public override bool ShouldUpdatePosition() => false;
public override Color? GetAlpha(Color lightColor) => Color.White;
}
}