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

@ -33,6 +33,14 @@ namespace RacesOfValheim
public static ConfigEntry<float> BloodMagicSkillGainMultiplier;
public static ConfigEntry<float> SurtlingFormDamageBonus;
// ─── Stamina ─────────────────────────────────────────────────────────────
// The race used to have infinite stamina. Now it has a large pool that grows with each
// boss, on top of what its devoured food gives - added, never assigned, so stamina mods
// still stack.
public static ConfigEntry<float> BaseStaminaBonus;
public static ConfigEntry<float> StaminaBonusPerState;
public static ConfigEntry<float> StaminaCostMultiplier;
// ─── Bat Form ────────────────────────────────────────────────────────────
// Both of these undo something vanilla does to any player on the debug-fly flag, which is
// what the bat flies on. See AswidBatAggro for the six vanilla methods involved.
@ -130,6 +138,14 @@ namespace RacesOfValheim
SurtlingFormDamageBonus = config.Bind(combat, "Surtling Form Damage Bonus", 30f,
new ConfigDescription("Flat damage added to every attack once the tier 8 Surtling form is unlocked.", new AcceptableValueRange<float>(0f, 100f)));
const string stamina = "Aswid - Stamina";
BaseStaminaBonus = config.Bind(stamina, "Base Stamina Bonus", 25f,
new ConfigDescription("Max stamina added on top of the game's base 75 and your food, before any boss.", new AcceptableValueRange<float>(0f, 300f)));
StaminaBonusPerState = config.Bind(stamina, "Stamina Bonus Per State", 10f,
new ConfigDescription("Max stamina added per progression state (8 at Fader).", new AcceptableValueRange<float>(0f, 50f)));
StaminaCostMultiplier = config.Bind(stamina, "Stamina Cost Multiplier", 1f,
new ConfigDescription("Multiplies every stamina cost: sprinting, swimming, attacks, blocking. 1 is the normal cost, 0.5 half. There is no infinite setting on purpose; set the bonuses above high instead.", new AcceptableValueRange<float>(0.1f, 2f)));
const string batform = "Aswid - Bat Form";
BatFormAggro = config.Bind(batform, "Monsters Notice The Bat", true,
new ConfigDescription("Lets monsters see, hear and wake up for a player in Bat Form. Vanilla refuses to notice anyone flying on the debug-fly flag, which is the flag the form uses - turn this off to go back to a bat nothing ever looks at."));

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;
}
}

View file

@ -1344,6 +1344,12 @@ namespace RacesOfValheim
}
}
/// <summary>Max stamina the race adds on top of food, at the given progression state.</summary>
public static float GetStaminaBonus(int state)
{
return AswidConfig.BaseStaminaBonus.Value + AswidConfig.StaminaBonusPerState.Value * state;
}
public static bool IsAswid()
{
return Player.m_localPlayer != null &&