From f321c249f5b9b4f8abc4f519a3666cdda94fad7a Mon Sep 17 00:00:00 2001 From: Frans Bongers Date: Sun, 22 Dec 2024 22:15:57 +0100 Subject: use medallions --- data.js | 404 ++++++++++++++++--------------- data.ts | 456 ++++++++++++++++++++--------------- images/medaillons/medaillon_0.png | Bin 83925 -> 0 bytes images/medaillons/medaillon_1.png | Bin 86793 -> 0 bytes images/medaillons/medaillon_2.png | Bin 82783 -> 0 bytes images/medaillons/medaillon_3.png | Bin 84146 -> 0 bytes images/medaillons/medaillon_4.png | Bin 90155 -> 0 bytes images/medaillons/medaillon_5.png | Bin 80227 -> 0 bytes images/medaillons/medaillon_6.png | Bin 90532 -> 0 bytes images/medaillons/medaillon_7.png | Bin 89231 -> 0 bytes images/medaillons/medaillon_8.png | Bin 84308 -> 0 bytes images/medallions/medallion_0.png | Bin 0 -> 83925 bytes images/medallions/medallion_1.png | Bin 0 -> 86793 bytes images/medallions/medallion_2.png | Bin 0 -> 82783 bytes images/medallions/medallion_3.png | Bin 0 -> 84146 bytes images/medallions/medallion_4.png | Bin 0 -> 90155 bytes images/medallions/medallion_5.png | Bin 0 -> 80227 bytes images/medallions/medallion_6.png | Bin 0 -> 90532 bytes images/medallions/medallion_7.png | Bin 0 -> 89231 bytes images/medallions/medallion_8.png | Bin 0 -> 84308 bytes land-and-freedom.css | 67 ++++-- land-and-freedom.scss | 55 ++++- play.html | 4 + play.js | 70 +++--- play.ts | 92 ++++--- rules.js | 393 +++++++++++++++++++++++++----- rules.ts | 495 ++++++++++++++++++++++++++++++-------- types.d.ts | 14 +- 28 files changed, 1396 insertions(+), 654 deletions(-) delete mode 100644 images/medaillons/medaillon_0.png delete mode 100644 images/medaillons/medaillon_1.png delete mode 100644 images/medaillons/medaillon_2.png delete mode 100644 images/medaillons/medaillon_3.png delete mode 100644 images/medaillons/medaillon_4.png delete mode 100644 images/medaillons/medaillon_5.png delete mode 100644 images/medaillons/medaillon_6.png delete mode 100644 images/medaillons/medaillon_7.png delete mode 100644 images/medaillons/medaillon_8.png create mode 100644 images/medallions/medallion_0.png create mode 100644 images/medallions/medallion_1.png create mode 100644 images/medallions/medallion_2.png create mode 100644 images/medallions/medallion_3.png create mode 100644 images/medallions/medallion_4.png create mode 100644 images/medallions/medallion_5.png create mode 100644 images/medallions/medallion_6.png create mode 100644 images/medallions/medallion_7.png create mode 100644 images/medallions/medallion_8.png diff --git a/data.js b/data.js index 33f2374..20a6486 100644 --- a/data.js +++ b/data.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.FRONTS = exports.DEFEAT = exports.VICTORY = exports.TRASH = exports.TOWARDS_CENTER = exports.AWAY_FROM_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; +exports.ORGANIZATION_MEDALLION_ID = exports.ARCHIVES_MEDALLION_ID = exports.VOLUNTEERS_MEDALLION_ID = exports.INTELLIGENCE_MEDALLION_ID = exports.PROPAGANDA_MEDALLION_ID = exports.STRATEGY_MEDALLION_ID = exports.FRONTS = exports.DEFEAT = exports.VICTORY = exports.TRASH = exports.TOWARDS_CENTER = exports.AWAY_FROM_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.INITIATIVE_PLAYER = 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; exports.create_effect = create_effect; const LIBERTY = 0; exports.LIBERTY = LIBERTY; @@ -23,6 +23,7 @@ exports.ON = ON; const PLAYER_WITH_MOST_HERO_POINTS = 0; exports.PLAYER_WITH_MOST_HERO_POINTS = PLAYER_WITH_MOST_HERO_POINTS; const INITIATIVE_PLAYER = 'i'; +exports.INITIATIVE_PLAYER = INITIATIVE_PLAYER; const ALL_PLAYERS = 'all'; const ARAGON = 'a'; const MADRID = 'm'; @@ -62,11 +63,24 @@ const VICTORY = 'Victory'; exports.VICTORY = VICTORY; const DEFEAT = 'Defeat'; exports.DEFEAT = DEFEAT; -function create_effect(type, target, value) { +const STRATEGY_MEDALLION_ID = 3; +exports.STRATEGY_MEDALLION_ID = STRATEGY_MEDALLION_ID; +const PROPAGANDA_MEDALLION_ID = 4; +exports.PROPAGANDA_MEDALLION_ID = PROPAGANDA_MEDALLION_ID; +const INTELLIGENCE_MEDALLION_ID = 5; +exports.INTELLIGENCE_MEDALLION_ID = INTELLIGENCE_MEDALLION_ID; +const VOLUNTEERS_MEDALLION_ID = 6; +exports.VOLUNTEERS_MEDALLION_ID = VOLUNTEERS_MEDALLION_ID; +const ARCHIVES_MEDALLION_ID = 7; +exports.ARCHIVES_MEDALLION_ID = ARCHIVES_MEDALLION_ID; +const ORGANIZATION_MEDALLION_ID = 8; +exports.ORGANIZATION_MEDALLION_ID = ORGANIZATION_MEDALLION_ID; +function create_effect(type, target, value, faction) { return { type, target, value, + faction, }; } const data = { @@ -740,9 +754,9 @@ const data = { { id: 55, effects: [ - create_effect('attack', SOUTHERN, -4), - create_effect('attack', ARAGON, -1), - create_effect('track', SOVIET_SUPPORT, -2), + create_effect('attack', SOUTHERN, -4, INITIATIVE_PLAYER), + create_effect('attack', ARAGON, -1, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -757,9 +771,9 @@ const data = { { id: 56, effects: [ - create_effect('attack', SOUTHERN, -3), - create_effect('attack', CLOSEST_TO_VICTORY, -2), - create_effect('bonus', MORALE_BONUS, OFF), + create_effect('attack', SOUTHERN, -3, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -2, INITIATIVE_PLAYER), + create_effect('bonus', MORALE_BONUS, OFF, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -774,9 +788,9 @@ const data = { { id: 57, effects: [ - create_effect('attack', MADRID, -5), - create_effect('track', FOREIGN_AID, -2), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1), + create_effect('attack', MADRID, -5, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), + create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -791,9 +805,9 @@ const data = { { id: 58, effects: [ - create_effect('attack', NORTHERN, -5), - create_effect('attack', CLOSEST_TO_VICTORY, -1), - create_effect('track', COLLECTIVIZATION, -1), + create_effect('attack', NORTHERN, -5, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -1, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -808,9 +822,9 @@ const data = { { id: 59, effects: [ - create_effect('attack', MADRID, -4), - create_effect('attack', CLOSEST_TO_VICTORY, -2), - create_effect('track', LIBERTY, -1), + create_effect('attack', MADRID, -4, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -2, INITIATIVE_PLAYER), + create_effect('track', LIBERTY, -1, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -825,9 +839,9 @@ const data = { { id: 60, effects: [ - create_effect('attack', NORTHERN, -3), - create_effect('attack', CLOSEST_TO_VICTORY, -3), - create_effect('track', LIBERTY, -1), + create_effect('attack', NORTHERN, -3, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -3, INITIATIVE_PLAYER), + create_effect('track', LIBERTY, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -842,9 +856,9 @@ const data = { { id: 61, effects: [ - create_effect('attack', ARAGON, -4), - create_effect('attack', CLOSEST_TO_VICTORY, -2), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1), + create_effect('attack', ARAGON, -4, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -2, INITIATIVE_PLAYER), + create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -859,9 +873,9 @@ const data = { { id: 62, effects: [ - create_effect('attack', SOUTHERN, -5), - create_effect('bonus', MORALE_BONUS, OFF), - create_effect('track', LIBERTY, -1), + create_effect('attack', SOUTHERN, -5, INITIATIVE_PLAYER), + create_effect('bonus', MORALE_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', LIBERTY, -1, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -876,9 +890,9 @@ const data = { { id: 63, effects: [ - create_effect('attack', CLOSEST_TO_VICTORY, -5), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', COLLECTIVIZATION, -1), + create_effect('attack', CLOSEST_TO_VICTORY, -5, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -893,9 +907,9 @@ const data = { { id: 64, effects: [ - create_effect('attack', SOUTHERN, -4), - create_effect('attack', MADRID, -2), - create_effect('track', FOREIGN_AID, -1), + create_effect('attack', SOUTHERN, -4, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -2, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -1, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -910,9 +924,9 @@ const data = { { id: 65, effects: [ - create_effect('attack', CLOSEST_TO_DEFEAT, -1), - create_effect('attack', MADRID, -4), - create_effect('track', SOVIET_SUPPORT, -2), + create_effect('attack', CLOSEST_TO_DEFEAT, -1, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -4, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -927,9 +941,9 @@ const data = { { id: 66, effects: [ - create_effect('attack', ARAGON, -3), - create_effect('attack', SOUTHERN, -2), - create_effect('track', FOREIGN_AID, -2), + create_effect('attack', ARAGON, -3, INITIATIVE_PLAYER), + create_effect('attack', SOUTHERN, -2, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -944,9 +958,9 @@ const data = { { id: 67, effects: [ - create_effect('attack', NORTHERN, -4), - create_effect('attack', ARAGON, -2), - create_effect('track', COLLECTIVIZATION, -1), + create_effect('attack', NORTHERN, -4, INITIATIVE_PLAYER), + create_effect('attack', ARAGON, -2, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -961,9 +975,9 @@ const data = { { id: 68, effects: [ - create_effect('attack', ARAGON, -4), - create_effect('attack', MADRID, -1), - create_effect('bonus', TEAMWORK_BONUS, OFF), + create_effect('attack', ARAGON, -4, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -1, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -978,9 +992,9 @@ const data = { { id: 69, effects: [ - create_effect('attack', MADRID, -3), - create_effect('attack', NORTHERN, -2), - create_effect('bonus', TEAMWORK_BONUS, OFF), + create_effect('attack', MADRID, -3, INITIATIVE_PLAYER), + create_effect('attack', NORTHERN, -2, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -995,9 +1009,9 @@ const data = { { id: 70, effects: [ - create_effect('attack', NORTHERN, -3), - create_effect('attack', MADRID, -3), - create_effect('track', FOREIGN_AID, -1), + create_effect('attack', NORTHERN, -3, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -3, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -1012,9 +1026,9 @@ const data = { { id: 71, effects: [ - create_effect('attack', CLOSEST_TO_DEFEAT, -3), - create_effect('attack', MADRID, -2), - create_effect('track', SOVIET_SUPPORT, -2), + create_effect('attack', CLOSEST_TO_DEFEAT, -3, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -2, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1029,9 +1043,9 @@ const data = { { id: 72, effects: [ - create_effect('attack', ARAGON, -3), - create_effect('attack', NORTHERN, -1), - create_effect('attack', CLOSEST_TO_VICTORY, -2), + create_effect('attack', ARAGON, -3, INITIATIVE_PLAYER), + create_effect('attack', NORTHERN, -1, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -2, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1046,10 +1060,10 @@ const data = { { id: 73, effects: [ - create_effect('attack', NORTHERN, -6), - create_effect('attack', CLOSEST_TO_VICTORY, -1), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1), + create_effect('attack', NORTHERN, -6, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -1, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -1064,9 +1078,9 @@ const data = { { id: 74, effects: [ - create_effect('attack', MADRID, -2), - create_effect('attack', CLOSEST_TO_VICTORY, -5), - create_effect('track', SOVIET_SUPPORT, -2), + create_effect('attack', MADRID, -2, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -5, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1081,9 +1095,9 @@ const data = { { id: 75, effects: [ - create_effect('attack', NORTHERN, -5), - create_effect('attack', CLOSEST_TO_VICTORY, -3), - create_effect('track', COLLECTIVIZATION, -1), + create_effect('attack', NORTHERN, -5, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -3, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -1098,9 +1112,9 @@ const data = { { id: 76, effects: [ - create_effect('attack', ARAGON, -5), - create_effect('attack', NORTHERN, -2), - create_effect('track', FOREIGN_AID, -2), + create_effect('attack', ARAGON, -5, INITIATIVE_PLAYER), + create_effect('attack', NORTHERN, -2, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1115,9 +1129,9 @@ const data = { { id: 77, effects: [ - create_effect('attack', ARAGON, -5), - create_effect('attack', MADRID, -3), - create_effect('track', FOREIGN_AID, -1), + create_effect('attack', ARAGON, -5, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -3, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -1, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1132,10 +1146,10 @@ const data = { { id: 78, effects: [ - create_effect('attack', MADRID, -6), - create_effect('attack', CLOSEST_TO_VICTORY, -1), - create_effect('track', LIBERTY, -1), - create_effect('track', SOVIET_SUPPORT, -1), + create_effect('attack', MADRID, -6, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -1, INITIATIVE_PLAYER), + create_effect('track', LIBERTY, -1, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -1, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1150,10 +1164,10 @@ const data = { { id: 79, effects: [ - create_effect('attack', NORTHERN, -6), - create_effect('attack', MADRID, -1), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', COLLECTIVIZATION, -1), + create_effect('attack', NORTHERN, -6, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -1, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -1168,9 +1182,9 @@ const data = { { id: 80, effects: [ - create_effect('attack', CLOSEST_TO_DEFEAT, -3), - create_effect('attack', NORTHERN, -5), - create_effect('track', LIBERTY, -1), + create_effect('attack', CLOSEST_TO_DEFEAT, -3, INITIATIVE_PLAYER), + create_effect('attack', NORTHERN, -5, INITIATIVE_PLAYER), + create_effect('track', LIBERTY, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -1185,9 +1199,9 @@ const data = { { id: 81, effects: [ - create_effect('attack', MADRID, -5), - create_effect('attack', CLOSEST_TO_VICTORY, -2), - create_effect('track', FOREIGN_AID, -2), + create_effect('attack', MADRID, -5, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -2, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1202,9 +1216,9 @@ const data = { { id: 82, effects: [ - create_effect('attack', CLOSEST_TO_DEFEAT, -4), - create_effect('attack', CLOSEST_TO_VICTORY, -4), - create_effect('track', COLLECTIVIZATION, -1), + create_effect('attack', CLOSEST_TO_DEFEAT, -4, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -4, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1219,9 +1233,9 @@ const data = { { id: 83, effects: [ - create_effect('attack', ARAGON, -7), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', FOREIGN_AID, -1), + create_effect('attack', ARAGON, -7, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -1, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1236,10 +1250,10 @@ const data = { { id: 84, effects: [ - create_effect('attack', CLOSEST_TO_DEFEAT, -1), - create_effect('attack', SOUTHERN, -5), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', FOREIGN_AID, -2), + create_effect('attack', CLOSEST_TO_DEFEAT, -1, INITIATIVE_PLAYER), + create_effect('attack', SOUTHERN, -5, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -1254,9 +1268,9 @@ const data = { { id: 85, effects: [ - create_effect('attack', SOUTHERN, -6), - create_effect('attack', MADRID, -2), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1), + create_effect('attack', SOUTHERN, -6, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -2, INITIATIVE_PLAYER), + create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -1271,10 +1285,10 @@ const data = { { id: 86, effects: [ - create_effect('attack', CLOSEST_TO_DEFEAT, -2), - create_effect('attack', MADRID, -5), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', SOVIET_SUPPORT, -1) + create_effect('attack', CLOSEST_TO_DEFEAT, -2, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -5, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -1, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1289,9 +1303,9 @@ const data = { { id: 87, effects: [ - create_effect('attack', SOUTHERN, -4), - create_effect('attack', ARAGON, -3), - create_effect('track', SOVIET_SUPPORT, -2) + create_effect('attack', SOUTHERN, -4, INITIATIVE_PLAYER), + create_effect('attack', ARAGON, -3, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -1306,9 +1320,9 @@ const data = { { id: 88, effects: [ - create_effect('attack', MADRID, -5), - create_effect('attack', SOUTHERN, -2), - create_effect('track', SOVIET_SUPPORT, -2) + create_effect('attack', MADRID, -5, INITIATIVE_PLAYER), + create_effect('attack', SOUTHERN, -2, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1323,9 +1337,9 @@ const data = { { id: 89, effects: [ - create_effect('attack', SOUTHERN, -7), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', COLLECTIVIZATION, -1) + create_effect('attack', SOUTHERN, -7, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -1340,9 +1354,9 @@ const data = { { id: 90, effects: [ - create_effect('attack', ARAGON, -4), - create_effect('attack', NORTHERN, -4), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1) + create_effect('attack', ARAGON, -4, INITIATIVE_PLAYER), + create_effect('attack', NORTHERN, -4, INITIATIVE_PLAYER), + create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1357,10 +1371,10 @@ const data = { { id: 91, effects: [ - create_effect('attack', MADRID, -5), - create_effect('attack', SOUTHERN, -4), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', SOVIET_SUPPORT, -2) + create_effect('attack', MADRID, -5, INITIATIVE_PLAYER), + create_effect('attack', SOUTHERN, -4, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1375,10 +1389,10 @@ const data = { { id: 92, effects: [ - create_effect('attack', ARAGON, -6), - create_effect('attack', CLOSEST_TO_VICTORY, -3), - create_effect('track', FOREIGN_AID, -2), - create_effect('track', COLLECTIVIZATION, -1), + create_effect('attack', ARAGON, -6, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -3, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1393,9 +1407,9 @@ const data = { { id: 93, effects: [ - create_effect('attack', NORTHERN, -4), - create_effect('attack', CLOSEST_TO_VICTORY, -6), - create_effect('track', FOREIGN_AID, -2), + create_effect('attack', NORTHERN, -4, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -6, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -1410,9 +1424,9 @@ const data = { { id: 94, effects: [ - create_effect('attack', NORTHERN, -6), - create_effect('attack', SOUTHERN, -4), - create_effect('track', SOVIET_SUPPORT, -2), + create_effect('attack', NORTHERN, -6, INITIATIVE_PLAYER), + create_effect('attack', SOUTHERN, -4, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -1427,9 +1441,9 @@ const data = { { id: 95, effects: [ - create_effect('attack', CLOSEST_TO_DEFEAT, -5), - create_effect('attack', SOUTHERN, -5), - create_effect('track', FOREIGN_AID, -2), + create_effect('attack', CLOSEST_TO_DEFEAT, -5, INITIATIVE_PLAYER), + create_effect('attack', SOUTHERN, -5, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -1444,9 +1458,9 @@ const data = { { id: 96, effects: [ - create_effect('attack', MADRID, -4), - create_effect('attack', CLOSEST_TO_VICTORY, -6), - create_effect('track', COLLECTIVIZATION, -1), + create_effect('attack', MADRID, -4, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -6, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1461,9 +1475,9 @@ const data = { { id: 97, effects: [ - create_effect('attack', MADRID, -6), - create_effect('attack', ARAGON, -4), - create_effect('track', SOVIET_SUPPORT, -2), + create_effect('attack', MADRID, -6, INITIATIVE_PLAYER), + create_effect('attack', ARAGON, -4, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1478,10 +1492,10 @@ const data = { { id: 98, effects: [ - create_effect('attack', NORTHERN, -7), - create_effect('attack', MADRID, -2), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', LIBERTY, -1), + create_effect('attack', NORTHERN, -7, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -2, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', LIBERTY, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -1496,10 +1510,10 @@ const data = { { id: 99, effects: [ - create_effect('attack', NORTHERN, -6), - create_effect('attack', MADRID, -3), - create_effect('track', FOREIGN_AID, -2), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1), + create_effect('attack', NORTHERN, -6, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -3, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), + create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -1514,10 +1528,10 @@ const data = { { id: 100, effects: [ - create_effect('attack', SOUTHERN, -7), - create_effect('attack', CLOSEST_TO_DEFEAT, -2), - create_effect('track', FOREIGN_AID, -2), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1), + create_effect('attack', SOUTHERN, -7, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_DEFEAT, -2, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), + create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -1532,9 +1546,9 @@ const data = { { id: 101, effects: [ - create_effect('attack', ARAGON, -7), - create_effect('attack', MADRID, -3), - create_effect('track', SOVIET_SUPPORT, -2), + create_effect('attack', ARAGON, -7, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -3, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1549,9 +1563,9 @@ const data = { { id: 102, effects: [ - create_effect('attack', MADRID, -6), - create_effect('attack', CLOSEST_TO_VICTORY, -4), - create_effect('track', FOREIGN_AID, -2), + create_effect('attack', MADRID, -6, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -4, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1566,10 +1580,10 @@ const data = { { id: 103, effects: [ - create_effect('attack', MADRID, -7), - create_effect('attack', NORTHERN, -2), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1) + create_effect('attack', MADRID, -7, INITIATIVE_PLAYER), + create_effect('attack', NORTHERN, -2, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1584,10 +1598,10 @@ const data = { { id: 104, effects: [ - create_effect('attack', SOUTHERN, -6), - create_effect('attack', ARAGON, -3), - create_effect('track', SOVIET_SUPPORT, -2), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1) + create_effect('attack', SOUTHERN, -6, INITIATIVE_PLAYER), + create_effect('attack', ARAGON, -3, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), + create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -1602,9 +1616,9 @@ const data = { { id: 105, effects: [ - create_effect('attack', ARAGON, -6), - create_effect('attack', NORTHERN, -4), - create_effect('track', LIBERTY, -1), + create_effect('attack', ARAGON, -6, INITIATIVE_PLAYER), + create_effect('attack', NORTHERN, -4, INITIATIVE_PLAYER), + create_effect('track', LIBERTY, -1, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1619,10 +1633,10 @@ const data = { { id: 106, effects: [ - create_effect('attack', MADRID, -6), - create_effect('attack', CLOSEST_TO_VICTORY, -3), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', LIBERTY, -1), + create_effect('attack', MADRID, -6, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -3, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', LIBERTY, -1, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1637,10 +1651,10 @@ const data = { { id: 107, effects: [ - create_effect('attack', ARAGON, -8), - create_effect('attack', SOUTHERN, -1), - create_effect('track', COLLECTIVIZATION, -1), - create_effect('track', SOVIET_SUPPORT, -2), + create_effect('attack', ARAGON, -8, INITIATIVE_PLAYER), + create_effect('attack', SOUTHERN, -1, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1655,10 +1669,10 @@ const data = { { id: 108, effects: [ - create_effect('attack', CLOSEST_TO_DEFEAT, -3), - create_effect('attack', SOUTHERN, -6), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1) + create_effect('attack', CLOSEST_TO_DEFEAT, -3, INITIATIVE_PLAYER), + create_effect('attack', SOUTHERN, -6, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -1697,7 +1711,7 @@ const data = { top: 426, }, ], - medaillons: [ + medallions: [ { id: 0, name: 'Subterfuge', @@ -1711,27 +1725,27 @@ const data = { name: 'Momentum', }, { - id: 3, + id: STRATEGY_MEDALLION_ID, name: 'Strategy', }, { - id: 4, + id: PROPAGANDA_MEDALLION_ID, name: 'Propaganda', }, { - id: 5, + id: INTELLIGENCE_MEDALLION_ID, name: 'Intelligence', }, { - id: 6, + id: VOLUNTEERS_MEDALLION_ID, name: 'Volunteers', }, { - id: 7, + id: ARCHIVES_MEDALLION_ID, name: 'Archives', }, { - id: 8, + id: ORGANIZATION_MEDALLION_ID, name: 'Organization', }, ], @@ -1748,9 +1762,9 @@ const data = { null, null, create_effect('track', GOVERNMENT, TOWARDS_CENTER), - create_effect('front', ANY, 1), + create_effect('front', ANY, 1, ANARCHISTS_ID), null, - create_effect('medaillon', ANY, 1), + create_effect('medallion', ANY, 1, ANARCHISTS_ID), ], }, { @@ -1767,7 +1781,7 @@ const data = { create_effect('front', ANY, 1), create_effect('track', LIBERTY, 1), null, - create_effect('medaillon', ANY, 1), + create_effect('medallion', ANY, 1, ANARCHISTS_ID), ], }, { @@ -1775,7 +1789,7 @@ const data = { name: 'Government', triggers: [ null, - create_effect('medaillon', ANY, 1), + create_effect('medallion', ANY, 1, COMMUNISTS_ID), null, null, create_effect('track', SOVIET_SUPPORT, 1), @@ -1784,7 +1798,7 @@ const data = { create_effect('track', FOREIGN_AID, 1), null, null, - create_effect('medaillon', ANY, 1), + create_effect('medallion', ANY, 1, MODERATES_ID), ], }, { @@ -1798,10 +1812,10 @@ const data = { null, create_effect('track', LIBERTY, -1), null, - create_effect('front', ANY, 1), + create_effect('front', ANY, 1, COMMUNISTS_ID), create_effect('track', GOVERNMENT, -1), null, - create_effect('medaillon', ANY, 1), + create_effect('medallion', ANY, 1, COMMUNISTS_ID), ], }, { @@ -1815,10 +1829,10 @@ const data = { null, create_effect('track', LIBERTY, -1), null, - create_effect('front', ANY, 1), + create_effect('front', ANY, 1, MODERATES_ID), create_effect('track', GOVERNMENT, 1), null, - create_effect('medaillon', ANY, 1), + create_effect('medallion', ANY, 1, MODERATES_ID), ], }, ], diff --git a/data.ts b/data.ts index 7c61705..2f51434 100644 --- a/data.ts +++ b/data.ts @@ -43,15 +43,24 @@ const MODERATE = 'Moderate' as Player; const VICTORY = 'Victory'; const DEFEAT = 'Defeat'; +const STRATEGY_MEDALLION_ID = 3; +const PROPAGANDA_MEDALLION_ID = 4; +const INTELLIGENCE_MEDALLION_ID = 5; +const VOLUNTEERS_MEDALLION_ID = 6; +const ARCHIVES_MEDALLION_ID = 7; +const ORGANIZATION_MEDALLION_ID = 8; + function create_effect( type: Effect['type'], target: Effect['target'], - value: Effect['value'] + value: Effect['value'], + faction?: Effect['faction'] ): Effect { return { type, target, value, + faction, }; } @@ -69,6 +78,7 @@ export { CLOSEST_TO_VICTORY, COLLECTIVIZATION, GOVERNMENT, + INITIATIVE_PLAYER, SOVIET_SUPPORT, FOREIGN_AID, MORALE_BONUS, @@ -84,10 +94,14 @@ export { VICTORY, DEFEAT, FRONTS, + STRATEGY_MEDALLION_ID, + PROPAGANDA_MEDALLION_ID, + INTELLIGENCE_MEDALLION_ID, + VOLUNTEERS_MEDALLION_ID, + ARCHIVES_MEDALLION_ID, + ORGANIZATION_MEDALLION_ID, }; - - const data: StaticData = { cards: [ {} as Card, @@ -786,9 +800,9 @@ const data: StaticData = { { id: 55, effects: [ - create_effect('attack', SOUTHERN, -4), - create_effect('attack', ARAGON, -1), - create_effect('track', SOVIET_SUPPORT, -2), + create_effect('attack', SOUTHERN, -4, INITIATIVE_PLAYER), + create_effect('attack', ARAGON, -1, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -803,9 +817,9 @@ const data: StaticData = { { id: 56, effects: [ - create_effect('attack', SOUTHERN, -3), - create_effect('attack', CLOSEST_TO_VICTORY, -2), - create_effect('bonus', MORALE_BONUS, OFF), + create_effect('attack', SOUTHERN, -3, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -2, INITIATIVE_PLAYER), + create_effect('bonus', MORALE_BONUS, OFF, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -820,9 +834,14 @@ const data: StaticData = { { id: 57, effects: [ - create_effect('attack', MADRID, -5), - create_effect('track', FOREIGN_AID, -2), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1), + create_effect('attack', MADRID, -5, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), + create_effect( + 'hero_points', + PLAYER_WITH_MOST_HERO_POINTS, + -1, + INITIATIVE_PLAYER + ), ], test: { front: MADRID, @@ -837,9 +856,9 @@ const data: StaticData = { { id: 58, effects: [ - create_effect('attack', NORTHERN, -5), - create_effect('attack', CLOSEST_TO_VICTORY, -1), - create_effect('track', COLLECTIVIZATION, -1), + create_effect('attack', NORTHERN, -5, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -1, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -854,9 +873,9 @@ const data: StaticData = { { id: 59, effects: [ - create_effect('attack', MADRID, -4), - create_effect('attack', CLOSEST_TO_VICTORY, -2), - create_effect('track', LIBERTY, -1), + create_effect('attack', MADRID, -4, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -2, INITIATIVE_PLAYER), + create_effect('track', LIBERTY, -1, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -871,9 +890,9 @@ const data: StaticData = { { id: 60, effects: [ - create_effect('attack', NORTHERN, -3), - create_effect('attack', CLOSEST_TO_VICTORY, -3), - create_effect('track', LIBERTY, -1), + create_effect('attack', NORTHERN, -3, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -3, INITIATIVE_PLAYER), + create_effect('track', LIBERTY, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -888,9 +907,14 @@ const data: StaticData = { { id: 61, effects: [ - create_effect('attack', ARAGON, -4), - create_effect('attack', CLOSEST_TO_VICTORY, -2), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1), + create_effect('attack', ARAGON, -4, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -2, INITIATIVE_PLAYER), + create_effect( + 'hero_points', + PLAYER_WITH_MOST_HERO_POINTS, + -1, + INITIATIVE_PLAYER + ), ], test: { front: ARAGON, @@ -905,9 +929,9 @@ const data: StaticData = { { id: 62, effects: [ - create_effect('attack', SOUTHERN, -5), - create_effect('bonus', MORALE_BONUS, OFF), - create_effect('track', LIBERTY, -1), + create_effect('attack', SOUTHERN, -5, INITIATIVE_PLAYER), + create_effect('bonus', MORALE_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', LIBERTY, -1, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -922,9 +946,9 @@ const data: StaticData = { { id: 63, effects: [ - create_effect('attack', CLOSEST_TO_VICTORY, -5), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', COLLECTIVIZATION, -1), + create_effect('attack', CLOSEST_TO_VICTORY, -5, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -939,9 +963,9 @@ const data: StaticData = { { id: 64, effects: [ - create_effect('attack', SOUTHERN, -4), - create_effect('attack', MADRID, -2), - create_effect('track', FOREIGN_AID, -1), + create_effect('attack', SOUTHERN, -4, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -2, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -1, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -956,9 +980,9 @@ const data: StaticData = { { id: 65, effects: [ - create_effect('attack', CLOSEST_TO_DEFEAT, -1), - create_effect('attack', MADRID, -4), - create_effect('track', SOVIET_SUPPORT, -2), + create_effect('attack', CLOSEST_TO_DEFEAT, -1, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -4, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -973,9 +997,9 @@ const data: StaticData = { { id: 66, effects: [ - create_effect('attack', ARAGON, -3), - create_effect('attack', SOUTHERN, -2), - create_effect('track', FOREIGN_AID, -2), + create_effect('attack', ARAGON, -3, INITIATIVE_PLAYER), + create_effect('attack', SOUTHERN, -2, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -990,9 +1014,9 @@ const data: StaticData = { { id: 67, effects: [ - create_effect('attack', NORTHERN, -4), - create_effect('attack', ARAGON, -2), - create_effect('track', COLLECTIVIZATION, -1), + create_effect('attack', NORTHERN, -4, INITIATIVE_PLAYER), + create_effect('attack', ARAGON, -2, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -1007,9 +1031,9 @@ const data: StaticData = { { id: 68, effects: [ - create_effect('attack', ARAGON, -4), - create_effect('attack', MADRID, -1), - create_effect('bonus', TEAMWORK_BONUS, OFF), + create_effect('attack', ARAGON, -4, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -1, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1024,9 +1048,9 @@ const data: StaticData = { { id: 69, effects: [ - create_effect('attack', MADRID, -3), - create_effect('attack', NORTHERN, -2), - create_effect('bonus', TEAMWORK_BONUS, OFF), + create_effect('attack', MADRID, -3, INITIATIVE_PLAYER), + create_effect('attack', NORTHERN, -2, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1041,9 +1065,9 @@ const data: StaticData = { { id: 70, effects: [ - create_effect('attack', NORTHERN, -3), - create_effect('attack', MADRID, -3), - create_effect('track', FOREIGN_AID, -1), + create_effect('attack', NORTHERN, -3, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -3, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -1058,9 +1082,9 @@ const data: StaticData = { { id: 71, effects: [ - create_effect('attack', CLOSEST_TO_DEFEAT, -3), - create_effect('attack', MADRID, -2), - create_effect('track', SOVIET_SUPPORT, -2), + create_effect('attack', CLOSEST_TO_DEFEAT, -3, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -2, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1075,9 +1099,9 @@ const data: StaticData = { { id: 72, effects: [ - create_effect('attack', ARAGON, -3), - create_effect('attack', NORTHERN, -1), - create_effect('attack', CLOSEST_TO_VICTORY, -2), + create_effect('attack', ARAGON, -3, INITIATIVE_PLAYER), + create_effect('attack', NORTHERN, -1, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -2, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1092,10 +1116,15 @@ const data: StaticData = { { id: 73, effects: [ - create_effect('attack', NORTHERN, -6), - create_effect('attack', CLOSEST_TO_VICTORY, -1), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1), + create_effect('attack', NORTHERN, -6, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -1, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect( + 'hero_points', + PLAYER_WITH_MOST_HERO_POINTS, + -1, + INITIATIVE_PLAYER + ), ], test: { front: NORTHERN, @@ -1110,9 +1139,9 @@ const data: StaticData = { { id: 74, effects: [ - create_effect('attack', MADRID, -2), - create_effect('attack', CLOSEST_TO_VICTORY, -5), - create_effect('track', SOVIET_SUPPORT, -2), + create_effect('attack', MADRID, -2, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -5, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1127,9 +1156,9 @@ const data: StaticData = { { id: 75, effects: [ - create_effect('attack', NORTHERN, -5), - create_effect('attack', CLOSEST_TO_VICTORY, -3), - create_effect('track', COLLECTIVIZATION, -1), + create_effect('attack', NORTHERN, -5, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -3, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -1144,9 +1173,9 @@ const data: StaticData = { { id: 76, effects: [ - create_effect('attack', ARAGON, -5), - create_effect('attack', NORTHERN, -2), - create_effect('track', FOREIGN_AID, -2), + create_effect('attack', ARAGON, -5, INITIATIVE_PLAYER), + create_effect('attack', NORTHERN, -2, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1161,9 +1190,9 @@ const data: StaticData = { { id: 77, effects: [ - create_effect('attack', ARAGON, -5), - create_effect('attack', MADRID, -3), - create_effect('track', FOREIGN_AID, -1), + create_effect('attack', ARAGON, -5, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -3, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -1, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1178,10 +1207,10 @@ const data: StaticData = { { id: 78, effects: [ - create_effect('attack', MADRID, -6), - create_effect('attack', CLOSEST_TO_VICTORY, -1), - create_effect('track', LIBERTY, -1), - create_effect('track', SOVIET_SUPPORT, -1), + create_effect('attack', MADRID, -6, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -1, INITIATIVE_PLAYER), + create_effect('track', LIBERTY, -1, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -1, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1196,10 +1225,10 @@ const data: StaticData = { { id: 79, effects: [ - create_effect('attack', NORTHERN, -6), - create_effect('attack', MADRID, -1), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', COLLECTIVIZATION, -1), + create_effect('attack', NORTHERN, -6, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -1, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -1214,9 +1243,9 @@ const data: StaticData = { { id: 80, effects: [ - create_effect('attack', CLOSEST_TO_DEFEAT, -3), - create_effect('attack', NORTHERN, -5), - create_effect('track', LIBERTY, -1), + create_effect('attack', CLOSEST_TO_DEFEAT, -3, INITIATIVE_PLAYER), + create_effect('attack', NORTHERN, -5, INITIATIVE_PLAYER), + create_effect('track', LIBERTY, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -1231,9 +1260,9 @@ const data: StaticData = { { id: 81, effects: [ - create_effect('attack', MADRID, -5), - create_effect('attack', CLOSEST_TO_VICTORY, -2), - create_effect('track', FOREIGN_AID, -2), + create_effect('attack', MADRID, -5, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -2, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1248,9 +1277,9 @@ const data: StaticData = { { id: 82, effects: [ - create_effect('attack', CLOSEST_TO_DEFEAT, -4), - create_effect('attack', CLOSEST_TO_VICTORY, -4), - create_effect('track', COLLECTIVIZATION, -1), + create_effect('attack', CLOSEST_TO_DEFEAT, -4, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -4, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1265,9 +1294,9 @@ const data: StaticData = { { id: 83, effects: [ - create_effect('attack', ARAGON, -7), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', FOREIGN_AID, -1), + create_effect('attack', ARAGON, -7, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -1, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1282,10 +1311,10 @@ const data: StaticData = { { id: 84, effects: [ - create_effect('attack', CLOSEST_TO_DEFEAT, -1), - create_effect('attack', SOUTHERN, -5), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', FOREIGN_AID, -2), + create_effect('attack', CLOSEST_TO_DEFEAT, -1, INITIATIVE_PLAYER), + create_effect('attack', SOUTHERN, -5, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -1300,9 +1329,14 @@ const data: StaticData = { { id: 85, effects: [ - create_effect('attack', SOUTHERN, -6), - create_effect('attack', MADRID, -2), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1), + create_effect('attack', SOUTHERN, -6, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -2, INITIATIVE_PLAYER), + create_effect( + 'hero_points', + PLAYER_WITH_MOST_HERO_POINTS, + -1, + INITIATIVE_PLAYER + ), ], test: { front: SOUTHERN, @@ -1317,10 +1351,10 @@ const data: StaticData = { { id: 86, effects: [ - create_effect('attack', CLOSEST_TO_DEFEAT, -2), - create_effect('attack', MADRID, -5), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', SOVIET_SUPPORT, -1) + create_effect('attack', CLOSEST_TO_DEFEAT, -2, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -5, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -1, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1335,9 +1369,9 @@ const data: StaticData = { { id: 87, effects: [ - create_effect('attack', SOUTHERN, -4), - create_effect('attack', ARAGON, -3), - create_effect('track', SOVIET_SUPPORT, -2) + create_effect('attack', SOUTHERN, -4, INITIATIVE_PLAYER), + create_effect('attack', ARAGON, -3, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -1352,9 +1386,9 @@ const data: StaticData = { { id: 88, effects: [ - create_effect('attack', MADRID, -5), - create_effect('attack', SOUTHERN, -2), - create_effect('track', SOVIET_SUPPORT, -2) + create_effect('attack', MADRID, -5, INITIATIVE_PLAYER), + create_effect('attack', SOUTHERN, -2, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1369,9 +1403,9 @@ const data: StaticData = { { id: 89, effects: [ - create_effect('attack', SOUTHERN, -7), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', COLLECTIVIZATION, -1) + create_effect('attack', SOUTHERN, -7, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -1386,9 +1420,14 @@ const data: StaticData = { { id: 90, effects: [ - create_effect('attack', ARAGON, -4), - create_effect('attack', NORTHERN, -4), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1) + create_effect('attack', ARAGON, -4, INITIATIVE_PLAYER), + create_effect('attack', NORTHERN, -4, INITIATIVE_PLAYER), + create_effect( + 'hero_points', + PLAYER_WITH_MOST_HERO_POINTS, + -1, + INITIATIVE_PLAYER + ), ], test: { front: ARAGON, @@ -1403,10 +1442,10 @@ const data: StaticData = { { id: 91, effects: [ - create_effect('attack', MADRID, -5), - create_effect('attack', SOUTHERN, -4), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', SOVIET_SUPPORT, -2) + create_effect('attack', MADRID, -5, INITIATIVE_PLAYER), + create_effect('attack', SOUTHERN, -4, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1421,10 +1460,10 @@ const data: StaticData = { { id: 92, effects: [ - create_effect('attack', ARAGON, -6), - create_effect('attack', CLOSEST_TO_VICTORY, -3), - create_effect('track', FOREIGN_AID, -2), - create_effect('track', COLLECTIVIZATION, -1), + create_effect('attack', ARAGON, -6, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -3, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1439,9 +1478,9 @@ const data: StaticData = { { id: 93, effects: [ - create_effect('attack', NORTHERN, -4), - create_effect('attack', CLOSEST_TO_VICTORY, -6), - create_effect('track', FOREIGN_AID, -2), + create_effect('attack', NORTHERN, -4, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -6, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -1456,9 +1495,9 @@ const data: StaticData = { { id: 94, effects: [ - create_effect('attack', NORTHERN, -6), - create_effect('attack', SOUTHERN, -4), - create_effect('track', SOVIET_SUPPORT, -2), + create_effect('attack', NORTHERN, -6, INITIATIVE_PLAYER), + create_effect('attack', SOUTHERN, -4, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -1473,9 +1512,9 @@ const data: StaticData = { { id: 95, effects: [ - create_effect('attack', CLOSEST_TO_DEFEAT, -5), - create_effect('attack', SOUTHERN, -5), - create_effect('track', FOREIGN_AID, -2), + create_effect('attack', CLOSEST_TO_DEFEAT, -5, INITIATIVE_PLAYER), + create_effect('attack', SOUTHERN, -5, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), ], test: { front: SOUTHERN, @@ -1490,9 +1529,9 @@ const data: StaticData = { { id: 96, effects: [ - create_effect('attack', MADRID, -4), - create_effect('attack', CLOSEST_TO_VICTORY, -6), - create_effect('track', COLLECTIVIZATION, -1), + create_effect('attack', MADRID, -4, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -6, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1507,9 +1546,9 @@ const data: StaticData = { { id: 97, effects: [ - create_effect('attack', MADRID, -6), - create_effect('attack', ARAGON, -4), - create_effect('track', SOVIET_SUPPORT, -2), + create_effect('attack', MADRID, -6, INITIATIVE_PLAYER), + create_effect('attack', ARAGON, -4, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1524,10 +1563,10 @@ const data: StaticData = { { id: 98, effects: [ - create_effect('attack', NORTHERN, -7), - create_effect('attack', MADRID, -2), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', LIBERTY, -1), + create_effect('attack', NORTHERN, -7, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -2, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', LIBERTY, -1, INITIATIVE_PLAYER), ], test: { front: NORTHERN, @@ -1542,10 +1581,15 @@ const data: StaticData = { { id: 99, effects: [ - create_effect('attack', NORTHERN, -6), - create_effect('attack', MADRID, -3), - create_effect('track', FOREIGN_AID, -2), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1), + create_effect('attack', NORTHERN, -6, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -3, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), + create_effect( + 'hero_points', + PLAYER_WITH_MOST_HERO_POINTS, + -1, + INITIATIVE_PLAYER + ), ], test: { front: NORTHERN, @@ -1560,10 +1604,15 @@ const data: StaticData = { { id: 100, effects: [ - create_effect('attack', SOUTHERN, -7), - create_effect('attack', CLOSEST_TO_DEFEAT, -2), - create_effect('track', FOREIGN_AID, -2), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1), + create_effect('attack', SOUTHERN, -7, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_DEFEAT, -2, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), + create_effect( + 'hero_points', + PLAYER_WITH_MOST_HERO_POINTS, + -1, + INITIATIVE_PLAYER + ), ], test: { front: SOUTHERN, @@ -1578,9 +1627,9 @@ const data: StaticData = { { id: 101, effects: [ - create_effect('attack', ARAGON, -7), - create_effect('attack', MADRID, -3), - create_effect('track', SOVIET_SUPPORT, -2), + create_effect('attack', ARAGON, -7, INITIATIVE_PLAYER), + create_effect('attack', MADRID, -3, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1595,9 +1644,9 @@ const data: StaticData = { { id: 102, effects: [ - create_effect('attack', MADRID, -6), - create_effect('attack', CLOSEST_TO_VICTORY, -4), - create_effect('track', FOREIGN_AID, -2), + create_effect('attack', MADRID, -6, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -4, INITIATIVE_PLAYER), + create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1612,10 +1661,15 @@ const data: StaticData = { { id: 103, effects: [ - create_effect('attack', MADRID, -7), - create_effect('attack', NORTHERN, -2), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1) + create_effect('attack', MADRID, -7, INITIATIVE_PLAYER), + create_effect('attack', NORTHERN, -2, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect( + 'hero_points', + PLAYER_WITH_MOST_HERO_POINTS, + -1, + INITIATIVE_PLAYER + ), ], test: { front: MADRID, @@ -1630,10 +1684,15 @@ const data: StaticData = { { id: 104, effects: [ - create_effect('attack', SOUTHERN, -6), - create_effect('attack', ARAGON, -3), - create_effect('track', SOVIET_SUPPORT, -2), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1) + create_effect('attack', SOUTHERN, -6, INITIATIVE_PLAYER), + create_effect('attack', ARAGON, -3, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), + create_effect( + 'hero_points', + PLAYER_WITH_MOST_HERO_POINTS, + -1, + INITIATIVE_PLAYER + ), ], test: { front: SOUTHERN, @@ -1648,9 +1707,9 @@ const data: StaticData = { { id: 105, effects: [ - create_effect('attack', ARAGON, -6), - create_effect('attack', NORTHERN, -4), - create_effect('track', LIBERTY, -1), + create_effect('attack', ARAGON, -6, INITIATIVE_PLAYER), + create_effect('attack', NORTHERN, -4, INITIATIVE_PLAYER), + create_effect('track', LIBERTY, -1, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1665,10 +1724,10 @@ const data: StaticData = { { id: 106, effects: [ - create_effect('attack', MADRID, -6), - create_effect('attack', CLOSEST_TO_VICTORY, -3), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('track', LIBERTY, -1), + create_effect('attack', MADRID, -6, INITIATIVE_PLAYER), + create_effect('attack', CLOSEST_TO_VICTORY, -3, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect('track', LIBERTY, -1, INITIATIVE_PLAYER), ], test: { front: MADRID, @@ -1683,10 +1742,10 @@ const data: StaticData = { { id: 107, effects: [ - create_effect('attack', ARAGON, -8), - create_effect('attack', SOUTHERN, -1), - create_effect('track', COLLECTIVIZATION, -1), - create_effect('track', SOVIET_SUPPORT, -2), + create_effect('attack', ARAGON, -8, INITIATIVE_PLAYER), + create_effect('attack', SOUTHERN, -1, INITIATIVE_PLAYER), + create_effect('track', COLLECTIVIZATION, -1, INITIATIVE_PLAYER), + create_effect('track', SOVIET_SUPPORT, -2, INITIATIVE_PLAYER), ], test: { front: ARAGON, @@ -1701,10 +1760,15 @@ const data: StaticData = { { id: 108, effects: [ - create_effect('attack', CLOSEST_TO_DEFEAT, -3), - create_effect('attack', SOUTHERN, -6), - create_effect('bonus', TEAMWORK_BONUS, OFF), - create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1) + create_effect('attack', CLOSEST_TO_DEFEAT, -3, INITIATIVE_PLAYER), + create_effect('attack', SOUTHERN, -6, INITIATIVE_PLAYER), + create_effect('bonus', TEAMWORK_BONUS, OFF, INITIATIVE_PLAYER), + create_effect( + 'hero_points', + PLAYER_WITH_MOST_HERO_POINTS, + -1, + INITIATIVE_PLAYER + ), ], test: { front: SOUTHERN, @@ -1743,7 +1807,7 @@ const data: StaticData = { top: 426, }, ], - medaillons: [ + medallions: [ { id: 0, name: 'Subterfuge', @@ -1757,27 +1821,27 @@ const data: StaticData = { name: 'Momentum', }, { - id: 3, + id: STRATEGY_MEDALLION_ID, name: 'Strategy', }, { - id: 4, + id: PROPAGANDA_MEDALLION_ID, name: 'Propaganda', }, { - id: 5, + id: INTELLIGENCE_MEDALLION_ID, name: 'Intelligence', }, { - id: 6, + id: VOLUNTEERS_MEDALLION_ID, name: 'Volunteers', }, { - id: 7, + id: ARCHIVES_MEDALLION_ID, name: 'Archives', }, { - id: 8, + id: ORGANIZATION_MEDALLION_ID, name: 'Organization', }, ], @@ -1794,9 +1858,9 @@ const data: StaticData = { null, null, create_effect('track', GOVERNMENT, TOWARDS_CENTER), - create_effect('front', ANY, 1), + create_effect('front', ANY, 1, ANARCHISTS_ID), null, - create_effect('medaillon', ANY, 1), + create_effect('medallion', ANY, 1, ANARCHISTS_ID), ], }, { @@ -1813,7 +1877,7 @@ const data: StaticData = { create_effect('front', ANY, 1), create_effect('track', LIBERTY, 1), null, - create_effect('medaillon', ANY, 1), + create_effect('medallion', ANY, 1, ANARCHISTS_ID), ], }, { @@ -1821,7 +1885,7 @@ const data: StaticData = { name: 'Government', triggers: [ null, - create_effect('medaillon', ANY, 1), + create_effect('medallion', ANY, 1, COMMUNISTS_ID), null, null, create_effect('track', SOVIET_SUPPORT, 1), @@ -1830,7 +1894,7 @@ const data: StaticData = { create_effect('track', FOREIGN_AID, 1), null, null, - create_effect('medaillon', ANY, 1), + create_effect('medallion', ANY, 1, MODERATES_ID), ], }, { @@ -1844,10 +1908,10 @@ const data: StaticData = { null, create_effect('track', LIBERTY, -1), null, - create_effect('front', ANY, 1), + create_effect('front', ANY, 1, COMMUNISTS_ID), create_effect('track', GOVERNMENT, -1), null, - create_effect('medaillon', ANY, 1), + create_effect('medallion', ANY, 1, COMMUNISTS_ID), ], }, { @@ -1861,10 +1925,10 @@ const data: StaticData = { null, create_effect('track', LIBERTY, -1), null, - create_effect('front', ANY, 1), + create_effect('front', ANY, 1, MODERATES_ID), create_effect('track', GOVERNMENT, 1), null, - create_effect('medaillon', ANY, 1), + create_effect('medallion', ANY, 1, MODERATES_ID), ], }, ], diff --git a/images/medaillons/medaillon_0.png b/images/medaillons/medaillon_0.png deleted file mode 100644 index acec979..0000000 Binary files a/images/medaillons/medaillon_0.png and /dev/null differ diff --git a/images/medaillons/medaillon_1.png b/images/medaillons/medaillon_1.png deleted file mode 100644 index 8ad2d04..0000000 Binary files a/images/medaillons/medaillon_1.png and /dev/null differ diff --git a/images/medaillons/medaillon_2.png b/images/medaillons/medaillon_2.png deleted file mode 100644 index 4200d41..0000000 Binary files a/images/medaillons/medaillon_2.png and /dev/null differ diff --git a/images/medaillons/medaillon_3.png b/images/medaillons/medaillon_3.png deleted file mode 100644 index 0733f78..0000000 Binary files a/images/medaillons/medaillon_3.png and /dev/null differ diff --git a/images/medaillons/medaillon_4.png b/images/medaillons/medaillon_4.png deleted file mode 100644 index ad18b04..0000000 Binary files a/images/medaillons/medaillon_4.png and /dev/null differ diff --git a/images/medaillons/medaillon_5.png b/images/medaillons/medaillon_5.png deleted file mode 100644 index 4c27495..0000000 Binary files a/images/medaillons/medaillon_5.png and /dev/null differ diff --git a/images/medaillons/medaillon_6.png b/images/medaillons/medaillon_6.png deleted file mode 100644 index ead86f3..0000000 Binary files a/images/medaillons/medaillon_6.png and /dev/null differ diff --git a/images/medaillons/medaillon_7.png b/images/medaillons/medaillon_7.png deleted file mode 100644 index acc4053..0000000 Binary files a/images/medaillons/medaillon_7.png and /dev/null differ diff --git a/images/medaillons/medaillon_8.png b/images/medaillons/medaillon_8.png deleted file mode 100644 index e228bb9..0000000 Binary files a/images/medaillons/medaillon_8.png and /dev/null differ diff --git a/images/medallions/medallion_0.png b/images/medallions/medallion_0.png new file mode 100644 index 0000000..acec979 Binary files /dev/null and b/images/medallions/medallion_0.png differ diff --git a/images/medallions/medallion_1.png b/images/medallions/medallion_1.png new file mode 100644 index 0000000..8ad2d04 Binary files /dev/null and b/images/medallions/medallion_1.png differ diff --git a/images/medallions/medallion_2.png b/images/medallions/medallion_2.png new file mode 100644 index 0000000..4200d41 Binary files /dev/null and b/images/medallions/medallion_2.png differ diff --git a/images/medallions/medallion_3.png b/images/medallions/medallion_3.png new file mode 100644 index 0000000..0733f78 Binary files /dev/null and b/images/medallions/medallion_3.png differ diff --git a/images/medallions/medallion_4.png b/images/medallions/medallion_4.png new file mode 100644 index 0000000..ad18b04 Binary files /dev/null and b/images/medallions/medallion_4.png differ diff --git a/images/medallions/medallion_5.png b/images/medallions/medallion_5.png new file mode 100644 index 0000000..4c27495 Binary files /dev/null and b/images/medallions/medallion_5.png differ diff --git a/images/medallions/medallion_6.png b/images/medallions/medallion_6.png new file mode 100644 index 0000000..ead86f3 Binary files /dev/null and b/images/medallions/medallion_6.png differ diff --git a/images/medallions/medallion_7.png b/images/medallions/medallion_7.png new file mode 100644 index 0000000..acc4053 Binary files /dev/null and b/images/medallions/medallion_7.png differ diff --git a/images/medallions/medallion_8.png b/images/medallions/medallion_8.png new file mode 100644 index 0000000..e228bb9 Binary files /dev/null and b/images/medallions/medallion_8.png differ diff --git a/land-and-freedom.css b/land-and-freedom.css index 5fff93b..afa3a6f 100644 --- a/land-and-freedom.css +++ b/land-and-freedom.css @@ -43,6 +43,20 @@ main { grid-row: 2; } +.role_medallions { + grid-row: 3; + grid-column: 1/3; + padding: 3px 4px; + display: flex; + flex-direction: row-reverse; + gap: 4px; +} + +.role_info { + grid-row: 4; + grid-column: 1/3; +} + #role_Anarchist { background-color: rgb(93, 89, 106); } @@ -646,17 +660,25 @@ main { z-index: 1; } +.blank_marker.action, .bonus.action, .card.action, .front.action, +.medallion.action, .standee.action { box-shadow: 0 0 0 3px white; } +.blank_marker.action { + z-index: 2; +} + +.blank_marker.action:hover, .bonus.action:hover, .card.action:hover, .card.selected, .front.action:hover, +.medallion.action:hover, .standee.action:hover { box-shadow: 0 0 0 3px yellow; } @@ -707,9 +729,7 @@ main { background-image: url("images/bonus/bonus_1_on.png"); } -.medaillon { - box-sizing: border-box; - position: absolute; +.medallion { width: 47px; height: 47px; background-size: cover; @@ -718,40 +738,45 @@ main { border-radius: 10px; } -.medaillon[data-medaillon-id="0"] { - background-image: url("images/medaillons/medaillon_0.png"); +#medallions .medallion { + box-sizing: border-box; + position: absolute; +} + +.medallion[data-medallion-id="0"] { + background-image: url("images/medallions/medallion_0.png"); } -.medaillon[data-medaillon-id="1"] { - background-image: url("images/medaillons/medaillon_1.png"); +.medallion[data-medallion-id="1"] { + background-image: url("images/medallions/medallion_1.png"); } -.medaillon[data-medaillon-id="2"] { - background-image: url("images/medaillons/medaillon_2.png"); +.medallion[data-medallion-id="2"] { + background-image: url("images/medallions/medallion_2.png"); } -.medaillon[data-medaillon-id="3"] { - background-image: url("images/medaillons/medaillon_3.png"); +.medallion[data-medallion-id="3"] { + background-image: url("images/medallions/medallion_3.png"); } -.medaillon[data-medaillon-id="4"] { - background-image: url("images/medaillons/medaillon_4.png"); +.medallion[data-medallion-id="4"] { + background-image: url("images/medallions/medallion_4.png"); } -.medaillon[data-medaillon-id="5"] { - background-image: url("images/medaillons/medaillon_5.png"); +.medallion[data-medallion-id="5"] { + background-image: url("images/medallions/medallion_5.png"); } -.medaillon[data-medaillon-id="6"] { - background-image: url("images/medaillons/medaillon_6.png"); +.medallion[data-medallion-id="6"] { + background-image: url("images/medallions/medallion_6.png"); } -.medaillon[data-medaillon-id="7"] { - background-image: url("images/medaillons/medaillon_7.png"); +.medallion[data-medallion-id="7"] { + background-image: url("images/medallions/medallion_7.png"); } -.medaillon[data-medaillon-id="8"] { - background-image: url("images/medaillons/medaillon_8.png"); +.medallion[data-medallion-id="8"] { + background-image: url("images/medallions/medallion_8.png"); } #log { diff --git a/land-and-freedom.scss b/land-and-freedom.scss index 6385944..ec183e5 100644 --- a/land-and-freedom.scss +++ b/land-and-freedom.scss @@ -67,6 +67,20 @@ main { grid-row: 2; } +.role_medallions { + grid-row: 3; + grid-column: 1 / 3; + padding: 3px 4px; + display: flex; + flex-direction: row-reverse; + gap: 4px; +} + +.role_info { + grid-row: 4; + grid-column: 1 / 3; +} + // #role_Anarchist::before { // background-color: $anarchist-color; // content: ' '; @@ -93,10 +107,10 @@ main { } .role { - color:floralwhite; + color: floralwhite; a { - color:floralwhite; + color: floralwhite; } } @@ -288,17 +302,25 @@ main { // opacity: 0.6; } +.blank_marker.action, .bonus.action, .card.action, .front.action, +.medallion.action, .standee.action { box-shadow: 0 0 0 3px $selectable-color; } +.blank_marker.action { + z-index: 2; +} + +.blank_marker.action:hover, .bonus.action:hover, .card.action:hover, .card.selected, .front.action:hover, +.medallion.action:hover, .standee.action:hover { box-shadow: 0 0 0 3px $selected-color; } @@ -332,9 +354,7 @@ main { } } -.medaillon { - box-sizing: border-box; - position: absolute; +.medallion { width: 47px; height: 47px; background-size: cover; @@ -343,9 +363,14 @@ main { border-radius: 10px; } +#medallions .medallion { + box-sizing: border-box; + position: absolute; +} + @for $i from 0 through 8 { - .medaillon[data-medaillon-id='#{$i}'] { - background-image: url('images/medaillons/medaillon_#{$i}.png'); + .medallion[data-medallion-id='#{$i}'] { + background-image: url('images/medallions/medallion_#{$i}.png'); } } @@ -369,18 +394,24 @@ main { } #log .h2.anarchist { background-color: $anarchist-color; - color:floralwhite; + color: floralwhite; } #log .h2.communist { background-color: $communist-color; - color:floralwhite; + color: floralwhite; } #log .h2.moderate { background-color: $moderate-color; - color:floralwhite; + color: floralwhite; } #log .h2.fascist { background-color: $fascist-color; } -#log div.i { padding-left: 32px; text-indent: -12px; } -#log div.ii { padding-left: 44px; text-indent: -12px; } \ No newline at end of file +#log div.i { + padding-left: 32px; + text-indent: -12px; +} +#log div.ii { + padding-left: 44px; + text-indent: -12px; +} diff --git a/play.html b/play.html index f7a6189..e7b3e7f 100644 --- a/play.html +++ b/play.html @@ -41,18 +41,21 @@
Anarchist
-
+
Communist
-
+
Moderate
-
+
@@ -85,6 +88,7 @@
+
diff --git a/play.js b/play.js index 1ff8d8d..fa7dcb4 100644 --- a/play.js +++ b/play.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const BONUSES_COUNT = 2; const CARD_COUNT = 109; const GLORY_COUNT = 9; -const MEDAILLONS_COUNT = 5; +const medallionS_COUNT = 9; const STANDEES_COUNT = 5; const TRACK_COUNT = 5; const TRACK_LENGTH = 11; @@ -11,6 +11,7 @@ const FACTIONS = ['a', 'c', 'm']; console.log('roles', document.getElementById('roles')); const ui = { map: document.getElementById('map'), + medallions_container: document.getElementById('medallions'), markers: document.getElementById('markers'), fronts: { a: { @@ -37,15 +38,18 @@ const ui = { glory_container: document.getElementById('glory'), hand: document.getElementById('hand'), current_events: document.getElementById('current_events'), - stats: { + roles: { a: { hero_points: document.querySelector('#role_Anarchist .role_stat'), + medallions: document.querySelector('#role_Anarchist .role_medallions'), }, c: { hero_points: document.querySelector('#role_Communist .role_stat'), + medallions: document.querySelector('#role_Communist .role_medallions'), }, m: { hero_points: document.querySelector('#role_Moderate .role_stat'), + medallions: document.querySelector('#role_Moderate .role_medallions'), }, pool: { hero_points: document.getElementById('pool_hero_points'), @@ -59,11 +63,11 @@ const ui = { tracks: document.getElementById('tracks'), hero_points: document.querySelector('#role_Anarchist .role_stat'), year: document.getElementById('year'), - blank_markers: [[], [], [], [], []], + blank_markers: [], bonuses: [], tokens_on_front: {}, glory: [], - medaillons: [], + medallions: [], spaces: [], standees: [], pieces: [], @@ -91,7 +95,7 @@ const LAYOUT_GLORY = [ [885, 771], [922, 771], ]; -const LAYOUT_MEDAILLONS = [ +const LAYOUT_medallionS = [ [364, 556], [415, 556], [466, 556], @@ -191,11 +195,10 @@ function on_init() { if (on_init_once) return; on_init_once = true; - console.log('ui', ui); - console.log('document', document); - for (let t = 0; t < 5; ++t) { - for (let bm = 0; bm < TRACK_LENGTH; ++bm) { - let e = (ui.blank_markers[t][bm] = document.createElement('div')); + for (let t = 0; t < TRACK_COUNT; ++t) { + for (let s = 0; s < TRACK_LENGTH; ++s) { + const bm = t * 11 + s; + let e = (ui.blank_markers[bm] = document.createElement('div')); e.className = 'blank_marker'; register_action(e, 'blank_marker', bm); } @@ -217,12 +220,11 @@ function on_init() { 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'; - e.setAttribute('data-medaillon-id', '' + m); - register_action(e, 'medaillon', m); - ui.map.appendChild(ui.medaillons[m]); + for (let m = 0; m < medallionS_COUNT; ++m) { + let e = (ui.medallions[m] = document.createElement('div')); + e.className = 'medallion'; + e.setAttribute('data-medallion-id', '' + m); + register_action(e, 'medallion', m); } for (let s = 0; s < STANDEES_COUNT; ++s) { let e = (ui.standees[s] = document.createElement('div')); @@ -254,7 +256,7 @@ 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.roles[key].hero_points.replaceChildren(`Hero Points: ${view.hero_points[key]}`); } ui.current_events.replaceChildren(); for (let i = 0; i < view.current_events.length; i++) { @@ -265,12 +267,12 @@ 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]) { - ui.markers.appendChild(ui.blank_markers[t][bm]); - ui.blank_markers[t][bm].style.left = LAYOUT_TRACKS[t][bm][0] + 'px'; - ui.blank_markers[t][bm].style.top = LAYOUT_TRACKS[t][bm][1] + 'px'; - } + for (let bm of view.triggered_track_effects) { + const s = bm % 11; + const t = Math.floor(bm / 11); + ui.markers.appendChild(ui.blank_markers[bm]); + ui.blank_markers[bm].style.left = LAYOUT_TRACKS[t][s][0] + 'px'; + ui.blank_markers[bm].style.top = LAYOUT_TRACKS[t][s][1] + 'px'; } for (let bonus_id of Object.keys(view.bonuses)) { ui.bonuses[bonus_id].setAttribute('data-bonus-on', view.bonuses[bonus_id] + 0); @@ -295,10 +297,19 @@ function on_update() { ui.fronts[front_id].contributions.appendChild(ui.tokens_on_front[front_id][faction_id]); } } - for (let i = 0; i < view.medaillons.length; ++i) { - if (view.medaillons[i] !== null) { - ui.medaillons[i].style.left = LAYOUT_MEDAILLONS[i][0] + 'px'; - ui.medaillons[i].style.top = LAYOUT_MEDAILLONS[i][1] + 'px'; + ui.medallions_container.replaceChildren(); + for (let i = 0; i < view.medallions.pool.length; ++i) { + if (view.medallions.pool[i] !== null) { + const id = view.medallions.pool[i]; + ui.medallions[id].style.left = LAYOUT_medallionS[i][0] + 'px'; + ui.medallions[id].style.top = LAYOUT_medallionS[i][1] + 'px'; + ui.medallions_container.appendChild(ui.medallions[id]); + } + } + for (let f of FACTIONS) { + ui.roles[f].medallions.replaceChildren(); + for (let m of view.medallions[f]) { + ui.roles[f].medallions.appendChild(ui.medallions[m]); } } for (let faction_id of FACTIONS) { @@ -339,6 +350,9 @@ function on_update() { action_button('up', 'Up'); action_button('down', 'Down'); action_button('next', 'Next'); + action_button('remove_blank_marker', 'Remove Blank marker'); + action_button('yes', 'Yes'); + action_button('no', 'No'); action_button('skip', 'Skip'); action_button('done', 'Done'); action_button('undo', 'Undo'); @@ -347,7 +361,7 @@ function on_log(text) { let p = document.createElement('div'); if (text.match(/^>>/)) { text = text.substring(2); - p.className = "ii"; + p.className = 'ii'; } if (text.match(/^>/)) { text = text.substring(1); diff --git a/play.ts b/play.ts index feb7201..5fbdd4e 100644 --- a/play.ts +++ b/play.ts @@ -14,7 +14,7 @@ const BONUSES_COUNT = 2; // const PIECE_COUNT = 32; const CARD_COUNT = 109; const GLORY_COUNT = 9; -const MEDAILLONS_COUNT = 5; +const medallionS_COUNT = 9; const STANDEES_COUNT = 5; const TRACK_COUNT = 5; const TRACK_LENGTH = 11; @@ -25,6 +25,7 @@ console.log('roles', document.getElementById('roles')); const ui = { map: document.getElementById('map'), + medallions_container: document.getElementById('medallions'), markers: document.getElementById('markers'), fronts: { a: { @@ -51,15 +52,18 @@ const ui = { glory_container: document.getElementById('glory'), hand: document.getElementById('hand'), current_events: document.getElementById('current_events'), - stats: { + roles: { a: { hero_points: document.querySelector('#role_Anarchist .role_stat'), + medallions: document.querySelector('#role_Anarchist .role_medallions'), }, c: { hero_points: document.querySelector('#role_Communist .role_stat'), + medallions: document.querySelector('#role_Communist .role_medallions'), }, m: { hero_points: document.querySelector('#role_Moderate .role_stat'), + medallions: document.querySelector('#role_Moderate .role_medallions'), }, pool: { hero_points: document.getElementById('pool_hero_points'), @@ -73,13 +77,13 @@ const ui = { tracks: document.getElementById('tracks'), hero_points: document.querySelector('#role_Anarchist .role_stat'), year: document.getElementById('year'), - blank_markers: [[], [], [], [], []], + blank_markers: [], bonuses: [], // fronts: {}, tokens_on_front: {}, // front_values: {}, glory: [], - medaillons: [], + medallions: [], spaces: [], standees: [], pieces: [], @@ -112,7 +116,7 @@ const LAYOUT_GLORY = [ [922, 771], ]; -const LAYOUT_MEDAILLONS = [ +const LAYOUT_medallionS = [ [364, 556], [415, 556], [466, 556], @@ -246,14 +250,11 @@ function on_init() { if (on_init_once) return; on_init_once = true; - console.log('ui', ui); - - console.log('document', document); - // Create blank_markers - for (let t = 0; t < 5; ++t) { - for (let bm = 0; bm < TRACK_LENGTH; ++bm) { - let e = (ui.blank_markers[t][bm] = document.createElement('div')); + for (let t = 0; t < TRACK_COUNT; ++t) { + for (let s = 0; s < TRACK_LENGTH; ++s) { + const bm = t * 11 + s; + let e = (ui.blank_markers[bm] = document.createElement('div')); e.className = 'blank_marker'; register_action(e, 'blank_marker', bm); } @@ -280,13 +281,12 @@ function on_init() { 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')); - e.className = 'medaillon'; - e.setAttribute('data-medaillon-id', '' + m); - register_action(e, 'medaillon', m); - ui.map.appendChild(ui.medaillons[m]); + // create track medallions + for (let m = 0; m < medallionS_COUNT; ++m) { + let e = (ui.medallions[m] = document.createElement('div')); + e.className = 'medallion'; + e.setAttribute('data-medallion-id', '' + m); + register_action(e, 'medallion', m); } // create track standees @@ -319,7 +319,7 @@ function on_init() { Object.keys(ui.fronts).forEach((front_id) => { register_action(ui.fronts[front_id].front, 'front', front_id); - }) + }); } // @ts-ignore @@ -328,7 +328,7 @@ function on_update() { on_init(); for (let key of Object.keys(view.hero_points)) { - ui.stats[key].hero_points.replaceChildren( + ui.roles[key].hero_points.replaceChildren( `Hero Points: ${view.hero_points[key]}` ); } @@ -349,12 +349,12 @@ function on_update() { } ui.markers.replaceChildren(); - for (let t = 0; t < TRACK_COUNT; ++t) { - for (let bm of view.triggered_track_effects[t]) { - ui.markers.appendChild(ui.blank_markers[t][bm]); - ui.blank_markers[t][bm].style.left = LAYOUT_TRACKS[t][bm][0] + 'px'; - ui.blank_markers[t][bm].style.top = LAYOUT_TRACKS[t][bm][1] + 'px'; - } + for (let bm of view.triggered_track_effects) { + const s = bm % 11; + const t = Math.floor(bm / 11); + ui.markers.appendChild(ui.blank_markers[bm]); + ui.blank_markers[bm].style.left = LAYOUT_TRACKS[t][s][0] + 'px'; + ui.blank_markers[bm].style.top = LAYOUT_TRACKS[t][s][1] + 'px'; } for (let bonus_id of Object.keys(view.bonuses)) { @@ -382,17 +382,30 @@ function on_update() { for (let front_id of Object.keys(view.fronts)) { const front_data = view.fronts[front_id]; // ui.fronts[front_id].value.replaceChildren(front_data.value); - ui.fronts[front_id].value.replaceChildren(front_data.status !== null ? front_data.status : front_data.value); + ui.fronts[front_id].value.replaceChildren( + front_data.status !== null ? front_data.status : front_data.value + ); ui.fronts[front_id].contributions.replaceChildren(); - for(let faction_id of front_data.contributions) { - ui.fronts[front_id].contributions.appendChild(ui.tokens_on_front[front_id][faction_id]); + for (let faction_id of front_data.contributions) { + ui.fronts[front_id].contributions.appendChild( + ui.tokens_on_front[front_id][faction_id] + ); } } - for (let i = 0; i < view.medaillons.length; ++i) { - if (view.medaillons[i] !== null) { - ui.medaillons[i].style.left = LAYOUT_MEDAILLONS[i][0] + 'px'; - ui.medaillons[i].style.top = LAYOUT_MEDAILLONS[i][1] + 'px'; + ui.medallions_container.replaceChildren(); + for (let i = 0; i < view.medallions.pool.length; ++i) { + if (view.medallions.pool[i] !== null) { + const id = view.medallions.pool[i]; + ui.medallions[id].style.left = LAYOUT_medallionS[i][0] + 'px'; + ui.medallions[id].style.top = LAYOUT_medallionS[i][1] + 'px'; + ui.medallions_container.appendChild(ui.medallions[id]); + } + } + for (let f of FACTIONS) { + ui.roles[f].medallions.replaceChildren(); + for (let m of view.medallions[f]) { + ui.roles[f].medallions.appendChild(ui.medallions[m]); } } @@ -441,6 +454,9 @@ function on_update() { action_button('up', 'Up'); action_button('down', 'Down'); action_button('next', 'Next'); + action_button('remove_blank_marker', 'Remove Blank marker'); + action_button('yes', 'Yes'); + action_button('no', 'No'); action_button('skip', 'Skip'); action_button('done', 'Done'); action_button('undo', 'Undo'); @@ -450,10 +466,10 @@ function on_update() { function on_log(text) { let p = document.createElement('div'); - if (text.match(/^>>/)) { - text = text.substring(2) - p.className = "ii" - } + if (text.match(/^>>/)) { + text = text.substring(2); + p.className = 'ii'; + } if (text.match(/^>/)) { text = text.substring(1); diff --git a/rules.js b/rules.js index bd1f473..3b085a9 100644 --- a/rules.js +++ b/rules.js @@ -28,15 +28,13 @@ const front_names = { v: 'the Front closest to Victory', }; const bonus_names = ['Morale Bonus', 'Teamwork Bonus']; -const { cards, tracks, } = data_1.default; +const { cards, medallions, tracks, } = data_1.default; const bonuses = [data_1.MORALE_BONUS, data_1.TEAMWORK_BONUS]; const faction_cards = { [data_1.ANARCHISTS_ID]: make_list(37, 54), [data_1.COMMUNISTS_ID]: make_list(19, 36), [data_1.MODERATES_ID]: make_list(1, 18), }; -const medaillons = make_list(0, 8); -console.log('medaillons', medaillons); const fascist_decks = { 1: make_list(55, 72), 2: make_list(73, 90), @@ -54,6 +52,9 @@ function gen_action(action, argument) { view.actions[action].push(argument); } } +function gen_action_blank_marker(marker_id) { + gen_action('blank_marker', marker_id); +} function gen_action_bonus(bonus_id) { gen_action('bonus', bonus_id); } @@ -63,6 +64,9 @@ function gen_action_card(card_id) { function gen_action_front(front_id) { gen_action('front', front_id); } +function gen_action_medallion(medallion_id) { + gen_action('medallion', medallion_id); +} function gen_action_standee(track_id) { gen_action('standee', track_id); } @@ -138,8 +142,6 @@ function setup_player_turn() { } function start_of_player_turn() { const args = get_active_node_args(); - console.log('args', args); - console.log('args'); const player = faction_player_map[args.f]; log_h2(player, player); resolve_active_and_proceed(); @@ -187,7 +189,6 @@ function insert_before_or_after_active_node(node, position, engine = game.engine return; } const i = a.parent.indexOf(a.node); - console.log('insert_before_active_node', i); if (i >= 0) { array_insert(a.parent, i + (position == 'after' ? 1 : 0), node); } @@ -216,7 +217,6 @@ function next() { } function resolve_active_node() { const next_node = get_active_node(game.engine); - console.log('resolve_active_node', next_node); if (next_node !== null) { next_node.r = resolved; } @@ -243,11 +243,12 @@ function game_view(state, player) { hand: game.hands[faction_id], hero_points: game.hero_points, initiative: game.initiative, - medaillons: game.medaillons, + medallions: game.medallions, selected_card: game.chosen_cards[faction_id], tableaus: game.tableaus, tracks: game.tracks, triggered_track_effects: game.triggered_track_effects, + used_medallions: game.used_medallions, year: game.year, }; if (game.state === 'game_over') { @@ -328,13 +329,12 @@ function setup(seed, _scenario, _options) { [data_1.MODERATES_ID]: null, }, initiative: data_1.MODERATES_ID, - medaillons: [ - draw_item(medaillons), - draw_item(medaillons), - draw_item(medaillons), - draw_item(medaillons), - draw_item(medaillons), - ], + medallions: { + [data_1.ANARCHISTS_ID]: [], + [data_1.COMMUNISTS_ID]: [], + [data_1.MODERATES_ID]: [], + pool: [], + }, tableaus: { [data_1.ANARCHISTS_ID]: [], [data_1.COMMUNISTS_ID]: [], @@ -346,29 +346,33 @@ function setup(seed, _scenario, _options) { [data_1.COMMUNISTS_ID]: [], [data_1.MODERATES_ID]: [], }, - triggered_track_effects: [[], [], [], [], []], + triggered_track_effects: [], log: [], undo: [], + used_medallions: [], turn: 0, year: 0, state_data: null, }; + draw_medallions(); start_year(); return game; } function draw_hand_cards(faction_id, count) { const deck = list_deck(faction_id); + if (game.medallions[faction_id].includes(data_1.INTELLIGENCE_MEDALLION_ID)) { + count++; + } + const drawn_cards = count; if (deck.length < count) { count = count - deck.length; game.hands[faction_id] = game.hands[faction_id].concat(deck); game.discard[faction_id] = []; } - console.log('draw_hand_cards', count); - const log = count === 1 + const log = drawn_cards === 1 ? `${get_player(faction_id)} draws 1 card` - : `${get_player(faction_id)} draws ${count} cards`; + : `${get_player(faction_id)} draws ${drawn_cards} cards`; logi(log); - console.log('deck', list_deck(faction_id)); for (let i = 0; i < count; i++) { const deck = list_deck(faction_id); game.hands[faction_id].push(draw_card(deck)); @@ -390,7 +394,7 @@ function start_turn() { const card = cards[cardId]; log_h2('Fascist Event', 'fascist'); log(card.title); - game.engine = card.effects.map((effect) => resolve_effect(effect, game.initiative)); + game.engine = card.effects.map((effect) => resolve_effect(effect)); if (game.year === 3 && game.turn === 1) { game.engine.push(create_function_node('setup_final_bid')); } @@ -416,27 +420,63 @@ states.activate_icon = { resolve_active_and_proceed(); }, collectivization() { - move_track(data_1.COLLECTIVIZATION, get_icon_count_in_tableau('collectivization')); + const count = get_icon_count_in_tableau('collectivization'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.COLLECTIVIZATION, count); + } + else { + move_track(data_1.COLLECTIVIZATION, count); + } resolve_active_and_proceed(); }, d_collectivization() { - move_track(data_1.COLLECTIVIZATION, -1 * get_icon_count_in_tableau('d_collectivization')); + const count = -1 * get_icon_count_in_tableau('d_collectivization'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.COLLECTIVIZATION, count); + } + else { + move_track(data_1.COLLECTIVIZATION, count); + } resolve_active_and_proceed(); }, d_foreign_aid() { - move_track(data_1.FOREIGN_AID, -1 * get_icon_count_in_tableau('d_foreign_aid')); + const count = -1 * get_icon_count_in_tableau('d_foreign_aid'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.FOREIGN_AID, count); + } + else { + move_track(data_1.FOREIGN_AID, count); + } resolve_active_and_proceed(); }, d_government() { - move_track(data_1.GOVERNMENT, -1 * get_icon_count_in_tableau('d_government')); + const count = -1 * get_icon_count_in_tableau('d_government'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.GOVERNMENT, count); + } + else { + move_track(data_1.GOVERNMENT, count); + } resolve_active_and_proceed(); }, d_liberty() { - move_track(data_1.LIBERTY, -1 * get_icon_count_in_tableau('d_liberty')); + const count = -1 * get_icon_count_in_tableau('d_liberty'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.LIBERTY, count); + } + else { + move_track(data_1.LIBERTY, count); + } resolve_active_and_proceed(); }, d_soviet_support() { - move_track(data_1.SOVIET_SUPPORT, -1 * get_icon_count_in_tableau('d_soviet_support')); + const count = -1 * get_icon_count_in_tableau('d_soviet_support'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.SOVIET_SUPPORT, count); + } + else { + move_track(data_1.SOVIET_SUPPORT, count); + } resolve_active_and_proceed(); }, draw_card() { @@ -444,12 +484,24 @@ states.activate_icon = { resolve_active_and_proceed(); }, foreign_aid() { - move_track(data_1.FOREIGN_AID, get_icon_count_in_tableau('foreign_aid')); + const count = get_icon_count_in_tableau('foreign_aid'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.FOREIGN_AID, count); + } + else { + move_track(data_1.FOREIGN_AID, count); + } resolve_active_and_proceed(); }, government() { const direction = game.active === data_1.COMMUNIST ? -1 : 1; - move_track(data_1.GOVERNMENT, direction * get_icon_count_in_tableau('government')); + const count = direction * get_icon_count_in_tableau('government'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.GOVERNMENT, count); + } + else { + move_track(data_1.GOVERNMENT, count); + } resolve_active_and_proceed(); }, government_to_center() { @@ -458,11 +510,23 @@ states.activate_icon = { resolve_active_and_proceed(); }, liberty() { - move_track(data_1.LIBERTY, get_icon_count_in_tableau('liberty')); + const count = get_icon_count_in_tableau('liberty'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.LIBERTY, count); + } + else { + move_track(data_1.LIBERTY, count); + } resolve_active_and_proceed(); }, soviet_support() { - move_track(data_1.SOVIET_SUPPORT, get_icon_count_in_tableau('soviet_support')); + const count = get_icon_count_in_tableau('soviet_support'); + if (can_use_medallion(data_1.ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(data_1.SOVIET_SUPPORT, count); + } + else { + move_track(data_1.SOVIET_SUPPORT, count); + } resolve_active_and_proceed(); }, teamwork_on() { @@ -477,18 +541,11 @@ states.add_glory = { gen_action('add_glory'); }, add_glory() { - console.log('add_glory'); let number = 1; if (game.turn === 4) { 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 { - log_h3(`${game.active} adds ${number} tokens to the Bag of Glory`); - } + add_glory(get_active_faction(), number); resolve_active_and_proceed(); }, }; @@ -699,13 +756,48 @@ states.choose_final_bid = { resolve_active_and_proceed(); }, }; +states.choose_medallion = { + inactive: 'choose a medallion', + prompt() { + view.prompt = 'Choose a medallion'; + for (let m of game.medallions.pool) { + gen_action_medallion(m); + } + if (!game.medallions.pool.some((m) => m !== null)) { + gen_action('skip'); + } + }, + medallion(m) { + const faction = get_active_faction(); + const medallion = medallions[m]; + logi(`${faction_player_map[faction]} earns ${medallion.name}`); + const index = game.medallions.pool.indexOf(m); + game.medallions.pool[index] = null; + switch (m) { + case 0: + add_glory(faction, 1, true); + break; + case 1: + gain_hero_points(faction, 7); + break; + case 2: + break; + default: + game.medallions[faction].push(m); + } + resolve_active_and_proceed(); + }, + skip() { + resolve_active_and_proceed(); + }, +}; states.end_of_year_discard = { inactive: 'discard cards from hand and tableau', prompt() { view.prompt = 'Discard a card'; const faction_id = get_active_faction(); const hand = game.hands[faction_id]; - if (hand.length > game.year) { + if (hand.length > get_hand_limit(faction_id)) { for (let c of hand) gen_action_card(c); } @@ -717,7 +809,6 @@ states.end_of_year_discard = { }, card(c) { const faction_id = get_active_faction(); - console.log('list deck', list_deck(faction_id)); if (game.hands[faction_id].includes(c)) { game.hands[faction_id] = game.hands[faction_id].filter((id) => id !== c); } @@ -725,7 +816,7 @@ states.end_of_year_discard = { game.tableaus[faction_id] = game.tableaus[faction_id].filter((id) => id !== c); } game.discard[faction_id].push(c); - if (game.hands[faction_id].length > game.year || + if (game.hands[faction_id].length > get_hand_limit(faction_id) || game.tableaus[faction_id].length > game.year) { next(); } @@ -763,7 +854,6 @@ states.lose_hero_points = { view.prompt = 'Choose player to lose Hero Points'; if (args.t === data_1.PLAYER_WITH_MOST_HERO_POINTS) { const factions = get_factions_with_most_hero_poins(); - console.log('faction', factions); for (let faction_id of factions) { gen_action(faction_player_map[faction_id]); } @@ -806,7 +896,8 @@ states.move_track = { let value = node.a.v; if (s === data_1.GOVERNMENT && (value === data_1.TOWARDS_CENTER || value === data_1.AWAY_FROM_CENTER)) { - value = get_government_track_direction(value); + const direction = get_government_track_direction(value); + value = direction; } move_track(s, value); resolve_active_and_proceed(); @@ -878,8 +969,8 @@ states.player_turn = { array_remove(game.hands[faction_id], game.hands[faction_id].indexOf(card)); game.trash[faction_id].push(card); log_h3(`${game.active} plays ${cards[card].title} for the Event`); - insert_after_active_node(create_effects_node(cards[card].effects)); - resolve_active_and_proceed(); + insert_before_active_node(create_effects_node(cards[card].effects)); + next(); }, spend_hp() { insert_before_active_node(create_leaf_node('spend_hero_points', get_active_faction())); @@ -887,16 +978,42 @@ states.player_turn = { next(); }, }; +states.remove_blank_marker = { + inactive: 'remove a Blank marker', + prompt() { + view.prompt = 'Remove a Blank marker'; + for (const b of game.triggered_track_effects) { + gen_action_blank_marker(b); + } + }, + blank_marker(b) { + const faction = get_active_faction(); + pay_hero_points(faction, 1); + const track_id = Math.floor(b / 11); + const space_id = b % 11; + logi(`${faction_player_map[faction]} removes a Blank marker from space ${space_id} of ${get_track_name(track_id)}`); + game.triggered_track_effects = game.triggered_track_effects.filter((id) => id !== b); + game.used_medallions.push(data_1.ARCHIVES_MEDALLION_ID); + resolve_active_and_proceed(); + }, +}; states.spend_hero_points = { inactive: 'spend Hero points', prompt() { view.prompt = 'Spend your Hero points'; gen_action('done'); + const faction = get_active_faction(); const hero_points = game.hero_points[get_active_faction()]; if (hero_points === 0) { return; } gen_action('draw_card'); + if (can_use_medallion(data_1.ARCHIVES_MEDALLION_ID, faction)) { + gen_action('remove_blank_marker'); + } + if (can_use_medallion(data_1.VOLUNTEERS_MEDALLION_ID, faction)) { + gen_action('add_to_front'); + } if (hero_points < 2) { return; } @@ -917,6 +1034,18 @@ states.spend_hero_points = { } gen_action_standee(data_1.GOVERNMENT); }, + add_to_front() { + const faction = get_active_faction(); + pay_hero_points(faction, 1); + insert_after_active_node(create_seq_node([ + create_leaf_node('add_to_front', faction, { + t: data_1.ANY, + v: 1, + }), + create_leaf_node('spend_hero_points', faction), + ])); + resolve_active_and_proceed(); + }, done() { resolve_active_and_proceed(); }, @@ -929,6 +1058,20 @@ states.spend_hero_points = { pay_hero_points(faction, 1); draw_hand_cards(faction, 1); }, + remove_blank_marker() { + const faction = get_active_faction(); + if (game.used_medallions) { + game.used_medallions.push(data_1.ARCHIVES_MEDALLION_ID); + } + else { + game.used_medallions = [data_1.ARCHIVES_MEDALLION_ID]; + } + insert_after_active_node(create_seq_node([ + create_leaf_node('remove_blank_marker', faction), + create_leaf_node('spend_hero_points', faction), + ])); + resolve_active_and_proceed(); + }, standee(track_id) { let amount = 2; if (track_id === data_1.LIBERTY || track_id === data_1.COLLECTIVIZATION) { @@ -949,6 +1092,51 @@ states.spend_hero_points = { resolve_active_and_proceed(); }, }; +states.use_organization_medallion = { + inactive: 'use Organization Medallion', + prompt() { + view.prompt = 'Use Organization Medallion?'; + gen_action('yes'); + gen_action('no'); + }, + yes() { + const faction = get_active_faction(); + pay_hero_points(faction, 1); + game.used_medallions.push(data_1.ORGANIZATION_MEDALLION_ID); + let { t, v } = get_active_node_args(); + if (v > 0) { + v++; + } + else { + v--; + } + move_track(t, v); + resolve_active_and_proceed(); + }, + no() { + const { t, v } = get_active_node_args(); + move_track(t, v); + resolve_active_and_proceed(); + }, +}; +states.use_strategy_medallion = { + inactive: 'use Strategy Medallion', + prompt() { + view.prompt = 'Use Strategy Medallion?'; + gen_action('yes'); + gen_action('no'); + }, + yes() { + game.used_medallions.push(data_1.STRATEGY_MEDALLION_ID); + const { f } = get_active_node_args(); + const faction = get_active_faction(); + update_front(f, 1, faction); + resolve_active_and_proceed(); + }, + no() { + resolve_active_and_proceed(); + }, +}; function pop_undo() { const save_log = game.log; const save_undo = game.undo; @@ -957,6 +1145,20 @@ function pop_undo() { game.log = save_log; game.undo = save_undo; } +function add_glory(faction, amount, indent = false) { + for (let i = 0; i < amount; ++i) { + game.bag_of_glory.push(get_active_faction()); + } + let text = amount === 1 + ? `${faction_player_map[faction]} adds 1 token to the Bag of Glory` + : `${faction_player_map[faction]} adds ${amount} tokens to the Bag of Glory`; + if (indent) { + logi(text); + } + else { + log_h3(text); + } +} function check_activate_icon() { if (game.bonuses[data_1.MORALE_BONUS] === data_1.ON) { insert_after_active_node(create_leaf_node('activate_icon', get_active_faction_id())); @@ -1024,6 +1226,7 @@ function end_of_turn() { Object.keys(game.fronts).forEach((front_id) => { game.fronts[front_id].contributions = []; }); + game.used_medallions = []; if (game.turn === 4) { end_of_year(); } @@ -1090,6 +1293,13 @@ function game_over(result, victory) { log_br(); log(game.victory); } +function get_hand_limit(faction) { + let hand_limit = game.year; + if (game.medallions[faction].includes(data_1.INTELLIGENCE_MEDALLION_ID)) { + hand_limit++; + } + return hand_limit; +} function resolve_fascist_test() { log_h2('Fascist Test', 'fascist'); const test = get_current_event().test; @@ -1098,6 +1308,17 @@ function resolve_fascist_test() { (status !== data_1.DEFEAT && game.fronts[test.front].value >= test.value); if (test_passed) { log('The Test is passed'); + for (const faction of get_player_order()) { + let hero_points_gain = game.fronts[test.front].contributions.includes(faction) + ? 2 + : 0; + if (can_use_medallion(data_1.PROPAGANDA_MEDALLION_ID, faction)) { + hero_points_gain += 2; + } + if (hero_points_gain > 0) { + gain_hero_points(faction, hero_points_gain); + } + } } else { log('The Test is failed'); @@ -1138,7 +1359,6 @@ function resolve_final_bid() { resolve_active_and_proceed(); } function get_fronts_to_add_to(target) { - console.log('get_fronts_to_add_to', target); if (target === data_1.CLOSEST_TO_DEFEAT || target === data_1.CLOSEST_TO_VICTORY) { return get_fronts_closest_to(target); } @@ -1152,9 +1372,11 @@ function get_fronts_to_add_to(target) { function get_max_value_for_track(track_id) { switch (track_id) { case data_1.LIBERTY: - return game.tracks[data_1.COLLECTIVIZATION] >= 8 ? 10 : 7; + const max_lib = game.tracks[data_1.COLLECTIVIZATION] >= 8 ? 10 : 7; + return Math.max(max_lib, game.tracks[data_1.LIBERTY]); case data_1.GOVERNMENT: - return game.tracks[data_1.FOREIGN_AID] >= 8 ? 10 : 7; + const max_gov = game.tracks[data_1.FOREIGN_AID] >= 8 ? 10 : 7; + return Math.max(max_gov, game.tracks[data_1.GOVERNMENT]); case data_1.COLLECTIVIZATION: case data_1.SOVIET_SUPPORT: case data_1.FOREIGN_AID: @@ -1165,7 +1387,8 @@ function get_max_value_for_track(track_id) { function get_min_value_for_track(track_id) { switch (track_id) { case data_1.GOVERNMENT: - return game.tracks[data_1.SOVIET_SUPPORT] >= 8 ? 4 : 1; + const min_gov = game.tracks[data_1.SOVIET_SUPPORT] >= 8 ? 4 : 1; + return Math.min(min_gov, game.tracks[data_1.GOVERNMENT]); case data_1.LIBERTY: case data_1.COLLECTIVIZATION: case data_1.SOVIET_SUPPORT: @@ -1198,9 +1421,9 @@ function move_track(track_id, change) { triggered_spaces.forEach((space_id) => { const trigger = tracks[track_id].triggers[space_id]; if (trigger !== null && - !game.triggered_track_effects[track_id].includes(space_id)) { + !game.triggered_track_effects.includes(get_blank_marker_id(track_id, space_id))) { if (space_id !== 0) { - game.triggered_track_effects[track_id].push(space_id); + game.triggered_track_effects.push(get_blank_marker_id(track_id, space_id)); } const node = resolve_effect(trigger); if (node !== null) { @@ -1213,6 +1436,24 @@ function pay_hero_points(faction, amount) { game.hero_points[faction] -= amount; game.hero_points.pool += amount; } +function can_use_medallion(medallion_id, faction) { + faction = faction === undefined ? get_active_faction() : faction; + const can_use = game.medallions[faction].includes(medallion_id) && + !game.used_medallions.includes(medallion_id); + if (medallion_id === data_1.ORGANIZATION_MEDALLION_ID) { + return can_use && game.hero_points[faction] > 0; + } + else { + return can_use; + } +} +function insert_use_organization_medallion_node(track_id, value) { + const faction = get_active_faction(); + insert_after_active_node(create_leaf_node('use_organization_medallion', faction, { + t: track_id, + v: value, + })); +} function update_bonus(bonus_id, status) { if (game.bonuses[bonus_id] === status) { return; @@ -1242,6 +1483,14 @@ function update_front(front_id, change, faction_id = null) { !game.fronts[front_id].contributions.includes(faction_id)) { game.fronts[front_id].contributions.push(faction_id); } + if (change > 0 && + faction_id !== undefined && + game.fronts[front_id].value < 10 && + can_use_medallion(data_1.STRATEGY_MEDALLION_ID)) { + insert_after_active_node(create_leaf_node('use_strategy_medallion', get_active_faction(), { + f: front_id, + })); + } if (game.fronts[front_id].value >= 10) { victory_on_a_front(front_id); } @@ -1276,22 +1525,30 @@ function create_effects_node(effects) { } return accrued; }, []); - return { - t: seq_node, - c: nodes, - }; + return create_seq_node(nodes); +} +function get_faction_to_resolve_effect(effect) { + if (!effect.faction) { + return get_active_faction(); + } + if (effect.faction === data_1.INITIATIVE_PLAYER) { + return game.initiative; + } + return effect.faction; } const effect_type_state_map = { attack: 'attack_front', bonus: 'change_bonus', front: 'add_to_front', + medallion: 'choose_medallion', track: 'move_track', }; -function resolve_effect(effect, faction = get_active_faction()) { +function resolve_effect(effect) { const args = { t: effect.target, v: effect.value, }; + const faction = get_faction_to_resolve_effect(effect); let state = effect_type_state_map[effect.type]; if (state !== undefined) { return create_leaf_node(state, faction, args); @@ -1320,12 +1577,6 @@ function draw_card(deck) { set_delete(deck, c); return c; } -function draw_item(ids) { - let i = random(ids.length); - let r = ids[i]; - set_delete(ids, r); - return r; -} function lose_hero_point(faction, value) { const points_lost = Math.min(game.hero_points[faction], Math.abs(value)); game.hero_points.pool += points_lost; @@ -1370,7 +1621,6 @@ function log_h2(msg, player) { log(`.h2${player ? `.${player}` : ''} ${msg}`); log_br(); } -log; function log_h3(msg) { log_br(); log('.h3 ' + msg); @@ -1386,6 +1636,9 @@ function get_active_faction() { function get_active_faction_id() { return player_faction_map[game.active]; } +function get_blank_marker_id(track_id, space_id) { + return track_id * 11 + space_id; +} function get_faction_id(player) { return player_faction_map[player]; } @@ -1494,7 +1747,8 @@ function list_deck(id) { const deck = []; const card_list = id === 'fascist' ? fascist_decks[game.year] : faction_cards[id]; card_list.forEach((card) => { - if (id === 'fascist' && game.discard.f.includes(card)) { + if (id === 'fascist' && + (game.discard.f.includes(card) || game.current_events.includes(card))) { return; } else if (id !== 'fascist' && @@ -1507,6 +1761,15 @@ function list_deck(id) { }); return deck; } +function draw_medallions() { + const medallion_ids = make_list(0, 8); + for (let m = 0; m < 5; ++m) { + let i = random(medallion_ids.length); + let r = medallion_ids[i]; + set_delete(medallion_ids, r); + game.medallions.pool.push(r); + } +} function array_remove(array, index) { let n = array.length; for (let i = index + 1; i < n; ++i) diff --git a/rules.ts b/rules.ts index dc3700a..3f0a2cf 100644 --- a/rules.ts +++ b/rules.ts @@ -39,6 +39,7 @@ import data, { CLOSEST_TO_VICTORY, COLLECTIVIZATION, GOVERNMENT, + INITIATIVE_PLAYER, SOVIET_SUPPORT, FOREIGN_AID, ON, @@ -54,6 +55,13 @@ import data, { create_effect, AWAY_FROM_CENTER, TOWARDS_CENTER, + ARCHIVES_MEDALLION_ID, + INTELLIGENCE_MEDALLION_ID, + // VOLUNTEERS_MEDALLION_ID, + ORGANIZATION_MEDALLION_ID, + STRATEGY_MEDALLION_ID, + PROPAGANDA_MEDALLION_ID, + VOLUNTEERS_MEDALLION_ID, // StaticData, // PLAYER_WITH_MOST_HERO_POINTS, } from './data'; @@ -98,6 +106,7 @@ const bonus_names: string[] = ['Morale Bonus', 'Teamwork Bonus']; const { cards, + medallions, // fronts, tracks, } = data; @@ -110,10 +119,6 @@ const faction_cards = { [MODERATES_ID]: make_list(1, 18) as CardId[], }; -const medaillons = make_list(0, 8) as number[]; - -console.log('medaillons', medaillons); - const fascist_decks = { 1: make_list(55, 72), 2: make_list(73, 90), @@ -133,6 +138,10 @@ function gen_action(action: string, argument?: number | string) { } } +function gen_action_blank_marker(marker_id: number) { + gen_action('blank_marker', marker_id); +} + function gen_action_bonus(bonus_id: number) { gen_action('bonus', bonus_id); } @@ -145,6 +154,10 @@ function gen_action_front(front_id: string) { gen_action('front', front_id); } +function gen_action_medallion(medallion_id: number) { + gen_action('medallion', medallion_id); +} + function gen_action_standee(track_id: number) { gen_action('standee', track_id); } @@ -256,8 +269,6 @@ function setup_player_turn() { function start_of_player_turn() { const args = get_active_node_args(); - console.log('args', args); - console.log('args'); const player = faction_player_map[args.f]; log_h2(player, player); resolve_active_and_proceed(); @@ -319,7 +330,6 @@ function insert_before_or_after_active_node( return; } const i = a.parent.indexOf(a.node); - console.log('insert_before_active_node', i); if (i >= 0) { array_insert(a.parent, i + (position == 'after' ? 1 : 0), node); } @@ -356,7 +366,6 @@ function next() { function resolve_active_node() { const next_node = get_active_node(game.engine); - console.log('resolve_active_node', next_node); if (next_node !== null) { next_node.r = resolved; } @@ -393,11 +402,12 @@ function game_view(state: Game, player: Player) { hand: game.hands[faction_id], hero_points: game.hero_points, initiative: game.initiative, - medaillons: game.medaillons, + medallions: game.medallions, selected_card: game.chosen_cards[faction_id], tableaus: game.tableaus, tracks: game.tracks, triggered_track_effects: game.triggered_track_effects, + used_medallions: game.used_medallions, year: game.year, }; @@ -482,13 +492,12 @@ export function setup(seed: number, _scenario: string, _options: unknown) { [MODERATES_ID]: null, }, initiative: MODERATES_ID, - medaillons: [ - draw_item(medaillons), - draw_item(medaillons), - draw_item(medaillons), - draw_item(medaillons), - draw_item(medaillons), - ], + medallions: { + [ANARCHISTS_ID]: [], + [COMMUNISTS_ID]: [], + [MODERATES_ID]: [], + pool: [], + }, tableaus: { [ANARCHISTS_ID]: [], [COMMUNISTS_ID]: [], @@ -500,14 +509,17 @@ export function setup(seed: number, _scenario: string, _options: unknown) { [COMMUNISTS_ID]: [], [MODERATES_ID]: [], }, - triggered_track_effects: [[], [], [], [], []], + triggered_track_effects: [], log: [], undo: [], + used_medallions: [], turn: 0, year: 0, state_data: null, }; + draw_medallions(); + start_year(); return game; } @@ -515,6 +527,11 @@ export function setup(seed: number, _scenario: string, _options: unknown) { function draw_hand_cards(faction_id: FactionId, count: number) { const deck = list_deck(faction_id); + if (game.medallions[faction_id].includes(INTELLIGENCE_MEDALLION_ID)) { + count++; + } + const drawn_cards = count; + // Draw all remaining cards if (deck.length < count) { count = count - deck.length; @@ -522,13 +539,12 @@ function draw_hand_cards(faction_id: FactionId, count: number) { game.discard[faction_id] = []; } - console.log('draw_hand_cards', count); const log = - count === 1 + drawn_cards === 1 ? `${get_player(faction_id)} draws 1 card` - : `${get_player(faction_id)} draws ${count} cards`; + : `${get_player(faction_id)} draws ${drawn_cards} cards`; logi(log); - console.log('deck', list_deck(faction_id)); + for (let i = 0; i < count; i++) { const deck = list_deck(faction_id); game.hands[faction_id].push(draw_card(deck)); @@ -557,9 +573,7 @@ function start_turn() { log_h2('Fascist Event', 'fascist'); log(card.title); - game.engine = card.effects.map((effect) => - resolve_effect(effect, game.initiative) - ); + game.engine = card.effects.map((effect) => resolve_effect(effect)); if (game.year === 3 && game.turn === 1) { game.engine.push(create_function_node('setup_final_bid')); } else { @@ -594,33 +608,57 @@ states.activate_icon = { resolve_active_and_proceed(); }, collectivization() { - move_track(COLLECTIVIZATION, get_icon_count_in_tableau('collectivization')); + const count = get_icon_count_in_tableau('collectivization'); + if (can_use_medallion(ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(COLLECTIVIZATION, count); + } else { + move_track(COLLECTIVIZATION, count); + } resolve_active_and_proceed(); }, d_collectivization() { - move_track( - COLLECTIVIZATION, - -1 * get_icon_count_in_tableau('d_collectivization') - ); + const count = -1 * get_icon_count_in_tableau('d_collectivization'); + if (can_use_medallion(ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(COLLECTIVIZATION, count); + } else { + move_track(COLLECTIVIZATION, count); + } resolve_active_and_proceed(); }, d_foreign_aid() { - move_track(FOREIGN_AID, -1 * get_icon_count_in_tableau('d_foreign_aid')); + const count = -1 * get_icon_count_in_tableau('d_foreign_aid'); + if (can_use_medallion(ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(FOREIGN_AID, count); + } else { + move_track(FOREIGN_AID, count); + } resolve_active_and_proceed(); }, d_government() { - move_track(GOVERNMENT, -1 * get_icon_count_in_tableau('d_government')); + const count = -1 * get_icon_count_in_tableau('d_government'); + if (can_use_medallion(ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(GOVERNMENT, count); + } else { + move_track(GOVERNMENT, count); + } resolve_active_and_proceed(); }, d_liberty() { - move_track(LIBERTY, -1 * get_icon_count_in_tableau('d_liberty')); + const count = -1 * get_icon_count_in_tableau('d_liberty'); + if (can_use_medallion(ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(LIBERTY, count); + } else { + move_track(LIBERTY, count); + } resolve_active_and_proceed(); }, d_soviet_support() { - move_track( - SOVIET_SUPPORT, - -1 * get_icon_count_in_tableau('d_soviet_support') - ); + const count = -1 * get_icon_count_in_tableau('d_soviet_support'); + if (can_use_medallion(ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(SOVIET_SUPPORT, count); + } else { + move_track(SOVIET_SUPPORT, count); + } resolve_active_and_proceed(); }, draw_card() { @@ -631,12 +669,22 @@ states.activate_icon = { resolve_active_and_proceed(); }, foreign_aid() { - move_track(FOREIGN_AID, get_icon_count_in_tableau('foreign_aid')); + const count = get_icon_count_in_tableau('foreign_aid'); + if (can_use_medallion(ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(FOREIGN_AID, count); + } else { + move_track(FOREIGN_AID, count); + } resolve_active_and_proceed(); }, government() { const direction = game.active === COMMUNIST ? -1 : 1; - move_track(GOVERNMENT, direction * get_icon_count_in_tableau('government')); + const count = direction * get_icon_count_in_tableau('government'); + if (can_use_medallion(ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(GOVERNMENT, count); + } else { + move_track(GOVERNMENT, count); + } resolve_active_and_proceed(); }, government_to_center() { @@ -648,11 +696,21 @@ states.activate_icon = { resolve_active_and_proceed(); }, liberty() { - move_track(LIBERTY, get_icon_count_in_tableau('liberty')); + const count = get_icon_count_in_tableau('liberty'); + if (can_use_medallion(ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(LIBERTY, count); + } else { + move_track(LIBERTY, count); + } resolve_active_and_proceed(); }, soviet_support() { - move_track(SOVIET_SUPPORT, get_icon_count_in_tableau('soviet_support')); + const count = get_icon_count_in_tableau('soviet_support'); + if (can_use_medallion(ORGANIZATION_MEDALLION_ID)) { + insert_use_organization_medallion_node(SOVIET_SUPPORT, count); + } else { + move_track(SOVIET_SUPPORT, count); + } resolve_active_and_proceed(); }, teamwork_on() { @@ -668,17 +726,11 @@ states.add_glory = { gen_action('add_glory'); }, add_glory() { - console.log('add_glory'); let number = 1; if (game.turn === 4) { 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 { - log_h3(`${game.active} adds ${number} tokens to the Bag of Glory`); - } + add_glory(get_active_faction(), number); resolve_active_and_proceed(); }, }; @@ -898,13 +950,54 @@ states.choose_final_bid = { }, }; +states.choose_medallion = { + inactive: 'choose a medallion', + prompt() { + view.prompt = 'Choose a medallion'; + for (let m of game.medallions.pool) { + gen_action_medallion(m); + } + if (!game.medallions.pool.some((m) => m !== null)) { + gen_action('skip'); + } + }, + medallion(m: number) { + const faction = get_active_faction(); + const medallion = medallions[m]; + + logi(`${faction_player_map[faction]} earns ${medallion.name}`); + + const index = game.medallions.pool.indexOf(m); + + game.medallions.pool[index] = null; + + switch (m) { + case 0: + add_glory(faction, 1, true); + break; + case 1: + gain_hero_points(faction, 7); + break; + case 2: + // insert play another card action + break; + default: + game.medallions[faction].push(m); + } + resolve_active_and_proceed(); + }, + skip() { + resolve_active_and_proceed(); + }, +}; + states.end_of_year_discard = { inactive: 'discard cards from hand and tableau', prompt() { view.prompt = 'Discard a card'; const faction_id = get_active_faction(); const hand = game.hands[faction_id]; - if (hand.length > game.year) { + if (hand.length > get_hand_limit(faction_id)) { for (let c of hand) gen_action_card(c); } const tableau = game.tableaus[faction_id]; @@ -914,7 +1007,6 @@ states.end_of_year_discard = { }, card(c: CardId) { const faction_id = get_active_faction(); - console.log('list deck', list_deck(faction_id)); if (game.hands[faction_id].includes(c)) { game.hands[faction_id] = game.hands[faction_id].filter((id) => id !== c); } else if (game.tableaus[faction_id].includes(c)) { @@ -924,7 +1016,7 @@ states.end_of_year_discard = { } game.discard[faction_id].push(c); if ( - game.hands[faction_id].length > game.year || + game.hands[faction_id].length > get_hand_limit(faction_id) || game.tableaus[faction_id].length > game.year ) { // More cards to discard so resolve same state again @@ -966,7 +1058,6 @@ states.lose_hero_points = { view.prompt = 'Choose player to lose Hero Points'; if (args.t === PLAYER_WITH_MOST_HERO_POINTS) { const factions = get_factions_with_most_hero_poins(); - console.log('faction', factions); for (let faction_id of factions) { gen_action(faction_player_map[faction_id]); } @@ -1014,7 +1105,9 @@ states.move_track = { s === GOVERNMENT && (value === TOWARDS_CENTER || value === AWAY_FROM_CENTER) ) { - value = get_government_track_direction(value); + const direction = get_government_track_direction(value); + // Value equals direction because away / towards always moves 1 step + value = direction; } move_track(s, value); @@ -1095,9 +1188,9 @@ states.player_turn = { game.trash[faction_id].push(card); log_h3(`${game.active} plays ${cards[card].title} for the Event`); - insert_after_active_node(create_effects_node(cards[card].effects)); + insert_before_active_node(create_effects_node(cards[card].effects)); - resolve_active_and_proceed(); + next(); }, spend_hp() { // insert spend hero points node before current node @@ -1111,18 +1204,55 @@ states.player_turn = { }, }; +states.remove_blank_marker = { + inactive: 'remove a Blank marker', + prompt() { + view.prompt = 'Remove a Blank marker'; + + for (const b of game.triggered_track_effects) { + gen_action_blank_marker(b); + } + }, + blank_marker(b: number) { + const faction = get_active_faction(); + pay_hero_points(faction, 1); + + const track_id = Math.floor(b / 11); + const space_id = b % 11; + + logi( + `${ + faction_player_map[faction] + } removes a Blank marker from space ${space_id} of ${get_track_name( + track_id + )}` + ); + game.triggered_track_effects = game.triggered_track_effects.filter( + (id) => id !== b + ); + game.used_medallions.push(ARCHIVES_MEDALLION_ID); + resolve_active_and_proceed(); + }, +}; + states.spend_hero_points = { inactive: 'spend Hero points', prompt() { view.prompt = 'Spend your Hero points'; gen_action('done'); + const faction = get_active_faction(); const hero_points = game.hero_points[get_active_faction()]; if (hero_points === 0) { return; } gen_action('draw_card'); - + if (can_use_medallion(ARCHIVES_MEDALLION_ID, faction)) { + gen_action('remove_blank_marker'); + } + if (can_use_medallion(VOLUNTEERS_MEDALLION_ID, faction)) { + gen_action('add_to_front'); + } if (hero_points < 2) { return; } @@ -1145,6 +1275,20 @@ states.spend_hero_points = { } gen_action_standee(GOVERNMENT); }, + add_to_front() { + const faction = get_active_faction(); + pay_hero_points(faction, 1); + insert_after_active_node( + create_seq_node([ + create_leaf_node('add_to_front', faction, { + t: ANY, + v: 1, + }), + create_leaf_node('spend_hero_points', faction), + ]) + ); + resolve_active_and_proceed(); + }, done() { resolve_active_and_proceed(); }, @@ -1157,6 +1301,21 @@ states.spend_hero_points = { pay_hero_points(faction, 1); draw_hand_cards(faction, 1); }, + remove_blank_marker() { + const faction = get_active_faction(); + if (game.used_medallions) { + game.used_medallions.push(ARCHIVES_MEDALLION_ID); + } else { + game.used_medallions = [ARCHIVES_MEDALLION_ID]; + } + insert_after_active_node( + create_seq_node([ + create_leaf_node('remove_blank_marker', faction), + create_leaf_node('spend_hero_points', faction), + ]) + ); + resolve_active_and_proceed(); + }, standee(track_id: number) { let amount = 2; if (track_id === LIBERTY || track_id === COLLECTIVIZATION) { @@ -1179,21 +1338,59 @@ states.spend_hero_points = { }, }; -// states.move_to = { -// inactive: 'move', -// prompt() { -// view.prompt = 'Move the piece to a space.'; -// for (let s = 0; s < 64; ++s) gen_action_space(s); -// }, -// // space(to) { -// // game.location[game.selected] = to -// // game.state = "move" -// // if (game.active === PLAYER1) -// // game.active = PLAYER2 -// // else -// // game.active = PLAYER1 -// // }, -// }; +states.use_organization_medallion = { + inactive: 'use Organization Medallion', + prompt() { + view.prompt = 'Use Organization Medallion?'; + + gen_action('yes'); + gen_action('no'); + }, + yes() { + const faction = get_active_faction(); + pay_hero_points(faction, 1); + game.used_medallions.push(ORGANIZATION_MEDALLION_ID); + + let { t, v } = get_active_node_args(); + + if (v > 0) { + v++; + } else { + v--; + } + + move_track(t, v); + resolve_active_and_proceed(); + }, + no() { + const { t, v } = get_active_node_args(); + + move_track(t, v); + resolve_active_and_proceed(); + }, +}; + +states.use_strategy_medallion = { + inactive: 'use Strategy Medallion', + prompt() { + view.prompt = 'Use Strategy Medallion?'; + + gen_action('yes'); + gen_action('no'); + }, + yes() { + game.used_medallions.push(STRATEGY_MEDALLION_ID); + const { f } = get_active_node_args(); + const faction = get_active_faction(); + + update_front(f, 1, faction); + + resolve_active_and_proceed(); + }, + no() { + resolve_active_and_proceed(); + }, +}; // #endrregion @@ -1208,6 +1405,27 @@ function pop_undo() { // #region GAME FUNCTIONS +function add_glory( + faction: FactionId, + amount: number, + indent: boolean = false +) { + for (let i = 0; i < amount; ++i) { + game.bag_of_glory.push(get_active_faction()); + } + + let text = + amount === 1 + ? `${faction_player_map[faction]} adds 1 token to the Bag of Glory` + : `${faction_player_map[faction]} adds ${amount} tokens to the Bag of Glory`; + + if (indent) { + logi(text); + } else { + log_h3(text); + } +} + // Check if Morale bonus is on so player can activate icon function check_activate_icon() { if (game.bonuses[MORALE_BONUS] === ON) { @@ -1281,6 +1499,7 @@ function end_of_turn() { Object.keys(game.fronts).forEach((front_id) => { game.fronts[front_id].contributions = []; }); + game.used_medallions = []; if (game.turn === 4) { end_of_year(); } else { @@ -1365,6 +1584,14 @@ function game_over(result: Player | 'None', victory: string) { log(game.victory); } +function get_hand_limit(faction: FactionId) { + let hand_limit = game.year; + if (game.medallions[faction].includes(INTELLIGENCE_MEDALLION_ID)) { + hand_limit++; + } + return hand_limit; +} + function resolve_fascist_test() { log_h2('Fascist Test', 'fascist'); @@ -1375,9 +1602,23 @@ function resolve_fascist_test() { (status !== DEFEAT && game.fronts[test.front].value >= test.value); if (test_passed) { log('The Test is passed'); + for (const faction of get_player_order()) { + let hero_points_gain = game.fronts[test.front].contributions.includes( + faction + ) + ? 2 + : 0; + if (can_use_medallion(PROPAGANDA_MEDALLION_ID, faction)) { + hero_points_gain += 2; + } + if (hero_points_gain > 0) { + gain_hero_points(faction, hero_points_gain); + } + } } else { log('The Test is failed'); } + const effect = test_passed ? test.pass : test.fail; const node = resolve_effect(effect); @@ -1421,7 +1662,6 @@ function resolve_final_bid() { // TODO: check for defeated / won fronts function get_fronts_to_add_to(target: string): FrontId[] { - console.log('get_fronts_to_add_to', target); if (target === CLOSEST_TO_DEFEAT || target === CLOSEST_TO_VICTORY) { return get_fronts_closest_to(target); } else if (target === ANY) { @@ -1434,9 +1674,11 @@ function get_fronts_to_add_to(target: string): FrontId[] { function get_max_value_for_track(track_id: number) { switch (track_id) { case LIBERTY: - return game.tracks[COLLECTIVIZATION] >= 8 ? 10 : 7; + const max_lib = game.tracks[COLLECTIVIZATION] >= 8 ? 10 : 7; + return Math.max(max_lib, game.tracks[LIBERTY]); case GOVERNMENT: - return game.tracks[FOREIGN_AID] >= 8 ? 10 : 7; + const max_gov = game.tracks[FOREIGN_AID] >= 8 ? 10 : 7; + return Math.max(max_gov, game.tracks[GOVERNMENT]); case COLLECTIVIZATION: case SOVIET_SUPPORT: case FOREIGN_AID: @@ -1448,7 +1690,8 @@ function get_max_value_for_track(track_id: number) { function get_min_value_for_track(track_id: number) { switch (track_id) { case GOVERNMENT: - return game.tracks[SOVIET_SUPPORT] >= 8 ? 4 : 1; + const min_gov = game.tracks[SOVIET_SUPPORT] >= 8 ? 4 : 1; + return Math.min(min_gov, game.tracks[GOVERNMENT]); case LIBERTY: case COLLECTIVIZATION: case SOVIET_SUPPORT: @@ -1476,8 +1719,8 @@ function move_track(track_id: number, change: number) { const current_value = game.tracks[track_id]; let new_value = current_value + change; new_value = Math.max(new_value, get_min_value_for_track(track_id)); - new_value = Math.min(new_value, get_max_value_for_track(track_id)); + game.tracks[track_id] = new_value; logi(`${get_track_name(track_id)} to ${new_value}`); @@ -1492,10 +1735,14 @@ function move_track(track_id: number, change: number) { const trigger = tracks[track_id].triggers[space_id]; if ( trigger !== null && - !game.triggered_track_effects[track_id].includes(space_id) + !game.triggered_track_effects.includes( + get_blank_marker_id(track_id, space_id) + ) ) { if (space_id !== 0) { - game.triggered_track_effects[track_id].push(space_id); + game.triggered_track_effects.push( + get_blank_marker_id(track_id, space_id) + ); } const node = resolve_effect(trigger); if (node !== null) { @@ -1510,6 +1757,33 @@ function pay_hero_points(faction: FactionId, amount: number) { game.hero_points.pool += amount; } +function can_use_medallion(medallion_id: number, faction?: FactionId) { + faction = faction === undefined ? get_active_faction() : faction; + const can_use = + game.medallions[faction].includes(medallion_id) && + !game.used_medallions.includes(medallion_id); + + if (medallion_id === ORGANIZATION_MEDALLION_ID) { + return can_use && game.hero_points[faction] > 0; + } else { + return can_use; + } +} + +function insert_use_organization_medallion_node( + track_id: number, + value: number +) { + const faction = get_active_faction(); + + insert_after_active_node( + create_leaf_node('use_organization_medallion', faction, { + t: track_id, + v: value, + }) + ); +} + function update_bonus(bonus_id: number, status: number) { if (game.bonuses[bonus_id] === status) { return; @@ -1557,6 +1831,19 @@ function update_front( game.fronts[front_id].contributions.push(faction_id); } + if ( + change > 0 && + faction_id !== undefined && + game.fronts[front_id].value < 10 && + can_use_medallion(STRATEGY_MEDALLION_ID) + ) { + insert_after_active_node( + create_leaf_node('use_strategy_medallion', get_active_faction(), { + f: front_id, + }) + ); + } + // Check victory / defeat on a front if (game.fronts[front_id].value >= 10) { victory_on_a_front(front_id); @@ -1597,33 +1884,45 @@ function create_effects_node(effects: Effect[]): EngineNode { } return accrued; }, []); - return { - t: seq_node, - c: nodes, - }; + return create_seq_node(nodes); +} + +function get_faction_to_resolve_effect(effect: Effect): FactionId { + if (!effect.faction) { + return get_active_faction(); + } + if (effect.faction === INITIATIVE_PLAYER) { + return game.initiative; + } + return effect.faction; } const effect_type_state_map: Record = { attack: 'attack_front', bonus: 'change_bonus', front: 'add_to_front', + medallion: 'choose_medallion', track: 'move_track', }; function resolve_effect( - effect: Effect, - faction: FactionId = get_active_faction() + effect: Effect + // faction: FactionId = get_active_faction() // ): EngineNode | null { const args = { t: effect.target, v: effect.value, }; - let state = effect_type_state_map[effect.type]; + const faction = get_faction_to_resolve_effect(effect); + + // Default cases where effect type is mapped to a state + let state = effect_type_state_map[effect.type]; if (state !== undefined) { return create_leaf_node(state, faction, args); } + // Specific mapping based on target if ( effect.type === 'hero_points' && effect.target === PLAYER_WITH_MOST_HERO_POINTS @@ -1666,13 +1965,6 @@ function draw_card(deck: CardId[]): CardId { return c; } -function draw_item(ids: number[]): number { - let i = random(ids.length); - let r = ids[i] as CardId; - set_delete(ids, r); - return r; -} - function lose_hero_point(faction: FactionId, value: number) { const points_lost = Math.min(game.hero_points[faction], Math.abs(value)); game.hero_points.pool += points_lost; @@ -1749,8 +2041,6 @@ function log_h2(msg: string, player?: Player | 'fascist') { log_br(); } -log; - // function log_h2_active(msg: string) { // log_br(); // log('.h2 ' + msg); @@ -1790,6 +2080,10 @@ function get_active_faction_id(): FactionId { return player_faction_map[game.active]; } +function get_blank_marker_id(track_id: number, space_id: number) { + return track_id * 11 + space_id; +} + function get_faction_id(player: Player): FactionId { return player_faction_map[player]; } @@ -1918,7 +2212,10 @@ function list_deck(id: FactionId | 'fascist') { const card_list = id === 'fascist' ? fascist_decks[game.year] : faction_cards[id]; card_list.forEach((card) => { - if (id === 'fascist' && game.discard.f.includes(card)) { + if ( + id === 'fascist' && + (game.discard.f.includes(card) || game.current_events.includes(card)) + ) { return; } else if ( id !== 'fascist' && @@ -1933,6 +2230,16 @@ function list_deck(id: FactionId | 'fascist') { return deck; } +function draw_medallions() { + const medallion_ids = make_list(0, 8) as number[]; + for (let m = 0; m < 5; ++m) { + let i = random(medallion_ids.length); + let r = medallion_ids[i] as CardId; + set_delete(medallion_ids, r); + game.medallions.pool.push(r); + } +} + // #endregion // #region ARRAY diff --git a/types.d.ts b/types.d.ts index 2b44d65..859fa79 100644 --- a/types.d.ts +++ b/types.d.ts @@ -43,11 +43,13 @@ export interface Game { hands: Record; hero_points: Record; initiative: FactionId; - medaillons: Array; + medallions: Record & { pool: Array }; tableaus: Record; tracks: number[]; trash: Record; - triggered_track_effects: number[][]; + triggered_track_effects: number[]; + used_medallions: number[]; + result?: string; victory?: string; @@ -80,10 +82,11 @@ export interface View { hand: CardId[]; hero_points: Game['hero_points']; initiative: Game['initiative']; - medaillons: Game['medaillons']; + medallions: Game['medallions']; tableaus: Game['tableaus']; tracks: number[]; triggered_track_effects: Game['triggered_track_effects']; + used_medallions: Game['used_medallions']; year: number; } @@ -162,7 +165,7 @@ export interface Effect { | 'bonus' | 'hero_points' | 'front' - | 'medaillon' + | 'medallion' | 'draw_card' | 'play_card' | 'swap_card_tableau_hand' @@ -171,6 +174,7 @@ export interface Effect { | 'return_card'; target: string | number; value: number; + faction?: FactionId | 'i'; } export interface StaticData { @@ -181,7 +185,7 @@ export interface StaticData { left: number; top: number; }>; - medaillons: Array<{ + medallions: Array<{ id: number; name: string; }>; -- cgit v1.2.3