fix(factions): the player can strike allied creatures again

Valheim 1.0's hit filters (Attack melee/area, Projectile OnHit/DoAOE/
IsValidTarget, Aoe.ShouldHit) skip a target when BaseAI.IsEnemy says
false and the attacker is a player without PvP. The truce said false
for every allied creature, so the blow passed through: no damage, no
grudge, nothing for kin to join. RaceGrudge.StrikeScope opens a scope
around those six methods in which both truce patches stand down for
the player's own hit; everything else keeps the truce.
This commit is contained in:
kanym 2026-11-06 21:21:20 +01:00
commit 4ee98d90cb
3 changed files with 57 additions and 0 deletions

View file

@ -165,6 +165,10 @@ namespace RacesOfValheim
if (!__result) return; // already not enemies, nothing to add
if (a == null || b == null) return;
// The player's own blow. Peace is the creature's choice, not a shield. See
// RaceGrudge.StrikeScope.
if (RaceGrudge.PlayerStrikes(a)) return;
if (IsThrallTruce(a, b) || IsThrallTruce(b, a))
{
__result = false;