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().
This commit is contained in:
parent
0a3f82e955
commit
14648aaf62
4 changed files with 206 additions and 38 deletions
|
|
@ -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,
|
||||
|
|
@ -212,26 +221,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
|
||||
|
|
@ -301,8 +312,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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue