RacesOfValheim/JotunnModStub/Skadi/SkadiFrostHeart.cs
Ferdinando 5c5b8c34d2 feat(races): Skadi hollow chain, plus the pending Dvergar and Fenrir ones
Three per-race item chains had accumulated uncommitted. They land
together because FactionMerchantCatalog.cs carries hunks from all
three and cannot be split without interactive staging.

Skadi (new this session):
- SkadiNokkel - "Skadis Nokkel", a StaffSkeleton clone recoloured to
  ice, stripped of its eitr and health costs and of the skeleton
  summon, opening an ice-blue portal to a troll cave the player
  claims as their own. Crafted at the forge after Moder from a
  1500-coin Greater Frost Heart, a DragonTear and a TrophySkeleton.
- SkadiFrostHeart - the bought leg of that recipe, sold by the
  Cultist bench.
- SkadiHollow / SkadiHollowPortal - claims one existing TrollCave02
  in the Black Forest, half a world radius out and south of the
  equator, and opens a linked local portal pair to it.
- RaceCaveBuilding - Skadi and Trol may build inside any troll cave.

Two facts worth keeping, both paid for the hard way:
- a troll cave counts as a DUNGEON, so the flag that refuses a piece
  there is the per-piece Piece.m_allowedInDungeons, not the
  per-location Location.m_noBuild. Player.m_placementStatus names the
  exact refusal reason and is now logged.
- Object.DestroyImmediate is forbidden inside an animation event
  callback, and a staff cast runs in one - it fails silently there.

Also carried in, from earlier sessions and unverified in game:
- Dvergar contract bank and barrel (DvergarBanco*, DvergarBotte*)
- Fenrir Ulvsblod trough (FenrirMangiatoia*)
- the Wolf -> Ulv merchant bench move, so tameable wolves stop
  answering the E key with a shop window

Status: compiles clean with no new warnings. The Skadi chain has NOT
been confirmed working in game - the most recent fix to the troll
cave detection is still untested.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-08 14:58:43 +02:00

57 lines
2.4 KiB
C#

using Jotunn.Entities;
using Jotunn.Managers;
using UnityEngine;
namespace RacesOfValheim
{
/// <summary>
/// Greater Frost Heart - the bought leg of the Skadi recipe, and the piece that keeps this chain
/// hooked to the faction merchant system the way every other race's does. 1500 coins from the
/// Cultist bench, which is the same price band as GreaterUlvsblod, GreaterCursedBone and
/// GreaterCursedSkull: the reagent that unlocks the last step of a race's chain.
///
/// A NOTE ON THE SHOP KEY, because it has already cost this project once: the Cultist shop in
/// FactionMerchantCatalog is mapped on the mob "Fenring_Cultist", NOT on "Fenring" - that one is
/// a different bench belonging to the Fenrir trough. Selling from the wrong one puts the item in
/// a shop nobody expects.
/// </summary>
public static class SkadiFrostHeart
{
public const string PrefabName = "GreaterFrostHeart";
public const string DisplayName = "Greater Frost Heart";
public const int Price = 1500;
private const string SourcePrefab = "FreezeGland";
public static void Register()
{
GameObject prefab = PrefabManager.Instance.CreateClonedPrefab(PrefabName, SourcePrefab);
if (prefab == null)
{
Jotunn.Logger.LogWarning($"[Skadi] Could not clone {SourcePrefab}; {DisplayName} not registered.");
return;
}
ItemDrop drop = prefab.GetComponent<ItemDrop>();
if (drop == null || drop.m_itemData == null || drop.m_itemData.m_shared == null)
{
Jotunn.Logger.LogWarning($"[Skadi] {SourcePrefab} clone has no usable ItemDrop; {DisplayName} not registered.");
return;
}
SkadiIce.Apply(prefab);
ItemDrop.ItemData.SharedData shared = drop.m_itemData.m_shared;
shared.m_name = DisplayName;
shared.m_description = "Older cold than the mountain's. The cultists sell it and will not say where they dig.";
shared.m_itemType = ItemDrop.ItemData.ItemType.Material;
shared.m_weight = 0.5f;
shared.m_maxStackSize = 10;
shared.m_value = Price;
ItemManager.Instance.AddItem(new CustomItem(prefab, fixReference: false));
Jotunn.Logger.LogInfo($"[Skadi] {DisplayName} registered at {Price} coins.");
}
}
}