shadowcrest/server logic notes.md

1.4 KiB

validation for placing cards:

  • is the game still running
  • is it the players turn
  • does the card exist
  • does the player have that card in his deck
  • does the player have this card in his hand
  • is the type of card allowed in that type of field
  • is the field already blocked by another card

validation for attacking another player

  • is the game still running
  • is it the players turn
  • does the card exist
  • does the player have that card in his deck
  • is that card played
  • does the enemy have remaining monster cards on his side
    • if yes a direct attack would only be possible if a effect allows it
  • can this card attack
    • is the card of correct type
    • is it blocked by effects (will be implemented after card effects are implemented)

player death management (win condition)

  • does a players hp go to 0?
    • make the other player the winner
    • if an effect affects the playing player card priority comes first

handle a player leaving

  • check if game still runs
    • make remaining player win if yes

turn management

  • server keeps track of each turn
    • whos turn is it
    • what turn state is currently active
      • draw state
      • place state
    • is the player trying to do actions not allowed in the given state

drawing cards:

  • ensure the player only can have 7 cards
    • if limit exceeds the player payes lifepoints and drops a card
  • ensure the drawn card for sure still can be in the players deck