summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.js3
-rw-r--r--rules.js11
2 files changed, 5 insertions, 9 deletions
diff --git a/play.js b/play.js
index 22ae8a2..1c37e19 100644
--- a/play.js
+++ b/play.js
@@ -969,8 +969,7 @@ function is_stacked() {
}
function update_discard() {
- // TODO when rewind and needs to empty
- if ("discard" in view) {
+ if (view.discard) {
let stacked = is_stacked()
ui.discard_pile.style.flexDirection = (stacked ? "column" : "row")
for (let i = 0; i < 4; ++i) {
diff --git a/rules.js b/rules.js
index ac96885..60bcafa 100644
--- a/rules.js
+++ b/rules.js
@@ -140,13 +140,14 @@ exports.view = function (state, role) {
dice: game.dice,
}
- if (game.cmd && "attacker" in game.cmd) {
+ if (game.cmd && game.cmd.attacker !== undefined) {
view.attack = {
where: game.cmd.where,
attacker: game.cmd.attacker,
target: game.cmd.target
}
- if ("n_units" in game.cmd) view.attack.n_units = game.cmd.n_units
+ if (game.cmd.n_units !== undefined)
+ view.attack.n_units = game.cmd.n_units
}
if (game.result) {
@@ -252,7 +253,7 @@ exports.setup = function (seed, scenario, _options) {
cavalry: Array(10).fill(AVAILABLE),
deck: [],
of_gods_and_kings: [null, null, 0],
- // discard: [],
+ discard: [],
order: [],
cmd: {
type: null,
@@ -407,10 +408,6 @@ function end_card() {
}
function update_discard() {
- if ("discard" in game === false) {
- game.discard = []
- }
-
if (this_card() === 45)
game.discard = [45]
else if (this_card() === 46)