With real-time combat on, a connecting hit causes a short flinch that interrupts the victim's wind-up. Its length scales with damage relative to max health and with attack strength.
A blocked hit causes a smaller recoil on the blocker and, for strong blows, a brief stagger on the attacker.
Uses existing hit animation groups when the loaded content has them, and degrades gracefully when it doesn't, as on the Game Template.
Lua's ignoreStagger in AttackInfo is respected.
Unit tests cover the reaction timing. A headless run on the Game Template shows no errors.
Part of #5.
**Acceptance**
- With real-time combat on, a connecting hit causes a short flinch that interrupts the victim's wind-up. Its length scales with damage relative to max health and with attack strength.
- A blocked hit causes a smaller recoil on the blocker and, for strong blows, a brief stagger on the attacker.
- Uses existing hit animation groups when the loaded content has them, and degrades gracefully when it doesn't, as on the Game Template.
- Lua's `ignoreStagger` in AttackInfo is respected.
- Unit tests cover the reaction timing. A headless run on the Game Template shows no errors.
claude
added this to the 2. Feel milestone 2026-11-12 18:31:44 +00:00
New [Game] hit reactions setting, on by default, used with real time combat. The rules are in mwmechanics/hitreaction.cpp.
Flinch: a connecting melee hit queues a flinch of (0.2 + 0.5 * min(1, damage / (0.25 * max health))) * (0.5 + 0.5 * strength) seconds, so 0.1 to 0.7 s. It starts when the Lua stagger sets hit recovery, which means ignoreStagger (and god mode, which skips stagger) prevent it.
Block: a shield block or parry makes the blocker recoil for 0.1 to 0.25 s by attack strength. A blocked blow at 0.75 strength or more staggers the attacker for 0.25 to 0.6 s.
During any reaction (CreatureStats::mReactionTime, not saved), the controller interrupts an attack wind-up and starts no new attack. The existing hit and block animations still play where the content has them. On the Game Template, which has none usable, only the timer applies.
Shield block and parry resolution moved into one resolveMeleeBlock, shared by Npc::hit and Creature::hit.
Docs: [Game] hit reactions in settings/game.rst, and the reaction lines in docs/ashlar/SCENARIOS.md.
Tests
Build OK. components-tests 1636 passed, openmw-tests 596 passed (7 new in testhitreaction.cpp, covering the timing).
SCENARIO=combat docker/ashlar-run.sh (#24): no errors. Player flinched 50 times and had 8 wind-ups interrupted. The duelist flinched 5 times. The duelist recoiled on 11 blocks and the player on 6. The duelist was staggered on 7 strong blocked blows (0.57 to 0.6 s). Both actors have 5000 health in the scenario, so flinches stay near their minimum (0.11 to 0.20 s).
Default boot: clean screenshot, no errors.
Not verified
ignoreStagger holds by design (the flinch only starts through hit recovery) but has no end-to-end test.
The durations are first guesses. How the flinch and stagger feel needs Eric's playtest. They're constants in hitreaction.hpp and easy to tune or turn into settings.
Done in `2c5f6e4e7d`.
**What changed**
- New `[Game] hit reactions` setting, on by default, used with real time combat. The rules are in `mwmechanics/hitreaction.cpp`.
- **Flinch:** a connecting melee hit queues a flinch of `(0.2 + 0.5 * min(1, damage / (0.25 * max health))) * (0.5 + 0.5 * strength)` seconds, so 0.1 to 0.7 s. It starts when the Lua stagger sets hit recovery, which means `ignoreStagger` (and god mode, which skips stagger) prevent it.
- **Block:** a shield block or parry makes the blocker recoil for 0.1 to 0.25 s by attack strength. A blocked blow at 0.75 strength or more staggers the attacker for 0.25 to 0.6 s.
- During any reaction (`CreatureStats::mReactionTime`, not saved), the controller interrupts an attack wind-up and starts no new attack. The existing hit and block animations still play where the content has them. On the Game Template, which has none usable, only the timer applies.
- Shield block and parry resolution moved into one `resolveMeleeBlock`, shared by `Npc::hit` and `Creature::hit`.
- Docs: `[Game] hit reactions` in `settings/game.rst`, and the reaction lines in `docs/ashlar/SCENARIOS.md`.
**Tests**
- Build OK. components-tests 1636 passed, openmw-tests 596 passed (7 new in `testhitreaction.cpp`, covering the timing).
- `SCENARIO=combat docker/ashlar-run.sh` (#24): no errors. Player flinched 50 times and had 8 wind-ups interrupted. The duelist flinched 5 times. The duelist recoiled on 11 blocks and the player on 6. The duelist was staggered on 7 strong blocked blows (0.57 to 0.6 s). Both actors have 5000 health in the scenario, so flinches stay near their minimum (0.11 to 0.20 s).
- Default boot: clean screenshot, no errors.
**Not verified**
- `ignoreStagger` holds by design (the flinch only starts through hit recovery) but has no end-to-end test.
- The durations are first guesses. How the flinch and stagger feel needs Eric's playtest. They're constants in `hitreaction.hpp` and easy to tune or turn into settings.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Part of #5.
Acceptance
ignoreStaggerin AttackInfo is respected.Done in
2c5f6e4e7d.What changed
[Game] hit reactionssetting, on by default, used with real time combat. The rules are inmwmechanics/hitreaction.cpp.(0.2 + 0.5 * min(1, damage / (0.25 * max health))) * (0.5 + 0.5 * strength)seconds, so 0.1 to 0.7 s. It starts when the Lua stagger sets hit recovery, which meansignoreStagger(and god mode, which skips stagger) prevent it.CreatureStats::mReactionTime, not saved), the controller interrupts an attack wind-up and starts no new attack. The existing hit and block animations still play where the content has them. On the Game Template, which has none usable, only the timer applies.resolveMeleeBlock, shared byNpc::hitandCreature::hit.[Game] hit reactionsinsettings/game.rst, and the reaction lines indocs/ashlar/SCENARIOS.md.Tests
testhitreaction.cpp, covering the timing).SCENARIO=combat docker/ashlar-run.sh(#24): no errors. Player flinched 50 times and had 8 wind-ups interrupted. The duelist flinched 5 times. The duelist recoiled on 11 blocks and the player on 6. The duelist was staggered on 7 strong blocked blows (0.57 to 0.6 s). Both actors have 5000 health in the scenario, so flinches stay near their minimum (0.11 to 0.20 s).Not verified
ignoreStaggerholds by design (the flinch only starts through hit recovery) but has no end-to-end test.hitreaction.hppand easy to tune or turn into settings.