summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrans Bongers <fransbongers@macbookpro.home>2025-03-25 11:52:26 +0100
committerFrans Bongers <fransbongers@macbookpro.home>2025-03-25 11:52:26 +0100
commit5aef76ee121090ead684540b9889fd8e10852c82 (patch)
tree568a5a4bf69f7c68d334d67247432df8b5b55ed2
parent57c7b2292f44712b27efebff4401be22cead0437 (diff)
downloadland-and-freedom-5aef76ee121090ead684540b9889fd8e10852c82.tar.gz
auto draw from bag of glory
-rw-r--r--rules.js29
-rw-r--r--rules.ts40
2 files changed, 42 insertions, 27 deletions
diff --git a/rules.js b/rules.js
index b1714dc..e44b8e0 100644
--- a/rules.js
+++ b/rules.js
@@ -1213,25 +1213,32 @@ states.draw_card = {
resolve_active_and_proceed(true);
},
};
+function draw_glory_from_bag() {
+ const index = random(game.bag_of_glory.length);
+ const faction = game.bag_of_glory[index];
+ game.glory.push(faction);
+ game.glory_current_year = game.glory_current_year = [
+ false,
+ false,
+ false,
+ ];
+ game.glory_current_year[faction] = true;
+ array_remove(game.bag_of_glory, index);
+ logi(`Pulled T${faction} from the Bag`);
+}
states.draw_glory = {
inactive: 'draw from the Bag of Glory',
+ auto_resolve() {
+ draw_glory_from_bag();
+ return true;
+ },
prompt() {
gen_spend_hero_points();
view.prompt = 'Draw from the Bag of Glory.';
gen_action('draw_glory');
},
draw_glory() {
- const index = random(game.bag_of_glory.length);
- const faction = game.bag_of_glory[index];
- game.glory.push(faction);
- game.glory_current_year = game.glory_current_year = [
- false,
- false,
- false,
- ];
- game.glory_current_year[faction] = true;
- array_remove(game.bag_of_glory, index);
- logi(`Pulled T${faction} from the Bag`);
+ draw_glory_from_bag();
resolve_active_and_proceed(true);
},
};
diff --git a/rules.ts b/rules.ts
index 2e386a1..bb64184 100644
--- a/rules.ts
+++ b/rules.ts
@@ -1509,30 +1509,38 @@ states.draw_card = {
},
};
+function draw_glory_from_bag() {
+ const index = random(game.bag_of_glory.length);
+ const faction = game.bag_of_glory[index];
+
+ game.glory.push(faction);
+
+ game.glory_current_year = game.glory_current_year = [
+ false,
+ false,
+ false,
+ ];
+
+ game.glory_current_year[faction] = true;
+
+ array_remove(game.bag_of_glory, index);
+
+ logi(`Pulled T${faction} from the Bag`);
+}
+
states.draw_glory = {
inactive: 'draw from the Bag of Glory',
+ auto_resolve() {
+ draw_glory_from_bag();
+ return true;
+ },
prompt() {
gen_spend_hero_points();
view.prompt = 'Draw from the Bag of Glory.';
gen_action('draw_glory');
},
draw_glory() {
- const index = random(game.bag_of_glory.length);
- const faction = game.bag_of_glory[index];
-
- game.glory.push(faction);
-
- game.glory_current_year = game.glory_current_year = [
- false,
- false,
- false,
- ];
-
- game.glory_current_year[faction] = true;
-
- array_remove(game.bag_of_glory, index);
-
- logi(`Pulled T${faction} from the Bag`);
+ draw_glory_from_bag();
resolve_active_and_proceed(true);
},