50 lines
1.8 KiB
C#
50 lines
1.8 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
using Terraria.ID;
|
|
using Terraria.Audio;
|
|
|
|
namespace CalamityMod.Projectiles.Typeless
|
|
{
|
|
public class BloodBomb : ModProjectile, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Typeless";
|
|
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 20;
|
|
Projectile.height = 20;
|
|
Projectile.friendly = true;
|
|
Projectile.penetrate = 1;
|
|
Projectile.extraUpdates = 1;
|
|
Projectile.timeLeft = 600;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.4f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f);
|
|
if (Projectile.localAI[0] == 0f)
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Item73, Projectile.position);
|
|
Projectile.localAI[0] += 1f;
|
|
}
|
|
for (int j = 0; j < 3; j++)
|
|
{
|
|
int bloody = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1.2f);
|
|
Main.dust[bloody].noGravity = true;
|
|
Main.dust[bloody].velocity *= 0.5f;
|
|
Main.dust[bloody].velocity += Projectile.velocity * 0.1f;
|
|
}
|
|
}
|
|
|
|
public override void OnKill(int timeLeft)
|
|
{
|
|
if (Projectile.owner == Main.myPlayer)
|
|
{
|
|
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<BloodBombExplosion>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
|
|
}
|
|
}
|
|
}
|
|
}
|