41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Magic
|
|
{
|
|
public class MadAlchemistsCocktailGasCloud : ModProjectile, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Magic";
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 32;
|
|
Projectile.height = 32;
|
|
Projectile.friendly = true;
|
|
Projectile.DamageType = DamageClass.Magic;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.tileCollide = false;
|
|
Projectile.penetrate = -1;
|
|
|
|
// Only one gas cloud can hit at once.
|
|
Projectile.usesIDStaticNPCImmunity = true;
|
|
Projectile.idStaticNPCHitCooldown = 9;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Projectile.ai[1] += 1f;
|
|
if (Projectile.ai[1] > 60f)
|
|
{
|
|
Projectile.ai[0] += 10f;
|
|
}
|
|
if (Projectile.ai[0] > 255f)
|
|
{
|
|
Projectile.Kill();
|
|
Projectile.ai[0] = 255f;
|
|
}
|
|
Projectile.alpha = (int)(100.0 + (double)Projectile.ai[0] * 0.7);
|
|
Projectile.rotation += Projectile.velocity.X * 0.1f;
|
|
Projectile.rotation += (float)Projectile.direction * 0.003f;
|
|
Projectile.velocity *= 0.96f;
|
|
}
|
|
}
|
|
}
|