Files
CalamityModPublic/Projectiles/Rogue/MoonSigil.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

100 lines
3.4 KiB
C#

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class MoonSigil : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Moon Sigil");
}
public override void SetDefaults()
{
Projectile.width = 20;
Projectile.height = 20;
Projectile.friendly = true;
Projectile.penetrate = 2;
Projectile.ignoreWater = true;
Projectile.timeLeft = 250;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.DamageType = RogueDamageClass.Instance;
}
public override void AI()
{
if (Projectile.timeLeft < 52)
{
Projectile.alpha += 5;
Projectile.scale -= 0.013f;
}
if (Projectile.alpha >= 255)
{
Projectile.alpha = 255;
Projectile.Kill();
return;
}
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 8f, 20f);
}
// Reduce damage of projectiles if more than the cap are active
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
int projectileCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type];
int cap = 5;
int oldDamage = damage;
if (projectileCount > cap)
{
damage -= (int)(oldDamage * ((projectileCount - cap) * 0.05));
if (damage < 1)
damage = 1;
}
}
public override void Kill(int timeLeft)
{
float dustSp = 0.2f;
int dustD = 0;
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 5; j++)
{
Vector2 dustspeed = new Vector2(dustSp, dustSp).RotatedBy(MathHelper.ToRadians(dustD));
int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 31, dustspeed.X, dustspeed.Y, 200, new Color(213, 242, 232, 200), 1f);
Main.dust[d].noGravity = true;
Main.dust[d].position = Projectile.Center;
Main.dust[d].velocity = dustspeed;
dustSp += 0.2f;
}
dustD += 90;
dustSp = 0.2f;
}
}
public override void PostDraw(Color lightColor)
{
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Rogue/MoonSigil").Value;
Main.spriteBatch.Draw
(
texture,
new Vector2
(
Projectile.position.X - Main.screenPosition.X + Projectile.width * 0.5f,
Projectile.position.Y - Main.screenPosition.Y + Projectile.height - 20 * 0.5f
),
new Rectangle(0, 0, 20, 20),
Color.White,
Projectile.rotation,
new Vector2(10, 10),
Projectile.scale,
SpriteEffects.None,
0f
);
}
}
}