Removed Foveanator

This commit is contained in:
CongratsIsTrash committed 2025-06-10 16:26:20 -04:00
1 parent a1cce76576
commit 66948d0ac6
18 files changed
+16 -1484

No files matched your search

-10
View File
@@ -200,7 +200,6 @@ namespace CalamityMod
{ NPCID.Spazmatism, 0.85 },
{ NPCID.Retinazer, 0.85 },
{ ModContent.NPCType<Foveanator>(), 0.85 },
{ ModContent.NPCType<AquaticScourgeHead>(), 1.1 },
{ ModContent.NPCType<AquaticScourgeBody>(), 0.8 },
@@ -399,12 +398,6 @@ namespace CalamityMod
102, // 153 in phase 2
119, // 178 in phase 2
153 } }, // 229 in phase 2
{ ModContent.NPCType<Foveanator>(), new int[] {
62, // 93 in phase 2
94, // 141 in phase 2
110, // 165 in phase 2
128, // 192 in phase 2
178 } }, // 267 in phase 2
{ ModContent.NPCType<AquaticScourgeHead>(), new int[] { 110, 176, 187, 198, 330 } },
{ ModContent.NPCType<AquaticScourgeBody>(), new int[] { 75, 112, 136, 160, 240 } },
@@ -649,9 +642,6 @@ namespace CalamityMod
{ new Tuple<int, int>(NPCID.Spazmatism, ModContent.ProjectileType<CursedFire>()), new int[] { 60, 120, 148, 176, 264 } },
{ new Tuple<int, int>(NPCID.Spazmatism, ModContent.ProjectileType<Shadowflamethrower>()), new int[] { 70, 120, 148, 176, 264 } },
{ new Tuple<int, int>(NPCID.Spazmatism, ModContent.ProjectileType<ShadowflameFireball>()), new int[] { 60, 100, 128, 156, 234 } },
{ new Tuple<int, int>(ModContent.NPCType<Foveanator>(), ModContent.ProjectileType<FoveanatorLaser>()), new int[] { 50, 108, 132, 156, 234 } },
{ new Tuple<int, int>(ModContent.NPCType<Foveanator>(), ModContent.ProjectileType<FoveanatorEnergyBomb>()), new int[] { 70, 120, 148, 176, 264 } },
{ new Tuple<int, int>(ModContent.NPCType<Foveanator>(), ModContent.ProjectileType<FoveanatorFlamethrower>()), new int[] { 70, 120, 148, 176, 264 } },
{ new Tuple<int, int>(ModContent.NPCType<AquaticScourgeHead>(), ModContent.ProjectileType<SulphuricAcidMist>()), new int[] { 60, 100, 120, 140, 210 } },
{ new Tuple<int, int>(ModContent.NPCType<AquaticScourgeHead>(), ModContent.ProjectileType<SandPoisonCloud>()), new int[] { 70, 120, 136, 152, 228 } },
+1 -2
View File
@@ -213,8 +213,7 @@ namespace CalamityMod.Events
{
NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, NPCID.Spazmatism);
NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, NPCID.Retinazer);
NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, ModContent.NPCType<Foveanator>());
}, permittedNPCs: new int[] { NPCID.Retinazer, ModContent.NPCType<Foveanator>() }),
}, permittedNPCs: new int[] { NPCID.Retinazer }),
new Boss(ModContent.NPCType<AquaticScourgeHead>(), TimeChangeContext.Day, permittedNPCs: new int[] { ModContent.NPCType<AquaticScourgeBody>(), ModContent.NPCType<AquaticScourgeBodyAlt>(), ModContent.NPCType<AquaticScourgeTail>() }),
-3
View File
@@ -91,9 +91,6 @@ namespace CalamityMod.ILEditing
On_AWorldListItem.GetDifficulty += GetDifficultyOverride;
On_Item.GetShimmered += ShimmerEffectEdits;
On_Player.Teleport += TPOverride;
On_NPC.SpawnBoss += TripletsSpawnTextOverride;
On_NPC.DoDeathEvents_BeforeLoot += PreventFoveanatorDefeatMessageIfNotKilledLast;
On_NPC.DoDeathEvents_CelebrateBossDeath += TripletsDefeatTextOverride;
On_TileDrawing.DrawSingleTile += GlowMaskTileRender;
On_Main.DoUpdate_HandleChat += SpawnPunchCard;
On_Player.PlaceThing_CannonBall += AllowCannonJellyfishUse;
-61
View File
@@ -1849,67 +1849,6 @@ namespace CalamityMod.ILEditing
}
#endregion
#region Revengeance Master Mode Twins Shenanigans
public static void TripletsSpawnTextOverride(On_NPC.orig_SpawnBoss orig, int x, int y, int type, int targetPlayerIndex)
{
if (CalamityWorld.death && type == NPCID.Retinazer)
{
int retinazerIndex = NPC.NewNPC(NPC.GetBossSpawnSource(targetPlayerIndex), x, y, type, 1);
if (retinazerIndex == 200)
{
return;
}
Main.npc[retinazerIndex].target = targetPlayerIndex;
Main.npc[retinazerIndex].timeLeft *= 20;
if (Main.dedServ && retinazerIndex < 200)
{
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, retinazerIndex);
}
AchievementsHelper.CheckMechaMayhem();
CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.TripletsBossText", new Color(175, 75, 255));
return;
}
else
{
orig(x, y, type, targetPlayerIndex);
}
}
public static void PreventFoveanatorDefeatMessageIfNotKilledLast(On_NPC.orig_DoDeathEvents_BeforeLoot orig, NPC self, Player closestPlayer)
{
if (CalamityWorld.death && self.type == ModContent.NPCType<Foveanator>() && (NPC.AnyNPCs(NPCID.Spazmatism) || NPC.AnyNPCs(NPCID.Retinazer)))
{
self.value = 0f;
self.boss = false;
return;
}
else
{
orig(self, closestPlayer);
}
}
public static void TripletsDefeatTextOverride(On_NPC.orig_DoDeathEvents_CelebrateBossDeath orig, NPC self, string typeName)
{
bool correctNPCType = self.type == NPCID.Retinazer || self.type == NPCID.Spazmatism || self.type == ModContent.NPCType<Foveanator>();
if (CalamityWorld.death && correctNPCType)
{
if (Main.netMode == NetmodeID.SinglePlayer)
Main.NewText(Language.GetTextValue("Announcement.HasBeenDefeated_Plural", CalamityUtils.GetTextValue("Status.Boss.TripletsDefeatName")), 175, 75, 255);
else if (Main.dedServ)
ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasBeenDefeated_Plural", NetworkText.FromKey("Mods.CalamityMod.Status.Boss.TripletsDefeatName")), new Color(175, 75, 255));
return;
}
else
{
orig(self, typeName);
}
}
#endregion
#region Optimized GlowMask Rendering on Tile
private static void GlowMaskTileRender(On_TileDrawing.orig_DrawSingleTile orig, TileDrawing self, TileDrawInfo drawData, bool solidLayer, int waterStyleOverride, Vector2 screenPosition, Vector2 screenOffset, int tileX, int tileY)
{
+4 -4
View File
@@ -1920,7 +1920,7 @@ namespace CalamityMod.NPCs
{
npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.55);
}
else if (npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism || npc.type == NPCType<Foveanator>())
else if (npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism)
{
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2);
npc.npcSlots = 10f;
@@ -2938,7 +2938,7 @@ namespace CalamityMod.NPCs
{
if (!NPC.downedMechBossAny)
{
if (DestroyerIDList.Includes(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDList.Includes(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType<Foveanator>())
if (DestroyerIDList.Includes(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDList.Includes(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer)
{
double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic;
npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier);
@@ -2948,7 +2948,7 @@ namespace CalamityMod.NPCs
}
else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1))
{
if (DestroyerIDList.Includes(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDList.Includes(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType<Foveanator>())
if (DestroyerIDList.Includes(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDList.Includes(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer)
{
double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic;
npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier);
@@ -3959,7 +3959,7 @@ namespace CalamityMod.NPCs
public override bool PreAI(NPC npc)
{
// Change Spaz and Ret weaknesses and resistances when phase 2 starts.
if (npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType<Foveanator>())
if (npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer)
{
if (npc.ai[0] >= 2f)
{
-966
View File
@@ -1,966 +0,0 @@
using System;
using System.IO;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.DataStructures;
using CalamityMod.Events;
using CalamityMod.NPCs.AstrumDeus;
using CalamityMod.Projectiles.Boss;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.Chat;
using Terraria.GameContent;
using Terraria.GameContent.Achievements;
using Terraria.GameContent.Bestiary;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.NormalNPCs
{
public class Foveanator : ModNPC
{
public static int phase1IconIndex;
public static int phase2IconIndex;
public static Asset<Texture2D> GlowTexture;
public override void Load()
{
string phase1IconPath = "CalamityMod/NPCs/NormalNPCs/Foveanator_Head_Boss";
string phase2IconPath = "CalamityMod/NPCs/NormalNPCs/Foveanator_Phase2_Head_Boss";
phase1IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1);
phase2IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1);
}
public override void SetStaticDefaults()
{
Main.npcFrameCount[Type] = 6;
NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true };
NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData);
if (!Main.dedServ)
GlowTexture = ModContent.Request<Texture2D>("CalamityMod/NPCs/NormalNPCs/FoveanatorGlow", AssetRequestMode.AsyncLoad);
}
public override void SetDefaults()
{
NPC.Calamity().canBreakPlayerDefense = true;
NPC.aiStyle = -1;
AIType = -1;
NPC.GetNPCDamage();
NPC.DR_NERD(0.2f);
NPC.width = 100;
NPC.height = 100;
if (Main.tenthAnniversaryWorld)
NPC.scale *= 0.5f;
if (CalamityWorld.LegendaryMode)
NPC.scale *= 0.8f;
NPC.defense = 10;
NPC.lifeMax = 24000;
NPC.knockBackResist = 0f;
NPC.noGravity = true;
NPC.noTileCollide = true;
NPC.boss = true;
NPC.SpawnWithHigherTime(30);
NPC.HitSound = SoundID.NPCHit1;
NPC.DeathSound = SoundID.NPCDeath14;
NPC.Calamity().VulnerableToCold = true;
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = true;
AnimationType = NPCID.Retinazer;
Music = MusicID.Boss2;
CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true);
}
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(NPC.localAI[0]);
writer.Write(NPC.localAI[1]);
writer.Write(NPC.localAI[2]);
writer.Write(NPC.localAI[3]);
for (int i = 0; i < 4; i++)
writer.Write(NPC.Calamity().newAI[i]);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
NPC.localAI[0] = reader.ReadSingle();
NPC.localAI[1] = reader.ReadSingle();
NPC.localAI[2] = reader.ReadSingle();
NPC.localAI[3] = reader.ReadSingle();
for (int i = 0; i < 4; i++)
NPC.Calamity().newAI[i] = reader.ReadSingle();
}
public override void BossHeadSlot(ref int index) => index = NPC.ai[0] >= 3f ? phase2IconIndex : phase1IconIndex;
public override void AI()
{
CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity();
bool bossRush = BossRushEvent.BossRushActive;
// Get a target
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
CalamityUtils.CalamityTargeting(NPC, default);
float enrageScale = bossRush ? 0.5f : 0.3f;
if (Main.IsItDay() || bossRush)
{
NPC.Calamity().CurrentlyEnraged = !bossRush;
enrageScale += 1f;
}
// Percent life remaining
float lifeRatio = NPC.life / (float)NPC.lifeMax;
// Check for Retinazer
bool retAlive = false;
if (CalamityGlobalNPC.laserEye != -1)
retAlive = Main.npc[CalamityGlobalNPC.laserEye].active;
// Check for Spazmatism or Retinazer
bool spazAlive = false;
if (CalamityGlobalNPC.fireEye != -1)
spazAlive = Main.npc[CalamityGlobalNPC.fireEye].active;
// Explode if ret and spaz are dead
if (!retAlive && !spazAlive)
{
NPC.life = 0;
NPC.HitEffect();
NPC.active = false;
NPC.netUpdate = true;
return;
}
Vector2 lookDirection = NPC.Center - Main.player[NPC.target].Center;
int direction = (NPC.Center.X < Main.player[NPC.target].position.X + Main.player[NPC.target].width) ? -1 : 1;
float hoverRotation = lookDirection.ToRotation() + MathHelper.PiOver2;
if (hoverRotation < 0f)
hoverRotation += MathHelper.TwoPi;
else if (hoverRotation > MathHelper.TwoPi)
hoverRotation -= MathHelper.TwoPi;
// Rotate faster during energy bomb and laser barrage
float rotationRate = NPC.ai[1] == 3f ? 0.25f : 0.15f;
NPC.rotation = NPC.rotation.AngleTowards(hoverRotation, rotationRate);
if (Main.rand.NextBool(5))
{
int foveaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y + NPC.height * 0.25f), NPC.width, (int)(NPC.height * 0.5f), DustID.Blood, NPC.velocity.X, 2f, 0, default, 1f);
Dust dust = Main.dust[foveaDust];
dust.velocity.X *= 0.5f;
dust.velocity.Y *= 0.1f;
}
if (Main.netMode != NetmodeID.MultiplayerClient && !Main.player[NPC.target].dead && NPC.timeLeft < 10)
{
for (int i = 0; i < Main.maxNPCs; i++)
{
if (i != NPC.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism || Main.npc[i].type == NPC.type) && Main.npc[i].timeLeft - 1 > NPC.timeLeft)
NPC.timeLeft = Main.npc[i].timeLeft - 1;
}
}
// Phase HP ratios
float phase2LifeRatio = 0.85f;
float finalPhaseLifeRatio = 0.4f;
// Movement variables
float phase1MaxSpeedIncrease = 2f;
float phase1MaxAccelerationIncrease = 0.025f;
float phase1MaxChargeSpeedIncrease = 1f;
// Phase duration variables
float phase1MaxLaserPhaseDurationDecrease = 120f;
// Go to phase 2 early if Spaz and Ret health total goes below 50%
// Go to final phase early if Spaz and Ret health total goes below 20%
float retAndSpazHPRatio = 0f;
if (CalamityGlobalNPC.fireEye != -1)
{
if (Main.npc[CalamityGlobalNPC.fireEye].active)
retAndSpazHPRatio += Main.npc[CalamityGlobalNPC.fireEye].life / (float)Main.npc[CalamityGlobalNPC.fireEye].lifeMax;
}
if (CalamityGlobalNPC.laserEye != -1)
{
if (Main.npc[CalamityGlobalNPC.laserEye].active)
retAndSpazHPRatio += Main.npc[CalamityGlobalNPC.laserEye].life / (float)Main.npc[CalamityGlobalNPC.laserEye].lifeMax;
}
// Phase checks
bool phase2 = lifeRatio < phase2LifeRatio || retAndSpazHPRatio < 0.5f;
bool finalPhase = lifeRatio < finalPhaseLifeRatio || retAndSpazHPRatio < 0.2f;
Vector2 mechQueenSpacing = Vector2.Zero;
if (NPC.IsMechQueenUp)
{
NPC NPC = Main.npc[NPC.mechQueen];
Vector2 mechQueenCenter = NPC.GetMechQueenCenter();
Vector2 eyePosition = new Vector2(0f, -300f);
eyePosition *= 0.75f;
float mechdusaRotation = NPC.velocity.X * 0.025f;
mechQueenSpacing = mechQueenCenter + eyePosition;
mechQueenSpacing = mechQueenSpacing.RotatedBy(mechdusaRotation, mechQueenCenter);
}
NPC.reflectsProjectiles = false;
// Despawn
if (Main.player[NPC.target].dead)
{
NPC.velocity.Y -= 0.04f;
if (NPC.timeLeft > 10)
{
NPC.timeLeft = 10;
return;
}
}
else if (NPC.ai[0] == 0f)
{
if (NPC.ai[1] == 0f)
{
// Avoid cheap bullshit
NPC.damage = 0;
float maxVelocity = 8.5f;
float acceleration = 0.12f;
maxVelocity += 4.5f * enrageScale;
acceleration += 0.06f * enrageScale;
maxVelocity += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio));
acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio));
if (CalamityWorld.LegendaryMode)
{
maxVelocity *= 1.15f;
acceleration *= 1.15f;
}
// Foveanator stays further away from the player than Retinazer (Retinazer distance is 300, Foveanator distance is 450)
float distanceFromTarget = 450f;
Vector2 destination = Main.player[NPC.target].Center + Vector2.UnitX * distanceFromTarget * direction - Vector2.UnitY * distanceFromTarget;
float distanceFromDestination = (destination - NPC.Center).Length();
Vector2 idealVelocity = (destination - NPC.Center).SafeNormalize(Vector2.UnitX * direction);
if (NPC.IsMechQueenUp)
{
maxVelocity = 14f;
destination = mechQueenSpacing;
distanceFromDestination = (destination - NPC.Center).Length();
idealVelocity = (destination - NPC.Center).SafeNormalize(Vector2.UnitY);
if (distanceFromDestination > maxVelocity)
idealVelocity *= maxVelocity / distanceFromDestination;
float inertia = 60f;
NPC.velocity = (NPC.velocity * (inertia - 1f) + idealVelocity) / inertia;
}
else
NPC.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration);
// Foveanator stays in this phase longer than Retinazer (Foveanator time is 450, Retinazer time is 300)
// Foveanator has longer cooldown between firing projectiles than Retinazer (Foveanator cooldown is 60, Retinazer cooldown is 30)
float phaseGateValue = 450f - (phase1MaxLaserPhaseDurationDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)));
float laserGateValue = 60f;
if (NPC.IsMechQueenUp)
{
phaseGateValue = 1350f;
laserGateValue = ((!NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody]) ? 120f : 180f);
}
NPC.ai[2] += 1f;
if (NPC.ai[2] >= phaseGateValue)
{
NPC.ai[1] = 1f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
CalamityUtils.CalamityTargeting(NPC, default);
NPC.netUpdate = true;
}
else if (distanceFromDestination < 960f)
{
if (!Main.player[NPC.target].dead)
{
NPC.ai[3] += 1f;
if (CalamityWorld.LegendaryMode)
NPC.ai[3] += 0.5f;
}
if (NPC.ai[3] >= laserGateValue)
{
NPC.ai[3] = 0f;
SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
float laserSpeed = 6f + 1.5f * enrageScale;
int type = ModContent.ProjectileType<FoveanatorLaser>();
int damage = NPC.GetProjectileDamage(type);
// Reduce mech boss projectile damage depending on the new ore progression changes
if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive)
{
double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert;
double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert;
if (!NPC.downedMechBossAny)
damage = (int)(damage * firstMechMultiplier);
else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1))
damage = (int)(damage * secondMechMultiplier);
}
Vector2 laserVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * laserSpeed;
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 60f, laserVelocity, type, damage, 0f, Main.myPlayer);
}
}
}
}
else if (NPC.ai[1] == 1f)
{
// Set damage
NPC.damage = NPC.defDamage;
NPC.rotation = hoverRotation;
float chargeSpeed = 4f;
chargeSpeed += 1f * enrageScale;
if (CalamityWorld.LegendaryMode)
chargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio));
if (CalamityWorld.LegendaryMode)
chargeSpeed += 1f;
NPC.velocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * chargeSpeed;
NPC.ai[1] = 2f;
}
else if (NPC.ai[1] == 2f)
{
// Set damage
NPC.damage = NPC.defDamage;
NPC.ai[2] += 1f;
float decelerateGateValue = 72f + (12f * ((1f - lifeRatio) / (1f - phase2LifeRatio)));
if (NPC.ai[2] >= decelerateGateValue)
{
// Avoid cheap bullshit
NPC.damage = 0;
float decelerationMultiplier = 0.8f - (0.2f * ((1f - lifeRatio) / (1f - phase2LifeRatio)));
NPC.velocity *= decelerationMultiplier;
if (Math.Abs(NPC.velocity.X) < 0.1)
NPC.velocity.X = 0f;
if (Math.Abs(NPC.velocity.Y) < 0.1)
NPC.velocity.Y = 0f;
}
else
{
// Accelerative charge
float maxVelocity = 24f;
maxVelocity += 6f * enrageScale;
if (CalamityWorld.LegendaryMode)
maxVelocity += (phase1MaxChargeSpeedIncrease * 6f) * ((1f - lifeRatio) / (1f - phase2LifeRatio));
if (NPC.velocity.Length() < maxVelocity)
{
NPC.velocity *= 1.04f;
if (NPC.velocity.Length() > maxVelocity)
{
NPC.velocity.Normalize();
NPC.velocity *= maxVelocity;
}
}
NPC.rotation = NPC.velocity.ToRotation() - MathHelper.PiOver2;
}
float delayBeforeChargingAgain = 96f - (6f * ((1f - lifeRatio) / (1f - phase2LifeRatio)));
if (NPC.ai[2] >= delayBeforeChargingAgain)
{
NPC.ai[3] += 1f;
NPC.ai[2] = 0f;
NPC.rotation = hoverRotation;
float totalCharges = 3f;
if (NPC.ai[3] >= totalCharges)
{
NPC.ai[1] = 0f;
NPC.ai[3] = 0f;
CalamityUtils.CalamityTargeting(NPC, default);
}
else
NPC.ai[1] = 1f;
}
}
// Enter phase 2
if (phase2)
{
NPC.ai[0] = 1f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
CalamityUtils.CalamityTargeting(NPC, default);
NPC.netUpdate = true;
}
}
else if (NPC.ai[0] == 1f || NPC.ai[0] == 2f)
{
// Avoid cheap bullshit
NPC.damage = 0;
if (NPC.IsMechQueenUp)
NPC.reflectsProjectiles = true;
if (NPC.ai[0] == 1f)
{
NPC.ai[2] += 0.005f;
if (NPC.ai[2] > 0.5f)
NPC.ai[2] = 0.5f;
}
else
{
NPC.ai[2] -= 0.005f;
if (NPC.ai[2] < 0f)
NPC.ai[2] = 0f;
}
NPC.rotation += NPC.ai[2];
NPC.ai[1] += 1f;
if (NPC.ai[2] >= 0.2f)
{
if (NPC.ai[1] % 20f == 0f)
{
SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = ModContent.ProjectileType<FoveanatorEnergyBomb>();
int damage = NPC.GetProjectileDamage(type);
// Reduce mech boss projectile damage depending on the new ore progression changes
if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive)
{
double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert;
double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert;
if (!NPC.downedMechBossAny)
damage = (int)(damage * firstMechMultiplier);
else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1))
damage = (int)(damage * secondMechMultiplier);
}
float projectileSpeed = 16f;
Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed;
int spread = 30;
float rotation = MathHelper.ToRadians(spread);
for (int i = 0; i < 2; i++)
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i));
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 60f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f);
}
}
}
}
if (NPC.ai[1] == 100f)
{
NPC.ai[0] += 1f;
NPC.ai[1] = 0f;
if (NPC.ai[0] == 3f)
{
NPC.ai[2] = 0f;
}
else
{
SoundEngine.PlaySound(SoundID.NPCHit1, NPC.Center);
if (!Main.dedServ)
{
for (int i = 0; i < 2; i++)
{
Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), Mod.Find<ModGore>("Foveanator1").Type, NPC.scale);
Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 7, NPC.scale);
Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 6, NPC.scale);
}
}
for (int j = 0; j < 20; j++)
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f);
SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center);
}
}
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f);
NPC.velocity *= 0.98f;
if (Math.Abs(NPC.velocity.X) < 0.1)
NPC.velocity.X = 0f;
if (Math.Abs(NPC.velocity.Y) < 0.1)
NPC.velocity.Y = 0f;
}
else
{
// If in phase 2 but Spaz or Ret aren't
bool spazOrRetInPhase1 = false;
if (CalamityGlobalNPC.fireEye != -1)
{
if (Main.npc[CalamityGlobalNPC.fireEye].active)
spazOrRetInPhase1 = Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 1f || Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 2f || Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 0f;
}
if (CalamityGlobalNPC.laserEye != -1)
{
if (Main.npc[CalamityGlobalNPC.laserEye].active)
spazOrRetInPhase1 = Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 1f || Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 2f || Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 0f;
}
NPC.chaseable = !spazOrRetInPhase1;
int setDamage = (int)Math.Round(NPC.defDamage * 1.5);
NPC.defense = NPC.defDefense + 14;
calamityGlobalNPC.DR = spazOrRetInPhase1 ? 0.9999f : 0.2f;
calamityGlobalNPC.unbreakableDR = spazOrRetInPhase1;
calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = spazOrRetInPhase1;
NPC.HitSound = SoundID.NPCHit4;
if (NPC.ai[1] == 0f)
{
// Avoid cheap bullshit
NPC.damage = 0;
float maxVelocity = 4f + (1.2f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio));
float acceleration = 0.06f + (0.02f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio));
maxVelocity += 2f * enrageScale;
acceleration += 0.04f * enrageScale;
float distanceFromTarget = 360f;
Vector2 destination = Main.player[NPC.target].Center + Vector2.UnitX * distanceFromTarget * direction;
float distanceFromDestination = (destination - NPC.Center).Length();
Vector2 idealVelocity = (destination - NPC.Center).SafeNormalize(Vector2.UnitX * direction);
if (!NPC.IsMechQueenUp)
{
// Boost speed if too far from target
if (distanceFromDestination > distanceFromTarget)
maxVelocity += MathHelper.Lerp(0f, 12f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f));
if (CalamityWorld.LegendaryMode)
{
maxVelocity *= 1.15f;
acceleration *= 1.15f;
}
NPC.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration);
}
// Fire flamethrower for x seconds
NPC.ai[2] += (retAlive && spazAlive) ? 1f : 2f;
float phaseGateValue = NPC.IsMechQueenUp ? 1350f : 360f - (90f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio));
if (NPC.ai[2] >= phaseGateValue)
{
// Go to charge phase or fire large barrage of lasers and energy bombs if in final phase
NPC.ai[1] = finalPhase ? 3f : 1f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
NPC.netUpdate = true;
}
// Fire fireballs and flamethrower
else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height))
{
// Play flame sound on timer
NPC.localAI[2] += 1f;
if (NPC.localAI[2] > 22f)
{
NPC.localAI[2] = 0f;
SoundEngine.PlaySound(SoundID.Item34, NPC.Center);
}
if (Main.netMode != NetmodeID.MultiplayerClient)
{
NPC.localAI[1] += 1f;
if (NPC.localAI[1] > 4f)
{
NPC.localAI[1] = 0f;
float foveanatorFlamethrowerSpeed = 4f + 2f * enrageScale;
float timeForFlamethrowerToReachMaxVelocity = (retAlive && spazAlive) ? 120f : 60f;
float flamethrowerSpeedScalar = MathHelper.Clamp(NPC.ai[2] / timeForFlamethrowerToReachMaxVelocity, 0f, 1f);
foveanatorFlamethrowerSpeed = MathHelper.Lerp(0.1f, foveanatorFlamethrowerSpeed, flamethrowerSpeedScalar);
int type = ModContent.ProjectileType<FoveanatorFlamethrower>();
int damage = NPC.GetProjectileDamage(type);
// Reduce mech boss projectile damage depending on the new ore progression changes
if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive)
{
double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert;
double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert;
if (!NPC.downedMechBossAny)
damage = (int)(damage * firstMechMultiplier);
else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1))
damage = (int)(damage * secondMechMultiplier);
}
Vector2 flamethrowerVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * foveanatorFlamethrowerSpeed + NPC.velocity * 0.5f;
if (NPC.IsMechQueenUp)
flamethrowerVelocity = (NPC.rotation + MathHelper.PiOver2).ToRotationVector2() * foveanatorFlamethrowerSpeed + NPC.velocity * 0.5f;
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 100f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer);
}
}
}
if (NPC.IsMechQueenUp)
{
maxVelocity = 14f;
destination = mechQueenSpacing;
distanceFromDestination = (destination - NPC.Center).Length();
idealVelocity = (destination - NPC.Center).SafeNormalize(Vector2.UnitY);
if (distanceFromDestination > maxVelocity)
idealVelocity *= maxVelocity / distanceFromDestination;
float inertia = 60f;
NPC.velocity = (NPC.velocity * (inertia - 1f) + idealVelocity) / inertia;
}
}
// Charge
else if (NPC.ai[1] == 1f)
{
// Set damage
NPC.damage = setDamage;
// Play charge sound
// TODO - Make this a jet turbine sound or something
//SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center);
// Set rotation and velocity
NPC.rotation = hoverRotation;
float chargeSpeed = 4.5f + (1.25f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio));
chargeSpeed += 4f * enrageScale;
if (CalamityWorld.LegendaryMode)
chargeSpeed *= 1.2f;
NPC.velocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * chargeSpeed;
NPC.ai[1] = 2f;
}
// Maintain charge velocity until deceleration
else if (NPC.ai[1] == 2f)
{
// Set damage
NPC.damage = setDamage;
NPC.ai[2] += 1f;
float chargeTime = 60f - (20f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio));
// Slow down
if (NPC.ai[2] >= chargeTime)
{
// Avoid cheap bullshit
NPC.damage = 0;
float deceleration = 0.8f - (0.15f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio));
NPC.velocity *= deceleration;
if (Math.Abs(NPC.velocity.X) < 0.1)
NPC.velocity.X = 0f;
if (Math.Abs(NPC.velocity.Y) < 0.1)
NPC.velocity.Y = 0f;
}
else
{
// Accelerative charge
float maxVelocity = 27f;
maxVelocity += 6f * enrageScale;
if (CalamityWorld.LegendaryMode)
maxVelocity += 7.5f * ((1f - lifeRatio) / (1f - phase2LifeRatio));
// Spawn Energy Bombs along the way
float energyBombFireRate = 8f;
if (NPC.ai[2] % energyBombFireRate == 0f)
{
SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = ModContent.ProjectileType<FoveanatorEnergyBomb>();
int damage = NPC.GetProjectileDamage(type);
// Reduce mech boss projectile damage depending on the new ore progression changes
if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive)
{
double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert;
double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert;
if (!NPC.downedMechBossAny)
damage = (int)(damage * firstMechMultiplier);
else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1))
damage = (int)(damage * secondMechMultiplier);
}
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + NPC.velocity.SafeNormalize(Vector2.UnitY) * 60f, Vector2.Zero, type, damage, 0f, Main.myPlayer, 1f);
}
}
if (NPC.velocity.Length() < maxVelocity)
{
NPC.velocity *= 1.06f;
if (NPC.velocity.Length() > maxVelocity)
{
NPC.velocity.Normalize();
NPC.velocity *= maxVelocity;
}
}
NPC.rotation = NPC.velocity.ToRotation() - MathHelper.PiOver2;
}
// Charge 2 times
if (NPC.ai[2] >= chargeTime * 1.3f)
{
NPC.ai[3] += 1f;
NPC.ai[2] = 0f;
NPC.rotation = hoverRotation;
float maxCharges = 2f;
if (NPC.ai[3] >= maxCharges)
{
NPC.ai[1] = 0f;
NPC.ai[3] = 0f;
}
else
NPC.ai[1] = 1f;
}
}
// Laser and energy bomb barrage
else if (NPC.ai[1] == 3f)
{
float maxVelocity = 12f + (2.4f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio));
float acceleration = 0.16f + (0.32f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio));
maxVelocity += 6f * enrageScale;
acceleration += 0.08f * enrageScale;
if (CalamityWorld.LegendaryMode)
{
maxVelocity *= 1.15f;
acceleration *= 1.15f;
}
float distanceFromTarget = 640f;
Vector2 destination = Main.player[NPC.target].Center + Vector2.UnitX * distanceFromTarget * direction;
float distanceFromDestination = (destination - NPC.Center).Length();
Vector2 idealVelocity = (destination - NPC.Center).SafeNormalize(Vector2.UnitX * direction);
bool gettingIntoPosition = NPC.ai[2] == 0f;
if (NPC.Distance(Main.player[NPC.target].Center) < distanceFromTarget && gettingIntoPosition)
{
NPC.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration);
}
else
{
NPC.SimpleFlyMovement(idealVelocity * maxVelocity * 0.5f, acceleration * 0.5f);
// Fire 3 spreads of energy bombs and lasers
int totalSpreads = 6;
// Fire rates
float laserBarrageFireRate = 45f;
float energyBombFireRate = 90f;
NPC.ai[2] += 1f;
// Energy bombs
if (NPC.ai[2] % energyBombFireRate == 0f)
{
SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = ModContent.ProjectileType<FoveanatorEnergyBomb>();
int damage = NPC.GetProjectileDamage(type);
// Reduce mech boss projectile damage depending on the new ore progression changes
if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive)
{
double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert;
double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert;
if (!NPC.downedMechBossAny)
damage = (int)(damage * firstMechMultiplier);
else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1))
damage = (int)(damage * secondMechMultiplier);
}
Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * 16f;
int numProj = 3;
int spread = 30;
float rotation = MathHelper.ToRadians(spread);
for (int i = 0; i < numProj; i++)
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1)));
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 60f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f);
}
}
NPC.ai[3] += 1f;
}
else if (NPC.ai[2] % laserBarrageFireRate == 0f)
{
SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = ModContent.ProjectileType<FoveanatorLaser>();
int damage = NPC.GetProjectileDamage(type);
// Reduce mech boss projectile damage depending on the new ore progression changes
if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive)
{
double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert;
double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert;
if (!NPC.downedMechBossAny)
damage = (int)(damage * firstMechMultiplier);
else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1))
damage = (int)(damage * secondMechMultiplier);
}
float projectileSpeed = 8f + 2f * enrageScale;
Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed;
int numProj = 4;
int spread = 40;
float rotation = MathHelper.ToRadians(spread);
for (int i = 0; i < numProj; i++)
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1)));
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 60f, perturbedSpeed, type, damage, 0f, Main.myPlayer);
}
}
NPC.ai[3] += 1f;
}
// Charge
if (NPC.ai[3] >= totalSpreads)
{
NPC.ai[1] = 1f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
NPC.netUpdate = true;
}
}
}
}
}
public override void BossLoot(ref string name, ref int potionType) => potionType = ItemID.GreaterHealingPotion;
public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment)
{
NPC.lifeMax = (int)(NPC.lifeMax * 0.75f * balance * bossAdjustment);
NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier());
}
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
{
SpriteEffects spriteEffects = SpriteEffects.None;
if (NPC.spriteDirection == 1)
spriteEffects = SpriteEffects.FlipHorizontally;
spriteBatch.Draw(TextureAssets.Npc[Type].Value, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0f);
Texture2D glowTexture = GlowTexture.Value;
spriteBatch.Draw(glowTexture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, Color.White, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0f);
return false;
}
public override void HitEffect(NPC.HitInfo hit)
{
if (NPC.life > 0)
{
for (int i = 0; (double)i < hit.Damage / (double)NPC.lifeMax * 100D; i++)
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f);
return;
}
for (int i = 0; i < 150; i++)
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 2 * hit.HitDirection, -2f);
if (!Main.dedServ)
{
for (int i = 0; i < 2; i++)
{
Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 2, NPC.scale);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7, NPC.scale);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 9, NPC.scale);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), Mod.Find<ModGore>("Foveanator2").Type, NPC.scale);
}
}
for (int i = 0; i < 10; i++)
{
int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f);
Main.dust[dust].velocity *= 1.4f;
}
for (int i = 0; i < 5; i++)
{
int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default, 2.5f);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= 5f;
dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default, 1.5f);
Main.dust[dust].velocity *= 3f;
}
if (!Main.dedServ)
{
int gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default, Main.rand.Next(61, 64));
Main.gore[gore].velocity *= 0.4f;
Main.gore[gore].velocity.X += 1f;
Main.gore[gore].velocity.Y += 1f;
gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default, Main.rand.Next(61, 64));
Main.gore[gore].velocity *= 0.4f;
Main.gore[gore].velocity.X -= 1f;
Main.gore[gore].velocity.Y += 1f;
gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default, Main.rand.Next(61, 64));
Main.gore[gore].velocity *= 0.4f;
Main.gore[gore].velocity.X += 1f;
Main.gore[gore].velocity.Y -= 1f;
gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default, Main.rand.Next(61, 64));
Main.gore[gore].velocity *= 0.4f;
Main.gore[gore].velocity.X -= 1f;
Main.gore[gore].velocity.Y -= 1f;
}
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 618 B

