Beispiel #1
0
var voteCompleted = function(data) {
	var directive, cards = null;
	var voteDivs = $('.player-slot .vote');
	data.supporters.forEach(function(support, index) {
		voteDivs.eq(index).show().text(support ? 'Ja!' : 'Nein!');
	});

	if (data.hitler) {
		endGame(false, 'hitler');
	} else if (data.elected) {
		State.presidentElect = State.getPresident().uid;
		State.chancellorElect = State.getChancellor().uid;

		State.chatDisabled = true;
		Policies.draw(3);

		if (State.isLocalPresident()) {
			Policies.updateChoices(data.secret.policies);
			cards = 'policy';
			directive = 'Choose a policy to <strong>discard</strong>';
		} else {
			directive = 'President ' + Util.nameSpan(State.getPresident()) + ' to discard a policy';
		}
		Chat.setDirective(directive);
	} else {
		failedGovernment(data.forced, 'Election does not pass');
	}
	Cards.show(cards);
};
Beispiel #2
0
var policyDiscarded = function(data) {
	var directive, cards;
	if (State.isLocalChancellor()) {
		updatePolicyChoices(data.secret.policies);
		directive = 'Select a policy to <strong>enact</strong>';
		if (State.canVeto) {
			directive += ', or request a <strong>veto</strong>';
		}
		cards = 'policy';
	} else {
		var chancellor = State.getChancellor();
		directive = 'Chancellor ' + Util.nameSpan(chancellor) + ' to enact a policy';
		cards = null;
	}
	Chat.setDirective(directive);
	Cards.show(cards);
	discardPolicyCards(1);
};
Beispiel #3
0
var vetoRequest = function(data) {
	var directive, cards;
	var chancellor = State.getChancellor();
	if (State.isLocalPresident()) {
		directive = 'Confirm or override Chancellor ' + Util.nameSpan(chancellor) + '\'s veto request';
		cards = 'veto';
	} else {
		if (State.isLocalChancellor()) {
			var president = State.getPresident();
			directive = 'Awaiting confirmation from President ' + Util.nameSpan(president.name);
		} else {
			directive = 'Chancellor ' + Util.nameSpan(chancellor.name) + ' is requesting a veto, awaiting confirmation';
		}
		cards = null;
	}
	Chat.setDirective(directive);
	Cards.show(cards);
};
Beispiel #4
0
var policyEnacted = function(data) {
	var Game = require('game/game');

	discardPolicyCards(1);

	Cards.show(null);
	Game.resetElectionTracker();

	var policyType = data.policy;
	Chat.addAction('President ' + Util.nameSpan(State.getPresident()) + ' and Chancellor ' + Util.nameSpan(State.getChancellor()) + ' enacted <strong class="player-name '+policyType+' danger">' + policyType + '</strong> policy');

	var fascistPower = enactPolicy(policyType);
	if (State.finished) {
		return;
	}
	checkRemainingPolicies();

	if (fascistPower) {
		State.presidentPower = fascistPower;
		if (fascistPower.indexOf('peek') > -1) {
			previewPolicies(data.secret);
		} else {
			var directive;
			if (fascistPower.indexOf('investigate') > -1) {
				if (State.isLocalPresident()) {
					directive = 'Choose a player to investigate their party';
				} else {
					directive = 'President ' + Util.nameSpan(State.getPresident()) + ' to investigate a player';
				}
			} else if (fascistPower.indexOf('election') > -1) {
				if (State.isLocalPresident()) {
					directive = 'Select a special election presidential candidate';
				} else {
					directive = 'President ' + Util.nameSpan(State.getPresident()) + ' to select the special election candidate';
				}
			} else if (fascistPower.indexOf('bullet') > -1) {
				if (State.isLocalPresident()) {
					directive = 'Choose a player to kill';
				} else {
					directive = 'President ' + Util.nameSpan(State.getPresident()) + ' to kill a player';
				}
			}
			Chat.setDirective(directive);
			App.enablePlayerSelection(fascistPower);
		}
	} else {
		Game.advanceTurn();
	}
};