Files
CalamityModPublic/Projectiles/Typeless/PendantProjectile1.cs
T

41 lines
1.6 KiB
C#

using CalamityMod.Buffs.StatDebuffs;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class PendantProjectile1 : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.timeLeft = 220;
Projectile.penetrate = 1;
Projectile.tileCollide = false;
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f);
Projectile.rotation += Projectile.velocity.X * 1.25f;
for (int i = 0; i < 5; i++)
{
int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Flare_Blue, 0f, 0f, 100, default, 0.6f);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= 0.5f;
Main.dust[dust].velocity += Projectile.velocity * 0.1f;
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<Eutrophication>(), 30);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<Eutrophication>(), 30);
}
}