RacesOfValheim/JotunnModStub/Trenta/TrentaConfig.cs
kanym 14648aaf62 feat(trenta): make ability numbers and keybinds BepInEx-configurable
Adds TrentaConfigManagement.cs rather than reusing the TrentaConfig name,
same reasoning as DvergarConfigManagement: that existing class holds
identity constants that must never change (RaceId, status effect and
prefab names), hand-tuned cosmetic placement numbers (skin colour, crown
position), and design-time 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 move: Photosynthesis, Purple Rain, Last
Stand/Thorns, Homecoming Portal, Hornet's Nest, Muspell, and the vegan
food duration bonus each get a Configuration Manager section, plus the
three transform/ability keybinds (Purple Rain, Portal, Muspell).
TrentaConfig's fields for those now forward to TrentaConfigManagement
(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.

Fixes a BepInEx startup crash caught while testing: the Hornet's Nest
section name used a straight ASCII apostrophe, which
ConfigDefinition.CheckInvalidConfigChars rejects outright (section/key
names may not contain = \n \t \ " ' [ ]). Switched to the typographic
apostrophe (U+2019), which reads the same and isn't on the forbidden list.

Config sections stay bound alphabetically by race (Aswid, Draugh,
Dvergar, Fenrir, Furling, Skadi, Skeleton, Trenta) in
RacesOfValheim.Awake().
2026-08-06 15:20:10 +02:00

411 lines
28 KiB
C#

using System.Collections.Generic;
using UnityEngine;
namespace RacesOfValheim
{
/// <summary>
/// Every tunable number the Trenta uses, in one place.
///
/// Same arrangement as DvergarConfig: TrentaProgression reads these to build its per-tier
/// rules and the patches read the rules, never a literal. Retuning the race means editing
/// this file only.
///
/// Nothing here is final - the values are placeholders so the race compiles and runs while
/// the design is still open.
/// </summary>
public static class TrentaConfig
{
// ─── Identity ────────────────────────────────────────────────────────
// Anagram of "Treant": the Trenta are the tree-born.
//
// This is the value stored in m_customData["Race"] and in the ZDO, so renaming it after
// players have chosen the race would orphan their characters. Decide it now.
public const string RaceId = "Trenta";
public const string StatsSE = "SE_TrentaStats";
// Mirrors the ZDO key layout the other races use, so remote clients can read the tier
// without having the local player's progression state.
public const string StateZdoKey = "RacesOfValheim_TrentaState";
// Title of the compendium entry, once RaceCompendium learns about the race.
public const string CompendiumTitle = "Trenta Secrets";
// ─── Model ───────────────────────────────────────────────────────────
// Applied to the player's "Visual" child rather than the root transform, the way Furling
// and Dvergar do it: scaling the root would drag the collider and camera pivot along.
//
// Tuning knobs are static readonly rather than const throughout: a const folds at compile
// time, which turns "is this perk switched off?" guards into dead code the moment a knob
// is set to zero.
public static readonly float VisualScale = 1f; // TODO: taller than a human?
// ─── Skin ────────────────────────────────────────────────────────────
// Written straight onto the body material's _SkinColor by an UpdateColors postfix, which
// is the only thing that actually tints a player.
//
// This is a multiplier over the human skin texture, not a replacement, so a value near
// (1,1,1) changes nothing anyone can see. Every race that reads clearly commits to a
// channel - Trol (0.1, 0.6, 0.7), Furling (0.3, 0.8, 0.3) - so the Trenta does too:
// the pale green of a young leaf for skin, dark foliage green for hair and beard.
public static readonly Color SkinColor = new Color(0.55f, 0.85f, 0.35f, 1f);
public static readonly Color HairColor = new Color(0.06f, 0.28f, 0.08f, 1f);
// ─── Crown of branches ───────────────────────────────────────────────
// A greydwarf shaman wears a crown of horns and dead wood, and it is the one piece of
// vanilla art that says "this one grew rather than was born". The whole trophy is hung on
// the player's head bone and then sunk into the skull until only the branches clear it -
// the same trick the Furling uses to wear a goblin head, aimed at a different result.
public const string CrownTrophyPrefabName = "TrophyGreydwarfShaman";
// Bone the crown is hung from on the player's own rig.
public const string PlayerHeadBoneName = "Head";
// These three are the ones to eyeball in game; everything else about the crown is fixed.
// Valheim's player rig is authored at roughly 100x, which is why bone-local numbers are
// this small - the Furling's goblin head sits at 0.0058 for comparison.
//
// Y is up in the head bone's frame, so lowering it sinks the trophy deeper and shows less
// of the crown. Too high and a shrunken greydwarf face floats out of the player's own; too
// low and the branches disappear into the scalp.
public static readonly Vector3 CrownOffsetPosition = new Vector3(0.0005f, 0.0008f, 0f);
public static readonly Vector3 CrownOffsetRotation = new Vector3(-90f, 0f, 90f);
public static readonly float CrownScale = 0.0070f;
// ─── Progression tables ──────────────────────────────────────────────
// Indexed by progression state; index 0 is unused so the state number indexes directly.
// 1 Base, 2 Eikthyr, 3 The Elder, 4 Bonemass, 5 Moder, 6 Yagluth, 7 The Queen, 8 Fader.
public static readonly float[] HealthBonusByState =
{
0f, // (unused)
0f, // 1 Base TODO
0f, // 2 Eikthyr TODO
0f, // 3 The Elder TODO
0f, // 4 Bonemass TODO
0f, // 5 Moder TODO
0f, // 6 Yagluth TODO
0f, // 7 The Queen TODO
0f // 8 Fader TODO
};
// ─── Photosynthesis ──────────────────────────────────────────────────
// 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.
// 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.
public const float PhotosynthesisVelocityEpsilon = 0.01f;
// ─── Purple Rain (The Elder) ─────────────────────────────────────────
// A spray of toxic-purple pollen: heals everything the Trenta doesn't fight, poisons
// everything that fights the Trenta. "Ally" is deliberately not a hardcoded species list -
// TrentaAbilities checks the same BaseAI.IsEnemy the mod's own hostility rules use, so it
// 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
// The keybind used to live here as a KeyCode const; it is now
// TrentaConfigManagement's PurpleRainKey (a rebindable KeyboardShortcut), read directly
// by TrentaAbilities.
// 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";
// Source of the spray particle system Purple Rain clones and retints. "Greydwarf_Shaman"
// is the same prefab name AswidRace's own raw-food mapping already keys off, so it is
// known-correct rather than guessed.
public const string PurpleRainVfxSourcePrefab = "Greydwarf_Shaman";
public static readonly Color PurpleRainVfxColor = new Color(0.55f, 0.1f, 0.85f, 1f); // toxic purple
// ─── Bonemass passives ───────────────────────────────────────────────
// Three flat unlocks, all live from the same boss kill: swimming costs no stamina, and
// Poison and Wet can no longer touch a Trenta. A body that runs on sunlight and rain
// rather than blood has nothing left for the swamp to spoil.
public const int BonemassDefeatedState = 4;
// ─── Moder passives ──────────────────────────────────────────────────
public const int ModerDefeatedState = 5;
// 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.
// 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 static float ThornsReflectPercent => TrentaConfigManagement.ThornsReflectPercent.Value;
// ─── Homecoming Portal (Yagluth) ─────────────────────────────────────
// Opens a linked pair of portals - one where the Trenta is standing, one at their
// respawn point - for everyone to walk through, no item-carry restriction, for 30
// seconds. The visual is deliberately just the swirl, not the vanilla wooden frame -
// "solo la componente VFX del portale normale" - and the teleport itself is entirely
// 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
// The keybind used to live here as a KeyCode const; it is now TrentaConfigManagement's
// PortalKey (a rebindable KeyboardShortcut), read directly by TrentaAbilities.
// 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
// rather than guessed, the same standard as every other prefab name in this file).
public const string PortalVfxSourcePrefab = "portal_wood";
public static readonly Color PortalVfxColor = new Color(0.55f, 0.1f, 0.85f, 1f); // same toxic purple as Purple Rain
public const string PortalCdSE = "SE_TrentaPortalCooldown";
// ─── Hornet's Nest (The Queen) ───────────────────────────────────────
// A permanent, passive companion rather than a keybound ability: once the Queen is dead
// it simply exists, hovering on the Trenta, and stays until the state that granted it no
// longer holds. TrentaRace.Update ticks its lifecycle unconditionally (not gated behind
// the usual "still Trenta" early return) so it is torn down the instant a race change,
// a drop in tier or death would otherwise leave it orphaned with nothing left to update it.
public const int HornetsNestUnlockState = 7; // The Queen dead
// Matches the wild Bee Nest's own sting - 10 poison damage every 4 seconds - rather than
// an invented number, on the read that "as if constantly stung by bees" means using the
// real thing's own numbers. Not found as a tunable field on the Beehive class itself
// (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.
// Forward to TrentaConfigManagement (BepInEx ConfigEntry) - see that class.
public static float HornetsNestDamagePerTick => TrentaConfigManagement.HornetsNestDamagePerTick.Value;
public static float HornetsNestTickInterval => TrentaConfigManagement.HornetsNestTickInterval.Value;
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,
// just discarding the two effects Draugh keeps instead of the one it discards.
public const string HornetsNestFliesSourcePrefab = "Draugr";
// Source of the buzz: the ambient bee-swarm effect a placed Beehive plays, read for its
// AudioClip only - never instantiated, so nothing about how it looks ever enters this
// ability, matching "la sua unica componente visiva sarà le mosche" literally.
public const string HornetsNestBeehivePrefab = "Beehive";
// ─── Muspell (Fader) ─────────────────────────────────────────────────
// A toggled transformation, the same shape as FenrirRace's own G/H/J forms: press J to
// become a half-size The Elder, press J again to revert. The permanent-fire half of the
// original design (Burning VFX + ignite-on-hit) was tried and dropped - the flame glitched
// with no reliable fix in reach, so it was removed rather than chased further.
// TrentaMuspell.cs mirrors FenrirRace.cs (transform/revert routines, ExecuteTransformation/
// ExecuteReversion) and FenrirBehaviors.cs (per-form Animator + mouse-button attack
// 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
// 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";
// 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 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 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
// Attack.m_attackAnimation feeds directly into ZSyncAnimation.SetTrigger, so these are the
// exact strings The Elder itself uses:
// gd_king_stomp (jaws) -> primary animation "stomp", m_attackRandomAnimations=2
// gd_king_shoot (shaman attack) -> primary animation "shoot", spawns gdking_root_projectile
// gd_king_rootspawn (spawn) -> primary animation "spawn"
// Stomp's randomAnimations=2 means the real trigger fired is "stomp0" or "stomp1", picked
// at random each swing, mirroring Attack.Start's own random-suffix branch.
public const string MuspellStompTrigger = "stomp";
public const int MuspellStompTriggerVariants = 2;
public const string MuspellSpikeTrigger = "shoot";
public const string MuspellRootSummonTrigger = "spawn";
// Purple Rain's own cooldown while Muspell is active - read by TryPurpleRain instead of
// PurpleRainCooldown whenever TrentaMuspell.IsTransformed is true.
public const float MuspellPurpleRainCooldown = 10f;
// ─── Diet ────────────────────────────────────────────────────────────
// The Trenta are strict vegans: no meat, fish, egg or honey, in any dish that contains
// even a trace of one. TrentaFoodPatches blocks eating anything whose prefab is not in
// this set - meads are untouched, since those never carry m_food/m_foodStamina/m_foodEitr
// and so never look like "food" to that check in the first place.
//
// Every entry here is the game's actual internal prefab ID (verified against the item's
// wiki infobox one at a time - the display name does not reliably predict it: Blueberries
// is "Blueberries" but Raspberries is "Raspberry", Magecap is "MushroomMagecap", Fiddlehead
// is "Fiddleheadfern"). Get one of these wrong and that food silently stops being
// recognised as vegan-safe rather than throwing, so this list must never be hand-guessed.
//
// Deliberately excludes every dish that touches Honey, Egg, Royal jelly or Volture egg
// (Cooked egg, Mushroom omelette, Frosted sweetbread, Yggdrasil porridge, Spicy marmalade,
// Roasted crust pie) even though none of those are meat - a vegan diet is "no animal
// product", not "no meat", and the player asked for the former.
public static readonly HashSet<string> VeganFoodPrefabNames = new HashSet<string>
{
// Meadows / Black Forest
"Raspberry", // Raspberries
"Mushroom", // Mushroom
"Blueberries", // Blueberries
"MushroomYellow", // Yellow mushroom
"Carrot", // Carrot
"QueensJam", // Queen's jam
"CarrotSoup", // Carrot soup
// Mountain
"Onion", // Onion
"OnionSoup", // Onion soup
// Plains
"Cloudberry", // Cloudberries
"Bread", // Bread
// Mistlands
"MushroomMagecap", // Magecap
"MushroomJotunPuffs", // Jotun puffs
"Salad", // Salad
// Ashlands
"MushroomSmokePuff", // Smoke puff
"Fiddleheadfern", // Fiddlehead
"Vineberry", // Vineberry cluster
"ScorchingMedley", // Scorching medley
"SizzlingBerryBroth", // Sizzling berry broth
"SparklingShroomshake", // Sparkling shroomshake
"MarinatedGreens" // Marinated greens
};
// 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
// the game wakes up: eating the raw item on the spot consumes it and grants the strongest
// health/eitr dish its own biome has to offer (see the biome-pairing table worked out with
// the player - eitr food wins the tie-break wherever a biome has one, otherwise health
// wins by default). Before that boss falls the same click does nothing special - the seed
// just behaves like the ordinary planting material it already is.
//
// A handful of judgment calls, all defaults rather than answers pulled from the player:
// - Fir cone spans Black Forest/Swamp/Mountain and Birch seeds spans Meadows/Plains;
// each is given one fixed stat block drawn from the highest-tier biome it grows in
// (Mountain, Plains) rather than varying by where it happened to be picked up.
// - Flax has no seed-to-food entry: it produces fibre, never food, in vanilla, so there
// is nothing sensible to "awaken" it into.
// - Magecap and Jotun puffs are self-seeding (the raw item you plant is the same one you
// already eat raw at the base tier), so their entry represents an *upgrade* on the same
// item rather than turning an inedible material into a first meal.
public const int EikthyrDefeatedState = 2; // BossProgressionManager state 2 = Eikthyr dead
// Prefix shared by every generated awakened-food prefab, so patches can recognise one on
// sight (Trenta_Player_EatFood_DuplicateGuard_Patch) without re-deriving the raw-name map.
public const string AwakenedSeedPrefabPrefix = "TrentaAwakened_";
public struct AwakenedSeedFood
{
public string RawPrefabName; // the seed/cone/acorn/mushroom item this replaces on eating
public float Health;
public float Stamina;
public float Eitr;
public float Duration; // seconds
public float Healing; // hp/tick
public string AwakenedPrefabName => AwakenedSeedPrefabPrefix + RawPrefabName;
}
public static readonly AwakenedSeedFood[] AwakenedSeedFoods =
{
// Meadows - no eitr food in the biome, so health wins by default (Cooked deer meat).
new AwakenedSeedFood { RawPrefabName = "BeechSeeds", Health = 35, Stamina = 12, Eitr = 0, Duration = 1200, Healing = 2 },
new AwakenedSeedFood { RawPrefabName = "Acorn", Health = 35, Stamina = 12, Eitr = 0, Duration = 1200, Healing = 2 },
// Black Forest - no eitr food, health wins (Deer stew).
new AwakenedSeedFood { RawPrefabName = "CarrotSeeds", Health = 45, Stamina = 15, Eitr = 0, Duration = 1500, Healing = 3 },
new AwakenedSeedFood { RawPrefabName = "PineCone", Health = 45, Stamina = 15, Eitr = 0, Duration = 1500, Healing = 3 },
// Fir cone also grows in Swamp and Mountain; Mountain is its highest tier (Wolf skewer).
new AwakenedSeedFood { RawPrefabName = "FirCone", Health = 65, Stamina = 21, Eitr = 0, Duration = 1500, Healing = 3 },
// Swamp - no eitr food, health wins (Serpent stew).
new AwakenedSeedFood { RawPrefabName = "TurnipSeeds", Health = 80, Stamina = 26, Eitr = 0, Duration = 1800, Healing = 4 },
// Mountain - no eitr food, health wins (Wolf skewer).
new AwakenedSeedFood { RawPrefabName = "OnionSeeds", Health = 65, Stamina = 21, Eitr = 0, Duration = 1500, Healing = 3 },
// Plains - no eitr food, health wins (Lox meat pie). Birch seeds also grows in
// Meadows; Plains is its higher tier.
new AwakenedSeedFood { RawPrefabName = "Barley", Health = 75, Stamina = 24, Eitr = 0, Duration = 1800, Healing = 4 },
new AwakenedSeedFood { RawPrefabName = "BirchSeeds", Health = 75, Stamina = 24, Eitr = 0, Duration = 1800, Healing = 4 },
// Mistlands - Seeker aspic has the biome's highest eitr, so it wins the tie-break over
// Misthare supreme's higher health.
new AwakenedSeedFood { RawPrefabName = "MushroomMagecap", Health = 28, Stamina = 14, Eitr = 85, Duration = 1800, Healing = 3 },
new AwakenedSeedFood { RawPrefabName = "MushroomJotunPuffs", Health = 28, Stamina = 14, Eitr = 85, Duration = 1800, Healing = 3 },
// Ashlands - Marinated greens has the biome's highest eitr, wins the tie-break over
// Piquant pie's higher health.
new AwakenedSeedFood { RawPrefabName = "VineberrySeeds", Health = 32, Stamina = 16, Eitr = 95, Duration = 1800, Healing = 4 }
};
// Built once from the array above so the Humanoid.UseItem patch can look a clicked
// prefab up in O(1) instead of scanning the array on every item use.
public static readonly Dictionary<string, AwakenedSeedFood> AwakenedSeedFoodByRawPrefab = BuildAwakenedSeedFoodLookup();
private static Dictionary<string, AwakenedSeedFood> BuildAwakenedSeedFoodLookup()
{
var lookup = new Dictionary<string, AwakenedSeedFood>();
foreach (AwakenedSeedFood food in AwakenedSeedFoods)
{
lookup[food.RawPrefabName] = food;
}
return lookup;
}
// ─── Helpers ─────────────────────────────────────────────────────────
/// <summary>Clamped table lookup, so a state outside 1..8 can never index out of range.</summary>
public static float Lookup(float[] table, int state)
{
if (table == null || table.Length == 0) return 0f;
int index = Mathf.Clamp(state, BossProgressionManager.MinState, table.Length - 1);
return table[index];
}
}
}