RacesOfValheim/JotunnModStub/Trenta/TrentaConfigManagement.cs

181 lines
14 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using UnityEngine;
using BepInEx.Configuration;
namespace RacesOfValheim
{
/// <summary>
/// The BepInEx-configurable slice of the Trenta's numbers, bound as 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).
///
/// Named separately from the pre-existing TrentaConfig (rather than folding into it), same
/// reasoning as DvergarConfigManagement: that class is a different kind of thing - identity
/// constants that must never change once a player has the race (RaceId, status effect and
/// prefab names - renaming them would orphan saved characters or break asset lookups),
/// hand-tuned cosmetic placement numbers (skin colour, crown position), and design-time data
/// tables (HealthBonusByState, the per-biome AwakenedSeedFoods list) left alone under the same
/// boundary drawn for every other race's progression table. Only the genuine ability knobs -
/// Photosynthesis, Purple Rain, Last Stand/Thorns, Homecoming Portal, Hornet's Nest, Muspell,
/// and the vegan food duration bonus - plus the three transform/ability keybinds, belong here.
/// TrentaConfig's own fields for those now forward to this class (same const-to-property trick
/// used for Skadi and Dvergar), so every existing call site kept working unchanged except the
/// three keybind consumers in TrentaAbilities, which now read the live configured key.
///
/// Everything here is read live on every use - TrentaProgression.GetRules only caches
/// HealthBonus (from the untouched table above), so none of this needs a relog to take effect.
/// </summary>
public static class TrentaConfigManagement
{
// ─── Keybinds ──────────────────────────────────────────────────────────
public static ConfigEntry<KeyboardShortcut> PurpleRainKey;
public static ConfigEntry<KeyboardShortcut> PortalKey;
public static ConfigEntry<KeyboardShortcut> MuspellKey;
// ─── Photosynthesis (tier 1+, passive) ───────────────────────────────
public static ConfigEntry<float> PhotosynthesisStillnessSeconds;
public static ConfigEntry<int> PhotosynthesisHealSeconds;
public static ConfigEntry<float> PhotosynthesisHealPercentPerSecond;
public static ConfigEntry<float> PhotosynthesisRestBaseMinutes;
public static ConfigEntry<float> PhotosynthesisRestMinutesPerBoss;
// ─── Purple Rain (tier 3+) ────────────────────────────────────────────
public static ConfigEntry<float> PurpleRainCooldown;
public static ConfigEntry<float> MuspellPurpleRainCooldown;
public static ConfigEntry<float> PurpleRainRadius;
public static ConfigEntry<float> PurpleRainHealAmount;
public static ConfigEntry<float> PurpleRainPoisonDamage;
// ─── Bonemass (tier 4+, passive) ──────────────────────────────────────
public static ConfigEntry<float> SwimStaminaRegen;
// ─── Last Stand & Thorns (tier 5+) ────────────────────────────────────
public static ConfigEntry<float> LastStandMaxArmorBonus;
public static ConfigEntry<float> ThornsReflectPercent;
// ─── Root of the Elder (tier 3+, defensive piece) ─────────────────────
public static ConfigEntry<float> ElderRootHealth;
public static ConfigEntry<float> ElderRootSelfHealDelay;
public static ConfigEntry<float> ElderRootSelfHealPercentPerSecond;
public static ConfigEntry<float> ElderRootRepairRadius;
public static ConfigEntry<float> ElderRootRepairInterval;
// ─── Homecoming Portal (tier 6+) ──────────────────────────────────────
public static ConfigEntry<float> PortalCooldown;
public static ConfigEntry<float> PortalLifetime;
public static ConfigEntry<float> PortalSpawnDistance;
// ─── Hornet's Nest (tier 7+, passive) ─────────────────────────────────
public static ConfigEntry<float> HornetsNestDamagePerTick;
public static ConfigEntry<float> HornetsNestTickInterval;
public static ConfigEntry<float> HornetsNestEngageRadius;
public static ConfigEntry<float> HornetsNestFollowSpeed;
public static ConfigEntry<float> HornetsNestOrbitRadius;
public static ConfigEntry<float> HornetsNestAttackHeight;
// ─── Muspell (tier 8) ──────────────────────────────────────────────────
public static ConfigEntry<float> MuspellScale;
public static ConfigEntry<float> MuspellStompDamage;
public static ConfigEntry<float> MuspellStompRadius;
public static ConfigEntry<float> MuspellSpikeDamage;
public static ConfigEntry<float> MuspellSpikeVelocity;
// ─── Diet ──────────────────────────────────────────────────────────────
public static ConfigEntry<float> FoodDurationMultiplier;
public static void Bind(ConfigFile config)
{
const string keybinds = "Trenta - Keybinds";
PurpleRainKey = config.Bind(keybinds, "Purple Rain", new KeyboardShortcut(KeyCode.G),
new ConfigDescription("Casts Purple Rain, tier 3+."));
PortalKey = config.Bind(keybinds, "Homecoming Portal", new KeyboardShortcut(KeyCode.H),
new ConfigDescription("Opens the Homecoming Portal pair, tier 6+."));
MuspellKey = config.Bind(keybinds, "Muspell Form", new KeyboardShortcut(KeyCode.J),
new ConfigDescription("Transform into (or revert from) Muspell, tier 8."));
const string photo = "Trenta - Photosynthesis";
PhotosynthesisStillnessSeconds = config.Bind(photo, "Stillness Seconds", 10f,
new ConfigDescription("Seconds standing still in daylight, out from under a roof, before healing begins.", new AcceptableValueRange<float>(1f, 60f)));
PhotosynthesisHealSeconds = config.Bind(photo, "Heal Ticks", 8,
new ConfigDescription("Number of 1-second heal ticks once it fires.", new AcceptableValueRange<int>(1, 30)));
PhotosynthesisHealPercentPerSecond = config.Bind(photo, "Heal Percent Per Tick", 0.10f,
new ConfigDescription("Fraction of max health healed per tick.", new AcceptableValueRange<float>(0f, 1f)));
PhotosynthesisRestBaseMinutes = config.Bind(photo, "Rest Base Minutes", 5f,
new ConfigDescription("Rested-buff duration granted at base tier.", new AcceptableValueRange<float>(0f, 60f)));
PhotosynthesisRestMinutesPerBoss = config.Bind(photo, "Rest Minutes Per Boss", 1f,
new ConfigDescription("Extra Rested-buff minutes, per boss defeated.", new AcceptableValueRange<float>(0f, 10f)));
const string purpleRain = "Trenta - Purple Rain";
PurpleRainCooldown = config.Bind(purpleRain, "Cooldown", 20f,
new ConfigDescription("Seconds between casts in human form.", new AcceptableValueRange<float>(0f, 300f)));
MuspellPurpleRainCooldown = config.Bind(purpleRain, "Muspell Cooldown", 10f,
new ConfigDescription("Seconds between casts while transformed into Muspell.", new AcceptableValueRange<float>(0f, 300f)));
PurpleRainRadius = config.Bind(purpleRain, "Radius", 8f,
new ConfigDescription("Meters from the player the spray reaches.", new AcceptableValueRange<float>(1f, 30f)));
PurpleRainHealAmount = config.Bind(purpleRain, "Ally Heal Amount", 40f,
new ConfigDescription("Flat heal applied to you and to every ally hit.", new AcceptableValueRange<float>(0f, 200f)));
PurpleRainPoisonDamage = config.Bind(purpleRain, "Enemy Poison Damage", 40f,
new ConfigDescription("Flat poison damage applied to every enemy hit.", new AcceptableValueRange<float>(0f, 200f)));
const string bonemass = "Trenta - Bonemass";
SwimStaminaRegen = config.Bind(bonemass, "Swim Stamina Regen", 0.1f,
new ConfigDescription("Share of the normal stamina regen kept while swimming, from Bonemass on. The game stops regen in water entirely, so an empty Trenta used to drown even though swimming is free. 0 is the game's behaviour.", new AcceptableValueRange<float>(0f, 1f)));
const string lastStand = "Trenta - Last Stand & Thorns";
LastStandMaxArmorBonus = config.Bind(lastStand, "Last Stand Max Armor Bonus", 0.5f,
new ConfigDescription("Armor multiplier bonus at near-zero health, tier 5+ (0.5 = +50%). Scales down to 0 at full health.", new AcceptableValueRange<float>(0f, 3f)));
ThornsReflectPercent = config.Bind(lastStand, "Thorns Reflect Percent", 0.2f,
new ConfigDescription("Fraction of every hit taken reflected back at the attacker, tier 5+.", new AcceptableValueRange<float>(0f, 1f)));
const string elderRoot = "Trenta - Root of the Elder";
ElderRootHealth = config.Bind(elderRoot, "Health", 300f,
new ConfigDescription("Max structural health of the piece itself.", new AcceptableValueRange<float>(50f, 2000f)));
ElderRootSelfHealDelay = config.Bind(elderRoot, "Self-Heal Delay", 10f,
new ConfigDescription("Seconds without taking a hit before the piece starts healing itself.", new AcceptableValueRange<float>(0f, 60f)));
ElderRootSelfHealPercentPerSecond = config.Bind(elderRoot, "Self-Heal Percent Per Second", 0.02f,
new ConfigDescription("Fraction of max health regained per second once healing starts.", new AcceptableValueRange<float>(0f, 1f)));
ElderRootRepairRadius = config.Bind(elderRoot, "Repair Radius", 5f,
new ConfigDescription("Meters from the piece within which every player-built thing gets repaired.", new AcceptableValueRange<float>(1f, 30f)));
ElderRootRepairInterval = config.Bind(elderRoot, "Repair Interval", 60f,
new ConfigDescription("Seconds between repair pulses.", new AcceptableValueRange<float>(5f, 600f)));
const string portal = "Trenta - Homecoming Portal";
PortalCooldown = config.Bind(portal, "Cooldown", 300f,
new ConfigDescription("Seconds between casts, tier 6+.", new AcceptableValueRange<float>(0f, 3600f)));
PortalLifetime = config.Bind(portal, "Lifetime", 30f,
new ConfigDescription("Seconds the portal pair stays open.", new AcceptableValueRange<float>(5f, 300f)));
PortalSpawnDistance = config.Bind(portal, "Spawn Distance", 2f,
new ConfigDescription("Meters in front of the player the cast-side portal opens.", new AcceptableValueRange<float>(0.5f, 10f)));
const string hornets = "Trenta - Hornet’s Nest";
HornetsNestDamagePerTick = config.Bind(hornets, "Damage Per Tick", 10f,
new ConfigDescription("Poison and pierce damage dealt per sting, tier 7+.", new AcceptableValueRange<float>(0f, 50f)));
HornetsNestTickInterval = config.Bind(hornets, "Tick Interval", 4f,
new ConfigDescription("Seconds between stings on an engaged target.", new AcceptableValueRange<float>(0.5f, 20f)));
HornetsNestEngageRadius = config.Bind(hornets, "Engage Radius", 6f,
new ConfigDescription("Meters from the player within which a foe is engaged.", new AcceptableValueRange<float>(1f, 30f)));
HornetsNestFollowSpeed = config.Bind(hornets, "Follow Speed", 8f,
new ConfigDescription("Meters per second the nest moves to reach its target or resting orbit.", new AcceptableValueRange<float>(1f, 30f)));
HornetsNestOrbitRadius = config.Bind(hornets, "Orbit Radius", 0.6f,
new ConfigDescription("How tightly it hugs the player while at rest.", new AcceptableValueRange<float>(0.1f, 5f)));
HornetsNestAttackHeight = config.Bind(hornets, "Attack Height", 1.5f,
new ConfigDescription("Meters above a target it hovers while stinging.", new AcceptableValueRange<float>(0f, 5f)));
const string muspell = "Trenta - Muspell";
MuspellScale = config.Bind(muspell, "Model Scale", 0.5f,
new ConfigDescription("Model scale while transformed, tier 8.", new AcceptableValueRange<float>(0.1f, 2f)));
MuspellStompDamage = config.Bind(muspell, "Stomp Damage", 60f,
new ConfigDescription("Base damage of the stomp attack, before the Unarmed skill bonus.", new AcceptableValueRange<float>(0f, 300f)));
MuspellStompRadius = config.Bind(muspell, "Stomp Radius", 2.5f,
new ConfigDescription("Hit-sweep radius for the stomp.", new AcceptableValueRange<float>(1f, 10f)));
MuspellSpikeDamage = config.Bind(muspell, "Spike Damage", 35f,
new ConfigDescription("Base pierce damage of the root-spike projectile, before the Unarmed skill bonus.", new AcceptableValueRange<float>(0f, 200f)));
MuspellSpikeVelocity = config.Bind(muspell, "Spike Velocity", 20f,
new ConfigDescription("Travel speed of the root-spike projectile.", new AcceptableValueRange<float>(1f, 60f)));
const string diet = "Trenta - Diet";
FoodDurationMultiplier = config.Bind(diet, "Vegan Food Duration Multiplier", 2f,
new ConfigDescription("Multiplies digestion time for every vegan-safe food eaten.", new AcceptableValueRange<float>(1f, 5f)));
}
}
}