summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js50
1 files changed, 46 insertions, 4 deletions
diff --git a/rules.js b/rules.js
index 6c9187b..3b1b8e9 100644
--- a/rules.js
+++ b/rules.js
@@ -1140,14 +1140,56 @@ states.move_track = {
resolve_active_and_proceed();
},
};
+function can_move_track_up(track_id) {
+ const faction = get_active_faction();
+ return game.faction_turn === data_1.COMMUNISTS_ID &&
+ faction === data_1.COMMUNISTS_ID &&
+ track_id === data_1.GOVERNMENT
+ ? false
+ : true;
+}
+function can_move_track_down(track_id) {
+ const faction = get_active_faction();
+ if (game.faction_turn === data_1.ANARCHISTS_ID &&
+ faction === data_1.ANARCHISTS_ID &&
+ (track_id === data_1.LIBERTY || track_id === data_1.COLLECTIVIZATION)) {
+ return false;
+ }
+ if (game.faction_turn === data_1.COMMUNISTS_ID &&
+ faction === data_1.COMMUNISTS_ID &&
+ track_id === data_1.SOVIET_SUPPORT) {
+ return false;
+ }
+ if (game.faction_turn === data_1.MODERATES_ID &&
+ faction === data_1.MODERATES_ID &&
+ (track_id === data_1.GOVERNMENT || track_id === data_1.FOREIGN_AID)) {
+ return false;
+ }
+ return true;
+}
states.move_track_up_or_down = {
inactive: 'move a track',
prompt() {
gen_spend_hero_points();
- const node = get_active_node();
- view.prompt = `Move ${get_track_name(node.a.track_id)} up or down`;
- gen_action('up');
- gen_action('down');
+ const { track_id } = get_active_node_args();
+ const can_move_up = can_move_track_up(track_id);
+ const can_move_down = can_move_track_down(track_id);
+ const track_name = get_track_name(track_id);
+ if (can_move_down && can_move_up) {
+ view.prompt = `Move ${track_name} up or down`;
+ }
+ else if (can_move_up) {
+ view.prompt = `Move ${track_name} up`;
+ }
+ else {
+ view.prompt = `Move ${track_name} down`;
+ }
+ if (can_move_up) {
+ gen_action('up');
+ }
+ if (can_move_down) {
+ gen_action('down');
+ }
},
spend_hp() {
resolve_spend_hp();