summaryrefslogtreecommitdiff
path: root/rules.ts
diff options
context:
space:
mode:
authorFrans Bongers <fransbongers@macbookpro.home>2025-03-22 19:55:15 +0100
committerFrans Bongers <fransbongers@macbookpro.home>2025-03-22 19:55:15 +0100
commite0be8aea7bc4d8de52ee0e8750968d70f86c979d (patch)
treefb2e55977b177d92d9d72543878aae25d9ed3753 /rules.ts
parenta4d3e709611d1895d5339504321f10352ffe3cb7 (diff)
downloadland-and-freedom-e0be8aea7bc4d8de52ee0e8750968d70f86c979d.tar.gz
add skip button when player does not have any hand cards
Diffstat (limited to 'rules.ts')
-rw-r--r--rules.ts16
1 files changed, 15 insertions, 1 deletions
diff --git a/rules.ts b/rules.ts
index abadd40..9484e7b 100644
--- a/rules.ts
+++ b/rules.ts
@@ -1261,6 +1261,9 @@ states.play_card = {
gen_action_card(c);
}
}
+ if (hand.length === 0) {
+ gen_action('skip');
+ }
},
spend_hp() {
resolve_spend_hp();
@@ -1273,6 +1276,12 @@ states.play_card = {
// NOTE: I don't think we are using game.played_card in the UI at the moment?
game.played_card = game.selected_cards[faction][game.selected_cards[faction].length - 1];
log_header("C" + game.played_card, faction);
+
+ insert_after_active_node(create_state_node('player_turn', faction, { src: get_active_node_args().src }));
+
+ resolve_active_and_proceed();
+ },
+ skip() {
resolve_active_and_proceed();
},
};
@@ -1957,11 +1966,17 @@ states.player_turn = {
next();
},
use_momentum() {
+ /**
+ * This will only be used in case a player gets the momentum medallion
+ * during their own turn. This needs to have similar functionality as
+ * end_turn function where game.faction_turn === faction_id
+ */
const faction_id = get_active_faction();
game.selected_cards[faction_id].pop();
game.momentum = null;
game.can_use_ap = 0;
game.can_use_mb = 0;
+ game.engine.push(create_function_node('end_of_player_turn', { f: faction_id }));
resolve_active_and_proceed();
},
use_morale_bonus() {
@@ -3345,7 +3360,6 @@ function resolve_effect(effect: Effect, source?: EffectSource): EngineNode {
resolve: () => {
return create_seq_node([
create_state_node('play_card', faction, { src: source }),
- create_state_node('player_turn', faction, { src: source }),
]);
},
},