RacesOfValheim/JotunnModStub/Fenrir/FenrirClaws.cs
2026-08-11 19:29:58 +02:00

56 lines
2.4 KiB
C#

using UnityEngine;
namespace RacesOfValheim
{
/// <summary>
/// The Cursed Claws: the flesh rippers, worn exactly as the game authored them.
///
/// Everything about how they behave - issued once, never dropped, back in hand the moment the
/// hands are free, tier damage as slash - lives in RaceClawSet. This file is only the Fenrir's
/// half: which model, and when the race is currently a wolf.
///
/// No tint. The fenrir claw already looks like something a Fenrir would grow, which is the
/// whole reason it is the one being borrowed.
/// </summary>
public class FenrirClaws : RaceClawSet
{
public static readonly FenrirClaws Instance = new FenrirClaws();
public override string RaceId => "Fenrir";
public override string ItemName => "FenrirCursedClaws";
public override string DisplayName => "Cursed Claws";
public override string Description => "The wolf's hands, kept on in the man's shape. They do not come off.";
public override string[] ModelPrefabs => new[]
{
"FistFenrirClaw",
"FistFenrirClaw_Undead",
"FenrirClaw",
};
// The Fenrir publishes no per-tier state of its own, so the damage falls back to the local
// player's progression. That is right for the player at the keyboard and approximate for
// somebody else's claws on a shared world - the same compromise the Sverm makes, and the
// fix if it ever matters is a state key in FenrirRace, not a change here.
/// <summary>
/// A wolf swings its own jaws, and FenrirFormBehavior does that damage itself. The ZDO
/// carries the form for everyone; the status effect is the local player's own copy of the
/// same fact, checked second so a form that has begun but not yet replicated still counts.
/// </summary>
public override bool IsTransformed(Player player)
{
if (player == null) return false;
ZNetView nview = player.GetComponent<ZNetView>();
if (nview != null && nview.IsValid())
{
if (!string.IsNullOrEmpty(nview.GetZDO().GetString("RacesOfValheim_FenrirForm", ""))) return true;
}
return player == Player.m_localPlayer &&
player.GetSEMan() != null &&
player.GetSEMan().HaveStatusEffect("SE_FenrirForm".GetStableHashCode());
}
}
}