create-config-file #16
4 changed files with 107 additions and 17 deletions
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().
commit
4b382e7fad
88
JotunnModStub/Furling/FurlingConfig.cs
Normal file
88
JotunnModStub/Furling/FurlingConfig.cs
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
using BepInEx.Configuration;
|
||||
|
||||
namespace RacesOfValheim
|
||||
{
|
||||
/// <summary>
|
||||
/// Every tunable number behind the Furling's abilities, bound as BepInEx ConfigEntry so they
|
||||
/// show up in Configuration Manager without touching code - see
|
||||
/// CONFIGURATION-MANAGER-HOWTO.md. Bound once, from RacesOfValheim.Awake(). One section per
|
||||
/// topic (matches the other races' layout).
|
||||
///
|
||||
/// No keybinds section: every Furling ability is passive, triggered automatically by tier,
|
||||
/// biome, or combat events rather than a key press - unlike every other race so far.
|
||||
///
|
||||
/// Tier-gate thresholds (which progression state unlocks each ability) are left as-is, same
|
||||
/// boundary drawn for every other race's progression table - not exposed here. "Dance of the
|
||||
/// Dead" (tier 4+, doubles alchemy/ammo craft yield) has no numeric knob either: it works by
|
||||
/// crafting a second copy of the output rather than multiplying a configurable amount, so
|
||||
/// there is nothing here to bind.
|
||||
/// </summary>
|
||||
public static class FurlingConfig
|
||||
{
|
||||
// ─── Passive combat (always active, no tier gate) ────────────────────
|
||||
public static ConfigEntry<float> RunSpeedBonus;
|
||||
public static ConfigEntry<float> WeaponSkillXPMultiplier;
|
||||
public static ConfigEntry<float> IgniteOnHitMinFireDamage;
|
||||
|
||||
// ─── Master of Shadows (tier 2+) ──────────────────────────────────────
|
||||
public static ConfigEntry<float> StealthNoiseRangeThreshold;
|
||||
|
||||
// ─── The Wickerman (tier 3+) ───────────────────────────────────────────
|
||||
public static ConfigEntry<float> WickermanFireResistMultiplier;
|
||||
public static ConfigEntry<float> PoisonResistMultiplier;
|
||||
public static ConfigEntry<float> FireArrowMinDamage;
|
||||
|
||||
// ─── Grave Robber (tier 5+) ────────────────────────────────────────────
|
||||
public static ConfigEntry<float> TrophyDropMultiplier;
|
||||
public static ConfigEntry<float> TrophyDoublingRadius;
|
||||
public static ConfigEntry<int> CoinsPerStarMin;
|
||||
public static ConfigEntry<int> CoinsPerStarMax;
|
||||
|
||||
// ─── The King is Dead (tier 6+) ───────────────────────────────────────
|
||||
public static ConfigEntry<float> PlainsSkillXPMultiplier;
|
||||
|
||||
// ─── In the Mist (tier 7+) ─────────────────────────────────────────────
|
||||
public static ConfigEntry<float> EitrFoodDigestionSlowdown;
|
||||
|
||||
public static void Bind(ConfigFile config)
|
||||
{
|
||||
const string combat = "Furling - Passive Combat";
|
||||
RunSpeedBonus = config.Bind(combat, "Run Speed Bonus", 0.1f,
|
||||
new ConfigDescription("Move speed multiplier bonus, always active.", new AcceptableValueRange<float>(0f, 1f)));
|
||||
WeaponSkillXPMultiplier = config.Bind(combat, "Weapon Skill XP Multiplier", 2f,
|
||||
new ConfigDescription("Multiplies XP gain for every weapon skill, always active.", new AcceptableValueRange<float>(0.5f, 5f)));
|
||||
IgniteOnHitMinFireDamage = config.Bind(combat, "Ignite On Hit Min Fire Damage", 10f,
|
||||
new ConfigDescription("Minimum fire damage added to a physical hit, tier 8+ (Through Fire and Flames).", new AcceptableValueRange<float>(0f, 100f)));
|
||||
|
||||
const string shadows = "Furling - Master of Shadows";
|
||||
StealthNoiseRangeThreshold = config.Bind(shadows, "Noise Range Threshold", 15f,
|
||||
new ConfigDescription("Noise events at or below this range are suppressed entirely, tier 2+.", new AcceptableValueRange<float>(0f, 50f)));
|
||||
|
||||
const string wickerman = "Furling - The Wickerman";
|
||||
WickermanFireResistMultiplier = config.Bind(wickerman, "Fire Resist Multiplier", 0.5f,
|
||||
new ConfigDescription("Multiplies incoming fire damage, tier 3+ (full immunity replaces this at tier 8+).", new AcceptableValueRange<float>(0f, 1f)));
|
||||
PoisonResistMultiplier = config.Bind(wickerman, "Poison Resist Multiplier", 0.5f,
|
||||
new ConfigDescription("Multiplies incoming poison damage, tier 3+ and tier 8+.", new AcceptableValueRange<float>(0f, 1f)));
|
||||
FireArrowMinDamage = config.Bind(wickerman, "Fire Arrow Min Damage", 22f,
|
||||
new ConfigDescription("Minimum fire damage added to bow attacks, tier 3+.", new AcceptableValueRange<float>(0f, 100f)));
|
||||
|
||||
const string graveRobber = "Furling - Grave Robber";
|
||||
TrophyDropMultiplier = config.Bind(graveRobber, "Trophy Drop Multiplier", 2f,
|
||||
new ConfigDescription("Multiplies trophy drop counts from non-boss kills within range, tier 5+.", new AcceptableValueRange<float>(1f, 5f)));
|
||||
TrophyDoublingRadius = config.Bind(graveRobber, "Trophy Doubling Radius", 25f,
|
||||
new ConfigDescription("Meters from the player a kill must be within for its trophy drops to be doubled.", new AcceptableValueRange<float>(1f, 100f)));
|
||||
CoinsPerStarMin = config.Bind(graveRobber, "Coins Per Star Min", 1,
|
||||
new ConfigDescription("Minimum bonus coins dropped, per star the kill had.", new AcceptableValueRange<int>(0, 50)));
|
||||
CoinsPerStarMax = config.Bind(graveRobber, "Coins Per Star Max", 25,
|
||||
new ConfigDescription("Maximum bonus coins dropped, per star the kill had.", new AcceptableValueRange<int>(0, 100)));
|
||||
|
||||
const string kingIsDead = "Furling - The King Is Dead";
|
||||
PlainsSkillXPMultiplier = config.Bind(kingIsDead, "Plains Skill XP Multiplier", 2f,
|
||||
new ConfigDescription("Multiplies XP gain for every skill while standing in the Plains biome, tier 6+.", new AcceptableValueRange<float>(0.5f, 5f)));
|
||||
|
||||
const string mist = "Furling - In the Mist";
|
||||
EitrFoodDigestionSlowdown = config.Bind(mist, "Eitr Food Digestion Slowdown", 0.5f,
|
||||
new ConfigDescription("Fraction of normal speed at which eitr (blue) food is consumed, tier 7+ (0.5 = lasts twice as long).", new AcceptableValueRange<float>(0.1f, 1f)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -136,7 +136,7 @@ namespace RacesOfValheim
|
|||
hit.m_damage.m_pierce > 0 || hit.m_damage.m_chop > 0 ||
|
||||
hit.m_damage.m_pickaxe > 0)
|
||||
{
|
||||
hit.m_damage.m_fire = Mathf.Max(hit.m_damage.m_fire, 10f);
|
||||
hit.m_damage.m_fire = Mathf.Max(hit.m_damage.m_fire, FurlingConfig.IgniteOnHitMinFireDamage.Value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ namespace RacesOfValheim
|
|||
DraughConfig.Bind(Config);
|
||||
DvergarConfigManagement.Bind(Config);
|
||||
FenrirConfig.Bind(Config);
|
||||
FurlingConfig.Bind(Config);
|
||||
SkadiConfig.Bind(Config);
|
||||
harmony.PatchAll();
|
||||
gameObject.AddComponent<FenrirRace>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue