RacesOfValheim/JotunnModStub/Fenrir/FenrirConfig.cs
kanym c2bc73b3a0 feat(fenrir): eyes turn the Cultist's yellow when it is back from cooldown
The ready flag becomes an int: none, a form, or the Cultist. The Cultist
wins only while its rules give it a cooldown (Yagluth and Queen), since
that is the one return worth announcing. Its body shares the Fenring's
material and its breath is white flame tinted by texture, so the colour
comes from its death effect: FlameRoundYellowParticle's emission,
(2.691, 1.797, 0.455), bundle c4210710.
2026-10-23 20:06:49 +02:00

237 lines
18 KiB
C#

using UnityEngine;
using BepInEx.Configuration;
namespace RacesOfValheim
{
/// <summary>
/// Every tunable number and keybind behind the Fenrir's abilities and special attacks, 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/DraughConfig's layout).
///
/// Only the four transform/howl keys are exposed as rebindable - unlike Skadi's dragon forms,
/// which share one unified attack-button scheme across all three forms, each of Fenrir's four
/// forms (Fenring, Cultist, Wolf, Ulv) is an independent MonoBehaviour with its own hardcoded
/// mouse-button reads. Rebinding all of those individually would be a much larger, more
/// error-prone change for comparatively little value over just leaving attacks on the mouse,
/// which is where an action game's combat inputs are expected to live.
///
/// One caveat: the Form Buffs section is read once, into the status effects built by
/// FenrirRace.CreateModAssets on mod startup - not every frame. Retuning those values
/// mid-session needs a relog to take effect. Everything else (Passive Combat, every attack's
/// numbers) is read live on every use.
/// </summary>
public static class FenrirConfig
{
// ─── Keybinds ──────────────────────────────────────────────────────────
// Defaults match today's fixed inputs exactly, so nobody's controls change until they
// open Configuration Manager (or the .cfg) and rebind one on purpose.
public static ConfigEntry<KeyboardShortcut> WolfFormKey;
public static ConfigEntry<KeyboardShortcut> FenrirFormKey;
public static ConfigEntry<KeyboardShortcut> CultistFormKey;
public static ConfigEntry<KeyboardShortcut> HowlKey;
// ─── Passive combat (scales with progression state) ──────────────────
public static ConfigEntry<float> ArmorBonusPerState;
public static ConfigEntry<float> DamageBonusPerState;
public static ConfigEntry<float> FallDamageReductionPerState;
public static ConfigEntry<float> SpeedBonusPerState;
public static ConfigEntry<float> JumpBonusPerState;
public static ConfigEntry<float> SunSicknessDuration;
// ─── Form buffs (applied while transformed) ───────────────────────────
public static ConfigEntry<float> FullFormSpeedBonus;
public static ConfigEntry<float> FullFormJumpBonus;
public static ConfigEntry<float> FullFormFallDamageReduction;
public static ConfigEntry<float> WolfFormSpeedBonus;
public static ConfigEntry<float> WolfFormFallDamageReduction;
public static ConfigEntry<float> FormStaminaRegenMultiplier;
public static ConfigEntry<float> FormStaminaDrainReduction;
// ─── Fenring form attacks ─────────────────────────────────────────────
public static ConfigEntry<float> FenringHeavyClawDamage;
public static ConfigEntry<float> FenringLightClawDamage;
public static ConfigEntry<float> FenringJumpAttackDamage;
public static ConfigEntry<float> FenringJumpDashSpeed;
public static ConfigEntry<float> FenringJumpDashUpwardSpeed;
public static ConfigEntry<float> FenringAttackRadius;
public static ConfigEntry<float> FenringPushForce;
// ─── Cultist form attacks ──────────────────────────────────────────────
public static ConfigEntry<float> CultistClawDamage;
public static ConfigEntry<float> CultistDoubleClawDamage;
public static ConfigEntry<float> CultistAttackRadius;
public static ConfigEntry<float> CultistPushForce;
public static ConfigEntry<float> CultistFireDamagePerTick;
public static ConfigEntry<float> CultistFireEitrDrainPerSecond;
public static ConfigEntry<float> CultistFireMagicSkillScaling;
public static ConfigEntry<float> CultistFireAttackRadius;
// ─── Wolf form attacks ─────────────────────────────────────────────────
public static ConfigEntry<float> WolfAttack1Damage;
public static ConfigEntry<float> WolfAttack2Damage;
public static ConfigEntry<float> WolfAttack3Damage;
public static ConfigEntry<float> WolfAttackRadius;
public static ConfigEntry<float> WolfPushForce;
// ─── Ulv form attacks ──────────────────────────────────────────────────
public static ConfigEntry<float> UlvBiteDamage;
public static ConfigEntry<float> UlvHeavyBiteDamage;
public static ConfigEntry<float> UlvJumpAttackDamage;
public static ConfigEntry<float> UlvLeapSpeed;
public static ConfigEntry<float> UlvAttackRadius;
public static ConfigEntry<float> UlvPushForce;
// ─── Debug ─────────────────────────────────────────────────────────────
public static ConfigEntry<bool> DebugFormHits;
// ─── Appearance (per player, never synced) ──────────────────────────────
public static ConfigEntry<bool> ReadyMessage;
public static ConfigEntry<bool> EyeGlow;
public static ConfigEntry<float> EyeNightStrength;
public static ConfigEntry<float> EyeReadyStrength;
public static void Bind(ConfigFile config)
{
const string keybinds = "Fenrir - Keybinds";
WolfFormKey = config.Bind(keybinds, "Wolf Form", new KeyboardShortcut(KeyCode.G),
new ConfigDescription("Transform into (or revert from) a Wolf/Ulv, tier 3+."));
FenrirFormKey = config.Bind(keybinds, "Fenrir Form", new KeyboardShortcut(KeyCode.H),
new ConfigDescription("Transform into (or revert from) a Fenring/Ulv, tier 4+."));
CultistFormKey = config.Bind(keybinds, "Cultist Form", new KeyboardShortcut(KeyCode.J),
new ConfigDescription("Transform into (or revert from) a Cultist, tier 6+."));
HowlKey = config.Bind(keybinds, "Howl", new KeyboardShortcut(KeyCode.O),
new ConfigDescription("Howls in Fenring or Cultist form. Cosmetic only."));
const string combat = "Fenrir - Passive Combat";
ArmorBonusPerState = config.Bind(combat, "Armor Bonus Per State", 3f,
new ConfigDescription("Flat armor added, per progression state.", new AcceptableValueRange<float>(0f, 20f)));
DamageBonusPerState = config.Bind(combat, "Damage Bonus Per State", 5f,
new ConfigDescription("Flat physical damage added to equipped weapons, per progression state.", new AcceptableValueRange<float>(0f, 20f)));
FallDamageReductionPerState = config.Bind(combat, "Fall Damage Reduction Per State", 0.1f,
new ConfigDescription("Fall damage reduction added per progression state, capped at 100%.", new AcceptableValueRange<float>(0f, 1f)));
SpeedBonusPerState = config.Bind(combat, "Speed Bonus Per State", 0.03f,
new ConfigDescription("Move speed multiplier added, per progression state.", new AcceptableValueRange<float>(0f, 0.2f)));
JumpBonusPerState = config.Bind(combat, "Jump Bonus Per State", 0.03f,
new ConfigDescription("Jump height multiplier added, per progression state.", new AcceptableValueRange<float>(0f, 0.2f)));
SunSicknessDuration = config.Bind(combat, "Sun Sickness Duration", 60f,
new ConfigDescription("Seconds of forced human form after being reverted by sunrise.", new AcceptableValueRange<float>(0f, 300f)));
const string buffs = "Fenrir - Form Buffs";
BindNote(config, buffs, "Note: these values need a relog to take effect.");
FullFormSpeedBonus = config.Bind(buffs, "Full Form Speed Bonus", 1.0f,
new ConfigDescription("Speed multiplier bonus while in Fenring or Cultist form.", new AcceptableValueRange<float>(0f, 3f)));
FullFormJumpBonus = config.Bind(buffs, "Full Form Jump Bonus", 1.0f,
new ConfigDescription("Jump multiplier bonus while in Fenring or Cultist form.", new AcceptableValueRange<float>(0f, 3f)));
FullFormFallDamageReduction = config.Bind(buffs, "Full Form Fall Damage Reduction", 1.0f,
new ConfigDescription("Fall damage reduction while in Fenring or Cultist form (1 = immune).", new AcceptableValueRange<float>(0f, 1f)));
WolfFormSpeedBonus = config.Bind(buffs, "Wolf Form Speed Bonus", 0.5f,
new ConfigDescription("Speed multiplier bonus while in Wolf or Ulv form.", new AcceptableValueRange<float>(0f, 3f)));
WolfFormFallDamageReduction = config.Bind(buffs, "Wolf Form Fall Damage Reduction", 0.5f,
new ConfigDescription("Fall damage reduction while in Wolf or Ulv form.", new AcceptableValueRange<float>(0f, 1f)));
FormStaminaRegenMultiplier = config.Bind(buffs, "Stamina Regen Multiplier", 1.3f,
new ConfigDescription("Stamina regen multiplier in any transformed state.", new AcceptableValueRange<float>(1f, 5f)));
FormStaminaDrainReduction = config.Bind(buffs, "Stamina Drain Reduction", 0.2f,
new ConfigDescription("Reduction to running stamina drain in any transformed state.", new AcceptableValueRange<float>(0f, 1f)));
const string fenring = "Fenrir - Fenring Attacks";
FenringHeavyClawDamage = config.Bind(fenring, "Heavy Claw Damage", 110f,
new ConfigDescription("Base damage of the heavy claw (Right Mouse), before the Unarmed skill bonus.", new AcceptableValueRange<float>(0f, 500f)));
FenringLightClawDamage = config.Bind(fenring, "Light Claw Damage", 60f,
new ConfigDescription("Base damage of the light claw (Left Mouse), before the Unarmed skill bonus.", new AcceptableValueRange<float>(0f, 500f)));
FenringJumpAttackDamage = config.Bind(fenring, "Jump Attack Damage", 95f,
new ConfigDescription("Base damage of the leaping attack (Middle Mouse), before the Unarmed skill bonus.", new AcceptableValueRange<float>(0f, 500f)));
FenringJumpDashSpeed = config.Bind(fenring, "Jump Dash Speed", 31.5f,
new ConfigDescription("Forward speed during the leap.", new AcceptableValueRange<float>(0f, 60f)));
FenringJumpDashUpwardSpeed = config.Bind(fenring, "Jump Dash Upward Speed", 13.1f,
new ConfigDescription("Upward speed during the first half of the leap.", new AcceptableValueRange<float>(0f, 30f)));
FenringAttackRadius = config.Bind(fenring, "Attack Radius", 2.5f,
new ConfigDescription("Hit-sweep radius for all three attacks.", new AcceptableValueRange<float>(1f, 10f)));
FenringPushForce = config.Bind(fenring, "Push Force", 30f,
new ConfigDescription("Knockback applied on a hit.", new AcceptableValueRange<float>(0f, 100f)));
const string cultist = "Fenrir - Cultist Attacks";
CultistClawDamage = config.Bind(cultist, "Claw Damage", 85f,
new ConfigDescription("Base damage of the single claw (Left Mouse), before the Unarmed skill bonus.", new AcceptableValueRange<float>(0f, 500f)));
CultistDoubleClawDamage = config.Bind(cultist, "Double Claw Damage", 140f,
new ConfigDescription("Base damage of the double claw (Middle Mouse), before the Unarmed skill bonus.", new AcceptableValueRange<float>(0f, 500f)));
CultistAttackRadius = config.Bind(cultist, "Claw Attack Radius", 2.5f,
new ConfigDescription("Hit-sweep radius for both claw attacks.", new AcceptableValueRange<float>(1f, 10f)));
CultistPushForce = config.Bind(cultist, "Claw Push Force", 30f,
new ConfigDescription("Knockback applied by a claw hit.", new AcceptableValueRange<float>(0f, 100f)));
CultistFireDamagePerTick = config.Bind(cultist, "Fire Damage Per Tick", 20f,
new ConfigDescription("Fire damage per 0.2s tick while channeling (Right Mouse held), before the Elemental Magic skill bonus.", new AcceptableValueRange<float>(0f, 100f)));
CultistFireEitrDrainPerSecond = config.Bind(cultist, "Fire Eitr Drain Per Second", 12.5f,
new ConfigDescription("Eitr spent per second while channeling fire.", new AcceptableValueRange<float>(0f, 100f)));
CultistFireMagicSkillScaling = config.Bind(cultist, "Fire Magic Skill Scaling", 0.5f,
new ConfigDescription("Extra fire damage per tick, per point of Elemental Magic skill.", new AcceptableValueRange<float>(0f, 5f)));
CultistFireAttackRadius = config.Bind(cultist, "Fire Attack Radius", 3f,
new ConfigDescription("Hit-sweep radius for the fire breath.", new AcceptableValueRange<float>(1f, 15f)));
const string wolf = "Fenrir - Wolf Attacks";
WolfAttack1Damage = config.Bind(wolf, "Attack 1 Damage", 40f,
new ConfigDescription("Base damage of the Left Mouse attack, before the Unarmed skill bonus.", new AcceptableValueRange<float>(0f, 300f)));
WolfAttack2Damage = config.Bind(wolf, "Attack 2 Damage", 60f,
new ConfigDescription("Base damage of the Right Mouse attack, before the Unarmed skill bonus.", new AcceptableValueRange<float>(0f, 300f)));
WolfAttack3Damage = config.Bind(wolf, "Attack 3 Damage", 80f,
new ConfigDescription("Base damage of the Middle Mouse attack, before the Unarmed skill bonus.", new AcceptableValueRange<float>(0f, 300f)));
WolfAttackRadius = config.Bind(wolf, "Attack Radius", 2.0f,
new ConfigDescription("Hit-sweep radius for all three attacks.", new AcceptableValueRange<float>(1f, 10f)));
WolfPushForce = config.Bind(wolf, "Push Force", 20f,
new ConfigDescription("Knockback applied on a hit.", new AcceptableValueRange<float>(0f, 100f)));
const string ulv = "Fenrir - Ulv Attacks";
UlvBiteDamage = config.Bind(ulv, "Bite Damage", 40f,
new ConfigDescription("Base damage of the Left Mouse bite, before the Unarmed skill bonus.", new AcceptableValueRange<float>(0f, 300f)));
UlvHeavyBiteDamage = config.Bind(ulv, "Heavy Bite Damage", 60f,
new ConfigDescription("Base damage of the Right Mouse bite, before the Unarmed skill bonus.", new AcceptableValueRange<float>(0f, 300f)));
UlvJumpAttackDamage = config.Bind(ulv, "Jump Attack Damage", 80f,
new ConfigDescription("Base damage of the leaping Middle Mouse attack, before the Unarmed skill bonus.", new AcceptableValueRange<float>(0f, 300f)));
UlvLeapSpeed = config.Bind(ulv, "Leap Speed", 18f,
new ConfigDescription("Forward speed during the leap attack.", new AcceptableValueRange<float>(0f, 40f)));
UlvAttackRadius = config.Bind(ulv, "Attack Radius", 2.0f,
new ConfigDescription("Hit-sweep radius for all three attacks.", new AcceptableValueRange<float>(1f, 10f)));
UlvPushForce = config.Bind(ulv, "Push Force", 25f,
new ConfigDescription("Knockback applied on a hit.", new AcceptableValueRange<float>(0f, 100f)));
// The whole section stays local - see ConfigSync.LocalSections.
const string appearance = "Fenrir - Appearance";
ReadyMessage = config.Bind(appearance, "Ready Message", true,
new ConfigDescription("Shows \"<form> is Ready!\" when a form's cooldown ends. The eyes say the same thing; turn this off if they are enough."));
EyeGlow = config.Bind(appearance, "Eye Glow", true,
new ConfigDescription("Fenrir eyes glow at night in the Fenring's own orange: faint while no form can be taken, bright when one can, yellow when the Cultist is back from its cooldown. Off hides them on every Fenrir you see."));
// Above 0.5 so the red channel (2.0 x strength) passes 1 and the bloom pass picks it
// up: at 0.35 the faint state read as no glow at all.
EyeNightStrength = config.Bind(appearance, "Eye Night Strength", 0.6f,
new ConfigDescription("Glow at night while no form is ready.", new AcceptableValueRange<float>(0f, 3f)));
EyeReadyStrength = config.Bind(appearance, "Eye Ready Strength", 1.2f,
new ConfigDescription("Glow at night while a form is ready.", new AcceptableValueRange<float>(0f, 3f)));
// "debug" in the key keeps it local - see ConfigSync.
DebugFormHits = config.Bind("Fenrir - Debug", "Debug: Log Form Hits", false,
new ConfigDescription("Writes one log line per claw or bite: what was in reach, what it hit, and why anything was skipped. For bug reports about attacks that do no damage."));
}
/// <summary>
/// A non-editable line of text, standing in for the caveat comment this class carries at
/// the top - Configuration Manager has no label widget of its own, so this binds a real
/// (unused) bool ConfigEntry and replaces its value widget with nothing via CustomDrawer,
/// same trick used for section dividers earlier in this mod's config work. A high Order
/// keeps it above the section's other entries, which are left at the default Order and so
/// sort alphabetically among themselves.
/// </summary>
private static void BindNote(ConfigFile config, string section, string text)
{
config.Bind(section, text, false, new ConfigDescription(
"", null, new ConfigurationManagerAttributes
{
Order = 100,
CustomDrawer = DrawNothing,
HideDefaultButton = true,
ReadOnly = true
}));
}
private static void DrawNothing(ConfigEntryBase entry) { }
}
}