diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 33 |
1 files changed, 21 insertions, 12 deletions
@@ -150,7 +150,7 @@ exports.setup = function (seed, scenario, options) { log(".h2 " + info.date) log("") - goto_roll_phase() + goto_action_phase() return game } @@ -438,16 +438,12 @@ function can_place_dice(c) { if (!pred) throw Error("bad pattern definition: " + pattern) -console.log("can_place_dice", data.cards[c].number, pattern, pred(c)) - let wing = data.cards[c].wing -console.log(" wing " + wing, game.placed) for (let i = 0; i < game.placed.length; i += 2) { let x = game.placed[i] if (x !== c) { // TODO: place_2_on_WING ability let i_wing = data.cards[x].wing - console.log(" placed on", x, i_wing) if (i_wing === wing) return false } @@ -463,8 +459,6 @@ console.log(" wing " + wing, game.placed) function can_place_value(c, v) { let old_v = map_get(game.placed, c, 0) - console.log("can_place_value", c, v, old_v) - if (c === undefined) throw new Error("boo") return old_v === 0 || old_v === v } @@ -557,13 +551,11 @@ function check_triples() { function gen_pool_die(v) { let p = player_index() - console.log("gen_pool_die", v) for (let i = 0; i < 6; ++i) if (get_player_dice_location(p, i) < 0 && get_player_dice_value(p, i) === v) gen_action_die(p * 6 + i) } - function gen_single(c, v) { if (!can_place_value(c, v)) return false @@ -868,8 +860,27 @@ function can_take_action(c, a) { return false } +function can_take_any_action() { + let p = player_index() + for (let c of game.front[p]) { + if (has_any_dice_on_card(c)) + return true + if (has_any_cubes_on_card(c)) + return true + } + return false +} + function goto_action_phase() { - game.state = "action" + if (game.reacted) { + game.reacted = 0 + goto_roll_phase() + } else { + if (can_take_any_action()) + game.state = "action" + else + goto_roll_phase() + } } states.action = { @@ -1032,7 +1043,6 @@ function apply_hit() { } function apply_hit_per_die() { - console.log("HIT PER DIE", game.selected, count_dice_on_card(game.selected)) remove_sticks(game.target, count_dice_on_card(game.selected)) } @@ -1041,7 +1051,6 @@ function apply_hit_per_pair() { } function apply_attack(a) { -console.log("ATTACK", a.effect) switch (a.effect) { default: throw new Error("invalid attack effect: " + text) |