Adds TrolConfig.cs, following the established per-race pattern: one Configuration Manager section per topic (Passive Combat, Throw Rock, True Form, Log Weapon, Farming), plus the two ability keybinds (Throw Rock, True Form). Defaults match the previous hardcoded constants exactly. Fixes a real sync risk found while wiring it: True Form's scale (2.0 normal / 2.5 at tier 7+) was hardcoded independently in two places - the local transform routine in TrolRace and the remote-player sizing postfix in TrolPatches. Both now read the same TrolConfig.TrueFormScaleNormal/ TrueFormScaleAdvanced, so a retuned value can no longer make a Trol one size to themselves and another size to everyone else. Tier-gate thresholds and the small hardcoded "normal size by tier" table (1.2/1.25/1.30) stay untouched, same boundary drawn for every other race's progression data. Config sections stay bound alphabetically by race (Aswid, Draugh, Dvergar, Fenrir, Furling, Skadi, Skeleton, Trenta, Trol) in RacesOfValheim.Awake() - this is the last of the nine.
63 lines
2.4 KiB
C#
63 lines
2.4 KiB
C#
using HarmonyLib;
|
|
using UnityEngine;
|
|
|
|
namespace RacesOfValheim
|
|
{
|
|
[HarmonyPatch(typeof(Character), "ApplyDamage")]
|
|
public static class Trol_Character_ApplyDamage_Patch
|
|
{
|
|
public static void Prefix(Character __instance, ref HitData hit)
|
|
{
|
|
if (__instance == Player.m_localPlayer && TrolRace.IsTrol())
|
|
{
|
|
// Trols are weak to fire
|
|
if (hit.m_damage.m_fire > 0f)
|
|
{
|
|
hit.m_damage.m_fire *= TrolConfig.FireWeaknessMultiplier.Value;
|
|
}
|
|
}
|
|
|
|
if (hit.GetAttacker() == Player.m_localPlayer && TrolRace.IsTrol())
|
|
{
|
|
if (BossProgressionManager.GetCurrentProgressionState() >= 4) // Bonemass
|
|
{
|
|
float bonus = TrolConfig.BonemassMeleeBonus.Value;
|
|
if (hit.m_skill == Skills.SkillType.Clubs || hit.m_skill == Skills.SkillType.Unarmed)
|
|
{
|
|
hit.m_damage.m_blunt += bonus;
|
|
}
|
|
else if (hit.m_skill == Skills.SkillType.Axes)
|
|
{
|
|
hit.m_damage.m_slash += bonus;
|
|
}
|
|
}
|
|
|
|
if (BossProgressionManager.GetCurrentProgressionState() >= 6) // Yagluth
|
|
{
|
|
float bonus = TrolConfig.YagluthMeleeBonus.Value;
|
|
if (hit.m_skill == Skills.SkillType.Clubs || hit.m_skill == Skills.SkillType.Unarmed)
|
|
{
|
|
hit.m_damage.m_blunt += bonus;
|
|
}
|
|
else if (hit.m_skill == Skills.SkillType.Axes)
|
|
{
|
|
hit.m_damage.m_slash += bonus;
|
|
}
|
|
}
|
|
|
|
if (Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_TrolTrueForm".GetStableHashCode()))
|
|
{
|
|
float bonus = TrolConfig.TrueFormMeleeBonus.Value;
|
|
if (hit.m_skill == Skills.SkillType.Clubs || hit.m_skill == Skills.SkillType.Unarmed)
|
|
{
|
|
hit.m_damage.m_blunt += bonus;
|
|
}
|
|
else if (hit.m_skill == Skills.SkillType.Axes)
|
|
{
|
|
hit.m_damage.m_slash += bonus;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|