Every status effect the mod registers now carries a $rov_se_ token instead of English, and status_effects.json holds the texts in English and Italian. Valheim localizes both fields itself when it shows them. The blood potion's tooltip has numbers in it, so SE_BloodPotion fills its $1 and $2 in GetTooltipString, at display time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
70 lines
3.2 KiB
C#
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 = "$rov_se_skeleton_resurrectcd_name";
|
|
m_tooltip = "$rov_se_skeleton_resurrectcd_tooltip";
|
|
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;
|
|
}
|
|
}
|
|
}
|