add menus for top and bottom actions (#4314)
* add menus for top and bottom actions * style points * github online editor is literally the worst * add moving cards from bottom of deck to hand fix getting multiple cards from the bottom note that moving cards from the bottom of the deck does not get remembered by or disrupt undoing draws * Apply suggestions from code review Co-authored-by: tooomm <tooomm@users.noreply.github.com> Co-authored-by: tooomm <tooomm@users.noreply.github.com>
This commit is contained in:
parent
6c004155ff
commit
ad0f313c9d
3 changed files with 369 additions and 84 deletions
|
@ -239,6 +239,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
||||||
connect(aShuffle, SIGNAL(triggered()), this, SLOT(actShuffle()));
|
connect(aShuffle, SIGNAL(triggered()), this, SLOT(actShuffle()));
|
||||||
aMulligan = new QAction(this);
|
aMulligan = new QAction(this);
|
||||||
connect(aMulligan, SIGNAL(triggered()), this, SLOT(actMulligan()));
|
connect(aMulligan, SIGNAL(triggered()), this, SLOT(actMulligan()));
|
||||||
|
|
||||||
aMoveTopToPlay = new QAction(this);
|
aMoveTopToPlay = new QAction(this);
|
||||||
connect(aMoveTopToPlay, SIGNAL(triggered()), this, SLOT(actMoveTopCardToPlay()));
|
connect(aMoveTopToPlay, SIGNAL(triggered()), this, SLOT(actMoveTopCardToPlay()));
|
||||||
aMoveTopToPlayFaceDown = new QAction(this);
|
aMoveTopToPlayFaceDown = new QAction(this);
|
||||||
|
@ -253,8 +254,25 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
||||||
connect(aMoveTopCardsToExile, SIGNAL(triggered()), this, SLOT(actMoveTopCardsToExile()));
|
connect(aMoveTopCardsToExile, SIGNAL(triggered()), this, SLOT(actMoveTopCardsToExile()));
|
||||||
aMoveTopCardToBottom = new QAction(this);
|
aMoveTopCardToBottom = new QAction(this);
|
||||||
connect(aMoveTopCardToBottom, SIGNAL(triggered()), this, SLOT(actMoveTopCardToBottom()));
|
connect(aMoveTopCardToBottom, SIGNAL(triggered()), this, SLOT(actMoveTopCardToBottom()));
|
||||||
aMoveBottomCardToGrave = new QAction(this);
|
|
||||||
connect(aMoveBottomCardToGrave, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToGrave()));
|
aDrawBottomCard = new QAction(this);
|
||||||
|
connect(aDrawBottomCard, SIGNAL(triggered()), this, SLOT(actDrawBottomCard()));
|
||||||
|
aDrawBottomCards = new QAction(this);
|
||||||
|
connect(aDrawBottomCards, SIGNAL(triggered()), this, SLOT(actDrawBottomCards()));
|
||||||
|
aMoveBottomToPlay = new QAction(this);
|
||||||
|
connect(aMoveBottomToPlay, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToPlay()));
|
||||||
|
aMoveBottomToPlayFaceDown = new QAction(this);
|
||||||
|
connect(aMoveBottomToPlayFaceDown, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToPlayFaceDown()));
|
||||||
|
aMoveBottomCardToGraveyard = new QAction(this);
|
||||||
|
connect(aMoveBottomCardToGraveyard, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToGrave()));
|
||||||
|
aMoveBottomCardToExile = new QAction(this);
|
||||||
|
connect(aMoveBottomCardToExile, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToExile()));
|
||||||
|
aMoveBottomCardsToGraveyard = new QAction(this);
|
||||||
|
connect(aMoveBottomCardsToGraveyard, SIGNAL(triggered()), this, SLOT(actMoveBottomCardsToGrave()));
|
||||||
|
aMoveBottomCardsToExile = new QAction(this);
|
||||||
|
connect(aMoveBottomCardsToExile, SIGNAL(triggered()), this, SLOT(actMoveBottomCardsToExile()));
|
||||||
|
aMoveBottomCardToTop = new QAction(this);
|
||||||
|
connect(aMoveBottomCardToTop, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToTop()));
|
||||||
}
|
}
|
||||||
|
|
||||||
playerMenu = new TearOffMenu();
|
playerMenu = new TearOffMenu();
|
||||||
|
@ -292,21 +310,32 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
||||||
libraryMenu->addAction(aAlwaysRevealTopCard);
|
libraryMenu->addAction(aAlwaysRevealTopCard);
|
||||||
libraryMenu->addAction(aAlwaysLookAtTopCard);
|
libraryMenu->addAction(aAlwaysLookAtTopCard);
|
||||||
libraryMenu->addSeparator();
|
libraryMenu->addSeparator();
|
||||||
libraryMenu->addAction(aMoveTopToPlay);
|
topLibraryMenu = libraryMenu->addTearOffMenu(QString());
|
||||||
libraryMenu->addAction(aMoveTopToPlayFaceDown);
|
bottomLibraryMenu = libraryMenu->addTearOffMenu(QString());
|
||||||
libraryMenu->addAction(aMoveTopCardToBottom);
|
|
||||||
libraryMenu->addAction(aMoveBottomCardToGrave);
|
|
||||||
libraryMenu->addSeparator();
|
|
||||||
libraryMenu->addAction(aMoveTopCardToGraveyard);
|
|
||||||
libraryMenu->addAction(aMoveTopCardToExile);
|
|
||||||
libraryMenu->addAction(aMoveTopCardsToGraveyard);
|
|
||||||
libraryMenu->addAction(aMoveTopCardsToExile);
|
|
||||||
libraryMenu->addSeparator();
|
libraryMenu->addSeparator();
|
||||||
libraryMenu->addAction(aOpenDeckInDeckEditor);
|
libraryMenu->addAction(aOpenDeckInDeckEditor);
|
||||||
deck->setMenu(libraryMenu, aDrawCard);
|
deck->setMenu(libraryMenu, aDrawCard);
|
||||||
} else {
|
|
||||||
handMenu = nullptr;
|
topLibraryMenu->addAction(aMoveTopToPlay);
|
||||||
libraryMenu = nullptr;
|
topLibraryMenu->addAction(aMoveTopToPlayFaceDown);
|
||||||
|
topLibraryMenu->addAction(aMoveTopCardToBottom);
|
||||||
|
topLibraryMenu->addSeparator();
|
||||||
|
topLibraryMenu->addAction(aMoveTopCardToGraveyard);
|
||||||
|
topLibraryMenu->addAction(aMoveTopCardsToGraveyard);
|
||||||
|
topLibraryMenu->addAction(aMoveTopCardToExile);
|
||||||
|
topLibraryMenu->addAction(aMoveTopCardsToExile);
|
||||||
|
|
||||||
|
bottomLibraryMenu->addAction(aDrawBottomCard);
|
||||||
|
bottomLibraryMenu->addAction(aDrawBottomCards);
|
||||||
|
bottomLibraryMenu->addSeparator();
|
||||||
|
bottomLibraryMenu->addAction(aMoveBottomToPlay);
|
||||||
|
bottomLibraryMenu->addAction(aMoveBottomToPlayFaceDown);
|
||||||
|
bottomLibraryMenu->addAction(aMoveBottomCardToTop);
|
||||||
|
bottomLibraryMenu->addSeparator();
|
||||||
|
bottomLibraryMenu->addAction(aMoveBottomCardToGraveyard);
|
||||||
|
bottomLibraryMenu->addAction(aMoveBottomCardsToGraveyard);
|
||||||
|
bottomLibraryMenu->addAction(aMoveBottomCardToExile);
|
||||||
|
bottomLibraryMenu->addAction(aMoveBottomCardsToExile);
|
||||||
}
|
}
|
||||||
|
|
||||||
graveMenu = playerMenu->addTearOffMenu(QString());
|
graveMenu = playerMenu->addTearOffMenu(QString());
|
||||||
|
@ -699,24 +728,36 @@ void Player::retranslateUi()
|
||||||
aViewHand->setText(tr("&View hand"));
|
aViewHand->setText(tr("&View hand"));
|
||||||
aViewTopCards->setText(tr("View &top cards of library..."));
|
aViewTopCards->setText(tr("View &top cards of library..."));
|
||||||
mRevealLibrary->setTitle(tr("Reveal &library to..."));
|
mRevealLibrary->setTitle(tr("Reveal &library to..."));
|
||||||
mRevealTopCard->setTitle(tr("Reveal t&op cards to..."));
|
mRevealTopCard->setTitle(tr("Reveal &top cards to..."));
|
||||||
|
topLibraryMenu->setTitle(tr("&Top of library..."));
|
||||||
|
bottomLibraryMenu->setTitle(tr("&Bottom of library..."));
|
||||||
aAlwaysRevealTopCard->setText(tr("&Always reveal top card"));
|
aAlwaysRevealTopCard->setText(tr("&Always reveal top card"));
|
||||||
aAlwaysLookAtTopCard->setText(tr("Al&ways look at top card"));
|
aAlwaysLookAtTopCard->setText(tr("&Always look at top card"));
|
||||||
aOpenDeckInDeckEditor->setText(tr("O&pen deck in deck editor"));
|
aOpenDeckInDeckEditor->setText(tr("&Open deck in deck editor"));
|
||||||
aViewSideboard->setText(tr("&View sideboard"));
|
aViewSideboard->setText(tr("&View sideboard"));
|
||||||
aDrawCard->setText(tr("&Draw card"));
|
aDrawCard->setText(tr("&Draw card"));
|
||||||
aDrawCards->setText(tr("D&raw cards..."));
|
aDrawCards->setText(tr("D&raw cards..."));
|
||||||
aUndoDraw->setText(tr("&Undo last draw"));
|
aUndoDraw->setText(tr("&Undo last draw"));
|
||||||
aMulligan->setText(tr("Take &mulligan"));
|
aMulligan->setText(tr("Take &mulligan"));
|
||||||
aShuffle->setText(tr("&Shuffle"));
|
aShuffle->setText(tr("&Shuffle"));
|
||||||
aMoveTopToPlay->setText(tr("Play top card"));
|
|
||||||
|
aMoveTopToPlay->setText(tr("&Play top card"));
|
||||||
aMoveTopToPlayFaceDown->setText(tr("Play top card &face down"));
|
aMoveTopToPlayFaceDown->setText(tr("Play top card &face down"));
|
||||||
aMoveTopCardToGraveyard->setText(tr("Move top card to grave&yard"));
|
aMoveTopCardToGraveyard->setText(tr("Move top card to grave&yard"));
|
||||||
aMoveTopCardToExile->setText(tr("Move top card to e&xile"));
|
aMoveTopCardToExile->setText(tr("Move top card to e&xile"));
|
||||||
aMoveTopCardsToGraveyard->setText(tr("Move top cards to &graveyard..."));
|
aMoveTopCardsToGraveyard->setText(tr("Move top cards to &graveyard..."));
|
||||||
aMoveTopCardsToExile->setText(tr("Move top cards to &exile..."));
|
aMoveTopCardsToExile->setText(tr("Move top cards to &exile..."));
|
||||||
aMoveTopCardToBottom->setText(tr("Put top card on &bottom"));
|
aMoveTopCardToBottom->setText(tr("Put top card on &bottom"));
|
||||||
aMoveBottomCardToGrave->setText(tr("Put bottom card &in graveyard"));
|
|
||||||
|
aDrawBottomCard->setText(tr("&Draw bottom card"));
|
||||||
|
aDrawBottomCards->setText(tr("D&raw bottom cards..."));
|
||||||
|
aMoveBottomToPlay->setText(tr("&Play bottom card"));
|
||||||
|
aMoveBottomToPlayFaceDown->setText(tr("Play bottom card &face down"));
|
||||||
|
aMoveBottomCardToGraveyard->setText(tr("Move bottom card to grave&yard"));
|
||||||
|
aMoveBottomCardToExile->setText(tr("Move bottom card to e&xile"));
|
||||||
|
aMoveBottomCardsToGraveyard->setText(tr("Move bottom cards to &graveyard..."));
|
||||||
|
aMoveBottomCardsToExile->setText(tr("Move bottom cards to &exile..."));
|
||||||
|
aMoveBottomCardToTop->setText(tr("Put bottom card on &top"));
|
||||||
|
|
||||||
handMenu->setTitle(tr("&Hand"));
|
handMenu->setTitle(tr("&Hand"));
|
||||||
mRevealHand->setTitle(tr("&Reveal hand to..."));
|
mRevealHand->setTitle(tr("&Reveal hand to..."));
|
||||||
|
@ -887,7 +928,15 @@ void Player::setShortcutsActive()
|
||||||
aMoveTopCardToExile->setShortcut(shortcuts.getSingleShortcut("Player/aMoveTopCardToExile"));
|
aMoveTopCardToExile->setShortcut(shortcuts.getSingleShortcut("Player/aMoveTopCardToExile"));
|
||||||
aMoveTopCardsToExile->setShortcut(shortcuts.getSingleShortcut("Player/aMoveTopCardsToExile"));
|
aMoveTopCardsToExile->setShortcut(shortcuts.getSingleShortcut("Player/aMoveTopCardsToExile"));
|
||||||
aMoveTopCardToBottom->setShortcut(shortcuts.getSingleShortcut("Player/aMoveTopCardToBottom"));
|
aMoveTopCardToBottom->setShortcut(shortcuts.getSingleShortcut("Player/aMoveTopCardToBottom"));
|
||||||
aMoveBottomCardToGrave->setShortcut(shortcuts.getSingleShortcut("Player/aMoveBottomCardToGrave"));
|
aDrawBottomCard->setShortcut(shortcuts.getSingleShortcut("Player/aDrawBottomCard"));
|
||||||
|
aDrawBottomCards->setShortcut(shortcuts.getSingleShortcut("Player/aDrawBottomCards"));
|
||||||
|
aMoveBottomToPlay->setShortcut(shortcuts.getSingleShortcut("Player/aMoveBottomToPlay"));
|
||||||
|
aMoveBottomToPlayFaceDown->setShortcut(shortcuts.getSingleShortcut("Player/aMoveBottomToPlayFaceDown"));
|
||||||
|
aMoveBottomCardToGraveyard->setShortcut(shortcuts.getSingleShortcut("Player/aMoveBottomCardToGrave"));
|
||||||
|
aMoveBottomCardsToGraveyard->setShortcut(shortcuts.getSingleShortcut("Player/aMoveBottomCardsToGrave"));
|
||||||
|
aMoveBottomCardToExile->setShortcut(shortcuts.getSingleShortcut("Player/aMoveBottomCardToExile"));
|
||||||
|
aMoveBottomCardsToExile->setShortcut(shortcuts.getSingleShortcut("Player/aMoveBottomCardsToExile"));
|
||||||
|
aMoveBottomCardToTop->setShortcut(shortcuts.getSingleShortcut("Player/aMoveBottomCardToTop"));
|
||||||
aPlayFacedown->setShortcut(shortcuts.getSingleShortcut("Player/aPlayFacedown"));
|
aPlayFacedown->setShortcut(shortcuts.getSingleShortcut("Player/aPlayFacedown"));
|
||||||
aPlay->setShortcut(shortcuts.getSingleShortcut("Player/aPlay"));
|
aPlay->setShortcut(shortcuts.getSingleShortcut("Player/aPlay"));
|
||||||
}
|
}
|
||||||
|
@ -918,6 +967,14 @@ void Player::setShortcutsInactive()
|
||||||
aMoveTopCardsToGraveyard->setShortcut(QKeySequence());
|
aMoveTopCardsToGraveyard->setShortcut(QKeySequence());
|
||||||
aMoveTopCardToExile->setShortcut(QKeySequence());
|
aMoveTopCardToExile->setShortcut(QKeySequence());
|
||||||
aMoveTopCardsToExile->setShortcut(QKeySequence());
|
aMoveTopCardsToExile->setShortcut(QKeySequence());
|
||||||
|
aDrawBottomCard->setShortcut(QKeySequence());
|
||||||
|
aDrawBottomCards->setShortcut(QKeySequence());
|
||||||
|
aMoveBottomToPlay->setShortcut(QKeySequence());
|
||||||
|
aMoveBottomToPlayFaceDown->setShortcut(QKeySequence());
|
||||||
|
aMoveBottomCardToGraveyard->setShortcut(QKeySequence());
|
||||||
|
aMoveBottomCardsToGraveyard->setShortcut(QKeySequence());
|
||||||
|
aMoveBottomCardToExile->setShortcut(QKeySequence());
|
||||||
|
aMoveBottomCardsToExile->setShortcut(QKeySequence());
|
||||||
|
|
||||||
QMapIterator<int, AbstractCounter *> counterIterator(counters);
|
QMapIterator<int, AbstractCounter *> counterIterator(counters);
|
||||||
while (counterIterator.hasNext()) {
|
while (counterIterator.hasNext()) {
|
||||||
|
@ -1094,6 +1151,24 @@ void Player::actUndoDraw()
|
||||||
sendGameCommand(Command_UndoDraw());
|
sendGameCommand(Command_UndoDraw());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::cmdSetTopCard(Command_MoveCard &cmd)
|
||||||
|
{
|
||||||
|
cmd.set_start_zone("deck");
|
||||||
|
auto *cardToMove = cmd.mutable_cards_to_move()->add_card();
|
||||||
|
cardToMove->set_card_id(0);
|
||||||
|
cmd.set_target_player_id(getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::cmdSetBottomCard(Command_MoveCard &cmd)
|
||||||
|
{
|
||||||
|
CardZone *zone = zones.value("deck");
|
||||||
|
int lastCard = zone->getCards().size() - 1;
|
||||||
|
cmd.set_start_zone("deck");
|
||||||
|
auto *cardToMove = cmd.mutable_cards_to_move()->add_card();
|
||||||
|
cardToMove->set_card_id(lastCard);
|
||||||
|
cmd.set_target_player_id(getId());
|
||||||
|
}
|
||||||
|
|
||||||
void Player::actMoveTopCardToGrave()
|
void Player::actMoveTopCardToGrave()
|
||||||
{
|
{
|
||||||
if (zones.value("deck")->getCards().empty()) {
|
if (zones.value("deck")->getCards().empty()) {
|
||||||
|
@ -1101,9 +1176,7 @@ void Player::actMoveTopCardToGrave()
|
||||||
}
|
}
|
||||||
|
|
||||||
Command_MoveCard cmd;
|
Command_MoveCard cmd;
|
||||||
cmd.set_start_zone("deck");
|
cmdSetTopCard(cmd);
|
||||||
cmd.mutable_cards_to_move()->add_card()->set_card_id(0);
|
|
||||||
cmd.set_target_player_id(getId());
|
|
||||||
cmd.set_target_zone("grave");
|
cmd.set_target_zone("grave");
|
||||||
cmd.set_x(0);
|
cmd.set_x(0);
|
||||||
cmd.set_y(0);
|
cmd.set_y(0);
|
||||||
|
@ -1118,9 +1191,7 @@ void Player::actMoveTopCardToExile()
|
||||||
}
|
}
|
||||||
|
|
||||||
Command_MoveCard cmd;
|
Command_MoveCard cmd;
|
||||||
cmd.set_start_zone("deck");
|
cmdSetTopCard(cmd);
|
||||||
cmd.mutable_cards_to_move()->add_card()->set_card_id(0);
|
|
||||||
cmd.set_target_player_id(getId());
|
|
||||||
cmd.set_target_zone("rfg");
|
cmd.set_target_zone("rfg");
|
||||||
cmd.set_x(0);
|
cmd.set_x(0);
|
||||||
cmd.set_y(0);
|
cmd.set_y(0);
|
||||||
|
@ -1130,13 +1201,15 @@ void Player::actMoveTopCardToExile()
|
||||||
|
|
||||||
void Player::actMoveTopCardsToGrave()
|
void Player::actMoveTopCardsToGrave()
|
||||||
{
|
{
|
||||||
int number = QInputDialog::getInt(game, tr("Move top cards to grave"), tr("Number:"));
|
const int maxCards = zones.value("deck")->getCards().size();
|
||||||
if (!number) {
|
if (maxCards == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int maxCards = zones.value("deck")->getCards().size();
|
int number = QInputDialog::getInt(game, tr("Move top cards to grave"), tr("Number:"));
|
||||||
if (number > maxCards) {
|
if (number == 0) {
|
||||||
|
return;
|
||||||
|
} else if (number > maxCards) {
|
||||||
number = maxCards;
|
number = maxCards;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1156,13 +1229,15 @@ void Player::actMoveTopCardsToGrave()
|
||||||
|
|
||||||
void Player::actMoveTopCardsToExile()
|
void Player::actMoveTopCardsToExile()
|
||||||
{
|
{
|
||||||
int number = QInputDialog::getInt(game, tr("Move top cards to exile"), tr("Number:"));
|
const int maxCards = zones.value("deck")->getCards().size();
|
||||||
if (!number) {
|
if (maxCards == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int maxCards = zones.value("deck")->getCards().size();
|
int number = QInputDialog::getInt(game, tr("Move top cards to exile"), tr("Number:"));
|
||||||
if (number > maxCards) {
|
if (number == 0) {
|
||||||
|
return;
|
||||||
|
} else if (number > maxCards) {
|
||||||
number = maxCards;
|
number = maxCards;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1182,12 +1257,14 @@ void Player::actMoveTopCardsToExile()
|
||||||
|
|
||||||
void Player::actMoveTopCardToBottom()
|
void Player::actMoveTopCardToBottom()
|
||||||
{
|
{
|
||||||
|
if (zones.value("deck")->getCards().empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Command_MoveCard cmd;
|
Command_MoveCard cmd;
|
||||||
cmd.set_start_zone("deck");
|
cmdSetTopCard(cmd);
|
||||||
cmd.mutable_cards_to_move()->add_card()->set_card_id(0);
|
|
||||||
cmd.set_target_player_id(getId());
|
|
||||||
cmd.set_target_zone("deck");
|
cmd.set_target_zone("deck");
|
||||||
cmd.set_x(-1);
|
cmd.set_x(-1); // bottom of deck
|
||||||
cmd.set_y(0);
|
cmd.set_y(0);
|
||||||
|
|
||||||
sendGameCommand(cmd);
|
sendGameCommand(cmd);
|
||||||
|
@ -1195,11 +1272,12 @@ void Player::actMoveTopCardToBottom()
|
||||||
|
|
||||||
void Player::actMoveTopCardToPlay()
|
void Player::actMoveTopCardToPlay()
|
||||||
{
|
{
|
||||||
|
if (zones.value("deck")->getCards().empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Command_MoveCard cmd;
|
Command_MoveCard cmd;
|
||||||
cmd.set_start_zone("deck");
|
cmdSetTopCard(cmd);
|
||||||
CardToMove *cardToMove = cmd.mutable_cards_to_move()->add_card();
|
|
||||||
cardToMove->set_card_id(0);
|
|
||||||
cmd.set_target_player_id(getId());
|
|
||||||
cmd.set_target_zone("stack");
|
cmd.set_target_zone("stack");
|
||||||
cmd.set_x(-1);
|
cmd.set_x(-1);
|
||||||
cmd.set_y(0);
|
cmd.set_y(0);
|
||||||
|
@ -1209,6 +1287,10 @@ void Player::actMoveTopCardToPlay()
|
||||||
|
|
||||||
void Player::actMoveTopCardToPlayFaceDown()
|
void Player::actMoveTopCardToPlayFaceDown()
|
||||||
{
|
{
|
||||||
|
if (zones.value("deck")->getCards().empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Command_MoveCard cmd;
|
Command_MoveCard cmd;
|
||||||
cmd.set_start_zone("deck");
|
cmd.set_start_zone("deck");
|
||||||
CardToMove *cardToMove = cmd.mutable_cards_to_move()->add_card();
|
CardToMove *cardToMove = cmd.mutable_cards_to_move()->add_card();
|
||||||
|
@ -1224,15 +1306,183 @@ void Player::actMoveTopCardToPlayFaceDown()
|
||||||
|
|
||||||
void Player::actMoveBottomCardToGrave()
|
void Player::actMoveBottomCardToGrave()
|
||||||
{
|
{
|
||||||
CardZone *zone = zones.value("deck");
|
if (zones.value("deck")->getCards().empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Command_MoveCard cmd;
|
||||||
|
cmdSetBottomCard(cmd);
|
||||||
|
cmd.set_target_zone("grave");
|
||||||
|
cmd.set_x(0);
|
||||||
|
cmd.set_y(0);
|
||||||
|
|
||||||
|
sendGameCommand(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::actMoveBottomCardToExile()
|
||||||
|
{
|
||||||
|
if (zones.value("deck")->getCards().empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Command_MoveCard cmd;
|
||||||
|
cmdSetBottomCard(cmd);
|
||||||
|
cmd.set_target_zone("rfg");
|
||||||
|
cmd.set_x(0);
|
||||||
|
cmd.set_y(0);
|
||||||
|
|
||||||
|
sendGameCommand(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::actMoveBottomCardsToGrave()
|
||||||
|
{
|
||||||
|
const int maxCards = zones.value("deck")->getCards().size();
|
||||||
|
if (maxCards == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int number = QInputDialog::getInt(game, tr("Move bottom cards to grave"), tr("Number:"));
|
||||||
|
if (number == 0) {
|
||||||
|
return;
|
||||||
|
} else if (number > maxCards) {
|
||||||
|
number = maxCards;
|
||||||
|
}
|
||||||
|
|
||||||
Command_MoveCard cmd;
|
Command_MoveCard cmd;
|
||||||
cmd.set_start_zone("deck");
|
cmd.set_start_zone("deck");
|
||||||
cmd.mutable_cards_to_move()->add_card()->set_card_id(zone->getCards().size() - 1);
|
|
||||||
cmd.set_target_player_id(getId());
|
cmd.set_target_player_id(getId());
|
||||||
cmd.set_target_zone("grave");
|
cmd.set_target_zone("grave");
|
||||||
cmd.set_x(0);
|
cmd.set_x(0);
|
||||||
cmd.set_y(0);
|
cmd.set_y(0);
|
||||||
|
|
||||||
|
for (int i = maxCards - number; i < maxCards; ++i) {
|
||||||
|
cmd.mutable_cards_to_move()->add_card()->set_card_id(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
sendGameCommand(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::actMoveBottomCardsToExile()
|
||||||
|
{
|
||||||
|
const int maxCards = zones.value("deck")->getCards().size();
|
||||||
|
if (maxCards == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int number = QInputDialog::getInt(game, tr("Move bottom cards to exile"), tr("Number:"));
|
||||||
|
if (number == 0) {
|
||||||
|
return;
|
||||||
|
} else if (number > maxCards) {
|
||||||
|
number = maxCards;
|
||||||
|
}
|
||||||
|
|
||||||
|
Command_MoveCard cmd;
|
||||||
|
cmd.set_start_zone("deck");
|
||||||
|
cmd.set_target_player_id(getId());
|
||||||
|
cmd.set_target_zone("rfg");
|
||||||
|
cmd.set_x(0);
|
||||||
|
cmd.set_y(0);
|
||||||
|
|
||||||
|
for (int i = maxCards - number; i < maxCards; ++i) {
|
||||||
|
cmd.mutable_cards_to_move()->add_card()->set_card_id(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
sendGameCommand(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::actMoveBottomCardToTop()
|
||||||
|
{
|
||||||
|
if (zones.value("deck")->getCards().empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Command_MoveCard cmd;
|
||||||
|
cmdSetBottomCard(cmd);
|
||||||
|
cmd.set_target_zone("deck");
|
||||||
|
cmd.set_x(0); // top of deck
|
||||||
|
cmd.set_y(0);
|
||||||
|
|
||||||
|
sendGameCommand(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::actDrawBottomCard()
|
||||||
|
{
|
||||||
|
if (zones.value("deck")->getCards().empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Command_MoveCard cmd;
|
||||||
|
cmdSetBottomCard(cmd);
|
||||||
|
cmd.set_target_zone("hand");
|
||||||
|
cmd.set_x(0);
|
||||||
|
cmd.set_y(0);
|
||||||
|
|
||||||
|
sendGameCommand(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::actDrawBottomCards()
|
||||||
|
{
|
||||||
|
const int maxCards = zones.value("deck")->getCards().size();
|
||||||
|
if (maxCards == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int number = QInputDialog::getInt(game, tr("Draw bottom cards"), tr("Number:"));
|
||||||
|
if (number == 0) {
|
||||||
|
return;
|
||||||
|
} else if (number > maxCards) {
|
||||||
|
number = maxCards;
|
||||||
|
}
|
||||||
|
|
||||||
|
Command_MoveCard cmd;
|
||||||
|
cmd.set_start_zone("deck");
|
||||||
|
cmd.set_target_player_id(getId());
|
||||||
|
cmd.set_target_zone("hand");
|
||||||
|
cmd.set_x(0);
|
||||||
|
cmd.set_y(0);
|
||||||
|
|
||||||
|
for (int i = maxCards - number; i < maxCards; ++i) {
|
||||||
|
cmd.mutable_cards_to_move()->add_card()->set_card_id(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
sendGameCommand(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::actMoveBottomCardToPlay()
|
||||||
|
{
|
||||||
|
if (zones.value("deck")->getCards().empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Command_MoveCard cmd;
|
||||||
|
cmdSetBottomCard(cmd);
|
||||||
|
cmd.set_target_zone("stack");
|
||||||
|
cmd.set_x(-1);
|
||||||
|
cmd.set_y(0);
|
||||||
|
|
||||||
|
sendGameCommand(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::actMoveBottomCardToPlayFaceDown()
|
||||||
|
{
|
||||||
|
if (zones.value("deck")->getCards().empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CardZone *zone = zones.value("deck");
|
||||||
|
int lastCard = zone->getCards().size() - 1;
|
||||||
|
|
||||||
|
Command_MoveCard cmd;
|
||||||
|
cmd.set_start_zone("deck");
|
||||||
|
auto *cardToMove = cmd.mutable_cards_to_move()->add_card();
|
||||||
|
cardToMove->set_card_id(lastCard);
|
||||||
|
cardToMove->set_face_down(true);
|
||||||
|
|
||||||
|
cmd.set_target_player_id(getId());
|
||||||
|
cmd.set_target_zone("table");
|
||||||
|
cmd.set_x(-1);
|
||||||
|
cmd.set_y(0);
|
||||||
|
|
||||||
sendGameCommand(cmd);
|
sendGameCommand(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,52 +18,52 @@ namespace protobuf
|
||||||
class Message;
|
class Message;
|
||||||
}
|
}
|
||||||
} // namespace google
|
} // namespace google
|
||||||
class CardDatabase;
|
|
||||||
class DeckLoader;
|
|
||||||
class QMenu;
|
|
||||||
class QAction;
|
|
||||||
class ZoneViewZone;
|
|
||||||
class TabGame;
|
|
||||||
class AbstractCounter;
|
|
||||||
class AbstractCardItem;
|
class AbstractCardItem;
|
||||||
class CardItem;
|
class AbstractCounter;
|
||||||
class ArrowTarget;
|
|
||||||
class ArrowItem;
|
class ArrowItem;
|
||||||
|
class ArrowTarget;
|
||||||
|
class CardDatabase;
|
||||||
|
class CardItem;
|
||||||
class CardZone;
|
class CardZone;
|
||||||
class StackZone;
|
|
||||||
class TableZone;
|
|
||||||
class HandZone;
|
|
||||||
class PlayerTarget;
|
|
||||||
class ServerInfo_User;
|
|
||||||
class ServerInfo_Player;
|
|
||||||
class ServerInfo_Arrow;
|
|
||||||
class ServerInfo_Counter;
|
|
||||||
class CommandContainer;
|
class CommandContainer;
|
||||||
|
class Command_MoveCard;
|
||||||
|
class DeckLoader;
|
||||||
|
class Event_AttachCard;
|
||||||
|
class Event_ChangeZoneProperties;
|
||||||
|
class Event_CreateArrow;
|
||||||
|
class Event_CreateCounter;
|
||||||
|
class Event_CreateToken;
|
||||||
|
class Event_DelCounter;
|
||||||
|
class Event_DeleteArrow;
|
||||||
|
class Event_DestroyCard;
|
||||||
|
class Event_DrawCards;
|
||||||
|
class Event_DumpZone;
|
||||||
|
class Event_FlipCard;
|
||||||
|
class Event_GameSay;
|
||||||
|
class Event_MoveCard;
|
||||||
|
class Event_RevealCards;
|
||||||
|
class Event_RollDie;
|
||||||
|
class Event_SetCardAttr;
|
||||||
|
class Event_SetCardCounter;
|
||||||
|
class Event_SetCounter;
|
||||||
|
class Event_Shuffle;
|
||||||
|
class Event_StopDumpZone;
|
||||||
class GameCommand;
|
class GameCommand;
|
||||||
class GameEvent;
|
class GameEvent;
|
||||||
class GameEventContext;
|
class GameEventContext;
|
||||||
// class Event_ConnectionStateChanged;
|
class HandZone;
|
||||||
class Event_GameSay;
|
|
||||||
class Event_Shuffle;
|
|
||||||
class Event_RollDie;
|
|
||||||
class Event_CreateArrow;
|
|
||||||
class Event_DeleteArrow;
|
|
||||||
class Event_CreateToken;
|
|
||||||
class Event_SetCardAttr;
|
|
||||||
class Event_SetCardCounter;
|
|
||||||
class Event_CreateCounter;
|
|
||||||
class Event_SetCounter;
|
|
||||||
class Event_DelCounter;
|
|
||||||
class Event_DumpZone;
|
|
||||||
class Event_StopDumpZone;
|
|
||||||
class Event_MoveCard;
|
|
||||||
class Event_FlipCard;
|
|
||||||
class Event_DestroyCard;
|
|
||||||
class Event_AttachCard;
|
|
||||||
class Event_DrawCards;
|
|
||||||
class Event_RevealCards;
|
|
||||||
class Event_ChangeZoneProperties;
|
|
||||||
class PendingCommand;
|
class PendingCommand;
|
||||||
|
class PlayerTarget;
|
||||||
|
class QAction;
|
||||||
|
class QMenu;
|
||||||
|
class ServerInfo_Arrow;
|
||||||
|
class ServerInfo_Counter;
|
||||||
|
class ServerInfo_Player;
|
||||||
|
class ServerInfo_User;
|
||||||
|
class StackZone;
|
||||||
|
class TabGame;
|
||||||
|
class TableZone;
|
||||||
|
class ZoneViewZone;
|
||||||
|
|
||||||
const int MAX_TOKENS_PER_DIALOG = 99;
|
const int MAX_TOKENS_PER_DIALOG = 99;
|
||||||
|
|
||||||
|
@ -165,7 +165,15 @@ public slots:
|
||||||
void actMoveTopCardsToGrave();
|
void actMoveTopCardsToGrave();
|
||||||
void actMoveTopCardsToExile();
|
void actMoveTopCardsToExile();
|
||||||
void actMoveTopCardToBottom();
|
void actMoveTopCardToBottom();
|
||||||
|
void actDrawBottomCard();
|
||||||
|
void actDrawBottomCards();
|
||||||
|
void actMoveBottomCardToPlay();
|
||||||
|
void actMoveBottomCardToPlayFaceDown();
|
||||||
void actMoveBottomCardToGrave();
|
void actMoveBottomCardToGrave();
|
||||||
|
void actMoveBottomCardToExile();
|
||||||
|
void actMoveBottomCardsToGrave();
|
||||||
|
void actMoveBottomCardsToExile();
|
||||||
|
void actMoveBottomCardToTop();
|
||||||
|
|
||||||
void actViewLibrary();
|
void actViewLibrary();
|
||||||
void actViewHand();
|
void actViewHand();
|
||||||
|
@ -217,7 +225,8 @@ private:
|
||||||
TabGame *game;
|
TabGame *game;
|
||||||
QMenu *sbMenu, *countersMenu, *sayMenu, *createPredefinedTokenMenu, *mRevealLibrary, *mRevealTopCard, *mRevealHand,
|
QMenu *sbMenu, *countersMenu, *sayMenu, *createPredefinedTokenMenu, *mRevealLibrary, *mRevealTopCard, *mRevealHand,
|
||||||
*mRevealRandomHandCard, *mRevealRandomGraveyardCard;
|
*mRevealRandomHandCard, *mRevealRandomGraveyardCard;
|
||||||
TearOffMenu *moveGraveMenu, *moveRfgMenu, *graveMenu, *moveHandMenu, *handMenu, *libraryMenu, *rfgMenu, *playerMenu;
|
TearOffMenu *moveGraveMenu, *moveRfgMenu, *graveMenu, *moveHandMenu, *handMenu, *libraryMenu, *topLibraryMenu,
|
||||||
|
*bottomLibraryMenu, *rfgMenu, *playerMenu;
|
||||||
QList<QMenu *> playerLists;
|
QList<QMenu *> playerLists;
|
||||||
QList<QAction *> allPlayersActions;
|
QList<QAction *> allPlayersActions;
|
||||||
QAction *aMoveHandToTopLibrary, *aMoveHandToBottomLibrary, *aMoveHandToGrave, *aMoveHandToRfg,
|
QAction *aMoveHandToTopLibrary, *aMoveHandToBottomLibrary, *aMoveHandToGrave, *aMoveHandToRfg,
|
||||||
|
@ -227,7 +236,9 @@ private:
|
||||||
*aMoveTopCardToExile, *aMoveTopCardsToGraveyard, *aMoveTopCardsToExile, *aMoveTopCardToBottom, *aViewGraveyard,
|
*aMoveTopCardToExile, *aMoveTopCardsToGraveyard, *aMoveTopCardsToExile, *aMoveTopCardToBottom, *aViewGraveyard,
|
||||||
*aViewRfg, *aViewSideboard, *aDrawCard, *aDrawCards, *aUndoDraw, *aMulligan, *aShuffle, *aMoveTopToPlay,
|
*aViewRfg, *aViewSideboard, *aDrawCard, *aDrawCards, *aUndoDraw, *aMulligan, *aShuffle, *aMoveTopToPlay,
|
||||||
*aMoveTopToPlayFaceDown, *aUntapAll, *aRollDie, *aCreateToken, *aCreateAnotherToken, *aCardMenu,
|
*aMoveTopToPlayFaceDown, *aUntapAll, *aRollDie, *aCreateToken, *aCreateAnotherToken, *aCardMenu,
|
||||||
*aMoveBottomCardToGrave;
|
*aMoveBottomToPlay, *aMoveBottomToPlayFaceDown, *aMoveBottomCardToTop, *aMoveBottomCardToGraveyard,
|
||||||
|
*aMoveBottomCardToExile, *aMoveBottomCardsToGraveyard, *aMoveBottomCardsToExile, *aDrawBottomCard,
|
||||||
|
*aDrawBottomCards;
|
||||||
|
|
||||||
QList<QAction *> aAddCounter, aSetCounter, aRemoveCounter;
|
QList<QAction *> aAddCounter, aSetCounter, aRemoveCounter;
|
||||||
QAction *aPlay, *aPlayFacedown, *aHide, *aTap, *aDoesntUntap, *aAttach, *aUnattach, *aDrawArrow, *aSetPT, *aResetPT,
|
QAction *aPlay, *aPlayFacedown, *aHide, *aTap, *aDoesntUntap, *aAttach, *aUnattach, *aDrawArrow, *aSetPT, *aResetPT,
|
||||||
|
@ -305,6 +316,8 @@ private:
|
||||||
void eventDrawCards(const Event_DrawCards &event);
|
void eventDrawCards(const Event_DrawCards &event);
|
||||||
void eventRevealCards(const Event_RevealCards &event);
|
void eventRevealCards(const Event_RevealCards &event);
|
||||||
void eventChangeZoneProperties(const Event_ChangeZoneProperties &event);
|
void eventChangeZoneProperties(const Event_ChangeZoneProperties &event);
|
||||||
|
void cmdSetTopCard(Command_MoveCard &cmd);
|
||||||
|
void cmdSetBottomCard(Command_MoveCard &cmd);
|
||||||
|
|
||||||
QVariantList parsePT(const QString &pt);
|
QVariantList parsePT(const QString &pt);
|
||||||
|
|
||||||
|
|
|
@ -502,9 +502,31 @@ private:
|
||||||
{"Player/aMoveTopCardToBottom", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Bottom of Library"),
|
{"Player/aMoveTopCardToBottom", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Bottom of Library"),
|
||||||
parseSequenceString(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Move_top)},
|
ShortcutGroup::Move_top)},
|
||||||
|
{"Player/aMoveBottomToPlay",
|
||||||
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Stack"), parseSequenceString(""), ShortcutGroup::Move_bottom)},
|
||||||
|
{"Player/aMoveBottomToPlayFaceDown", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Battlefield, Face Down"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Move_bottom)},
|
||||||
{"Player/aMoveBottomCardToGrave", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard"),
|
{"Player/aMoveBottomCardToGrave", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard"),
|
||||||
parseSequenceString(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Move_bottom)},
|
ShortcutGroup::Move_bottom)},
|
||||||
|
{"Player/aMoveBottomCardsToGrave", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard (Multiple)"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Move_bottom)},
|
||||||
|
{"Player/aMoveBottomCardToExile",
|
||||||
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile"), parseSequenceString(""), ShortcutGroup::Move_bottom)},
|
||||||
|
{"Player/aMoveBottomCardsToExile", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile (Multiple)"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Move_bottom)},
|
||||||
|
{"Player/aMoveBottomCardToTop", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Top of Library"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Move_bottom)},
|
||||||
|
{"Player/aDrawBottomCard", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Draw Bottom Card"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Move_bottom)},
|
||||||
|
{"Player/aDrawBottomCards", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Draw Multiple Cards from Bottom..."),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Move_bottom)},
|
||||||
{"Player/aDrawArrow", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Draw Arrow..."),
|
{"Player/aDrawArrow", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Draw Arrow..."),
|
||||||
parseSequenceString(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Gameplay)},
|
ShortcutGroup::Gameplay)},
|
||||||
|
|
Loading…
Reference in a new issue