feat(furling): make ability numbers BepInEx-configurable

Adds FurlingConfig.cs, following the established per-race pattern: one
Configuration Manager section per tier ability (Passive Combat, Master of
Shadows, The Wickerman, Grave Robber, The King Is Dead, In the Mist). No
keybinds section - every Furling ability is passive, triggered by tier,
biome, or combat events rather than a key press. Defaults match the
previous hardcoded constants exactly.

"Dance of the Dead" (tier 4+) has no numeric knob and stays untouched: it
doubles craft yield by crafting a literal second copy rather than
multiplying a configurable amount.

Also fixes a latent truncation bug found while wiring the trophy drop
multiplier: it was applied as `amount *= 2` (int), which would have
truncated any non-integer multiplier a player configured (e.g. 1.5x
rounding down every time). Now computed as
Mathf.RoundToInt(amount * multiplier).

Config sections stay bound alphabetically by race (Aswid, Draugh,
Dvergar, Fenrir, Furling, Skadi) in RacesOfValheim.Awake().
This commit is contained in:
kanym 2026-08-06 14:25:23 +02:00
commit 4b382e7fad
4 changed files with 107 additions and 17 deletions

View file

@ -42,7 +42,7 @@ namespace RacesOfValheim
{
if (__instance == null || __instance != Player.m_localPlayer) return;
if (!FurlingRace.IsFurling()) return;
__result *= 1.1f;
__result *= 1f + FurlingConfig.RunSpeedBonus.Value;
}
}
@ -323,14 +323,14 @@ namespace RacesOfValheim
if (isWeaponSkill)
{
factor *= 2f;
factor *= FurlingConfig.WeaponSkillXPMultiplier.Value;
}
else if (BossProgressionManager.GetCurrentProgressionState() >= 6)
{
// The King is Dead: in Plains, ALL other skills (including magic) get 2x XP
// The King is Dead: in Plains, ALL other skills (including magic) get bonus XP
if (EnvMan.instance != null && EnvMan.instance.GetCurrentBiome() == Heightmap.Biome.Plains)
{
factor *= 2f;
factor *= FurlingConfig.PlainsSkillXPMultiplier.Value;
}
}
}
@ -347,7 +347,7 @@ namespace RacesOfValheim
// Check if it's nighttime or inside a dungeon
if (BossProgressionManager.GetCurrentProgressionState() >= 2) // Master of Shadows (Eikthyr)
{
if (range <= 15f)
if (range <= FurlingConfig.StealthNoiseRangeThreshold.Value)
{
return false;
}
@ -368,12 +368,12 @@ namespace RacesOfValheim
if (state >= 8) // Through Fire and Flames (Fader): full fire immunity
{
hit.m_damage.m_fire = 0f;
if (hit.m_damage.m_poison > 0) hit.m_damage.m_poison *= 0.5f;
if (hit.m_damage.m_poison > 0) hit.m_damage.m_poison *= FurlingConfig.PoisonResistMultiplier.Value;
}
else if (state >= 3) // The Wickerman: -50% fire and poison
else if (state >= 3) // The Wickerman: reduced fire and poison
{
if (hit.m_damage.m_fire > 0) hit.m_damage.m_fire *= 0.5f;
if (hit.m_damage.m_poison > 0) hit.m_damage.m_poison *= 0.5f;
if (hit.m_damage.m_fire > 0) hit.m_damage.m_fire *= FurlingConfig.WickermanFireResistMultiplier.Value;
if (hit.m_damage.m_poison > 0) hit.m_damage.m_poison *= FurlingConfig.PoisonResistMultiplier.Value;
}
}
}
@ -393,10 +393,11 @@ namespace RacesOfValheim
(ammo != null && ammo.m_shared.m_skillType == Skills.SkillType.Bows))
{
// If the arrow doesn't already have significant fire damage, add it
if (hitData != null && hitData.m_damage.m_fire < 22f)
float minFireDamage = FurlingConfig.FireArrowMinDamage.Value;
if (hitData != null && hitData.m_damage.m_fire < minFireDamage)
{
// Adds fire damage equivalent to a standard fire arrow
hitData.m_damage.m_fire = Mathf.Max(hitData.m_damage.m_fire, 22f);
hitData.m_damage.m_fire = Mathf.Max(hitData.m_damage.m_fire, minFireDamage);
}
}
}
@ -494,7 +495,7 @@ namespace RacesOfValheim
if (character != null && (character.IsBoss() || character.gameObject.name.ToLower().Contains("boss"))) return;
float distance = Vector3.Distance(Player.m_localPlayer.transform.position, __instance.transform.position);
if (distance > 25f) return;
if (distance > FurlingConfig.TrophyDoublingRadius.Value) return;
var newList = new System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<GameObject, int>>();
foreach (var drop in __result)
@ -506,7 +507,7 @@ namespace RacesOfValheim
var itemDrop = go.GetComponent<ItemDrop>();
if (itemDrop != null && itemDrop.m_itemData.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Trophy)
{
amount *= 2;
amount = Mathf.RoundToInt(amount * FurlingConfig.TrophyDropMultiplier.Value);
}
}
newList.Add(new System.Collections.Generic.KeyValuePair<GameObject, int>(go, amount));
@ -519,7 +520,7 @@ namespace RacesOfValheim
GameObject coinsPrefab = Jotunn.Managers.PrefabManager.Cache.GetPrefab<GameObject>("Coins");
if (coinsPrefab != null)
{
int extraCoins = stars * UnityEngine.Random.Range(1, 26);
int extraCoins = stars * UnityEngine.Random.Range(FurlingConfig.CoinsPerStarMin.Value, FurlingConfig.CoinsPerStarMax.Value + 1);
newList.Add(new System.Collections.Generic.KeyValuePair<GameObject, int>(coinsPrefab, extraCoins));
}
}
@ -635,8 +636,8 @@ namespace RacesOfValheim
// Blue food = eitr > 0
if (food.m_item.m_shared.m_foodEitr > 0f)
{
// Give back half of dt that vanilla subtracted
food.m_time += dt * 0.5f;
// Give back the slowed-down fraction of dt that vanilla subtracted
food.m_time += dt * (1f - FurlingConfig.EitrFoodDigestionSlowdown.Value);
// Clamp to max burn time so we don't exceed the original duration
float maxTime = food.m_item.m_shared.m_foodBurnTime;
if (food.m_time > maxTime) food.m_time = maxTime;