woollyblanket / card-battler-backend

API for a turn based, deck building, battle game
MIT License
0 stars 0 forks source link

Create the game logic #12

Open woollyblanket opened 1 year ago

woollyblanket commented 1 year ago

Create a new endpoint, probably something like /games/:id/start. This will start the game flow. The flow will look something like this:

  1. Spawn enemies. Probably between 1 and 3 enemies can spawn. There is some logic here to increase the stats of the enemies based on the level. As the player progresses through the levels, the enemies get harder
  2. Initiate player's turn
  3. Player plays cards that are in their deck to try and defeat the enemies. Will need a new endpoint for this action, probably something like /cards/:id/play. There should be some validation here to make sure that the player can only play a card that's in their deck
  4. When a card is played it gets placed into the discard pile, or the burned pile, depending on the card. Discarded cards get returned to the deck after the round, burned cards get returned to the deck after the level
  5. After the player's turn, the enemies take their turn
  6. After the enemies turn, the round ends, and the next round begins. Continue from point 2 until either the player defeats all the enemies, or the player's character is defeated
  7. When the player wins, their character get rewards. This makes the character stronger and makes them more capable of defeating the more difficult enemies.

Rewards could be:

woollyblanket commented 1 year ago

I don't think I shouldn't use a new verb here. [POST] /games/:id/start should maybe be [POST] /games. That should create a new game. Creating a game should be analogous to starting a new game, I think... or maybe not, that mightn't be RESTful anymore... I need to think more about the proper endpoint to use