Based on Design of a turn-based game where actions have side-effects
I am building a card-game where cards can have side-effects be triggered under different circumstances.
I was given a good idea on how to handle different phases by having hooks (events) that different cards can be triggered to do something, like when a card is played, draw an additional card, etc.
I am not sure how I should compose all these things to work together, I have a GameState object which handles the state of the game (who's turn, player objects, timers) checking if a move is legal etc.
I am having a Card class that currently just has a type and a name getter/setters and properties. I believe the best way to store cards would be to use .JSON files, because that would let you simply write a new card.
To achieve side-effects I am thinking of having "components" that is configured through a cards JSON-file.
{
"name": "Ocean Humans",
"type": "Creature",
"components": {
}
}
However, I am not sure how I should compose these JSON-files to some actually working object. How do I call these components when I invoke a hook_event (draw a card, phase begin). And make sure right components are run?
No comments:
Post a Comment