Wargles' suggestion. A Dvergar pays 3 stone per black marble and 2 fine wood per Yggdrasil wood on structural hammer pieces; stations, furniture, containers and fires keep their cost. The swap is made on the piece prefabs of the Dvergar's own client, so the menu, the known piece check and the cost paid all follow it, and the pieces show once stone or fine wood is known. Vanilla refunds whatever m_resources says on the machine that destroys a piece, so a cheap piece is tagged on its ZDO with the ratios paid, and DropResources gets the matching cost on every client: a cheap wall never refunds black marble, and a vanilla wall still does. Swapped pieces carry the Dvergar race icon on their button in the 1.0 build menu (BuildUiPieceButton). The startup log lists every swapped piece with its station and both costs. Config: "Dvergar - Cheap Building" (Enabled, Stone per Black Marble, Fine Wood per Yggdrasil Wood).
124 lines
9.7 KiB
C#
124 lines
9.7 KiB
C#
using UnityEngine;
|
|
using BepInEx.Configuration;
|
|
|
|
namespace RacesOfValheim
|
|
{
|
|
/// <summary>
|
|
/// The BepInEx-configurable slice of the Dvergar's numbers, bound as ConfigEntry so they show
|
|
/// up in Configuration Manager without touching code - see CONFIGURATION-MANAGER-HOWTO.md.
|
|
/// Bound once, from RacesOfValheim.Awake(). One section per topic (matches
|
|
/// SkadiConfig/AswidConfig/DraughConfig's layout).
|
|
///
|
|
/// Named separately from the pre-existing DvergarConfig (rather than folding into it) because
|
|
/// that class is a different kind of thing: identity constants that must never change once a
|
|
/// player has the race (RaceId, status effect names - renaming them would orphan saved
|
|
/// characters), hand-tuned cosmetic placement numbers (eye/hood position - exposing those as
|
|
/// sliders would just let someone accidentally break the model), and per-tier tables (health
|
|
/// malus, smithing/trader discounts - the same "leave alone" boundary drawn for every other
|
|
/// race's progression table). Only the genuine ability knobs - Runic Ping/Overcharge and their
|
|
/// two keybinds, mining and weapon-affinity percentages - belong here. DvergarConfig's own
|
|
/// fields for those now forward to this class (see the comments there), so every existing call
|
|
/// site kept working unchanged.
|
|
///
|
|
/// One caveat worth knowing: DvergarProgression.GetRules caches its result per progression
|
|
/// state the first time that state is reached. ElementalDamagePerState and the weapon-affinity
|
|
/// percentages below are read into that cache, so retuning them mid-session only affects tiers
|
|
/// the cache hasn't already built - a relog (or reaching a new tier) picks up the new value.
|
|
/// Runic Ping/Overcharge and mining read their config live on every use and are unaffected.
|
|
/// </summary>
|
|
public static class DvergarConfigManagement
|
|
{
|
|
// ─── Keybinds ──────────────────────────────────────────────────────────
|
|
public static ConfigEntry<KeyboardShortcut> RunicPingKey;
|
|
public static ConfigEntry<KeyboardShortcut> RunicOverchargeKey;
|
|
|
|
// ─── Passive combat ──────────────────────────────────────────────────
|
|
public static ConfigEntry<float> ElementalDamagePerState;
|
|
public static ConfigEntry<float> MinMaxHealth;
|
|
public static ConfigEntry<float> WeaponAffinityDamagePercent;
|
|
public static ConfigEntry<float> WeaponAffinityStaminaPercent;
|
|
|
|
// ─── Mining ────────────────────────────────────────────────────────────
|
|
public static ConfigEntry<float> MiningDamageMultiplier;
|
|
public static ConfigEntry<float> MiningStaminaPercent;
|
|
public static ConfigEntry<float> MiningExtraDropChance;
|
|
|
|
// ─── Runic Ping (tier 6+) ─────────────────────────────────────────────
|
|
public static ConfigEntry<float> RunicPingEitrCost;
|
|
public static ConfigEntry<float> RunicPingRadius;
|
|
public static ConfigEntry<float> RunicPingDuration;
|
|
public static ConfigEntry<float> RunicPingCooldown;
|
|
public static ConfigEntry<float> RunicPingLightRange;
|
|
public static ConfigEntry<float> RunicPingLightIntensity;
|
|
|
|
// ─── Runic Overcharge (tier 8) ────────────────────────────────────────
|
|
public static ConfigEntry<float> RunicOverchargeEitrCost;
|
|
public static ConfigEntry<float> RunicOverchargeMultiplier;
|
|
public static ConfigEntry<float> RunicOverchargeWindow;
|
|
public static ConfigEntry<float> RunicOverchargeCooldown;
|
|
|
|
// ─── Cheap Building ───────────────────────────────────────────────────────
|
|
public static ConfigEntry<bool> CheapBuildingEnabled;
|
|
public static ConfigEntry<int> CheapStonePerBlackMarble;
|
|
public static ConfigEntry<int> CheapFineWoodPerYggdrasil;
|
|
|
|
public static void Bind(ConfigFile config)
|
|
{
|
|
const string keybinds = "Dvergar - Keybinds";
|
|
RunicPingKey = config.Bind(keybinds, "Runic Ping", new KeyboardShortcut(KeyCode.G),
|
|
new ConfigDescription("Lights up ore veins and hidden enemies nearby, tier 6+."));
|
|
RunicOverchargeKey = config.Bind(keybinds, "Runic Overcharge", new KeyboardShortcut(KeyCode.H),
|
|
new ConfigDescription("Loads the next favoured-weapon blow with bonus damage, tier 8."));
|
|
|
|
const string combat = "Dvergar - Passive Combat";
|
|
ElementalDamagePerState = config.Bind(combat, "Elemental Damage Per State", 2f,
|
|
new ConfigDescription("Lightning added to every blow the player lands, multiplied by the current progression state.", new AcceptableValueRange<float>(0f, 10f)));
|
|
MinMaxHealth = config.Bind(combat, "Minimum Max Health", 5f,
|
|
new ConfigDescription("A Dvergar's max health is never reduced below this, however the per-tier malus lines up.", new AcceptableValueRange<float>(1f, 50f)));
|
|
WeaponAffinityDamagePercent = config.Bind(combat, "Weapon Affinity Damage Percent", 0.15f,
|
|
new ConfigDescription("Extra physical damage with a favoured weapon (Hammer/Bow/Axe/Crossbow), as a fraction.", new AcceptableValueRange<float>(0f, 1f)));
|
|
WeaponAffinityStaminaPercent = config.Bind(combat, "Weapon Affinity Stamina Percent", 0.20f,
|
|
new ConfigDescription("Stamina refunded on attacks with a favoured weapon, as a fraction.", new AcceptableValueRange<float>(0f, 1f)));
|
|
|
|
const string mining = "Dvergar - Mining";
|
|
MiningDamageMultiplier = config.Bind(mining, "Damage Multiplier", 1.20f,
|
|
new ConfigDescription("Multiplies pickaxe damage against rock, tier 2+.", new AcceptableValueRange<float>(1f, 3f)));
|
|
MiningStaminaPercent = config.Bind(mining, "Stamina Discount Percent", 0.40f,
|
|
new ConfigDescription("Stamina saved per pickaxe swing, as a fraction.", new AcceptableValueRange<float>(0f, 1f)));
|
|
MiningExtraDropChance = config.Bind(mining, "Extra Ore Drop Chance", 0.25f,
|
|
new ConfigDescription("Chance a mined vein yields one extra unit of ore. 0 disables the yield half of the affinity.", new AcceptableValueRange<float>(0f, 1f)));
|
|
|
|
const string ping = "Dvergar - Runic Ping";
|
|
RunicPingEitrCost = config.Bind(ping, "Eitr Cost", 25f,
|
|
new ConfigDescription("Eitr spent per cast.", new AcceptableValueRange<float>(0f, 100f)));
|
|
RunicPingRadius = config.Bind(ping, "Radius", 40f,
|
|
new ConfigDescription("Meters within which ore veins and hidden enemies are marked.", new AcceptableValueRange<float>(5f, 100f)));
|
|
RunicPingDuration = config.Bind(ping, "Marker Duration", 10f,
|
|
new ConfigDescription("Seconds a marker light stays lit.", new AcceptableValueRange<float>(1f, 60f)));
|
|
RunicPingCooldown = config.Bind(ping, "Cooldown", 20f,
|
|
new ConfigDescription("Seconds between casts.", new AcceptableValueRange<float>(0f, 300f)));
|
|
RunicPingLightRange = config.Bind(ping, "Marker Light Range", 8f,
|
|
new ConfigDescription("Range of each marker light.", new AcceptableValueRange<float>(1f, 30f)));
|
|
RunicPingLightIntensity = config.Bind(ping, "Marker Light Intensity", 2f,
|
|
new ConfigDescription("Intensity of each marker light.", new AcceptableValueRange<float>(0.1f, 10f)));
|
|
|
|
const string overcharge = "Dvergar - Runic Overcharge";
|
|
RunicOverchargeEitrCost = config.Bind(overcharge, "Eitr Cost", 60f,
|
|
new ConfigDescription("Eitr spent to load a charge.", new AcceptableValueRange<float>(0f, 200f)));
|
|
RunicOverchargeMultiplier = config.Bind(overcharge, "Damage Multiplier", 4f,
|
|
new ConfigDescription("Multiplies physical damage on the blow that discharges the loaded weapon.", new AcceptableValueRange<float>(1f, 10f)));
|
|
RunicOverchargeWindow = config.Bind(overcharge, "Charge Window", 15f,
|
|
new ConfigDescription("Seconds a loaded charge is held before it lapses unused.", new AcceptableValueRange<float>(1f, 60f)));
|
|
RunicOverchargeCooldown = config.Bind(overcharge, "Cooldown", 60f,
|
|
new ConfigDescription("Seconds between casts.", new AcceptableValueRange<float>(0f, 300f)));
|
|
|
|
const string building = "Dvergar - Cheap Building";
|
|
CheapBuildingEnabled = config.Bind(building, "Enabled", true,
|
|
new ConfigDescription("A Dvergar builds the black marble and Yggdrasil wood building pieces (walls, floors, beams, roofs, arches, stairs) with stone and fine wood instead. Stations and furniture keep their cost. A deconstructed piece gives back what was paid for it."));
|
|
CheapStonePerBlackMarble = config.Bind(building, "Stone per Black Marble", 3,
|
|
new ConfigDescription("Stone a Dvergar pays for each black marble in a piece's cost.", new AcceptableValueRange<int>(1, 10)));
|
|
CheapFineWoodPerYggdrasil = config.Bind(building, "Fine Wood per Yggdrasil Wood", 2,
|
|
new ConfigDescription("Fine wood a Dvergar pays for each Yggdrasil wood in a piece's cost.", new AcceptableValueRange<int>(1, 10)));
|
|
}
|
|
}
|
|
}
|