Files
CalamityModPublic/Projectiles/Ranged/AccelerationRoundProj.cs
T
Ozzatron d4b5160f98 1 - Fully replaced Momentum Capacitor. It is now a channeled Burden Breaker.
2 - Stealth no longer gives movement speed.
3 - Moved a bunch of CalamityGlobalProjectile utilities to CalamityUtils where they belong.
4 - Renamed several things in CalamityGlobalProjectile
2022-07-02 19:42:56 -04:00

78 lines
2.6 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Ranged
{
public class AccelerationRoundProj : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Acceleration Round");
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 4;
Projectile.height = 4;
Projectile.aiStyle = 1;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.extraUpdates = 3;
AIType = ProjectileID.Bullet;
Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration;
}
public override void AI()
{
Projectile.velocity *= 1.01f;
if (Projectile.velocity.Length() >= 12f)
{
Projectile.velocity *= 0.5f;
Projectile.extraUpdates++;
Projectile.netUpdate = true;
}
Projectile.localAI[0] += 1f;
if (Projectile.localAI[0] > 4f)
{
if (Main.rand.NextBool(3))
{
int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 91, 0f, 0f, 0, default, 0.5f);
Main.dust[num137].alpha = Projectile.alpha;
Main.dust[num137].velocity *= 0f;
Main.dust[num137].noGravity = true;
}
}
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height);
SoundEngine.PlaySound(SoundID.Dig, Projectile.position);
return true;
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor);
return false;
}
public override void Kill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item10, Projectile.position);
for (int k = 0; k < 5; k++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 91, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f);
}
}
}
}