Fixed Rev+ Moon Lord vanilla boss bar having health issues with eyes
This commit is contained in:
1 parent
e24e937869
commit
f155f74779
5 files changed
+91
-5
No files matched your search
@@ -166,7 +166,7 @@ FathomSwarmerVisage: {
|
||||
{$CommonItemTooltip.IncreasesMaxMinionsBy}
|
||||
{$CommonItemTooltip.PercentIncreasedSummonDamage@1}
|
||||
Provides breathing and light underwater
|
||||
Greatly enhances visibility in the abyss
|
||||
Greatly enhances visibility in the abyss
|
||||
'''
|
||||
SetBonus:
|
||||
'''
|
||||
@@ -446,7 +446,7 @@ ReaverHeadExplore: {
|
||||
'''
|
||||
Emits light and shows the location of treasure and ore
|
||||
{$Common.AggroReduction} and grants underwater breathing
|
||||
Greatly enhances visibility in the abyss
|
||||
Greatly enhances visibility in the abyss
|
||||
Increased block placement & tool range by {0}
|
||||
Increases pickup range for items
|
||||
'''
|
||||
|
||||
@@ -175,7 +175,7 @@ RustedJingleBell: {
|
||||
'''
|
||||
Summons a baby ghost bell to light the way for you
|
||||
Provides a moderate amount of light while underwater
|
||||
{$Common.AbyssLightLevel}
|
||||
{$Common.AbyssLightLevel}
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ StrangeOrb: {
|
||||
'''
|
||||
Summons a miniature Ocean Spirit light pet
|
||||
Provides a large amount of light while underwater
|
||||
{$Common.AbyssLightLevel}
|
||||
{$Common.AbyssLightLevel}
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ using Terraria.GameContent;
|
||||
using Terraria.GameContent.Achievements;
|
||||
using Terraria.GameContent.Bestiary;
|
||||
using Terraria.GameContent.Events;
|
||||
using Terraria.GameContent.UI.BigProgressBar;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -1235,9 +1236,13 @@ namespace CalamityMod.NPCs
|
||||
|
||||
VulnerabilitiesAndResistances(npc);
|
||||
|
||||
//Gives Brain of Cthulhu a unique boss bar in Rev+ where Creepers contribute to a Shield rather than additional Health
|
||||
// Gives Brain of Cthulhu a unique boss bar in Rev+ where Creepers contribute to a Shield rather than additional Health
|
||||
if (npc.type == NPCID.BrainofCthulhu && CalamityWorld.revenge)
|
||||
npc.BossBar = GetInstance<RevBrainOfCthulhuBossBar>();
|
||||
// Replaces Moon Lord's boss bar in Rev+ to fix a health counting bug with the eyes after being killed
|
||||
bool hasBar = Main.BigBossProgressBar.TryGetSpecialVanillaBossBar(npc.type, out IBigProgressBar bar);
|
||||
if (hasBar && bar is MoonLordProgressBar && CalamityWorld.revenge)
|
||||
npc.BossBar = GetInstance<RevMoonLordBossBar>();
|
||||
}
|
||||
|
||||
public override bool? CanFallThroughPlatforms(NPC npc)
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.GameContent.UI.BigProgressBar;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.UI.VanillaBossBars
|
||||
{
|
||||
internal class RevMoonLordBossBar : ModBossBar
|
||||
{
|
||||
private List<int> MoonLordPartIDs = [NPCID.MoonLordCore, NPCID.MoonLordHead, NPCID.MoonLordHand];
|
||||
private NPC _dummy;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
_dummy = new NPC();
|
||||
}
|
||||
public override Asset<Texture2D> GetIconTexture(ref Rectangle? iconFrame) => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[NPCID.MoonLordHead]];
|
||||
|
||||
public override bool? ModifyInfo(ref BigProgressBarInfo info, ref float life, ref float lifeMax, ref float shield, ref float shieldMax)
|
||||
{
|
||||
NPC target = Main.npc[info.npcIndexToAimAt];
|
||||
if ((!target.active || InBadAI(target)) && !TryFindingAnotherMoonLordPiece(ref info))
|
||||
return false;
|
||||
|
||||
life = 0f;
|
||||
lifeMax = 0f;
|
||||
shield = 0f;
|
||||
shieldMax = 0f;
|
||||
|
||||
NPCSpawnParams dummy = default;
|
||||
dummy.strengthMultiplierOverride = target.strengthMultiplier;
|
||||
dummy.playerCountForMultiplayerDifficultyOverride = target.statsAreScaledForThisManyPlayers;
|
||||
_dummy.SetDefaults(NPCID.MoonLordCore, dummy);
|
||||
lifeMax += _dummy.lifeMax;
|
||||
_dummy.SetDefaults(NPCID.MoonLordHead, dummy);
|
||||
lifeMax += _dummy.lifeMax;
|
||||
_dummy.SetDefaults(NPCID.MoonLordHand, dummy);
|
||||
lifeMax += _dummy.lifeMax * 2;
|
||||
|
||||
// Find all the Moon Lord parts, and add their totals. Do not add them if in a "bad AI" state.
|
||||
foreach (NPC n in Main.ActiveNPCs)
|
||||
{
|
||||
if (MoonLordPartIDs.Contains(n.type) && !InBadAI(n))
|
||||
{
|
||||
life += n.life;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool InBadAI(NPC n)
|
||||
{
|
||||
// If in death animation, or in initial startup state
|
||||
if (n.type == NPCID.MoonLordCore && (n.ai[0] == 2f || n.ai[0] == -1f || n.localAI[3] == 0f))
|
||||
return true;
|
||||
// If in death animation, or this eye has been "killed"
|
||||
if (n.ai[0] == -2f || n.ai[0] == -3f || n.Calamity().newAI[0] == 1f)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool TryFindingAnotherMoonLordPiece(ref BigProgressBarInfo info)
|
||||
{
|
||||
foreach (NPC n in Main.ActiveNPCs)
|
||||
{
|
||||
if (MoonLordPartIDs.Contains(n.type) && !InBadAI(n))
|
||||
{
|
||||
info.npcIndexToAimAt = n.whoAmI;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user