RacesOfValheim/JotunnModStub/Skeleton/SkeletonStatusEffects.cs
kanym 0a3f82e955 feat(skeleton): make ability numbers BepInEx-configurable, add fire VFX toggle
Adds SkeletonConfig.cs, following the established per-race pattern: one
Configuration Manager section per topic (Passive Combat, Fire Aura,
Resurrection). No keybinds section - every Skeleton ability is passive,
triggered by tier and combat events rather than a key press. Defaults
match the previous hardcoded constants exactly.

The per-tier progression table itself (max health bonus, lifesteal
percent, max summons) stays untouched, same boundary drawn for every
other race's progression table.

Also adds a client-side "Head Fire VFX Enabled" toggle under a new
Skeleton - Visuals section, gating both places the burning-skull effect
is triggered (SkeletonRace for the local player, ZdoVisualSync for every
other skeleton-race player this client renders) - disabling it stops the
flame rendering for this client only, without changing what other
players see.

Config sections stay bound alphabetically by race (Aswid, Draugh,
Dvergar, Fenrir, Furling, Skadi, Skeleton) in RacesOfValheim.Awake().
2026-08-06 15:11:39 +02:00

70 lines
3.2 KiB
C#

using UnityEngine;
using System.Collections.Generic;
namespace RacesOfValheim
{
public class SE_SkeletonStats : SE_Stats
{
// The tier the current m_mods were built for. -1 means "never built".
private int m_appliedState = -1;
public override void Setup(Character character)
{
base.Setup(character);
RebuildForState();
}
public override void UpdateStatusEffect(float dt)
{
base.UpdateStatusEffect(dt);
// Setup runs once, when the effect is first applied - so the damage modifiers were
// frozen at whatever tier the player happened to be on then, usually tier 1 because the
// effect goes on at spawn before a boss is ever killed. Poison immunity therefore never
// arrived: killing the boss changed the rules, and nothing ever asked them again.
// Everything else the race does re-reads GetRules per hit, which is why only the
// modifiers looked broken. Re-check here instead; the state comparison makes it free.
RebuildForState();
}
private void RebuildForState()
{
int state = BossProgressionManager.GetCurrentProgressionState();
if (state == m_appliedState) return;
m_appliedState = state;
SkeletonProgression.SkeletonRules rules = SkeletonProgression.GetRules(state);
// Set here, on the live effect, rather than by SkeletonRace on the registered
// 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 ? SkeletonConfig.EnhancedRegenHealthMultiplier.Value : 1.0f;
m_mods = new List<HitData.DamageModPair>
{
new HitData.DamageModPair { m_type = HitData.DamageType.Pierce, m_modifier = HitData.DamageModifier.Resistant },
new HitData.DamageModPair { m_type = HitData.DamageType.Slash, m_modifier = HitData.DamageModifier.Resistant },
new HitData.DamageModPair { m_type = HitData.DamageType.Blunt, m_modifier = HitData.DamageModifier.Weak }
};
if (rules.PoisonImmunity)
{
m_mods.Add(new HitData.DamageModPair { m_type = HitData.DamageType.Poison, m_modifier = HitData.DamageModifier.Immune });
}
}
}
public class SE_SkeletonResurrectCooldown : StatusEffect
{
public override void Setup(Character character)
{
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<GameObject>("TrophySkeletonPoison")?.GetComponent<ItemDrop>()?.m_itemData.GetIcon()
?? Jotunn.Managers.PrefabManager.Cache.GetPrefab<GameObject>("TrophySkeleton")?.GetComponent<ItemDrop>()?.m_itemData.GetIcon();
m_ttl = SkeletonConfig.ResurrectionCooldown.Value;
}
}
}