Files
CalamityModPublic/Projectiles/Ranged/AccelerationBulletProj.cs
T
Andrew Marheine e989939849 1 - Bullets work like they should, in terms of velocity.
2 - Eidolic Wail and Hadopelagic Echo improvements.
3 - Providence Guardians circle her and apply different effects to Provi while alive.
2022-01-12 20:15:06 -06:00

78 lines
2.5 KiB
C#

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class AccelerationBulletProj : 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.ranged = true;
projectile.penetrate = 1;
projectile.timeLeft = 600;
projectile.extraUpdates = 3;
aiType = ProjectileID.Bullet;
projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration;
}
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);
Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f);
return true;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor);
return false;
}
public override void Kill(int timeLeft)
{
Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 10);
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);
}
}
}
}