Dominic Kexel avatar Dominic Kexel committed e90dbd0

more functions to GameInterface

Comments (0)

Files changed (1)

game/gameinterface.py

         :type to_deck: bool
         :param message: message to display instead of '<playername> took <cardname>'
         :param message: str
+        :returns: the top card from the pile
+        :rtype: Card
         """
-        pass
 
     @abc.abstractmethod
     def whisper(self, message, player=None):
         :param player: the player that should receive the message instead of the active player
         :type player: Player
         """
-        pass
 
     @abc.abstractmethod
     def yell(self, message):
         :param message: the message the players should receive
         :type message: str
         """
-        pass
 
     @abc.abstractmethod
     def update_player(self, player=None):
         :param player: The player which should receive the update instead of all players
         :type player: Player
         """
-        pass
 
     @abc.abstractmethod
     def trash_card(self, player, card, silent=False):
         :param silent: If True, the trashing is not announced
         :type silent: bool
         """
-        pass
 
     @abc.abstractmethod
     def take_card(self, player, card, message=None, to_hand=False, to_deck=False):
         :type to_hand: bool
         :param to_deck: the card should go on top of the deck instead of discard pile
         :type to_deck: bool
+        :returns: the card
+        :rtype: Card
         """
-        pass
 
     @abc.abstractmethod
     def reveal_top_card(self, player=None):
         :param player: the player that should reveal his top card instead of the active player
         :type player: Player
         """
-        pass
 
     @abc.abstractmethod
     def reveal_player_hand(self, player=None):
         :param player: the player that should reveal his hand instead of the active player
         :type player: Player
         """
-        pass
 
     @abc.abstractmethod
     def on_resolve(self, card, f):
         :type card: Card
         :param f: the callback function that should be called when the card resolves
         :type f: function
-        """
+        """
+
+    @abc.abstractmethod
+    def resolved(self, card):
+        """Called by cards to tell the game they are resolved
+
+        :param card: the card that is resolved
+        :type card: Card
+        """
+
+    @abc.abstractmethod
+    def previous_player(self):
+        """Return the previous player before the actual one
+
+        :returns: the player before the active player
+        :rtype: Player"""
+
+    @abc.abstractmethod
+    def next_player(self, current=None):
+        """Return the next player after the actual or given one
+
+        :param current: the player of which the next player is returned
+        :type current: Player
+        :returns: the player after 'current'
+        :rtype: Player
+        """
+
+    @abc.abstractmethod
+    def play_card(self, player, card_id, free=False, is_duration=False, update=True):
+        """Let the player play a card
+
+        :param player: the player that plays the card
+        :type player: Player
+        :param card_id: the card of the card played
+        :type card_id: int
+        :param free: if True, playing this card don't cost an action
+        :type free: bool
+        :param is_duration: has to be set to True if the card is played during resolving a duration-action at the begin
+        of a turn
+        :type is_duration: bool
+        """
+
+    @abc.abstractmethod
+    def let_all_players_pick(self, card, text, handler=None, player_filter=None):
+        """Let all players pick a card from their hand
+
+        :param card: the card that triggers this action
+        :type card: Card
+        :param text: the message that all players get displayed
+        :type text: str
+        :param handler: the callback function that is invoked when each player chooses his card
+        :type handler: function
+        :param player_filter: a function that takes a player and decides if this player should pick a card
+        :type player_filter: function
+        """
+
+    @abc.abstractmethod
+    def let_order_cards(self, card, text, cards, callback):
+        """
+        Let the player order a bunch of cards
+
+        :param card: the card that triggers this action
+        :type card: Card
+        :param text: the message that will be displayed to the player
+        :type text: str
+        :param cards: the cards the player should order
+        :type cards: list
+        :param callback: the callback function that is invoked after the player ordered the cards
+        :type callback: function
+        """
+
+    @abc.abstractmethod
+    def let_pick_from_hand(self, card, text, callback=None):
+        """
+        Let the player pick some cards from his hand
+
+        :param card: the card that triggers this action
+        :type card: Card
+        :param text: the message that will be displayed to the player
+        :type text: str
+        :param callback: the callback function that is invoked after the player picked the cards
+        :type callback: function
+        """
+
+    @abc.abstractmethod
+    def let_pick_pile(self, card, text, callback=None):
+        """
+        Let the player pick a pile of cards from the board
+
+        :param card: the card that triggers this action
+        :type card: Card
+        :param text: the message that will be displayed to the player
+        :type text: str
+        :param callback: the callback function that is invoked after the player picked a pile
+        :type callback: function
+        """
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.