feat(aswid): replace infinite stamina with a boss-scaled pool

The Aswid shared the Skeleton's UseStamina skip, so stamina mods, foods
and skills did nothing for it. It now spends stamina, scaled by a cost
multiplier, and gets +25 max stamina plus 10 per boss added on top of its
food. The stamina bar shows again. Draugh and Skeleton are unchanged.
This commit is contained in:
kanym 2026-10-26 13:54:44 +01:00
commit ab0a21244d
10 changed files with 56 additions and 5 deletions

View file

@ -497,7 +497,7 @@ namespace RacesOfValheim
{
public static bool Prefix(Hud __instance, Player player)
{
if (player == Player.m_localPlayer && (AswidRace.IsAswid() || DraughRace.IsDraugh()))
if (player == Player.m_localPlayer && DraughRace.IsDraugh())
{
if (__instance.m_staminaBar2Root != null && __instance.m_staminaBar2Root.gameObject.activeSelf)
{
@ -507,7 +507,8 @@ namespace RacesOfValheim
}
// Vanilla switches the bar on once, when the HUD is built, and never again. Without
// this a player who left the Aswid or the Draugh had no stamina bar until relog.
// this a player who left the Draugh had no stamina bar until relog - and an Aswid
// updating from a version that still hid it would have none either.
if (player == Player.m_localPlayer && __instance.m_staminaBar2Root != null
&& !__instance.m_staminaBar2Root.gameObject.activeSelf)
{
@ -820,6 +821,26 @@ namespace RacesOfValheim
stamina += extraFood.m_stamina;
eitr += extraFood.m_eitr;
}
// Added on top of whatever vanilla and other mods put here, never assigned: a mod that
// raises max stamina has to keep raising it for an Aswid too.
stamina += AswidRace.GetStaminaBonus(BossProgressionManager.GetCurrentProgressionState());
}
}
/// <summary>
/// The Aswid's stamina. It used to be infinite: the Skeleton's UseStamina skip covered the
/// Aswid too, which made every stamina mod, food and skill meaningless for the race (the Discord
/// reports that started the rebalance). The cost is now scaled rather than skipped, so the
/// call still reaches vanilla - and any other mod patching it - with a smaller number.
/// </summary>
[HarmonyPatch(typeof(Player), "UseStamina")]
public static class Aswid_UseStamina_Patch
{
public static void Prefix(Player __instance, ref float v)
{
if (__instance != Player.m_localPlayer || !AswidRace.IsAswid()) return;
v *= AswidConfig.StaminaCostMultiplier.Value;
}
}