fa icon indicating copy to clipboard operation
fa copied to clipboard

Refactor draw functionality

Open Garanas opened this issue 3 months ago • 0 comments

Description of the proposed changes

The current code has a flaw and a bug in it:

  • Flaw: the vote does not expire. If you offer it at the start of the game and forget about it then your opponent can 'randomly' draw the game later.
  • Bug: it relies on a user input to determine what army we make the draw offer for. It uses OkayToMessWithArmy to validate the army. This does not work in union mode. In union mode you can technically forfeit for other, allied armies.

We try to fix both issues with these changes. I took the route to refactor it into a separate component. The implementation is quite simple. It's not a huge refactor.

Testing done on the proposed changes

Start a game of 4 players with 2 teams and validate whether the game draws.

Additional context

A few things that we may want to add:

  • [ ] A message when the draw offer expired.
  • [ ] The 'Draw' button needs to uncheck when the draw offer expires.

Checklist

Garanas avatar Sep 18 '25 07:09 Garanas