RacesOfValheim/JotunnModStub/Fenrir/FenrirProgression.cs
kanym 6755c263f3 feat(fenrir): make ability numbers and keybinds BepInEx-configurable
Adds FenrirConfig.cs, following the established per-race pattern: one
Configuration Manager section per topic (Keybinds, Passive Combat, Form
Buffs, and one per transformation form - Fenring, Cultist, Wolf, Ulv),
covering every attack's damage/radius/push-force number across all four
independent form behaviors, plus the four transform/howl keybinds.
Defaults match the previous hardcoded constants exactly.

Only the four transform/howl keys are rebindable - unlike Skadi's dragon
forms, which share one unified attack-button scheme, each of Fenrir's
four forms is an independent MonoBehaviour with its own hardcoded mouse
reads, so making all eleven attack buttons rebindable was left out as a
much larger, separately-scoped change.

The Form Buffs section opens with a non-editable note (the CustomDrawer
trick from ConfigurationManagerAttributes) explaining that those specific
values are baked into status effects once at mod startup and need a
relog to pick up a change - everything else reads live.

Config sections stay bound alphabetically by race (Aswid, Draugh,
Dvergar, Fenrir, Skadi) in RacesOfValheim.Awake().
2026-08-06 14:12:07 +02:00

84 lines
2.8 KiB
C#

using System;
using UnityEngine;
namespace RacesOfValheim
{
public static class FenrirProgression
{
public enum FormType
{
None,
Wolf,
Ulv,
Fenring,
Cultist
}
public class FormRules
{
public FormType Form;
public bool NeedsNight;
public float DurationMinutes;
public float CooldownMinutes;
public FormRules(FormType form, bool needsNight, float duration, float cooldown)
{
Form = form;
NeedsNight = needsNight;
DurationMinutes = duration;
CooldownMinutes = cooldown;
}
}
public static float GetArmorBonus(int state)
{
return FenrirConfig.ArmorBonusPerState.Value * state;
}
public static float GetDamageBonus(int state)
{
return FenrirConfig.DamageBonusPerState.Value * state;
}
public static float GetFallDamageModifier(int state)
{
return Mathf.Clamp(-FenrirConfig.FallDamageReductionPerState.Value * state, -1f, 0f);
}
public static float GetSpeedModifier(int state)
{
return FenrirConfig.SpeedBonusPerState.Value * state;
}
public static float GetJumpModifier(int state)
{
return FenrirConfig.JumpBonusPerState.Value * state;
}
// --- Transformation Rules for Keys ---
public static FormRules GetGKeyRules(int state)
{
if (state >= 5) return new FormRules(FormType.Ulv, false, 0f, 0f); // Moder: Ulv (Day/Night)
if (state >= 4) return new FormRules(FormType.Wolf, false, 0f, 0f); // Bonemass: Wolf (Day/Night)
if (state >= 3) return new FormRules(FormType.Wolf, true, 0f, 0f); // Elder: Wolf (Night)
return null;
}
public static FormRules GetHKeyRules(int state)
{
if (state >= 7) return new FormRules(FormType.Fenring, false, 0f, 0f); // Queen: Fenrir (Day/Night)
if (state >= 5) return new FormRules(FormType.Fenring, true, 0f, 0f); // Moder: Fenrir (Night)
if (state >= 4) return new FormRules(FormType.Ulv, true, 0f, 0f); // Bonemass: Ulv (Night)
return null;
}
public static FormRules GetJKeyRules(int state)
{
if (state >= 8) return new FormRules(FormType.Cultist, false, 0f, 0f); // Fader: Cultist (Day/Night)
if (state >= 7) return new FormRules(FormType.Cultist, true, 1f, 5f); // Queen: Cultist (Night, 1m dur, 5m cd)
if (state >= 6) return new FormRules(FormType.Cultist, true, 1f, 10f); // Yagluth: Cultist (Night, 1m dur, 10m cd)
return null;
}
}
}