Files
CalamityModPublic/Projectiles/Magic/Shadowbolt.cs
T
2023-05-28 06:14:26 +07:00

71 lines
2.3 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class Shadowbolt : ModProjectile
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetDefaults()
{
Projectile.width = 4;
Projectile.height = 4;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Magic;
Projectile.ignoreWater = true;
Projectile.penetrate = 6;
Projectile.extraUpdates = 100;
Projectile.timeLeft = 300;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
Projectile.damage = (int)(Projectile.damage * 1.15);
Projectile.penetrate--;
if (Projectile.penetrate <= 0)
{
Projectile.Kill();
}
else
{
if (Projectile.velocity.X != oldVelocity.X)
{
Projectile.velocity.X = -oldVelocity.X;
}
if (Projectile.velocity.Y != oldVelocity.Y)
{
Projectile.velocity.Y = -oldVelocity.Y;
}
}
return false;
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
Projectile.damage = (int)(Projectile.damage * 1.15);
}
public override void AI()
{
Projectile.localAI[0] += 1f;
if (Projectile.localAI[0] > 9f)
{
for (int num447 = 0; num447 < 4; num447++)
{
Vector2 vector33 = Projectile.position;
vector33 -= Projectile.velocity * ((float)num447 * 0.25f);
Projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 1f);
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
}
}
}
}