cuttle icon indicating copy to clipboard operation
cuttle copied to clipboard

[DevEx]: Refactor Card Selection

Open itsalaidbacklife opened this issue 3 years ago • 1 comments

Feature Summary

Card selection should be refactored to remove the use of indices

Detailed Description

Currently card selection is a combination of an index variable, computed properties, and data about whether you're interacting with the deck or your hand.

In order to prep for #87 , we should refactor selection to make it more generalizable. A cleaner approach would likely be to have two pieces of data:

  1. selectedCard: the actual card object being selected
  2. selectedArea: the place the card was selected from. This could be an enum to specify the valid sources e.g. SelectedArea.PLAYER_HAND or SelectedArea.OPPONENT_POINTS

These could then be used in various computed properties as necessary to determine whether moves are playable with the selected card, or to simply display move choices for cards that the player cannot themselves play (because they are already in play, or in the opponent hand, for example)

itsalaidbacklife avatar Sep 23 '22 19:09 itsalaidbacklife

Hi, I apply fro issue #621 but I can take this one either. I would like to help and start contributing with cuttle

fuveluck avatar Oct 11 '23 09:10 fuveluck