Skip to content

Commit

Permalink
team vote failed, next team allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
wooki committed Dec 14, 2012
1 parent b1e0f86 commit 1edb6d1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
3 changes: 2 additions & 1 deletion application/controllers/games.php
Expand Up @@ -111,7 +111,8 @@ public function start($slug=false) {
'title' => $game->name.' Role Assignment - Covert Mission - Group game with a star wars theme',
'description' => 'Covert Mission is a group game with a star wars theme based around player deception and deduction of player motives, in the same genre as werewolf and mafia.',
'game' => $game,
'player' => $player
'player' => $player,
'spies' => Game::get_spies($game)
);

$this->load->view('shared/_header.php', $this->view_data);
Expand Down
11 changes: 11 additions & 0 deletions application/models/game.php
Expand Up @@ -178,6 +178,17 @@ static function get_team($game) {
return $team;
}

// get spies
static function get_spies($game) {
$spies = array();
foreach ($game->players as $player) {
if ($player->role === "Rebel Spy") {
$spies[] = $player;
}
}
return $spies;
}

// get leader
static function get_leader($game) {
foreach ($game->players as $player) {
Expand Down
12 changes: 11 additions & 1 deletion application/views/games/role_assign.php
Expand Up @@ -12,7 +12,17 @@
<p data-game-state="starting" class="alert alert-info game_state">Starting game</p>

<p>You are playing as a<?php if ($player->role == "Imperial Officer") { echo 'n'; } ?>
<strong><?= player_role($player->role) ?></strong>. You
<strong><?= player_role($player->role) ?></strong></p>

<?php if ($player->role == "Rebel Spy") { ?>
<p>Other Rebel Spies: <?php foreach ($spies as $spy) { ?>
<?php if ($spy->slug != $player->slug) { echo $spy->name; } ?>
<?php } ?></p>
<?php } else { ?>
<p>Note: Rebel Spies will know who each other are!</p>
<?php } ?>

<p>You
must complete 3 our of the 5 missions that you will be set to win the game.</p>

<p>A team leader will be assigned for each mission and they then select the operatives to
Expand Down
6 changes: 6 additions & 0 deletions application/views/missions/vote.php
Expand Up @@ -23,6 +23,12 @@

<p>Acknowledge vote result: <span class="label label-info"><?= $vote_result ?></span></p>

<p>The following players voted against the team selection:</p>
<?php foreach ($player as $p) { ?>
<?php if ($p->vote == "Reject") { ?><?= player_label($p->name) ?>
<?php } ?>
<?php } ?>

<?php if ($player->state == "mission-vote") { ?>
<button type="submit" class="btn btn-primary btn-large">Acknowledge</button>
<?php } else { ?>
Expand Down

0 comments on commit 1edb6d1

Please sign in to comment.