Merge branch 'main' into race-chains-and-stations

# Conflicts:
#	JotunnModStub/Aswid/AswidRace.cs
#	JotunnModStub/Factions/FactionHostilityPatch.cs
#	JotunnModStub/Factions/FactionMerchantCatalog.cs
#	JotunnModStub/Furling/FurlingPatches.cs
This commit is contained in:
kanym 2026-08-07 17:15:10 +02:00
commit f60b8d8f7d
48 changed files with 1865 additions and 380 deletions

View file

@ -23,17 +23,17 @@ namespace RacesOfValheim
// Player.TakeInput, so nothing fires while a map, chest or chat window has focus.
if (!RaceInput.Allowed) return;
if (state >= TrentaConfig.PurpleRainUnlockState && Input.GetKeyDown(TrentaConfig.PurpleRainKey))
if (state >= TrentaConfig.PurpleRainUnlockState && TrentaConfigManagement.PurpleRainKey.Value.IsDown())
{
TryPurpleRain(player);
}
if (state >= TrentaConfig.PortalUnlockState && Input.GetKeyDown(TrentaConfig.PortalKey))
if (state >= TrentaConfig.PortalUnlockState && TrentaConfigManagement.PortalKey.Value.IsDown())
{
TryOpenPortal(player);
}
if (state >= TrentaConfig.MuspellUnlockState && Input.GetKeyDown(TrentaConfig.MuspellKey))
if (state >= TrentaConfig.MuspellUnlockState && TrentaConfigManagement.MuspellKey.Value.IsDown())
{
TrentaMuspell.Toggle(player);
}

View file

