Files
CalamityModPublic/Projectiles/Typeless/FlameLickedHellblast.cs
T

107 lines
3.7 KiB
C#

using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class FlameLickedHellblast : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public override string Texture => "CalamityMod/Projectiles/Boss/BrimstoneHellblast";
public override void SetStaticDefaults()
{
Main.projFrames[Type] = 4;
ProjectileID.Sets.TrailCacheLength[Type] = 2;
ProjectileID.Sets.TrailingMode[Type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 40;
Projectile.height = 40;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.penetrate = 5;
Projectile.timeLeft = 255;
Projectile.localNPCHitCooldown = -1;
Projectile.usesLocalNPCImmunity = true;
}
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);
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1);
return false;
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
if (target.creativeGodMode)
return;
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 90);
}
public override bool? CanDamage() => Projectile.timeLeft >= 51;
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
//Doze - I gave all parry accessories long debuff infliction times due to the lack of weapons that inflict debuffs for a decent time, and the scarcity of using the parry
//Most common vanilla debuffs have a way to inflict them for 15, 20, or even 30 seconds
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), CalamityUtils.SecondsToFrames(15));
}
public override void OnKill(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);
}
}
}
}