feat(draugh): make abilities BepInEx-configurable; reorder Skadi sections

Adds DraughConfig.cs, following the SkadiConfig/AswidConfig pattern: one
Configuration Manager section per tier ability (Passive Combat, Sunken
Menace, Rotting Edge, Undead Fortitude, North Wind, Undying Will, Swarm Of
Terror, Steal Their Breath). No keybinds section - every Draugh ability
triggers off a game event (parry, hit taken/landed, death) rather than a
key press. Defaults match the previous hardcoded constants exactly.

Also reorders SkadiConfig so Passive Combat binds right after Keybinds,
matching the Aswid/Draugh section order (Keybinds, then Passive Combat,
then the rest).

Config sections stay bound alphabetically by race (Aswid, Draugh, Skadi)
in RacesOfValheim.Awake().
This commit is contained in:
kanym 2026-08-06 13:42:44 +02:00
commit 8595b7108a
6 changed files with 166 additions and 49 deletions

View file

@ -20,7 +20,7 @@ namespace RacesOfValheim
if (BossProgressionManager.GetCurrentProgressionState() >= 2)
{
// Invert the Wet debuff to actually heal the Draugh
__instance.m_healthRegenMultiplier = 1.25f; // +25% health regen
__instance.m_healthRegenMultiplier = DraughConfig.WetHealthRegenMultiplier.Value;
__instance.m_staminaRegenMultiplier = 1f; // No stamina penalty
__instance.m_tooltip = "The water restores your rotten flesh. Health regeneration increased.";
}
@ -47,20 +47,21 @@ namespace RacesOfValheim
float physDamage = hit.m_damage.m_blunt + hit.m_damage.m_slash + hit.m_damage.m_pierce + hit.m_damage.m_chop;
if (physDamage > 0f && hit.m_skill != Skills.SkillType.BloodMagic && hit.m_skill != Skills.SkillType.ElementalMagic)
{
// Add poison damage based on the physical damage (e.g., 20% of physical damage as poison DoT)
hit.m_damage.m_poison += physDamage * 0.20f;
// Add poison damage based on the physical damage
hit.m_damage.m_poison += physDamage * DraughConfig.PoisonOnHitPercent.Value;
}
}
if (BossProgressionManager.GetCurrentProgressionState() >= 4)
{
// Stage 4: Undead Fortitude (+30% crit damage on staggered enemies)
// Stage 4: Undead Fortitude (crit damage on staggered enemies)
if (__instance.IsStaggering())
{
hit.m_damage.m_blunt *= 1.30f;
hit.m_damage.m_slash *= 1.30f;
hit.m_damage.m_pierce *= 1.30f;
hit.m_damage.m_chop *= 1.30f;
float critMult = DraughConfig.StaggerCritMultiplier.Value;
hit.m_damage.m_blunt *= critMult;
hit.m_damage.m_slash *= critMult;
hit.m_damage.m_pierce *= critMult;
hit.m_damage.m_chop *= critMult;
}
}
}
@ -82,31 +83,31 @@ namespace RacesOfValheim
if (state >= 3)
{
// Check if it was a parry.
// Check if it was a parry.
float blockTimer = Traverse.Create(__instance).Field("m_blockTimer").GetValue<float>();
float parryTime = 0.25f; // Default Valheim parry window
float parryTime = DraughConfig.ParryWindow.Value;
if (blockTimer != -1f && blockTimer <= parryTime)
{
// Stage 3: Poison Splash
HitData poisonSplash = new HitData();
poisonSplash.m_damage.m_poison = 40f; // Flat base poison splash
poisonSplash.m_damage.m_poison = DraughConfig.PoisonSplashDamage.Value;
poisonSplash.m_point = attacker.GetCenterPoint();
poisonSplash.SetAttacker(__instance);
poisonSplash.m_dir = (attacker.GetCenterPoint() - __instance.GetCenterPoint()).normalized;
attacker.ApplyDamage(poisonSplash, true, false);
// Visual effect for splash
UnityEngine.Object.Instantiate(ZNetScene.instance.GetPrefab("vfx_OozeHit"), attacker.GetCenterPoint(), Quaternion.identity);
// Stage 5: North Wind (AoE Frost)
if (state >= 5)
{
if (Time.time - lastNorthWindTime >= 20f)
if (Time.time - lastNorthWindTime >= DraughConfig.NorthWindCooldown.Value)
{
lastNorthWindTime = Time.time;
// Visual effect for Nova (sledge frost effect)
GameObject iceHit = ZNetScene.instance.GetPrefab("vfx_sledge_iron_hit"); // Actually, vfx_ice_hit is better, or vfx_sledge_iron_hit which is used by Frostner
if (iceHit == null) iceHit = ZNetScene.instance.GetPrefab("vfx_ice_hit");
@ -115,25 +116,26 @@ namespace RacesOfValheim
UnityEngine.Object.Instantiate(iceHit, __instance.transform.position, Quaternion.identity);
}
// Find all characters within 8 meters
// Find all characters within range
float northWindRadius = DraughConfig.NorthWindRadius.Value;
List<Character> allCharacters = Character.GetAllCharacters();
foreach (Character ch in allCharacters)
{
if (ch == null || ch == __instance || ch.IsPlayer() || ch.IsDead()) continue;
if (Vector3.Distance(__instance.transform.position, ch.transform.position) <= 8f)
if (Vector3.Distance(__instance.transform.position, ch.transform.position) <= northWindRadius)
{
HitData northWind = new HitData();
northWind.m_damage.m_frost = 50f;
northWind.m_damage.m_frost = DraughConfig.NorthWindFrostDamage.Value;
northWind.m_point = ch.GetCenterPoint();
northWind.SetAttacker(__instance);
northWind.m_dir = (ch.GetCenterPoint() - __instance.GetCenterPoint()).normalized;
northWind.m_pushForce = 20f;
northWind.m_pushForce = DraughConfig.NorthWindPushForce.Value;
ch.ApplyDamage(northWind, true, false);
}
}
Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "The northern wind blows");
}
}
@ -177,7 +179,7 @@ namespace RacesOfValheim
{
if (p.m_customData != null && p.m_customData.TryGetValue("Race", out string race) && race == "Draugh")
{
if (Vector3.Distance(__instance.transform.position, p.transform.position) <= 100f)
if (Vector3.Distance(__instance.transform.position, p.transform.position) <= DraughConfig.DeathAuraRadius.Value)
{
draughNearby = true;
break;
@ -229,7 +231,7 @@ namespace RacesOfValheim
}
float currentEitr = __instance.GetEitr();
if (currentEitr > 0f && Time.time - DraughRace.lastUndyingWillTime >= 600f) // 10 minutes
if (currentEitr > 0f && Time.time - DraughRace.lastUndyingWillTime >= DraughConfig.UndyingWillCooldown.Value)
{
// Trigger Undying Will!
DraughRace.lastUndyingWillTime = Time.time;
@ -279,12 +281,12 @@ namespace RacesOfValheim
if (hit == null || hit.GetAttacker() == null || hit.m_damage.GetTotalDamage() <= 0f) return;
// Melee check via distance
if (Vector3.Distance(hit.GetAttacker().transform.position, __instance.transform.position) <= 5f)
if (Vector3.Distance(hit.GetAttacker().transform.position, __instance.transform.position) <= DraughConfig.SwarmDetectionRadius.Value)
{
if (Time.time - DraughRace.lastSeekerSpawnTime >= 10f)
if (Time.time - DraughRace.lastSeekerSpawnTime >= DraughConfig.SwarmSpawnCooldown.Value)
{
DraughRace.lastSeekerSpawnTime = Time.time;
GameObject prefab = ObjectDB.instance.GetItemPrefab("SeekerBrood");
if (prefab == null)
{
@ -295,17 +297,17 @@ namespace RacesOfValheim
{
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "Swarm of Terror!");
for (int i = 0; i < 2; i++)
for (int i = 0; i < DraughConfig.SwarmSpawnCount.Value; i++)
{
Vector3 spawnPos = __instance.transform.position + __instance.transform.forward * 1f + UnityEngine.Random.insideUnitSphere * 1.5f;
spawnPos.y = __instance.transform.position.y;
GameObject brood = UnityEngine.Object.Instantiate(prefab, spawnPos, Quaternion.identity);
Character c = brood.GetComponent<Character>();
if (c != null)
{
c.m_faction = Character.Faction.Players; // Make it friendly
// Remove drops
CharacterDrop drop = brood.GetComponent<CharacterDrop>();
if (drop != null)
@ -313,8 +315,7 @@ namespace RacesOfValheim
UnityEngine.Object.Destroy(drop);
}
// Kill after 9.5 seconds
DraughRace.Instance.StartCoroutine(DraughRace.Instance.KillBroodAfterTime(c, 9.5f));
DraughRace.Instance.StartCoroutine(DraughRace.Instance.KillBroodAfterTime(c, DraughConfig.SwarmBroodLifetime.Value));
}
}
}
@ -335,7 +336,7 @@ namespace RacesOfValheim
// Steal Their Breath triggered!
DraughRace.isUndying = false; // Break the routine loop
float healAmount = Player.m_localPlayer.GetMaxHealth() * 0.25f;
float healAmount = Player.m_localPlayer.GetMaxHealth() * DraughConfig.StealBreathHealPercent.Value;
Player.m_localPlayer.Heal(healAmount);
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "Steal Their Breath! Death is denied.");