fix: a stagger cancels the form's attack

A form swing waits for its clip's hit event and lands on a timeout if none comes,
so a stagger that cut the clip short still dealt the blow. Attacks are marked as
they start (TrySpendStamina, Ravager AttackRoutine) and their hits are dropped if
a stagger began since. No attack or Cultist breath starts while staggered.
This commit is contained in:
kanym 2026-10-29 13:53:04 +01:00
commit beffd0bee6
5 changed files with 28 additions and 7 deletions

View file

@ -744,7 +744,7 @@ namespace RacesOfValheim
wasGrounded = grounded;
if (!RaceInput.Allowed || !grounded) return;
if (!RaceInput.Allowed || !grounded || player.IsStaggering()) return;
// Right click rams, left click bites, middle click slams. All three read the device
// directly (mouse, or its gamepad counterpart - see RaceInput.AttackDown) rather than
@ -782,6 +782,7 @@ namespace RacesOfValheim
float radius, bool slam, bool lunge)
{
isAttacking = true;
FormStagger.MarkAttack();
bool played = StartAttackState(profile);
if (rootMotion != null) rootMotion.Active = lunge;
@ -791,6 +792,7 @@ namespace RacesOfValheim
yield return FollowAttackState(stateName, played, 0f, () =>
{
if (FormStagger.AttackInterrupted) return;
if (slam) Slam(profile, radius, leftY, rightY, dropSamples);
else ExecuteDamage(profile, radius);
}, () =>