Move to bottom of library in random order. (#3549)

* - Allow shuffling a subset of a zone
- When moving cards to the bottom of library, shuffle them after
- Process events in the correct order serverside

* Zach fixes

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>

* Comments + additional guard
This commit is contained in:
Rob Blanckaert 2019-02-07 11:08:44 -08:00 committed by Zach H
parent 6e3fd30fcb
commit d932581f4a
10 changed files with 160 additions and 109 deletions

View file

@ -738,7 +738,7 @@ void Player::retranslateUi()
aMoveToTopLibrary->setText(tr("&Top of library"));
aMoveToXfromTopOfLibrary->setText(tr("X cards from the top of library..."));
aMoveToBottomLibrary->setText(tr("&Bottom of library"));
aMoveToBottomLibrary->setText(tr("&Bottom of library in random order"));
aMoveToHand->setText(tr("&Hand"));
aMoveToGraveyard->setText(tr("&Graveyard"));
aMoveToExile->setText(tr("&Exile"));
@ -1453,7 +1453,7 @@ void Player::eventShuffle(const Event_Shuffle &event)
if (zone->getView() && zone->getView()->getRevealZone()) {
zone->getView()->setWriteableRevealZone(false);
}
emit logShuffle(this, zone);
emit logShuffle(this, zone, event.start(), event.end());
}
void Player::eventRollDie(const Event_RollDie &event)
@ -2440,6 +2440,16 @@ void Player::cardMenuAction()
cmd->set_target_zone("deck");
cmd->set_x(-1);
cmd->set_y(0);
if (idList.card_size() > 1) {
auto *scmd = new Command_Shuffle;
scmd->set_zone_name("deck");
scmd->set_start(-idList.card_size());
scmd->set_end(-1);
// Server process events backwards, so...
commandList.append(scmd);
}
commandList.append(cmd);
break;
}