feat(aswid): make abilities and special attacks BepInEx-configurable

Adds AswidConfig.cs, following the SkadiConfig pattern: one Configuration
Manager section per topic (Keybinds, Passive Combat, Vampiric Aura,
Superhuman Senses, Eclipse, Devour, Domination), covering every tunable
number and all five ability keybinds (Bat Form, Mist Form, Eclipse, Tame,
Toggle Devour). Defaults match the previous hardcoded constants exactly.

Also fixes a real mismatch found along the way: the tame hover-text
hardcoded "[K] Tame" while the key that actually triggered taming was U.
Both now read the same configured Tame key, so the hint stays correct if
it's rebound.

Config sections are bound alphabetically by race (Aswid before Skadi) in
RacesOfValheim.Awake(), since Configuration Manager's category list
follows bind order.
This commit is contained in:
kanym 2026-08-06 13:33:39 +02:00
commit 629a534bc3
6 changed files with 178 additions and 37 deletions

View file

@ -177,8 +177,8 @@ namespace RacesOfValheim
if (__instance == Player.m_localPlayer && AswidRace.IsAswid())
{
int state = BossProgressionManager.GetCurrentProgressionState();
float multiplier = (EnvMan.instance != null && EnvMan.IsNight()) ? 2f : 1f;
__result += 1f * state * multiplier;
float multiplier = (EnvMan.instance != null && EnvMan.IsNight()) ? AswidConfig.NightMultiplier.Value : 1f;
__result += AswidConfig.ArmorBonusPerState.Value * state * multiplier;
}
}
}
@ -203,8 +203,8 @@ namespace RacesOfValheim
int state = BossProgressionManager.GetCurrentProgressionState();
if (state > 0)
{
float multiplier = (EnvMan.instance != null && EnvMan.IsNight()) ? 2f : 1f;
float bonus = 2f * state * multiplier;
float multiplier = (EnvMan.instance != null && EnvMan.IsNight()) ? AswidConfig.NightMultiplier.Value : 1f;
float bonus = AswidConfig.DamageBonusPerState.Value * state * multiplier;
// Add flat bonus to physical damage types that the weapon already has
if (__result.m_slash > 0) __result.m_slash += bonus;
@ -463,7 +463,11 @@ namespace RacesOfValheim
if (canTame)
{
__result += "\n[<color=yellow><b>K</b></color>] Tame";
// Used to hardcode "[K] Tame" while AswidRace.Update actually checked U (now
// AswidConfig.TameKey) - the hint never matched the working key, and would have
// gone stale again the moment that key was rebound. MainKey.ToString() reads back
// whatever is actually bound.
__result += $"\n[<color=yellow><b>{AswidConfig.TameKey.Value.MainKey}</b></color>] Tame";
}
}
}
@ -525,7 +529,7 @@ namespace RacesOfValheim
ZNetView nview = __instance.GetComponent<ZNetView>();
if (nview != null && nview.IsValid() && nview.GetZDO().GetString("RacesOfValheim_Race", "Human") == "Aswid")
{
if (__instance == Player.m_localPlayer && RaceInput.Allowed && Input.GetKeyDown(KeyCode.I))
if (__instance == Player.m_localPlayer && RaceInput.Allowed && AswidConfig.ToggleDevourKey.Value.IsDown())
{
AswidRace.DevourEnabled = !AswidRace.DevourEnabled;
string msg = AswidRace.DevourEnabled ? "Devour Ability: ENABLED" : "Devour Ability: DISABLED";
@ -647,7 +651,7 @@ namespace RacesOfValheim
float lifesteal = rules.LifestealPercent;
if (EnvMan.instance != null && EnvMan.IsNight())
{
lifesteal *= 2f;
lifesteal *= AswidConfig.NightMultiplier.Value;
}
if (lifesteal > 0f)
{
@ -738,7 +742,7 @@ namespace RacesOfValheim
{
if (skillType == Skills.SkillType.BloodMagic)
{
factor *= 2f; // Benedictus et Afflictus: Double speed for Blood Magic
factor *= AswidConfig.BloodMagicSkillGainMultiplier.Value; // Benedictus et Afflictus
}
}
}