From ab0a21244da542c6249a41a71b49873a10b93d1b Mon Sep 17 00:00:00 2001 From: kanym Date: Mon, 26 Oct 2026 13:54:44 +0100 Subject: [PATCH] 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. --- JotunnModStub/Aswid/AswidConfig.cs | 16 ++++++++++++ JotunnModStub/Aswid/AswidPatches.cs | 25 +++++++++++++++++-- JotunnModStub/Aswid/AswidRace.cs | 6 +++++ JotunnModStub/Package/README.md | 2 +- JotunnModStub/README.md | 2 +- JotunnModStub/RaceCompendium.cs | 4 +++ JotunnModStub/Skeleton/SkeletonPatches.cs | 3 ++- .../Translations/English/compendium.json | 1 + .../Translations/Italian/compendium.json | 1 + .../Translations/Russian/compendium.json | 1 + 10 files changed, 56 insertions(+), 5 deletions(-) diff --git a/JotunnModStub/Aswid/AswidConfig.cs b/JotunnModStub/Aswid/AswidConfig.cs index da24f9d..093706a 100644 --- a/JotunnModStub/Aswid/AswidConfig.cs +++ b/JotunnModStub/Aswid/AswidConfig.cs @@ -33,6 +33,14 @@ namespace RacesOfValheim public static ConfigEntry BloodMagicSkillGainMultiplier; public static ConfigEntry 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 BaseStaminaBonus; + public static ConfigEntry StaminaBonusPerState; + public static ConfigEntry 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(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(0f, 300f))); + StaminaBonusPerState = config.Bind(stamina, "Stamina Bonus Per State", 10f, + new ConfigDescription("Max stamina added per progression state (8 at Fader).", new AcceptableValueRange(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(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.")); diff --git a/JotunnModStub/Aswid/AswidPatches.cs b/JotunnModStub/Aswid/AswidPatches.cs index 6f4be0a..e413174 100644 --- a/JotunnModStub/Aswid/AswidPatches.cs +++ b/JotunnModStub/Aswid/AswidPatches.cs @@ -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()); + } + } + + /// + /// 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. + /// + [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; } } diff --git a/JotunnModStub/Aswid/AswidRace.cs b/JotunnModStub/Aswid/AswidRace.cs index fb949a3..26bc9be 100644 --- a/JotunnModStub/Aswid/AswidRace.cs +++ b/JotunnModStub/Aswid/AswidRace.cs @@ -1344,6 +1344,12 @@ namespace RacesOfValheim } } + /// Max stamina the race adds on top of food, at the given progression state. + public static float GetStaminaBonus(int state) + { + return AswidConfig.BaseStaminaBonus.Value + AswidConfig.StaminaBonusPerState.Value * state; + } + public static bool IsAswid() { return Player.m_localPlayer != null && diff --git a/JotunnModStub/Package/README.md b/JotunnModStub/Package/README.md index 80f442f..1fb44ec 100644 --- a/JotunnModStub/Package/README.md +++ b/JotunnModStub/Package/README.md @@ -23,7 +23,7 @@ This mod currently introduces 4 custom races: - **Blood Magic**: Block to channel a life-draining aura that saps the life of enemies in an area around you (doubled radius at night). - **Blood Magic Mastery**: You can cast Blood Magic items with infinite Eitr, relying purely on their health costs. - **Night Prowler**: Your passive speed and jump bonuses double during the night. -- **Undead Vigor**: Like the skeleton, the Aswid has infinite stamina. You consume the lifeforce of fallen foes directly instead of eating standard food. +- **Undead Vigor**: The Aswid has a large stamina pool that grows with every boss, on top of its food. You consume the lifeforce of fallen foes directly instead of eating standard food. ## Installation (manual) 1. Install BepInExPack Valheim. diff --git a/JotunnModStub/README.md b/JotunnModStub/README.md index 343bba3..041b292 100644 --- a/JotunnModStub/README.md +++ b/JotunnModStub/README.md @@ -26,7 +26,7 @@ This mod currently introduces 6 custom races: - **Blood Magic**: Block to channel a life-draining aura that saps the life of enemies in an area around you (doubled radius at night). **Only available while in Bat or Mist form.** - **Blood Magic Mastery**: You can cast Blood Magic items with infinite Eitr, relying purely on their health costs. - **Day walker, Night stalker**: Your passive speed and jump bonuses double during the night. -- **Undead Vigor**: Like the skeleton, the Aswid has infinite stamina. You consume the lifeforce of fallen foes directly instead of eating standard food. +- **Undead Vigor**: The Aswid has a large stamina pool that grows with every boss, on top of its food. You consume the lifeforce of fallen foes directly instead of eating standard food. ### 5. Furling - **Goblin Heritage**: You play as a Goblin (Fuling). No beard, no hair (for males). diff --git a/JotunnModStub/RaceCompendium.cs b/JotunnModStub/RaceCompendium.cs index 6029fa4..9b84f96 100644 --- a/JotunnModStub/RaceCompendium.cs +++ b/JotunnModStub/RaceCompendium.cs @@ -467,6 +467,10 @@ namespace RacesOfValheim sb.AppendLine(ModText.Get("rov_compendium_aswid_benedictus_et_afflictus")); sb.AppendLine(ModText.Get("rov_compendium_aswid_take_no_fall_damage_physical", arm, dmg, spd, lifesteal, (AswidConfig.BloodMagicSkillGainMultiplier.Value).ToString("0.#"))); + sb.AppendLine(ModText.Get("rov_compendium_aswid_undead_vigor", + Mathf.RoundToInt(AswidRace.GetStaminaBonus(state)), + Mathf.RoundToInt(AswidConfig.StaminaBonusPerState.Value), + Mathf.RoundToInt(AswidConfig.StaminaCostMultiplier.Value * 100f))); sb.AppendLine(ModText.Get("rov_compendium_aswid_vampiric_aura_passive_toggle")); sb.AppendLine(ModText.Get("rov_compendium_aswid_always_active_every_form_with", auraRadiusDay, auraRadiusNight, auraExecute)); diff --git a/JotunnModStub/Skeleton/SkeletonPatches.cs b/JotunnModStub/Skeleton/SkeletonPatches.cs index 8bfab05..b5e3e93 100644 --- a/JotunnModStub/Skeleton/SkeletonPatches.cs +++ b/JotunnModStub/Skeleton/SkeletonPatches.cs @@ -62,7 +62,8 @@ namespace RacesOfValheim { public static bool Prefix(Player __instance) { - if ((SkeletonRace.IsSkeleton() || AswidRace.IsAswid() || DraughRace.IsDraugh()) && __instance == Player.m_localPlayer) + // The Aswid used to be on this list. It spends stamina now, see Aswid_UseStamina_Patch. + if ((SkeletonRace.IsSkeleton() || DraughRace.IsDraugh()) && __instance == Player.m_localPlayer) { // Infinite stamina: skip the original UseStamina method return false; diff --git a/JotunnModStub/Translations/English/compendium.json b/JotunnModStub/Translations/English/compendium.json index ccf331e..295b8e7 100644 --- a/JotunnModStub/Translations/English/compendium.json +++ b/JotunnModStub/Translations/English/compendium.json @@ -39,6 +39,7 @@ "rov_compendium_aswid_sense_every_untamed_creature_within": "You sense every untamed creature within $1m, marking it with a telltale glow.\n", "rov_compendium_aswid_superhuman_senses_passive": "[Moder Unlock] Superhuman Senses (Passive):", "rov_compendium_aswid_take_no_fall_damage_physical": "You take no fall damage, and physical kills automatically devour edible enemies (Vae Victis) for Blood Magic XP. Your physical stats scale with every boss you defeat: +$1 Armor, +$2 Damage, +$3% Speed and Jump, and +$4% Lifesteal on physical hits. All of these bonuses double during the night. You can cast Blood Magic items with infinite Eitr, and your Blood Magic skill rises $5x as fast.\n", + "rov_compendium_aswid_undead_vigor": "Undead Vigor: your endurance is unholy but not endless. You carry +$1 Maximum Stamina at your present standing (+$2 for every boss), on top of what your food gives, and every stamina cost lands at $3% of the normal price.\n", "rov_compendium_aswid_tame_u_key_asksvin_join": "[Fader Unlock] Tame ('U' Key): Asksvin join the huntable list.\n", "rov_compendium_aswid_tame_u_key_lox_join": "[Yagluth Unlock] Tame ('U' Key): Lox join the huntable list.\n", "rov_compendium_aswid_tame_u_key_tame_boar": "[Eikthyr Unlock] Tame ('U' Key): Tame a boar under your cursor.\n", diff --git a/JotunnModStub/Translations/Italian/compendium.json b/JotunnModStub/Translations/Italian/compendium.json index 432dc23..f1093dd 100644 --- a/JotunnModStub/Translations/Italian/compendium.json +++ b/JotunnModStub/Translations/Italian/compendium.json @@ -39,6 +39,7 @@ "rov_compendium_aswid_sense_every_untamed_creature_within": "Percepisci ogni creatura non addomesticata entro $1m, e la segni con un bagliore rivelatore.\n", "rov_compendium_aswid_superhuman_senses_passive": "[Sblocco Moder] Sensi sovrumani (passiva):", "rov_compendium_aswid_take_no_fall_damage_physical": "Non subisci danni da caduta, e le uccisioni fisiche divorano automaticamente i nemici commestibili (Vae Victis) dandoti esperienza di Magia del sangue. Le tue statistiche fisiche crescono con ogni boss sconfitto: +$1 armatura, +$2 danni, +$3% velocità e salto, +$4% furto di vita sui colpi fisici. Di notte tutti questi bonus raddoppiano. Puoi usare gli oggetti di Magia del sangue con eitr infinito, e la tua abilità di Magia del sangue sale $5 volte più in fretta.\n", + "rov_compendium_aswid_undead_vigor": "Vigore non morto: la tua resistenza è empia, ma non infinita. Al tuo livello attuale hai +$1 stamina massima (+$2 per ogni boss), oltre a quella che ti dà il cibo, e ogni costo di stamina ti pesa il $3% del normale.\n", "rov_compendium_aswid_tame_u_key_asksvin_join": "[Sblocco Fader] Addomesticare (tasto 'U'): gli asksvin si aggiungono alle prede.\n", "rov_compendium_aswid_tame_u_key_lox_join": "[Sblocco Yagluth] Addomesticare (tasto 'U'): i lox si aggiungono alle prede.\n", "rov_compendium_aswid_tame_u_key_tame_boar": "[Sblocco Eikthyr] Addomesticare (tasto 'U'): addomestica il cinghiale sotto il cursore.\n", diff --git a/JotunnModStub/Translations/Russian/compendium.json b/JotunnModStub/Translations/Russian/compendium.json index 1eed152..95ee341 100644 --- a/JotunnModStub/Translations/Russian/compendium.json +++ b/JotunnModStub/Translations/Russian/compendium.json @@ -39,6 +39,7 @@ "rov_compendium_aswid_sense_every_untamed_creature_within": "Вы чувствуете любое неприрученное существо в радиусе $1 м, подсвечивая его характерным свечением.\n", "rov_compendium_aswid_superhuman_senses_passive": "[Награда: Матерь] Сверхчеловеческие чувства (Пассивное):", "rov_compendium_aswid_take_no_fall_damage_physical": "Вы не получаете урона от падения, а убийства в ближнем бою автоматически пожирают съедобных врагов (Vae Victis), принося опыт магии крови. Ваши физические характеристики растут с каждым убитым боссом: +$1 к броне, +$2 к урону, +$3% к скорости и прыжку, и +$4% вампиризма при физ. атаках. Все эти бонусы удваиваются ночью. Вы можете использовать предметы магии крови с бесконечным эйтром, а навык «Магия крови» растет в $5 раз быстрее.\n", + "rov_compendium_aswid_undead_vigor": "Неживая стойкость: ваша выносливость нечестива, но не бесконечна. На текущем этапе у вас +$1 к максимальной выносливости (+$2 за каждого босса) сверх той, что дает еда, а любые траты выносливости составляют $3% от обычных.\n", "rov_compendium_aswid_tame_u_key_asksvin_join": "[Награда: Прародитель] Приручение (клавиша «U»): Пеплозавры добавляются в список доступных для приручения.\n", "rov_compendium_aswid_tame_u_key_lox_join": "[Награда: Яглут] Приручение (клавиша «U»): Быкоящеры добавляются в список доступных для приручения.\n", "rov_compendium_aswid_tame_u_key_tame_boar": "[Награда: Эйктюр] Приручение (клавиша «U»): Мгновенно приручает кабана под прицелом.\n",