Files
CalamityModPublic/Projectiles/Rogue/ProfanedPartisanSpear.cs
T
Andrew Marheine cb6b42f43f 1 - Highest tier accessory reforges now reforge into other highest tier accessory reforges.
2 - Nerfed Amalgam extra projectile damage values.
3 - Arma bags now only drop on first boss kills.
4 - Nerfed Conference Call extra bullet damage by 30%.
5 - Cal Clone dashes are no longer predictive.
6 - Old Duke looks in the direction he's about to dash instead of directly at the player, if he's going to dash.
7 - Updated pillar spawn code a bit more.
8 - Pulse Rifle now works like it should and doesn't hit 4 times on a single target.
9 - Adjusted HomeInOnNPC calls to use projectile.tileCollide to decide homing through tiles or not.
2021-04-13 00:19:56 -05:00

101 lines
2.8 KiB
C#

using Terraria;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using CalamityMod.Buffs.DamageOverTime;
namespace CalamityMod.Projectiles.Rogue
{
public class ProfanedPartisanSpear : ModProjectile
{
public int timer = 0;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Profaned Spear");
}
public override void SetDefaults()
{
projectile.width = 10;
projectile.height = 10;
projectile.friendly = true;
projectile.ignoreWater = true;
projectile.Calamity().rogue = true;
projectile.penetrate = -1;
projectile.extraUpdates = 3;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 10;
projectile.timeLeft = 600;
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
if (projectile.ai[1] != 1f)
{
if (projectile.velocity.X != oldVelocity.X)
{
projectile.velocity.X = -oldVelocity.X;
}
if (projectile.velocity.Y != oldVelocity.Y)
{
projectile.velocity.Y = -oldVelocity.Y;
}
projectile.ai[1] = 1f;
projectile.ai[0] = 1f;
projectile.extraUpdates = 2;
if (projectile.timeLeft > 280)
projectile.timeLeft = 280;
}
return false;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
OnHitEffects();
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
OnHitEffects();
}
private void OnHitEffects()
{
if (projectile.ai[1] != 1f)
{
projectile.velocity.X *= -1f;
projectile.velocity.Y *= -1f;
projectile.ai[1] = 1f;
projectile.ai[0] = 1f;
projectile.extraUpdates = 2;
if (projectile.timeLeft > 280)
projectile.timeLeft = 280;
}
}
public override void AI()
{
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2;
if (projectile.ai[0] == 1f)
timer++;
if (timer >= 5)
projectile.penetrate = 1;
if (timer >= 10)
{
CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 7f, 20f);
}
}
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;
}
}
}