I am working on a project that is a video game version of an existing tabletop game, King of Tokyo. In the game, players can buy cards that have special benefits immediately and then are discarded, or have special conditions that need to be meet to be activated and are kept for the duration of the game.
Right now, I am having trouble finding a design pattern that works for this. The two solutions I have come up with involve each card being a child of a Card class, and then each player either checks each card they have each step of their turn, or each player contains toggles for each card effect and then there are a bunch of if/else statements in each step of their turn.
Neither of these are very good. Expanding the game to have new cards would entail a lot of changes to both the cards and the player since they are tightly coupled.
Some of the problematic cards go something like this:
- You can always re-roll any [3] you have.
- You can purchase cards from other monsters. Pay them the [Energy] cost.
- You can re-roll a die of each other monster once each turn. If the re-roll is [Heart] discard this card.
- Choose a card any monster has in play and put a mimic counter on it. This card counts as a duplicate of that card as if it just had been bought. Spend 1[Energy] at the start of your turn to change the power you are mimicking.
A full list can be found here
How can I have cards like this with very different conditions/effects without tight coupling and/or manually coding each card? (If it helps I am using C#)
Aucun commentaire:
Enregistrer un commentaire