RacesOfValheim/JotunnModStub/Trol/TrolConfig.cs
kanym 851247ea60 chore(release): v1.4.0 - Factions, Configuration Manager, Trol log-grab fix
Documents everything that landed on main since 1.3.12 (Factions peace +
merchants, BepInEx Configuration Manager across all nine races, Dvergar/Aswid
eye glow, Skeleton head-visibility and menu-preview fixes) and bumps the
version accordingly.

Also fixes a real bug found while writing this changelog: Trol's True Form
log-grab was piggybacked on pressing the True Form key a second time, with no
on-screen hint it existed. It now has its own keybind (default E, configurable
like every other race's keys) and a proper crosshair prompt patched onto
vanilla's own HoverText component - the first attempt added a second,
competing Hoverable component to the log and it was silently never reached,
since Unity's GetComponentInParent<Hoverable>() only returns the first match
and vanilla's own HoverText was already on the object.
2026-08-07 09:56:16 +02:00

133 lines
10 KiB
C#

using UnityEngine;
using BepInEx.Configuration;
namespace RacesOfValheim
{
/// <summary>
/// Every tunable number and keybind behind the Trol'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 every other race's layout).
///
/// Tier-gate thresholds (which progression state unlocks each perk) are left as-is, same
/// boundary drawn for every other race's progression table - not exposed here.
///
/// True Form's scale (Normal/Advanced) is read from both the local transform routine
/// (TrolRace) and the remote-sizing postfix (TrolPatches) - both now read the same
/// ConfigEntry rather than each carrying its own literal, so a retuned value can no longer
/// make a Trol one size to themselves and another to everyone else.
/// </summary>
public static class TrolConfig
{
// ─── Keybinds ──────────────────────────────────────────────────────────
public static ConfigEntry<KeyboardShortcut> ThrowRockKey;
public static ConfigEntry<KeyboardShortcut> TrueFormKey;
public static ConfigEntry<KeyboardShortcut> GrabLogKey;
// ─── Passive combat ──────────────────────────────────────────────────
public static ConfigEntry<float> FireWeaknessMultiplier;
public static ConfigEntry<float> BonemassMeleeBonus;
public static ConfigEntry<float> YagluthMeleeBonus;
public static ConfigEntry<float> TrueFormMeleeBonus;
public static ConfigEntry<float> RegenMultiplierBonus;
public static ConfigEntry<float> FavoredSkillXPMultiplier;
public static ConfigEntry<float> CarryWeightBonusBase;
public static ConfigEntry<float> CarryWeightBonusBonemass;
public static ConfigEntry<float> CarryWeightBonusYagluth;
public static ConfigEntry<float> ArmorBonusPerState;
// ─── Throw Rock (tier 3+) ─────────────────────────────────────────────
public static ConfigEntry<float> ThrowRockCooldown;
public static ConfigEntry<float> ThrowRockCooldownTrueForm;
public static ConfigEntry<float> ThrowRockBaseDamage;
public static ConfigEntry<float> ThrowRockBonemassBonus;
public static ConfigEntry<float> ThrowRockYagluthBonus;
public static ConfigEntry<float> ThrowRockTrueFormBonus;
public static ConfigEntry<float> ThrowRockProjectileVelocity;
public static ConfigEntry<float> ThrowLogVelocity;
// ─── True Form (tier 5+) ───────────────────────────────────────────────
public static ConfigEntry<float> TrueFormDuration;
public static ConfigEntry<float> TrueFormCooldown;
public static ConfigEntry<float> TrueFormScaleNormal;
public static ConfigEntry<float> TrueFormScaleAdvanced;
// ─── Log Weapon (tier 7+) ──────────────────────────────────────────────
public static ConfigEntry<float> LogWeaponMaxDurability;
public static ConfigEntry<float> LogWeaponDurabilityDrainPerHit;
// ─── Farming ───────────────────────────────────────────────────────────
public static ConfigEntry<float> UnarmedFarmingDamageBonusPerState;
public static void Bind(ConfigFile config)
{
const string keybinds = "Trol - Keybinds";
ThrowRockKey = config.Bind(keybinds, "Throw Rock", new KeyboardShortcut(KeyCode.G),
new ConfigDescription("Throws a rock (or the log you're holding), tier 3+."));
TrueFormKey = config.Bind(keybinds, "True Form", new KeyboardShortcut(KeyCode.H),
new ConfigDescription("Transform into (or revert from) True Form, tier 5+."));
GrabLogKey = config.Bind(keybinds, "Grab Log", new KeyboardShortcut(KeyCode.E),
new ConfigDescription("Grabs a felled log as a weapon while looking at one, tier 7+ and already in True Form. Matches vanilla's own interact key rather than reusing the True Form key a second time."));
const string combat = "Trol - Passive Combat";
FireWeaknessMultiplier = config.Bind(combat, "Fire Weakness Multiplier", 1.5f,
new ConfigDescription("Multiplies incoming fire damage (1.5 = 50% weaker).", new AcceptableValueRange<float>(1f, 3f)));
BonemassMeleeBonus = config.Bind(combat, "Bonemass Melee Bonus", 10f,
new ConfigDescription("Flat damage added to Clubs/Unarmed/Axes attacks, tier 4+.", new AcceptableValueRange<float>(0f, 100f)));
YagluthMeleeBonus = config.Bind(combat, "Yagluth Melee Bonus", 5f,
new ConfigDescription("Additional flat damage added to Clubs/Unarmed/Axes attacks, tier 6+.", new AcceptableValueRange<float>(0f, 100f)));
TrueFormMeleeBonus = config.Bind(combat, "True Form Melee Bonus", 40f,
new ConfigDescription("Flat damage added to Clubs/Unarmed/Axes attacks while in True Form.", new AcceptableValueRange<float>(0f, 200f)));
RegenMultiplierBonus = config.Bind(combat, "Regen Multiplier Bonus", 0.10f,
new ConfigDescription("Health regen multiplier bonus, tier 3+ (0.10 = +10%).", new AcceptableValueRange<float>(0f, 2f)));
FavoredSkillXPMultiplier = config.Bind(combat, "Favored Skill XP Multiplier", 2f,
new ConfigDescription("Multiplies XP gain for Clubs/Unarmed/Axes/Pickaxes/WoodCutting, tier 2+.", new AcceptableValueRange<float>(0.5f, 5f)));
CarryWeightBonusBase = config.Bind(combat, "Carry Weight Bonus (Base)", 200f,
new ConfigDescription("Flat carry weight added, always active.", new AcceptableValueRange<float>(0f, 1000f)));
CarryWeightBonusBonemass = config.Bind(combat, "Carry Weight Bonus (Bonemass)", 50f,
new ConfigDescription("Additional flat carry weight, tier 4+.", new AcceptableValueRange<float>(0f, 500f)));
CarryWeightBonusYagluth = config.Bind(combat, "Carry Weight Bonus (Yagluth)", 50f,
new ConfigDescription("Additional flat carry weight, tier 6+.", new AcceptableValueRange<float>(0f, 500f)));
ArmorBonusPerState = config.Bind(combat, "Armor Bonus Per State", 3f,
new ConfigDescription("Flat armor added, per progression state.", new AcceptableValueRange<float>(0f, 20f)));
const string throwRock = "Trol - Throw Rock";
ThrowRockCooldown = config.Bind(throwRock, "Cooldown", 60f,
new ConfigDescription("Seconds between throws in human form.", new AcceptableValueRange<float>(0f, 300f)));
ThrowRockCooldownTrueForm = config.Bind(throwRock, "Cooldown (True Form)", 15f,
new ConfigDescription("Seconds between throws while in True Form.", new AcceptableValueRange<float>(0f, 300f)));
ThrowRockBaseDamage = config.Bind(throwRock, "Base Damage", 25f,
new ConfigDescription("Base blunt damage of a thrown rock (not used when throwing a log).", new AcceptableValueRange<float>(0f, 200f)));
ThrowRockBonemassBonus = config.Bind(throwRock, "Bonemass Bonus", 10f,
new ConfigDescription("Additional damage, tier 4+.", new AcceptableValueRange<float>(0f, 100f)));
ThrowRockYagluthBonus = config.Bind(throwRock, "Yagluth Bonus", 5f,
new ConfigDescription("Additional damage, tier 6+.", new AcceptableValueRange<float>(0f, 100f)));
ThrowRockTrueFormBonus = config.Bind(throwRock, "True Form Bonus", 40f,
new ConfigDescription("Additional damage while in True Form.", new AcceptableValueRange<float>(0f, 200f)));
ThrowRockProjectileVelocity = config.Bind(throwRock, "Rock Velocity", 20f,
new ConfigDescription("Travel speed of a thrown rock.", new AcceptableValueRange<float>(1f, 60f)));
ThrowLogVelocity = config.Bind(throwRock, "Log Velocity", 60f,
new ConfigDescription("Travel speed of a thrown log (compensates for its weight/drag).", new AcceptableValueRange<float>(1f, 150f)));
const string trueForm = "Trol - True Form";
TrueFormDuration = config.Bind(trueForm, "Duration", 60f,
new ConfigDescription("Seconds True Form lasts before automatically reverting.", new AcceptableValueRange<float>(5f, 600f)));
TrueFormCooldown = config.Bind(trueForm, "Cooldown", 600f,
new ConfigDescription("Seconds between True Form activations.", new AcceptableValueRange<float>(0f, 3600f)));
TrueFormScaleNormal = config.Bind(trueForm, "Scale", 2.0f,
new ConfigDescription("Model scale while in True Form, tier 5-6.", new AcceptableValueRange<float>(1f, 4f)));
TrueFormScaleAdvanced = config.Bind(trueForm, "Scale (Tier 7+)", 2.5f,
new ConfigDescription("Model scale while in True Form, tier 7+.", new AcceptableValueRange<float>(1f, 4f)));
const string logWeapon = "Trol - Log Weapon";
LogWeaponMaxDurability = config.Bind(logWeapon, "Max Durability", 6f,
new ConfigDescription("Hits a grabbed log weapon survives before breaking, tier 7+.", new AcceptableValueRange<float>(1f, 50f)));
LogWeaponDurabilityDrainPerHit = config.Bind(logWeapon, "Durability Drain Per Hit", 1f,
new ConfigDescription("Durability spent per hit landed.", new AcceptableValueRange<float>(0.1f, 10f)));
const string farming = "Trol - Farming";
UnarmedFarmingDamageBonusPerState = config.Bind(farming, "Unarmed Damage Bonus Per State", 3f,
new ConfigDescription("Extra chop/pickaxe damage when farming or mining unarmed, per progression state.", new AcceptableValueRange<float>(0f, 20f)));
}
}
}