Note: Does not include item rarities, and appears to shown nonexistant using directive movement in the commit. This does not really affect anything, however.
100 lines
3.5 KiB
C#
100 lines
3.5 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Melee
|
|
{
|
|
public class TrueCausticEdgeProjectile : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Edge");
|
|
ProjectileID.Sets.TrailCacheLength[projectile.type] = 10;
|
|
ProjectileID.Sets.TrailingMode[projectile.type] = 1;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = 20;
|
|
projectile.height = 20;
|
|
projectile.aiStyle = 27;
|
|
projectile.friendly = true;
|
|
projectile.melee = true;
|
|
projectile.penetrate = 3;
|
|
projectile.timeLeft = 600;
|
|
projectile.usesLocalNPCImmunity = true;
|
|
projectile.localNPCHitCooldown = 10;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Lighting.AddLight(projectile.Center, 0f, 0.35f, 0f);
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
|
{
|
|
if (projectile.timeLeft > 595)
|
|
return false;
|
|
|
|
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2);
|
|
return false;
|
|
}
|
|
|
|
public override Color? GetAlpha(Color lightColor)
|
|
{
|
|
return new Color(0, 100, 0, 0);
|
|
}
|
|
|
|
public override bool OnTileCollide(Vector2 oldVelocity)
|
|
{
|
|
projectile.damage = (int)(projectile.damage * 1.25);
|
|
projectile.penetrate--;
|
|
if (projectile.penetrate <= 0)
|
|
{
|
|
projectile.Kill();
|
|
}
|
|
else
|
|
{
|
|
projectile.ai[0] += 0.1f;
|
|
if (projectile.velocity.X != oldVelocity.X)
|
|
{
|
|
projectile.velocity.X = -oldVelocity.X;
|
|
}
|
|
if (projectile.velocity.Y != oldVelocity.Y)
|
|
{
|
|
projectile.velocity.Y = -oldVelocity.Y;
|
|
}
|
|
Main.PlaySound(SoundID.Item10, projectile.position);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
target.AddBuff(BuffID.OnFire, 240);
|
|
target.AddBuff(BuffID.Venom, 120);
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
Main.PlaySound(SoundID.Item10, projectile.position);
|
|
int num3;
|
|
for (int num795 = 4; num795 < 31; num795 = num3 + 1)
|
|
{
|
|
float num796 = projectile.oldVelocity.X * (30f / (float)num795);
|
|
float num797 = projectile.oldVelocity.Y * (30f / (float)num795);
|
|
int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 44, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f);
|
|
Main.dust[num798].noGravity = true;
|
|
Dust dust = Main.dust[num798];
|
|
dust.velocity *= 0.5f;
|
|
num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 44, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f);
|
|
dust = Main.dust[num798];
|
|
dust.velocity *= 0.05f;
|
|
num3 = num795;
|
|
}
|
|
}
|
|
}
|
|
}
|