diff --git a/cockatrice/src/player.cpp b/cockatrice/src/player.cpp index 4aeb4cd1..84403e61 100644 --- a/cockatrice/src/player.cpp +++ b/cockatrice/src/player.cpp @@ -8,6 +8,7 @@ #include "pilezone.h" #include "tablezone.h" #include "handzone.h" +#include "cardlist.h" #include #include #include @@ -113,12 +114,15 @@ Player::Player(const QString &_name, int _id, bool _local, CardDatabase *_db, Cl connect(aDrawCards, SIGNAL(triggered()), this, SLOT(actDrawCards())); aShuffle = new QAction(this); connect(aShuffle, SIGNAL(triggered()), this, SLOT(actShuffle())); + aMulligan = new QAction(this); + connect(aMulligan, SIGNAL(triggered()), this, SLOT(actMuligan())); } playerMenu = new QMenu(QString()); if (local) { handMenu = playerMenu->addMenu(QString()); + handMenu->addAction(aMulligan); handMenu->addAction(aMoveHandToTopLibrary); handMenu->addAction(aMoveHandToBottomLibrary); handMenu->addAction(aMoveHandToGrave); @@ -189,6 +193,8 @@ Player::Player(const QString &_name, int _id, bool _local, CardDatabase *_db, Cl sbMenu = 0; } + cardsInHand = 0; + retranslateUi(); } @@ -240,6 +246,8 @@ void Player::retranslateUi() aDrawCard->setShortcut(tr("Ctrl+D")); aDrawCards->setText(tr("D&raw cards...")); aDrawCards->setShortcut(tr("Ctrl+E")); + aMulligan->setText(tr("Take &mulligan...")); + aMulligan->setShortcut(tr("Ctrl+M")); aShuffle->setText(tr("&Shuffle")); aShuffle->setShortcut(tr("Ctrl+S")); @@ -324,13 +332,27 @@ void Player::actShuffle() void Player::actDrawCard() { client->drawCards(1); + cardsInHand++; +} + +void Player::actMuligan() +{ + if(cardsInHand >= 0) return; + CardList handCards = hand->getCards(); + for(int i = 0; i < handCards.size(); i++){ + client->moveCard(handCards.at(i)->getId(),"hand","deck",0); + } + client->shuffle(); + client->drawCards(--cardsInHand); } void Player::actDrawCards() { int number = QInputDialog::getInteger(0, tr("Draw cards"), tr("Number:")); - if (number) + if (number){ client->drawCards(number); + cardsInHand += number; + } } void Player::actUntapAll() @@ -467,6 +489,12 @@ void Player::gameEvent(const ServerEventData &event) qDebug(QString("target zone invalid: %1").arg(data[4]).toLatin1()); break; } + + /* if(startZone == zones.value("hand")){ + cardsInHand--; + qDebug() << "<<<<<<<<<<<<<<<<<<<< Karte aus hand entfernt"; + qDebug() << "<<<<<<<<<<<<<<<<<<<<< Handkartenanzahl: " << cardsInHand; + }*/ int x = data[5].toInt(); int y = data[6].toInt(); bool facedown = data[7].toInt(); diff --git a/cockatrice/src/player.h b/cockatrice/src/player.h index 3a0a8f5c..e3c1fb6b 100644 --- a/cockatrice/src/player.h +++ b/cockatrice/src/player.h @@ -42,6 +42,7 @@ public slots: void actShuffle(); void actDrawCard(); void actDrawCards(); + void actMuligan(); void actViewLibrary(); void actViewTopCards(); @@ -58,7 +59,7 @@ private: *aMoveGraveToTopLibrary, *aMoveGraveToBottomLibrary, *aMoveGraveToHand, *aMoveGraveToRfg, *aMoveRfgToTopLibrary, *aMoveRfgToBottomLibrary, *aMoveRfgToHand, *aMoveRfgToGrave, *aViewLibrary, *aViewTopCards, *aViewGraveyard, *aViewRfg, *aViewSideboard, - *aDrawCard, *aDrawCards, *aShuffle, + *aDrawCard, *aDrawCards, *aMulligan, *aShuffle, *aUntapAll, *aRollDie, *aCreateToken; int defaultNumberTopCards; @@ -66,6 +67,8 @@ private: int id; bool active; bool local; + + int cardsInHand; QMap zones; TableZone *table; diff --git a/cockatrice/translations/cockatrice_de.ts b/cockatrice/translations/cockatrice_de.ts index 02980dca..9ac5ae1c 100644 --- a/cockatrice/translations/cockatrice_de.ts +++ b/cockatrice/translations/cockatrice_de.ts @@ -1687,41 +1687,41 @@ Player - - - + + + Move to &top of library Oben auf die Biblio&thek legen - - - + + + Move to &bottom of library Unter die &Bibliothek legen - + &View library &Zeige Bibliothek - + F3 F3 - + View &top cards of library... Zeige die oberen Kar&ten der Bibliothek... - + &View graveyard &Zeige Friedhof - + F4 F4 @@ -1730,27 +1730,27 @@ Zeige ent&fernte Karten - + &View sideboard Zeige &Sideboard - + Player "%1" Spieler "%1" - + &Hand &Hand - + &Library Bib&liothek - + &Graveyard &Friedhof @@ -1759,90 +1759,100 @@ Entfe&rnte Karten - + &Sideboard &Sideboard - + View top cards of library Zeige die obersten Karten der Bibliothek - + Number of cards: Anzahl der Karten: - + &Draw card Karte &ziehen - + &View exile &Zeige Exil - + &Exile &Exil - - + + Move to &hand auf die &Hand nehmen - - + + Move to g&raveyard auf den &Friedhof legen - - + + Move to &exile ins &Exil schicken - + Ctrl+D Ctrl+D - + D&raw cards... Ka&rten ziehen... - + Ctrl+E Ctrl+E - + + Take &mulligan... + &Mulligan nehmen... + + + + Ctrl+M + Ctrl+M + + + &Shuffle Mi&schen - + Ctrl+S Ctrl+S - + &Counters &Zähler - + &Untap all permanents &Enttappe alle bleibenden Karten - + Ctrl+U Ctrl+U @@ -1871,67 +1881,67 @@ Ctrl+L - + R&oll die... &Würfeln... - + Ctrl+I Ctrl+I - + &Create token... &Token erstellen... - + Ctrl+T Ctrl+T - + S&ay &Sagen - + F5 F5 - + F6 F6 - + F7 F7 - + F8 F8 - + F9 F9 - + F10 F10 - + Draw cards Karten ziehen - + Number: Anzahl: @@ -1944,22 +1954,22 @@ Neue Lebenspunkte insgesamt: - + Roll die Würfeln - + Number of sides: Anzahl der Seiten: - + Create token Token erstellen - + Name: Name: