Commit d7b3764b authored by Max-Wilhelm Bruker's avatar Max-Wilhelm Bruker
Browse files

added feature: move top cards of library to grave/exile

parent fe9798bf
...@@ -126,6 +126,10 @@ Player::Player(const QString &_name, int _id, bool _local, TabGame *_parent) ...@@ -126,6 +126,10 @@ Player::Player(const QString &_name, int _id, bool _local, TabGame *_parent)
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()));
aMoveTopCardsToGrave = new QAction(this);
connect(aMoveTopCardsToGrave, SIGNAL(triggered()), this, SLOT(actMoveTopCardsToGrave()));
aMoveTopCardsToExile = new QAction(this);
connect(aMoveTopCardsToExile, SIGNAL(triggered()), this, SLOT(actMoveTopCardsToExile()));
} }
playerMenu = new QMenu(QString()); playerMenu = new QMenu(QString());
...@@ -147,6 +151,9 @@ Player::Player(const QString &_name, int _id, bool _local, TabGame *_parent) ...@@ -147,6 +151,9 @@ Player::Player(const QString &_name, int _id, bool _local, TabGame *_parent)
libraryMenu->addSeparator(); libraryMenu->addSeparator();
libraryMenu->addAction(aViewLibrary); libraryMenu->addAction(aViewLibrary);
libraryMenu->addAction(aViewTopCards); libraryMenu->addAction(aViewTopCards);
libraryMenu->addSeparator();
libraryMenu->addAction(aMoveTopCardsToGrave);
libraryMenu->addAction(aMoveTopCardsToExile);
deck->setMenu(libraryMenu, aDrawCard); deck->setMenu(libraryMenu, aDrawCard);
} else { } else {
handMenu = 0; handMenu = 0;
...@@ -306,6 +313,8 @@ void Player::retranslateUi() ...@@ -306,6 +313,8 @@ void Player::retranslateUi()
aDrawCards->setText(tr("D&raw cards...")); aDrawCards->setText(tr("D&raw cards..."));
aMulligan->setText(tr("Take &mulligan")); aMulligan->setText(tr("Take &mulligan"));
aShuffle->setText(tr("&Shuffle")); aShuffle->setText(tr("&Shuffle"));
aMoveTopCardsToGrave->setText(tr("Move top cards to g&raveyard..."));
aMoveTopCardsToExile->setText(tr("Move top cards to &exile..."));
handMenu->setTitle(tr("&Hand")); handMenu->setTitle(tr("&Hand"));
sbMenu->setTitle(tr("&Sideboard")); sbMenu->setTitle(tr("&Sideboard"));
...@@ -440,6 +449,36 @@ void Player::actDrawCards() ...@@ -440,6 +449,36 @@ void Player::actDrawCards()
sendGameCommand(new Command_DrawCards(-1, number)); sendGameCommand(new Command_DrawCards(-1, number));
} }
void Player::actMoveTopCardsToGrave()
{
int number = QInputDialog::getInteger(0, tr("Move top cards to grave"), tr("Number:"));
if (!number)
return;
QList<Command *> commandList;
const int maxCards = zones.value("deck")->getCards().size();
if (number > maxCards)
number = maxCards;
for (int i = 0; i < number; ++i)
commandList.append(new Command_MoveCard(-1, "deck", 0, "grave", 0, 0, false));
sendCommandContainer(new CommandContainer(commandList));
}
void Player::actMoveTopCardsToExile()
{
int number = QInputDialog::getInteger(0, tr("Move top cards to grave"), tr("Number:"));
if (!number)
return;
QList<Command *> commandList;
const int maxCards = zones.value("deck")->getCards().size();
if (number > maxCards)
number = maxCards;
for (int i = 0; i < number; ++i)
commandList.append(new Command_MoveCard(-1, "deck", 0, "rfg", 0, 0, false));
sendCommandContainer(new CommandContainer(commandList));
}
void Player::actUntapAll() void Player::actUntapAll()
{ {
sendGameCommand(new Command_SetCardAttr(-1, "table", -1, "tapped", "0")); sendGameCommand(new Command_SetCardAttr(-1, "table", -1, "tapped", "0"));
......
...@@ -76,6 +76,8 @@ public slots: ...@@ -76,6 +76,8 @@ public slots:
void actDrawCard(); void actDrawCard();
void actDrawCards(); void actDrawCards();
void actMulligan(); void actMulligan();
void actMoveTopCardsToGrave();
void actMoveTopCardsToExile();
void actViewLibrary(); void actViewLibrary();
void actViewTopCards(); void actViewTopCards();
...@@ -101,7 +103,8 @@ private: ...@@ -101,7 +103,8 @@ private:
QAction *aMoveHandToTopLibrary, *aMoveHandToBottomLibrary, *aMoveHandToGrave, *aMoveHandToRfg, QAction *aMoveHandToTopLibrary, *aMoveHandToBottomLibrary, *aMoveHandToGrave, *aMoveHandToRfg,
*aMoveGraveToTopLibrary, *aMoveGraveToBottomLibrary, *aMoveGraveToHand, *aMoveGraveToRfg, *aMoveGraveToTopLibrary, *aMoveGraveToBottomLibrary, *aMoveGraveToHand, *aMoveGraveToRfg,
*aMoveRfgToTopLibrary, *aMoveRfgToBottomLibrary, *aMoveRfgToHand, *aMoveRfgToGrave, *aMoveRfgToTopLibrary, *aMoveRfgToBottomLibrary, *aMoveRfgToHand, *aMoveRfgToGrave,
*aViewLibrary, *aViewTopCards, *aViewGraveyard, *aViewRfg, *aViewSideboard, *aViewLibrary, *aViewTopCards, *aMoveTopCardsToGrave, *aMoveTopCardsToExile,
*aViewGraveyard, *aViewRfg, *aViewSideboard,
*aDrawCard, *aDrawCards, *aMulligan, *aShuffle, *aDrawCard, *aDrawCards, *aMulligan, *aShuffle,
*aUntapAll, *aRollDie, *aCreateToken, *aCreateAnotherToken, *aUntapAll, *aRollDie, *aCreateToken, *aCreateAnotherToken,
*aCardMenu; *aCardMenu;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment