Add "Random card from graveyard" (#2652)

This commit is contained in:
Zach H 2017-04-26 18:12:56 -04:00 committed by GitHub
parent df211748ca
commit 7c1a18da5e
2 changed files with 27 additions and 3 deletions

View file

@ -287,6 +287,15 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, TabGame *_pare
graveMenu = playerMenu->addMenu(QString());
graveMenu->addAction(aViewGraveyard);
if (local) {
mRevealRandomGraveyardCard = graveMenu->addMenu(QString());
QAction *newAction = mRevealRandomGraveyardCard->addAction(QString());
newAction->setData(-1);
connect(newAction, SIGNAL(triggered()), this, SLOT(actRevealRandomGraveyardCard()));
allPlayersActions.append(newAction);
mRevealRandomGraveyardCard->addSeparator();
}
grave->setMenu(graveMenu, aViewGraveyard);
rfgMenu = playerMenu->addMenu(QString());
@ -533,7 +542,7 @@ void Player::playerListActionTriggered()
cmd.set_zone_name("hand");
else if (menu == mRevealRandomHandCard) {
cmd.set_zone_name("hand");
cmd.set_card_id(-2);
cmd.set_card_id(RANDOM_CARD_FROM_ZONE);
} else
return;
@ -655,6 +664,7 @@ void Player::retranslateUi()
handMenu->setTitle(tr("&Hand"));
mRevealHand->setTitle(tr("&Reveal hand to..."));
mRevealRandomHandCard->setTitle(tr("Reveal r&andom card to..."));
mRevealRandomGraveyardCard->setTitle(tr("Reveal random card to..."));
sbMenu->setTitle(tr("&Sideboard"));
libraryMenu->setTitle(tr("&Library"));
countersMenu->setTitle(tr("&Counters"));
@ -892,6 +902,18 @@ void Player::actViewGraveyard()
static_cast<GameScene *>(scene())->toggleZoneView(this, "grave", -1);
}
void Player::actRevealRandomGraveyardCard()
{
Command_RevealCards cmd;
QAction *action = static_cast<QAction *>(sender());
const int otherPlayerId = action->data().toInt();
if (otherPlayerId != -1)
cmd.set_player_id(otherPlayerId);
cmd.set_zone_name("grave");
cmd.set_card_id(RANDOM_CARD_FROM_ZONE);
sendGameCommand(cmd);
}
void Player::actViewRfg()
{
static_cast<GameScene *>(scene())->toggleZoneView(this, "rfg", -1);

View file

@ -127,6 +127,7 @@ public slots:
void actViewTopCards();
void actAlwaysRevealTopCard();
void actViewGraveyard();
void actRevealRandomGraveyardCard();
void actViewRfg();
void actViewSideboard();
@ -165,7 +166,7 @@ private slots:
private:
TabGame *game;
QMenu *playerMenu, *handMenu, *moveHandMenu, *graveMenu, *moveGraveMenu, *rfgMenu, *moveRfgMenu, *libraryMenu, *sbMenu, *countersMenu, *sayMenu, *createPredefinedTokenMenu,
*mRevealLibrary, *mRevealTopCard, *mRevealHand, *mRevealRandomHandCard;
*mRevealLibrary, *mRevealTopCard, *mRevealHand, *mRevealRandomHandCard, *mRevealRandomGraveyardCard;
QList<QMenu *> playerLists;
QList<QAction *> allPlayersActions;
QAction *aMoveHandToTopLibrary, *aMoveHandToBottomLibrary, *aMoveHandToGrave, *aMoveHandToRfg,
@ -247,7 +248,8 @@ private:
public:
static const int counterAreaWidth = 55;
enum CardMenuActionType { cmTap, cmUntap, cmDoesntUntap, cmFlip, cmPeek, cmClone, cmMoveToTopLibrary, cmMoveToBottomLibrary, cmMoveToHand, cmMoveToGraveyard, cmMoveToExile };
enum CardsToReveal {RANDOM_CARD_FROM_ZONE = -2};
enum { Type = typeOther };
int type() const { return Type; }
QRectF boundingRect() const;