Files
CalamityModPublic/Projectiles/Summon/BloodSpit.cs
T

54 lines
2.0 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Summon
{
public class BloodSpit : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Summon";
public Player Owner => Main.player[Projectile.owner];
public override void SetStaticDefaults()
{
Main.projFrames[Type] = 3;
ProjectileID.Sets.MinionShot[Type] = true;
}
public override void SetDefaults()
{
Projectile.width = Projectile.height = 8;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.timeLeft = 150;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 6;
Projectile.DamageType = DamageClass.Summon;
Projectile.Calamity().BloodstoneOrbValue = 12; //Bloodstone Orb lifesteal. May want to go back to regular lifesteal.
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, Projectile.Opacity * 0.77f, Projectile.Opacity * 0.15f, Projectile.Opacity * 0.08f);
Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2;
if (Projectile.frameCounter++ > 4)
{
Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type];
Projectile.frameCounter = 0;
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
for (int i = 0; i < 15; i++)
{
Dust blood = Dust.NewDustDirect(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Blood, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f);
blood.velocity = Main.rand.NextVector2Circular(1f, 2f);
blood.noGravity = true;
}
}
}
}