tstates.inc.php - hadarawgs - Hadara adaptation for boardgamearena.com
 (HTM) git clone git://git.z3bra.org/hadarawgs.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
       tstates.inc.php (4147B)
       ---
            1 <?php
            2 /**
            3  *------
            4  * BGA framework: © Gregory Isabelli <gisabelli@boardgamearena.com> & Emmanuel Colin <ecolin@boardgamearena.com>
            5  * hadarawgs implementation : © Willy Goiffon <dev@z3bra.org>
            6  *
            7  * This code has been produced on the BGA studio platform for use on http://boardgamearena.com.
            8  * See http://en.boardgamearena.com/#!doc/Studio for more information.
            9  * -----
           10  *
           11  * states.inc.php
           12  *
           13  * hadarawgs game states description
           14  *
           15  */
           16 
           17 /*
           18  * Game state machine is a tool used to facilitate game developpement by doing common stuff that can be set up
           19  * in a very easy way from this configuration file.
           20  *
           21  * Please check the BGA Studio presentation about game state to understand this, and associated documentation.
           22  *
           23  * Summary:
           24  *
           25  * States types:
           26  * _ activeplayer: in this type of state, we expect some action from the active player.
           27  * _ multipleactiveplayer: in this type of state, we expect some action from multiple players (the active players)
           28  * _ game: this is an intermediary state where we don't expect any actions
           29  *   from players. Your game logic must decide what is the next game state.
           30  * _ manager: special type for initial and final state
           31  *
           32  * Arguments of game states:
           33  * _ name: the name of the GameState, in order you can recognize it on your own code.
           34  * _ description: the description of the current game state is always displayed in the action status bar on
           35  *   the top of the game. Most of the time this is useless for game state with "game" type.
           36  * _ descriptionmyturn: the description of the current game state when it's your turn.
           37  * _ type: defines the type of game states (activeplayer / multipleactiveplayer / game / manager)
           38  * _ action: name of the method to call when this game state become the current game state. Usually, the
           39  *   action method is prefixed by "st" (ex: "stMyGameStateName").
           40  * _ possibleactions: array that specify possible player actions on this step. It allows you to use "checkAction"
           41  *   method on both client side (Javacript: this.checkAction) and server side (PHP: self::checkAction).
           42  * _ transitions: the transitions are the possible paths to go from a game state to another. You must name
           43  *   transitions in order to use transition names in "nextState" PHP method, and use IDs to
           44  *   specify the next game state for each transition.
           45  * _ args: name of the method to call to retrieve arguments for this gamestate. Arguments are sent to the
           46  *   client side to be used on "onEnteringState" or to set arguments in the gamestate description.
           47  * _ updateGameProgression: when specified, the game progression is updated (=> call to your getGameProgression method).
           48  */
           49 
           50 //    !! It is not a good idea to modify this file when a game is running !!
           51 
           52 
           53 $machinestates = array(
           54 
           55         // The initial state. Please do not modify.
           56         1 => array(
           57                 "name" => "gameSetup",
           58                 "description" => "",
           59                 "type" => "manager",
           60                 "action" => "stGameSetup",
           61                 "transitions" => array( "" => 2 )
           62         ),
           63 
           64         // Note: ID=2 => your first state
           65 
           66         2 => array(
           67                 "name" => "playerTurn",
           68                 "description" => clienttranslate('${actplayer} must play a card or pass'),
           69                 "descriptionmyturn" => clienttranslate('${you} must play a card or pass'),
           70                 "type" => "activeplayer",
           71                 "possibleactions" => array( "playCard", "pass" ),
           72                 "transitions" => array( "playCard" => 2, "pass" => 2 )
           73         ),
           74 
           75 /*
           76         Examples:
           77 
           78         2 => array(
           79                 "name" => "nextPlayer",
           80                 "description" => '',
           81                 "type" => "game",
           82                 "action" => "stNextPlayer",
           83                 "updateGameProgression" => true,
           84                 "transitions" => array( "endGame" => 99, "nextPlayer" => 10 )
           85         ),
           86 
           87         10 => array(
           88                 "name" => "playerTurn",
           89                 "description" => clienttranslate('${actplayer} must play a card or pass'),
           90                 "descriptionmyturn" => clienttranslate('${you} must play a card or pass'),
           91                 "type" => "activeplayer",
           92                 "possibleactions" => array( "playCard", "pass" ),
           93                 "transitions" => array( "playCard" => 2, "pass" => 2 )
           94         ),
           95 
           96 */
           97 
           98         // Final state.
           99         // Please do not modify (and do not overload action/args methods).
          100         99 => array(
          101                 "name" => "gameEnd",
          102                 "description" => clienttranslate("End of game"),
          103                 "type" => "manager",
          104                 "action" => "stGameEnd",
          105                 "args" => "argGameEnd"
          106         )
          107 
          108 );
          109 
          110 
          111