fix(forms): Trol, Skadi, Sverm and Muspell form hits build adrenaline

The same bug the Fenrir forms had until d8dcecb. Vanilla grants a hit's
adrenaline inside Attack; these forms skip Attack and call Damage
directly, so only the stagger bonus in Character.Damage ever reached the
player.

FormMelee.GrantAdrenaline now runs after each hit of the True Form
troll's punch and log swings, the drake's maul, the Ravager's swings and
the Muspell's stomp. The troll's ground slam hits through an Aoe, which
never touches Attack either: the slam marks its Aoe, and a postfix on
Aoe.OnHit grants the adrenaline for each creature it lands on.

Projectiles (Throw Rock, the Muspell spike, drake breath) were never
affected: Projectile grants its own adrenaline on a hit.
This commit is contained in:
kanym 2026-10-29 01:52:10 +01:00
commit b7b9cbcbd5
4 changed files with 24 additions and 0 deletions

View file

@ -620,6 +620,7 @@ namespace RacesOfValheim
hitData.SetAttacker(Player.m_localPlayer);
target.Damage(hitData);
FormMelee.GrantAdrenaline(target);
}
}

View file

@ -1067,6 +1067,7 @@ namespace RacesOfValheim
hitData.SetAttacker(player);
target.Damage(hitData);
FormMelee.GrantAdrenaline(target);
}
}
}

View file

@ -496,6 +496,7 @@ namespace RacesOfValheim
hitData.SetAttacker(attacker);
target.Damage(hitData);
FormMelee.GrantAdrenaline(target);
}
}
}

View file

@ -337,6 +337,7 @@ namespace RacesOfValheim
aoe.m_hitOwner = false;
aoe.m_hitProps = true;
aoe.m_radius = Mathf.Max(aoe.m_radius, range * 0.6f);
instance.AddComponent<TrolSlamAoe>();
aoe.Setup(player, player.transform.forward, -1f, hitData, null, null);
spawned = true;
}
@ -429,6 +430,7 @@ namespace RacesOfValheim
if (targetObj != null) done.Add(targetObj);
FormMelee.LogHit(FormLabel, target, damage.GetTotalDamage());
target.Damage(hitData);
FormMelee.GrantAdrenaline(target);
profile.Shared.m_hitEffect.Create(targetCenter, Quaternion.identity);
landed++;
}
@ -437,6 +439,25 @@ namespace RacesOfValheim
}
}
/// <summary>Marks the Aoe a True Form slam spawned, so its hits can be told apart from a
/// real troll's.</summary>
internal class TrolSlamAoe : MonoBehaviour { }
/// <summary>
/// Adrenaline for each creature the slam's Aoe lands on. Vanilla gives it inside Attack, and
/// an Aoe set up by hand never goes through one (FormMelee.GrantAdrenaline says why the sweeps
/// needed the same).
/// </summary>
[HarmonyPatch(typeof(Aoe), "OnHit")]
public static class Trol_SlamAoeAdrenaline_Patch
{
public static void Postfix(Aoe __instance, Collider collider, bool __result)
{
if (!__result || collider == null || __instance.GetComponent<TrolSlamAoe>() == null) return;
FormMelee.GrantAdrenaline(collider.GetComponentInParent<Character>());
}
}
/// <summary>
/// The troll every other client sees. RemoteFenrirAnimator in shape: legs from the remote
/// player's own Animator, which ZSyncAnimation keeps fed over the network, and attacks replayed