RacesOfValheim/JotunnModStub/Draugh/DraughConfig.cs
kanym 276ff93834 feat(draugh): add the Human Meat item the Bonemass perk has always promised
Two places in the mod used an item called "HumanMeat" and nothing registered
it: the drop in Draugh_DeathAura_Patch and the "fatal to the living" block in
DraughFoodPatches. Both check for null, so the perk has been a no-op since
it was written - a README line with no item behind it. The two consumers are
unchanged; what was missing was the producer.

Built from two vanilla items, one for the look and one for the numbers.
RawMeat gives the model and icon, because that is what a piece of somebody
looks like and because raw flesh is the Draugh's whole food identity.
BloodPudding gives the nourishment, copied field by field at start-up rather
than written down here, so the item stays balanced against the game's own
progression and follows any change made to it.

Blood Pudding's stamina goes onto health and stamina is left at zero. A
Draugh does not use stamina, so nourishment spent there is thrown away: the
food slot would read full while giving the race half of what it cost.

RawMeat is a Material in vanilla - raw meat is not edible - so m_itemType is
forced to Consumable. That is the one assumption worth knowing about, and
the registration logs what it produced so a silent failure cannot hide. The
meat is tinted on copies of the materials, never the shared ones, or every
piece of raw meat in the world would darken with it.

The README said humanoids drop it. The patch is on Player.OnDeath and always
was, so the line now says what the code does: a player who dies inside the
death aura, the Draugh included.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-26 00:20:16 +02:00

121 lines
8.7 KiB
C#

