# Conflicts: # JotunnModStub/Aswid/AswidRace.cs # JotunnModStub/Factions/FactionHostilityPatch.cs # JotunnModStub/Factions/FactionMerchantCatalog.cs # JotunnModStub/Furling/FurlingPatches.cs
566 lines
38 KiB
C#
566 lines
38 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.
|
|
|
|
// ─── 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;
|
|
}
|
|
|
|
// ─── Composter (item progression, tier 1) ────────────────────────────
|
|
// The Trenta's half of the per-race station system the Aswid's Blood Refinery started.
|
|
// Full design in Trenta_Composter.txt; every number it settles on lives here.
|
|
//
|
|
// The chain: a Rot Seed bought from the Greydwarf faction bench gates the Composter, the
|
|
// Composter rots raw flesh into Fertilizer, and Fertilizer grows any plant on the spot.
|
|
public const string ComposterPieceName = "TrentaComposter";
|
|
public const string ComposterDisplayName = "Composter";
|
|
|
|
public const string FertilizerName = "Fertilizer";
|
|
public const string FertilizerDisplayName = "Fertilizer";
|
|
|
|
public const string RotSeedName = "RotSeed";
|
|
public const string RotSeedDisplayName = "Rot Seed";
|
|
|
|
// Same band as the Aswid's Blood Core, which does the same job for the same reason.
|
|
public const int RotSeedPrice = 500;
|
|
|
|
// "Slightly smaller than a fermenter" - the vanilla barrel is already human-sized, so this
|
|
// is a shave rather than the halving the (enormous) eitr refinery needed.
|
|
public const float ComposterScale = 0.85f;
|
|
|
|
// One batch: 100 units of flesh in, 20 Fertilizer out after the compost time, so 5 units
|
|
// of flesh per Fertilizer. Flesh is valued by AswidBloodRefinery.FleshValue.
|
|
public const float ComposterCapacity = 100f;
|
|
public const float ComposterCompostSeconds = 2400f; // as a normal fermenter
|
|
public const int ComposterYield = 20;
|
|
|
|
// Where the Draugr's flies and green gas hang over the lid. The scaled barrel is roughly a
|
|
// metre tall; this is an eyeball figure and is meant to be adjusted in game.
|
|
public static readonly Vector3 ComposterVfxLocalPosition = new Vector3(0f, 1f, 0f);
|
|
|
|
// Same prefab TrentaHornetsNest and DraughVisuals already read their particles off. The
|
|
// Composter keeps the same subset DraughVisuals keeps - flies plus the green smoke - which
|
|
// is why the swarm on a Heartwood Grove and the haze over a Composter match by default.
|
|
public const string ComposterVfxSourcePrefab = "Draugr";
|
|
|
|
// Entrails, darkened to loam. Only the world/held model takes the tint - the inventory
|
|
// icon is an atlas sprite and cannot be repainted (proven the hard way on the Aswid's
|
|
// Blood Essence), so the icon is borrowed from Guck instead: green-black reads as
|
|
// "compost" without reading as "intestine".
|
|
public static readonly Color FertilizerTint = new Color(0.18f, 0.13f, 0.09f, 1f);
|
|
public const string FertilizerIconSource = "Guck";
|
|
|
|
public static readonly Color RotSeedTint = new Color(0.16f, 0.12f, 0.08f, 1f);
|
|
|
|
// ─── Heartwood Grove (item progression, tier 2) ──────────────────────
|
|
// Plant a seed, wait, and the tree that comes up fertilises what surrounds it, stings what
|
|
// approaches it, and fills a chest with honey. Three independent functions on one piece.
|
|
public const string GroveSeedName = "HeartwoodSeed";
|
|
public const string GroveSeedDisplayName = "Heartwood Seed";
|
|
public const string GroveSaplingPieceName = "TrentaHeartwoodSapling";
|
|
public const string GroveSaplingDisplayName = "Heartwood Sapling";
|
|
public const string GrovePieceName = "TrentaHeartwoodGrove";
|
|
public const string GroveDisplayName = "Heartwood Grove";
|
|
|
|
// A grove costs exactly one full Composter batch. That is the whole balance argument.
|
|
public const int GroveSeedFertilizerCost = ComposterYield;
|
|
|
|
// World time, not session time: Plant.TimeSincePlanted reads ZNet's clock, so a sapling
|
|
// keeps growing with the zone unloaded and the game shut, same as the Composter's timer.
|
|
public const float GroveGrowSeconds = 7200f;
|
|
|
|
// One radius for both halves on purpose - the grove defends exactly the ground it farms,
|
|
// and the player only has to learn one number. Matches PurpleRainRadius.
|
|
public const float GroveRadius = 8f;
|
|
|
|
// One plant per tick, not the whole radius: 20 Fertilizer is then 20 minutes of autonomy.
|
|
// Growing everything at once would empty the trough in a single tick.
|
|
public const float GroveFertilizeInterval = 60f;
|
|
public const int GroveFertilizerCapacity = ComposterYield;
|
|
|
|
// The honey rate is not invented: m_secPerUnit and m_maxHoney are read off the vanilla
|
|
// Beehive at registration. Only the capacity is scaled - a whole tree of bees has to last
|
|
// while the player is away, where a hive only has to last until they walk past it.
|
|
public const int GroveHoneyCapacityFactor = 5;
|
|
|
|
// Honey accrues day and night, exactly as a vanilla hive's does.
|
|
//
|
|
// This used to be a GroveHoneyAtNight knob defaulting to false, on the reading that
|
|
// Beehive.m_effectOnlyInDaylight meant "bees only work in daylight". It does not: by its
|
|
// name and by the only method that touches it (Beehive.UpdateBees), it gates m_beeEffect -
|
|
// the buzz and the particles - not production. Vanilla hives make honey overnight.
|
|
//
|
|
// Getting that wrong did not merely slow the grove down, it starved it. The night was
|
|
// discarded by resetting the accrual stamp, which meant a whole m_secPerUnit had to fit
|
|
// inside one unbroken stretch of daylight - and m_secPerUnit is of the same order as a
|
|
// Valheim day is long (a full cycle is EnvMan.m_dayLengthSec, 1800s by default, of which
|
|
// roughly 1260s is not night). So honey was somewhere between rare and arithmetically
|
|
// impossible depending on the hive's real rate and what time it was when the tree matured.
|
|
//
|
|
// If the "bees sleep at night" flavour is ever wanted, it belongs where vanilla puts it:
|
|
// on the swarm's buzz, not on the honey.
|
|
|
|
// Only the model is taken off this prefab, never its TreeBase or its log drop - the same
|
|
// discipline the VFX borrowing follows. A Yggdrasil shoot reads as "grown from a root of
|
|
// the world" rather than as any old beech, and matches YggdrasilWood being in the recipe.
|
|
public const string GroveModelPrefab = "YggaShoot_small1";
|
|
public const float GroveModelScale = 1f;
|
|
|
|
// Cloned for the sapling stage; must be a prefab that carries a Plant component.
|
|
public const string GroveSaplingSourcePrefab = "Beech_Sapling";
|
|
|
|
// The grove's swarm is the Hornet's Nest swarm with a different anchor - deliberately not
|
|
// a second copy of that code, so a change to the sting is a change to both. It therefore
|
|
// reads HornetsNestDamagePerTick / HornetsNestTickInterval and has no damage of its own.
|
|
//
|
|
// A grove is a piece, not a Character, so BaseAI.IsEnemy cannot be asked directly the way
|
|
// the player-anchored swarm asks it. The fallback rule lives in TrentaHornetSwarm.
|
|
public const float GroveStingRadius = GroveRadius;
|
|
|
|
// Density cap, enforced by PieceDensityLimit. Without one, a field of groves is a carpet of
|
|
// bees that kills anything that comes near, and this was a known open point for two rounds.
|
|
//
|
|
// More permissive than the Draugh body pile's five, on the reading that a grove is a farm
|
|
// rather than an army and costs a Composter batch rather than a 500-coin bone. Unlike almost
|
|
// every other number in this file it has no vanilla equivalent to be read off, so it IS a
|
|
// guess - change it freely, it is one line and nothing else depends on it.
|
|
public const int GroveMaxInRange = 10;
|
|
public const float GroveDensityAreaKm2 = 1.6f; // the same frame the body pile uses
|
|
|
|
// ─── The vanilla beehive ─────────────────────────────────────────────
|
|
// Two features read this prefab: the grove borrows its honey rate and capacity, and the
|
|
// Hornet's Nest borrows the AudioClip off its bee effect.
|
|
//
|
|
// Both used to look up "Beehive" and both silently got nothing - confirmed from the BepInEx
|
|
// log, which is the whole reason those lookups now warn instead of returning quietly. There is
|
|
// a Beehive.prefab in the asset manifest, but it is not what PrefabManager resolves under that
|
|
// name; the buildable hive is "piece_beehive", and that is the one carrying the tuned Beehive
|
|
// component. Both names are tried in order so a game update that moves it cannot silence this
|
|
// again without saying so.
|
|
public static readonly string[] BeehiveSourcePrefabs = { "piece_beehive", "Beehive" };
|
|
|
|
// ─── Helpers ─────────────────────────────────────────────────────────
|
|
|
|
/// <summary>
|
|
/// The vanilla Beehive component, or null. Shared by the grove and the Hornet's Nest so the
|
|
/// two cannot disagree about where it lives.
|
|
/// </summary>
|
|
public static Beehive FindVanillaBeehive()
|
|
{
|
|
foreach (string name in BeehiveSourcePrefabs)
|
|
{
|
|
GameObject prefab = Jotunn.Managers.PrefabManager.Cache.GetPrefab<GameObject>(name);
|
|
Beehive hive = prefab != null ? prefab.GetComponent<Beehive>() : null;
|
|
if (hive != null)
|
|
{
|
|
Jotunn.Logger.LogInfo($"[Trenta] Vanilla beehive resolved from '{name}'.");
|
|
return hive;
|
|
}
|
|
}
|
|
|
|
Jotunn.Logger.LogWarning("[Trenta] No vanilla beehive found under any of: " +
|
|
string.Join(", ", BeehiveSourcePrefabs));
|
|
return null;
|
|
}
|
|
|
|
/// <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];
|
|
}
|
|
}
|
|
}
|