180 lines
15 KiB
C#
180 lines
15 KiB
C#
using UnityEngine;
|
|
using BepInEx.Configuration;
|
|
|
|
namespace RacesOfValheim
|
|
{
|
|
/// <summary>
|
|
/// Every tunable number and keybind behind the Trol's abilities, 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
|
|
/// topic (matches every other race's layout).
|
|
///
|
|
/// Tier-gate thresholds (which progression state unlocks each perk) are left as-is, same
|
|
/// boundary drawn for every other race's progression table - not exposed here.
|
|
///
|
|
/// True Form's scale (Normal/Advanced) is read from both the local transform routine
|
|
/// (TrolRace) and the remote-sizing postfix (TrolPatches) - both now read the same
|
|
/// ConfigEntry rather than each carrying its own literal, so a retuned value can no longer
|
|
/// make a Trol one size to themselves and another to everyone else.
|
|
/// </summary>
|
|
public static class TrolConfig
|
|
{
|
|
// ─── Keybinds ──────────────────────────────────────────────────────────
|
|
public static ConfigEntry<KeyboardShortcut> ThrowRockKey;
|
|
public static ConfigEntry<KeyboardShortcut> TrueFormKey;
|
|
public static ConfigEntry<KeyboardShortcut> GrabLogKey;
|
|
|
|
// ─── Passive combat ──────────────────────────────────────────────────
|
|
public static ConfigEntry<float> FireWeaknessMultiplier;
|
|
public static ConfigEntry<float> BonemassMeleeBonus;
|
|
public static ConfigEntry<float> YagluthMeleeBonus;
|
|
public static ConfigEntry<float> TrueFormMeleeBonus;
|
|
public static ConfigEntry<float> RegenMultiplierBonus;
|
|
public static ConfigEntry<float> FavoredSkillXPMultiplier;
|
|
public static ConfigEntry<float> CarryWeightBonusBase;
|
|
public static ConfigEntry<float> CarryWeightBonusBonemass;
|
|
public static ConfigEntry<float> CarryWeightBonusYagluth;
|
|
public static ConfigEntry<float> ArmorBonusPerState;
|
|
|
|
// ─── Throw Rock (tier 3+) ─────────────────────────────────────────────
|
|
public static ConfigEntry<float> ThrowRockCooldown;
|
|
public static ConfigEntry<float> ThrowRockCooldownTrueForm;
|
|
public static ConfigEntry<float> ThrowRockBaseDamage;
|
|
public static ConfigEntry<float> ThrowRockBonemassBonus;
|
|
public static ConfigEntry<float> ThrowRockYagluthBonus;
|
|
public static ConfigEntry<float> ThrowRockTrueFormBonus;
|
|
public static ConfigEntry<float> ThrowRockProjectileVelocity;
|
|
public static ConfigEntry<float> ThrowLogVelocity;
|
|
|
|
// ─── True Form (tier 5+) ───────────────────────────────────────────────
|
|
public static ConfigEntry<float> TrueFormDuration;
|
|
public static ConfigEntry<float> TrueFormCooldown;
|
|
public static ConfigEntry<float> TrueFormScaleNormal;
|
|
public static ConfigEntry<float> TrueFormScaleAdvanced;
|
|
public static ConfigEntry<bool> TrueFormLegacy;
|
|
public static ConfigEntry<float> TrueFormModelSize;
|
|
public static ConfigEntry<float> TrueFormTrollDamageShare;
|
|
public static ConfigEntry<float> TrueFormAttackReach;
|
|
public static ConfigEntry<bool> TrueFormSlamCrater;
|
|
public static ConfigEntry<float> TrueFormPunchStamina;
|
|
public static ConfigEntry<float> TrueFormSlamStamina;
|
|
public static ConfigEntry<float> TrueFormLogSwingStamina;
|
|
public static ConfigEntry<float> TrueFormLogOverheadStamina;
|
|
|
|
// ─── Log Weapon (tier 7+) ──────────────────────────────────────────────
|
|
public static ConfigEntry<float> LogWeaponMaxDurability;
|
|
public static ConfigEntry<float> LogWeaponDurabilityDrainPerHit;
|
|
|
|
// ─── Farming ───────────────────────────────────────────────────────────
|
|
public static ConfigEntry<float> UnarmedFarmingDamageBonusPerState;
|
|
|
|
// ─── Appearance ────────────────────────────────────────────────────────
|
|
public static ConfigEntry<Color> SkinColor;
|
|
public static ConfigEntry<Color> HairColor;
|
|
|
|
// The colours every Trol wore before these became settings. Also what a Trol on an older
|
|
// build of the mod shows as, since that build publishes no colour of its own.
|
|
public static readonly Color DefaultSkinColor = new Color(0.1f, 0.6f, 0.7f, 1f);
|
|
public static readonly Color DefaultHairColor = new Color(0.9f, 0.8f, 0.4f, 1f);
|
|
|
|
public static void Bind(ConfigFile config)
|
|
{
|
|
const string appearance = "Trol - Appearance";
|
|
SkinColor = config.Bind(appearance, "Skin Color", DefaultSkinColor,
|
|
new ConfigDescription("Your Trol's skin. Other players see it too. The game multiplies it with the skin texture, so it comes out a little darker than the swatch. For the look of Valheim's own trolls try 7FA8C9."));
|
|
HairColor = config.Bind(appearance, "Hair Color", DefaultHairColor,
|
|
new ConfigDescription("Your Trol's hair and beard. Other players see it too."));
|
|
|
|
const string keybinds = "Trol - Keybinds";
|
|
ThrowRockKey = config.Bind(keybinds, "Throw Rock", new KeyboardShortcut(KeyCode.G),
|
|
new ConfigDescription("Throws a rock (or the log you're holding), tier 3+."));
|
|
TrueFormKey = config.Bind(keybinds, "True Form", new KeyboardShortcut(KeyCode.H),
|
|
new ConfigDescription("Transform into (or revert from) True Form, tier 5+."));
|
|
GrabLogKey = config.Bind(keybinds, "Grab Log", new KeyboardShortcut(KeyCode.E),
|
|
new ConfigDescription("Grabs a felled log as a weapon while looking at one, tier 7+ and already in True Form. The game's own Use key (gamepad included) always grabs too; this is an extra key on top of it."));
|
|
|
|
const string combat = "Trol - Passive Combat";
|
|
FireWeaknessMultiplier = config.Bind(combat, "Fire Weakness Multiplier", 1.5f,
|
|
new ConfigDescription("Multiplies incoming fire damage (1.5 = 50% weaker).", new AcceptableValueRange<float>(1f, 3f)));
|
|
BonemassMeleeBonus = config.Bind(combat, "Bonemass Melee Bonus", 10f,
|
|
new ConfigDescription("Flat damage added to Clubs/Unarmed/Axes attacks, tier 4+.", new AcceptableValueRange<float>(0f, 100f)));
|
|
YagluthMeleeBonus = config.Bind(combat, "Yagluth Melee Bonus", 5f,
|
|
new ConfigDescription("Additional flat damage added to Clubs/Unarmed/Axes attacks, tier 6+.", new AcceptableValueRange<float>(0f, 100f)));
|
|
TrueFormMeleeBonus = config.Bind(combat, "True Form Melee Bonus", 40f,
|
|
new ConfigDescription("Flat damage added to Clubs/Unarmed/Axes attacks while in True Form.", new AcceptableValueRange<float>(0f, 200f)));
|
|
RegenMultiplierBonus = config.Bind(combat, "Regen Multiplier Bonus", 0.10f,
|
|
new ConfigDescription("Health regen multiplier bonus, tier 3+ (0.10 = +10%).", new AcceptableValueRange<float>(0f, 2f)));
|
|
FavoredSkillXPMultiplier = config.Bind(combat, "Favored Skill XP Multiplier", 2f,
|
|
new ConfigDescription("Multiplies XP gain for Clubs/Unarmed/Axes/Pickaxes/WoodCutting, tier 2+.", new AcceptableValueRange<float>(0.5f, 5f)));
|
|
CarryWeightBonusBase = config.Bind(combat, "Carry Weight Bonus (Base)", 200f,
|
|
new ConfigDescription("Flat carry weight added, always active.", new AcceptableValueRange<float>(0f, 1000f)));
|
|
CarryWeightBonusBonemass = config.Bind(combat, "Carry Weight Bonus (Bonemass)", 50f,
|
|
new ConfigDescription("Additional flat carry weight, tier 4+.", new AcceptableValueRange<float>(0f, 500f)));
|
|
CarryWeightBonusYagluth = config.Bind(combat, "Carry Weight Bonus (Yagluth)", 50f,
|
|
new ConfigDescription("Additional flat carry weight, tier 6+.", new AcceptableValueRange<float>(0f, 500f)));
|
|
ArmorBonusPerState = config.Bind(combat, "Armor Bonus Per State", 3f,
|
|
new ConfigDescription("Flat armor added, per progression state.", new AcceptableValueRange<float>(0f, 20f)));
|
|
|
|
const string throwRock = "Trol - Throw Rock";
|
|
ThrowRockCooldown = config.Bind(throwRock, "Cooldown", 60f,
|
|
new ConfigDescription("Seconds between throws in human form.", new AcceptableValueRange<float>(0f, 300f)));
|
|
ThrowRockCooldownTrueForm = config.Bind(throwRock, "Cooldown (True Form)", 15f,
|
|
new ConfigDescription("Seconds between throws while in True Form.", new AcceptableValueRange<float>(0f, 300f)));
|
|
ThrowRockBaseDamage = config.Bind(throwRock, "Base Damage", 25f,
|
|
new ConfigDescription("Base blunt damage of a thrown rock (not used when throwing a log).", new AcceptableValueRange<float>(0f, 200f)));
|
|
ThrowRockBonemassBonus = config.Bind(throwRock, "Bonemass Bonus", 10f,
|
|
new ConfigDescription("Additional damage, tier 4+.", new AcceptableValueRange<float>(0f, 100f)));
|
|
ThrowRockYagluthBonus = config.Bind(throwRock, "Yagluth Bonus", 5f,
|
|
new ConfigDescription("Additional damage, tier 6+.", new AcceptableValueRange<float>(0f, 100f)));
|
|
ThrowRockTrueFormBonus = config.Bind(throwRock, "True Form Bonus", 40f,
|
|
new ConfigDescription("Additional damage while in True Form.", new AcceptableValueRange<float>(0f, 200f)));
|
|
ThrowRockProjectileVelocity = config.Bind(throwRock, "Rock Velocity", 20f,
|
|
new ConfigDescription("Travel speed of a thrown rock.", new AcceptableValueRange<float>(1f, 60f)));
|
|
ThrowLogVelocity = config.Bind(throwRock, "Log Velocity", 60f,
|
|
new ConfigDescription("Travel speed of a thrown log (compensates for its weight/drag).", new AcceptableValueRange<float>(1f, 150f)));
|
|
|
|
const string trueForm = "Trol - True Form";
|
|
TrueFormDuration = config.Bind(trueForm, "Duration", 60f,
|
|
new ConfigDescription("Seconds True Form lasts before automatically reverting. Ignored once Fader is defeated: the form then lasts until you press the key again.", new AcceptableValueRange<float>(5f, 600f)));
|
|
TrueFormCooldown = config.Bind(trueForm, "Cooldown", 600f,
|
|
new ConfigDescription("Seconds between True Form activations.", new AcceptableValueRange<float>(0f, 3600f)));
|
|
TrueFormScaleNormal = config.Bind(trueForm, "Scale", 2.0f,
|
|
new ConfigDescription("Model scale while in True Form, tier 5-6.", new AcceptableValueRange<float>(1f, 4f)));
|
|
TrueFormScaleAdvanced = config.Bind(trueForm, "Scale (Tier 7+)", 2.5f,
|
|
new ConfigDescription("Model scale while in True Form, tier 7+.", new AcceptableValueRange<float>(1f, 4f)));
|
|
TrueFormLegacy = config.Bind(trueForm, "Legacy True Form", false,
|
|
new ConfigDescription("Off: True Form wears Valheim's own troll, with its punch and ground slam instead of your weapons. On: the old True Form, your own Trol grown bigger with weapons in hand. Turn it on if you use a player model mod such as VRM, which needs the player's body to stay visible. Your own choice: other players see you the way you picked."));
|
|
TrueFormModelSize = config.Bind(trueForm, "Troll Model Size", 1f,
|
|
new ConfigDescription("How tall the troll stands, as a share of the True Form size set by Scale above. 1 = exactly as tall as the old True Form.", new AcceptableValueRange<float>(0.5f, 2f)));
|
|
TrueFormTrollDamageShare = config.Bind(trueForm, "Troll Attack Damage", 0.5f,
|
|
new ConfigDescription("Share of a real troll's damage each troll attack deals. Your Clubs skill then scales it the way it scales a club, and the True Form Melee Bonus and tier bonuses add on top.", new AcceptableValueRange<float>(0.1f, 2f)));
|
|
TrueFormAttackReach = config.Bind(trueForm, "Troll Attack Reach", 1.3f,
|
|
new ConfigDescription("Multiplies how far the troll's punch and slam reach and how wide they hit. 1 = a real troll's reach at the size you stand.", new AcceptableValueRange<float>(0.5f, 3f)));
|
|
TrueFormSlamCrater = config.Bind(trueForm, "Ground Slam Crater", true,
|
|
new ConfigDescription("The ground slam digs into the ground where it lands, like a pickaxe blow. Never inside a ward you have no access to."));
|
|
|
|
// Priced by the troll's own damage (punch and side log swing 60 blunt, slam and overhead
|
|
// log 70), with the slam dearer because it hits all around: vanilla charges a sledge about
|
|
// twice a mace for similar damage. An iron mace swing costs 10, an iron sledge 20.
|
|
const string staminaNote = " Base stamina, cut by up to a third with the Clubs skill as a club's is. 0 makes it free.";
|
|
TrueFormPunchStamina = config.Bind(trueForm, "Punch Stamina", 10f,
|
|
new ConfigDescription("Stamina for the punch (Left Mouse)." + staminaNote, new AcceptableValueRange<float>(0f, 60f)));
|
|
TrueFormSlamStamina = config.Bind(trueForm, "Ground Slam Stamina", 18f,
|
|
new ConfigDescription("Stamina for the ground slam (Middle Mouse)." + staminaNote, new AcceptableValueRange<float>(0f, 60f)));
|
|
TrueFormLogSwingStamina = config.Bind(trueForm, "Log Swing Stamina", 10f,
|
|
new ConfigDescription("Stamina for the side swing with a log in hand (Left Mouse)." + staminaNote, new AcceptableValueRange<float>(0f, 60f)));
|
|
TrueFormLogOverheadStamina = config.Bind(trueForm, "Log Overhead Stamina", 12f,
|
|
new ConfigDescription("Stamina for the overhead swing with a log in hand (Middle Mouse)." + staminaNote, new AcceptableValueRange<float>(0f, 60f)));
|
|
|
|
const string logWeapon = "Trol - Log Weapon";
|
|
LogWeaponMaxDurability = config.Bind(logWeapon, "Max Durability", 6f,
|
|
new ConfigDescription("Hits a grabbed log weapon survives before breaking, tier 7+.", new AcceptableValueRange<float>(1f, 50f)));
|
|
LogWeaponDurabilityDrainPerHit = config.Bind(logWeapon, "Durability Drain Per Hit", 1f,
|
|
new ConfigDescription("Durability spent per hit landed.", new AcceptableValueRange<float>(0.1f, 10f)));
|
|
|
|
const string farming = "Trol - Farming";
|
|
UnarmedFarmingDamageBonusPerState = config.Bind(farming, "Unarmed Damage Bonus Per State", 3f,
|
|
new ConfigDescription("Extra chop/pickaxe damage when farming or mining unarmed, per progression state.", new AcceptableValueRange<float>(0f, 20f)));
|
|
}
|
|
}
|
|
}
|