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
86 lines
2.9 KiB
C#
86 lines
2.9 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Magic
|
|
{
|
|
public class VividLaser2 : ModProjectile
|
|
{
|
|
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Vivid Bolt");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 10;
|
|
Projectile.height = 10;
|
|
Projectile.friendly = true;
|
|
Projectile.alpha = 255;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.timeLeft = 120;
|
|
Projectile.penetrate = 1;
|
|
Projectile.DamageType = DamageClass.Magic;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Vector2 value7 = new Vector2(5f, 10f);
|
|
Projectile.ai[1] += 1f;
|
|
for (int dust = 0; dust < 2; dust++)
|
|
{
|
|
Vector2 value8 = Vector2.UnitX * -12f;
|
|
value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[1] * 0.1308997f + (float)dust * 3.14159274f), default) * value7 - Projectile.rotation.ToRotationVector2() * 10f;
|
|
int num42 = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f);
|
|
Main.dust[num42].scale = 0.75f;
|
|
Main.dust[num42].noGravity = true;
|
|
Main.dust[num42].position = Projectile.Center + value8;
|
|
Main.dust[num42].velocity = Projectile.velocity;
|
|
}
|
|
|
|
if (Projectile.timeLeft < 110)
|
|
Projectile.ai[0] = 1f;
|
|
|
|
if (Projectile.ai[0] >= 1f)
|
|
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 400f, 12f, 20f);
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
for (int k = 0; k < 3; k++)
|
|
{
|
|
int randomDust = Utils.SelectRandom(Main.rand, new int[]
|
|
{
|
|
107,
|
|
234,
|
|
269
|
|
});
|
|
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f);
|
|
}
|
|
}
|
|
|
|
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();
|
|
}
|
|
|
|
// Cannot deal damage for the first several frames of existence.
|
|
public override bool? CanHitNPC(NPC target)
|
|
{
|
|
if (Projectile.timeLeft >= 110)
|
|
{
|
|
return false;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public override bool CanHitPvp(Player target) => Projectile.timeLeft < 110;
|
|
}
|
|
}
|