Пример #1
0
function next_player($player)
{
    $players = array_of_ids(select_players());
    foreach ($players as $i => $p) {
        if ($p == $player) {
            $index = $i;
        }
    }
    set_if_exists($next_player, $players[$index + 1]);
    set_if_not_set($next_player, $players[0]);
    return $next_player;
}
Пример #2
0
                    break;
            }
        }
        if (get_status($_POST["room"], $_POST["witness"]) == not_owned && get_status($_POST["weapon"], $_POST["witness"]) == not_owned) {
            add_card_owner_status($_POST["suspect"], $_POST["witness"], owned);
        } elseif (get_status($_POST["weapon"], $_POST["witness"]) == not_owned && get_status($_POST["suspect"], $_POST["witness"]) == not_owned) {
            add_card_owner_status($_POST["room"], $_POST["witness"], owned);
        } elseif (get_status($_POST["room"], $_POST["witness"]) == not_owned && get_status($_POST["suspect"], $_POST["witness"]) == not_owned) {
            add_card_owner_status($_POST["weapon"], $_POST["witness"], owned);
        }
        increment_turn();
        redirect_to_action("show");
        break;
    case "skip":
        increment_turn();
        redirect_to_action("show");
        break;
    case "show":
        break;
    case "daybook":
        break;
    case "revert":
        $turn = max(array_of_ids(select_turns()));
        delete_turn($turn);
        delete_owned_of_turn($turn);
        redirect_to_action("show");
        break;
    default:
        header_if(true, 403);
        exit;
}
Пример #3
0
function select_unknown_owners($card)
{
    $known_players = array_of_ids(select_with_request_string("player AS id", "owned", array("game", "player", "card", "status"), array(), array("game" => game, "card" => $card)));
    return array_diff(array_of_ids(select_suspects()), $known_players);
}