Files
CalamityModPublic/Projectiles/Rogue/BallisticPoisonCloud.cs
T
CongratsIsTrash 6a58977542 Projectile localization cleanup
This includes a bunch of unused projectiles getting deleted
2024-06-24 14:36:17 -04:00

70 lines
2.3 KiB
C#

using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class BallisticPoisonCloud : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Rogue";
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 10;
}
public override void SetDefaults()
{
Projectile.width = 34;
Projectile.height = 34;
Projectile.friendly = true;
Projectile.alpha = 255;
Projectile.penetrate = 5;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.timeLeft = 600;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 10;
}
public override void AI()
{
Projectile.ai[0] += 1f;
Projectile.frameCounter++;
if (Projectile.frameCounter > 6)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.ai[0] < 219f) //255 - frameCounter tick * number of disippation frames
{
if (Projectile.frame >= 4)
{
Projectile.frame = 0;
}
}
else if (Projectile.owner == Main.myPlayer && Projectile.frame >= Main.projFrames[Projectile.type])
{
Projectile.Kill();
}
Projectile.velocity *= 0.98f;
if (Projectile.alpha > 80)
{
Projectile.alpha -= 30;
if (Projectile.alpha < 80)
{
Projectile.alpha = 80;
}
}
if (Math.Abs(Projectile.velocity.X) > 0.1f)
{
Projectile.spriteDirection = -Projectile.direction;
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, Projectile.ai[1] == 1f ? 240 : 120);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Venom, Projectile.ai[1] == 1f ? 240 : 120);
}
}