feat(skadi): make abilities and special attacks BepInEx-configurable

Binds every tunable number behind Skadi's Cold Spell, frost aura, bonus
frost damage, dragon-form scale/melee/ranged attacks, and directed flight
as BepInEx ConfigEntry values (SkadiConfig.cs), following
CONFIGURATION-MANAGER-HOWTO.md. Defaults match the previous hardcoded
constants exactly, so this is config-only, no gameplay change.

BepInEx writes these to BepInEx/config/com.nandor.racesofvalheim.cfg on
first run regardless of whether Configuration Manager is installed - a
plain, commented, hand-editable text file - so players without the plugin
can still retune values by hand.
This commit is contained in:
kanym 2026-08-06 12:45:53 +02:00
commit c088eb74f4
5 changed files with 172 additions and 30 deletions

View file

@ -27,17 +27,21 @@ namespace RacesOfValheim
// Cold Spell tuning. Damage is 15 + 8 per progression state, so it runs from roughly 31 at
// Eikthyr to 79 at Fader - deliberately a notch under the melee options of the other races
// at each tier, which is the trade for hitting at range on a short cooldown.
//
// All values below read from SkadiConfig (BepInEx Config, see SkadiConfig.cs) rather than
// being fixed constants, so they can be retuned from Configuration Manager without a
// rebuild - see CONFIGURATION-MANAGER-HOWTO.md.
public const string SPELL_COOLDOWN_SE = "SE_SkadiSpellCooldown";
public const string ATTACK_COOLDOWN_SE = "SE_SkadiAttackCooldown";
private const float SPELL_STAMINA_COST = 20f;
private const float SPELL_COOLDOWN = 1.5f;
private const float IMPROVED_SPELL_COOLDOWN = 4f;
private const float SPELL_BASE_DAMAGE = 15f;
private const float SPELL_DAMAGE_PER_STATE = 8f;
private const int IMPROVED_SPELL_SHARDS = 10;
private static float SPELL_STAMINA_COST => SkadiConfig.SpellStaminaCost.Value;
private static float SPELL_COOLDOWN => SkadiConfig.SpellCooldown.Value;
private static float IMPROVED_SPELL_COOLDOWN => SkadiConfig.ImprovedSpellCooldown.Value;
private static float SPELL_BASE_DAMAGE => SkadiConfig.SpellBaseDamage.Value;
private static float SPELL_DAMAGE_PER_STATE => SkadiConfig.SpellDamagePerState.Value;
private static int IMPROVED_SPELL_SHARDS => SkadiConfig.ImprovedSpellShards.Value;
// The improved cast spreads 1.6 casts worth of damage over its shards: wider, not stronger.
private const float IMPROVED_SPELL_DAMAGE_BUDGET = 1.6f;
private static float IMPROVED_SPELL_DAMAGE_BUDGET => SkadiConfig.ImprovedSpellDamageBudget.Value;
private void Awake()
{
@ -158,7 +162,7 @@ namespace RacesOfValheim
if (rules.FrostAura)
{
EnsureFrostAuraVFX(true);
if (Time.time - lastAuraTime >= 1f)
if (Time.time - lastAuraTime >= SkadiConfig.AuraTickInterval.Value)
{
ApplyColdAura();
lastAuraTime = Time.time;
@ -482,10 +486,10 @@ namespace RacesOfValheim
if (c == Player.m_localPlayer) continue;
if (c.IsTamed() || c.IsPlayer()) continue;
if (Vector3.Distance(center, c.transform.position) <= 3f)
if (Vector3.Distance(center, c.transform.position) <= SkadiConfig.AuraRadius.Value)
{
HitData hit = new HitData();
hit.m_damage.m_frost = 10f;
hit.m_damage.m_frost = SkadiConfig.AuraDamagePerTick.Value;
hit.m_point = c.transform.position;
hit.m_dir = (c.transform.position - center).normalized;
hit.SetAttacker(Player.m_localPlayer);
@ -525,9 +529,9 @@ namespace RacesOfValheim
private Vector3 GetFormScale(SkadiProgression.FormType form)
{
if (form == SkadiProgression.FormType.Moder) return Vector3.one * 0.5f; // Increased to 50%
if (form == SkadiProgression.FormType.SkeletonDragon) return Vector3.one * 0.55f; // 10% larger than Moder
return Vector3.one * 0.9f; // Drake (reduced by 10%)
if (form == SkadiProgression.FormType.Moder) return Vector3.one * SkadiConfig.ModerScale.Value;
if (form == SkadiProgression.FormType.SkeletonDragon) return Vector3.one * SkadiConfig.FaderScale.Value;
return Vector3.one * SkadiConfig.DrakeScale.Value; // Drake
}
private IEnumerator TransformRoutine(SkadiProgression.FormRules rules)