csa.jportal.match.Match
Match is THE central class in JPortal. Here all the game actually takes place. Although the match class does not enforce all rules, card abilties are all left to the cards, cards can nearly do everything good and evil (otherwise the game wouldn´t be as open as it is), the game keeps track of players, turns and phases and (most importantly all cards that are in game, and where they are -possible: Library, Hand, Creature, Land, Graveyard, Discarded). And in general provides support for players to "look at the table" and "move things on the table". Like tapping, drawing cards and so on.
(Most those methods won´t be called from the actual player, but rather by the cards they play)
Concept:
- two players (hardcoded at the moment)
- each player provides a "display", the display is thus player related and views all things in the match from the view of the player it belongs to
- (computer players don´t really need a display, so far only a "Hot Seat" display for a human player is implemented (another display possibility might be: a display for a human player over internet for example doesn´t need to display any information on "THIS" computer, it will only pass information over ip, in both directions)
- methods invoked by a player, asking questions about the match must allways pass the reference of that player to the method, so the match knows who is asking
- this provides match with a mechanism to decide which information to share and which not to share
- for example:
calling of the method: CardList getHandOpponent(MatchPlayable p)
It would be quite a bad idea to provide the player with THAT information. The players can not be allowed to cheat by looking in the opponents hand. On the other side SOME information can be provided, for example how many cards are left on the opponents hand.
For above example its quite easy, it is implemented as:
return hide(mHand[otherPlayerNumber(mPlayerToInt.get(p))]);
@author Malban