feat(dvergur): add the Dvergur race scaffold
An eighth race built on the existing per-race pattern: a MonoBehaviour driver registered from Awake, a progression table keyed on the boss state, an SE_Stats carrier, and Harmony patches for the individual perks. The helmet slot stays free. Whatever the player equips keeps every one of its stats and only its mesh is swapped for the dvergr hood, which is the Skeleton's helmet handling turned into a replacement rather than a plain hide. Every percentage the spec left open lives in DvergurConfig as a named value and is marked TODO there, so tuning the race never means touching the logic. The knobs are static readonly rather than const so that switching a perk off with a zero does not fold its guard into dead code.
This commit is contained in:
parent
4cd452d187
commit
3ec51aeb45
10 changed files with 1365 additions and 1 deletions
237
JotunnModStub/Dvergur/DvergurConfig.cs
Normal file
237
JotunnModStub/Dvergur/DvergurConfig.cs
Normal file
|
|
@ -0,0 +1,237 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace RacesOfValheim
|
||||
{
|
||||
/// <summary>
|
||||
/// Every tunable number the Dvergur uses, in one place.
|
||||
///
|
||||
/// The race was specced with most percentages still open, so nothing here is baked into the
|
||||
/// logic: DvergurProgression reads these to build its per-tier rules and the patches read the
|
||||
/// rules, never a literal. Retuning the race means editing this file only.
|
||||
///
|
||||
/// Values still marked TODO are placeholders chosen to be playable, not final.
|
||||
/// </summary>
|
||||
public static class DvergurConfig
|
||||
{
|
||||
// ─── Identity ────────────────────────────────────────────────────────
|
||||
// "Dvergur" is provisional. It is the value stored in m_customData["Race"] and in the
|
||||
// ZDO, so renaming it after players have chosen the race would orphan their characters.
|
||||
public const string RaceId = "Dvergur";
|
||||
|
||||
public const string StatsSE = "SE_DvergurStats";
|
||||
public const string OverchargeSE = "SE_DvergurOvercharge";
|
||||
public const string RunicPingCdSE = "SE_DvergurRunicPingCooldown";
|
||||
public const string OverchargeCdSE = "SE_DvergurOverchargeCooldown";
|
||||
|
||||
// Mirrors the ZDO key layout the other races use, so remote clients can read the tier
|
||||
// without having the local player's progression state.
|
||||
public const string StateZdoKey = "RacesOfValheim_DvergurState";
|
||||
|
||||
// ─── Model ───────────────────────────────────────────────────────────
|
||||
// Applied to the player's "Visual" child rather than the root transform, the way Furling
|
||||
// does it: scaling the root would drag the collider and camera pivot along with it.
|
||||
// Tuning knobs are static readonly rather than const throughout: a const folds at compile
|
||||
// time, which turns "is this perk switched off?" guards into dead code the moment a knob
|
||||
// is set to zero, and would bake the old value into any assembly built against this one.
|
||||
public static readonly float VisualScale = 0.70f; // -30% versus a human
|
||||
|
||||
// ─── Cosmetic hood ───────────────────────────────────────────────────
|
||||
// The helmet slot itself stays free — whatever the player equips keeps all of its stats,
|
||||
// only the mesh is swapped. Tried in order; the first prefab that resolves wins.
|
||||
public static readonly string[] HoodPrefabCandidates =
|
||||
{
|
||||
"HelmetDverger", // Dverger circlet item
|
||||
"helmet_dverger", // its attach visual, if the item prefab is unavailable
|
||||
"Dverger" // last resort: lift the headgear renderer off the creature
|
||||
};
|
||||
|
||||
// Valheim rigs are authored at scale 100, hence the very small numbers. Tuned against
|
||||
// the head bone, same approach as the Furling trophy head.
|
||||
public static readonly Vector3 HoodLocalPosition = new Vector3(0f, 0.0012f, 0f);
|
||||
public static readonly Vector3 HoodLocalRotation = new Vector3(-90f, 0f, 90f);
|
||||
public static readonly float HoodLocalScale = 0.0075f;
|
||||
|
||||
|
||||
// ─── Health malus ────────────────────────────────────────────────────
|
||||
// Indexed by progression state; index 0 is unused so the state number indexes directly.
|
||||
// Base -10, growing to -20 once The Queen falls.
|
||||
public static readonly float[] HealthMalusByState =
|
||||
{
|
||||
0f, // (unused)
|
||||
10f, // 1 Base
|
||||
10f, // 2 Eikthyr
|
||||
10f, // 3 The Elder
|
||||
13f, // 4 Bonemass
|
||||
15f, // 5 Moder
|
||||
17.5f, // 6 Yagluth TODO: spec says -17/-18, pick one
|
||||
20f, // 7 The Queen
|
||||
20f // 8 Fader
|
||||
};
|
||||
|
||||
// A Dvergur must never be reduced below this, however the malus and food line up.
|
||||
public static readonly float MinMaxHealth = 5f;
|
||||
|
||||
// ─── Weapon affinity ─────────────────────────────────────────────────
|
||||
// Bonus damage plus a stamina discount on the attack. Neither scales with the tier - a
|
||||
// tier only ever adds a new weapon to the list - and skill XP is deliberately untouched.
|
||||
public struct WeaponAffinity
|
||||
{
|
||||
public Skills.SkillType Skill;
|
||||
public int UnlockState;
|
||||
public HitData.DamageType FlatDamageType; // channel the flat bonus lands on
|
||||
public float FlatDamage; // TODO
|
||||
public float DamagePercent; // TODO, share of physical damage added
|
||||
public float StaminaPercent; // TODO, share of attack stamina refunded
|
||||
public float StaminaFlat; // TODO, flat stamina refunded
|
||||
public string DisplayName;
|
||||
}
|
||||
|
||||
public static readonly WeaponAffinity[] WeaponAffinities =
|
||||
{
|
||||
new WeaponAffinity
|
||||
{
|
||||
Skill = Skills.SkillType.Clubs, UnlockState = 1,
|
||||
FlatDamageType = HitData.DamageType.Blunt,
|
||||
FlatDamage = 0f, DamagePercent = 0.15f,
|
||||
StaminaPercent = 0.20f, StaminaFlat = 0f,
|
||||
DisplayName = "Hammer"
|
||||
},
|
||||
new WeaponAffinity
|
||||
{
|
||||
Skill = Skills.SkillType.Bows, UnlockState = 2,
|
||||
FlatDamageType = HitData.DamageType.Pierce,
|
||||
FlatDamage = 0f, DamagePercent = 0.15f,
|
||||
StaminaPercent = 0.20f, StaminaFlat = 0f,
|
||||
DisplayName = "Bow"
|
||||
},
|
||||
new WeaponAffinity
|
||||
{
|
||||
Skill = Skills.SkillType.Axes, UnlockState = 3,
|
||||
FlatDamageType = HitData.DamageType.Slash,
|
||||
FlatDamage = 0f, DamagePercent = 0.15f,
|
||||
StaminaPercent = 0.20f, StaminaFlat = 0f,
|
||||
DisplayName = "Axe"
|
||||
},
|
||||
new WeaponAffinity
|
||||
{
|
||||
Skill = Skills.SkillType.Crossbows, UnlockState = 6,
|
||||
FlatDamageType = HitData.DamageType.Pierce,
|
||||
FlatDamage = 0f, DamagePercent = 0.15f,
|
||||
StaminaPercent = 0.20f, StaminaFlat = 0f,
|
||||
DisplayName = "Crossbow"
|
||||
}
|
||||
};
|
||||
|
||||
// ─── Mining affinity ─────────────────────────────────────────────────
|
||||
// Unlocks alongside the antler pickaxe.
|
||||
public const int MiningAffinityState = 2;
|
||||
|
||||
// Faster mining is modelled as extra pickaxe damage per swing rather than a swing-rate
|
||||
// change: rock HP is what actually gates how long a vein takes.
|
||||
public static readonly float MiningDamageMultiplier = 1.20f; // TODO: 20% faster?
|
||||
public static readonly float MiningStaminaPercent = 0.40f; // TODO: or 40% less stamina?
|
||||
|
||||
// Chance for a mined vein to yield an extra unit of ore. 0 disables the yield half of
|
||||
// the affinity and leaves it purely a speed/stamina perk.
|
||||
public static readonly float MiningExtraDropChance = 0.25f; // TODO
|
||||
|
||||
// Matched against the drop prefab name, lowercased, by Contains.
|
||||
public static readonly string[] OreDropNames =
|
||||
{
|
||||
"copperore", "tinore", "ironscrap", "silverore", "blackmetalscrap", "flametalore"
|
||||
};
|
||||
|
||||
// ─── Smithing / jewelry ──────────────────────────────────────────────
|
||||
// Percentage saved on the metal cost of crafting and upgrading. Starts at Bonemass and
|
||||
// caps at Moder. Indexed by progression state.
|
||||
public static readonly float[] SmithingDiscountByState =
|
||||
{
|
||||
0f, // (unused)
|
||||
0f, // 1 Base
|
||||
0f, // 2 Eikthyr
|
||||
0f, // 3 The Elder
|
||||
0.20f, // 4 Bonemass
|
||||
0.40f, // 5 Moder - cap
|
||||
0.40f, // 6 Yagluth
|
||||
0.40f, // 7 The Queen
|
||||
0.40f // 8 Fader
|
||||
};
|
||||
|
||||
// Only these resources are discounted, which is what keeps the perk to smithing and
|
||||
// jewelry rather than quietly cheapening every wooden wall the player puts up.
|
||||
public static readonly string[] DiscountedResourceNames =
|
||||
{
|
||||
"copper", "tin", "bronze", "iron", "silver", "blackmetal", "flametal",
|
||||
"ironnails", "bronzenails", "copperore", "tinore", "silverore", "flametalore",
|
||||
"ruby", "amber", "amberpearl", "coins", "silvernecklace"
|
||||
};
|
||||
|
||||
// ─── Haldor / Hildir favour ──────────────────────────────────────────
|
||||
// Both halves of the trade: a discount on what the traders charge, and a bonus on what
|
||||
// they pay for trophies and hunting rewards. Indexed by progression state.
|
||||
public static readonly float[] TraderBuyDiscountByState =
|
||||
{
|
||||
0f, // (unused)
|
||||
0f, // 1 Base
|
||||
0f, // 2 Eikthyr
|
||||
0f, // 3 The Elder
|
||||
0.10f, // 4 Bonemass - step 1 TODO
|
||||
0.15f, // 5 Moder - step 2 TODO
|
||||
0.20f, // 6 Yagluth - step 3 TODO
|
||||
0.25f, // 7 The Queen - full TODO
|
||||
0.25f // 8 Fader
|
||||
};
|
||||
|
||||
public static readonly float[] TraderSellBonusByState =
|
||||
{
|
||||
0f, // (unused)
|
||||
0f, // 1 Base
|
||||
0f, // 2 Eikthyr
|
||||
0f, // 3 The Elder
|
||||
0.10f, // 4 Bonemass - step 1 TODO
|
||||
0.20f, // 5 Moder - step 2 TODO
|
||||
0.30f, // 6 Yagluth - step 3 TODO
|
||||
0.40f, // 7 The Queen - full TODO
|
||||
0.40f // 8 Fader
|
||||
};
|
||||
|
||||
// ─── Runic Ping (Yagluth) ────────────────────────────────────────────
|
||||
public const int RunicPingState = 6;
|
||||
public const KeyCode RunicPingKey = KeyCode.G;
|
||||
|
||||
public static readonly float RunicPingEitrCost = 25f; // TODO
|
||||
public static readonly float RunicPingRadius = 40f; // TODO
|
||||
public static readonly float RunicPingDuration = 10f; // TODO
|
||||
public static readonly float RunicPingCooldown = 20f; // TODO
|
||||
|
||||
public static readonly Color RunicPingOreColor = new Color(0.4f, 0.8f, 1f);
|
||||
public static readonly Color RunicPingEnemyColor = new Color(1f, 0.35f, 0.35f);
|
||||
public static readonly float RunicPingLightRange = 8f;
|
||||
public static readonly float RunicPingLightIntensity = 2f;
|
||||
|
||||
// Vein prefabs are matched on name, lowercased, by Contains - MineRock5_Copper,
|
||||
// silvervein, rock4_copper and friends all fall out of this list.
|
||||
public static readonly string[] RunicPingVeinNames =
|
||||
{
|
||||
"copper", "tin", "silvervein", "obsidian", "meteorite", "flametal", "mudpile", "leviathan"
|
||||
};
|
||||
|
||||
// ─── Runic Overcharge (Fader) ────────────────────────────────────────
|
||||
public const int RunicOverchargeState = 8;
|
||||
public const KeyCode RunicOverchargeKey = KeyCode.H;
|
||||
|
||||
public static readonly float RunicOverchargeEitrCost = 60f; // TODO
|
||||
public static readonly float RunicOverchargeMultiplier = 4f; // TODO, applied to physical damage
|
||||
public static readonly float RunicOverchargeWindow = 15f; // seconds the charge is held
|
||||
public static readonly float RunicOverchargeCooldown = 60f; // TODO
|
||||
|
||||
// ─── Helpers ─────────────────────────────────────────────────────────
|
||||
/// <summary>Clamped table lookup, so a state outside 1..8 can never index out of range.</summary>
|
||||
public static float Lookup(float[] table, int state)
|
||||
{
|
||||
if (table == null || table.Length == 0) return 0f;
|
||||
int index = Mathf.Clamp(state, BossProgressionManager.MinState, table.Length - 1);
|
||||
return table[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue