increased the duration of vHex on almost all of scal's attacks, removed it from the blue sword swings. Brothers fire darts a bit less at low hp and a bit slower
136 lines
4.9 KiB
C#
136 lines
4.9 KiB
C#
using System.IO;
|
|
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.Dusts;
|
|
using CalamityMod.Events;
|
|
using CalamityMod.NPCs;
|
|
using CalamityMod.NPCs.CalClone;
|
|
using CalamityMod.NPCs.SupremeCalamitas;
|
|
using CalamityMod.World;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Boss
|
|
{
|
|
public class BrimstoneBarrage : 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.width = 18;
|
|
Projectile.height = 18;
|
|
Projectile.hostile = true;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.tileCollide = false;
|
|
Projectile.penetrate = -1;
|
|
Projectile.timeLeft = 690;
|
|
CooldownSlot = ImmunityCooldownID.Bosses;
|
|
}
|
|
|
|
public override void SendExtraAI(BinaryWriter writer)
|
|
{
|
|
writer.Write(Projectile.localAI[0]);
|
|
}
|
|
|
|
public override void ReceiveExtraAI(BinaryReader reader)
|
|
{
|
|
Projectile.localAI[0] = reader.ReadSingle();
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
bool bossRush = BossRushEvent.BossRushActive;
|
|
|
|
if (Projectile.velocity.Length() < (Projectile.ai[1] == 0f ? (bossRush ? 17.5f : 14f) : (bossRush ? 12.5f : 10f)))
|
|
Projectile.velocity *= bossRush ? 1.0125f : 1.01f;
|
|
|
|
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
|
|
|
Projectile.frameCounter++;
|
|
if (Projectile.frameCounter > 4)
|
|
{
|
|
Projectile.frame++;
|
|
Projectile.frameCounter = 0;
|
|
}
|
|
if (Projectile.frame > 3)
|
|
Projectile.frame = 0;
|
|
|
|
if (Projectile.timeLeft < 60)
|
|
Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f);
|
|
|
|
if (Projectile.ai[0] == 2f)
|
|
{
|
|
if (Projectile.timeLeft > 570)
|
|
{
|
|
int player = Player.FindClosest(Projectile.Center, 1, 1);
|
|
Vector2 vector = Main.player[player].Center - Projectile.Center;
|
|
float scaleFactor = Projectile.velocity.Length();
|
|
vector.Normalize();
|
|
vector *= scaleFactor;
|
|
Projectile.velocity = (Projectile.velocity * 15f + vector) / 16f;
|
|
Projectile.velocity.Normalize();
|
|
Projectile.velocity *= scaleFactor;
|
|
}
|
|
}
|
|
if (Projectile.ai[2] == 2f)
|
|
{
|
|
if (Projectile.timeLeft > 600)
|
|
Projectile.velocity *= 1.015f;
|
|
Projectile.scale = 0.8f;
|
|
|
|
Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), 182);
|
|
trailDust.noGravity = true;
|
|
trailDust.velocity = (-Projectile.velocity * 0.5f) * Main.rand.NextFloat(0.1f, 0.9f);
|
|
trailDust.scale = Main.rand.NextFloat(0.2f, 0.6f);
|
|
}
|
|
|
|
if (Projectile.localAI[0] == 0f)
|
|
{
|
|
Projectile.localAI[0] = 1f;
|
|
|
|
if (Projectile.ai[0] == 0f)
|
|
Projectile.damage = NPC.AnyNPCs(ModContent.NPCType<SupremeCalamitas>()) ? Projectile.GetProjectileDamage(ModContent.NPCType<SupremeCalamitas>()) : Projectile.GetProjectileDamage(ModContent.NPCType<CalamitasClone>());
|
|
}
|
|
|
|
Lighting.AddLight(Projectile.Center, 0.75f * Projectile.Opacity, 0f, 0f);
|
|
}
|
|
|
|
public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f;
|
|
|
|
public override void OnHitPlayer(Player target, Player.HurtInfo info)
|
|
{
|
|
if (info.Damage <= 0 || Projectile.Opacity != 1f)
|
|
return;
|
|
|
|
if (Projectile.ai[0] == 0f || Main.zenithWorld)
|
|
target.AddBuff(ModContent.BuffType<VulnerabilityHex>(), 180);
|
|
else
|
|
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 90);
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|