68 lines
2.2 KiB
C#
68 lines
2.2 KiB
C#
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Magic
|
|
{
|
|
public class BloodBeam : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Blood Beam");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 12;
|
|
Projectile.height = 12;
|
|
Projectile.friendly = true;
|
|
Projectile.tileCollide = true;
|
|
Projectile.DamageType = DamageClass.Magic;
|
|
Projectile.penetrate = -1;
|
|
Projectile.extraUpdates = 3;
|
|
Projectile.timeLeft = 120;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Lighting.AddLight(Projectile.Center, 0.35f, 0f, 0f);
|
|
if (Projectile.ai[0] > 7f)
|
|
{
|
|
float scalar = 1f;
|
|
if (Projectile.ai[0] == 8f)
|
|
{
|
|
scalar = 0.25f;
|
|
}
|
|
else if (Projectile.ai[0] == 9f)
|
|
{
|
|
scalar = 0.5f;
|
|
}
|
|
else if (Projectile.ai[0] == 10f)
|
|
{
|
|
scalar = 0.75f;
|
|
}
|
|
Projectile.ai[0] += 1f;
|
|
int dustType = DustID.Blood;
|
|
int blood = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f);
|
|
Dust dust = Main.dust[blood];
|
|
if (Main.rand.NextBool(3))
|
|
{
|
|
dust.noGravity = true;
|
|
dust.scale *= 2f;
|
|
dust.velocity.X *= 2f;
|
|
dust.velocity.Y *= 2f;
|
|
}
|
|
dust.velocity.X *= 1.2f;
|
|
dust.velocity.Y *= 1.2f;
|
|
dust.scale *= scalar;
|
|
}
|
|
else
|
|
{
|
|
Projectile.ai[0] += 1f;
|
|
}
|
|
Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.PiOver2;
|
|
}
|
|
}
|
|
}
|