77 lines
2.8 KiB
C#
77 lines
2.8 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Magic
|
|
{
|
|
public class VividBolt : ModProjectile
|
|
{
|
|
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Bolt");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 4;
|
|
Projectile.height = 4;
|
|
Projectile.extraUpdates = 100;
|
|
Projectile.penetrate = -1;
|
|
Projectile.friendly = true;
|
|
Projectile.timeLeft = 30;
|
|
Projectile.DamageType = DamageClass.Magic;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.usesLocalNPCImmunity = true;
|
|
Projectile.localNPCHitCooldown = 6;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Vector2 value7 = new Vector2(5f, 10f);
|
|
Projectile.ai[0] += 1f;
|
|
if (Projectile.ai[0] == 48f)
|
|
{
|
|
Projectile.ai[0] = 0f;
|
|
}
|
|
else
|
|
{
|
|
for (int num41 = 0; num41 < 2; num41++)
|
|
{
|
|
Vector2 value8 = Vector2.UnitX * -12f;
|
|
value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[0] * 0.1308997f + (float)num41 * 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.33f;
|
|
Main.dust[num42].noGravity = true;
|
|
Main.dust[num42].position = Projectile.Center + value8;
|
|
Main.dust[num42].velocity = Projectile.velocity;
|
|
}
|
|
}
|
|
Projectile.localAI[0] += 1f;
|
|
if (Projectile.localAI[0] > 4f)
|
|
{
|
|
for (int num447 = 0; num447 < 2; num447++)
|
|
{
|
|
Vector2 vector33 = Projectile.position;
|
|
vector33 -= Projectile.velocity * ((float)num447 * 0.25f);
|
|
int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f);
|
|
Main.dust[num448].noGravity = true;
|
|
Main.dust[num448].position = vector33;
|
|
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.01f;
|
|
Main.dust[num448].velocity *= 0.1f;
|
|
}
|
|
}
|
|
}
|
|
|
|
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();
|
|
}
|
|
}
|
|
}
|