Expose related cards in card menu
This commit is contained in:
parent
da84bb33e1
commit
946598375f
2 changed files with 32 additions and 1 deletions
|
@ -1076,6 +1076,25 @@ void Player::actCreatePredefinedToken()
|
||||||
actCreateAnotherToken();
|
actCreateAnotherToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::actCreateRelatedCard()
|
||||||
|
{
|
||||||
|
// get he target card name
|
||||||
|
QAction *action = static_cast<QAction *>(sender());
|
||||||
|
CardInfo *cardInfo = db->getCard(action->text());
|
||||||
|
|
||||||
|
// create the token for the related card
|
||||||
|
Command_CreateToken cmd;
|
||||||
|
cmd.set_zone("table");
|
||||||
|
cmd.set_card_name(cardInfo->getName().toStdString());
|
||||||
|
cmd.set_color(cardInfo->getColors().isEmpty() ? QString().toStdString() : cardInfo->getColors().first().toLower().toStdString());
|
||||||
|
cmd.set_pt(cardInfo->getPowTough().toStdString());
|
||||||
|
cmd.set_destroy_on_zone_change(true);
|
||||||
|
cmd.set_x(-1);
|
||||||
|
cmd.set_y(0);
|
||||||
|
|
||||||
|
sendGameCommand(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
void Player::actSayMessage()
|
void Player::actSayMessage()
|
||||||
{
|
{
|
||||||
QAction *a = qobject_cast<QAction *>(sender());
|
QAction *a = qobject_cast<QAction *>(sender());
|
||||||
|
@ -2247,6 +2266,17 @@ void Player::updateCardMenu(CardItem *card)
|
||||||
cardMenu->addAction(aFlip);
|
cardMenu->addAction(aFlip);
|
||||||
if (card->getFaceDown())
|
if (card->getFaceDown())
|
||||||
cardMenu->addAction(aPeek);
|
cardMenu->addAction(aPeek);
|
||||||
|
|
||||||
|
QStringList relatedCards = card->getInfo()->getRelatedCards();
|
||||||
|
if(relatedCards.size())
|
||||||
|
{
|
||||||
|
QMenu * createRelatedCardMenu = cardMenu->addMenu(tr("Cr&eate related card"));
|
||||||
|
|
||||||
|
for (int i = 0; i < relatedCards.size(); ++i) {
|
||||||
|
QAction *a = createRelatedCardMenu->addAction(relatedCards.at(i));
|
||||||
|
connect(a, SIGNAL(triggered()), this, SLOT(actCreateRelatedCard()));
|
||||||
|
}
|
||||||
|
}
|
||||||
cardMenu->addSeparator();
|
cardMenu->addSeparator();
|
||||||
cardMenu->addAction(aAttach);
|
cardMenu->addAction(aAttach);
|
||||||
if (card->getAttachedTo())
|
if (card->getAttachedTo())
|
||||||
|
|
|
@ -141,6 +141,7 @@ private slots:
|
||||||
|
|
||||||
void actOpenDeckInDeckEditor();
|
void actOpenDeckInDeckEditor();
|
||||||
void actCreatePredefinedToken();
|
void actCreatePredefinedToken();
|
||||||
|
void actCreateRelatedCard();
|
||||||
void cardMenuAction();
|
void cardMenuAction();
|
||||||
void actCardCounterTrigger();
|
void actCardCounterTrigger();
|
||||||
void actAttach();
|
void actAttach();
|
||||||
|
|
Loading…
Reference in a new issue