Files
CalamityModPublic/Projectiles/Melee/YinYoLight.cs
T
Altixal 9f6f8741df Upgrading the rest of the yoyos
Be warned of Terrarian's fishy businesses
2023-08-12 19:40:41 +07:00

49 lines
1.5 KiB
C#

using Microsoft.Xna.Framework;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class YinYoLight : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
private const int speedTimerMax = 30;
private int speedTimer = 0;
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10;
ProjectileID.Sets.TrailingMode[Projectile.type] = 1;
}
public override void SetDefaults()
{
Projectile.width = Projectile.height = 10;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.MeleeNoSpeed;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.penetrate = 3;
Projectile.timeLeft = 120;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 30;
}
public override void AI()
{
Projectile.rotation += 0.5f;
speedTimer--;
if (speedTimer <= 0)
{
speedTimer = speedTimerMax;
Projectile.velocity *= -1f;
}
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2);
return false;
}
}
}