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

This commit is contained in:
Max-Wilhelm Bruker 2010-09-13 20:52:49 +02:00
parent fe9798bf46
commit d7b3764bba
2 changed files with 43 additions and 1 deletions

View file

@ -126,6 +126,10 @@ Player::Player(const QString &_name, int _id, bool _local, TabGame *_parent)
connect(aShuffle, SIGNAL(triggered()), this, SLOT(actShuffle()));
aMulligan = new QAction(this);
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());
@ -147,6 +151,9 @@ Player::Player(const QString &_name, int _id, bool _local, TabGame *_parent)
libraryMenu->addSeparator();
libraryMenu->addAction(aViewLibrary);
libraryMenu->addAction(aViewTopCards);
libraryMenu->addSeparator();
libraryMenu->addAction(aMoveTopCardsToGrave);
libraryMenu->addAction(aMoveTopCardsToExile);
deck->setMenu(libraryMenu, aDrawCard);
} else {
handMenu = 0;
@ -306,6 +313,8 @@ void Player::retranslateUi()
aDrawCards->setText(tr("D&raw cards..."));
aMulligan->setText(tr("Take &mulligan"));
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"));
sbMenu->setTitle(tr("&Sideboard"));
@ -440,6 +449,36 @@ void Player::actDrawCards()
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()
{
sendGameCommand(new Command_SetCardAttr(-1, "table", -1, "tapped", "0"));

View file

@ -76,6 +76,8 @@ public slots:
void actDrawCard();
void actDrawCards();
void actMulligan();
void actMoveTopCardsToGrave();
void actMoveTopCardsToExile();
void actViewLibrary();
void actViewTopCards();
@ -101,7 +103,8 @@ private:
QAction *aMoveHandToTopLibrary, *aMoveHandToBottomLibrary, *aMoveHandToGrave, *aMoveHandToRfg,
*aMoveGraveToTopLibrary, *aMoveGraveToBottomLibrary, *aMoveGraveToHand, *aMoveGraveToRfg,
*aMoveRfgToTopLibrary, *aMoveRfgToBottomLibrary, *aMoveRfgToHand, *aMoveRfgToGrave,
*aViewLibrary, *aViewTopCards, *aViewGraveyard, *aViewRfg, *aViewSideboard,
*aViewLibrary, *aViewTopCards, *aMoveTopCardsToGrave, *aMoveTopCardsToExile,
*aViewGraveyard, *aViewRfg, *aViewSideboard,
*aDrawCard, *aDrawCards, *aMulligan, *aShuffle,
*aUntapAll, *aRollDie, *aCreateToken, *aCreateAnotherToken,
*aCardMenu;