True Form now hides the Trol's body and puts the vanilla forest troll's model in its place, on the owner's client and on every other player's. The costume stands as tall as the old True Form did: it follows the Visual scale Trol_PlayerUpdate_Patch already grows and publishes, so the grow-in, the shrink back and the size others see come for free. It takes the Trol skin colour from Trol - Appearance. Weapons are out while it is up. Left click is the troll's punch, right click its ground slam, and with a log in hand they become its two log swings, which wear the log down per hit as a club swing did. Throw Rock plays the troll's throw. The attacks, their triggers and reach are read off the troll's own weapons at runtime, and each hit lands on the troll's OnAttackTrigger event rather than a fixed delay. Damage is a share of the troll's own (Troll Attack Damage, 0.5), scaled by the Clubs skill like a club and hit as Clubs, so the True Form and tier melee bonuses still add on top. Other players see the troll from the existing True Form ZDO flag, with attacks replayed from a new trigger key. New options in Trol - True Form: Troll Model (on/off), Troll Model Size, Troll Attack Damage.
157 lines
13 KiB
C#
157 lines
13 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> TrueFormUseTrollModel;
|
|
public static ConfigEntry<float> TrueFormModelSize;
|
|
public static ConfigEntry<float> TrueFormTrollDamageShare;
|
|
|
|
// ─── 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. Matches vanilla's own interact key rather than reusing the True Form key a second time."));
|
|
|
|
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)));
|
|
TrueFormUseTrollModel = config.Bind(trueForm, "Troll Model", true,
|
|
new ConfigDescription("Wear Valheim's own troll in True Form, with its own punch and ground slam instead of your weapons. Off: the old True Form, a bigger Trol with weapons in hand."));
|
|
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)));
|
|
|
|
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)));
|
|
}
|
|
}
|
|
}
|