RacesOfValheim/JotunnModStub/Skadi/SkadiStatusEffects.cs
kanym 9bf144aedc feat(text): status effect names and tooltips come from translation files
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>
2026-09-26 19:51:10 +02:00

66 lines
2.7 KiB
C#

using System;
using System.Collections.Generic;
using UnityEngine;
namespace RacesOfValheim
{
// Timed dragon forms. m_ttl is set when the form is entered, which is all Valheim needs to
// render the countdown: StatusEffect.GetIconText() prints the remaining time by itself.
public class SE_SkadiForm : StatusEffect
{
}
// Short ability cooldowns, shown purely so the HUD can count them down. Silent by design,
// unlike SE_FormCooldown which announces "... is Ready!" when it stops: tolerable once every
// few minutes for a dragon form, unbearable every three seconds for an attack.
public class SE_SkadiAbilityCooldown : StatusEffect
{
}
public class SE_SkadiStats : SE_Stats
{
public override void Setup(Character character)
{
base.Setup(character);
name = "SE_SkadiStats";
m_name = "$rov_se_skadi_aura_name";
m_tooltip = "$rov_se_skadi_aura_tooltip";
}
// What the last UpdateStats call actually wrote. SEMan.AddStatusEffect stores a Clone() of
// the registered prototype, so the effect running on the player is a separate object that
// has to be refreshed too (SkadiRace.Update does that) - and both of them are asked to
// update every frame. Rebuilding the mod list each time would churn a List per frame per
// instance, so nothing is rewritten until a tier change actually moves a value. These
// fields are not serialized, so a fresh clone starts at "never applied" and rebuilds once.
private bool statsApplied = false;
private float appliedFrostResistance = 0f;
private float appliedEitrRegenMultiplier = 0f;
public void UpdateStats(SkadiProgression.FormRules rules)
{
if (statsApplied &&
rules.FrostResistance == appliedFrostResistance &&
rules.EitrRegenMultiplier == appliedEitrRegenMultiplier)
{
return;
}
statsApplied = true;
appliedFrostResistance = rules.FrostResistance;
appliedEitrRegenMultiplier = rules.EitrRegenMultiplier;
m_mods = new List<HitData.DamageModPair>();
if (rules.FrostResistance >= 1f)
{
m_mods.Add(new HitData.DamageModPair() { m_type = HitData.DamageType.Frost, m_modifier = HitData.DamageModifier.Immune });
}
else if (rules.FrostResistance >= 0.5f)
{
m_mods.Add(new HitData.DamageModPair() { m_type = HitData.DamageType.Frost, m_modifier = HitData.DamageModifier.Resistant });
}
m_eitrRegenMultiplier = rules.EitrRegenMultiplier;
}
}
}