summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data.js8
-rw-r--r--data.ts9
-rw-r--r--land-and-freedom.css259
-rw-r--r--land-and-freedom.scss100
-rw-r--r--play.html22
-rw-r--r--play.js44
-rw-r--r--play.ts59
-rw-r--r--rules.js73
-rw-r--r--rules.ts70
-rw-r--r--types.d.ts6
10 files changed, 590 insertions, 60 deletions
diff --git a/data.js b/data.js
index ea07639..3de51ab 100644
--- a/data.js
+++ b/data.js
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-exports.TRASH = exports.TOWARDS_CENTER = exports.SELF = exports.PLAYER_WITH_MOST_HERO_POINTS = exports.OTHER_PLAYERS = exports.ON = exports.OFF = exports.TEAMWORK_BONUS = exports.MORALE_BONUS = exports.FOREIGN_AID = exports.SOVIET_SUPPORT = exports.GOVERNMENT = exports.COLLECTIVIZATION = exports.CLOSEST_TO_VICTORY = exports.CLOSEST_TO_DEFEAT = exports.LIBERTY = exports.ANY = exports.MODERATES_ID = exports.COMMUNISTS_ID = exports.ANARCHISTS_ID = void 0;
+exports.TRASH = exports.TOWARDS_CENTER = exports.SELF = exports.PLAYER_WITH_MOST_HERO_POINTS = exports.OTHER_PLAYERS = exports.ON = exports.OFF = exports.TEAMWORK_BONUS = exports.MORALE_BONUS = exports.FOREIGN_AID = exports.SOVIET_SUPPORT = exports.GOVERNMENT = exports.COLLECTIVIZATION = exports.CLOSEST_TO_VICTORY = exports.CLOSEST_TO_DEFEAT = exports.LIBERTY = exports.ANY = exports.MODERATES_ID = exports.COMMUNISTS_ID = exports.ANARCHISTS_ID = exports.MODERATE = exports.COMMUNIST = exports.ANARCHIST = void 0;
const LIBERTY = 0;
exports.LIBERTY = LIBERTY;
const COLLECTIVIZATION = 1;
@@ -48,6 +48,12 @@ const COMMUNISTS_ID = 'c';
exports.COMMUNISTS_ID = COMMUNISTS_ID;
const MODERATES_ID = 'm';
exports.MODERATES_ID = MODERATES_ID;
+const ANARCHIST = 'Anarchist';
+exports.ANARCHIST = ANARCHIST;
+const COMMUNIST = 'Communist';
+exports.COMMUNIST = COMMUNIST;
+const MODERATE = 'Moderate';
+exports.MODERATE = MODERATE;
function create_effect(type, target, value) {
return {
type,
diff --git a/data.ts b/data.ts
index f635e53..1ab4a98 100644
--- a/data.ts
+++ b/data.ts
@@ -1,4 +1,4 @@
-import { Card, Effect, FactionId, StaticData } from './types';
+import { Card, Effect, FactionId, Player, StaticData } from './types';
const LIBERTY = 0;
const COLLECTIVIZATION = 1;
@@ -35,7 +35,14 @@ const ANARCHISTS_ID = 'a' as FactionId;
const COMMUNISTS_ID = 'c' as FactionId;
const MODERATES_ID = 'm' as FactionId;
+const ANARCHIST = 'Anarchist' as Player;
+const COMMUNIST = 'Communist' as Player;
+const MODERATE = 'Moderate' as Player;
+
export {
+ ANARCHIST,
+ COMMUNIST,
+ MODERATE,
ANARCHISTS_ID,
COMMUNISTS_ID,
MODERATES_ID,
diff --git a/land-and-freedom.css b/land-and-freedom.css
index 9452199..196eddb 100644
--- a/land-and-freedom.css
+++ b/land-and-freedom.css
@@ -1,5 +1,5 @@
main {
- background-color: #7B904B;
+ background-color: #7b904b;
}
/* MAP */
@@ -26,10 +26,45 @@ main {
background-image: url(images/map100.png);
}
}
+.game_info {
+ padding: 3px 4px;
+ border-bottom: 1px solid black;
+ font-size: 16px;
+ line-height: 1.5;
+ grid-column: 1;
+ grid-row: 1;
+ display: flex;
+ flex-direction: column;
+}
+
+#roles {
+ grid-column: 1;
+ grid-row: 2;
+}
+
+#role_Anarchist {
+ background-color: rgb(76, 70, 89);
+}
+
+#role_Communist {
+ background-color: rgb(255, 0, 0);
+}
+
+#role_Moderate {
+ background-color: rgb(126, 18, 80);
+}
+
+.role {
+ color: white;
+}
+.role a {
+ color: white;
+}
+
.panel {
min-width: 1271px;
max-width: 1271px;
- background-color: #58641D;
+ background-color: #58641d;
margin: 12px auto;
box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.2666666667);
border: 2px solid #333;
@@ -54,11 +89,19 @@ main {
}
#hand_header {
- background-color: #273B09;
+ background-color: #273b09;
}
.panel_header[data-faction-id=a] {
- background: linear-gradient(45deg, black 50%, red 0);
+ background-color: rgb(76, 70, 89);
+}
+
+.panel_header[data-faction-id=c] {
+ background-color: rgb(255, 0, 0);
+}
+
+.panel_header[data-faction-id=m] {
+ background-color: rgb(126, 18, 80);
}
.front {
@@ -341,6 +384,190 @@ main {
background-image: url("images/cards100/card_62.png");
}
+.card[data-card-id="63"] {
+ background-image: url("images/cards100/card_63.png");
+}
+
+.card[data-card-id="64"] {
+ background-image: url("images/cards100/card_64.png");
+}
+
+.card[data-card-id="65"] {
+ background-image: url("images/cards100/card_65.png");
+}
+
+.card[data-card-id="66"] {
+ background-image: url("images/cards100/card_66.png");
+}
+
+.card[data-card-id="67"] {
+ background-image: url("images/cards100/card_67.png");
+}
+
+.card[data-card-id="68"] {
+ background-image: url("images/cards100/card_68.png");
+}
+
+.card[data-card-id="69"] {
+ background-image: url("images/cards100/card_69.png");
+}
+
+.card[data-card-id="70"] {
+ background-image: url("images/cards100/card_70.png");
+}
+
+.card[data-card-id="71"] {
+ background-image: url("images/cards100/card_71.png");
+}
+
+.card[data-card-id="72"] {
+ background-image: url("images/cards100/card_72.png");
+}
+
+.card[data-card-id="73"] {
+ background-image: url("images/cards100/card_73.png");
+}
+
+.card[data-card-id="74"] {
+ background-image: url("images/cards100/card_74.png");
+}
+
+.card[data-card-id="75"] {
+ background-image: url("images/cards100/card_75.png");
+}
+
+.card[data-card-id="76"] {
+ background-image: url("images/cards100/card_76.png");
+}
+
+.card[data-card-id="77"] {
+ background-image: url("images/cards100/card_77.png");
+}
+
+.card[data-card-id="78"] {
+ background-image: url("images/cards100/card_78.png");
+}
+
+.card[data-card-id="79"] {
+ background-image: url("images/cards100/card_79.png");
+}
+
+.card[data-card-id="80"] {
+ background-image: url("images/cards100/card_80.png");
+}
+
+.card[data-card-id="81"] {
+ background-image: url("images/cards100/card_81.png");
+}
+
+.card[data-card-id="82"] {
+ background-image: url("images/cards100/card_82.png");
+}
+
+.card[data-card-id="83"] {
+ background-image: url("images/cards100/card_83.png");
+}
+
+.card[data-card-id="84"] {
+ background-image: url("images/cards100/card_84.png");
+}
+
+.card[data-card-id="85"] {
+ background-image: url("images/cards100/card_85.png");
+}
+
+.card[data-card-id="86"] {
+ background-image: url("images/cards100/card_86.png");
+}
+
+.card[data-card-id="87"] {
+ background-image: url("images/cards100/card_87.png");
+}
+
+.card[data-card-id="88"] {
+ background-image: url("images/cards100/card_88.png");
+}
+
+.card[data-card-id="89"] {
+ background-image: url("images/cards100/card_89.png");
+}
+
+.card[data-card-id="90"] {
+ background-image: url("images/cards100/card_90.png");
+}
+
+.card[data-card-id="91"] {
+ background-image: url("images/cards100/card_91.png");
+}
+
+.card[data-card-id="92"] {
+ background-image: url("images/cards100/card_92.png");
+}
+
+.card[data-card-id="93"] {
+ background-image: url("images/cards100/card_93.png");
+}
+
+.card[data-card-id="94"] {
+ background-image: url("images/cards100/card_94.png");
+}
+
+.card[data-card-id="95"] {
+ background-image: url("images/cards100/card_95.png");
+}
+
+.card[data-card-id="96"] {
+ background-image: url("images/cards100/card_96.png");
+}
+
+.card[data-card-id="97"] {
+ background-image: url("images/cards100/card_97.png");
+}
+
+.card[data-card-id="98"] {
+ background-image: url("images/cards100/card_98.png");
+}
+
+.card[data-card-id="99"] {
+ background-image: url("images/cards100/card_99.png");
+}
+
+.card[data-card-id="100"] {
+ background-image: url("images/cards100/card_100.png");
+}
+
+.card[data-card-id="101"] {
+ background-image: url("images/cards100/card_101.png");
+}
+
+.card[data-card-id="102"] {
+ background-image: url("images/cards100/card_102.png");
+}
+
+.card[data-card-id="103"] {
+ background-image: url("images/cards100/card_103.png");
+}
+
+.card[data-card-id="104"] {
+ background-image: url("images/cards100/card_104.png");
+}
+
+.card[data-card-id="105"] {
+ background-image: url("images/cards100/card_105.png");
+}
+
+.card[data-card-id="106"] {
+ background-image: url("images/cards100/card_106.png");
+}
+
+.card[data-card-id="107"] {
+ background-image: url("images/cards100/card_107.png");
+}
+
+.card[data-card-id="108"] {
+ background-image: url("images/cards100/card_108.png");
+}
+
.card.event {
position: absolute;
width: 132px;
@@ -358,6 +585,30 @@ main {
margin-top: 1px;
}
+.glory {
+ box-sizing: border-box;
+ position: absolute;
+ width: 34px;
+ height: 34px;
+ background-size: 100% 100%;
+ border-radius: 4px;
+}
+
+.glory[data-faction-id=a] {
+ border: 1px #333 solid;
+ background-image: url("images/factions/anarchists.png");
+}
+
+.glory[data-faction-id=c] {
+ border: 1px #333 solid;
+ background-image: url("images/factions/communitsts.png");
+}
+
+.glory[data-faction-id=m] {
+ border: 1px #333 solid;
+ background-image: url("images/factions/moderates.png");
+}
+
.standee {
box-sizing: border-box;
position: absolute;
diff --git a/land-and-freedom.scss b/land-and-freedom.scss
index 3602c26..8b9636f 100644
--- a/land-and-freedom.scss
+++ b/land-and-freedom.scss
@@ -4,10 +4,14 @@
$selectable-color: white; // yellow;
$selected-color: yellow; //blue;
+$anarchist-color: rgb(76, 70, 89);
+$communist-color: rgb(255, 0, 0);
+$moderate-color: rgb(126, 18, 80);
+
main {
// background-color: rgb(213, 196, 131);
// background-color: darkolivegreen;
- background-color: #7B904B;;
+ background-color: #7b904b;
}
/* MAP */
@@ -44,11 +48,60 @@ main {
}
}
+.game_info {
+ padding: 3px 4px;
+ border-bottom: 1px solid black;
+ font-size: 16px;
+ line-height: 1.5;
+ grid-column: 1;
+ grid-row: 1;
+ display: flex;
+ flex-direction: column;
+}
+
+#roles {
+ grid-column: 1;
+ grid-row: 2;
+}
+
+// #role_Anarchist::before {
+// background-color: $anarchist-color;
+// content: ' ';
+// display: block;
+// height: 100%;
+// left: 0;
+// opacity: 0.6;
+// position: absolute;
+// top: 0;
+// width: 100%;
+// z-index: -1;
+// }
+
+#role_Anarchist {
+ background-color: $anarchist-color;
+}
+
+#role_Communist {
+ background-color: $communist-color;
+}
+
+#role_Moderate {
+ background-color: $moderate-color;
+}
+
+.role {
+ color: white;
+
+ a {
+ color: white;
+ }
+}
+
.panel {
min-width: 1271px;
max-width: 1271px;
// background-color: hsl(34, 10%, 35%);
- background-color: #58641D;
+ background-color: #58641d;
margin: 12px auto;
box-shadow: 1px 2px 4px #0004;
border: 2px solid #333;
@@ -73,11 +126,19 @@ main {
}
#hand_header {
- background-color: #273B09;
+ background-color: #273b09;
+}
+
+.panel_header[data-faction-id='a'] {
+ background-color: $anarchist-color;
+}
+
+.panel_header[data-faction-id='c'] {
+ background-color: $communist-color;
}
-.panel_header[data-faction-id="a"] {
- background: linear-gradient(45deg, black 50%, red 0);
+.panel_header[data-faction-id='m'] {
+ background-color: $moderate-color;
}
// #hand,
@@ -127,7 +188,7 @@ main {
box-shadow: 0 0 0 1px #333;
}
-@for $i from 1 through 62 {
+@for $i from 1 through 108 {
.card[data-card-id='#{$i}'] {
background-image: url('images/cards100/card_#{$i}.png');
}
@@ -151,6 +212,33 @@ main {
margin-top: 1px;
}
+.glory {
+ box-sizing: border-box;
+ position: absolute;
+ // background-color: yellow;
+ // opacity: 0.5;
+ width: 34px;
+ height: 34px;
+ background-size: 100% 100%;
+ // box-shadow: 0 0 0 1px #333;
+ border-radius: 4px;
+}
+
+.glory[data-faction-id='a'] {
+ border: 1px #333 solid;
+ background-image: url('images/factions/anarchists.png');
+}
+
+.glory[data-faction-id='c'] {
+ border: 1px #333 solid;
+ background-image: url('images/factions/communitsts.png');
+}
+
+.glory[data-faction-id='m'] {
+ border: 1px #333 solid;
+ background-image: url('images/factions/moderates.png');
+}
+
.standee {
box-sizing: border-box;
position: absolute;
diff --git a/play.html b/play.html
index 04e8168..fffbbca 100644
--- a/play.html
+++ b/play.html
@@ -32,7 +32,29 @@
</header>
<aside>
+ <div class="game_info">
+ <span id="year">Year 1</span>
+ <span id="pool_hero_points"></span>
+ </div>
<div id="roles">
+ <div id="role_Anarchist" class="role">
+ <div class="role_name"><span>Anarchist</span></div>
+ <div class="role_stat"></div>
+ <div class="role_user">-</div>
+ <div class="role_info"></div>
+ </div>
+ <div id="role_Communist" class="role">
+ <div class="role_name"><span>Communist</span></div>
+ <div class="role_stat"></div>
+ <div class="role_user">-</div>
+ <div class="role_info"></div>
+ </div>
+ <div id="role_Moderate" class="role">
+ <div class="role_name"><span>Moderate</span></div>
+ <div class="role_stat"></div>
+ <div class="role_user">-</div>
+ <div class="role_info"></div>
+ </div>
</div>
<div id="log"></div>
</aside>
diff --git a/play.js b/play.js
index c4e15ac..3711a13 100644
--- a/play.js
+++ b/play.js
@@ -1,27 +1,45 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
const BONUSES_COUNT = 2;
-const CARD_COUNT = 63;
+const CARD_COUNT = 109;
+const GLORY_COUNT = 9;
const MEDAILLONS_COUNT = 5;
const STANDEES_COUNT = 5;
const TRACK_COUNT = 5;
const TRACK_LENGTH = 11;
const FACTIONS = ['a', 'c', 'm'];
+console.log('roles', document.getElementById('roles'));
let ui = {
map: document.getElementById('map'),
markers: document.getElementById('markers'),
hand: document.getElementById('hand'),
current_events: document.getElementById('current_events'),
+ stats: {
+ a: {
+ hero_points: document.querySelector('#role_Anarchist .role_stat'),
+ },
+ c: {
+ hero_points: document.querySelector('#role_Communist .role_stat'),
+ },
+ m: {
+ hero_points: document.querySelector('#role_Moderate .role_stat'),
+ },
+ pool: {
+ hero_points: document.getElementById('pool_hero_points'),
+ },
+ },
tableaus: {
a: document.getElementById('tableau_a'),
c: document.getElementById('tableau_c'),
m: document.getElementById('tableau_m'),
},
tracks: document.getElementById('tracks'),
+ hero_points: document.querySelector('#role_Anarchist .role_stat'),
blank_markers: [[], [], [], [], []],
bonuses: [],
fronts: {},
frontValues: {},
+ glory: [],
medaillons: [],
spaces: [],
standees: [],
@@ -39,6 +57,17 @@ const LAYOUT_CURRENT_EVENTS = [
[445, 648],
[584, 648],
];
+const LAYOUT_GLORY = [
+ [801, 647],
+ [860, 647],
+ [897, 647],
+ [848, 718],
+ [775, 771],
+ [812, 771],
+ [849, 771],
+ [885, 771],
+ [922, 771],
+];
const LAYOUT_MEDAILLONS = [
[364, 556],
[415, 556],
@@ -174,6 +203,13 @@ function on_init() {
register_action(e, 'bonus', b);
ui.map.appendChild(ui.bonuses[b]);
}
+ for (let g = 0; g < GLORY_COUNT; ++g) {
+ let e = (ui.glory[g] = document.createElement('div'));
+ e.className = 'glory';
+ ui.map.appendChild(ui.glory[g]);
+ e.style.left = LAYOUT_GLORY[g][0] + 'px';
+ e.style.top = LAYOUT_GLORY[g][1] + 'px';
+ }
for (let m = 0; m < MEDAILLONS_COUNT; ++m) {
let e = (ui.medaillons[m] = document.createElement('div'));
e.className = 'medaillon';
@@ -200,6 +236,9 @@ function on_init() {
function on_update() {
console.log('on_update', view);
on_init();
+ for (let key of Object.keys(view.hero_points)) {
+ ui.stats[key].hero_points.replaceChildren(`Hero Points: ${view.hero_points[key]}`);
+ }
ui.current_events.replaceChildren();
for (let i = 0; i < view.current_events.length; i++) {
const cardId = view.current_events[i];
@@ -247,6 +286,9 @@ function on_update() {
ui.tableaus[faction_id].appendChild(ui.cards[c]);
}
}
+ for (let g = 0; g < view.glory.length; ++g) {
+ ui.glory[g].setAttribute('data-faction-id', view.glory[g]);
+ }
for (let e of action_register)
e.classList.toggle('action', is_action(e.my_action, e.my_id));
action_button('add_to_front', '+1 to a Front');
diff --git a/play.ts b/play.ts
index c8ffe93..57e8582 100644
--- a/play.ts
+++ b/play.ts
@@ -1,6 +1,6 @@
'use strict';
-import { StaticData, View } from './types';
+import { FactionId, StaticData, View } from './types';
declare function action_button(action: string, text: string): void;
// declare function register_action(element: HTMLElement, type: string, s: number): void;
@@ -12,28 +12,48 @@ declare const view: View;
const BONUSES_COUNT = 2;
// const PIECE_COUNT = 32;
-const CARD_COUNT = 63;
+const CARD_COUNT = 109;
+const GLORY_COUNT = 9;
const MEDAILLONS_COUNT = 5;
const STANDEES_COUNT = 5;
const TRACK_COUNT = 5;
const TRACK_LENGTH = 11;
const FACTIONS = ['a', 'c', 'm'];
+// const ROLES = ['Anarchist', 'Communist', 'Moderate'];
+
+console.log('roles', document.getElementById('roles'));
let ui = {
map: document.getElementById('map'),
markers: document.getElementById('markers'),
hand: document.getElementById('hand'),
current_events: document.getElementById('current_events'),
+ stats: {
+ a: {
+ hero_points: document.querySelector('#role_Anarchist .role_stat'),
+ },
+ c: {
+ hero_points: document.querySelector('#role_Communist .role_stat'),
+ },
+ m: {
+ hero_points: document.querySelector('#role_Moderate .role_stat'),
+ },
+ pool: {
+ hero_points: document.getElementById('pool_hero_points'),
+ },
+ },
tableaus: {
a: document.getElementById('tableau_a'),
c: document.getElementById('tableau_c'),
m: document.getElementById('tableau_m'),
},
tracks: document.getElementById('tracks'),
+ hero_points: document.querySelector('#role_Anarchist .role_stat'),
blank_markers: [[], [], [], [], []],
bonuses: [],
fronts: {},
frontValues: {},
+ glory: [],
medaillons: [],
spaces: [],
standees: [],
@@ -55,6 +75,18 @@ const LAYOUT_CURRENT_EVENTS = [
[584, 648],
];
+const LAYOUT_GLORY = [
+ [801, 647],
+ [860, 647],
+ [897, 647],
+ [848, 718],
+ [775, 771],
+ [812, 771],
+ [849, 771],
+ [885, 771],
+ [922, 771],
+];
+
const LAYOUT_MEDAILLONS = [
[364, 556],
[415, 556],
@@ -210,6 +242,14 @@ function on_init() {
ui.map.appendChild(ui.bonuses[b]);
}
+ for (let g = 0; g < GLORY_COUNT; ++g) {
+ let e = (ui.glory[g] = document.createElement('div'));
+ e.className = 'glory';
+ ui.map.appendChild(ui.glory[g]);
+ e.style.left = LAYOUT_GLORY[g][0] + 'px';
+ e.style.top = LAYOUT_GLORY[g][1] + 'px';
+ }
+
// create track medaillons
for (let m = 0; m < MEDAILLONS_COUNT; ++m) {
let e = (ui.medaillons[m] = document.createElement('div'));
@@ -246,6 +286,12 @@ function on_update() {
console.log('on_update', view);
on_init();
+ for (let key of Object.keys(view.hero_points)) {
+ ui.stats[key].hero_points.replaceChildren(
+ `Hero Points: ${view.hero_points[key]}`
+ );
+ }
+
// for (let s = 0; s < SPACE_COUNT; ++s) ui.spaces[s].replaceChildren();
// for (let p = 0; p < PIECE_COUNT; ++p) {
@@ -261,7 +307,6 @@ function on_update() {
ui.cards[cardId].style.top = LAYOUT_CURRENT_EVENTS[i][1] + 'px';
}
-
ui.markers.replaceChildren();
for (let t = 0; t < TRACK_COUNT; ++t) {
for (let bm of view.triggered_track_effects[t]) {
@@ -312,6 +357,10 @@ function on_update() {
}
}
+ for (let g = 0; g < view.glory.length; ++g) {
+ ui.glory[g].setAttribute('data-faction-id', view.glory[g]);
+ }
+
for (let e of action_register)
e.classList.toggle('action', is_action(e.my_action, e.my_id));
@@ -322,14 +371,14 @@ function on_update() {
action_button('d_collectivization', 'Decrease Collectivization');
action_button('d_foreign_aid', 'Decrease Foreign Aid');
action_button('d_government', 'Decrease Government');
-
+
action_button('d_soviet_support', 'Decrease Soviet Support');
action_button('draw_card', 'Draw a Card');
action_button('foreign_aid', 'Foreign Aid');
action_button('government', 'Government');
action_button('liberty', 'Liberty');
action_button('government_to_center', 'Government towards center');
-
+
action_button('teamwork_on', 'Teamwork Bonus On');
action_button('Anarchist', 'Anarchist');
action_button('Communist', 'Communist');
diff --git a/rules.js b/rules.js
index 5b8efd5..697ec13 100644
--- a/rules.js
+++ b/rules.js
@@ -1,6 +1,6 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
-exports.roles = exports.scenarios = exports.MODERATE = exports.COMMUNIST = exports.ANARCHIST = void 0;
+exports.roles = exports.scenarios = void 0;
exports.action = action;
exports.view = game_view;
exports.setup = setup;
@@ -8,19 +8,16 @@ const data_1 = require("./data");
const states = {};
let game = {};
var view = {};
-exports.ANARCHIST = 'Anarchist';
-exports.COMMUNIST = 'Communist';
-exports.MODERATE = 'Moderate';
const role_ids = [data_1.ANARCHISTS_ID, data_1.COMMUNISTS_ID, data_1.MODERATES_ID];
const faction_player_map = {
- [data_1.ANARCHISTS_ID]: exports.ANARCHIST,
- [data_1.COMMUNISTS_ID]: exports.COMMUNIST,
- [data_1.MODERATES_ID]: exports.MODERATE,
+ [data_1.ANARCHISTS_ID]: data_1.ANARCHIST,
+ [data_1.COMMUNISTS_ID]: data_1.COMMUNIST,
+ [data_1.MODERATES_ID]: data_1.MODERATE,
};
const player_faction_map = {
- [exports.ANARCHIST]: data_1.ANARCHISTS_ID,
- [exports.COMMUNIST]: data_1.COMMUNISTS_ID,
- [exports.MODERATE]: data_1.MODERATES_ID,
+ [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',
@@ -41,10 +38,12 @@ const faction_cards = {
const medaillons = make_list(0, 8);
console.log('medaillons', medaillons);
const fascist_decks = {
- 1: make_list(55, 62),
+ 1: make_list(55, 72),
+ 2: make_list(73, 90),
+ 3: make_list(91, 108),
};
exports.scenarios = ['Standard'];
-exports.roles = [exports.ANARCHIST, exports.COMMUNIST, exports.MODERATE];
+exports.roles = [data_1.ANARCHIST, data_1.COMMUNIST, data_1.MODERATE];
function gen_action(action, argument) {
if (argument === undefined) {
view.actions[action] = 1;
@@ -118,7 +117,7 @@ function setup_choose_card() {
const player_order = get_player_order();
game.engine = player_order.map((faction_id) => create_leaf_node('choose_card', faction_id));
game.engine.push(create_function_node('setup_player_turn'));
- next();
+ resolve_active_and_proceed();
}
function setup_player_turn() {
console.log('setup_player_turn');
@@ -126,7 +125,7 @@ function setup_player_turn() {
game.engine = player_order.map((faction_id) => create_seq_node([create_leaf_node('player_turn', faction_id)]));
game.engine.push(create_function_node('resolve_fascist_test'));
game.engine.push(create_function_node('setup_bag_of_glory'));
- next();
+ resolve_active_and_proceed();
}
const engine_functions = {
check_activate_icon,
@@ -184,7 +183,6 @@ function next() {
const node = get_active_node(game.engine);
console.log('node', node);
if (node.t === function_node && engine_functions[node.f]) {
- resolve_active_node();
const args = node.a;
if (args) {
engine_functions[node.f](args);
@@ -218,10 +216,13 @@ function game_view(state, player) {
prompt: null,
location: game.location,
selected: game.selected,
+ bag_of_glory: game.bag_of_glory,
bonuses: game.bonuses,
current_events: game.current_events,
fronts: game.fronts,
+ glory: game.glory,
hand: game.hands[faction_id],
+ hero_points: game.hero_points,
medaillons: game.medaillons,
selected_card: game.chosen_cards[faction_id],
tableaus: game.tableaus,
@@ -246,12 +247,8 @@ function setup(seed, _scenario, _options) {
game = {
seed: seed,
state: null,
- active: exports.ANARCHIST,
- bag_of_glory: {
- [data_1.ANARCHISTS_ID]: 1,
- [data_1.COMMUNISTS_ID]: 1,
- [data_1.MODERATES_ID]: 1,
- },
+ active: data_1.ANARCHIST,
+ bag_of_glory: [data_1.ANARCHISTS_ID, data_1.COMMUNISTS_ID, data_1.MODERATES_ID],
blank_markers: [[], [], [], [], []],
bonuses: [data_1.ON, data_1.ON],
current_events: [],
@@ -268,6 +265,7 @@ function setup(seed, _scenario, _options) {
n: -2,
s: -2,
},
+ glory: [],
hands: {
[data_1.ANARCHISTS_ID]: [],
[data_1.COMMUNISTS_ID]: [],
@@ -323,7 +321,9 @@ function draw_hand_cards() {
});
}
function start_year() {
+ console.log('start year');
log_h1('Year ' + game.year);
+ game.current_events = [];
draw_hand_cards();
start_turn();
}
@@ -414,7 +414,7 @@ states.add_glory = {
if (game.turn === 4) {
number++;
}
- game.bag_of_glory[get_active_faction()] += number;
+ game.bag_of_glory.push(get_active_faction());
if (number === 1) {
log_h3(`${game.active} adds 1 token to the Bag of Glory`);
}
@@ -722,11 +722,33 @@ function end_of_turn() {
start_turn();
}
}
-function end_of_year() { }
+function end_of_year() {
+ const gloryToDraw = [0, 1, 2, 5];
+ for (let i = 0; i < gloryToDraw[game.year]; ++i) {
+ const index = random(game.bag_of_glory.length);
+ game.glory.push(game.bag_of_glory[index]);
+ array_remove(game.bag_of_glory, index);
+ }
+ game.year++;
+ start_year();
+}
function resolve_fascist_test() {
console.log('resolve fascist test');
log_h2('Fascist test is resolved');
- next();
+ const test = get_current_event().test;
+ const test_passed = game.fronts[test.front] >= test.value;
+ if (test_passed) {
+ log('The Test is passed');
+ }
+ else {
+ log('The Test is failed');
+ }
+ const effect = test_passed ? test.pass : test.fail;
+ const node = resolve_effect(effect);
+ if (node !== null) {
+ insert_after_active_node(node);
+ }
+ resolve_active_and_proceed();
}
function get_fronts_to_add_to(target) {
console.log('get_fronts_to_add_to', target);
@@ -872,6 +894,9 @@ function get_active_faction_id() {
function get_faction_id(player) {
return player_faction_map[player];
}
+function get_current_event() {
+ return cards[game.current_events[game.current_events.length - 1]];
+}
function get_icon_count_in_tableau(icon, faction = get_active_faction_id()) {
let count = 0;
for (const c of game.tableaus[faction]) {
diff --git a/rules.ts b/rules.ts
index 2b84ab4..ee9b269 100644
--- a/rules.ts
+++ b/rules.ts
@@ -18,6 +18,9 @@ import {
} from './types';
import data, {
+ ANARCHIST,
+ COMMUNIST,
+ MODERATE,
ANARCHISTS_ID,
COMMUNISTS_ID,
MODERATES_ID,
@@ -56,9 +59,9 @@ const states = {} as States;
let game = {} as Game; // = null
var view = {} as View; // = null
-export const ANARCHIST = 'Anarchist' as Player;
-export const COMMUNIST = 'Communist' as Player;
-export const MODERATE = 'Moderate' as Player;
+// export const ANARCHIST = 'Anarchist' as Player;
+// export const COMMUNIST = 'Communist' as Player;
+// export const MODERATE = 'Moderate' as Player;
const role_ids = [ANARCHISTS_ID, COMMUNISTS_ID, MODERATES_ID];
@@ -104,7 +107,9 @@ const medaillons = make_list(0, 8) as number[];
console.log('medaillons', medaillons);
const fascist_decks = {
- 1: make_list(55, 62),
+ 1: make_list(55, 72),
+ 2: make_list(73, 90),
+ 3: make_list(91, 108),
};
export const scenarios = ['Standard'];
@@ -215,7 +220,7 @@ function setup_choose_card() {
create_leaf_node('choose_card', faction_id)
);
game.engine.push(create_function_node('setup_player_turn'));
- next();
+ resolve_active_and_proceed();
}
function setup_player_turn() {
@@ -226,7 +231,7 @@ function setup_player_turn() {
);
game.engine.push(create_function_node('resolve_fascist_test'));
game.engine.push(create_function_node('setup_bag_of_glory'));
- next();
+ resolve_active_and_proceed();
}
const engine_functions: Record<string, Function> = {
@@ -336,7 +341,6 @@ function next() {
const node = get_active_node(game.engine);
console.log('node', node);
if (node.t === function_node && engine_functions[node.f]) {
- resolve_active_node();
const args = node.a;
if (args) {
engine_functions[node.f](args);
@@ -379,11 +383,13 @@ function game_view(state: Game, player: Player) {
prompt: null,
location: game.location,
selected: game.selected,
-
+ bag_of_glory: game.bag_of_glory,
bonuses: game.bonuses,
current_events: game.current_events,
fronts: game.fronts,
+ glory: game.glory,
hand: game.hands[faction_id],
+ hero_points: game.hero_points,
medaillons: game.medaillons,
selected_card: game.chosen_cards[faction_id],
tableaus: game.tableaus,
@@ -414,11 +420,7 @@ export function setup(seed: number, _scenario: string, _options: unknown) {
seed: seed,
state: null,
active: ANARCHIST,
- bag_of_glory: {
- [ANARCHISTS_ID]: 1,
- [COMMUNISTS_ID]: 1,
- [MODERATES_ID]: 1,
- },
+ bag_of_glory: [ANARCHISTS_ID, COMMUNISTS_ID, MODERATES_ID],
blank_markers: [[], [], [], [], []],
bonuses: [ON, ON],
current_events: [],
@@ -435,6 +437,7 @@ export function setup(seed: number, _scenario: string, _options: unknown) {
n: -2,
s: -2,
},
+ glory: [],
hands: {
[ANARCHISTS_ID]: [],
[COMMUNISTS_ID]: [],
@@ -495,7 +498,9 @@ function draw_hand_cards() {
// #endregion
function start_year() {
+ console.log('start year')
log_h1('Year ' + game.year);
+ game.current_events = [];
draw_hand_cards();
start_turn();
}
@@ -609,7 +614,7 @@ states.add_glory = {
if (game.turn === 4) {
number++;
}
- game.bag_of_glory[get_active_faction()] += number;
+ game.bag_of_glory.push(get_active_faction());
if (number === 1) {
log_h3(`${game.active} adds 1 token to the Bag of Glory`);
} else {
@@ -1005,7 +1010,7 @@ function check_activate_icon() {
}
function end_of_turn() {
- // REMOVE playre tplems from the Fronts;
+ // REMOVE player tokens from the Fronts;
log_h2('End of turn');
if (game.turn === 4) {
end_of_year();
@@ -1015,12 +1020,37 @@ function end_of_turn() {
}
}
-function end_of_year() {}
+function end_of_year() {
+ const gloryToDraw = [0, 1, 2, 5];
+ for (let i = 0; i < gloryToDraw[game.year]; ++i) {
+ const index = random(game.bag_of_glory.length);
+ game.glory.push(game.bag_of_glory[index]);
+ array_remove(game.bag_of_glory, index);
+ }
+
+ game.year++;
+ start_year();
+}
function resolve_fascist_test() {
console.log('resolve fascist test');
log_h2('Fascist test is resolved');
- next();
+
+ const test = get_current_event().test;
+ const test_passed = game.fronts[test.front] >= test.value;
+ if (test_passed) {
+ log('The Test is passed');
+ } else {
+ log('The Test is failed');
+ }
+ const effect = test_passed ? test.pass : test.fail;
+ const node = resolve_effect(effect);
+
+ if (node !== null) {
+ insert_after_active_node(node);
+ }
+
+ resolve_active_and_proceed();
}
// TODO: check for defeated / won fronts
@@ -1338,6 +1368,12 @@ function get_faction_id(player: Player): FactionId {
return player_faction_map[player];
}
+function get_current_event(): EventCard {
+ return cards[
+ game.current_events[game.current_events.length - 1]
+ ] as EventCard;
+}
+
function get_icon_count_in_tableau(
icon: Icon,
faction: FactionId = get_active_faction_id()
diff --git a/types.d.ts b/types.d.ts
index 5597d10..59d9d9d 100644
--- a/types.d.ts
+++ b/types.d.ts
@@ -19,7 +19,7 @@ export interface Game {
year: number;
active: Player | null;
state: string | null;
- bag_of_glory: Record<FactionId, number>;
+ bag_of_glory: FactionId[];
blank_markers: number[][];
bonuses: number[];
chosen_cards: Record<FactionId, CardId>;
@@ -32,6 +32,7 @@ export interface Game {
n: number;
s: number;
};
+ glory: FactionId[];
hands: Record<FactionId, CardId[]>;
hero_points: Record<FactionId | 'pool', number>;
initiative: FactionId;
@@ -63,10 +64,13 @@ export interface View {
selected?: string;
selected_card: CardId | null;
+ bag_of_glory: Game['bag_of_glory'];
bonuses: Game['bonuses'];
current_events: CardId[];
fronts: Game['fronts'];
+ glory: Game['glory'];
hand: CardId[];
+ hero_points: Game['hero_points'];
medaillons: Game['medaillons'];
tableaus: Game['tableaus'];
tracks: number[];