With real-time combat on, the fatigue cost of an attack is paid when the swing is released, and it scales with wind-up strength and weapon weight. Today's GMSTs (fFatigueAttackBase, fFatigueAttackMult, fWeaponFatigueMult) set the base values.
An attack can't start below a configurable fatigue threshold. The player gets clear feedback, and the attack never silently fails.
Low fatigue caps the maximum attack strength instead of only lowering hit chance.
Applies to the player, NPCs and creatures. The AI doesn't spam attacks at zero fatigue.
Unit tests cover cost, threshold and cap. Settings are documented.
Part of #5.
**Acceptance**
- With real-time combat on, the fatigue cost of an attack is paid when the swing is released, and it scales with wind-up strength and weapon weight. Today's GMSTs (`fFatigueAttackBase`, `fFatigueAttackMult`, `fWeaponFatigueMult`) set the base values.
- An attack can't start below a configurable fatigue threshold. The player gets clear feedback, and the attack never silently fails.
- Low fatigue caps the maximum attack strength instead of only lowering hit chance.
- Applies to the player, NPCs and creatures. The AI doesn't spam attacks at zero fatigue.
- Unit tests cover cost, threshold and cap. Settings are documented.
claude
added this to the 2. Feel milestone 2026-11-12 18:31:41 +00:00
What changed (only with [Game] real time combat on; classic behavior is unchanged with it off)
Cost on release.CharacterController::prepareHit pays the cost when the swing is released, for melee, ranged and thrown attacks. applyFatigueLoss no longer charges at the hit, so an interrupted swing or a miss still costs fatigue. The cost is (fFatigueAttackBase + fFatigueAttackMult * encumbrance) * (0.5 + 0.5 * strength) + weight * strength * fWeaponFatigueMult. A full wind-up costs the same as a classic full-strength attack, and a quick tap costs half the base cost.
Threshold. New [Game] attack fatigue threshold (default 0.1 of max fatigue). Weapon attacks can't start below it, or at zero fatigue or less. The player gets "You are too tired to attack." once per press. AiCombatStorage::startAttackIfReady won't wind up a weapon attack while the actor is too tired, so the AI waits for fatigue to recover instead of spamming attacks. Spells and lockpicks aren't affected, and god mode skips all of this.
Strength cap. New [Game] attack fatigue cap (default 0.5). Below that share of max fatigue, the strongest possible attack falls linearly to a quarter of full strength at zero fatigue. 0 disables the cap. Applies to the player, NPCs and creatures, including creatures' random-strength attacks.
The rules are in mwmechanics/stamina.{hpp,cpp}, and both settings are documented in settings/game.rst and settings-default.cfg.
Tests
Build OK. components-tests: 1636 passed. openmw-tests: 589 passed, 11 of them new in teststamina.cpp (cost, threshold and cap).
The headless Game Template boot is clean.
No attack was exercised end to end headlessly, because the template has no hostile melee actor (#24).
Still to check
The "too tired" message is hard-coded English. There's no GMST for it, so localization can come later with the Lua UI work.
How it feels, including the default threshold and cap values, needs Eric's playtest.
Done in `28d5d076a0` (ashlar-build scheduled run).
**What changed** (only with `[Game] real time combat` on; classic behavior is unchanged with it off)
- **Cost on release.** `CharacterController::prepareHit` pays the cost when the swing is released, for melee, ranged and thrown attacks. `applyFatigueLoss` no longer charges at the hit, so an interrupted swing or a miss still costs fatigue. The cost is `(fFatigueAttackBase + fFatigueAttackMult * encumbrance) * (0.5 + 0.5 * strength) + weight * strength * fWeaponFatigueMult`. A full wind-up costs the same as a classic full-strength attack, and a quick tap costs half the base cost.
- **Threshold.** New `[Game] attack fatigue threshold` (default 0.1 of max fatigue). Weapon attacks can't start below it, or at zero fatigue or less. The player gets "You are too tired to attack." once per press. `AiCombatStorage::startAttackIfReady` won't wind up a weapon attack while the actor is too tired, so the AI waits for fatigue to recover instead of spamming attacks. Spells and lockpicks aren't affected, and god mode skips all of this.
- **Strength cap.** New `[Game] attack fatigue cap` (default 0.5). Below that share of max fatigue, the strongest possible attack falls linearly to a quarter of full strength at zero fatigue. 0 disables the cap. Applies to the player, NPCs and creatures, including creatures' random-strength attacks.
- The rules are in `mwmechanics/stamina.{hpp,cpp}`, and both settings are documented in `settings/game.rst` and `settings-default.cfg`.
**Tests**
- Build OK. components-tests: 1636 passed. openmw-tests: 589 passed, 11 of them new in `teststamina.cpp` (cost, threshold and cap).
- The headless Game Template boot is clean.
- No attack was exercised end to end headlessly, because the template has no hostile melee actor (#24).
**Still to check**
- The "too tired" message is hard-coded English. There's no GMST for it, so localization can come later with the Lua UI work.
- How it feels, including the default threshold and cap values, needs Eric's playtest.
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
fFatigueAttackBase,fFatigueAttackMult,fWeaponFatigueMult) set the base values.Done in
28d5d076a0(ashlar-build scheduled run).What changed (only with
[Game] real time combaton; classic behavior is unchanged with it off)CharacterController::prepareHitpays the cost when the swing is released, for melee, ranged and thrown attacks.applyFatigueLossno longer charges at the hit, so an interrupted swing or a miss still costs fatigue. The cost is(fFatigueAttackBase + fFatigueAttackMult * encumbrance) * (0.5 + 0.5 * strength) + weight * strength * fWeaponFatigueMult. A full wind-up costs the same as a classic full-strength attack, and a quick tap costs half the base cost.[Game] attack fatigue threshold(default 0.1 of max fatigue). Weapon attacks can't start below it, or at zero fatigue or less. The player gets "You are too tired to attack." once per press.AiCombatStorage::startAttackIfReadywon't wind up a weapon attack while the actor is too tired, so the AI waits for fatigue to recover instead of spamming attacks. Spells and lockpicks aren't affected, and god mode skips all of this.[Game] attack fatigue cap(default 0.5). Below that share of max fatigue, the strongest possible attack falls linearly to a quarter of full strength at zero fatigue. 0 disables the cap. Applies to the player, NPCs and creatures, including creatures' random-strength attacks.mwmechanics/stamina.{hpp,cpp}, and both settings are documented insettings/game.rstandsettings-default.cfg.Tests
teststamina.cpp(cost, threshold and cap).Still to check