Files
CalamityModPublic/Projectiles/Boss/BrimstoneHellblast.cs
T

96 lines
3.3 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Boss
{
public class BrimstoneHellblast : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Brimstone Hellblast");
Main.projFrames[projectile.type] = 4;
ProjectileID.Sets.TrailCacheLength[projectile.type] = 4;
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
}
public override void SetDefaults()
{
projectile.width = 40;
projectile.height = 40;
projectile.hostile = true;
projectile.ignoreWater = true;
projectile.tileCollide = false;
projectile.penetrate = -1;
projectile.timeLeft = 255;
projectile.alpha = 0;
cooldownSlot = 1;
}
public override void AI()
{
projectile.frameCounter++;
if (projectile.frameCounter > 12)
{
projectile.frame++;
projectile.frameCounter = 0;
}
if (projectile.frame > 3)
{
projectile.frame = 0;
}
projectile.alpha += 1;
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.9f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f);
if (projectile.ai[1] == 0f)
{
projectile.ai[1] = 1f;
Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20);
}
projectile.velocity.X *= 1.03f;
projectile.velocity.Y *= 1.03f;
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);
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
return false;
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(250, 50, 50, projectile.alpha);
}
public override void OnHitPlayer(Player target, int damage, bool crit)
{
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 180);
if (projectile.ai[0] == 0f)
target.AddBuff(ModContent.BuffType<VulnerabilityHex>(), 120, true);
}
public override void Kill(int timeLeft)
{
Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20);
for (int dust = 0; dust <= 5; dust++)
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, 0f, 0f);
}
}
}
}