77 lines
2.4 KiB
C#
77 lines
2.4 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Ranged
|
|
{
|
|
public class GreenExoArrow : ModProjectile
|
|
{
|
|
public override string Texture => "CalamityMod/Projectiles/LaserProj";
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Green Exo Arrow");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = 5;
|
|
projectile.height = 5;
|
|
projectile.friendly = true;
|
|
projectile.alpha = 255;
|
|
projectile.penetrate = 1;
|
|
projectile.extraUpdates = 3;
|
|
projectile.timeLeft = 300;
|
|
projectile.ranged = true;
|
|
projectile.arrow = true;
|
|
projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
if (projectile.alpha > 0)
|
|
{
|
|
projectile.alpha -= 25;
|
|
}
|
|
if (projectile.alpha < 0)
|
|
{
|
|
projectile.alpha = 0;
|
|
}
|
|
float num55 = 40f;
|
|
float num56 = 1.5f;
|
|
if (projectile.ai[1] == 0f)
|
|
{
|
|
projectile.localAI[0] += num56;
|
|
if (projectile.localAI[0] > num55)
|
|
{
|
|
projectile.localAI[0] = num55;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
projectile.localAI[0] -= num56;
|
|
if (projectile.localAI[0] <= 0f)
|
|
{
|
|
projectile.Kill();
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs();
|
|
|
|
public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs();
|
|
|
|
public override Color? GetAlpha(Color lightColor) => new Color(0, 250, 0, projectile.alpha);
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor);
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
if (projectile.owner == Main.myPlayer)
|
|
{
|
|
Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType<ExoMark>(),projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
|
|
}
|
|
}
|
|
}
|
|
}
|