summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js112
1 files changed, 54 insertions, 58 deletions
diff --git a/rules.js b/rules.js
index 40cde75..9cbda76 100644
--- a/rules.js
+++ b/rules.js
@@ -10,24 +10,24 @@ const states = {};
let game = {};
var view = {};
const role_ids = [data_1.ANARCHISTS_ID, data_1.COMMUNISTS_ID, data_1.MODERATES_ID];
-const faction_player_map = {
- a: data_1.ANARCHIST,
- c: data_1.COMMUNIST,
- m: data_1.MODERATE,
-};
+const faction_player_map = [
+ data_1.ANARCHIST,
+ data_1.COMMUNIST,
+ data_1.MODERATE,
+];
const player_faction_map = {
[data_1.ANARCHIST]: data_1.ANARCHISTS_ID,
[data_1.COMMUNIST]: data_1.COMMUNISTS_ID,
[data_1.MODERATE]: data_1.MODERATES_ID,
};
-const front_names = {
- a: 'Aragon Front',
- m: 'Madrid Front',
- n: 'Northern Front',
- s: 'Southern Front',
- d: 'the Front closest to Defeat',
- v: 'the Front closest to Victory',
-};
+const front_names = [
+ 'Aragon Front',
+ 'Madrid Front',
+ 'Northern Front',
+ 'Southern Front',
+ 'the Front closest to Defeat',
+ 'the Front closest to Victory',
+];
const bonus_names = ['Morale Bonus', 'Teamwork Bonus'];
const { cards, medallions, tracks, } = data_1.default;
const bonuses = [data_1.MORALE_BONUS, data_1.TEAMWORK_BONUS];
@@ -402,12 +402,12 @@ function setup(seed, _scenario, options) {
bag_of_glory: [data_1.ANARCHISTS_ID, data_1.COMMUNISTS_ID, data_1.MODERATES_ID],
bonuses: [data_1.ON, data_1.ON],
current_events: [],
- discard: {
- a: [],
- c: [],
- m: [],
- f: [],
- },
+ discard: [
+ [],
+ [],
+ [],
+ [],
+ ],
engine: [],
faction_turn: null,
fronts: [
@@ -434,42 +434,38 @@ function setup(seed, _scenario, options) {
],
glory: [],
first_player: null,
- hands: {
- a: [],
- c: [],
- m: [],
- },
+ hands: [
+ [],
+ [],
+ [],
+ ],
hero_points: {
- a: 2,
- c: 2,
- m: 0,
- pool: 14,
+ factions: [2, 2, 0],
+ pool: 14
},
initiative: data_1.MODERATES_ID,
medallions: {
- a: [],
- c: [],
- m: [],
+ factions: [[], [], []],
pool: [],
},
played_card: null,
player_order: [data_1.MODERATE],
- selected_cards: {
- a: [],
- c: [],
- m: [],
- },
- tableaus: {
- a: [],
- c: [],
- m: [],
- },
+ selected_cards: [
+ [],
+ [],
+ [],
+ ],
+ tableaus: [
+ [],
+ [],
+ [],
+ ],
tracks: [5, 5, 6, 3, 3],
- trash: {
- a: [],
- c: [],
- m: [],
- },
+ trash: [
+ [],
+ [],
+ [],
+ ],
triggered_track_effects: [],
log: [],
undo: [],
@@ -1178,11 +1174,11 @@ states.draw_glory = {
const index = random(game.bag_of_glory.length);
const faction = game.bag_of_glory[index];
game.glory.push(faction);
- game.glory_current_year = game.glory_current_year = {
- a: false,
- c: false,
- m: false,
- };
+ game.glory_current_year = game.glory_current_year = [
+ false,
+ false,
+ false,
+ ];
game.glory_current_year[faction] = true;
array_remove(game.bag_of_glory, index);
logi(`Pulled T${faction} from the Bag`);
@@ -1495,7 +1491,7 @@ states.peek_fascist_cards = {
game.top_of_events_deck = c;
for (const ec of game.fascist_cards) {
if (ec !== c) {
- game.discard.f.push(ec);
+ game.discard[data_1.FASCIST_ID].push(ec);
}
}
delete game.fascist_cards;
@@ -2204,11 +2200,11 @@ function end_of_year() {
}
}
const glory_to_draw = [0, 1, 2, 5];
- game.glory_current_year = {
- a: false,
- c: false,
- m: false,
- };
+ game.glory_current_year = [
+ false,
+ false,
+ false,
+ ];
const player_order = get_player_order();
const engine = [];
for (let i = 0; i < glory_to_draw[game.year]; ++i) {
@@ -2744,7 +2740,7 @@ function get_fronts_closest_to(target) {
if (values.length === 0) {
return [];
}
- const targetValue = target === 'd' ? Math.min(...values) : Math.max(...values);
+ const targetValue = target === data_1.CLOSEST_TO_DEFEAT ? Math.min(...values) : Math.max(...values);
return game.fronts.findIndex((front) => front.value === targetValue);
}
function log_br() {