@ -93,11 +93,12 @@ namespace RacesOfValheim
// Base passive, live from state 1: stand motionless in daylight, out from under a roof,
// and the Trenta puts down roots. TrentaAbilities.TickPhotosynthesis reads every number
// below; nothing is hard-coded in the patch itself.
public const float PhotosynthesisStillnessSeconds = 10f; // channel time before it fires
public const int PhotosynthesisHealSeconds = 8; // number of 1-second heal ticks
public const float PhotosynthesisHealPercentPerSecond = 0.10f; // % of max health per tick
public const float PhotosynthesisRestBaseMinutes = 5f; // Rested duration at Base
public const float PhotosynthesisRestMinutesPerBoss = 1f; // + this, per boss defeated
// Forward to TrentaConfigManagement (BepInEx ConfigEntry) - see that class.
public static float PhotosynthesisStillnessSeconds => TrentaConfigManagement.PhotosynthesisStillnessSeconds.Value;
public static int PhotosynthesisHealSeconds => TrentaConfigManagement.PhotosynthesisHealSeconds.Value;
public static float PhotosynthesisHealPercentPerSecond => TrentaConfigManagement.PhotosynthesisHealPercentPerSecond.Value;
public static float PhotosynthesisRestBaseMinutes => TrentaConfigManagement.PhotosynthesisRestBaseMinutes.Value;
public static float PhotosynthesisRestMinutesPerBoss => TrentaConfigManagement.PhotosynthesisRestMinutesPerBoss.Value;
// Character.GetVelocity() never reads exactly zero even standing still - a bit of
// physics jitter is normal. Below this, the Trenta counts as motionless.
@ -110,16 +111,20 @@ namespace RacesOfValheim
// lines up with RaceHostilityManager's Trenta block (Greyling/Greydwarf/Fuling/Troll/
// Leech/Deathsquito) and with every tamed companion and teammate, for free.
public const int PurpleRainUnlockState = 3; // The Elder dead
public const KeyCode PurpleRainKey = KeyCode.G;
// The keybind used to live here as a KeyCode const; it is now
// TrentaConfigManagement's PurpleRainKey (a rebindable KeyboardShortcut), read directly
// by TrentaAbilities.
public const float PurpleRainCooldown = 20f;
public const float PurpleRainRadius = 8f; // TODO: tune
public const float PurpleRainHealAmount = 40f; // TODO: tune - flat heal per ally hit
public const float PurpleRainPoisonDamage = 40f; // TODO: tune - a Poison-type hit; vanilla's
// own poison-on-hit handling takes over
// from there, same as SkeletonRace's fire
// aura just deals Fire damage and lets
// the burn status follow from that.
// Forward to TrentaConfigManagement (BepInEx ConfigEntry) - see that class.
public static float PurpleRainCooldown => TrentaConfigManagement.PurpleRainCooldown.Value;
public static float PurpleRainRadius => TrentaConfigManagement.PurpleRainRadius.Value;
public static float PurpleRainHealAmount => TrentaConfigManagement.PurpleRainHealAmount.Value;
public static float PurpleRainPoisonDamage => TrentaConfigManagement.PurpleRainPoisonDamage.Value;
// A Poison-type hit; vanilla's own
// poison-on-hit handling takes over from
// there, same as SkeletonRace's fire aura
// just deals Fire damage and lets the
// burn status follow from that.
public const string PurpleRainCdSE = "SE_TrentaPurpleRainCooldown";
@ -141,12 +146,13 @@ namespace RacesOfValheim
// Last Stand: always-on armor bonus that scales with health already lost, so it does
// nothing at full health and its most at the edge of death. SE_TrentaStats.ModifyArmorMods
// reads this every time armor is computed - there is no timer or trigger to it.
public const float LastStandMaxArmorBonus = 0.5f; // +50% armor at ~0 health remaining
// Forwards to TrentaConfigManagement (BepInEx ConfigEntry) - see that class.
public static float LastStandMaxArmorBonus => TrentaConfigManagement.LastStandMaxArmorBonus.Value;
// Thorns: reflects this fraction of every hit taken back at whoever landed it.
// Trenta_Character_Damage_Thorns_Patch reads it fresh on every hit - no timer, no charge,
// no cooldown, it just always applies. Replaces Camouflage, which never worked reliably.
public const float ThornsReflectPercent = 0.2f;
public static float ThornsReflectPercent => TrentaConfigManagement.ThornsReflectPercent.Value;
// ─── Homecoming Portal (Yagluth) ─────────────────────────────────────
// Opens a linked pair of portals - one where the Trenta is standing, one at their
@ -156,11 +162,13 @@ namespace RacesOfValheim
// custom (TrentaPortal.cs), not a re-skinned vanilla TeleportWorld, which is exactly why
// it can skip the raw-ore restriction the real thing carries.
public const int PortalUnlockState = 6; // Yagluth dead
public const KeyCode PortalKey = KeyCode.H;
// The keybind used to live here as a KeyCode const; it is now TrentaConfigManagement's
// PortalKey (a rebindable KeyboardShortcut), read directly by TrentaAbilities.
public const float PortalCooldown = 300f; // 5 minutes
public const float PortalLifetime = 30f;
public const float PortalSpawnDistance = 2f; // meters in front of the player, where it opens
// Forward to TrentaConfigManagement (BepInEx ConfigEntry) - see that class.
public static float PortalCooldown => TrentaConfigManagement.PortalCooldown.Value;
public static float PortalLifetime => TrentaConfigManagement.PortalLifetime.Value;
public static float PortalSpawnDistance => TrentaConfigManagement.PortalSpawnDistance.Value;
// Source of the swirl visual the portal clones and retints. "portal_wood" is the
// confirmed internal ID of the vanilla portal piece (verified against a live source
@ -184,13 +192,14 @@ namespace RacesOfValheim
// (probably scene data on the wild instance, not code), so this one rests on the wiki's
// account of live behaviour rather than the assembly's own IL the way most numbers in
// this file do - flag it if it reads as too strong or too weak once tried.
public const float HornetsNestDamagePerTick = 10f;
public const float HornetsNestTickInterval = 4f;
// Forward to TrentaConfigManagement (BepInEx ConfigEntry) - see that class.
public static float HornetsNestDamagePerTick => TrentaConfigManagement.HornetsNestDamagePerTick.Value;
public static float HornetsNestTickInterval => TrentaConfigManagement.HornetsNestTickInterval.Value;
public const float HornetsNestEngageRadius = 6f; // TODO: tune - how close a foe has to get
public const float HornetsNestFollowSpeed = 8f; // TODO: tune
public const float HornetsNestOrbitRadius = 0.6f; // how tightly it hugs the Trenta at rest
public const float HornetsNestAttackHeight = 1.5f; // hovers this high over a target it is stinging - the "from above" for the pierce half of each tick
public static float HornetsNestEngageRadius => TrentaConfigManagement.HornetsNestEngageRadius.Value; // how close a foe has to get
public static float HornetsNestFollowSpeed => TrentaConfigManagement.HornetsNestFollowSpeed.Value;
public static float HornetsNestOrbitRadius => TrentaConfigManagement.HornetsNestOrbitRadius.Value; // how tightly it hugs the Trenta at rest
public static float HornetsNestAttackHeight => TrentaConfigManagement.HornetsNestAttackHeight.Value; // hovers this high over a target it is stinging - the "from above" for the pierce half of each tick
// The flies only, not the smoke or the drip, off the same "Draugr" prefab
// DraughRace.EnsureVFX already reads for its own aura - same source, same filtering rule,
@ -211,26 +220,28 @@ namespace RacesOfValheim
// pattern) about as closely as two independent races' code can - both are read, not
// guessed, so the shape of this is trustworthy even where individual numbers below are not.
public const int MuspellUnlockState = 8; // Fader dead
public const KeyCode MuspellKey = KeyCode.J;
// The keybind used to live here as a KeyCode const; it is now TrentaConfigManagement's
// MuspellKey (a rebindable KeyboardShortcut), read directly by TrentaAbilities.
// "gd_king" is The Elder's own internal prefab name, confirmed against a live source
// (not guessed) the same way "portal_wood" and "Draugr" were.
public const string MuspellFormPrefab = "gd_king";
public const float MuspellScale = 0.5f;
// Forward to TrentaConfigManagement (BepInEx ConfigEntry) - see that class.
public static float MuspellScale => TrentaConfigManagement.MuspellScale.Value;
// Stomp's damage/radius are still this mod's own numbers - TODO: replace with
// gd_king_stomp's own SharedData.m_damages once dumpelder reports it, the same way the
// trigger name below was replaced with a read value instead of a guess.
public const float MuspellStompDamage = 60f;
public const float MuspellStompRadius = 2.5f; // TODO: tune
public static float MuspellStompDamage => TrentaConfigManagement.MuspellStompDamage.Value;
public static float MuspellStompRadius => TrentaConfigManagement.MuspellStompRadius.Value;
// The ranged attack is a real Projectile (type=Projectile, range 8-24), not an instant
// cone hit - "gdking_root_projectile", The Elder's own vine/spike shot, spawned and set up
// exactly the way Attack.FireProjectileBurst does it (Instantiate, new HitData, IProjectile
// .Setup), for "identico" rather than an approximation.
public const string MuspellSpikeProjectilePrefab = "gdking_root_projectile";
public const float MuspellSpikeDamage = 35f; // TODO: replace with the projectile's own m_damage once dumpelder reports it
public const float MuspellSpikeVelocity = 20f; // TODO: tune - m_projectileVel isn't in this dump yet either
public static float MuspellSpikeDamage => TrentaConfigManagement.MuspellSpikeDamage.Value; // TODO: replace with the projectile's own m_damage once dumpelder reports it
public static float MuspellSpikeVelocity => TrentaConfigManagement.MuspellSpikeVelocity.Value; // TODO: m_projectileVel isn't in this dump yet either
// Read straight off gd_king's own default weapons via the "dumpelder" console command
// (RacesOfValheim.DumpElderCommand) rather than guessed - confirmed by IL that
@ -300,8 +311,9 @@ namespace RacesOfValheim
"MarinatedGreens" // Marinated greens
};
// Digestion runs twice as long for a Trenta eating any of the foods above.
public const float FoodDurationMultiplier = 2f;
// Digestion runs longer for a Trenta eating any of the foods above. Forwards to
// TrentaConfigManagement (BepInEx ConfigEntry) - see that class.
public static float FoodDurationMultiplier => TrentaConfigManagement.FoodDurationMultiplier.Value;
// ─── Awakened seeds ──────────────────────────────────────────────────
// Once a Trenta has felled Eikthyr, every seed, cone, acorn and self-seeding mushroom in

View file

@ -0,0 +1,155 @@
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;
// ─── Last Stand & Thorns (tier 5+) ────────────────────────────────────
public static ConfigEntry<float> LastStandMaxArmorBonus;
public static ConfigEntry<float> ThornsReflectPercent;
// ─── 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 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 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 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)));
}
}
}