using BepInEx.Configuration;
namespace RacesOfValheim
{
/// <summary>
/// Every tunable number behind the Draugh's abilities, bound as BepInEx ConfigEntry so they
/// show up in Configuration Manager without touching code - see
/// CONFIGURATION-MANAGER-HOWTO.md. Bound once, from RacesOfValheim.Awake(). One section per
/// topic (matches SkadiConfig/AswidConfig's layout) rather than one shared section, so each
/// shows up as its own entry in Configuration Manager's category list.
///
/// No keybinds here: every Draugh ability triggers automatically off a game event (a parry, a
/// hit taken, a hit landed, death) rather than a key press, unlike Skadi or Aswid.
///
/// Tier-gate thresholds (which progression state unlocks each ability) are left as-is, same
/// boundary drawn for Skadi's progression table - these are a differently-shaped piece of
/// config (per-tier unlock tables, not flat values).
/// </summary>
public static class DraughConfig
{
// ─── Passive combat (always active) ───────────────────────────────────
public static ConfigEntry<float> PhysicalResistMultiplier;
public static ConfigEntry<float> FireSpiritWeaknessMultiplier;
// ─── Sunken Menace (tier 2+: Wet heals instead of hurts) ─────────────────
public static ConfigEntry<float> WetHealthRegenMultiplier;
// ─── Rotting Edge (tier 3+: poison on hit, poison splash on parry) ──────
public static ConfigEntry<float> PoisonOnHitPercent;
public static ConfigEntry<float> ParryWindow;
public static ConfigEntry<float> PoisonSplashDamage;
// ─── Undead Fortitude (tier 4+: crit on staggered, death aura) ──────────
public static ConfigEntry<float> StaggerCritMultiplier;
public static ConfigEntry<float> DeathAuraRadius;
public static ConfigEntry<float> HumanMeatNourishmentMultiplier;
// ─── North Wind (tier 5+: AoE frost on parry, on the same cooldown) ──────
public static ConfigEntry<float> NorthWindCooldown;
public static ConfigEntry<float> NorthWindRadius;
public static ConfigEntry<float> NorthWindFrostDamage;
public static ConfigEntry<float> NorthWindPushForce;
// ─── Undying Will (tier 6+: survive death by burning Eitr) ──────────────
public static ConfigEntry<float> UndyingWillCooldown;
public static ConfigEntry<float> UndyingWillEitrDrainPerTick;
public static ConfigEntry<float> UndyingWillTickInterval;
// ─── Swarm of Terror (tier 7+: spawn friendly seeker brood on melee hits) ─
public static ConfigEntry<float> SwarmDetectionRadius;
public static ConfigEntry<float> SwarmSpawnCooldown;
public static ConfigEntry<int> SwarmSpawnCount;
public static ConfigEntry<float> SwarmBroodLifetime;
// ─── Steal Their Breath (tier 8+: cancel Undying Will death by a kill) ────
public static ConfigEntry<float> StealBreathHealPercent;
public static void Bind(ConfigFile config)
{
const string combat = "Draugh - Passive Combat";
PhysicalResistMultiplier = config.Bind(combat, "Physical Resist Multiplier", 0.8f,
new ConfigDescription("Multiplies incoming blunt/slash/pierce damage (0.8 = 20% resistance).", new AcceptableValueRange<float>(0f, 1f)));
FireSpiritWeaknessMultiplier = config.Bind(combat, "Fire/Spirit Weakness Multiplier", 1.5f,
new ConfigDescription("Multiplies incoming fire/spirit damage (1.5 = 50% weaker).", new AcceptableValueRange<float>(1f, 3f)));
const string sunkenMenace = "Draugh - Sunken Menace";
WetHealthRegenMultiplier = config.Bind(sunkenMenace, "Wet Health Regen Multiplier", 1.25f,
new ConfigDescription("Health regen multiplier while Wet, tier 2+ (Wet heals instead of hurting).", new AcceptableValueRange<float>(1f, 3f)));
const string rottingEdge = "Draugh - Rotting Edge";
PoisonOnHitPercent = config.Bind(rottingEdge, "Poison On Hit Percent", 0.20f,
new ConfigDescription("Fraction of physical damage dealt added as poison, tier 3+.", new AcceptableValueRange<float>(0f, 1f)));
ParryWindow = config.Bind(rottingEdge, "Parry Window", 0.25f,
new ConfigDescription("Seconds after a block still counts as a parry for Poison Splash/North Wind.", new AcceptableValueRange<float>(0.05f, 1f)));
PoisonSplashDamage = config.Bind(rottingEdge, "Poison Splash Damage", 40f,
new ConfigDescription("Flat poison damage dealt to whoever you parry, tier 3+.", new AcceptableValueRange<float>(0f, 200f)));
const string fortitude = "Draugh - Undead Fortitude";
StaggerCritMultiplier = config.Bind(fortitude, "Stagger Crit Multiplier", 1.30f,
new ConfigDescription("Multiplies physical damage dealt to staggered enemies, tier 4+.", new AcceptableValueRange<float>(1f, 3f)));
DeathAuraRadius = config.Bind(fortitude, "Death Aura Radius", 100f,
new ConfigDescription("Meters within which an ally's death drops Human Meat for you, tier 4+.", new AcceptableValueRange<float>(10f, 300f)));
// A multiplier rather than absolute numbers: Human Meat is built from Blood Pudding's own
// nourishment at start-up, and those are the game's values, not ours to hardcode.
HumanMeatNourishmentMultiplier = config.Bind(fortitude, "Human Meat Nourishment Multiplier", 1f,
new ConfigDescription("Scales Human Meat's health, stamina and eitr against the Blood Pudding it is built from. Read once at start-up.", new AcceptableValueRange<float>(0.1f, 3f)));
const string northWind = "Draugh - North Wind";
NorthWindCooldown = config.Bind(northWind, "Cooldown", 20f,
new ConfigDescription("Seconds between North Wind triggers, tier 5+.", new AcceptableValueRange<float>(0f, 120f)));
NorthWindRadius = config.Bind(northWind, "Radius", 8f,
new ConfigDescription("Meters from you that North Wind damages.", new AcceptableValueRange<float>(1f, 30f)));
NorthWindFrostDamage = config.Bind(northWind, "Frost Damage", 50f,
new ConfigDescription("Flat frost damage dealt to everything in range.", new AcceptableValueRange<float>(0f, 200f)));
NorthWindPushForce = config.Bind(northWind, "Push Force", 20f,
new ConfigDescription("Knockback applied to everything hit.", new AcceptableValueRange<float>(0f, 100f)));
const string undyingWill = "Draugh - Undying Will";
UndyingWillCooldown = config.Bind(undyingWill, "Cooldown", 600f,
new ConfigDescription("Seconds between Undying Will triggers, tier 6+.", new AcceptableValueRange<float>(0f, 3600f)));
UndyingWillEitrDrainPerTick = config.Bind(undyingWill, "Eitr Drain Per Tick", 2f,
new ConfigDescription("Eitr spent per tick while surviving on borrowed time.", new AcceptableValueRange<float>(0f, 20f)));
UndyingWillTickInterval = config.Bind(undyingWill, "Tick Interval", 0.2f,
new ConfigDescription("Seconds between Eitr drain ticks.", new AcceptableValueRange<float>(0.05f, 2f)));
const string swarm = "Draugh - Swarm Of Terror";
SwarmDetectionRadius = config.Bind(swarm, "Melee Detection Radius", 5f,
new ConfigDescription("Meters within which a hit taken counts as melee and can trigger a spawn, tier 7+.", new AcceptableValueRange<float>(1f, 20f)));
SwarmSpawnCooldown = config.Bind(swarm, "Spawn Cooldown", 10f,
new ConfigDescription("Seconds between spawns.", new AcceptableValueRange<float>(0f, 60f)));
SwarmSpawnCount = config.Bind(swarm, "Spawn Count", 2,
new ConfigDescription("Friendly Seeker Broodlings spawned per trigger.", new AcceptableValueRange<int>(1, 10)));
SwarmBroodLifetime = config.Bind(swarm, "Brood Lifetime", 9.5f,
new ConfigDescription("Seconds a spawned broodling survives before it dies on its own.", new AcceptableValueRange<float>(1f, 60f)));
const string stealBreath = "Draugh - Steal Their Breath";
StealBreathHealPercent = config.Bind(stealBreath, "Heal Percent", 0.25f,
new ConfigDescription("Fraction of max health healed when a kill cancels an in-progress Undying Will death, tier 8+.", new AcceptableValueRange<float>(0f, 1f)));
}
}
}