From 5870c99e1c54b49f6f18d4396f341137572c66f7 Mon Sep 17 00:00:00 2001 From: Mischa Untaga <99098079+MischaU8@users.noreply.github.com> Date: Sat, 25 Nov 2023 16:12:48 +0100 Subject: show opponent which cards are to be discarded --- rules.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/rules.js b/rules.js index 32a4ec7..5050d6f 100644 --- a/rules.js +++ b/rules.js @@ -2126,6 +2126,8 @@ function vm_draw_6_play_1_place_any_on_top_of_draw() { function vm_opponent_discard_2_random_draw_2() { clear_undo() next_player() + game.selected_cards = shuffle(object_copy(player_hand())).slice(0, 2) + log(`Randomly selected ${pluralize(game.selected_cards.length, 'card')} from ${game.active}'s Hand.`) game.state = "vm_opponent_discard_2_random_draw_2" } @@ -2805,25 +2807,23 @@ states.vm_place_any_on_top_of_draw = { } states.vm_opponent_discard_2_random_draw_2 = { - inactive: "discard 2 cards at random and then draw 2 cards.", + inactive: "discard 2 random cards and then draw 2 cards.", prompt() { - event_prompt("You must discard 2 cards from Hand at random and then draw 2 cards.") + event_prompt("You must discard 2 random cards and then draw 2 cards.") gen_action("next") }, next() { - clear_undo() - let first_two = shuffle(object_copy(player_hand())).slice(0, 2) - for (let c of first_two) { + for (let c of game.selected_cards) { discard_card_from_hand(c) - log(`${game.active} discarded C${c}.`) + log(`Discarded C${c}.`) } // XXX if we could discard less than two, should we also draw less than two? - let draw_count = Math.min(first_two.length, 2) - for (let i = 0; i < draw_count; ++i) { + for (let i = 0; i < game.selected_cards.length; ++i) { let card = draw_card(player_deck()) player_hand().push(card) } - log(`${game.active} drew ${draw_count} cards.`) + log(`${game.active} drew ${pluralize(game.selected_cards.length, 'card')}.`) + game.selected_cards = [] next_player() vm_next() } -- cgit v1.2.3