Merge branch 'fix-fenrir-form-adrenaline': Fenrir form hits build adrenaline like a weapon hit

This commit is contained in:
kanym 2026-10-23 22:23:20 +02:00
commit e37084ac33
2 changed files with 25 additions and 0 deletions

View file

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