RacesOfValheim/JotunnModStub/Aswid/AswidConfig.cs
kanym 629a534bc3 feat(aswid): make abilities and special attacks BepInEx-configurable
Adds AswidConfig.cs, following the SkadiConfig pattern: one Configuration
Manager section per topic (Keybinds, Passive Combat, Vampiric Aura,
Superhuman Senses, Eclipse, Devour, Domination), covering every tunable
number and all five ability keybinds (Bat Form, Mist Form, Eclipse, Tame,
Toggle Devour). Defaults match the previous hardcoded constants exactly.

Also fixes a real mismatch found along the way: the tame hover-text
hardcoded "[K] Tame" while the key that actually triggered taming was U.
Both now read the same configured Tame key, so the hint stays correct if
it's rebound.

Config sections are bound alphabetically by race (Aswid before Skadi) in
RacesOfValheim.Awake(), since Configuration Manager's category list
follows bind order.
2026-08-06 13:33:39 +02:00

133 lines
10 KiB
C#

using UnityEngine;
using BepInEx.Configuration;
namespace RacesOfValheim
{
/// <summary>
/// Every tunable number and keybind behind the Aswid'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's layout) rather than one shared section, so each shows up as
/// its own entry in Configuration Manager's category list.
///
/// Tier-gate thresholds (which progression state unlocks Mist Form, Eclipse, or which mob a
/// given tier can tame) 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 AswidConfig
{
// ─── 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> BatFormKey;
public static ConfigEntry<KeyboardShortcut> MistFormKey;
public static ConfigEntry<KeyboardShortcut> EclipseKey;
public static ConfigEntry<KeyboardShortcut> TameKey;
public static ConfigEntry<KeyboardShortcut> ToggleDevourKey;
// ─── Passive combat (scales with progression state, doubles at night) ────
public static ConfigEntry<float> DamageBonusPerState;
public static ConfigEntry<float> ArmorBonusPerState;
public static ConfigEntry<float> SpeedBonusPerState;
public static ConfigEntry<float> NightMultiplier;
public static ConfigEntry<float> BloodMagicSkillGainMultiplier;
public static ConfigEntry<float> SurtlingFormDamageBonus;
// ─── Vampiric Aura (passive, always active) ──────────────────────────────
public static ConfigEntry<float> AuraTickInterval;
public static ConfigEntry<float> AuraRadiusDay;
public static ConfigEntry<float> AuraRadiusNight;
public static ConfigEntry<float> AuraBaseDamage;
public static ConfigEntry<float> AuraBloodMagicScaling;
public static ConfigEntry<float> AuraExecuteThreshold;
// ─── Superhuman Senses (tier 5+ passive) ─────────────────────────────────
public static ConfigEntry<float> SensesRadius;
public static ConfigEntry<float> SensesRefreshInterval;
public static ConfigEntry<float> SensesLightRange;
public static ConfigEntry<float> SensesLightIntensity;
// ─── Eclipse (tier 6+ ability) ────────────────────────────────────────
public static ConfigEntry<float> EclipseCooldown;
public static ConfigEntry<float> EclipseCastTime;
public static ConfigEntry<float> EclipseDuration;
// ─── Devour ────────────────────────────────────────────────────────────
public static ConfigEntry<float> DevourCooldown;
// ─── Domination (tier 6+ ability, native Interact key) ───────────────────
public static ConfigEntry<float> EnslaveCooldown;
public static ConfigEntry<float> ThrallLifetime;
public static void Bind(ConfigFile config)
{
const string keybinds = "Aswid - Keybinds";
BatFormKey = config.Bind(keybinds, "Bat Form", new KeyboardShortcut(KeyCode.G),
new ConfigDescription("Transform into (or revert from) a Bat, tier 2+ (night only) / tier 3+ (any time)."));
MistFormKey = config.Bind(keybinds, "Mist Form Toggle", new KeyboardShortcut(KeyCode.H),
new ConfigDescription("Become (or revert from) mist, tier 7+."));
EclipseKey = config.Bind(keybinds, "Cast Eclipse", new KeyboardShortcut(KeyCode.J),
new ConfigDescription("Casts Eclipse, tier 6+. Fails silently at night."));
TameKey = config.Bind(keybinds, "Tame", new KeyboardShortcut(KeyCode.U),
new ConfigDescription("Tames the creature under your cursor, if your tier allows it."));
ToggleDevourKey = config.Bind(keybinds, "Toggle Devour Ability", new KeyboardShortcut(KeyCode.I),
new ConfigDescription("Turns the automatic Devour-on-kill behavior on or off."));
const string combat = "Aswid - Passive Combat";
DamageBonusPerState = config.Bind(combat, "Damage Bonus Per State", 2f,
new ConfigDescription("Flat physical damage added to equipped weapons, per progression state.", new AcceptableValueRange<float>(0f, 10f)));
ArmorBonusPerState = config.Bind(combat, "Armor Bonus Per State", 1f,
new ConfigDescription("Flat armor added, per progression state.", new AcceptableValueRange<float>(0f, 10f)));
SpeedBonusPerState = config.Bind(combat, "Speed Bonus Per State", 0.01f,
new ConfigDescription("Move/jump speed multiplier added, per progression state (0.01 = 1%).", new AcceptableValueRange<float>(0f, 0.1f)));
NightMultiplier = config.Bind(combat, "Night Multiplier", 2f,
new ConfigDescription("Multiplies the speed, armor, damage, and lifesteal bonuses above while it is night.", new AcceptableValueRange<float>(1f, 5f)));
BloodMagicSkillGainMultiplier = config.Bind(combat, "Blood Magic Skill Gain Multiplier", 2f,
new ConfigDescription("Multiplies how fast the Blood Magic skill levels up.", new AcceptableValueRange<float>(0.5f, 5f)));
SurtlingFormDamageBonus = config.Bind(combat, "Surtling Form Damage Bonus", 30f,
new ConfigDescription("Flat damage added to every attack once the tier 8 Surtling form is unlocked.", new AcceptableValueRange<float>(0f, 100f)));
const string aura = "Aswid - Vampiric Aura";
AuraTickInterval = config.Bind(aura, "Tick Interval", 0.25f,
new ConfigDescription("Seconds between aura damage/lifesteal ticks.", new AcceptableValueRange<float>(0.05f, 2f)));
AuraRadiusDay = config.Bind(aura, "Radius (Day)", 3f,
new ConfigDescription("Meters from the player that the aura drains during the day.", new AcceptableValueRange<float>(1f, 20f)));
AuraRadiusNight = config.Bind(aura, "Radius (Night)", 6f,
new ConfigDescription("Meters from the player that the aura drains at night.", new AcceptableValueRange<float>(1f, 20f)));
AuraBaseDamage = config.Bind(aura, "Base Damage", 1f,
new ConfigDescription("Damage per tick before the Blood Magic skill bonus, at human form's 0.5x multiplier.", new AcceptableValueRange<float>(0f, 20f)));
AuraBloodMagicScaling = config.Bind(aura, "Blood Magic Damage Scaling", 5f,
new ConfigDescription("Extra damage per tick at 100 Blood Magic skill (scales linearly from 0).", new AcceptableValueRange<float>(0f, 20f)));
AuraExecuteThreshold = config.Bind(aura, "Execute Threshold", 0.20f,
new ConfigDescription("Non-boss enemies at or below this fraction of max health are executed by the aura instead of merely damaged.", new AcceptableValueRange<float>(0f, 1f)));
const string senses = "Aswid - Superhuman Senses";
SensesRadius = config.Bind(senses, "Detection Radius", 100f,
new ConfigDescription("Meters within which nearby creatures are marked, tier 5+.", new AcceptableValueRange<float>(10f, 300f)));
SensesRefreshInterval = config.Bind(senses, "Refresh Interval", 1f,
new ConfigDescription("Seconds between detection sweeps.", new AcceptableValueRange<float>(0.2f, 5f)));
SensesLightRange = config.Bind(senses, "Marker Light Range", 10f,
new ConfigDescription("Range of the light placed on a detected creature.", new AcceptableValueRange<float>(1f, 30f)));
SensesLightIntensity = config.Bind(senses, "Marker Light Intensity", 2f,
new ConfigDescription("Intensity of the light placed on a detected creature.", new AcceptableValueRange<float>(0.1f, 10f)));
const string eclipse = "Aswid - Eclipse";
EclipseCooldown = config.Bind(eclipse, "Cooldown", 900f,
new ConfigDescription("Seconds between casts.", new AcceptableValueRange<float>(0f, 3600f)));
EclipseCastTime = config.Bind(eclipse, "Cast Time", 2f,
new ConfigDescription("Seconds the player is rooted while casting.", new AcceptableValueRange<float>(0f, 10f)));
EclipseDuration = config.Bind(eclipse, "Duration", 60f,
new ConfigDescription("Seconds the forced night lasts.", new AcceptableValueRange<float>(5f, 600f)));
const string devour = "Aswid - Devour";
DevourCooldown = config.Bind(devour, "Consume Cooldown", 5f,
new ConfigDescription("Minimum seconds between devouring a corpse, outside of an execute (which bypasses this).", new AcceptableValueRange<float>(0f, 60f)));
const string domination = "Aswid - Domination";
EnslaveCooldown = config.Bind(domination, "Enslave Cooldown", 900f,
new ConfigDescription("Seconds between dominating a creature, tier 6+.", new AcceptableValueRange<float>(0f, 3600f)));
ThrallLifetime = config.Bind(domination, "Thrall Lifetime", 60f,
new ConfigDescription("Seconds a dominated thrall survives before it dies on its own.", new AcceptableValueRange<float>(10f, 600f)));
}
}
}