Files
CalamityModPublic/Projectiles/Rogue/DuststormCloud.cs
T

68 lines
2.1 KiB
C#

using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class DuststormCloud : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Rogue";
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 4;
}
public override void SetDefaults()
{
Projectile.width = 38;
Projectile.height = 14;
Projectile.friendly = true;
Projectile.alpha = 255;
Projectile.penetrate = -1; //Would only be used by Sandslasher stealth
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.timeLeft = 600;
Projectile.DamageType = DamageClass.Generic;
Projectile.usesIDStaticNPCImmunity = true; //Would only be used by Sandslasher stealth
Projectile.idStaticNPCHitCooldown = 6; //Also only used by Sandslasher stealth
}
public override void AI()
{
Projectile.frameCounter++;
if (Projectile.frameCounter > 6)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame >= Main.projFrames[Projectile.type])
{
Projectile.frame = 0;
}
Projectile.velocity *= 0.995f;
Projectile.ai[1] += 1f;
if (Projectile.ai[1] >= 120f)
{
if (Projectile.alpha < 255)
{
Projectile.alpha += 5;
if (Projectile.alpha > 255)
{
Projectile.alpha = 255;
}
}
else if (Projectile.owner == Main.myPlayer)
{
Projectile.Kill();
}
}
else if (Projectile.alpha > 80)
{
Projectile.alpha -= 30;
if (Projectile.alpha < 80)
{
Projectile.alpha = 80;
}
}
}
}
}