Merge branch 'war-vulture' into main
Brings in v1.4.3-v1.4.5 work: Trol's Hammer, Bone Servants, War Vulture craftability, and the Aswid/Fenrir timed-claws rework, on top of the bugfixes merged into main since v1.4.2. Resolved conflicts in 7 files where main's post-v1.4.2 fixes overlapped war-vulture's claws rework: - README.md, manifest.json: took war-vulture's v1.4.5 content (main hadn't touched either since the v1.4.2 release). - RacesOfValheim.cs: plugin version -> 1.4.5. - RaceClaws.cs: kept war-vulture's lazy EnsureRoster() fix for the Fenrir claw-registration bug over main's belt-and-suspenders Register(this), and dropped the now-stale comment referencing the removed static constructor. Main's SetupDragItem race-ownership fix carried through untouched. - AswidConfig.cs/AswidRace.cs/AswidPatches.cs: adopted war-vulture's single-key design (I toggles both Vampiric Aura and Devour together) to match the documented v1.4.5 trader-safety fix, removing a duplicate AuraEnabled field the two branches had each declared independently. Kept main's IsDownIgnoringHeldKeys() input fix on top. - RaceCompendium.cs: kept main's fact-checked Aswid/Fenrir entries (war-vulture's copies were pre-fix stubs, one referencing a nonexistent variable) and layered in war-vulture's timed-claws wording. Build verified clean (0 errors) after resolution.
This commit is contained in:
commit
c2212df322
38 changed files with 3831 additions and 192 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
|
@ -158,9 +159,16 @@ namespace RacesOfValheim
|
|||
// SkadiSEManPatch above from tier 1 onward, so the tier 2 "Freezing to Cold" conversion never
|
||||
// gets a chance to run. These two patches scope out just that one environmental check: while
|
||||
// Player.UpdateEnvStatusEffects is running for the local Skadi player, GetDamageModifiers is
|
||||
// reported as Normal for Frost, so vanilla always attempts to apply the real status and
|
||||
// SkadiSEManPatch's per-tier logic (block/convert/allow) is what actually decides the outcome.
|
||||
// Frost damage resistance from hits (SkadiDamagePatch) is untouched by this.
|
||||
// reported without SE_SkadiStats' own Frost contribution, so vanilla attempts to apply the
|
||||
// real status and SkadiSEManPatch's per-tier logic (block/convert/allow) is what actually
|
||||
// decides the outcome. Frost damage resistance from hits (SkadiDamagePatch) is untouched.
|
||||
//
|
||||
// Only the race's own contribution is discounted. This used to report a flat Normal, which
|
||||
// also erased Frost resistance coming from a wolf/lox cape, a frost resistance mead or food:
|
||||
// a Skadi who had beaten Moder still caught the converted Cold on the Mountain while wearing
|
||||
// gear that makes a human immune, and below tier 4 caught real Freezing through the same gear.
|
||||
// The tiered ladder is meant to make the race better than a bare human, never worse than an
|
||||
// equipped one, so anything the player is actually wearing or drinking still counts.
|
||||
[HarmonyPatch(typeof(Player), "UpdateEnvStatusEffects")]
|
||||
public static class SkadiEnvCheckScope
|
||||
{
|
||||
|
|
@ -180,11 +188,38 @@ namespace RacesOfValheim
|
|||
[HarmonyPatch(typeof(Character), "GetDamageModifiers")]
|
||||
public static class SkadiEnvFrostModifierPatch
|
||||
{
|
||||
private static readonly int SkadiStatsHash = "SE_SkadiStats".GetStableHashCode();
|
||||
// Handed to the aura in place of its own list while the recompute runs. SE_Stats applies
|
||||
// m_mods as-is, so an empty list is simply "this effect grants nothing".
|
||||
private static readonly List<HitData.DamageModPair> NoMods = new List<HitData.DamageModPair>();
|
||||
private static bool recomputing = false;
|
||||
|
||||
public static void Postfix(Character __instance, ref HitData.DamageModifiers __result)
|
||||
{
|
||||
if (SkadiEnvCheckScope.Active && __instance == Player.m_localPlayer)
|
||||
if (recomputing) return;
|
||||
if (!SkadiEnvCheckScope.Active || __instance != Player.m_localPlayer) return;
|
||||
|
||||
// Character.GetDamageModifiers composes base modifiers + equipment + status effects,
|
||||
// and DamageModifiers.Apply keeps the strongest of the lot - there is no way to
|
||||
// subtract one contributor from a finished result. So the aura is muted and the whole
|
||||
// thing recomputed: what comes back is exactly what this player would have without
|
||||
// the race. The recursive call re-enters this postfix, which the flag turns into a
|
||||
// no-op. The status effect on the player is a clone of the registered prototype
|
||||
// (SEMan.AddStatusEffect clones on add), hence the lookup by hash rather than
|
||||
// SkadiRace.skadiCurseSE.
|
||||
SE_Stats aura = __instance.GetSEMan().GetStatusEffect(SkadiStatsHash) as SE_Stats;
|
||||
List<HitData.DamageModPair> auraMods = aura != null ? aura.m_mods : null;
|
||||
|
||||
recomputing = true;
|
||||
if (aura != null) aura.m_mods = NoMods;
|
||||
try
|
||||
{
|
||||
__result.m_frost = HitData.DamageModifier.Normal;
|
||||
__result.m_frost = __instance.GetDamageModifiers(null).m_frost;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (aura != null) aura.m_mods = auraMods;
|
||||
recomputing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue