Note: Does not include item rarities, and appears to shown nonexistant using directive movement in the commit. This does not really affect anything, however.
57 lines
2.0 KiB
C#
57 lines
2.0 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Boss
|
|
{
|
|
public class SandTooth : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Sand Tooth");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = 20;
|
|
projectile.height = 20;
|
|
projectile.hostile = true;
|
|
projectile.ignoreWater = true;
|
|
projectile.penetrate = 1;
|
|
projectile.timeLeft = 450;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
int num103 = (int)Player.FindClosest(projectile.Center, 1, 1);
|
|
projectile.ai[1] += 1f;
|
|
if (projectile.ai[1] < 250f && projectile.ai[1] > 60f)
|
|
{
|
|
float scaleFactor2 = projectile.velocity.Length();
|
|
Vector2 vector11 = Main.player[num103].Center - projectile.Center;
|
|
vector11.Normalize();
|
|
vector11 *= scaleFactor2;
|
|
projectile.velocity = (projectile.velocity * 24f + vector11) / 25f;
|
|
projectile.velocity.Normalize();
|
|
projectile.velocity *= scaleFactor2;
|
|
}
|
|
if (projectile.ai[0] < 0f)
|
|
{
|
|
if (projectile.velocity.Length() < 18f) //18
|
|
{
|
|
projectile.velocity *= 1.01f;
|
|
}
|
|
}
|
|
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f;
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
|
{
|
|
Texture2D tex = Main.projectileTexture[projectile.type];
|
|
spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f);
|
|
return false;
|
|
}
|
|
}
|
|
}
|