RacesOfValheim/JotunnModStub/RaceCompendium.cs
Ferdinando 34bdf35325 Merge branch 'war-vulture' into main
Sverm Ravager Strain (replacing the Stinger Morph), Trenta Elder Root, the
Trol food and Black Forest truce work, and the faction FindEnemy patch.

Conflicts resolved:

- FactionHostilityPatch.cs: both sides added a class at the same spot and
  they cover different holes, so both are kept - FactionStaticTargetPatch
  (main, stops same-faction mobs smashing structures) and
  FactionHuntPlayerPatch (war-vulture, closes the HuntPlayer fall-through).

- RaceCompendium.cs: both branches independently fixed the same off-by-one
  in the Trol's progression gates. Took main's wording, which matches the
  code - Axes are in the melee bonus (TrolDamagePatches sends them to
  m_slash), the 4th food slot has no gate at all, and Yagluth is +5 not +10
  (TrolConfig.YagluthMeleeBonus). Kept war-vulture's two new lines, the
  Kindling fire weakness and the Black Forest truce.

- Package/manifest.json: 1.4.8, which is what the root manifest and
  PluginVersion already said.

RacesOfValheim.cs referenced SvermConfig.StingerSE/StingerCdSE, which
war-vulture renamed to Ravager. Git merged those lines without a conflict
and the result did not compile; renamed.

Also in this commit:

- Factions on/off switches (FactionsConfig): "Faction truce" and "Faction
  merchants", both default on, both read live so they take effect without a
  restart. The truce gates its three postfixes; the merchants gate the
  Character.Awake setup plus every behavioural patch, so turning them off
  drops the prompt and the trade window on mobs already awake.

- SerpentMeat sells for 200 instead of 1 at the Fuling bench, moved to keep
  the list's ascending price order (the sell panel renders it as declared).

- DraughFoodPatches mapped "SerpentMeatRaw", which is not a prefab; the
  internal id is SerpentMeat, so serpent meat never cooked for a Draugh.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-25 18:52:10 +02:00

838 lines
57 KiB
C#

