diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-12-13 02:25:02 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-01-08 16:36:48 +0100 |
commit | 72bd7a444bffaea97ceb2d8fb69304753a6d8307 (patch) | |
tree | 5d8e66a7ace34174edec3e69049578efa78cd91f /rules.js | |
parent | a5368010c02c750d9f14804b9edb381c808d8cac (diff) | |
download | table-battles-72bd7a444bffaea97ceb2d8fb69304753a6d8307.tar.gz |
take_1_from and make_take_from. little round top.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 37 |
1 files changed, 36 insertions, 1 deletions
@@ -408,6 +408,17 @@ function move_dice(from, to) { } } +function take_one_die(from, to) { + for (let i = 0; i < 12; ++i) { + if (get_dice_location(i) === from) { + set_dice_location(i, to) + if (to === POOL) + set_dice_value(i, 0) + to = POOL + } + } +} + function take_wild_die(from, to) { for (let i = 0; i < 12; ++i) { if (get_dice_location(i) === from) { @@ -1501,7 +1512,15 @@ function goto_attack(target) { let take_from = card_has_rule(game.selected, "take_from") if (take_from) { for (let from of take_from) - move_dice(from, game.selected) + if (has_any_dice_on_card(from)) + move_dice(from, game.selected) + } + + let take_1_from = card_has_rule(game.selected, "take_1_from") + if (take_1_from) { + for (let from of take_1_from) + if (has_any_dice_on_card(from)) + take_one_die(from, game.selected) } game.state = "attack" @@ -1564,6 +1583,12 @@ states.attack = { if (w >= 0) gen_action_dice_on_card(w) + let may_take_from = card_has_rule(game.selected, "may_take_from") + if (may_take_from) { + for (let from of may_take_from) + gen_action_dice_on_card(from) + } + view.actions.attack = 1 }, attack() { @@ -1585,6 +1610,11 @@ states.attack = { log("Wild die from C" + w + ".") take_wild_die(w, game.selected) } + let may_take_from = card_has_rule(game.selected, "may_take_from") + if (may_take_from) { + move_dice(get_dice_location(d), game.selected) + goto_attack(game.target) // recompute hits + } } } @@ -1873,6 +1903,7 @@ function goto_absorb(c, a) { case "When target suffers Hits, this unit suffers them instead.": break case "When target suffers Hits, this card suffers 1 hit ONLY instead.": + case "When target suffers Hits, this unit suffers 1 hit ONLY instead.": game.hits = 1 break case "When target suffers Hits, this card suffers 1 less hit per die.": @@ -1972,6 +2003,8 @@ function get_attack_hits(c, a) { case "1 hit per die. Ignore first target until it comes out of Reserve.": case "1 hit per die (but see below). 1 self per action.": case "1 hit per die (plus dice from E. Phalanx).": + case "1 hit per die. 1 self per action. (But see Sharpshooters.)": + case "1 hit per die. 1 self per action. (But see 4th Alabama.)": return count_dice_on_card(c) case "1 hit per pair.": case "1 hit per pair. 1 self per action.": @@ -2000,6 +2033,8 @@ function get_attack_self(c, a) { case "1 hit per action. 1 self per action.": case "1 hit per die. 1 self per action.": case "1 hit per die (but see below). 1 self per action.": + case "1 hit per die. 1 self per action. (But see Sharpshooters.)": + case "1 hit per die. 1 self per action. (But see 4th Alabama.)": case "1 hit per pair. 1 self per action.": case "1 hit, PLUS 1 hit per die. 1 self per action.": return 1 |