115 lines
3.8 KiB
C#
115 lines
3.8 KiB
C#
using System;
|
|
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.Dusts;
|
|
using CalamityMod.NPCs.SupremeCalamitas;
|
|
using CalamityMod.NPCs;
|
|
using CalamityMod.World;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.Audio;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Boss
|
|
{
|
|
public class BrimstoneHellblast : ModProjectile, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Boss";
|
|
public override void SetStaticDefaults()
|
|
{
|
|
Main.projFrames[Projectile.type] = 4;
|
|
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2;
|
|
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.Calamity().DealsDefenseDamage = true;
|
|
Projectile.width = 40;
|
|
Projectile.height = 40;
|
|
Projectile.hostile = true;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.tileCollide = false;
|
|
Projectile.penetrate = -1;
|
|
Projectile.timeLeft = 255;
|
|
CooldownSlot = ImmunityCooldownID.Bosses;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Projectile.frameCounter++;
|
|
if (Projectile.frameCounter >= 10)
|
|
{
|
|
Projectile.frame++;
|
|
Projectile.frameCounter = 0;
|
|
}
|
|
if (Projectile.frame > 3)
|
|
Projectile.frame = 0;
|
|
|
|
Lighting.AddLight(Projectile.Center, 0.9f * Projectile.Opacity, 0f, 0f);
|
|
|
|
if (Projectile.timeLeft < 51)
|
|
Projectile.Opacity -= 0.02f;
|
|
|
|
if (Projectile.ai[1] == 0f)
|
|
{
|
|
Projectile.ai[1] = 1f;
|
|
SoundEngine.PlaySound(SoundID.Item20, Projectile.Center);
|
|
}
|
|
|
|
if (Projectile.velocity.Length() < 18f)
|
|
Projectile.velocity *= 1.03f;
|
|
|
|
if (Projectile.velocity.X < 0f)
|
|
{
|
|
Projectile.spriteDirection = -1;
|
|
Projectile.rotation = (float)Math.Atan2(-Projectile.velocity.Y, -Projectile.velocity.X);
|
|
}
|
|
else
|
|
{
|
|
Projectile.spriteDirection = 1;
|
|
Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X);
|
|
}
|
|
}
|
|
|
|
public override bool PreDraw(ref Color lightColor)
|
|
{
|
|
lightColor.R = (byte)(255 * Projectile.Opacity);
|
|
|
|
if (CalamityGlobalNPC.SCal != -1)
|
|
{
|
|
if (Main.npc[CalamityGlobalNPC.SCal].active)
|
|
{
|
|
if (Main.npc[CalamityGlobalNPC.SCal].ModNPC<SupremeCalamitas>().cirrus)
|
|
lightColor.B = (byte)(255 * Projectile.Opacity);
|
|
}
|
|
}
|
|
|
|
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
|
|
return false;
|
|
}
|
|
|
|
public override bool CanHitPlayer(Player target) => Projectile.timeLeft >= 51;
|
|
|
|
public override void OnHitPlayer(Player target, Player.HurtInfo info)
|
|
{
|
|
if (info.Damage <= 0 || Projectile.timeLeft < 51)
|
|
return;
|
|
|
|
if (Projectile.ai[0] == 0f || Main.zenithWorld)
|
|
target.AddBuff(ModContent.BuffType<VulnerabilityHex>(), 120);
|
|
else
|
|
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 180);
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Item20, Projectile.Center);
|
|
for (int dust = 0; dust <= 5; dust++)
|
|
{
|
|
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f);
|
|
}
|
|
}
|
|
}
|
|
}
|