RacesOfValheim/JotunnModStub/RaceCompendium.cs
kanym 83cd49c753 feat(aswid): devour feeds less health and some stamina
Devoured creatures feed 10% less health, and a share of it becomes
stamina: 60% for Meadows and Black Forest prey, 10% past them. Foods made
by the half-health formula are capped per biome, so a Troll no longer
feeds 150. The foods are rebuilt from their base values whenever a
setting changes or the server's values arrive.
2026-10-26 13:57:41 +01:00

911 lines
52 KiB
C#

using UnityEngine;
using HarmonyLib;
using System.Text;
using System.Collections.Generic;
namespace RacesOfValheim
{
public static class RaceCompendium
{
private static readonly string[] Races =
{
"Aswid", "Fenrir", "Skadi", "Skeleton", "Furling", "Trol", "Draugh", "Dvergar", "Trenta", "Sverm", "Alfar"
};
/// <summary>
/// A page's title. A token, which the game's Texts dialog localizes like the page itself.
///
/// It is also the page's key in m_knownTexts, and that dictionary is saved with the
/// character. Characters saved before the texts moved to translation files hold their
/// pages under the old English titles ("Aswid Secrets"), which is why UpdateCompendiumText
/// clears both forms.
/// </summary>
private static string PageKey(string race) => "$rov_compendium_" + race.ToLowerInvariant() + "_title";
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 (string race in Races)
{
knownTexts.Remove(PageKey(race));
knownTexts.Remove(race + " Secrets");
}
// 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);
}
else if (currentRace == AlfarConfig.RaceId)
{
GenerateAlfarText(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 = PageKey(race);
if (!knownTexts.TryGetValue(key, out string page)) return;
StringBuilder sb = new StringBuilder(page);
sb.AppendLine(ModText.Get("rov_compendium_warvulture_war_vulture"));
sb.AppendLine(ModText.Get("rov_compendium_warvulture_vulture_s_head_kept_stick"));
sb.AppendLine(ModText.Get("rov_compendium_warvulture_goes_where_look_goes_as", (WarVultureConfig.CruiseSpeed.Value).ToString("0.#"), (WarVultureConfig.SprintSpeed.Value).ToString("0.#"), (WarVultureConfig.SprintSeconds.Value).ToString("0"), (WarVultureConfig.RechargeSeconds.Value).ToString("0")));
if (WarVultureConfig.ShowStaminaBar.Value)
sb.AppendLine(ModText.Get("rov_compendium_warvulture_what_bird_has_left_bar"));
knownTexts[key] = sb.ToString();
}
/// <summary>
/// The Alfar's entry: what the body does, the powers as the bosses open them, and the Nexus.
/// Every number is read from the config, so the page cannot promise what the game does not do.
/// </summary>
private static void GenerateAlfarText(Dictionary<string, string> knownTexts, int state)
{
StringBuilder sb = new StringBuilder();
string F0(float v) => v.ToString("0");
string F1(float v) => v.ToString("0.#");
string Key(BepInEx.Configuration.ConfigEntry<BepInEx.Configuration.KeyboardShortcut> entry) => entry.Value.MainKey.ToString();
sb.AppendLine(ModText.Get("rov_compendium_alfar_the_alfar_light"));
sb.AppendLine(ModText.Get("rov_compendium_alfar_eitr_shield", F0(AlfarConfig.ShieldRate.Value * 100f), F1(AlfarConfig.ConductiveMultiplier.Value)));
sb.AppendLine(ModText.Get("rov_compendium_alfar_diet"));
sb.AppendLine(ModText.Get("rov_compendium_alfar_soft_fall"));
sb.AppendLine(ModText.Get("rov_compendium_alfar_levitation", F1(AlfarPowerConfig.LevitationCostPerSecond.Value)));
sb.AppendLine(ModText.Get("rov_compendium_alfar_heimkall", F0(AlfarConfig.HeimkallMinutes.Value), F0(AlfarConfig.HeimkallMinutesAfterYagluth.Value), F0(AlfarConfig.HeimkallMinutesAfterFader.Value), F0(AlfarConfig.HeimkallInvulnerableSeconds.Value)));
sb.AppendLine(ModText.Get("rov_compendium_alfar_powers"));
if (state >= AlfarPowerConfig.SkridState)
{
sb.AppendLine(ModText.Get("rov_compendium_alfar_skrid", Key(AlfarPowerConfig.SkridKey), F0(AlfarPowerConfig.SkridDistance.Value), F0(AlfarPowerConfig.SkridCooldown.Value)));
sb.AppendLine(ModText.Get("rov_compendium_alfar_grafvaettir", Key(AlfarPowerConfig.GrafvaettirKey), F0(AlfarPowerConfig.GrafSeconds.Value), AlfarPowerConfig.GrafStone.Value, AlfarPowerConfig.GrafFlint.Value, F0(AlfarPowerConfig.GrafCooldown.Value)));
}
if (state >= AlfarPowerConfig.UtsogState)
sb.AppendLine(ModText.Get("rov_compendium_alfar_utsog", F0(AlfarPowerConfig.UtsogPercent.Value)));
if (state >= AlfarPowerConfig.KallState)
sb.AppendLine(ModText.Get("rov_compendium_alfar_kall", Key(AlfarPowerConfig.KallKey), F0(AlfarPowerConfig.KallRadius.Value), F0(AlfarPowerConfig.KallCooldown.Value)));
if (state >= AlfarPowerConfig.LjosstormState)
sb.AppendLine(ModText.Get("rov_compendium_alfar_ljosstorm", Key(AlfarPowerConfig.LjosstormKey), F0(AlfarPowerConfig.StormRadius.Value), F0(AlfarPowerConfig.StormSeconds.Value), F0(AlfarPowerConfig.StormCooldown.Value)));
if (state >= AlfarPowerConfig.GeisliState)
sb.AppendLine(ModText.Get("rov_compendium_alfar_geisli", Key(AlfarPowerConfig.GeisliKey), F0(AlfarPowerConfig.BeamRange.Value), F0(AlfarPowerConfig.BeamMaxSeconds.Value)));
if (state >= AlfarPowerConfig.KyrrState)
sb.AppendLine(ModText.Get("rov_compendium_alfar_kyrr", Key(AlfarPowerConfig.KyrrKey), F0(AlfarPowerConfig.StasisSeconds.Value), F0(AlfarPowerConfig.StasisBossSeconds.Value)));
if (state >= AlfarPowerConfig.SameiningState)
sb.AppendLine(ModText.Get("rov_compendium_alfar_sameining", Key(AlfarPowerConfig.SameiningKey), F0(AlfarPowerConfig.ArchonThreshold.Value * 100f), F0(AlfarPowerConfig.ArchonSeconds.Value)));
if (state < AlfarPowerConfig.SameiningState)
sb.AppendLine(ModText.Get("rov_compendium_alfar_more_to_come"));
sb.AppendLine(ModText.Get("rov_compendium_alfar_nexus_title"));
sb.AppendLine(ModText.Get("rov_compendium_alfar_nexus", F0(AlfarNexusConfig.NexusRadius.Value), F1(AlfarNexusConfig.NexusDensityKm2.Value), AlfarNexusConfig.NexusBronze.Value));
sb.AppendLine(ModText.Get("rov_compendium_alfar_drones", AlfarNexusConfig.DroneCap.Value, AlfarNexusConfig.DroneBronze.Value));
sb.AppendLine(ModText.Get("rov_compendium_alfar_constructs", AlfarNexusConfig.NeistCap.Value, AlfarNexusConfig.EldingCap.Value, AlfarNexusConfig.SteinCap.Value));
sb.AppendLine(ModText.Get("rov_compendium_alfar_crystals", AlfarNexusConfig.CrystalCap.Value, AlfarNexusConfig.UpgradeCrystals.Value));
sb.AppendLine(ModText.Get("rov_compendium_alfar_ljosgard"));
sb.AppendLine(ModText.Get("rov_compendium_alfar_towers"));
knownTexts[PageKey("Alfar")] = 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(ModText.Get("rov_compendium_sverm_sverm_s_colony"));
sb.AppendLine(ModText.Get("rov_compendium_sverm_chitin_plating_do_not_dress"));
sb.AppendLine(rules.FireWeakness > 0f
? ModText.Get("rov_compendium_sverm_toxin_immunity_fire", (rules.BluntWeakness * 100f).ToString("0"), (rules.FireWeakness * 100f).ToString("0"))
: ModText.Get("rov_compendium_sverm_toxin_immunity_nofire", (rules.BluntWeakness * 100f).ToString("0")));
sb.AppendLine(ModText.Get("rov_compendium_sverm_hive_pheromones_no_invertebrate_will"));
sb.AppendLine(ModText.Get("rov_compendium_sverm_insect_metabolism_eat_everything_anyone"));
sb.AppendLine(ModText.Get("rov_compendium_sverm_chitin_claws_hands_are_weapon", (rules.ClawDamagePercent * 100f).ToString("0")));
if (rules.MetabolicSurge)
sb.AppendLine(ModText.Get("rov_compendium_sverm_metabolic_surge_running_jumping_cost"));
if (rules.CarryWeightBonus > 0f)
sb.AppendLine(ModText.Get("rov_compendium_sverm_ventral_pouches_carry_more", (rules.CarryWeightBonus).ToString("0")));
if (rules.SeedsEdible)
sb.AppendLine(ModText.Get("rov_compendium_sverm_grinding_mandibles_seeds_are_food"));
if (rules.SensoryAntennae)
sb.AppendLine(ModText.Get("rov_compendium_sverm_sensory_antennae_feel_what_lives"));
if (rules.VenomOnHit > 0f)
sb.AppendLine(ModText.Get("rov_compendium_sverm_venom_glands_every_blow_land", (rules.VenomOnHit).ToString("0.#")));
if (rules.AcidHemolymph > 0f)
sb.AppendLine(ModText.Get("rov_compendium_sverm_acid_hemolymph_whoever_strikes_melee", (rules.AcidHemolymph).ToString("0.#")));
if (rules.FallDamageModifier <= 0f)
sb.AppendLine(ModText.Get("rov_compendium_sverm_vestigial_wings_small_wings_no"));
if (rules.RavagerForm)
sb.AppendLine(ModText.Get("rov_compendium_sverm_ravager_strain_key_become_seeker", SvermConfigManagement.RavagerKey.Value));
if (rules.BodyScale > 1f)
sb.AppendLine(ModText.Get("rov_compendium_sverm_surrenal_glands_stand_tenth_larger"));
if (rules.CarapaceRegenPerSecond > 0f)
sb.AppendLine(ModText.Get("rov_compendium_sverm_carapace_regeneration_knit_yourself_back", (rules.CarapaceRegenPerSecond).ToString("0.##")));
if (rules.Emberform)
sb.AppendLine(ModText.Get("rov_compendium_sverm_annealed_chitin_emberform_eight_tiers"));
// ── The colony
sb.AppendLine(ModText.Get("rov_compendium_sverm_colony"));
if (state < SvermConfig.HiveUnlockState)
{
sb.AppendLine(ModText.Get("rov_compendium_sverm_colony_will_not_wake_until"));
}
else
{
sb.AppendLine(ModText.Get("rov_compendium_sverm_brood_mound_hammer_nest_no", SvermConfigManagement.NestMax, (SvermConfigManagement.NestRadius).ToString("0")));
sb.AppendLine(ModText.Get("rov_compendium_sverm_digestion_what_feed_not_yours", (SvermConfigManagement.DigestRate).ToString("0.#")));
sb.AppendLine(ModText.Get("rov_compendium_sverm_brood_eggs_nest_lays_one", (SvermConfig.EggInterval).ToString("0"), SvermConfig.EggCapBase + 1));
sb.AppendLine(ModText.Get("rov_compendium_sverm_hive_market_hammer_counter_raised", (SvermConfigManagement.AuraRadius).ToString("0")));
sb.AppendLine(ModText.Get("rov_compendium_sverm_growth_each_one_costs_that", SvermHiveStage.NameOf(2), (SvermHiveStage.PriceToLeave(1)).ToString("0"), SvermHiveStage.NameOf(3), (SvermHiveStage.PriceToLeave(2)).ToString("0"), SvermHiveStage.NameOf(4), (SvermHiveStage.PriceToLeave(3)).ToString("0")));
StringBuilder roster = new StringBuilder();
foreach (SvermBrood.Kind kind in SvermBrood.Roster)
{
roster.Append(ModText.Get("rov_compendium_sverm_from_at_most", kind.Display, (kind.Price).ToString("0"), SvermHiveStage.NameOf(kind.Stage), kind.Cap));
}
sb.AppendLine(ModText.Get("rov_compendium_sverm_troops_they_follow_when_ask", roster));
string workers = state >= SvermConfig.HaulerUnlockState
? ModText.Get("rov_compendium_sverm_workers_up_to", SvermConfigManagement.Haulers)
: ModText.Get("rov_compendium_sverm_workers_none");
// The sigil by its in-game name, so the page says what the player actually has to put
// in the chest rather than a prefab name.
string sigil = ButlerConfig.SigilItem.Value;
UnityEngine.GameObject sigilPrefab = ObjectDB.instance != null ? ObjectDB.instance.GetItemPrefab(sigil) : null;
ItemDrop sigilDrop = sigilPrefab != null ? sigilPrefab.GetComponent<ItemDrop>() : null;
if (sigilDrop != null && sigilDrop.m_itemData?.m_shared != null && Localization.instance != null)
{
sigil = Localization.instance.Localize(sigilDrop.m_itemData.m_shared.m_name);
}
sb.AppendLine(ModText.Get("rov_compendium_sverm_seeker_workers_free_always_free", workers, sigil, (ButlerConfig.WorkRadius.Value).ToString("0")));
sb.AppendLine(ModText.Get("rov_compendium_sverm_blister_tick_buys_slot_forever", (SvermConfig.TickPrice).ToString("0"), (SvermConfig.TickRespawnSeconds).ToString("0")));
sb.AppendLine(ModText.Get("rov_compendium_sverm_surrenal_glands_hyperplasia_everything_hatched"));
sb.AppendLine(ModText.Get("rov_compendium_sverm_beehives_raise_vanilla_hives_inside", (SvermConfigManagement.AuraRadius).ToString("0"), SvermConfigManagement.Beehives, (SvermConfig.HoneyHealing).ToString("0"), (SvermConfig.RoyalJellyHealing).ToString("0")));
}
knownTexts[PageKey("Sverm")] = 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(ModText.Get("rov_compendium_dvergar_dvergar_s_craft"));
sb.AppendLine(ModText.Get("rov_compendium_dvergar_small_stubborn_stand_shorter_than", heightReductionPercent, (rules.HealthMalus).ToString("0.#")));
sb.AppendLine(ModText.Get("rov_compendium_dvergar_runic_spark_runes_blood_earth", (rules.ElementalDamage).ToString("0.#")));
List<string> weapons = new List<string>();
foreach (DvergarConfig.WeaponAffinity affinity in rules.Affinities)
{
weapons.Add(affinity.DisplayName);
}
if (weapons.Count > 0)
{
sb.AppendLine(ModText.Get("rov_compendium_dvergar_weapon_affinity_passive_blows_struck", string.Join(", ", weapons.ToArray())));
}
if (rules.MiningAffinity)
sb.AppendLine(ModText.Get("rov_compendium_dvergar_mining_affinity_passive_pickaxe_answers"));
if (rules.SmithingDiscount > 0f)
sb.AppendLine(ModText.Get("rov_compendium_dvergar_smithing_jewelry_passive_waste_nothing", (rules.SmithingDiscount * 100f).ToString("0")));
if (rules.TraderBuyDiscount > 0f || rules.TraderSellBonus > 0f)
sb.AppendLine(ModText.Get("rov_compendium_dvergar_kin_traders_passive_haldor_hildir", (rules.TraderBuyDiscount * 100f).ToString("0"), (rules.TraderSellBonus * 100f).ToString("0")));
if (rules.RunicPing)
sb.AppendLine(ModText.Get("rov_compendium_dvergar_runic_ping_key_spend_eitr", DvergarConfigManagement.RunicPingKey.Value, (DvergarConfig.RunicPingEitrCost).ToString("0"), (DvergarConfig.RunicPingDuration).ToString("0"), (DvergarConfig.RunicPingRadius).ToString("0")));
if (rules.RunicOvercharge)
sb.AppendLine(ModText.Get("rov_compendium_dvergar_runic_overcharge_key_spend_eitr", DvergarConfigManagement.RunicOverchargeKey.Value, (DvergarConfig.RunicOverchargeEitrCost).ToString("0"), (DvergarConfig.RunicOverchargeMultiplier).ToString("0"), (DvergarConfig.RunicOverchargeWindow).ToString("0")));
knownTexts[PageKey("Dvergar")] = 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(ModText.Get("rov_compendium_draugh_draugh_s_awakening"));
sb.AppendLine(ModText.Get("rov_compendium_draugh_born_dead_buried_alive_take", physResistPercent, fireSpiritWeakPercent));
if (state >= 2)
sb.AppendLine(ModText.Get("rov_compendium_draugh_slowly_we_rot_passive_being", wetRegenPercent));
if (state >= 3)
sb.AppendLine(ModText.Get("rov_compendium_draugh_rotting_edge_passive_parry_physical", poisonOnHitPercent, poisonSplashDamage));
if (state >= 4)
sb.AppendLine(ModText.Get("rov_compendium_draugh_undead_fortitude_passive_poison_can", staggerCritPercent, deathAuraRadius));
if (state >= 5)
sb.AppendLine(ModText.Get("rov_compendium_draugh_grave_chill_passive_parry_frost", northWindDamage, northWindRadius, northWindCooldown));
if (state >= 6)
sb.AppendLine(ModText.Get("rov_compendium_draugh_zombie_ritual_passive_survival_when", eitrDrainPerSecond, undyingCooldownMinutes));
if (state >= 7)
sb.AppendLine(ModText.Get("rov_compendium_draugh_swarm_terror_retaliation_whenever_are", swarmCount, (DraughConfig.SwarmBroodLifetime.Value).ToString("0.#"), swarmCooldown));
if (state >= 8)
sb.AppendLine(ModText.Get("rov_compendium_draugh_steal_their_breath_execution_while", stealBreathHealPercent));
knownTexts[PageKey("Draugh")] = sb.ToString();
}
private static void GenerateTrolText(Dictionary<string, string> knownTexts, int state, Player player)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine(ModText.Get("rov_compendium_trol_trol_s_heritage"));
sb.AppendLine(ModText.Get("rov_compendium_trol_base_passive_are_natively_larger"));
// 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(ModText.Get("rov_compendium_trol_base_weakness_kindling_fire_finds", ((TrolConfig.FireWeaknessMultiplier.Value - 1f) * 100f).ToString("0")));
sb.AppendLine(ModText.Get("rov_compendium_trol_base_passive_black_forest_kin"));
// 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(ModText.Get("rov_compendium_trol_eikthyr_defeated_increased_xp_gain"));
if (state >= 3)
sb.AppendLine(ModText.Get("rov_compendium_trol_elder_defeated_unlocked_rock_throwing"));
if (state >= 4)
sb.AppendLine(ModText.Get("rov_compendium_trol_bonemass_defeated_size_carry_weight"));
if (state >= 5)
sb.AppendLine(ModText.Get("rov_compendium_trol_moder_defeated_unlocked_true_form"));
if (state >= 6)
sb.AppendLine(ModText.Get("rov_compendium_trol_yagluth_defeated_size_carry_weight"));
if (state >= 7)
sb.AppendLine(ModText.Get("rov_compendium_trol_queen_defeated_unlocked_log_weapon"));
if (state >= 8)
sb.AppendLine(ModText.Get("rov_compendium_trol_fader_defeated_wielded_trees_can"));
knownTexts[PageKey("Trol")] = 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(ModText.Get("rov_compendium_aswid_aswid_s_curse"));
sb.AppendLine(ModText.Get("rov_compendium_aswid_benedictus_et_afflictus"));
sb.AppendLine(ModText.Get("rov_compendium_aswid_take_no_fall_damage_physical", arm, dmg, spd, lifesteal, (AswidConfig.BloodMagicSkillGainMultiplier.Value).ToString("0.#")));
sb.AppendLine(ModText.Get("rov_compendium_aswid_undead_vigor",
Mathf.RoundToInt(AswidRace.GetStaminaBonus(state)),
Mathf.RoundToInt(AswidConfig.StaminaBonusPerState.Value),
Mathf.RoundToInt(AswidConfig.StaminaCostMultiplier.Value * 100f)));
sb.AppendLine(ModText.Get("rov_compendium_aswid_devour_diet",
Mathf.RoundToInt(AswidConfig.DevourHealthMultiplier.Value * 100f),
Mathf.RoundToInt(AswidConfig.EarlyStaminaShare.Value * 100f),
Mathf.RoundToInt(AswidConfig.DevourStaminaShare.Value * 100f)));
sb.AppendLine(ModText.Get("rov_compendium_aswid_vampiric_aura_passive_toggle"));
sb.AppendLine(ModText.Get("rov_compendium_aswid_always_active_every_form_with", auraRadiusDay, auraRadiusNight, auraExecute));
// 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(ModText.Get("rov_compendium_aswid_claws_beast_s_grows_blackened", (RaceClawsConfig.DurationSeconds.Value).ToString("0"), (SvermClaws.GetDamagePercent(state) * 100f).ToString("0")));
if (state >= 2)
sb.AppendLine(ModText.Get("rov_compendium_aswid_bat_form_g_key_night"));
if (state >= 2)
sb.AppendLine(ModText.Get("rov_compendium_aswid_tame_u_key_tame_boar"));
if (state >= 3)
sb.AppendLine(ModText.Get("rov_compendium_aswid_bat_form_now_answers_by"));
if (state >= 5)
{
sb.AppendLine(ModText.Get("rov_compendium_aswid_freezing_blood_passive"));
sb.AppendLine(ModText.Get("rov_compendium_aswid_gain_permanent_immunity_freezing_status"));
sb.AppendLine(ModText.Get("rov_compendium_aswid_superhuman_senses_passive"));
sb.AppendLine(ModText.Get("rov_compendium_aswid_sense_every_untamed_creature_within", sensesRadius));
sb.AppendLine(ModText.Get("rov_compendium_aswid_tame_u_key_wolves_join"));
}
if (state >= 6)
{
sb.AppendLine(ModText.Get("rov_compendium_aswid_eclipse_j_key_day_only"));
sb.AppendLine(ModText.Get("rov_compendium_aswid_second_cast_that_forces_night", (AswidConfig.EclipseCastTime.Value).ToString("0.#"), eclipseDuration, eclipseCooldownMin));
sb.AppendLine(ModText.Get("rov_compendium_aswid_dominate_native_interact_key"));
sb.AppendLine(ModText.Get("rov_compendium_aswid_target_non_tameable_non_boss", thrallLifetime, enslaveCooldownMin));
sb.AppendLine(ModText.Get("rov_compendium_aswid_tame_u_key_lox_join"));
}
if (state >= 7)
{
sb.AppendLine(ModText.Get("rov_compendium_aswid_weight_shadows_h_key_toggle"));
sb.AppendLine(ModText.Get("rov_compendium_aswid_transform_into_elusive_mist_become"));
}
if (state >= 8)
{
sb.AppendLine(ModText.Get("rov_compendium_aswid_asmund_passive"));
sb.AppendLine(ModText.Get("rov_compendium_aswid_hair_beard_turn_as_dark", surtlingDmg));
sb.AppendLine(ModText.Get("rov_compendium_aswid_tame_u_key_asksvin_join"));
}
knownTexts[PageKey("Aswid")] = 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(ModText.Get("rov_compendium_fenrir_curse_pack"));
sb.AppendLine(ModText.Get("rov_compendium_fenrir_beast_within_physical_stats_scale", arm, dmg, spd, jmp, fall));
// 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(ModText.Get("rov_compendium_fenrir_cursed_claws_s_wolf_s", (RaceClawsConfig.DurationSeconds.Value).ToString("0"), (SvermClaws.GetDamagePercent(state) * 100f).ToString("0")));
if (state >= 3)
sb.AppendLine(ModText.Get("rov_compendium_fenrir_wolf_form_g_key_night"));
if (state >= 4)
{
sb.AppendLine(ModText.Get("rov_compendium_fenrir_wolf_form_now_answers_by"));
sb.AppendLine(ModText.Get("rov_compendium_fenrir_ulv_form_h_key_night"));
}
if (state >= 5)
{
sb.AppendLine(ModText.Get("rov_compendium_fenrir_g_now_calls_ulv_form"));
sb.AppendLine(ModText.Get("rov_compendium_fenrir_fenring_form_h_key_night"));
}
if (state >= 6)
sb.AppendLine(ModText.Get("rov_compendium_fenrir_cultist_form_j_key_night"));
if (state >= 7)
{
sb.AppendLine(ModText.Get("rov_compendium_fenrir_fenring_form_now_answers_by"));
sb.AppendLine(ModText.Get("rov_compendium_fenrir_cultist_form_s_cooldown_falls"));
}
if (state >= 8)
sb.AppendLine(ModText.Get("rov_compendium_fenrir_cultist_form_now_answers_by"));
sb.AppendLine(ModText.Get("rov_compendium_fenrir_sunrise_breaks_any_night_bound"));
knownTexts[PageKey("Fenrir")] = 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(ModText.Get("rov_compendium_skadi_secrets_winter"));
sb.AppendLine(ModText.Get("rov_compendium_skadi_ice_affinity"));
sb.AppendLine(ModText.Get("rov_compendium_skadi_cold_cannot_touch_frost_answers", frostBonus));
if (state >= 2)
{
sb.AppendLine(ModText.Get("rov_compendium_skadi_cold_spell_middle_mouse"));
sb.AppendLine(ModText.Get("rov_compendium_skadi_hurl_shard_ice_at_whatever", spellDamage));
}
if (state >= 3)
{
sb.AppendLine(ModText.Get("rov_compendium_skadi_drake_form_g_key"));
sb.AppendLine(ModText.Get("rov_compendium_skadi_take_shape_frost_drake_right"));
}
if (state >= 4)
{
sb.AppendLine(ModText.Get("rov_compendium_skadi_winter_s_welcome_passive"));
sb.AppendLine(ModText.Get("rov_compendium_skadi_killing_gales_mountains_soften_mere"));
sb.AppendLine(ModText.Get("rov_compendium_skadi_drake_breath_left_mouse"));
sb.AppendLine(ModText.Get("rov_compendium_skadi_drake_form_may_now_spit"));
}
if (state >= 5)
{
sb.AppendLine(ModText.Get("rov_compendium_skadi_moder_form_h_key"));
sb.AppendLine(ModText.Get("rov_compendium_skadi_become_great_frost_dragon_herself"));
}
if (state >= 6)
{
sb.AppendLine(ModText.Get("rov_compendium_skadi_heart_winter_passive"));
sb.AppendLine(ModText.Get("rov_compendium_skadi_freezing_can_no_longer_reach"));
sb.AppendLine(ModText.Get("rov_compendium_skadi_improved_cold_spell"));
sb.AppendLine(ModText.Get("rov_compendium_skadi_cold_spell_scatters_into_ten"));
sb.AppendLine(ModText.Get("rov_compendium_skadi_moder_form_now_answers_again"));
}
if (state >= 7)
{
sb.AppendLine(ModText.Get("rov_compendium_skadi_winter_incarnate_passive"));
sb.AppendLine(ModText.Get("rov_compendium_skadi_frost_cannot_wound_at_all"));
sb.AppendLine(ModText.Get("rov_compendium_skadi_moder_form_may_now_held"));
}
if (state >= 8)
{
sb.AppendLine(ModText.Get("rov_compendium_skadi_skeleton_dragon_form_j_key"));
sb.AppendLine(ModText.Get("rov_compendium_skadi_bones_dragon_rise_at_call"));
}
// ── 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(ModText.Get("rov_compendium_skadi_crystal_golem"));
if (state < SkadiGolem.ModerProgressionState)
{
sb.AppendLine(ModText.Get("rov_compendium_skadi_tear_cold_nothing_wakes_stone"));
}
else
{
sb.AppendLine(ModText.Get("rov_compendium_skadi_cut_one_at_stonecutter_stone", SkadiGolem.CrystalCost));
sb.AppendLine(ModText.Get("rov_compendium_skadi_bound_stonecutter_that_shaped_may", (SkadiGolem.LeashRange).ToString("0")));
sb.AppendLine(ModText.Get("rov_compendium_skadi_one_stonecutter_holds_them_no", SkadiGolem.MaxPerStation, SkadiGolem.MaxInArea, (SkadiGolem.WitherSeconds).ToString("0")));
}
knownTexts[PageKey("Skadi")] = 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(ModText.Get("rov_compendium_skeleton_secrets_crypt"));
// 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 ? ModText.Get("rov_compendium_skeleton_stand_at_first_eight_standings") : ModText.Get("rov_compendium_skeleton_stand_at_eight_standings_earned", state, BossProgressionManager.GetBossTokenForState(state))));
sb.AppendLine(ModText.Get("rov_compendium_skeleton_undead_diet"));
sb.AppendLine(ModText.Get("rov_compendium_skeleton_no_hunger_moves_no_meal", (health).ToString("0")));
sb.AppendLine(ModText.Get("rov_compendium_skeleton_bones_blades"));
sb.AppendLine(ModText.Get("rov_compendium_skeleton_blades_points_find_little_cut"));
if (state >= 2)
{
sb.AppendLine(ModText.Get("rov_compendium_skeleton_green_rot"));
sb.AppendLine(ModText.Get("rov_compendium_skeleton_poison_has_nothing_left_poison", lifesteal));
}
if (state >= 3)
{
sb.AppendLine(ModText.Get("rov_compendium_skeleton_first_blow"));
sb.AppendLine(ModText.Get("rov_compendium_skeleton_first_strike_out_dark_staggers"));
}
if (state >= 4)
{
sb.AppendLine(ModText.Get("rov_compendium_skeleton_rotten_touch"));
sb.AppendLine(ModText.Get("rov_compendium_skeleton_what_strike_sicken_every_blow"));
}
if (state >= 5)
{
sb.AppendLine(ModText.Get("rov_compendium_skeleton_bones_alight"));
sb.AppendLine(ModText.Get("rov_compendium_skeleton_frame_remade_harder_cast_fire"));
}
if (state >= 6)
{
sb.AppendLine(ModText.Get("rov_compendium_skeleton_risen_again"));
sb.AppendLine(ModText.Get("rov_compendium_skeleton_killing_blow_no_longer_ends"));
}
if (state >= 7)
{
sb.AppendLine(ModText.Get("rov_compendium_skeleton_crypt_answers"));
sb.AppendLine(ModText.Get("rov_compendium_skeleton_every_enemy_put_down_rises", rules.MaxSummons));
}
if (state >= 8)
{
sb.AppendLine(ModText.Get("rov_compendium_skeleton_host_own"));
sb.AppendLine(ModText.Get("rov_compendium_skeleton_dead_now_follow_harm_deal", rules.MaxSummons, lifesteal));
}
knownTexts[PageKey("Skeleton")] = 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(ModText.Get("rov_compendium_furling_secrets_hoard"));
sb.AppendLine(ModText.Get("rov_compendium_furling_combat_mastery"));
sb.AppendLine(ModText.Get("rov_compendium_furling_all_weapon_combat_skills_gain", weaponXp, runSpeed));
if (state >= 2)
{
sb.AppendLine(ModText.Get("rov_compendium_furling_master_shadows_passive"));
sb.AppendLine(ModText.Get("rov_compendium_furling_footsteps_small_movements_no_longer", noiseRange));
}
if (state >= 3)
{
sb.AppendLine(ModText.Get("rov_compendium_furling_wickerman_passive"));
sb.AppendLine(ModText.Get("rov_compendium_furling_take_less_fire_damage_less", fireResist, poisonResist, fireArrowDmg));
}
if (state >= 4)
{
sb.AppendLine(ModText.Get("rov_compendium_furling_dance_dead_passive"));
sb.AppendLine(ModText.Get("rov_compendium_furling_every_mead_potion_wine_bomb"));
}
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(ModText.Get("rov_compendium_furling_passive", title));
sb.AppendLine(ModText.Get("rov_compendium_furling_whenever_normal_enemy_dies_within"));
}
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(ModText.Get("rov_compendium_furling_passive_2", title));
sb.AppendLine(ModText.Get("rov_compendium_furling_while_are_plains_biome_x"));
}
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(ModText.Get("rov_compendium_furling_passive_3", title));
sb.AppendLine(ModText.Get("rov_compendium_furling_blue_foods_those_that_restore"));
}
if (state >= 8)
{
sb.AppendLine(ModText.Get("rov_compendium_furling_through_fire_flames_passive"));
sb.AppendLine(ModText.Get("rov_compendium_furling_are_permanently_wreathed_flames_are"));
}
knownTexts[PageKey("Furling")] = 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(ModText.Get("rov_compendium_trenta_secrets_heartwood"));
sb.AppendLine(ModText.Get("rov_compendium_trenta_heartwood"));
sb.AppendLine(ModText.Get("rov_compendium_trenta_sap_heartwood_conduct_lightning_turn", foodDuration));
sb.AppendLine(ModText.Get("rov_compendium_trenta_photosynthesis"));
sb.AppendLine(ModText.Get("rov_compendium_trenta_stand_still_daylight_roof_over", stillness, healTicks, healPercent, restMinutes));
if (state >= TrentaConfig.EikthyrDefeatedState)
{
sb.AppendLine(ModText.Get("rov_compendium_trenta_awakened_seeds_passive"));
sb.AppendLine(ModText.Get("rov_compendium_trenta_every_seed_cone_acorn_self"));
}
if (state >= TrentaConfig.PurpleRainUnlockState)
{
sb.AppendLine(ModText.Get("rov_compendium_trenta_purple_rain_g_key"));
sb.AppendLine(ModText.Get("rov_compendium_trenta_spray_toxic_pollen_bursts_out", purpleRainRadius, purpleRainHeal, purpleRainPoison, purpleRainCooldown, purpleRainMuspellCooldown));
}
if (state >= TrentaConfig.BonemassDefeatedState)
{
sb.AppendLine(ModText.Get("rov_compendium_trenta_deep_roots_passive"));
sb.AppendLine(ModText.Get("rov_compendium_trenta_swamp_has_nothing_left_spoil"));
}
if (state >= TrentaConfig.ModerDefeatedState)
{
sb.AppendLine(ModText.Get("rov_compendium_trenta_last_stand_passive"));
sb.AppendLine(ModText.Get("rov_compendium_trenta_closer_come_falling_harder_bark", lastStandBonus));
sb.AppendLine(ModText.Get("rov_compendium_trenta_thorns_passive"));
sb.AppendLine(ModText.Get("rov_compendium_trenta_every_hit_take_returns_its", thornsPercent));
}
if (state >= TrentaConfig.PortalUnlockState)
{
sb.AppendLine(ModText.Get("rov_compendium_trenta_homecoming_portal_h_key"));
sb.AppendLine(ModText.Get("rov_compendium_trenta_open_linked_pair_portals_one", portalLifetime, portalCooldownMin));
}
if (state >= TrentaConfig.HornetsNestUnlockState)
{
sb.AppendLine(ModText.Get("rov_compendium_trenta_hornet_s_nest_passive"));
sb.AppendLine(ModText.Get("rov_compendium_trenta_swarm_hornets_has_made_its", hornetsRadius, hornetsDamage, hornetsInterval));
}
if (state >= TrentaConfig.MuspellUnlockState)
{
sb.AppendLine(ModText.Get("rov_compendium_trenta_muspell_j_key_toggle"));
sb.AppendLine(ModText.Get("rov_compendium_trenta_take_shape_young_elder_root", muspellStompDamage, muspellSpikeDamage));
}
knownTexts[PageKey("Trenta")] = sb.ToString();
}
}
[HarmonyPatch(typeof(TextsDialog), "Setup")]
public static class CompendiumSetup_Patch
{
public static void Prefix(Player player)
{
if (player != null)
{
RaceCompendium.UpdateCompendiumText(player);
}
}
}
}