Files
CalamityModPublic/Projectiles/Enemy/SulphuricAcidMist.cs
T

83 lines
2.4 KiB
C#

using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Enemy
{
public class SulphuricAcidMist : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Acid Mist");
Main.projFrames[projectile.type] = 10;
}
public override void SetDefaults()
{
projectile.width = 30;
projectile.height = 30;
projectile.hostile = true;
projectile.ignoreWater = true;
projectile.penetrate = 1;
projectile.timeLeft = 300;
projectile.alpha = 255;
}
public override void AI()
{
projectile.frameCounter++;
if (projectile.frameCounter > 6)
{
projectile.frame++;
projectile.frameCounter = 0;
}
if (projectile.frame > 9)
{
projectile.frame = 0;
}
if (projectile.ai[1] == 0f)
{
projectile.ai[1] = 1f;
Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 111);
}
if (projectile.velocity.X < 0f)
{
projectile.spriteDirection = -1;
projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X);
}
else
{
projectile.spriteDirection = 1;
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X);
}
projectile.ai[0] += 1f;
if (projectile.ai[0] >= 180f)
{
if (projectile.alpha < 255)
{
projectile.alpha += 5;
if (projectile.alpha > 255)
{
projectile.alpha = 255;
projectile.Kill();
}
}
}
else if (projectile.alpha > 80)
{
projectile.alpha -= 30;
if (projectile.alpha < 80)
{
projectile.alpha = 80;
}
}
}
public override void OnHitPlayer(Player target, int damage, bool crit)
{
target.AddBuff(BuffID.Venom, 120);
}
}
}