Files
CalamityModPublic/Projectiles/Ranged/MiniatureFolly.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

64 lines
2.1 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Ranged
{
public class MiniatureFolly : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Miniature Folly");
Main.projFrames[Projectile.type] = 2;
}
public override void SetDefaults()
{
Projectile.width = 24;
Projectile.height = 8;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.light = 0.25f;
Projectile.extraUpdates = 1;
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height);
SoundEngine.PlaySound(SoundID.NPCHit51, Projectile.Center);
return true;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
SoundEngine.PlaySound(SoundID.NPCHit51, Projectile.Center);
}
public override void AI()
{
Projectile.frameCounter++;
if (Projectile.frameCounter > 4)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame > 1)
{
Projectile.frame = 0;
}
if (Main.rand.Next(5) == 0)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f);
}
Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt();
Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? MathHelper.Pi : 0f);
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 10f, 20f);
}
}
}