Files
CalamityModPublic/Projectiles/Boss/MoltenBlob.cs
T

105 lines
3.6 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Boss
{
public class MoltenBlob : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Molten Blob");
Main.projFrames[projectile.type] = 2;
}
public override void SetDefaults()
{
projectile.width = 12;
projectile.height = 12;
projectile.hostile = true;
projectile.penetrate = -1;
projectile.timeLeft = 1200;
projectile.scale = 1.5f;
cooldownSlot = 0;
}
public override void AI()
{
projectile.velocity.X *= 0.95f;
if (projectile.wet || projectile.lavaWet)
{
projectile.velocity.Y = 0f;
}
else
{
projectile.velocity.Y = projectile.velocity.Y + 0.1f;
if (projectile.velocity.Y > 5f)
{
projectile.velocity.Y = 5f;
}
}
projectile.frameCounter++;
if (projectile.frameCounter > 6)
{
projectile.frame++;
projectile.frameCounter = 0;
}
if (projectile.frame > 1)
{
projectile.frame = 0;
}
}
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough)
{
fallThrough = false;
return true;
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
if (projectile.penetrate == 0)
{
projectile.Kill();
}
return false;
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(250, 150, 0, projectile.alpha);
}
public override void Kill(int timeLeft)
{
Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20);
projectile.position.X = projectile.position.X + (float)(projectile.width / 2);
projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2);
projectile.width = 10;
projectile.height = 10;
projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);
for (int num621 = 0; num621 < 3; num621++)
{
int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f);
if (Main.rand.NextBool(2))
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 5; num623++)
{
int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f);
}
}
public override void OnHitPlayer(Player target, int damage, bool crit)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 90);
}
}
}