diff --git a/JotunnModStub/RacesOfValheim.cs b/JotunnModStub/RacesOfValheim.cs index 6434ba1..002a20a 100644 --- a/JotunnModStub/RacesOfValheim.cs +++ b/JotunnModStub/RacesOfValheim.cs @@ -33,6 +33,7 @@ namespace RacesOfValheim FenrirConfig.Bind(Config); FurlingConfig.Bind(Config); SkadiConfig.Bind(Config); + SkeletonConfig.Bind(Config); harmony.PatchAll(); gameObject.AddComponent(); gameObject.AddComponent(); diff --git a/JotunnModStub/Skeleton/SkeletonConfig.cs b/JotunnModStub/Skeleton/SkeletonConfig.cs new file mode 100644 index 0000000..a31f1a9 --- /dev/null +++ b/JotunnModStub/Skeleton/SkeletonConfig.cs @@ -0,0 +1,76 @@ +using BepInEx.Configuration; + +namespace RacesOfValheim +{ + /// + /// Every tunable number behind the Skeleton'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 the other races' layout). + /// + /// No keybinds section: every Skeleton ability is passive, triggered by tier and combat events + /// rather than a key press. + /// + /// The per-tier progression table itself (SkeletonProgression.GetRules: max health bonus, + /// lifesteal percent per tier, max summons) is left as-is, same boundary drawn for every other + /// race's progression table - not exposed here. Only the flat ability numbers a tier's boolean + /// flag switches on are configurable. + /// + /// One caveat: Enhanced Regen Health Multiplier is read into SE_SkeletonStats.RebuildForState, + /// which only re-reads it when the player's progression state changes (it short-circuits if + /// the state matches what it last built for). Retuning that one value mid-session at an + /// already-reached tier needs a relog (or reaching a new tier) to take effect. Everything else + /// here reads live on every use. + /// + public static class SkeletonConfig + { + // ─── Passive combat ────────────────────────────────────────────────── + public static ConfigEntry AutoStunCooldown; + public static ConfigEntry AutoStunStaggerMultiplier; + public static ConfigEntry PoisonAttackBonus; + public static ConfigEntry EnhancedRegenHealthMultiplier; + public static ConfigEntry EnhancedRegenTickSpeedBonus; + + // ─── Fire Aura (tier 5+) ─────────────────────────────────────────────── + public static ConfigEntry FireAuraRadius; + public static ConfigEntry FireAuraDamagePerTick; + public static ConfigEntry FireAuraTickInterval; + + // ─── Resurrection (tier 6+) ──────────────────────────────────────────── + public static ConfigEntry ResurrectionCooldown; + + // ─── Visuals ─────────────────────────────────────────────────────────── + public static ConfigEntry HeadFireVFXEnabled; + + public static void Bind(ConfigFile config) + { + const string combat = "Skeleton - Passive Combat"; + AutoStunCooldown = config.Bind(combat, "Auto Stun Cooldown", 5f, + new ConfigDescription("Seconds between forced staggers on the enemy hit, tier 3+.", new AcceptableValueRange(0f, 60f))); + AutoStunStaggerMultiplier = config.Bind(combat, "Auto Stun Stagger Multiplier", 100f, + new ConfigDescription("Stagger multiplier applied to force the stagger through.", new AcceptableValueRange(1f, 500f))); + PoisonAttackBonus = config.Bind(combat, "Poison Attack Bonus", 20f, + new ConfigDescription("Flat poison damage added to every hit the player lands, tier 4+.", new AcceptableValueRange(0f, 100f))); + EnhancedRegenHealthMultiplier = config.Bind(combat, "Enhanced Regen Health Multiplier", 1.5f, + new ConfigDescription("Health regeneration multiplier, tier 5+.", new AcceptableValueRange(1f, 5f))); + EnhancedRegenTickSpeedBonus = config.Bind(combat, "Enhanced Regen Tick Speed Bonus", 0.25f, + new ConfigDescription("Extra speed at which the regen timer accumulates, tier 5+ (0.25 = 25% faster ticks).", new AcceptableValueRange(0f, 2f))); + + const string aura = "Skeleton - Fire Aura"; + FireAuraRadius = config.Bind(aura, "Radius", 5f, + new ConfigDescription("Meters from the player that the tier 5+ aura damages.", new AcceptableValueRange(1f, 20f))); + FireAuraDamagePerTick = config.Bind(aura, "Damage Per Tick", 30f, + new ConfigDescription("Fire damage dealt to every enemy in range, once per tick.", new AcceptableValueRange(0f, 100f))); + FireAuraTickInterval = config.Bind(aura, "Tick Interval", 1f, + new ConfigDescription("Seconds between aura damage ticks.", new AcceptableValueRange(0.1f, 5f))); + + const string resurrection = "Skeleton - Resurrection"; + ResurrectionCooldown = config.Bind(resurrection, "Cooldown", 300f, + new ConfigDescription("Seconds between auto-resurrections, tier 6+.", new AcceptableValueRange(0f, 3600f))); + + const string visuals = "Skeleton - Visuals"; + HeadFireVFXEnabled = config.Bind(visuals, "Head Fire VFX Enabled", true, + new ConfigDescription("Whether the burning-skull effect (worn from tier 5+) renders at all. A client-side preference: disabling it stops you from seeing it on yourself and on every other skeleton you look at, but does not change what other players see.")); + } + } +} diff --git a/JotunnModStub/Skeleton/SkeletonPatches.cs b/JotunnModStub/Skeleton/SkeletonPatches.cs index df22e9d..d302562 100644 --- a/JotunnModStub/Skeleton/SkeletonPatches.cs +++ b/JotunnModStub/Skeleton/SkeletonPatches.cs @@ -594,16 +594,16 @@ namespace RacesOfValheim if (attacker != null && attacker == Player.m_localPlayer && SkeletonRace.IsSkeleton()) { // Auto Stun - if (rules.AutoStunFirstHit && Time.time - lastStunTime > 5f) + if (rules.AutoStunFirstHit && Time.time - lastStunTime > SkeletonConfig.AutoStunCooldown.Value) { - hit.m_staggerMultiplier = 100f; // Force stagger + hit.m_staggerMultiplier = SkeletonConfig.AutoStunStaggerMultiplier.Value; // Force stagger lastStunTime = Time.time; } // Poison Attacks if (rules.PoisonAttacks) { - hit.m_damage.m_poison += 20f; // Add flat 20 poison damage + hit.m_damage.m_poison += SkeletonConfig.PoisonAttackBonus.Value; } // Lifesteal diff --git a/JotunnModStub/Skeleton/SkeletonRace.cs b/JotunnModStub/Skeleton/SkeletonRace.cs index b6f7e1f..6fa6e92 100644 --- a/JotunnModStub/Skeleton/SkeletonRace.cs +++ b/JotunnModStub/Skeleton/SkeletonRace.cs @@ -431,18 +431,17 @@ namespace RacesOfValheim // rate, which is the player's own field. if (rules.EnhancedRegen) { - // Speed up regen ticks by 20% (1.25x faster timer accumulation) float currentTimer = HarmonyLib.Traverse.Create(Player.m_localPlayer).Field("m_foodRegenTimer").Value; - HarmonyLib.Traverse.Create(Player.m_localPlayer).Field("m_foodRegenTimer").SetValue(currentTimer + Time.deltaTime * 0.25f); + HarmonyLib.Traverse.Create(Player.m_localPlayer).Field("m_foodRegenTimer").SetValue(currentTimer + Time.deltaTime * SkeletonConfig.EnhancedRegenTickSpeedBonus.Value); } // Flames on the skull, worn with the fire-tier model and nothing else. - headFlame.Apply(Player.m_localPlayer, rules.ModelPrefab == SkeletonProgression.FireModel); + headFlame.Apply(Player.m_localPlayer, SkeletonConfig.HeadFireVFXEnabled.Value && rules.ModelPrefab == SkeletonProgression.FireModel); if (rules.FireAura) { EnsureFireAuraVFX(true); - if (Time.time - lastAuraTime >= 1f) + if (Time.time - lastAuraTime >= SkeletonConfig.FireAuraTickInterval.Value) { ApplyFireAura(); lastAuraTime = Time.time; @@ -551,10 +550,10 @@ namespace RacesOfValheim if (Player.m_localPlayer == null) return; Vector3 center = Player.m_localPlayer.transform.position; - float radius = 5f; - + float radius = SkeletonConfig.FireAuraRadius.Value; + HitData hitData = new HitData(); - hitData.m_damage.m_fire = 30f; // 30 fire damage per second + hitData.m_damage.m_fire = SkeletonConfig.FireAuraDamagePerTick.Value; hitData.SetAttacker(Player.m_localPlayer); hitData.m_dir = Vector3.zero; diff --git a/JotunnModStub/Skeleton/SkeletonStatusEffects.cs b/JotunnModStub/Skeleton/SkeletonStatusEffects.cs index 553a760..502dd04 100644 --- a/JotunnModStub/Skeleton/SkeletonStatusEffects.cs +++ b/JotunnModStub/Skeleton/SkeletonStatusEffects.cs @@ -39,7 +39,7 @@ namespace RacesOfValheim // template: SEMan.AddStatusEffect clones what it is given and adds the clone, so // anything written to the template afterwards reaches nobody. That is why the Moder // regeneration bonus never applied either. - m_healthRegenMultiplier = rules.EnhancedRegen ? 1.5f : 1.0f; + m_healthRegenMultiplier = rules.EnhancedRegen ? SkeletonConfig.EnhancedRegenHealthMultiplier.Value : 1.0f; m_mods = new List { @@ -62,9 +62,9 @@ namespace RacesOfValheim base.Setup(character); m_name = "Resurrection Cooldown"; m_tooltip = "Your skeletal body is too weak to resurrect again right now."; - m_icon = Jotunn.Managers.PrefabManager.Cache.GetPrefab("TrophySkeletonPoison")?.GetComponent()?.m_itemData.GetIcon() + m_icon = Jotunn.Managers.PrefabManager.Cache.GetPrefab("TrophySkeletonPoison")?.GetComponent()?.m_itemData.GetIcon() ?? Jotunn.Managers.PrefabManager.Cache.GetPrefab("TrophySkeleton")?.GetComponent()?.m_itemData.GetIcon(); - m_ttl = 300f; // 5 minutes + m_ttl = SkeletonConfig.ResurrectionCooldown.Value; } } } diff --git a/JotunnModStub/ZdoVisualSync.cs b/JotunnModStub/ZdoVisualSync.cs index 1c698dc..4559f86 100644 --- a/JotunnModStub/ZdoVisualSync.cs +++ b/JotunnModStub/ZdoVisualSync.cs @@ -164,7 +164,7 @@ namespace RacesOfValheim // The burning skull, grown locally for whoever we are looking at. The tier is on the // ZDO, so this client can work out for itself whether they should be alight. - m_skeletonHeadFlame.Apply(m_player, rules.ModelPrefab == SkeletonProgression.FireModel); + m_skeletonHeadFlame.Apply(m_player, SkeletonConfig.HeadFireVFXEnabled.Value && rules.ModelPrefab == SkeletonProgression.FireModel); // Apply Scale Vector3 targetScale = rules.ScaleMultiplier;