+11 -25
View File
@@ -71,21 +71,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
{
for (int i = 0; i < Main.maxNPCs; i++)
{
if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism || Main.npc[i].type == ModContent.NPCType<Foveanator>()) && Main.npc[i].timeLeft - 1 > npc.timeLeft)
if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism) && Main.npc[i].timeLeft - 1 > npc.timeLeft)
npc.timeLeft = Main.npc[i].timeLeft - 1;
}
}
// Foveanator spawn
if (death && calamityGlobalNPC.newAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient && !bossRush)
{
NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType<Foveanator>());
calamityGlobalNPC.newAI[0] = 1f;
npc.SyncExtraAI();
}
bool foveanatorAlive = NPC.AnyNPCs(ModContent.NPCType<Foveanator>());
// Phase HP ratios
float phase2LifeRatio = death ? 0.85f : 0.7f;
float finalPhaseLifeRatio = death ? 0.4f : 0.25f;
@@ -174,7 +164,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
npc.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration);
float phaseGateValue = death ? (300f - phase1MaxLaserPhaseDurationDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio))) : 450f;
float laserGateValue = foveanatorAlive ? 45f : 30f;
float laserGateValue = 30f;
if (NPC.IsMechQueenUp)
{
phaseGateValue = 900f;
@@ -283,8 +273,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
npc.rotation = hoverRotation;
float totalCharges = death ? 6f : 5f;
if (foveanatorAlive)
totalCharges -= 1f;
if (npc.ai[3] >= totalCharges)
{
@@ -483,7 +471,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (Main.netMode != NetmodeID.MultiplayerClient)
{
npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f);
if (npc.localAI[1] >= (spazAlive ? (foveanatorAlive ? 64f : 52f) : foveanatorAlive ? 39f : 26f))
if (npc.localAI[1] >= (spazAlive ? 52f : 26f))
{
if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
{
@@ -540,7 +528,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (Main.netMode != NetmodeID.MultiplayerClient)
{
npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f);
if (npc.localAI[1] > (spazAlive ? (foveanatorAlive ? 25f : 20f) : foveanatorAlive ? 15f : 10f))
if (npc.localAI[1] > (spazAlive ? 20f : 10f))
{
if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
{
@@ -637,7 +625,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (npc.ai[3] % 3f == 0f)
{
float fireRate = spazAlive ? 13f : foveanatorAlive ? 11f : 9f;
float fireRate = spazAlive ? 13f : 9f;
if (npc.ai[2] % fireRate == 0f)
{
SoundEngine.PlaySound(SoundID.Item33, npc.Center);
@@ -805,13 +793,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
{
for (int i = 0; i < Main.maxNPCs; i++)
{
if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism || Main.npc[i].type == ModContent.NPCType<Foveanator>()) && Main.npc[i].timeLeft - 1 > npc.timeLeft)
if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism) && Main.npc[i].timeLeft - 1 > npc.timeLeft)
npc.timeLeft = Main.npc[i].timeLeft - 1;
}
}
bool foveanatorAlive = NPC.AnyNPCs(ModContent.NPCType<Foveanator>());
// Phase HP ratios
float phase2LifeRatio = death ? 0.85f : 0.7f;
float finalPhaseLifeRatio = death ? 0.3f : 0.15f;
@@ -924,7 +910,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
npc.ai[3] += 0.4f;
}
if (npc.ai[3] >= (foveanatorAlive ? 45f : 30f))
if (npc.ai[3] >= 30f)
{
npc.ai[3] = 0f;
@@ -1007,7 +993,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
npc.rotation = hoverRotation;
float totalCharges = foveanatorAlive ? 6f : 8f;
float totalCharges = 8f;
if (death)
totalCharges -= (float)Math.Round(phase1MaxChargesDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)));
@@ -1216,7 +1202,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
npc.ai[3] += 1f;
npc.localAI[1] = 0f;
float flamethrowerSpeed = foveanatorAlive ? 5f : 6f;
float flamethrowerSpeed = 6f;
flamethrowerSpeed += 3f * enrageScale;
float timeForFlamethrowerToReachMaxVelocity = 60f;
float flamethrowerSpeedScalar = MathHelper.Clamp(npc.ai[2] / timeForFlamethrowerToReachMaxVelocity, 0f, 1f);
@@ -1328,7 +1314,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
npc.rotation = hoverRotation;
float totalCharges = foveanatorAlive ? 4f : 5f;
float totalCharges = 5f;
if (npc.ai[3] >= totalCharges)
{
npc.ai[1] = 0f;
@@ -1505,7 +1491,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
npc.ai[2] += 1f;
// Fire shadowflames and cursed fireballs
float fireRate = retAlive ? 30f : foveanatorAlive ? 25f : 20f;
float fireRate = retAlive ? 30f : 20f;
if (npc.ai[2] % fireRate == 0f)
{
npc.ai[3] += 1f;
-152
View File
@@ -1,152 +0,0 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Events;
using CalamityMod.NPCs;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Boss
{
public class FoveanatorEnergyBomb : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Boss";
private const int TotalXFrames = 2;
private const int TotalYFrames = 8;
private const int ExplodeFrames = 6;
private const int ExplodeDamageStartFrame = 3;
private const int FrameTimer = 6;
public int frameX = 0;
public int frameY = 0;
public int CurrentFrame
{
get => frameX * TotalYFrames + frameY;
set
{
frameX = value / TotalYFrames;
frameY = value % TotalYFrames;
}
}
private const int TimeLeft = 300;
private const int SlowDownTime = TimeLeft / 2;
private const int ExplosionDuration = FrameTimer * ExplodeFrames;
private const float ExplodeDistance = 50f;
public override void SetDefaults()
{
Projectile.width = 133;
Projectile.height = 142;
Projectile.hostile = true;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.timeLeft = TimeLeft;
}
public override void AI()
{
// If moving, decelerate.
if (Projectile.velocity.Length() > 0f && Projectile.timeLeft <= SlowDownTime)
Projectile.velocity *= 0.95f;
// Get a target and calculate distance from it.
int target = Player.FindClosest(Projectile.Center, 1, 1);
float distanceFromTarget = Projectile.Distance(Main.player[target].Center);
// Explode when within a certain distance of the target.
if (distanceFromTarget <= ExplodeDistance && Projectile.timeLeft > ExplosionDuration)
Projectile.timeLeft = ExplosionDuration;
bool explode = Projectile.timeLeft <= ExplosionDuration;
// Stop immediately if explosion is triggered.
if (explode && Projectile.velocity.Length() > 0f)
Projectile.velocity = Vector2.Zero;
// Reset the frame counter and frameY when explosion is triggered.
if (Projectile.timeLeft == ExplosionDuration)
{
Projectile.frameCounter = 0;
frameY = 0;
}
// Explosion noise when actually exploding.
if (frameY == ExplodeDamageStartFrame && explode && Projectile.localAI[0] == 0f)
{
Projectile.localAI[0] = 1f;
SoundEngine.PlaySound(DeusMine.ExplodeSound, Projectile.Center);
}
Projectile.frameCounter++;
if (Projectile.frameCounter % FrameTimer == 0)
{
CurrentFrame++;
// Non-explosion uses the left side of the sheet, explosion uses the right side of the sheet.
frameX = explode ? 1 : 0;
// Kill the projectile when the explosion animation is done.
if (explode && frameY >= ExplodeFrames)
{
if (Projectile.ai[0] > 0f)
{
if (Projectile.owner == Main.myPlayer)
{
float laserSpeed = 2f;
int type = ModContent.ProjectileType<FoveanatorLaser>();
int damage = (int)Math.Round(Projectile.damage * 0.85);
Vector2 laserVelocity = (Main.player[target].Center - Projectile.Center).SafeNormalize(Vector2.UnitY) * laserSpeed;
Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 16f, laserVelocity, type, damage, 0f, Main.myPlayer);
}
}
Projectile.Kill();
return;
}
}
// Explosion has brighter light.
Color lightColor = Color.Lerp(new Color(25, 25, 128), new Color(100, 25, 128), Main.DiscoR / 255f);
float divisor = explode ? 128f : 255f;
Lighting.AddLight(Projectile.Center, lightColor.R / divisor, lightColor.G / divisor, lightColor.B / divisor);
}
public override bool PreDraw(ref Color lightColor) => false;
public override void PostDraw(Color lightColor)
{
if (Projectile.frameCounter < 5)
return;
lightColor.R = (byte)(255 * Projectile.Opacity);
lightColor.G = (byte)(255 * Projectile.Opacity);
lightColor.B = (byte)(255 * Projectile.Opacity);
Texture2D texture = TextureAssets.Projectile[Type].Value;
Vector2 position = Projectile.Center - Main.screenPosition;
Vector2 origin = texture.Size() / new Vector2(TotalXFrames, TotalYFrames) * 0.5f;
Rectangle frame = texture.Frame(TotalXFrames, TotalYFrames, frameX, frameY);
Main.EntitySpriteDraw(texture, position, frame, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None);
}
public override bool CanHitPlayer(Player target) => Projectile.timeLeft <= ExplosionDuration && frameY >= ExplodeDamageStartFrame;
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplodeDistance, targetHitbox);
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
if (Projectile.timeLeft <= ExplosionDuration)
target.AddBuff(BuffID.Frostburn, 180);
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

-158
View File
@@ -1,158 +0,0 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Boss
{
public class FoveanatorFlamethrower : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Boss";
public override string Texture => "CalamityMod/Projectiles/FireProj";
public static int Lifetime => 180;
public static int Fadetime => 160;
public ref float Time => ref Projectile.ai[0];
public int MistType = -1;
public override void SetDefaults()
{
Projectile.width = Projectile.height = 10;
Projectile.hostile = true;
Projectile.ignoreWater = true;
Projectile.penetrate = -1;
Projectile.MaxUpdates = 3;
Projectile.timeLeft = Lifetime;
CooldownSlot = ImmunityCooldownID.Bosses;
}
public override void AI()
{
Time++;
if (Time < Fadetime && Main.rand.NextBool(6))
{
Vector2 cinderPos = Projectile.Center + Main.rand.NextVector2Circular(60f, 60f) * Utils.Remap(Time, 0f, Lifetime, 0.5f, 1f);
float cinderSize = Utils.GetLerpValue(6f, 12f, Time, true);
Dust cinder = Dust.NewDustDirect(cinderPos, 4, 4, Main.rand.NextBool() ? (int)CalamityDusts.BlueCosmilite : (int)CalamityDusts.PurpleCosmilite, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f);
if (Main.rand.NextBool(3))
{
cinder.scale *= 2f;
cinder.velocity *= 2f;
}
cinder.noGravity = true;
cinder.scale *= cinderSize * 1.2f;
cinder.velocity += Projectile.velocity * Utils.Remap(Time, 0f, Fadetime * 0.75f, 1f, 0.1f) * Utils.Remap(Time, 0f, Fadetime * 0.1f, 0.1f, 1f);
}
if (MistType == -1)
MistType = Main.rand.Next(3);
Color lightColor = Color.Lerp(new Color(50, 50, 255), new Color(200, 50, 255), Main.DiscoR / 255f);
Lighting.AddLight(Projectile.Center, lightColor.R / 255f, lightColor.G / 255f, lightColor.B / 255f);
}
// Keeping the flames in place when hitting a block
public override bool OnTileCollide(Vector2 oldVelocity)
{
Projectile.velocity = oldVelocity * 0.95f;
Projectile.position -= Projectile.velocity;
Time++;
Projectile.timeLeft--;
return false;
}
// Cannot hit the player if fading out
public override bool CanHitPlayer(Player target) => Time <= Fadetime;
// Expanding hitbox
public override void ModifyDamageHitbox(ref Rectangle hitbox)
{
int size = (int)Utils.Remap(Time, 0f, Fadetime, 8f, 32f);
// Shrinks again after fading
if (Time > Fadetime)
size = (int)Utils.Remap(Time, Fadetime, Lifetime, 32f, 0f);
hitbox.Inflate(size, size);
}
// Anti-wall hacking checks
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => projHitbox.Intersects(targetHitbox) && Collision.CanHit(Projectile.Center, 0, 0, targetHitbox.Center.ToVector2(), 0, 0) ? null : false;
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
if (info.Damage <= 0)
return;
target.AddBuff(BuffID.Frostburn, 300);
// Cook you up (still scales with player size in case it's manipulated)
int smokeCount = 4 + (int)MathHelper.Clamp(target.width * 0.1f, 0f, 20f);
for (int i = 0; i < smokeCount; i++)
{
Vector2 smokePos = target.Center + Main.rand.NextVector2Circular(target.width * 0.5f, target.height * 0.5f);
Vector2 smokeVel = Vector2.UnitY * Main.rand.NextFloat(-2.4f, -0.8f) * MathHelper.Clamp(target.height * 0.1f, 1f, 10f);
Particle smoke = new MediumMistParticle(smokePos, smokeVel, Color.Lerp(new Color(50, 50, 255), new Color(200, 50, 255), Main.DiscoR / 255f), Color.DarkMagenta, Main.rand.NextFloat(1f, 2f), 245 - Main.rand.Next(50), 0.1f);
GeneralParticleHandler.SpawnParticle(smoke);
}
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D fire = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
Texture2D mist = ModContent.Request<Texture2D>("CalamityMod/Particles/MediumMist").Value;
// The conga line of colors to sift through
Color color1 = new Color(50, 50, 255, 200);
Color color2 = new Color(50, 0, 225, 70);
Color color3 = new Color(200, 50, 255, 100);
Color color4 = new Color(150, 15, 85, 100);
float length = ((Time > Fadetime - 10f) ? 0.1f : 0.15f);
float vOffset = Math.Min(Time, 20f);
float timeRatio = Utils.GetLerpValue(0f, Lifetime, Time);
float fireSize = Utils.Remap(timeRatio, 0.2f, 0.5f, 0.25f, 1f);
if (timeRatio >= 1f)
return false;
for (float j = 1f; j >= 0f; j -= length)
{
// Color
Color fireColor = ((timeRatio < 0.1f) ? Color.Lerp(Color.Transparent, color1, Utils.GetLerpValue(0f, 0.1f, timeRatio)) :
((timeRatio < 0.2f) ? Color.Lerp(color1, color2, Utils.GetLerpValue(0.1f, 0.2f, timeRatio)) :
((timeRatio < 0.35f) ? color2 :
((timeRatio < 0.7f) ? Color.Lerp(color2, color3, Utils.GetLerpValue(0.35f, 0.7f, timeRatio)) :
((timeRatio < 0.85f) ? Color.Lerp(color3, color4, Utils.GetLerpValue(0.7f, 0.85f, timeRatio)) :
Color.Lerp(color4, Color.Transparent, Utils.GetLerpValue(0.85f, 1f, timeRatio)))))));
fireColor *= (1f - j) * Utils.GetLerpValue(0f, 0.2f, timeRatio, true);
Color innerColor = Color.Lerp(fireColor, Color.Black, 0.3f);
// Positions and rotations
Vector2 firePos = Projectile.Center - Main.screenPosition - Projectile.velocity * vOffset * j;
float mainRot = -j * MathHelper.PiOver2 - Main.GlobalTimeWrappedHourly * (j + 1f) * 2f / length;
float trailRot = MathHelper.PiOver4 - mainRot;
// Draw one backtrail
Vector2 trailOffset = Projectile.velocity * vOffset * length * 0.5f;
Main.EntitySpriteDraw(fire, firePos - trailOffset, null, innerColor * 0.25f, trailRot, fire.Size() * 0.5f, fireSize, SpriteEffects.None);
// Draw the main fire
Main.EntitySpriteDraw(fire, firePos, null, innerColor, mainRot, fire.Size() * 0.5f, fireSize, SpriteEffects.None);
// Draw the masking smoke
Main.spriteBatch.SetBlendState(BlendState.Additive);
Rectangle frame = mist.Frame(1, 3, 0, MistType);
Main.EntitySpriteDraw(mist, firePos, frame, Color.Lerp(fireColor, Color.White, 0.3f), mainRot, frame.Size() * 0.5f, fireSize, SpriteEffects.None);
Main.EntitySpriteDraw(mist, firePos, frame, fireColor, mainRot, frame.Size() * 0.5f, fireSize * 3f, SpriteEffects.None);
Main.spriteBatch.SetBlendState(BlendState.AlphaBlend);
}
return false;
}
}
}
-101
View File
@@ -1,101 +0,0 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.NPCs.TownNPCs;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Boss
{
public class FoveanatorLaser : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Boss";
private const int FadeOutTime = 30;
private const float Acceleration = 1.05f;
private const float MaxVelocity = 24f;
public override void SetStaticDefaults()
{
Main.projFrames[Type] = 4;
ProjectileID.Sets.TrailCacheLength[Type] = 2;
ProjectileID.Sets.TrailingMode[Type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 16;
Projectile.hostile = true;
Projectile.ignoreWater = true;
Projectile.Opacity = 0f;
Projectile.penetrate = -1;
Projectile.timeLeft = 300;
}
public override void AI()
{
Projectile.frameCounter++;
if (Projectile.frameCounter > 4)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame > 3)
Projectile.frame = 0;
if (Projectile.velocity.Length() < MaxVelocity)
{
Projectile.velocity *= Acceleration;
if (Projectile.velocity.Length() > MaxVelocity)
{
Projectile.velocity.Normalize();
Projectile.velocity *= MaxVelocity;
}
}
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
Color lightColor = Color.Lerp(new Color(25, 25, 128), new Color(100, 25, 128), Main.DiscoR / 255f);
Lighting.AddLight(Projectile.Center, lightColor.R / 255f, lightColor.G / 255f, lightColor.B / 255f);
if (Projectile.timeLeft < FadeOutTime)
{
Projectile.Opacity -= 1f / FadeOutTime;
}
else if (Projectile.Opacity < 1f)
{
Projectile.Opacity += 0.25f;
if (Projectile.Opacity > 1f)
Projectile.Opacity = 1f;
}
}
public override bool PreDraw(ref Color lightColor)
{
lightColor.R = (byte)(255 * Projectile.Opacity);
lightColor.G = (byte)(255 * Projectile.Opacity);
lightColor.B = (byte)(255 * Projectile.Opacity);
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1);
return false;
}
public override bool CanHitPlayer(Player target) => Projectile.timeLeft >= FadeOutTime;
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
if (Projectile.timeLeft >= FadeOutTime)
target.AddBuff(BuffID.Frostburn, 90);
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
Collision.HitTiles(Projectile.Center, Projectile.velocity, Projectile.width, Projectile.height);
SoundEngine.PlaySound(SoundID.Item10, Projectile.position);
return true;
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 605 B

@@ -69,7 +69,6 @@ namespace CalamityMod.Systems.Collections
{ NPCID.Spazmatism, 150000 }, // 30 seconds
{ NPCID.Retinazer, 125000 },
{ NPCType<Foveanator>(), 137500 },
{ NPCID.TheDestroyer, 600000 }, // 30 seconds + immunity timer at start
{ NPCID.TheDestroyerBody, 600000 },
@@ -59,7 +59,6 @@ namespace CalamityMod.Systems.Collections
NPCID.Probe,
NPCID.Retinazer,
NPCID.Spazmatism,
NPCType<Foveanator>(),
NPCID.SkeletronPrime,
NPCType<SkeletronPrime2>(),
NPCID.PrimeCannon,