summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorJoël Simoneau <simoneaujoel@gmail.com>2025-04-09 20:55:02 -0400
committerJoël Simoneau <simoneaujoel@gmail.com>2025-04-09 20:55:02 -0400
commitf4e6fa42b7c256a86c9e6f94ab1ded8a6aab883c (patch)
tree459f1e89bb3909f901fa1c37a7b2a4089412a65c /rules.js
parent320900676c29dec41252b231b79905c8391513c4 (diff)
downloadvijayanagara-f4e6fa42b7c256a86c9e6f94ab1ded8a6aab883c.tar.gz
Discard pile!
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index 2b2cfc5..8ac2e91 100644
--- a/rules.js
+++ b/rules.js
@@ -127,6 +127,7 @@ exports.view = function (state, role) {
resources: game.resources,
inf: game.inf,
deck: [ this_card, deck_size, card_back, game.of_gods_and_kings ],
+ discard: game.discard,
cavalry: game.cavalry,
cylinder: game.cylinder,
pieces: game.pieces,
@@ -251,6 +252,7 @@ exports.setup = function (seed, scenario, _options) {
cavalry: Array(10).fill(AVAILABLE),
deck: [],
of_gods_and_kings: [null, null, 0],
+ discard: [],
order: [],
cmd: {
type: null,
@@ -403,11 +405,22 @@ function resume_event_card() {
function end_card() {
clear_undo()
-
+ update_discard()
array_remove(game.deck, 0)
goto_card()
}
+function update_discard() {
+ if (this_card() === 45)
+ game.discard = [45]
+ else if (this_card() === 46)
+ game.discard = [45, 46]
+ else if (this_card() === 47)
+ game.discard = [45, 46, 47]
+ else if (this_card() > 36)
+ game.discard.push(this_card())
+}
+
function goto_eligible() {
change_current(next_eligible_faction())
if (game.current < 0) {