boss hp config and healthbar closure modcalls

This commit is contained in:
GinYuH committed 2023-10-06 17:41:09 -07:00
1 parent 0b5b6eb1d3
commit 3ec922c111
1 file changed
+33
+33
View File
@@ -1669,6 +1669,9 @@ namespace CalamityMod
public static bool BossHealthBarVisible() => Main.LocalPlayer.Calamity().drawBossHPBar;
public static bool SetBossHealthBarVisible(bool visible) => Main.LocalPlayer.Calamity().drawBossHPBar = visible;
public static bool GetShouldCloseBossHealthBar(NPC npc) => npc?.Calamity()?.ShouldCloseHPBar ?? false;
public static void SetShouldCloseBossHealthBar(NPC npc, bool enabled) => npc.Calamity().ShouldCloseHPBar = enabled;
#endregion
#region Dodge Disabling
@@ -2529,6 +2532,30 @@ namespace CalamityMod
return new ArgumentNullException("ERROR: Must specify a bool.");
return SetBossHealthBarVisible(bossBarEnabled);
case "SetShouldCloseBossHealthBar":
{
if (args.Length < 2)
return new ArgumentNullException("ERROR: Must specify both an NPC and whether or not the NPC's health bar should be closed as a bool.");
if (args.Length < 3)
return new ArgumentNullException("ERROR: Must specify whether or not the NPC's health bar should be closed as a bool.");
if (!(args[2] is float) && !(args[2] is bool))
return new ArgumentException("ERROR: The second argument to \"SetShouldCloseBossHealthBar\" must be a bool.");
if (!isValidNPCArg(args[1]))
return new ArgumentException("ERROR: The first argument to \"SetShouldCloseBossHealthBar\" must be an NPC.");
SetShouldCloseBossHealthBar(castNPC(args[1]), (bool)args[2]);
return null;
}
case "GetShouldCloseBossHealthbar":
{
if (args.Length < 2)
return new ArgumentNullException("ERROR: Must specify an NPC.");
if (!isValidNPCArg(args[1]))
return new ArgumentException("ERROR: The first argument to \"GetShouldCloseBossHealthBar\" must be an NPC.");
return GetShouldCloseBossHealthBar(castNPC(args[1]));
}
case "CanFirePointBlank":
case "CanFirePointBlankShots":
if (args.Length < 2)
@@ -2856,6 +2883,12 @@ namespace CalamityMod
return null;
}
case "BossHealthBoost":
case "GetBossHealthBoost":
case "BossHealthMultiplier":
case "GetBossHealthMultiplier":
return CalamityConfig.Instance.BossHealthBoost;
default:
return new ArgumentException("ERROR: Invalid method name.");
}