fix: melee attacks now apply enemy defenses (armor/barrier/dodge)
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m17s

Bug: Melee sword attacks passed null as the enemy to applyEnemyDefenses,
causing all enemy defenses (armor, barrier, dodge) to be bypassed.
Spell damage and DoT effects correctly went through defenses.

Fix: In combat-actions.ts melee loop, get the current target enemy
from currentRoom.enemies (lowest HP, matching focus-fire targeting)
and pass it to applyEnemyDefenses instead of null.

Added 7 regression tests in melee-defense-bypass.test.ts to verify:
- Melee damage is reduced by armor
- Melee damage is reduced by barrier
- Unarmored enemies take more damage than armored ones
- Full damage dealt when no defenses
- Focus-fire targeting (lowest HP enemy)
- Graceful handling of empty enemy list
- Comparison proving defense application

All 948 tests pass (49 test files).
This commit is contained in:
2026-06-06 17:33:31 +02:00
parent 4b7aa82953
commit 325949cc5f
5 changed files with 431 additions and 13 deletions
+1
View File
@@ -228,6 +228,7 @@ Mana-Loop/
│ │ │ │ ├── guardian-names.test.ts
│ │ │ │ ├── mana-utils.test.ts
│ │ │ │ ├── melee-auto-attack.test.ts
│ │ │ │ ├── melee-defense-bypass.test.ts
│ │ │ │ ├── pact-utils.test.ts
│ │ │ │ ├── persistence.test.ts
│ │ │ │ ├── regression-fixes.test.ts