summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2025-03-22 16:37:02 +0100
committerTor Andersson <tor@ccxvii.net>2025-03-22 16:46:10 +0100
commit88a448a219b35138af7d494c74b27bbd8335acea (patch)
tree9a084ae5225dab372ee9cf23a006ca9a5edd6499
parentf83ef7dae8b8934aa4bf536757439b3f1f7f55b0 (diff)
downloadland-and-freedom-88a448a219b35138af7d494c74b27bbd8335acea.tar.gz
Log turning off bonus even when it's already off.
-rw-r--r--play.js2
-rw-r--r--rules.js14
-rw-r--r--rules.ts18
3 files changed, 16 insertions, 18 deletions
diff --git a/play.js b/play.js
index 2d42f0b..6592ac9 100644
--- a/play.js
+++ b/play.js
@@ -642,7 +642,7 @@ function on_log(text) { // eslint-disable-line no-unused-vars
text = text.replace(/\bC(\d+)\b/g, sub_card)
text = text.replace(/\bM(\d+)\b/g, sub_medallion)
- text = text.replace(/\bT[acmf]\b/g, sub_token)
+ text = text.replace(/\bT\d\b/g, sub_token)
text = text.replace(/\bHP\b/g, "Hero points")
// text = text.replace(/\bHP\b/g, "\u272b")
// text = text.replace(/\bHP\b/g, sub_token)
diff --git a/rules.js b/rules.js
index ab8007f..2ca6b70 100644
--- a/rules.js
+++ b/rules.js
@@ -947,9 +947,10 @@ states.change_bonus = {
game.bonuses[data_1.TEAMWORK_BONUS] === data_1.ON &&
game.bonuses[data_1.MORALE_BONUS] === data_1.ON) ||
(args.v === data_1.OFF && game.bonuses[args.t] === data_1.OFF)) {
+ view.prompt = `${bonus_names[args.t]} is already ${args.v === data_1.OFF ? 'off' : 'on'}.`;
gen_action('skip');
}
- if (args.t === data_1.ANY && args.v === data_1.ON) {
+ else if (args.t === data_1.ANY && args.v === data_1.ON) {
view.prompt = 'Turn on a Bonus.';
for (const bonus of bonuses) {
if (game.bonuses[bonus] === data_1.OFF) {
@@ -971,6 +972,8 @@ states.change_bonus = {
resolve_active_and_proceed();
},
skip() {
+ const args = get_active_node_args();
+ logi(`${bonus_names[args.t]} ${args.v === data_1.OFF ? 'off' : 'on'}`);
resolve_active_and_proceed();
},
};
@@ -2300,9 +2303,9 @@ function resolve_fascist_test() {
const test_passed = status === data_1.VICTORY ||
(status !== data_1.DEFEAT && game.fronts[front].value >= test.value);
const hero_point_actions = [];
- log_header("C" + get_current_event_id(), 'f');
+ log_header(front_names[front] + ' Test', 'f');
if (test_passed) {
- log(front_names[front] + ' Test successful:');
+ log('Test successful:');
for (const faction of get_player_order()) {
let hero_points_gain = game.fronts[front].contributions.includes(faction)
? 2
@@ -2320,7 +2323,7 @@ function resolve_fascist_test() {
}
}
else {
- log(front_names[front] + ' Test failed:');
+ log('Test failed:');
}
const effect = test_passed ? test.pass : test.fail;
const node = resolve_effect(effect, 'fascist_test');
@@ -2490,9 +2493,6 @@ function insert_use_organization_medallion_node(track_id, value) {
}));
}
function update_bonus(bonus_id, status) {
- if (game.bonuses[bonus_id] === status) {
- return;
- }
game.bonuses[bonus_id] = status;
if (status === data_1.ON)
logi(`${bonus_names[bonus_id]} on`);
diff --git a/rules.ts b/rules.ts
index 9c5be20..52f6bea 100644
--- a/rules.ts
+++ b/rules.ts
@@ -1214,9 +1214,10 @@ states.change_bonus = {
game.bonuses[MORALE_BONUS] === ON) ||
(args.v === OFF && game.bonuses[args.t] === OFF)
) {
+ view.prompt = `${bonus_names[args.t]} is already ${args.v === OFF ? 'off' : 'on'}.`;
gen_action('skip');
}
- if (args.t === ANY && args.v === ON) {
+ else if (args.t === ANY && args.v === ON) {
view.prompt = 'Turn on a Bonus.';
for (const bonus of bonuses) {
if (game.bonuses[bonus] === OFF) {
@@ -1224,9 +1225,7 @@ states.change_bonus = {
}
}
} else {
- view.prompt = `Turn ${args.v === OFF ? 'off' : 'on'} ${
- bonus_names[args.t]
- }.`;
+ view.prompt = `Turn ${args.v === OFF ? 'off' : 'on'} ${bonus_names[args.t]}.`;
gen_action_bonus(args.t);
}
},
@@ -1239,6 +1238,8 @@ states.change_bonus = {
resolve_active_and_proceed();
},
skip() {
+ const args = get_active_node_args();
+ logi(`${bonus_names[args.t]} ${args.v === OFF ? 'off' : 'on'}`);
resolve_active_and_proceed();
},
};
@@ -2837,10 +2838,10 @@ function resolve_fascist_test() {
const hero_point_actions: EngineNode[] = [];
- log_header("C" + get_current_event_id(), 'f');
+ log_header(front_names[front] + ' Test', 'f')
if (test_passed) {
- log(front_names[front] + ' Test successful:');
+ log('Test successful:');
for (const faction of get_player_order()) {
let hero_points_gain = game.fronts[front].contributions.includes(
@@ -2864,7 +2865,7 @@ function resolve_fascist_test() {
insert_after_active_node(create_seq_node(hero_point_actions));
}
} else {
- log(front_names[front] + ' Test failed:');
+ log('Test failed:');
}
const effect = test_passed ? test.pass : test.fail;
@@ -3078,9 +3079,6 @@ function insert_use_organization_medallion_node(
}
function update_bonus(bonus_id: number, status: number) {
- if (game.bonuses[bonus_id] === status) {
- return;
- }
game.bonuses[bonus_id] = status;
if (status === ON)
logi(`${bonus_names[bonus_id]} on`);