fix(fenrir): form hits build adrenaline like a weapon hit

Vanilla grants a hit's adrenaline inside Attack. The forms skip Attack
and call Damage directly, so only the stagger bonus in Character.Damage
reached the player: meadow mobs, quick to stagger, filled the bar, while
Lox, Tar, Brutes and Furlings gave nothing until staggered.

FormMelee.GrantAdrenaline adds the player's unarmed attack adrenaline
times the target's multiplier after each claw or bite, and a fifth of
it per 0.2s tick of the Cultist's fire.
This commit is contained in:
kanym 2026-10-23 22:17:17 +02:00
commit d8dcecb573
2 changed files with 25 additions and 0 deletions

View file

@ -752,6 +752,7 @@ namespace RacesOfValheim
if (targetObj != null) hitObjects.Add(targetObj); if (targetObj != null) hitObjects.Add(targetObj);
FormMelee.LogHit(FormLabel, target, totalDamage); FormMelee.LogHit(FormLabel, target, totalDamage);
target.Damage(hitData); target.Damage(hitData);
FormMelee.GrantAdrenaline(target);
} }
} }
} }
@ -1012,6 +1013,7 @@ namespace RacesOfValheim
if (targetObj != null) hitObjects.Add(targetObj); if (targetObj != null) hitObjects.Add(targetObj);
FormMelee.LogHit(FormLabel, target, totalDamage); FormMelee.LogHit(FormLabel, target, totalDamage);
target.Damage(hitData); target.Damage(hitData);
FormMelee.GrantAdrenaline(target, 0.2f); // one 0.2s tick: a full hit per second of breath
if (ZNetScene.instance != null) if (ZNetScene.instance != null)
{ {
@ -1141,6 +1143,7 @@ namespace RacesOfValheim
if (targetObj != null) hitObjects.Add(targetObj); if (targetObj != null) hitObjects.Add(targetObj);
FormMelee.LogHit(FormLabel, target, totalDamage); FormMelee.LogHit(FormLabel, target, totalDamage);
target.Damage(hitData); target.Damage(hitData);
FormMelee.GrantAdrenaline(target);
} }
} }
} }
@ -1355,6 +1358,7 @@ namespace RacesOfValheim
if (targetObj != null) hitObjects.Add(targetObj); if (targetObj != null) hitObjects.Add(targetObj);
FormMelee.LogHit(FormLabel, target, totalDamage); FormMelee.LogHit(FormLabel, target, totalDamage);
target.Damage(hitData); target.Damage(hitData);
FormMelee.GrantAdrenaline(target);
} }
} }
} }
@ -1562,6 +1566,7 @@ namespace RacesOfValheim
if (targetObj != null) hitObjects.Add(targetObj); if (targetObj != null) hitObjects.Add(targetObj);
FormMelee.LogHit(FormLabel, target, totalDamage); FormMelee.LogHit(FormLabel, target, totalDamage);
target.Damage(hitData); target.Damage(hitData);
FormMelee.GrantAdrenaline(target);
} }
} }
} }

View file

@ -336,6 +336,26 @@ namespace RacesOfValheim
Jotunn.Logger.LogInfo($"[FenrirForm] {form} swing skipped '{hit.name}' (layer {LayerMask.LayerToName(hit.gameObject.layer)}): {reason}."); Jotunn.Logger.LogInfo($"[FenrirForm] {form} swing skipped '{hit.name}' (layer {LayerMask.LayerToName(hit.gameObject.layer)}): {reason}.");
} }
/// <summary>
/// The adrenaline vanilla gives for a weapon hit, which a form's hit never got. Vanilla
/// grants it inside Attack (m_attackAdrenaline x the enemy's m_enemyAdrenalineMultiplier);
/// the forms skip Attack and call Damage directly, so only the stagger bonus inside
/// Character.Damage reached the player. That is the report: easy-to-stagger meadow mobs
/// filled the bar, Lox, Tar, Brutes and Furlings only did when staggered.
///
/// The per-hit amount is the player's own unarmed attack's, since the forms fight
/// unarmed. scale lets a damage-over-time tick pay a fraction of a hit.
/// </summary>
public static void GrantAdrenaline(IDestructible target, float scale = 1f)
{
Player player = Player.m_localPlayer;
if (player == null || !(target is Character character) || character == player) return;
ItemDrop unarmed = player.m_unarmedWeapon;
float perHit = unarmed != null ? unarmed.m_itemData.m_shared.m_attack.m_attackAdrenaline : 1f;
player.AddAdrenaline(perHit * character.m_enemyAdrenalineMultiplier * scale);
}
public static void LogHit(string form, IDestructible target, float damage) public static void LogHit(string form, IDestructible target, float damage)
{ {
if (!FenrirConfig.DebugFormHits.Value) return; if (!FenrirConfig.DebugFormHits.Value) return;