Skip to content

Commit

Permalink
Fix multiple bugs with evade command: it should spend one unit and no…
Browse files Browse the repository at this point in the history
…t mark unspent other units
  • Loading branch information
xpmatteo committed Nov 14, 2023
1 parent 83a9f01 commit f2b5500
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ image to appear. The parameters are:

# WIP

BUG combat with evasion does not "spend" the attacking unit

* use OpenLoop in MCTS: reimplement best commands
* implement MAP_CENTER and MAP_EAST

Expand Down
3 changes: 2 additions & 1 deletion src/model/commands/EvadeCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export class EvadeCommand extends Command {
} else {
game.moveUnit(this.toHex, this.fromHex);
}
game.endPhase();
game.shiftPhase();
game.markUnitSpent(attackingUnit);
return events;
}

Expand Down
4 changes: 4 additions & 0 deletions src/model/commands/EvadeCommand.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ describe('evade command', () => {
expect(game.unitStrength(evadingUnit)).toBe(3);
});

test('it spends the attacking unit', () => {
expect(game.isSpent(attackingUnit)).toBeTruthy();
});

});

test('It can kill the evading unit', () => {
Expand Down

0 comments on commit f2b5500

Please sign in to comment.