RacesOfValheim/JotunnModStub/Skadi/SkadiConfig.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

195 lines
16 KiB
C#

using UnityEngine;
using BepInEx.Configuration;
namespace RacesOfValheim
{
/// <summary>
/// Every tunable number and keybind behind Skadi's abilities and special attacks, bound as
/// BepInEx ConfigEntry so they show up in Configuration Manager without touching code - see
/// CONFIGURATION-MANAGER-HOWTO.md. Bound once, from RacesOfValheim.Awake().
///
/// One section per sub-group (rather than everything under one "Skadi" section) so each shows
/// up as its own entry in Configuration Manager's category list - collapsing them into a
/// single section made that list disappear. Keybinds is bound first, before its section
/// otherwise sorts alphabetically among the rest, since it is the group most worth reaching
/// quickly; within it every entry carries an explicit Order (Configuration Manager otherwise
/// sorts a section's own entries alphabetically) so it reads attack -> cast -> breath -> spin
/// -> flight -> the three transform keys, the order abilities actually chain in a fight,
/// rather than alphabetically.
/// </summary>
public static class SkadiConfig
{
// ─── Keybinds ──────────────────────────────────────────────────────────
// Defaults match today's fixed inputs exactly, so nobody's controls change until they
// open Configuration Manager (or the .cfg) and rebind one on purpose.
public static ConfigEntry<KeyboardShortcut> PrimaryAttackKey;
public static ConfigEntry<KeyboardShortcut> ColdSpellKey;
public static ConfigEntry<KeyboardShortcut> BreathAttackKey;
public static ConfigEntry<KeyboardShortcut> SpinAttackKey;
public static ConfigEntry<KeyboardShortcut> FlightToggleKey;
public static ConfigEntry<KeyboardShortcut> DrakeFormKey;
public static ConfigEntry<KeyboardShortcut> ModerFormKey;
public static ConfigEntry<KeyboardShortcut> FaderFormKey;
// ─── Cold Spell (human form) ─────────────────────────────────────────
public static ConfigEntry<float> SpellStaminaCost;
public static ConfigEntry<float> SpellCooldown;
public static ConfigEntry<float> ImprovedSpellCooldown;
public static ConfigEntry<float> SpellBaseDamage;
public static ConfigEntry<float> SpellDamagePerState;
public static ConfigEntry<int> ImprovedSpellShards;
public static ConfigEntry<float> ImprovedSpellDamageBudget;
// ─── Frost Aura (tier 7+ passive) ───────────────────────────────────────
public static ConfigEntry<float> AuraRadius;
public static ConfigEntry<float> AuraDamagePerTick;
public static ConfigEntry<float> AuraTickInterval;
// ─── Passive combat ──────────────────────────────────────────────────
public static ConfigEntry<float> BonusFrostDamagePerState;
// ─── Skadis Nokkel / the hidden hollow ───────────────────────────────
public static ConfigEntry<float> HollowCooldown;
public static ConfigEntry<float> HollowPortalCloseDelay;
public static ConfigEntry<float> HollowPortalSpawnDistance;
public static ConfigEntry<float> HollowEntryHeight;
// ─── Dragon forms: scale ─────────────────────────────────────────────
public static ConfigEntry<float> DrakeScale;
public static ConfigEntry<float> ModerScale;
public static ConfigEntry<float> FaderScale;
// ─── Dragon forms: attacks ────────────────────────────────────────────
public static ConfigEntry<float> FormAttackCooldown;
public static ConfigEntry<float> StaminaPerProjectile;
public static ConfigEntry<float> MaxVolleyStamina;
public static ConfigEntry<float> MeleeRadius;
public static ConfigEntry<float> ModerMeleeDamage;
public static ConfigEntry<float> FaderMeleeDamage;
public static ConfigEntry<float> FaderSpinDamage;
public static ConfigEntry<float> FaderSpinRadius;
// ─── Directed flight (Drake/Moder) ────────────────────────────────────
public static ConfigEntry<float> FlightTurnSpeed;
public static ConfigEntry<float> FlightGlideSpeed;
public static ConfigEntry<float> FlightBoostSpeed;
public static ConfigEntry<float> FlightSprintSpeed;
public static ConfigEntry<float> FlightReverseSpeed;
public static ConfigEntry<float> FlightLiftoffSpeed;
public static ConfigEntry<float> FlightHoverSeconds;
public static ConfigEntry<float> FlightSprintStaminaPerSecond;
public static void Bind(ConfigFile config)
{
// Bound first, and ahead of everything else in the file, in case Configuration
// Manager's category list preserves bind order rather than sorting sections
// alphabetically - either way, the keybinds themselves still land in the requested
// order via the explicit Order below, which is guaranteed.
const string keybinds = "Skadi - Keybinds";
int keyOrder = 8;
PrimaryAttackKey = config.Bind(keybinds, "Dragon Primary Attack", new KeyboardShortcut(KeyCode.Mouse0),
KeyDesc("Bite/claw attack in any dragon form.", keyOrder--));
ColdSpellKey = config.Bind(keybinds, "Cold Spell Cast", new KeyboardShortcut(KeyCode.Mouse2),
KeyDesc("Casts the Cold Spell in human form, tier 1+.", keyOrder--));
BreathAttackKey = config.Bind(keybinds, "Dragon Breath Attack", new KeyboardShortcut(KeyCode.Mouse2),
KeyDesc("Ranged breath/barrage attack in Moder and Skeleton Dragon form.", keyOrder--));
SpinAttackKey = config.Bind(keybinds, "Fader Spin Attack", new KeyboardShortcut(KeyCode.Mouse1),
KeyDesc("360-degree spin attack, Skeleton Dragon form only.", keyOrder--));
FlightToggleKey = config.Bind(keybinds, "Flight Toggle", new KeyboardShortcut(KeyCode.Mouse1),
KeyDesc("Takes off or lands while in Drake or Moder form.", keyOrder--));
DrakeFormKey = config.Bind(keybinds, "Drake Form", new KeyboardShortcut(KeyCode.G),
KeyDesc("Transform into (or revert from) the Drake, tier 3+.", keyOrder--));
ModerFormKey = config.Bind(keybinds, "Moder Form", new KeyboardShortcut(KeyCode.H),
KeyDesc("Transform into (or revert from) Moder, tier 5+.", keyOrder--));
FaderFormKey = config.Bind(keybinds, "Fader Form", new KeyboardShortcut(KeyCode.J),
KeyDesc("Transform into (or revert from) the Skeleton Dragon, tier 8.", keyOrder--));
const string combat = "Skadi - Passive Combat";
BonusFrostDamagePerState = config.Bind(combat, "Bonus Frost Damage Per State", 2f,
new ConfigDescription("Flat frost damage added to every hit the player lands, multiplied by the current progression state.", new AcceptableValueRange<float>(0f, 10f)));
const string hollow = "Skadi - Hidden Hollow";
HollowCooldown = config.Bind(hollow, "Cooldown", 120f,
new ConfigDescription("Seconds between openings of the hollow. This is the only brake on Skadis Nokkel - it costs no stamina, eitr or health - and it never applies to LEAVING: stepping in and changing your mind must not lock you in.", new AcceptableValueRange<float>(0f, 600f)));
HollowPortalCloseDelay = config.Bind(hollow, "Portal Close Delay", 5f,
new ConfigDescription("Seconds the portal pair lingers after the player comes back out. Until then both ends simply stand there - unlike the Trenta portal, this one has no lifetime of its own.", new AcceptableValueRange<float>(0f, 60f)));
HollowPortalSpawnDistance = config.Bind(hollow, "Portal Spawn Distance", 2f,
new ConfigDescription("Metres in front of the player the outside end of the portal appears.", new AcceptableValueRange<float>(0.5f, 10f)));
HollowEntryHeight = config.Bind(hollow, "Entry Height", 1f,
new ConfigDescription("Height above the claimed troll cave's own origin that the inner portal stands at. Raise it if arriving ever puts the player inside the ground.", new AcceptableValueRange<float>(0f, 20f)));
const string spell = "Skadi - Cold Spell";
SpellStaminaCost = config.Bind(spell, "Stamina Cost", 20f,
new ConfigDescription("Stamina spent per cast.", new AcceptableValueRange<float>(0f, 100f)));
SpellCooldown = config.Bind(spell, "Cooldown", 1.5f,
new ConfigDescription("Seconds between casts before the improved (tier 6+) cast unlocks.", new AcceptableValueRange<float>(0.1f, 10f)));
ImprovedSpellCooldown = config.Bind(spell, "Improved Cooldown", 4f,
new ConfigDescription("Seconds between casts once the improved cast unlocks (tier 6+) - a burst rather than rapid-fire.", new AcceptableValueRange<float>(0.1f, 15f)));
SpellBaseDamage = config.Bind(spell, "Base Damage", 15f,
new ConfigDescription("Frost damage at progression state 0, before the per-state bonus.", new AcceptableValueRange<float>(0f, 200f)));
SpellDamagePerState = config.Bind(spell, "Damage Per Progression State", 8f,
new ConfigDescription("Extra frost damage added per boss progression state (0-8).", new AcceptableValueRange<float>(0f, 50f)));
ImprovedSpellShards = config.Bind(spell, "Improved Shard Count", 10,
new ConfigDescription("Number of shards the improved (tier 6+) cast splits into.", new AcceptableValueRange<int>(1, 30)));
ImprovedSpellDamageBudget = config.Bind(spell, "Improved Damage Budget", 1.6f,
new ConfigDescription("Total damage of an improved cast, as a multiple of one normal cast, before it is split across shards.", new AcceptableValueRange<float>(0.5f, 5f)));
const string aura = "Skadi - Frost Aura";
AuraRadius = config.Bind(aura, "Radius", 3f,
new ConfigDescription("Meters from the player that the tier 7+ aura damages.", new AcceptableValueRange<float>(1f, 15f)));
AuraDamagePerTick = config.Bind(aura, "Damage Per Tick", 10f,
new ConfigDescription("Frost damage dealt to every enemy in range, once per tick.", new AcceptableValueRange<float>(0f, 50f)));
AuraTickInterval = config.Bind(aura, "Tick Interval", 1f,
new ConfigDescription("Seconds between aura damage ticks.", new AcceptableValueRange<float>(0.1f, 5f)));
const string scale = "Skadi - Dragon Form Scale";
DrakeScale = config.Bind(scale, "Drake Scale", 0.9f,
new ConfigDescription("Model scale while transformed into the Drake (tier 3-4).", new AcceptableValueRange<float>(0.1f, 2f)));
ModerScale = config.Bind(scale, "Moder Scale", 0.5f,
new ConfigDescription("Model scale while transformed into Moder (tier 5-7).", new AcceptableValueRange<float>(0.1f, 2f)));
FaderScale = config.Bind(scale, "Fader Scale", 0.55f,
new ConfigDescription("Model scale while transformed into the Skeleton Dragon (tier 8).", new AcceptableValueRange<float>(0.1f, 2f)));
const string attacks = "Skadi - Dragon Form Attacks";
FormAttackCooldown = config.Bind(attacks, "Attack Cooldown", 3f,
new ConfigDescription("Seconds between attacks in any dragon form.", new AcceptableValueRange<float>(0.5f, 15f)));
StaminaPerProjectile = config.Bind(attacks, "Stamina Per Projectile", 1.5f,
new ConfigDescription("Stamina charged per shard/projectile in a ranged volley.", new AcceptableValueRange<float>(0f, 10f)));
MaxVolleyStamina = config.Bind(attacks, "Max Volley Stamina", 85f,
new ConfigDescription("Stamina ceiling for a single volley, so the widest breath (60 shards) stays castable.", new AcceptableValueRange<float>(0f, 300f)));
MeleeRadius = config.Bind(attacks, "Melee Radius", 3f,
new ConfigDescription("Hit-sweep radius for bite/claw attacks (Moder and Fader).", new AcceptableValueRange<float>(1f, 15f)));
ModerMeleeDamage = config.Bind(attacks, "Moder Melee Damage", 90f,
new ConfigDescription("Base damage of Moder's bite/claw attacks, before the Unarmed skill bonus.", new AcceptableValueRange<float>(0f, 500f)));
FaderMeleeDamage = config.Bind(attacks, "Fader Melee Damage", 120f,
new ConfigDescription("Base damage of the Skeleton Dragon's bite/claw attacks, before the Unarmed skill bonus.", new AcceptableValueRange<float>(0f, 500f)));
FaderSpinDamage = config.Bind(attacks, "Fader Spin Damage", 100f,
new ConfigDescription("Base damage of the Skeleton Dragon's 360-degree spin attack.", new AcceptableValueRange<float>(0f, 500f)));
FaderSpinRadius = config.Bind(attacks, "Fader Spin Radius", 5f,
new ConfigDescription("Hit-sweep radius for the Skeleton Dragon's spin attack.", new AcceptableValueRange<float>(1f, 15f)));
const string flight = "Skadi - Directed Flight";
FlightTurnSpeed = config.Bind(flight, "Turn Speed", 120f,
new ConfigDescription("Degrees per second the dragon form turns to face its heading.", new AcceptableValueRange<float>(10f, 360f)));
FlightGlideSpeed = config.Bind(flight, "Glide Speed", 5f,
new ConfigDescription("Speed while gliding unpowered (no W/S held).", new AcceptableValueRange<float>(0f, 30f)));
FlightBoostSpeed = config.Bind(flight, "Boost Speed", 12f,
new ConfigDescription("Speed while holding W without sprinting.", new AcceptableValueRange<float>(0f, 50f)));
FlightSprintSpeed = config.Bind(flight, "Sprint Speed", 22f,
new ConfigDescription("Speed while holding W and Shift, stamina permitting.", new AcceptableValueRange<float>(0f, 60f)));
FlightReverseSpeed = config.Bind(flight, "Reverse Speed", 7f,
new ConfigDescription("Speed while beating backwards (S).", new AcceptableValueRange<float>(0f, 30f)));
FlightLiftoffSpeed = config.Bind(flight, "Liftoff Speed", 9f,
new ConfigDescription("Climb speed while clawing out of water.", new AcceptableValueRange<float>(0f, 30f)));
FlightHoverSeconds = config.Bind(flight, "Hover Seconds", 5f,
new ConfigDescription("How long level flight holds altitude after the last powered input before it starts to sink.", new AcceptableValueRange<float>(0f, 30f)));
FlightSprintStaminaPerSecond = config.Bind(flight, "Sprint Stamina Per Second", 15f,
new ConfigDescription("Stamina drained per second while the sprint speed is actually granted.", new AcceptableValueRange<float>(0f, 60f)));
}
private static ConfigDescription KeyDesc(string description, int order)
{
return new ConfigDescription(description, null, new ConfigurationManagerAttributes { Order = order });
}
}
}