598 lines
38 KiB
C#
598 lines
38 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",
|
|
"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 == 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.
|
|
/// </summary>
|
|
private static void GenerateDvergarText(Dictionary<string, string> knownTexts, int state)
|
|
{
|
|
DvergarProgression.DvergarRules rules = DvergarProgression.GetRules(state);
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.AppendLine("The Dvergar's Craft\n");
|
|
|
|
sb.AppendLine($"[Base Passive] Small and Stubborn: You stand a third 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();
|
|
}
|
|
|
|
private static void GenerateDraughText(Dictionary<string, string> knownTexts, int state, Player player)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.AppendLine("The Draugh's Awakening\n");
|
|
|
|
sb.AppendLine("[Base Passive] Born Dead, Buried Alive: You are a decaying undead warrior. You have innate resistance to Poison, but are weak to Fire and Spirit damage. Your digestive system adapts to death, allowing you to consume raw and rotten meat (Neck tail, raw meat, entrails, ooze, etc.).\n");
|
|
|
|
if (state >= 2)
|
|
sb.AppendLine("Slowly We Rot (Passive): You are no longer hindered by water. You gain immunity to the Wet effect, your movement speed in water is greatly increased, and you passively regenerate health while wet or swimming.\n");
|
|
|
|
if (state >= 3)
|
|
sb.AppendLine("Toxic Trace (Passive): Your physical attacks are laced with the swamp's decay. Enemies struck by your physical weapons suffer additional poison damage over time.\n");
|
|
|
|
if (state >= 4)
|
|
sb.AppendLine("Flesh and the Power It Holds (Passive): Slaying humanoid enemies drops Human Meat. Consuming it grants incredible buffs. You also gain the Corpse Run buff permanently.\n");
|
|
|
|
if (state >= 5)
|
|
sb.AppendLine("At the Heart of Winter (Parry Effect): When you successfully parry an attack, you unleash a freezing nova of frost magic around you, pushing back and damaging enemies (20 second cooldown).\n");
|
|
|
|
if (state >= 6)
|
|
sb.AppendLine("Zombie Ritual (Passive Survival): When you take fatal damage, you do not die. Instead, you enter a ghostly state, becoming immune to all damage. While in this state, your Eitr drains rapidly. If your Eitr hits zero, you truly die.\n");
|
|
|
|
if (state >= 7)
|
|
sb.AppendLine("Swarm of Terror (Retaliation): Whenever you are struck in melee combat, you automatically spawn 2 Seeker Broods to fight for you. They live for 9.5 seconds and have a 10 second cooldown.\n");
|
|
|
|
if (state >= 8)
|
|
sb.AppendLine("Steal Their Breath (Execution): While surviving in the 'Zombie Ritual' ghost state, scoring a killing blow on any enemy will instantly restore 25% 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: Physical kills automatically consume enemies (if edible). You are natively 20% larger than a human with immense strength. You have +200 Max Carry Weight and gain +3 Armor per boss defeated.\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, +10 Rock Throwing Damage. Unlocked 4th Food Slot.\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, +10 Damage to Clubs/Unarmed, +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();
|
|
}
|
|
|
|
private static void GenerateAswidText(Dictionary<string, string> knownTexts, int state)
|
|
{
|
|
int spd = state * 3;
|
|
int jmp = state * 3;
|
|
int arm = state * 3;
|
|
int dmg = state * 5;
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.AppendLine("The Aswid's Curse\n");
|
|
|
|
sb.AppendLine($"[Base Passive] Benedictus et Afflictus:");
|
|
sb.AppendLine($"Physical kills automatically consume enemies (Vae Victis) granting Blood Magic XP. Your physical stats scale progressively as you defeat Valheim's Bosses: +{arm} Armor, +{dmg} Damage, +{spd}% Speed, and +{jmp}% Jump. All your passive bonuses are doubled during the night. You can cast Blood Magic items with infinite Eitr, and your Blood Magic skill increases twice as fast.\n");
|
|
sb.AppendLine("Vampiric Aura (Passive, [I] to toggle): A magic damage aura drains nearby enemies automatically, at all times and in every form - no key to hold. It deals half damage as a human, full as a bat, and double as mist, healing you for 20% of the damage dealt. Weakened enemies are executed outright and converted into food. 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($"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 >= 1)
|
|
{
|
|
// Eikthyr - Base passives already covered
|
|
}
|
|
|
|
if (state >= 5)
|
|
{
|
|
sb.AppendLine("[Moder Unlock] Freezing Blood (Passive):");
|
|
sb.AppendLine("You gain permanent immunity to the Freezing status (mountains/snowstorms) and Poison damage.\n");
|
|
sb.AppendLine("[Moder Unlock] Auspex (Passive):");
|
|
sb.AppendLine("You emit a 10-meter aura that reveals the presence of untamed creatures by wreathing them in ethereal flames.\n");
|
|
}
|
|
|
|
if (state >= 6)
|
|
{
|
|
sb.AppendLine("[Yagluth Unlock] Dominate (E Key):");
|
|
sb.AppendLine("Press E on non-tameable, non-boss enemies to dominate them for 60 seconds (15-min cooldown). Dominated thralls fight alongside you and drop standard loot.\n");
|
|
}
|
|
|
|
if (state >= 7)
|
|
{
|
|
sb.AppendLine("[The Queen Unlock] Weight of Shadows (H Key):");
|
|
sb.AppendLine("You transform into an elusive mist. You become immune to physical and poison damage, but weak to fire, frost, and spirit. Your Vampiric Aura deals double damage, but you cannot attack or run. 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 +30 to Physical Damage.\n");
|
|
}
|
|
|
|
knownTexts["Aswid Secrets"] = sb.ToString();
|
|
}
|
|
|
|
private static void GenerateFenrirText(Dictionary<string, string> knownTexts, int state)
|
|
{
|
|
int spd = state * 3;
|
|
int jmp = state * 3;
|
|
int arm = state * 3;
|
|
int dmg = state * 5;
|
|
knownTexts["Fenrir Secrets"] = $"The secrets of the pack will be revealed soon...\n\nBase Passive: Physical kills automatically consume enemies (if edible). Your physical stats scale progressively as you defeat Valheim's Bosses: +{arm} Armor, +{dmg} Damage, +{spd}% Speed, and +{jmp}% Jump.\n\n" +
|
|
$"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. They cannot be dropped, traded or stolen while grown - and in beast form the jaws do the work instead.";
|
|
}
|
|
|
|
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();
|
|
}
|
|
|
|
private static void GenerateFurlingText(Dictionary<string, string> knownTexts, int state, Player player)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.AppendLine("The secrets of the hoard will be revealed soon...\n");
|
|
|
|
sb.AppendLine("[Base Passive] Combat Mastery:");
|
|
sb.AppendLine("All weapon and combat skills gain 2x XP permanently. You're short, but very fast  your movement speed is permanently increased by 10%.\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();
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(typeof(TextsDialog), "Setup")]
|
|
public static class CompendiumSetup_Patch
|
|
{
|
|
public static void Prefix(Player player)
|
|
{
|
|
if (player != null)
|
|
{
|
|
RaceCompendium.UpdateCompendiumText(player);
|
|
}
|
|
}
|
|
}
|
|
}
|