using UnityEngine;
using HarmonyLib;
using System.Text;
using System.Collections.Generic;
namespace RacesOfValheim
{
public static class RaceCompendium
{
private static readonly string[] RaceTitles = new string[]
{
"Aswid Secrets",
"Fenrir Secrets",
"Skadi Secrets",
"Skeleton Secrets",
"Furling Secrets",
"Trol Secrets",
"Draugh Secrets",
"Dvergar Secrets",
"Trenta Secrets",
"Sverm Secrets"
};
public static void UpdateCompendiumText(Player player)
{
if (player == null) return;
var knownTexts = HarmonyLib.Traverse.Create(player).Field("m_knownTexts").GetValue<Dictionary<string, string>>();
if (knownTexts == null) return;
// 1. Remove all old race texts to keep it clean
foreach (var title in RaceTitles)
{
if (knownTexts.ContainsKey(title))
{
knownTexts.Remove(title);
}
}
// 2. Determine current race
ZNetView nview = player.GetComponent<ZNetView>();
if (nview == null || !nview.IsValid()) return;
string currentRace = nview.GetZDO().GetString("RacesOfValheim_Race", "Human");
int state = BossProgressionManager.GetCurrentProgressionState();
if (currentRace == "Aswid")
{
GenerateAswidText(knownTexts, state);
}
else if (currentRace == "Fenrir")
{
GenerateFenrirText(knownTexts, state);
}
else if (currentRace == "Skadi")
{
GenerateSkadiText(knownTexts, state);
}
else if (currentRace == "Skeleton")
{
GenerateSkeletonText(knownTexts, state);
}
else if (currentRace == "Furling")
{
GenerateFurlingText(knownTexts, state, player);
}
else if (currentRace == "Trol")
{
GenerateTrolText(knownTexts, state, player);
}
else if (currentRace == "Draugh")
{
GenerateDraughText(knownTexts, state, player);
}
else if (currentRace == DvergarConfig.RaceId)
{
GenerateDvergarText(knownTexts, state);
}
else if (currentRace == TrentaConfig.RaceId)
{
GenerateTrentaText(knownTexts, state);
}
else if (currentRace == SvermConfig.RaceId)
{
GenerateSvermText(knownTexts, state);
}
// The War Vulture is not a racial power and does not belong inside any one race's
// generator: it is an item whose access list is a config entry. Appended here, once,
// to whichever page was just written - so adding a race to that list in Configuration
// Manager puts the paragraph on that race's page without a line of code changing.
AppendWarVulture(knownTexts, currentRace);
}
/// <summary>
/// The War Vulture's half-page, added to any race allowed to call the bird.
///
/// Asks WarVultureConfig instead of naming Furling and Dvergar, because the allowed list is
/// a config entry and a hard-coded pair would be wrong the moment anyone edits it. The
/// speeds are read the same way, so the page cannot promise a number the bird does not fly.
/// </summary>
private static void AppendWarVulture(Dictionary<string, string> knownTexts, string race)
{
// Before Bind runs there are no numbers to print. RaceAllowed already survives a null
// config; the speeds below would not.
if (WarVultureConfig.CruiseSpeed == null) return;
if (!WarVultureConfig.RaceAllowed(race)) return;
string key = race + " Secrets";
if (!knownTexts.TryGetValue(key, out string page)) return;
StringBuilder sb = new StringBuilder(page);
sb.AppendLine("\n-- THE WAR VULTURE --\n");
sb.AppendLine("A vulture's head kept on a stick, and the bird answers to it. Raise it and the vulture comes back under you. Raise it again and it carries you down, deaf to you until the ground arrives - and a third time lets go of it where you are.\n");
sb.AppendLine($"It goes where you look, and it goes as long as you care to stay up: {WarVultureConfig.CruiseSpeed.Value:0.#} meters a second costs it nothing at all. Hold your run key and it gives you {WarVultureConfig.SprintSpeed.Value:0.#} for {WarVultureConfig.SprintSeconds.Value:0} seconds and not a moment longer - there is only so much haste in a bird. Let go and the wind comes back into it in {WarVultureConfig.RechargeSeconds.Value:0} seconds, in the air. You never have to land for it.\n");
if (WarVultureConfig.ShowStaminaBar.Value)
sb.AppendLine("What the bird has left is the bar under your own.\n");
knownTexts[key] = sb.ToString();
}
/// <summary>
/// The Sverm's entry, in two halves because the race is two halves: a body that grows on its
/// own, and a colony that has to be built. Figures are read from the live rules and from the
/// colony's own tables rather than restated, so the page cannot drift from the code.
/// </summary>
private static void GenerateSvermText(Dictionary<string, string> knownTexts, int state)
{
SvermProgression.SvermRules rules = SvermProgression.GetRules(state);
StringBuilder sb = new StringBuilder();
sb.AppendLine("The Sverm's Colony\n");
sb.AppendLine("[Base Passive] Chitin Plating: You do not dress. Chest, legs and helm are carapace and never come off, and at every tier they are worth the full set of the biome ahead of you - at its best quality, weightless, and without the slowness that armour costs anyone else. Cloak and trinket are the only things you may still wear.\n");
sb.AppendLine($"[Base Passive] Toxin Immunity: Poison cannot touch you. What can is the club and the torch: you take {rules.BluntWeakness * 100f:0}% more from blunt blows{(rules.FireWeakness > 0f ? $" and {rules.FireWeakness * 100f:0}% more from fire" : ", and fire has stopped being a weakness")}.\n");
sb.AppendLine("[Base Passive] Hive Pheromones: No invertebrate will attack you - not leeches, not ticks, not deathsquitos, not seekers, not the bees. Bonemass is not an insect and does not care.\n");
sb.AppendLine("[Base Passive] Insect Metabolism: You eat everything anyone else eats, and honey is worth double to you. Alchemical blood is the one thing you will not swallow.\n");
sb.AppendLine($"[Base Passive] Chitin Claws: Your hands are the weapon. Bare-handed blows land at {rules.ClawDamagePercent * 100f:0}% of the claws' full weight, and they cannot be taken from you - draw a sword and they wait, sheathe it and they are back.\n");
if (rules.MetabolicSurge)
sb.AppendLine("[Eikthyr Unlock] Metabolic Surge: Running and jumping cost you less, and you jump higher.\n");
if (rules.CarryWeightBonus > 0f)
sb.AppendLine($"[Eikthyr Unlock] Ventral Pouches: You carry {rules.CarryWeightBonus:0} more.\n");
if (rules.SeedsEdible)
sb.AppendLine("[Elder Unlock] Grinding Mandibles: Seeds are food. Raw nourishment and nothing more - the garden's blessings belong to somebody else.\n");
if (rules.SensoryAntennae)
sb.AppendLine("[Elder Unlock] Sensory Antennae: You feel what lives around you, through stone and through soil.\n");
if (rules.VenomOnHit > 0f)
sb.AppendLine($"[Bonemass Unlock] Venom Glands: Every blow you land carries +{rules.VenomOnHit:0.#} poison.\n");
if (rules.AcidHemolymph > 0f)
sb.AppendLine($"[Bonemass Unlock] Acid Hemolymph: Whoever strikes you in melee takes {rules.AcidHemolymph:0.#} poison back for the trouble.\n");
if (rules.FallDamageModifier <= 0f)
sb.AppendLine("[Moder Unlock] Vestigial Wings: Small wings, and no ground hard enough to hurt you.\n");
if (rules.RavagerForm)
sb.AppendLine($"[Yagluth Unlock] Ravager Strain ('{SvermConfigManagement.RavagerKey.Value}' Key): Become a Seeker Brute. The claws still fight, the carapace is worth double, and nothing about it flies. It is how you hold a fight, not how you leave one.\n");
if (rules.BodyScale > 1f)
sb.AppendLine("[Queen Unlock] Surrenal Glands: You stand a tenth larger, and the carapace takes its greatest leap.\n");
if (rules.CarapaceRegenPerSecond > 0f)
sb.AppendLine($"[Fader Unlock] Carapace Regeneration: You knit yourself back together, {rules.CarapaceRegenPerSecond:0.##} health a second, always.\n");
if (rules.Emberform)
sb.AppendLine("[Fader Unlock] Annealed Chitin and Emberform: Eight tiers of burning have turned the flaw into armour - fire no longer hurts you, and the chitin goes black with a red heat under it.\n");
// ── The colony
sb.AppendLine("\n-- THE COLONY --\n");
if (state < SvermConfig.HiveUnlockState)
{
sb.AppendLine("The colony will not wake until the Elder falls. Until then you are a body, and the body is enough.\n");
}
else
{
sb.AppendLine($"Brood Mound (Hammer): Your nest, and no more than two of them may stand within {SvermConfig.HiveDensityRadius:0} meters of each other. Press it, or the hive at its foot, to feed it a whole stack out of your pack: any food, any wood, any resin. Honey and royal jelly are medicine now and it will not take them.\n");
sb.AppendLine($"Digestion: what you feed it is not yours to spend yet. It seeps into the nest's bank at {SvermConfigManagement.DigestRate:0.#} a second, and only what has arrived can be spent.\n");
sb.AppendLine($"Brood Eggs: the nest lays one every {SvermConfig.EggInterval:0} seconds and holds {SvermConfig.EggCapBase + 1} of them at its first stage, one more at each stage after. Every troop costs an egg as well as biomass - the egg grows back, the biomass does not.\n");
sb.AppendLine("Hive Market (Hammer): a counter raised within ten meters of a nest. Everything the colony buys is bought here, out of that nest's bank.\n");
sb.AppendLine($"Growth: {SvermHiveStage.NameOf(2)} {SvermHiveStage.PriceToLeave(1):0}, {SvermHiveStage.NameOf(3)} {SvermHiveStage.PriceToLeave(2):0}, {SvermHiveStage.NameOf(4)} {SvermHiveStage.PriceToLeave(3):0}. Each one costs that stage's whole tankful and opens the next rung of the roster.\n");
StringBuilder roster = new StringBuilder();
foreach (SvermBrood.Kind kind in SvermBrood.Roster)
{
roster.Append($"{kind.Display} {kind.Price:0} (from {SvermHiveStage.NameOf(kind.Stage)}, at most {kind.Cap}). ");
}
sb.AppendLine($"Troops: {roster}They follow when you ask, walk home when you let them go, and mend themselves.\n");
string haulers = state >= SvermConfig.HaulerUnlockState
? $", and up to {SvermConfigManagement.Haulers} haulers come out of the nest to carry food back into it"
: ", and the haulers who carry food back into it will not hatch until Bonemass falls";
sb.AppendLine($"Seeker Workers: free, and always free - no biomass, no egg, and a new one when an old one dies. Two trades that never share hands: up to {SvermConfigManagement.Farmers} farmers come out of the infected beehives to work the ground{haulers}. They are half a Seeker in size, in health and in reach, they take no orders and they never follow - they stay where they were born and defend what stands there.\n");
sb.AppendLine($"Blister Tick {SvermConfig.TickPrice:0}: buys a slot forever. It runs at what you are fighting and bursts, and the nest grows another one {SvermConfig.TickRespawnSeconds:0} seconds later, free.\n");
sb.AppendLine("Surrenal Glands 800 and Hyperplasia 1600: everything hatched after them is born with one star, then two.\n");
sb.AppendLine($"The beehives: raise vanilla hives inside the nest's ten meters and the colony takes them over after a minute - twice the speed, three times the honey, and royal jelly instead once Yagluth is down. Press honey or royal jelly on one of your own insects to heal it: {SvermConfig.HoneyHealing:0} and {SvermConfig.RoyalJellyHealing:0}.\n");
}
knownTexts["Sverm Secrets"] = sb.ToString();
}
/// <summary>
/// Reads its figures straight out of the live rules rather than restating them, so the
/// entry cannot drift from the code the way a hand-written percentage would. One prose
/// figure had already drifted before this pass: the height reduction was hand-written as
/// "a third shorter", left over from when DvergarConfig.VisualScale was 0.70 (-30%) - the
/// comment on that field says it was "nudged up" to 0.78 (-22%) once it read too small on
/// screen, and the compendium line was never updated to follow. Reads the live scale now.
/// </summary>
private static void GenerateDvergarText(Dictionary<string, string> knownTexts, int state)
{
DvergarProgression.DvergarRules rules = DvergarProgression.GetRules(state);
int heightReductionPercent = Mathf.RoundToInt((1f - DvergarConfig.VisualScale) * 100f);
StringBuilder sb = new StringBuilder();
sb.AppendLine("The Dvergar's Craft\n");
sb.AppendLine($"[Base Passive] Small and Stubborn: You stand {heightReductionPercent}% shorter than a human and carry {rules.HealthMalus:0.#} less health for it. The dvergr hood never leaves your head - wear whatever helm you please and keep every point of its protection, but the runes will always show you as one of the deep folk.\n");
sb.AppendLine($"[Base Passive] Runic Spark: The runes in your blood earth themselves through whatever you strike. Every blow you land carries +{rules.ElementalDamage:0.#} Lightning damage - a bonus that grows as each boss falls.\n");
List<string> weapons = new List<string>();
foreach (DvergarConfig.WeaponAffinity affinity in rules.Affinities)
{
weapons.Add(affinity.DisplayName);
}
if (weapons.Count > 0)
{
sb.AppendLine($"Weapon Affinity (Passive): {string.Join(", ", weapons.ToArray())}. Blows struck with these land harder and cost less stamina. The saving never grows - a tier only ever hands you another weapon to feel at home with - and your skill rises no faster than anyone else's.\n");
}
if (rules.MiningAffinity)
sb.AppendLine("[Eikthyr Unlock] Mining Affinity (Passive): The pickaxe answers to you. Veins break faster, cost you less stamina to work, and sometimes give up more than they should.\n");
if (rules.SmithingDiscount > 0f)
sb.AppendLine($"[Bonemass Unlock] Smithing and Jewelry (Passive): You waste nothing at the anvil. Metal and gems cost you {rules.SmithingDiscount * 100f:0}% less when crafting and upgrading.\n");
if (rules.TraderBuyDiscount > 0f || rules.TraderSellBonus > 0f)
sb.AppendLine($"[Bonemass Unlock] Kin of the Traders (Passive): Haldor and Hildir know their own. Their prices drop by {rules.TraderBuyDiscount * 100f:0}% for you, and what they pay for your trophies and hunting rewards rises by {rules.TraderSellBonus * 100f:0}%.\n");
if (rules.RunicPing)
sb.AppendLine($"[Yagluth Unlock] Runic Ping ('{DvergarConfigManagement.RunicPingKey.Value}' Key): Spend {DvergarConfig.RunicPingEitrCost:0} eitr to send a pulse through the stone. For {DvergarConfig.RunicPingDuration:0} seconds every ore vein and every hidden enemy within {DvergarConfig.RunicPingRadius:0} meters is lit for you alone.\n");
if (rules.RunicOvercharge)
sb.AppendLine($"[Fader Unlock] Runic Overcharge ('{DvergarConfigManagement.RunicOverchargeKey.Value}' Key): Spend {DvergarConfig.RunicOverchargeEitrCost:0} eitr to load the runes. Your next blow with a favoured weapon lands with {DvergarConfig.RunicOverchargeMultiplier:0}x its weight. Hold the charge no longer than {DvergarConfig.RunicOverchargeWindow:0} seconds or it bleeds away.\n");
knownTexts["Dvergar Secrets"] = sb.ToString();
}
/// <summary>
/// Rewritten off the live DraughConfig values, the way Fenrir's and Aswid's entries are.
/// The base passive claimed innate Poison resistance that Draugh_Damage_Patch never
/// grants at tier 1 - the real always-on modifiers are 20% Physical resistance and 50%
/// extra Fire/Spirit damage taken, plus the infinite stamina Draugh shares with Skeleton
/// and Aswid (Player_UseStamina_Patch) - none of which appeared here. "Slowly We Rot"
/// claimed Wet immunity and faster swimming that SE_Wet_Setup_Patch does not grant; it
/// only flips Wet's health regen positive and drops its stamina penalty. "Flesh and the
/// Power It Holds" invented a "Corpse Run buff" that appears nowhere in the codebase and
/// described Human Meat as a kill drop from humanoid enemies, when Draugh_DeathAura_Patch
/// actually drops it from any player dying near a Draugh - and the real tier 4 unlock
/// (Poison Immunity, a stagger crit bonus, no skill drain on death) was missing entirely.
/// Tier 5 never mentioned Frost Immunity, which Draugh_Damage_Patch also grants at that
/// tier alongside the frost nova on parry. Also given the "[Boss Unlock]" tier headers
/// every other race's entry uses, which this one never had.
/// </summary>
private static void GenerateDraughText(Dictionary<string, string> knownTexts, int state, Player player)
{
int physResistPercent = Mathf.RoundToInt((1f - DraughConfig.PhysicalResistMultiplier.Value) * 100f);
int fireSpiritWeakPercent = Mathf.RoundToInt((DraughConfig.FireSpiritWeaknessMultiplier.Value - 1f) * 100f);
int wetRegenPercent = Mathf.RoundToInt((DraughConfig.WetHealthRegenMultiplier.Value - 1f) * 100f);
int poisonOnHitPercent = Mathf.RoundToInt(DraughConfig.PoisonOnHitPercent.Value * 100f);
int poisonSplashDamage = Mathf.RoundToInt(DraughConfig.PoisonSplashDamage.Value);
int staggerCritPercent = Mathf.RoundToInt((DraughConfig.StaggerCritMultiplier.Value - 1f) * 100f);
int deathAuraRadius = Mathf.RoundToInt(DraughConfig.DeathAuraRadius.Value);
int northWindCooldown = Mathf.RoundToInt(DraughConfig.NorthWindCooldown.Value);
int northWindRadius = Mathf.RoundToInt(DraughConfig.NorthWindRadius.Value);
int northWindDamage = Mathf.RoundToInt(DraughConfig.NorthWindFrostDamage.Value);
int undyingCooldownMinutes = Mathf.RoundToInt(DraughConfig.UndyingWillCooldown.Value / 60f);
int eitrDrainPerSecond = Mathf.RoundToInt(DraughConfig.UndyingWillEitrDrainPerTick.Value / DraughConfig.UndyingWillTickInterval.Value);
int swarmCount = DraughConfig.SwarmSpawnCount.Value;
int swarmCooldown = Mathf.RoundToInt(DraughConfig.SwarmSpawnCooldown.Value);
int stealBreathHealPercent = Mathf.RoundToInt(DraughConfig.StealBreathHealPercent.Value * 100f);
StringBuilder sb = new StringBuilder();
sb.AppendLine("The Draugh's Awakening\n");
sb.AppendLine($"[Base Passive] Born Dead, Buried Alive: You take {physResistPercent}% less Physical (blunt/slash/pierce) damage, but Fire and Spirit strike you {fireSpiritWeakPercent}% harder. Skeletons, draugr, ghosts and wraiths no longer see you as prey. Your digestive system adapts to death, allowing you to consume raw and rotten meat (neck tail, raw meat, entrails, blood, etc.) - proper cooked food and berries disgust you and cannot be eaten.\n");
if (state >= 2)
sb.AppendLine($"[Eikthyr Unlock] Slowly We Rot (Passive): Being Wet no longer saps your stamina regeneration, and it heals rather than does nothing for you - your health regenerates {wetRegenPercent}% faster while wet or swimming.\n");
if (state >= 3)
sb.AppendLine($"[The Elder Unlock] Rotting Edge (Passive/Parry): Your physical attacks are laced with the swamp's decay, adding poison damage worth {poisonOnHitPercent}% of the physical harm you deal. A successful parry also splashes {poisonSplashDamage} poison damage onto whoever you parried.\n");
if (state >= 4)
sb.AppendLine($"[Bonemass Unlock] Undead Fortitude (Passive): Poison can no longer touch you at all. Striking a staggered enemy deals {staggerCritPercent}% more physical damage, and death no longer costs you skill experience. Should any player die within {deathAuraRadius}m of you, their fall leaves Human Meat behind - flesh only a Draugh can stomach.\n");
if (state >= 5)
sb.AppendLine($"[Moder Unlock] Grave Chill (Passive/Parry): Frost can no longer touch you at all. A successful parry now also unleashes a freezing nova, dealing {northWindDamage} Frost damage and pushing back everything within {northWindRadius}m of you - the nova has its own {northWindCooldown} second cooldown, separate from Rotting Edge's poison splash, which still fires on every parry.\n");
if (state >= 6)
sb.AppendLine($"[Yagluth Unlock] Zombie Ritual (Passive Survival): When you take fatal damage, you do not die. Instead, you enter a ghostly state, immune to all damage, while your Eitr drains at {eitrDrainPerSecond} per second. If your Eitr hits zero before you are saved, you truly die. Once triggered, the ritual cannot save you again for {undyingCooldownMinutes} minutes.\n");
if (state >= 7)
sb.AppendLine($"[The Queen Unlock] Swarm of Terror (Retaliation): Whenever you are struck in melee combat, you automatically spawn {swarmCount} Seeker Broods to fight for you. They live for {DraughConfig.SwarmBroodLifetime.Value:0.#} seconds, with a {swarmCooldown} second cooldown between spawns.\n");
if (state >= 8)
sb.AppendLine($"[Fader Unlock] Steal Their Breath (Execution): While surviving in the Zombie Ritual's ghost state, scoring a killing blow on any enemy will instantly restore {stealBreathHealPercent}% of your maximum health, stop the Eitr drain, and save your life, bringing you fully back to the world of the living.\n");
knownTexts["Draugh Secrets"] = sb.ToString();
}
private static void GenerateTrolText(Dictionary<string, string> knownTexts, int state, Player player)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("The Trol's Heritage\n");
sb.AppendLine($"Base Passive: You are natively 20% larger than a human with immense strength. You have +200 Max Carry Weight, gain +3 Armor per boss defeated, and carry a 4th food slot from your very first meal - no boss required.\n");
// Written from the config so a retuned multiplier can't leave the compendium lying.
// It was missing outright, which made the Trol the only race whose one drawback was
// nowhere in its own entry - the Sverm and the Skeleton both name theirs.
sb.AppendLine($"Base Weakness - Kindling: Fire finds you where nothing else does. Every burn you take lands for {(TrolConfig.FireWeaknessMultiplier.Value - 1f) * 100f:0}% more than it would on anyone else, and no armor or resistance changes that.\n");
sb.AppendLine("Base Passive: Black Forest kin. Greydwarves, Fulings and Trolls have no quarrel with you and will not open a fight - though hitting one still buys you the answer you asked for.\n");
// These gates were each one tier early: BossProgressionManager starts at MinState = 1
// with NO boss down, so state 2 is Eikthyr and state 8 is Fader - which is what every
// other race's entry in this file uses, and what the Trol's own patches check. A fresh
// Trol was being promised the Eikthyr XP bonus before killing anything, then finding
// TrolSkillPatches (state >= 2) refusing it, and the same slip ran the whole ladder.
if (state >= 2)
sb.AppendLine("Eikthyr Defeated: Increased XP gain for physical labor and blunt combat (Clubs, Unarmed, Axes, Pickaxes, WoodCutting).\n");
if (state >= 3)
sb.AppendLine("The Elder Defeated: Unlocked Rock Throwing ability. +10% passive health regeneration.\n");
if (state >= 4)
sb.AppendLine("Bonemass Defeated: +5% Size, +50 Carry Weight, +10 Damage to Clubs/Unarmed/Axes, +10 Rock Throwing Damage.\n");
if (state >= 5)
sb.AppendLine("Moder Defeated: Unlocked True Form (Transformation ability).\n");
if (state >= 6)
sb.AppendLine("Yagluth Defeated: +5% Size, +50 Carry Weight, +5 Damage to Clubs/Unarmed/Axes, +5 Rock Throwing Damage. Unlocked 5th Food Slot.\n");
if (state >= 7)
sb.AppendLine("The Queen Defeated: Unlocked Log Weapon (in True Form, interact with trees to wield them as weapons). True Form size is massively increased.\n");
if (state >= 8)
sb.AppendLine("Fader Defeated: Your wielded trees can now instantly smash through the toughest materials in the Ashlands.\n");
knownTexts["Trol Secrets"] = sb.ToString();
}
/// <summary>
/// Rewritten off the live AswidConfig/AswidProgression values, the way Fenrir's and Skadi's
/// entries are. The old text invented a Jump Bonus Per State that doesn't exist (jump actually
/// rides the same SpeedBonusPerState as move speed, in AswidStatusEffects.UpdateStats), used
/// state*3/state*5 multipliers that don't match ArmorBonusPerState=1/DamageBonusPerState=2, and
/// described the Vampiric Aura as a shield-block channel in bat/mist form only - it is actually
/// passive and always-on in every form (AswidRace.HandleVampiricAura), toggled with 'I'. Bat
/// Form, Eclipse, and Tame were missing entirely.
/// </summary>
private static void GenerateAswidText(Dictionary<string, string> knownTexts, int state)
{
int arm = Mathf.RoundToInt(AswidConfig.ArmorBonusPerState.Value * state);
int dmg = Mathf.RoundToInt(AswidConfig.DamageBonusPerState.Value * state);
int spd = Mathf.RoundToInt(AswidConfig.SpeedBonusPerState.Value * state * 100f);
int lifesteal = state * 2;
int auraRadiusDay = Mathf.RoundToInt(AswidConfig.AuraRadiusDay.Value);
int auraRadiusNight = Mathf.RoundToInt(AswidConfig.AuraRadiusNight.Value);
int auraExecute = Mathf.RoundToInt(AswidConfig.AuraExecuteThreshold.Value * 100f);
int sensesRadius = Mathf.RoundToInt(AswidConfig.SensesRadius.Value);
int eclipseCooldownMin = Mathf.RoundToInt(AswidConfig.EclipseCooldown.Value / 60f);
int eclipseDuration = Mathf.RoundToInt(AswidConfig.EclipseDuration.Value);
int enslaveCooldownMin = Mathf.RoundToInt(AswidConfig.EnslaveCooldown.Value / 60f);
int thrallLifetime = Mathf.RoundToInt(AswidConfig.ThrallLifetime.Value);
int surtlingDmg = Mathf.RoundToInt(AswidConfig.SurtlingFormDamageBonus.Value);
StringBuilder sb = new StringBuilder();
sb.AppendLine("The Aswid's Curse\n");
sb.AppendLine("[Base Passive] Benedictus et Afflictus:");
sb.AppendLine($"You take no fall damage, and physical kills automatically devour edible enemies (Vae Victis) for Blood Magic XP. Your physical stats scale with every boss you defeat: +{arm} Armor, +{dmg} Damage, +{spd}% Speed and Jump, and +{lifesteal}% Lifesteal on physical hits. All of these bonuses double during the night. You can cast Blood Magic items with infinite Eitr, and your Blood Magic skill rises {AswidConfig.BloodMagicSkillGainMultiplier.Value:0.#}x as fast.\n");
sb.AppendLine("Vampiric Aura (Passive, [I] to toggle):");
sb.AppendLine($"Always active, in every form, with no key to hold - only the on/off toggle. Drains a {auraRadiusDay}m radius by day, {auraRadiusNight}m by night, for magic damage that scales with your Blood Magic skill, healing you for the damage dealt. Enemies at or below {auraExecute}% health are executed outright. The aura hits for half in human form, full as a Bat, and double as Mist. It cannot tell traders from monsters, so switch it off with [I] before talking to Haldor or Hildir.\n");
// The live figure, so the entry cannot drift from the code: it is the same yardstick
// the Sverm's own claws are measured against, which is what keeps the three races even.
sb.AppendLine($"[Base Passive] Claws of the Beast ([K], {RaceClawsConfig.DurationSeconds.Value:0}s): Grows blackened claws for a limited time instead of a weapon. Bare-handed blows land at {SvermClaws.GetDamagePercent(state) * 100f:0}% of a full-grown pair's weight, all of it as slash, and they grow with every boss that falls. Draw a sword and they wait, sheathe it and they are back, until the timer runs out and they retract on their own - no slot wasted between casts. They cannot be dropped, traded or stolen while grown - and in bat or mist form you have no hands to hold them with.\n");
if (state >= 2)
sb.AppendLine("[Eikthyr Unlock] Bat Form ('G' Key, night only): Take the shape of a bat.\n");
if (state >= 2)
sb.AppendLine("[Eikthyr Unlock] Tame ('U' Key): Tame a boar under your cursor.\n");
if (state >= 3)
sb.AppendLine("[The Elder Unlock] Bat Form now answers by day as well as night.\n");
if (state >= 5)
{
sb.AppendLine("[Moder Unlock] Freezing Blood (Passive):");
sb.AppendLine("You gain permanent immunity to the Freezing status (mountains/snowstorms) and to Poison damage.\n");
sb.AppendLine("[Moder Unlock] Superhuman Senses (Passive):");
sb.AppendLine($"You sense every untamed creature within {sensesRadius}m, marking it with a telltale glow.\n");
sb.AppendLine("[Moder Unlock] Tame ('U' Key): Wolves join the huntable list.\n");
}
if (state >= 6)
{
sb.AppendLine("[Yagluth Unlock] Eclipse ('J' Key, day only):");
sb.AppendLine($"A {AswidConfig.EclipseCastTime.Value:0.#}-second cast that forces the night to fall around you for {eclipseDuration} seconds, letting you claim your night-doubled bonuses under the sun. Fails silently if it is already night. {eclipseCooldownMin}-minute cooldown.\n");
sb.AppendLine("[Yagluth Unlock] Dominate (native Interact key):");
sb.AppendLine($"Target a non-tameable, non-boss enemy to dominate it for {thrallLifetime} seconds ({enslaveCooldownMin}-min cooldown). Dominated thralls fight alongside you and drop standard loot.\n");
sb.AppendLine("[Yagluth Unlock] Tame ('U' Key): Lox join the huntable list.\n");
}
if (state >= 7)
{
sb.AppendLine("[The Queen Unlock] Weight of Shadows ('H' Key, toggle):");
sb.AppendLine("You transform into an elusive mist. You become immune to physical (blunt/slash/pierce) and poison damage, and take no fall damage, but you cannot attack, run, or jump. Your Vampiric Aura deals double damage while mist. Sunrise breaks the transformation.\n");
}
if (state >= 8)
{
sb.AppendLine("[Fader Unlock] Asmund (Passive):");
sb.AppendLine($"Your hair and beard turn as dark as the abyss. You become 10% taller and gain a flat +{surtlingDmg} Physical Damage.\n");
sb.AppendLine("[Fader Unlock] Tame ('U' Key): Asksvin join the huntable list.\n");
}
knownTexts["Aswid Secrets"] = sb.ToString();
}
/// <summary>
/// This used to be a single hardcoded sentence, the same at every tier - the forms
/// themselves (Wolf/Ulv/Fenring/Cultist, each gated by its own day/night and tier rules in
/// FenrirProgression) never appeared here at all. Rewritten the way Skadi's entry is, off
/// the live FenrirConfig values so it cannot drift from what TryTransformWithRules actually
/// grants at each state.
/// </summary>
private static void GenerateFenrirText(Dictionary<string, string> knownTexts, int state)
{
int spd = Mathf.RoundToInt(FenrirConfig.SpeedBonusPerState.Value * state * 100f);
int jmp = Mathf.RoundToInt(FenrirConfig.JumpBonusPerState.Value * state * 100f);
int arm = Mathf.RoundToInt(FenrirConfig.ArmorBonusPerState.Value * state);
int dmg = Mathf.RoundToInt(FenrirConfig.DamageBonusPerState.Value * state);
int fall = Mathf.RoundToInt(-FenrirProgression.GetFallDamageModifier(state) * 100f);
StringBuilder sb = new StringBuilder();
sb.AppendLine("The Curse of the Pack\n");
sb.AppendLine($"[Base Passive] The Beast Within: Your physical stats scale with every boss you defeat: +{arm} Armor, +{dmg} Damage, +{spd}% Speed, +{jmp}% Jump, and -{fall}% Fall Damage.\n");
// The live figure, so the entry cannot drift from the code: the same yardstick the
// Sverm's own claws are measured against, which is what keeps the three races even.
sb.AppendLine($"[Base Passive] Cursed Claws ([K], {RaceClawsConfig.DurationSeconds.Value:0}s): The wolf's hands, kept on in the man's shape for a limited time instead of a weapon. Bare-handed blows land at {SvermClaws.GetDamagePercent(state) * 100f:0}% of a full-grown pair's weight, all of it as slash, and they grow with every boss that falls. Draw a sword and they wait, sheathe it and they are back, until the timer runs out and they retract on their own - no slot wasted between casts. They cannot be dropped, traded or stolen while grown - and in beast form the jaws do the work instead.\n");
if (state >= 3)
sb.AppendLine("[The Elder Unlock] Wolf Form ('G' Key, night only): Take the shape of a wolf. Faster and lighter on your feet, with three claw attacks of growing weight on Left, Right, and Middle Mouse.\n");
if (state >= 4)
{
sb.AppendLine("[Bonemass Unlock] Wolf Form now answers by day as well as night.\n");
sb.AppendLine("[Bonemass Unlock] Ulv Form ('H' Key, night only): A heavier wolf shape - stronger bite attacks, still bound to the dark.\n");
}
if (state >= 5)
{
sb.AppendLine("[Moder Unlock] 'G' now calls Ulv Form instead of Wolf, and answers by day as well as night.\n");
sb.AppendLine("[Moder Unlock] Fenring Form ('H' Key, night only): Stand as a true Fenring - heavy claws and a leaping strike, and the strongest of the four shapes so far.\n");
}
if (state >= 6)
sb.AppendLine("[Yagluth Unlock] Cultist Form ('J' Key, night only): A robed shape that claws and channels fire. Lasts 1 minute, 10-minute cooldown.\n");
if (state >= 7)
{
sb.AppendLine("[The Queen Unlock] Fenring Form now answers by day as well as night.\n");
sb.AppendLine("[The Queen Unlock] Cultist Form's cooldown falls to 5 minutes (still night only, still 1 minute).\n");
}
if (state >= 8)
sb.AppendLine("[Fader Unlock] Cultist Form now answers by day as well as night, and may be held as long as you wish.\n");
sb.AppendLine("Sunrise breaks any night-bound form early and leaves the beast too tired to change shape again for a short while after.\n");
knownTexts["Fenrir Secrets"] = sb.ToString();
}
private static void GenerateSkadiText(Dictionary<string, string> knownTexts, int state)
{
// Mirrors the live values so the entry cannot drift from the code: the frost bonus is
// SkadiDamagePatch's 2 per state, the spell figure SkadiRace's 15 + 8 per state.
int frostBonus = state * 2;
int spellDamage = 15 + 8 * state;
StringBuilder sb = new StringBuilder();
sb.AppendLine("The Secrets of Winter\n");
sb.AppendLine("[Base Passive] Ice Affinity:");
sb.AppendLine($"The cold cannot touch you, and frost answers to your hand. You are immune to the Cold status, take only half damage from frost, and every blow you land carries +{frostBonus} Frost damage - a bonus that grows as each boss falls.\n");
if (state >= 2)
{
sb.AppendLine("[Eikthyr Unlock] Cold Spell (Middle Mouse):");
sb.AppendLine($"Hurl a shard of ice at whatever you look upon, for {spellDamage} Frost damage. It draws on 20 stamina rather than eitr, so it serves you from your very first winter.\n");
}
if (state >= 3)
{
sb.AppendLine("[The Elder Unlock] Drake Form ('G' Key):");
sb.AppendLine("Take the shape of a frost drake. Right Mouse lifts you into flight: you glide wherever you aim, hold W to climb and gather speed, hold Shift with it to spend stamina on a burst of speed, and press S to beat backwards along your aim while your gaze stays where it was. Release everything and you hold level for five seconds before settling into a slow descent. Water cannot hold you - your wings drag you free of the sea as readily as they lift you from the shore. In this shape you cannot yet strike.\n");
}
if (state >= 4)
{
sb.AppendLine("[Bonemass Unlock] Winter's Welcome (Passive):");
sb.AppendLine("The killing gales of the mountains soften to a mere chill - you suffer Cold where others would freeze.\n");
sb.AppendLine("[Bonemass Unlock] Drake Breath (Left Mouse):");
sb.AppendLine("Your drake form may now spit ice at your enemies.\n");
}
if (state >= 5)
{
sb.AppendLine("[Moder Unlock] Moder Form ('H' Key):");
sb.AppendLine("Become the great frost dragon herself for 1 minute, then wait 10 before calling her again. Afoot, Left Mouse bites and claws for no cost at all, while Middle Mouse breathes a stream of ice. On the wing, Left Mouse looses a barrage of shards. Only the breath and the barrage draw upon eitr.\n");
}
if (state >= 6)
{
sb.AppendLine("[Yagluth Unlock] Heart of Winter (Passive):");
sb.AppendLine("Freezing can no longer reach you at all, and your eitr returns half again as fast.\n");
sb.AppendLine("[Yagluth Unlock] Improved Cold Spell:");
sb.AppendLine("Your Cold Spell scatters into ten shards, spreading its bite across all before you. The wider cast needs 4 seconds to gather itself.\n");
sb.AppendLine("Moder Form now answers you again after only 5 minutes.\n");
}
if (state >= 7)
{
sb.AppendLine("[The Queen Unlock] Winter Incarnate (Passive):");
sb.AppendLine("Frost cannot wound you at all, and a freezing aura bleeds from your skin, gnawing at every untamed creature within 3 meters.\n");
sb.AppendLine("Moder Form may now be held as long as you wish, with no wait between callings.\n");
}
if (state >= 8)
{
sb.AppendLine("[Fader Unlock] Skeleton Dragon Form ('J' Key):");
sb.AppendLine("The bones of a dragon rise at your call, wreathed in frost. It rends with bite and claw, sweeps all around it with a spinning tail (Right Mouse), and its breath carries thrice the fury of Moder's.\n");
}
// ── The station. Figures come from SkadiGolem's own constants, which are also what
// MayRaise enforces, so the page and the refusal message can never disagree.
sb.AppendLine("\n-- THE CRYSTAL GOLEM --\n");
if (state < SkadiGolem.ModerProgressionState)
{
sb.AppendLine("The tear is cold. Nothing wakes in the stone until the mountain's queen has fallen.\n");
}
else
{
sb.AppendLine($"Cut one at a stonecutter for a stone golem's trophy, {SkadiGolem.CrystalCost} crystal and a dragon tear. The stone answers to no one who is not Skadi, so what you raise is yours and stays yours.\n");
sb.AppendLine($"It is bound to the stonecutter that shaped it and may never leave the {SkadiGolem.LeashRange:0} meters around it - the same circle the station itself builds in. It cannot be named, cannot be ordered and will not follow you. It guards the stone that cut it, and that is the whole of what it does.\n");
sb.AppendLine($"One stonecutter holds {SkadiGolem.MaxPerStation} of them, and no more than {SkadiGolem.MaxInArea} may stand within a day's walk of each other. Break the stonecutter and what it cut goes still {SkadiGolem.WitherSeconds:0} seconds later.\n");
}
knownTexts["Skadi Secrets"] = sb.ToString();
}
/// <summary>
/// This was a one-line placeholder that returned the same sentence at every tier, which is
/// why players reported that "Skeleton Secrets never populates after bosses" - it was never
/// written, rather than broken. It now unfolds tier by tier with the real numbers, the way
/// the Skadi entry above does.
/// </summary>
private static void GenerateSkeletonText(Dictionary<string, string> knownTexts, int state)
{
var rules = SkeletonProgression.GetRules(state);
float health = SkeletonProgression.GetMaxHealthBonus(state);
int lifesteal = Mathf.RoundToInt(rules.LifestealPercent * 100f);
StringBuilder sb = new StringBuilder();
sb.AppendLine("The Secrets of the Crypt\n");
// Says out loud which tier the race thinks it is on. A player who has killed a boss and
// seen nothing change can read this line back and know immediately whether the tier
// failed to advance or the unlock itself is broken.
sb.AppendLine(state <= BossProgressionManager.MinState
? "You stand at the first of eight standings; no boss has yet fallen to your reckoning.\n"
: $"You stand at the {state} of eight standings, earned by the fall of {BossProgressionManager.GetBossNameForState(state)}.\n");
sb.AppendLine("[Base Passive] Undead Diet:");
sb.AppendLine($"No hunger moves you and no meal can help you - mortal food is nothing to dry bones. In its place the dead grow strong as their betters fall: you carry +{health:0} Maximum Health at your present standing. Nor does effort tire you; you have no stamina to spend at all.\n");
sb.AppendLine("[Base Passive] Bones and Blades:");
sb.AppendLine("Blades and points find little to cut in you and do half their work, but a hammer's weight finds everything, and hurts you the more for it.\n");
if (state >= 2)
{
sb.AppendLine("[Eikthyr Unlock] The Green Rot:");
sb.AppendLine($"Poison has nothing left to poison - it cannot touch you at all - and your bones take on its sickly cast. Every blow you land returns {lifesteal}% of what it deals in physical harm to your own frame.\n");
}
if (state >= 3)
{
sb.AppendLine("[The Elder Unlock] The First Blow:");
sb.AppendLine("The first strike out of the dark staggers whatever it lands upon. The dead may do this once every 5 seconds.\n");
}
if (state >= 4)
{
sb.AppendLine("[Bonemass Unlock] Rotten Touch:");
sb.AppendLine("What you strike, you sicken - every blow carries 20 Poison damage of its own.\n");
}
if (state >= 5)
{
sb.AppendLine("[Moder Unlock] Bones Alight:");
sb.AppendLine("Your frame is remade in a harder cast, and fire clings to it: everything near enough to feel it is scorched. Your wounds also close faster than bone has any right to.\n");
}
if (state >= 6)
{
sb.AppendLine("[Yagluth Unlock] Risen Again:");
sb.AppendLine("A killing blow no longer ends you. You are made whole where you stand - and then the dark magic must gather itself for 5 minutes before it will do so again.\n");
}
if (state >= 7)
{
sb.AppendLine("[The Queen Unlock] The Crypt Answers:");
sb.AppendLine($"Every enemy you put down rises to fight for you, up to {rules.MaxSummons} at your side at once.\n");
}
if (state >= 8)
{
sb.AppendLine("[Fader Unlock] A Host of Your Own:");
sb.AppendLine($"{rules.MaxSummons} of the dead now follow you, and {lifesteal}% of the harm you deal comes back as your own strength.\n");
}
knownTexts["Skeleton Secrets"] = sb.ToString();
}
/// <summary>
/// Was a placeholder ("will be revealed soon") with a mojibake dash baked into the base
/// passive text and only the tier 5-8 entries actually written - Master of Shadows (tier 2,
/// Eikthyr) and The Wickerman (tier 3, The Elder) were entirely missing, and Dance of the Dead
/// (tier 4, Bonemass) wasn't mentioned at all. Filled in from FurlingPatches.cs/FurlingConfig.cs.
/// </summary>
private static void GenerateFurlingText(Dictionary<string, string> knownTexts, int state, Player player)
{
int runSpeed = Mathf.RoundToInt(FurlingConfig.RunSpeedBonus.Value * 100f);
int weaponXp = Mathf.RoundToInt(FurlingConfig.WeaponSkillXPMultiplier.Value);
int noiseRange = Mathf.RoundToInt(FurlingConfig.StealthNoiseRangeThreshold.Value);
int fireResist = Mathf.RoundToInt((1f - FurlingConfig.WickermanFireResistMultiplier.Value) * 100f);
int poisonResist = Mathf.RoundToInt((1f - FurlingConfig.PoisonResistMultiplier.Value) * 100f);
int fireArrowDmg = Mathf.RoundToInt(FurlingConfig.FireArrowMinDamage.Value);
StringBuilder sb = new StringBuilder();
sb.AppendLine("The Secrets of the Hoard\n");
sb.AppendLine("[Base Passive] Combat Mastery:");
sb.AppendLine($"All weapon and combat skills gain {weaponXp}x XP permanently. You're short, but very fast - your movement speed is permanently increased by {runSpeed}%.\n");
if (state >= 2)
{
sb.AppendLine("[Eikthyr Unlock] Master of Shadows (Passive):");
sb.AppendLine($"Your footsteps and small movements no longer betray you - any noise you make within {noiseRange} meters goes unheard.\n");
}
if (state >= 3)
{
sb.AppendLine("[The Elder Unlock] The Wickerman (Passive):");
sb.AppendLine($"You take {fireResist}% less Fire damage and {poisonResist}% less Poison damage. Your arrows carry at least {fireArrowDmg} Fire damage of their own.\n");
}
if (state >= 4)
{
sb.AppendLine("[Bonemass Unlock] Dance of the Dead (Passive):");
sb.AppendLine("Every mead, potion, wine, bomb, or batch of ammunition you craft comes out doubled - one copy for the recipe, one for free.\n");
}
if (state >= 5)
{
int modelIndex = Traverse.Create(player.GetComponent<VisEquipment>()).Field<int>("m_modelIndex").Value;
string title = modelIndex == 1 ? "The Woman on the Silver Mountain" : "The Man on the Silver Mountain";
sb.AppendLine($"[Moder Unlock] {title} (Passive):");
sb.AppendLine("Whenever a normal enemy dies within 25 meters, its trophy drops are doubled and it drops guaranteed gold coins based on its stars. Furthermore, whenever you mine raw ore deposits, your yield is doubled.\n");
}
if (state >= 6)
{
int modelIndex = Traverse.Create(player.GetComponent<VisEquipment>()).Field<int>("m_modelIndex").Value;
string title = modelIndex == 1 ? "The King is Dead, Hail to the Queen" : "The King is Dead, Hail to the King";
sb.AppendLine($"[Yagluth Unlock] {title} (Passive):");
sb.AppendLine("While you are in the Plains biome, your 2x XP multiplier is extended to all non-combat skills (including Elemental Magic and Blood Magic).\n");
}
if (state >= 7)
{
int modelIndex = Traverse.Create(player.GetComponent<VisEquipment>()).Field<int>("m_modelIndex").Value;
string title = modelIndex == 1 ? "In the Mist She Was Standing" : "In the Mist He Was Standing";
sb.AppendLine($"[The Queen Unlock] {title} (Passive):");
sb.AppendLine("Blue foods (those that restore Eitr) last twice as long for you compared to normal players.\n");
}
if (state >= 8)
{
sb.AppendLine("[Fader Unlock] Through Fire and Flames (Passive):");
sb.AppendLine("You are permanently wreathed in flames. You are completely immune to fire damage. All your physical attacks (regardless of weapon or unarmed) set the target on fire.\n");
}
knownTexts["Furling Secrets"] = sb.ToString();
}
/// <summary>
/// The Trenta had no compendium entry at all - no title in RaceTitles, no branch in
/// UpdateCompendiumText, no method. Written from scratch off TrentaConfig/
/// TrentaConfigManagement's live values and the tier gates in TrentaAbilities.cs/
/// TrentaStatusEffects.cs/TrentaPatches.cs.
/// </summary>
private static void GenerateTrentaText(Dictionary<string, string> knownTexts, int state)
{
int stillness = Mathf.RoundToInt(TrentaConfig.PhotosynthesisStillnessSeconds);
int healTicks = TrentaConfig.PhotosynthesisHealSeconds;
int healPercent = Mathf.RoundToInt(TrentaConfig.PhotosynthesisHealPercentPerSecond * 100f);
int restMinutes = Mathf.RoundToInt(TrentaConfig.PhotosynthesisRestBaseMinutes +
TrentaConfig.PhotosynthesisRestMinutesPerBoss * (state - BossProgressionManager.MinState));
int foodDuration = Mathf.RoundToInt(TrentaConfig.FoodDurationMultiplier);
int purpleRainRadius = Mathf.RoundToInt(TrentaConfig.PurpleRainRadius);
int purpleRainHeal = Mathf.RoundToInt(TrentaConfig.PurpleRainHealAmount);
int purpleRainPoison = Mathf.RoundToInt(TrentaConfig.PurpleRainPoisonDamage);
int purpleRainCooldown = Mathf.RoundToInt(TrentaConfigManagement.PurpleRainCooldown.Value);
int purpleRainMuspellCooldown = Mathf.RoundToInt(TrentaConfigManagement.MuspellPurpleRainCooldown.Value);
int lastStandBonus = Mathf.RoundToInt(TrentaConfig.LastStandMaxArmorBonus * 100f);
int thornsPercent = Mathf.RoundToInt(TrentaConfig.ThornsReflectPercent * 100f);
int portalCooldownMin = Mathf.RoundToInt(TrentaConfig.PortalCooldown / 60f);
int portalLifetime = Mathf.RoundToInt(TrentaConfig.PortalLifetime);
int hornetsDamage = Mathf.RoundToInt(TrentaConfig.HornetsNestDamagePerTick);
int hornetsInterval = Mathf.RoundToInt(TrentaConfig.HornetsNestTickInterval);
int hornetsRadius = Mathf.RoundToInt(TrentaConfig.HornetsNestEngageRadius);
int muspellStompDamage = Mathf.RoundToInt(TrentaConfig.MuspellStompDamage);
int muspellSpikeDamage = Mathf.RoundToInt(TrentaConfig.MuspellSpikeDamage);
StringBuilder sb = new StringBuilder();
sb.AppendLine("The Secrets of the Heartwood\n");
sb.AppendLine("[Base Passive] Heartwood:");
sb.AppendLine("Sap and heartwood conduct lightning and turn away the dead: you take half damage from Lightning and Spirit. But kindling burns and the woodsman's axe still bites - you take half again as much from Fire and Slash. Meat, fish, eggs and honey are nothing you can stomach; only what grows from the ground sustains you, and it does so for " + foodDuration + "x as long as it would a normal body.\n");
sb.AppendLine("[Base Passive] Photosynthesis:");
sb.AppendLine($"Stand still in daylight, roof over nothing but sky, for {stillness} unbroken seconds, and roots take hold: {healTicks} ticks of healing follow, {healPercent}% of your maximum health apiece, along with a Rested buff lasting {restMinutes} minutes - longer with every boss you have felled.\n");
if (state >= TrentaConfig.EikthyrDefeatedState)
{
sb.AppendLine("[Eikthyr Unlock] Awakened Seeds (Passive):");
sb.AppendLine("Every seed, cone, acorn and self-seeding mushroom you carry has woken up. Eat one on the spot and it consumes itself for the strongest meal its home biome has to offer, health or eitr as the biome favors, instead of sitting idle as planting stock.\n");
}
if (state >= TrentaConfig.PurpleRainUnlockState)
{
sb.AppendLine("[The Elder Unlock] Purple Rain ('G' Key):");
sb.AppendLine($"A spray of toxic pollen bursts out to {purpleRainRadius} meters: every ally caught in it is healed {purpleRainHeal}, every foe is poisoned for {purpleRainPoison}. {purpleRainCooldown}-second cooldown, shortened to {purpleRainMuspellCooldown} seconds while transformed into Muspell.\n");
}
if (state >= TrentaConfig.BonemassDefeatedState)
{
sb.AppendLine("[Bonemass Unlock] Deep Roots (Passive):");
sb.AppendLine("The swamp has nothing left to spoil in you. Poison cannot touch you, the Wet effect cannot land on you, and swimming costs no stamina at all.\n");
}
if (state >= TrentaConfig.ModerDefeatedState)
{
sb.AppendLine("[Moder Unlock] Last Stand (Passive):");
sb.AppendLine($"The closer you come to falling, the harder your bark grows: your armor rises by up to {lastStandBonus}% as your health drops toward zero.\n");
sb.AppendLine("[Moder Unlock] Thorns (Passive):");
sb.AppendLine($"Every hit you take returns {thornsPercent}% of its damage to whoever landed it.\n");
}
if (state >= TrentaConfig.PortalUnlockState)
{
sb.AppendLine("[Yagluth Unlock] Homecoming Portal ('H' Key):");
sb.AppendLine($"Open a linked pair of portals - one where you stand, one at your respawn point - for anyone to walk through, no ore or item carried against them. They fade after {portalLifetime} seconds. {portalCooldownMin}-minute cooldown.\n");
}
if (state >= TrentaConfig.HornetsNestUnlockState)
{
sb.AppendLine("[The Queen Unlock] Hornet's Nest (Passive):");
sb.AppendLine($"A swarm of hornets has made its home in your branches and never leaves. Any foe that comes within {hornetsRadius} meters is stung for {hornetsDamage} poison and pierce damage every {hornetsInterval} seconds until it breaks off or falls.\n");
}
if (state >= TrentaConfig.MuspellUnlockState)
{
sb.AppendLine("[Fader Unlock] Muspell ('J' Key, toggle):");
sb.AppendLine($"Take the shape of a young Elder, root and bramble given fury. Left Mouse stomps the ground for {muspellStompDamage} damage in a ring around you, Right Mouse looses a root-spike that pierces for {muspellSpikeDamage} - both rising with your Unarmed skill. Purple Rain still answers your call while transformed, on its shorter cooldown.\n");
}
knownTexts["Trenta Secrets"] = sb.ToString();
}
}
[HarmonyPatch(typeof(TextsDialog), "Setup")]
public static class CompendiumSetup_Patch
{
public static void Prefix(Player player)
{
if (player != null)
{
RaceCompendium.UpdateCompendiumText(player);
}
}
}
}