fixed bug with mulligan and restart of game
This commit is contained in:
parent
6049a601fb
commit
c86a1ed4f6
1 changed files with 15 additions and 9 deletions
|
@ -115,7 +115,7 @@ Player::Player(const QString &_name, int _id, bool _local, CardDatabase *_db, Cl
|
|||
aShuffle = new QAction(this);
|
||||
connect(aShuffle, SIGNAL(triggered()), this, SLOT(actShuffle()));
|
||||
aMulligan = new QAction(this);
|
||||
connect(aMulligan, SIGNAL(triggered()), this, SLOT(actMuligan()));
|
||||
connect(aMulligan, SIGNAL(triggered()), this, SLOT(actMulligan()));
|
||||
}
|
||||
|
||||
playerMenu = new QMenu(QString());
|
||||
|
@ -335,9 +335,11 @@ void Player::actDrawCard()
|
|||
cardsInHand++;
|
||||
}
|
||||
|
||||
void Player::actMuligan()
|
||||
void Player::actMulligan()
|
||||
{
|
||||
if(cardsInHand <= 0) return;
|
||||
if(cardsInHand <= 0 || cardsInHand > 7) return;
|
||||
|
||||
|
||||
CardList handCards = hand->getCards();
|
||||
for(int i = 0; i < handCards.size(); i++){
|
||||
client->moveCard(handCards.at(i)->getId(),"hand","deck",0);
|
||||
|
@ -351,7 +353,8 @@ void Player::actDrawCards()
|
|||
int number = QInputDialog::getInteger(0, tr("Draw cards"), tr("Number:"));
|
||||
if (number){
|
||||
client->drawCards(number);
|
||||
cardsInHand += number;
|
||||
cardsInHand = number;
|
||||
qDebug() << "ANZAHL DER GEZOGENEN KARTEN: <<<<<<<<<<<<<<<<<<<<<<<<< " << cardsInHand;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -490,11 +493,7 @@ void Player::gameEvent(const ServerEventData &event)
|
|||
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();
|
||||
|
@ -518,6 +517,13 @@ void Player::gameEvent(const ServerEventData &event)
|
|||
// because the addCard function can modify the card object.
|
||||
emit logMoveCard(this, card->getName(), startZone, logPosition, targetZone, logX);
|
||||
|
||||
/*if(startZone == zones.value("hand")){
|
||||
qDebug() << "<<<<<<<<<<<<<<<<<<<<< Handkartenanzahl: " << cardsInHand;
|
||||
cardsInHand--;
|
||||
qDebug() << "<<<<<<<<<<<<<<<<<<<< Karte aus hand entfernt";
|
||||
qDebug() << "<<<<<<<<<<<<<<<<<<<<< Handkartenanzahl: " << cardsInHand;
|
||||
}*/
|
||||
|
||||
targetZone->addCard(card, true, x, y);
|
||||
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue