feat(alfar): v1.6.0 - the Alfar, an eleventh race

Grey, tall and thin, with black eyes. Eitr is armour and fuel (shield,
diet, soft fall, levitation), Heimkall sends a lethal blow home at one
health every 20 minutes. Caster powers from Skrid to the archon
Sameining, with on-screen cooldowns. Automated base around the
Ljoskjarne: drones, three constructs, crystals, Ljosgard, Prismavard.
Compendium page in EN/IT/RU.

README: New in block, race section, progression, station line, changelog.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Ferdinando 2026-10-25 17:38:28 +01:00
commit 3f8cf1ee27
48 changed files with 7779 additions and 16 deletions

View file

@ -0,0 +1,110 @@
using Jotunn.Entities;
using UnityEngine;
namespace RacesOfValheim
{
/// <summary>
/// Test helpers for the Alfar, in the F5 console. They exist so the phases of Alfar_Test.txt can
/// be walked through without waiting twenty minutes between steps.
///
/// alfarstatus what the race is doing right now (eitr, Heimkall timer, SE, form...)
/// alfarreset clears every Alfar timer and cooldown
/// alfareitr <n|full|0> sets the eitr pool: a number, "full", or 0
/// alfarhp <n> sets the current health, to try the lethal-blow case without dying
/// </summary>
public class AlfarStatusCommand : ConsoleCommand
{
public override string Name => "alfarstatus";
public override string Help => "[DEBUG] Prints the Alfar's eitr, health, Heimkall timer and passive.";
public override void Run(string[] args)
{
Player player = Player.m_localPlayer;
if (player == null) { Console.instance.Print("No local player."); return; }
string race = AlfarVisuals.GetPlayerRace(player);
Print($"race={race} progression state={BossProgressionManager.GetCurrentProgressionState()}");
Print($"health={player.GetHealth():0}/{player.GetMaxHealth():0} eitr={player.GetEitr():0.0}/{player.GetMaxEitr():0}");
float left = AlfarHeimkall.Remaining(player);
Print($"Heimkall: {(left <= 0f ? "READY" : (left / 60f).ToString("0.0") + " min left")} " +
$"(cooldown now {AlfarHeimkall.CooldownSeconds() / 60f:0} min)");
bool se = player.GetSEMan().HaveStatusEffect(SE_AlfarStats.EffectName.GetStableHashCode());
Print($"passive status effect: {(se ? "on" : "OFF")}");
}
private static void Print(string text)
{
Console.instance.Print("[Alfar] " + text);
Jotunn.Logger.LogInfo("[Alfar] " + text);
}
}
public class AlfarResetCommand : ConsoleCommand
{
public override string Name => "alfarreset";
public override string Help => "[DEBUG] Clears the Alfar's Heimkall timer and every power cooldown.";
public override void Run(string[] args)
{
Player player = Player.m_localPlayer;
if (player == null) return;
AlfarHeimkall.ResetTimer(player);
AlfarHeimkall.InvulnerableUntil = 0f;
AlfarPowers.ResetCooldowns(player);
Console.instance.Print("[Alfar] Heimkall timer and power cooldowns cleared.");
}
}
public class AlfarEitrCommand : ConsoleCommand
{
public override string Name => "alfareitr";
public override string Help => "[DEBUG] alfareitr <number|full|0> - sets the Alfr's current eitr.";
public override void Run(string[] args)
{
Player player = Player.m_localPlayer;
if (player == null || args.Length == 0) { Console.instance.Print("alfareitr <number|full|0>"); return; }
float target;
if (args[0].ToLower() == "full") target = player.GetMaxEitr();
else if (!float.TryParse(args[0], System.Globalization.NumberStyles.Float,
System.Globalization.CultureInfo.InvariantCulture, out target))
{
Console.instance.Print("alfareitr <number|full|0>");
return;
}
target = Mathf.Clamp(target, 0f, player.GetMaxEitr());
float delta = target - player.GetEitr();
if (delta > 0f) player.AddEitr(delta);
else if (delta < 0f) AlfarEitr.Spend(player, -delta);
Console.instance.Print($"[Alfar] eitr = {player.GetEitr():0.0}/{player.GetMaxEitr():0}");
}
}
public class AlfarHpCommand : ConsoleCommand
{
public override string Name => "alfarhp";
public override string Help => "[DEBUG] alfarhp <number> - sets the current health, to test the lethal-blow case.";
public override void Run(string[] args)
{
Player player = Player.m_localPlayer;
if (player == null || args.Length == 0) { Console.instance.Print("alfarhp <number>"); return; }
if (!float.TryParse(args[0], System.Globalization.NumberStyles.Float,
System.Globalization.CultureInfo.InvariantCulture, out float hp))
{
Console.instance.Print("alfarhp <number>");
return;
}
player.SetHealth(Mathf.Clamp(hp, 1f, player.GetMaxHealth()));
Console.instance.Print($"[Alfar] health = {player.GetHealth():0}/{player.GetMaxHealth():0}");
}
}
}