Hello,
For my game I'm trying to implement zombie turns.
When a player turns into a zombie, the game just changes active player, goes to the end of turn state and then starts a new turn like normal. Zombie is deactivated for multiplayer states, otherwise he is never in an active state so never needed.
I get stuck with error zombie infinite loops, instead of the new real player getting a new turn.
The active player after state 19 is not the zombie player anymore.
Why does this happen ? I don't want the game to use the transition zombiePass when it's NOT the turn of the zombie, otherwise other people wouldn't be able to play at all.
For my game I'm trying to implement zombie turns.
When a player turns into a zombie, the game just changes active player, goes to the end of turn state and then starts a new turn like normal. Zombie is deactivated for multiplayer states, otherwise he is never in an active state so never needed.
I get stuck with error zombie infinite loops, instead of the new real player getting a new turn.
Code: Select all
2 => array(
"name" => "playerChooseNumber",
"description" => clienttranslate('${actplayer} must choose a number'),
"descriptionmyturn" => clienttranslate('${you} must choose a number'),
"type" => "activeplayer",
"possibleactions" => array("chooseNumber", "zombiePass"),
"transitions" => array("chooseNumber" => 20, "zombiePass" => 19)
),
19 => array(
"name" => "zombieChangePlayer",
"description" => clienttranslate('Changing player'),
"type" => "game",
"possibleactions" => array(""),
"transitions" => array("" => 2),
'action' => 'st_zombieChangePlayer',
),
Why does this happen ? I don't want the game to use the transition zombiePass when it's NOT the turn of the zombie, otherwise other people wouldn't be able to play at all.
Code: Select all
function zombieTurn( $state, $active_player )
{
$statename = $state['name'];
if ($state['type'] === "activeplayer") {
switch ($statename) {
default:
if($active_player == self::getActivePlayerId()) {
$this->gamestate->nextState("zombiePass");
}
break;
}
return;
}
if ($state['type'] === "multipleactiveplayer") {
// Always skipping for
// Choosing hand/confirming he saw the card.
$this->gamestate->setPlayerNonMultiactive( $active_player, '' );
return;
}
throw new feException( "Zombie mode not supported at this game state: ".$statename );
}