RacesOfValheim/JotunnModStub/Fenrir/FenrirStatusEffects.cs
kanym b0d18b0654 feat(text): on-screen messages come from translation files
Every message the mod puts in the middle or corner of the screen now reads
its text through ModText.Get, and messages.json holds 191 texts in English
and Italian. Values computed in code become $1, $2 in the text, so a
translator can put them wherever the sentence needs them. Branching
messages get one key per branch.

A few messages travel through a field before they are shown: thralls'
refusals and the building limits now hold a token or key there. Boss and
form names inside messages use tokens too, the bosses the game's own, so
"The Elder" arrives translated.

ModText.Get now localizes each argument before inserting it. A token
argument left for a later pass ran into the text after it: "$1's power"
became the unknown token "enemy_eikthyr's".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 20:30:03 +02:00

48 lines
1.5 KiB
C#

using System.Collections;
using BepInEx;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using UnityEngine;
using UnityEngine.UI; // Added for UI
namespace RacesOfValheim
{
public class SE_FormCooldown : StatusEffect
{
public override void Stop()
{
base.Stop();
if (Player.m_localPlayer != null)
{
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_fenrir_ready", m_name));
}
}
}
public class SE_FenrirCurse : SE_Stats
{
public override void Setup(Character character)
{
base.Setup(character);
if (character == Player.m_localPlayer)
{
Player.m_localPlayer.m_customData["FenrirCurse_Active"] = "true";
}
}
public override void UpdateStatusEffect(float dt)
{
base.UpdateStatusEffect(dt);
int state = BossProgressionManager.GetCurrentProgressionState();
m_fallDamageModifier = FenrirProgression.GetFallDamageModifier(state);
// SE_Stats.ModifySpeed adds baseSpeed * m_speedModifier, so this is the bonus alone:
// 0 is vanilla speed, 0.03 is +3%. A leading 1.0f here was a flat +100%.
m_speedModifier = FenrirProgression.GetSpeedModifier(state);
m_jumpModifier = new Vector3(0, FenrirProgression.GetJumpModifier(state), 0);
}
}
}