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().
This commit is contained in:
kanym 2026-08-06 14:12:07 +02:00
commit 6755c263f3
5 changed files with 265 additions and 54 deletions

View file

@ -58,17 +58,17 @@ namespace RacesOfValheim
}
if (isGrounded && RaceInput.Allowed)
{
if (Input.GetKeyDown(KeyCode.O))
if (FenrirConfig.HowlKey.Value.IsDown())
{
StartCoroutine(HowlRoutine());
}
else if (Input.GetMouseButtonDown(1)) // Tasto destro (Heavy Claw)
{
StartCoroutine(ClawRoutine("attack_claw1", 110f, 1.2f, 0.5f));
StartCoroutine(ClawRoutine("attack_claw1", FenrirConfig.FenringHeavyClawDamage.Value, 1.2f, 0.5f));
}
else if (Input.GetMouseButtonDown(0)) // Tasto sinistro
{
StartCoroutine(ClawRoutine("attack_claw0", 60f, 1.0f, 0.4f));
StartCoroutine(ClawRoutine("attack_claw0", FenrirConfig.FenringLightClawDamage.Value, 1.0f, 0.4f));
}
else if (Input.GetMouseButtonDown(2)) // Tasto centrale
{
@ -173,11 +173,11 @@ namespace RacesOfValheim
Rigidbody rb = Player.m_localPlayer.GetComponent<Rigidbody>();
if (rb != null)
{
Vector3 dashVelocity = Player.m_localPlayer.transform.forward * 31.5f;
Vector3 dashVelocity = Player.m_localPlayer.transform.forward * FenrirConfig.FenringJumpDashSpeed.Value;
// Spinta verso l'alto solo nella prima metà dello scatto
if (elapsedDash < dashDuration / 2f)
if (elapsedDash < dashDuration / 2f)
{
dashVelocity += Vector3.up * 13.1f;
dashVelocity += Vector3.up * FenrirConfig.FenringJumpDashUpwardSpeed.Value;
}
rb.MovePosition(rb.position + dashVelocity * Time.fixedDeltaTime);
@ -188,7 +188,7 @@ namespace RacesOfValheim
}
// Infliggiamo il danno al termine dello scatto
ExecuteClawDamage(95f);
ExecuteClawDamage(FenrirConfig.FenringJumpAttackDamage.Value);
// Tempo per riprendersi dall'atterraggio prima di potersi muovere di nuovo
yield return new WaitForSeconds(0.55f);
@ -203,7 +203,7 @@ namespace RacesOfValheim
Vector3 playerPos = Player.m_localPlayer.transform.position;
Vector3 attackPoint = playerPos + Player.m_localPlayer.transform.forward * 1.5f + Vector3.up * 1f;
float attackRadius = 2.5f;
float attackRadius = FenrirConfig.FenringAttackRadius.Value;
float unarmedSkillLevel = Player.m_localPlayer.GetSkillLevel(Skills.SkillType.Unarmed);
float totalDamage = baseDamage + unarmedSkillLevel;
@ -243,7 +243,7 @@ namespace RacesOfValheim
{
HitData hitData = new HitData();
hitData.m_damage.m_slash = totalDamage;
hitData.m_pushForce = 30f;
hitData.m_pushForce = FenrirConfig.FenringPushForce.Value;
hitData.m_point = targetCenter;
hitData.m_dir = Player.m_localPlayer.transform.forward;
hitData.m_skill = Skills.SkillType.Unarmed;
@ -339,7 +339,7 @@ namespace RacesOfValheim
StopFire();
}
if (canAct && Input.GetKeyDown(KeyCode.O))
if (canAct && FenrirConfig.HowlKey.Value.IsDown())
{
StartCoroutine(HowlRoutine());
}
@ -429,8 +429,7 @@ namespace RacesOfValheim
private void UpdateFire()
{
// Drain Eitr ridotto del 50% (da 25 a 12.5 per sec)
Player.m_localPlayer.UseEitr(12.5f * Time.deltaTime);
Player.m_localPlayer.UseEitr(FenrirConfig.CultistFireEitrDrainPerSecond.Value * Time.deltaTime);
cultistAnim.SetFloat("forward_speed", 0f);
cultistAnim.SetFloat("sideway_speed", 0f);
@ -460,11 +459,11 @@ namespace RacesOfValheim
Vector3 playerPos = Player.m_localPlayer.transform.position;
Vector3 attackPoint = playerPos + Player.m_localPlayer.transform.forward * 2.5f + Vector3.up * 1f;
float attackRadius = 3f;
float attackRadius = FenrirConfig.CultistFireAttackRadius.Value;
float magicSkillLevel = Player.m_localPlayer.GetSkillLevel(Skills.SkillType.ElementalMagic);
float baseFireDamage = 20f; // per 0.2s
float totalDamage = baseFireDamage + (magicSkillLevel * 0.5f);
float baseFireDamage = FenrirConfig.CultistFireDamagePerTick.Value;
float totalDamage = baseFireDamage + (magicSkillLevel * FenrirConfig.CultistFireMagicSkillScaling.Value);
int layerMask = LayerMask.GetMask("Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "character", "character_net", "character_ghost", "hitbox", "character_noenv", "vehicle");
Collider[] hits = Physics.OverlapSphere(attackPoint, attackRadius, layerMask);
@ -531,7 +530,7 @@ namespace RacesOfValheim
PlaySFX("sfx_cultist_attack", "sfx_fenring_attack", "sfx_wolf_attack");
ExecuteClawDamage(85f);
ExecuteClawDamage(FenrirConfig.CultistClawDamage.Value);
float remainingTimeToIdle = 0.5f - 0.4f;
if (remainingTimeToIdle > 0)
@ -557,7 +556,7 @@ namespace RacesOfValheim
PlaySFX("sfx_cultist_attack_double", "sfx_cultist_attack", "sfx_fenring_attack");
ExecuteClawDamage(140f);
ExecuteClawDamage(FenrirConfig.CultistDoubleClawDamage.Value);
// Attendiamo che l'animazione finisca (locking del giocatore)
// L'animazione doppia del cultista dura circa 1.5 - 2 secondi
@ -573,7 +572,7 @@ namespace RacesOfValheim
Vector3 playerPos = Player.m_localPlayer.transform.position;
Vector3 attackPoint = playerPos + Player.m_localPlayer.transform.forward * 1.5f + Vector3.up * 1f;
float attackRadius = 2.5f;
float attackRadius = FenrirConfig.CultistAttackRadius.Value;
float unarmedSkillLevel = Player.m_localPlayer.GetSkillLevel(Skills.SkillType.Unarmed);
float totalDamage = baseDamage + unarmedSkillLevel;
@ -613,7 +612,7 @@ namespace RacesOfValheim
{
HitData hitData = new HitData();
hitData.m_damage.m_slash = totalDamage;
hitData.m_pushForce = 30f;
hitData.m_pushForce = FenrirConfig.CultistPushForce.Value;
hitData.m_point = targetCenter;
hitData.m_dir = Player.m_localPlayer.transform.forward;
hitData.m_skill = Skills.SkillType.Unarmed;
@ -679,15 +678,15 @@ namespace RacesOfValheim
{
if (Input.GetMouseButtonDown(0)) // Left Click
{
StartCoroutine(WolfAttackRoutine("attack1", 40f, 0.6f, 0.2f));
StartCoroutine(WolfAttackRoutine("attack1", FenrirConfig.WolfAttack1Damage.Value, 0.6f, 0.2f));
}
else if (Input.GetMouseButtonDown(1)) // Right Click
{
StartCoroutine(WolfAttackRoutine("attack2", 60f, 0.8f, 0.3f));
StartCoroutine(WolfAttackRoutine("attack2", FenrirConfig.WolfAttack2Damage.Value, 0.8f, 0.3f));
}
else if (Input.GetMouseButtonDown(2)) // Middle Click
{
StartCoroutine(WolfAttackRoutine("attack3", 80f, 1.0f, 0.4f));
StartCoroutine(WolfAttackRoutine("attack3", FenrirConfig.WolfAttack3Damage.Value, 1.0f, 0.4f));
}
}
}
@ -745,7 +744,7 @@ namespace RacesOfValheim
Vector3 playerPos = Player.m_localPlayer.transform.position;
// Il lupo è basso, abbassiamo l'altezza dell'attacco
Vector3 attackPoint = playerPos + Player.m_localPlayer.transform.forward * 1.5f + Vector3.up * 0.5f;
float attackRadius = 2.0f;
float attackRadius = FenrirConfig.WolfAttackRadius.Value;
float unarmedSkillLevel = Player.m_localPlayer.GetSkillLevel(Skills.SkillType.Unarmed);
float totalDamage = baseDamage + unarmedSkillLevel;
@ -785,7 +784,7 @@ namespace RacesOfValheim
{
HitData hitData = new HitData();
hitData.m_damage.m_slash = totalDamage;
hitData.m_pushForce = 20f;
hitData.m_pushForce = FenrirConfig.WolfPushForce.Value;
hitData.m_point = targetCenter;
hitData.m_dir = Player.m_localPlayer.transform.forward;
hitData.m_skill = Skills.SkillType.Unarmed;
@ -852,12 +851,12 @@ namespace RacesOfValheim
{
if (Input.GetMouseButtonDown(0)) // Left Click
{
StartCoroutine(UlvAttackRoutine("attack_bite", 40f, 0.6f, 0.2f));
StartCoroutine(UlvAttackRoutine("attack_bite", FenrirConfig.UlvBiteDamage.Value, 0.6f, 0.2f));
}
else if (Input.GetMouseButtonDown(1)) // Right Click
{
// Right click uses bite but as a heavier attack since slash is moved to jump
StartCoroutine(UlvAttackRoutine("attack_bite", 60f, 0.8f, 0.3f));
StartCoroutine(UlvAttackRoutine("attack_bite", FenrirConfig.UlvHeavyBiteDamage.Value, 0.8f, 0.3f));
}
else if (Input.GetMouseButtonDown(2)) // Middle Click
{
@ -928,7 +927,7 @@ namespace RacesOfValheim
Vector3 playerPos = Player.m_localPlayer.transform.position;
Vector3 attackPoint = playerPos + Player.m_localPlayer.transform.forward * 1.5f + Vector3.up * 0.5f;
float attackRadius = 2.0f;
float attackRadius = FenrirConfig.UlvAttackRadius.Value;
float unarmedSkillLevel = Player.m_localPlayer.GetSkillLevel(Skills.SkillType.Unarmed);
float totalDamage = baseDamage + unarmedSkillLevel;
@ -968,7 +967,7 @@ namespace RacesOfValheim
{
HitData hitData = new HitData();
hitData.m_damage.m_slash = totalDamage;
hitData.m_pushForce = 25f;
hitData.m_pushForce = FenrirConfig.UlvPushForce.Value;
hitData.m_point = targetCenter;
hitData.m_dir = Player.m_localPlayer.transform.forward;
hitData.m_skill = Skills.SkillType.Unarmed;
@ -999,7 +998,7 @@ namespace RacesOfValheim
// Leap forward (+50% range)
float leapDuration = 0.25f;
float leapSpeed = 18f; // Increased from 12f to 18f
float leapSpeed = FenrirConfig.UlvLeapSpeed.Value;
float elapsed = 0f;
while (elapsed < leapDuration)
@ -1022,7 +1021,7 @@ namespace RacesOfValheim
}
}
ExecuteBiteDamage(80f);
ExecuteBiteDamage(FenrirConfig.UlvJumpAttackDamage.Value);
yield return new WaitForSeconds(0.4f);