diff options
-rw-r--r-- | rules.js | 65 |
1 files changed, 62 insertions, 3 deletions
@@ -11,6 +11,20 @@ Special card rules implemented: place_2_red remove_after_screen suffer_1_less_1_max + start_with_no_cubes + +TODO: + remove_with + rout_with + wild + take_dice_from + attack_reserve + no_morale_loss_after_rout (star=0) + +TODO: extra input steps + attack_choice + may_take_dice_from + */ @@ -200,10 +214,14 @@ exports.setup = function (seed, scenario, options) { set_add(reserve, c) else set_add(front, c) - if (card.special) - add_cubes(c, 1) - else + if (card.special) { + if (card_has_rule(c, "start_with_no_cubes")) + add_cubes(c, 0) + else + add_cubes(c, 1) + } else { add_sticks(c, card.strength) + } } for (let p = 0; p < 2; ++p) { @@ -404,6 +422,7 @@ const place_dice_once = { } const place_dice_check = { + "Full House": check_full_house, "Straight 3": check_straight_3, "Straight 4": check_straight_4, "Doubles": check_doubles, @@ -452,6 +471,7 @@ const place_dice_check = { } const place_dice_gen = { + "Full House": gen_full_house, "Straight 3": gen_straight_3, "Straight 4": gen_straight_4, "Doubles": gen_doubles, @@ -500,6 +520,7 @@ const place_dice_gen = { } const place_dice_take = { + "Full House": take_full_house, "Straight 3": take_straight_3, "Straight 4": take_straight_4, "Doubles": take_doubles, @@ -679,6 +700,18 @@ function check_triples(c) { ) } +function check_full_house(c) { + for (let x = 1; x <= 6; ++x) { + for (let y = 1; y <= 6; ++y) { + if (x !== y) { + if (check_single_count(c, x, 3) && check_single_count(c, y, 2)) + return true + } + } + } + return false +} + function gen_pool_die(v) { let p = player_index() for (let i = 0; i < 6; ++i) @@ -729,6 +762,17 @@ function gen_triples(c) { gen_pool_die(v) } +function gen_full_house(c) { + for (let x = 1; x <= 6; ++x) { + for (let y = 1; y <= 6; ++y) { + if (x !== y) { + if (check_single_count(c, x, 3) && check_single_count(c, y, 2)) + gen_pool_die(x) + } + } + } +} + function find_and_take_single(c, v) { let p = player_index() for (let i = 0; i < 6; ++i) { @@ -758,6 +802,21 @@ function take_triples(c, d) { find_and_take_single(c, v) } +function take_full_house(c, d) { + let x = get_dice_value(d) + for (let y = 1; y <= 6; ++y) { + if (x !== y) { + if (check_single_count(c, x, 3) && check_single_count(c, y, 2)) { + find_and_take_single(c, x) + find_and_take_single(c, x) + find_and_take_single(c, x) + find_and_take_single(c, y) + find_and_take_single(c, y) + } + } + } +} + function take_straight_3(c, d) { let v = get_dice_value(d) take_single(c, d) |