Added hint when drawing 0 cards (#4697)
* Logging a player drawing 0 cards will now result in the message "player had no cards left to draw." * Added hint when drawing when deck is empty * Added hint when drawing when deck is empty * Added hint when drawing when deck is empty * Update cockatrice/src/messagelogwidget.cpp update log message to present tense Co-authored-by: ebbit1q <ebbit1q@gmail.com> * added deckIsEmpty parameter to messagelogwidget::logDrawCards * run format Co-authored-by: ebbit1q <ebbit1q@gmail.com>
This commit is contained in:
parent
b99bd0176a
commit
8e4ddf366c
4 changed files with 12 additions and 8 deletions
|
@ -362,16 +362,20 @@ void MessageLogWidget::logMoveCard(Player *player,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageLogWidget::logDrawCards(Player *player, int number)
|
void MessageLogWidget::logDrawCards(Player *player, int number, bool deckIsEmpty)
|
||||||
{
|
{
|
||||||
soundEngine->playSound("draw_card");
|
soundEngine->playSound("draw_card");
|
||||||
if (currentContext == MessageContext_Mulligan) {
|
if (currentContext == MessageContext_Mulligan) {
|
||||||
logMulligan(player, number);
|
logMulligan(player, number);
|
||||||
|
} else {
|
||||||
|
if (deckIsEmpty && number == 0) {
|
||||||
|
appendHtmlServerMessage(tr("%1 tries to draw from an empty library").arg(sanitizeHtml(player->getName())));
|
||||||
} else {
|
} else {
|
||||||
appendHtmlServerMessage(tr("%1 draws %2 card(s).", "", number)
|
appendHtmlServerMessage(tr("%1 draws %2 card(s).", "", number)
|
||||||
.arg(sanitizeHtml(player->getName()))
|
.arg(sanitizeHtml(player->getName()))
|
||||||
.arg("<font class=\"blue\">" + QString::number(number) + "</font>"));
|
.arg("<font class=\"blue\">" + QString::number(number) + "</font>"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageLogWidget::logDumpZone(Player *player, CardZone *zone, int numberCards)
|
void MessageLogWidget::logDumpZone(Player *player, CardZone *zone, int numberCards)
|
||||||
|
@ -817,7 +821,7 @@ void MessageLogWidget::connectToPlayer(Player *player)
|
||||||
SLOT(logAttachCard(Player *, QString, Player *, QString)));
|
SLOT(logAttachCard(Player *, QString, Player *, QString)));
|
||||||
connect(player, SIGNAL(logUnattachCard(Player *, QString)), this, SLOT(logUnattachCard(Player *, QString)));
|
connect(player, SIGNAL(logUnattachCard(Player *, QString)), this, SLOT(logUnattachCard(Player *, QString)));
|
||||||
connect(player, SIGNAL(logDumpZone(Player *, CardZone *, int)), this, SLOT(logDumpZone(Player *, CardZone *, int)));
|
connect(player, SIGNAL(logDumpZone(Player *, CardZone *, int)), this, SLOT(logDumpZone(Player *, CardZone *, int)));
|
||||||
connect(player, SIGNAL(logDrawCards(Player *, int)), this, SLOT(logDrawCards(Player *, int)));
|
connect(player, SIGNAL(logDrawCards(Player *, int, bool)), this, SLOT(logDrawCards(Player *, int, bool)));
|
||||||
connect(player, SIGNAL(logUndoDraw(Player *, QString)), this, SLOT(logUndoDraw(Player *, QString)));
|
connect(player, SIGNAL(logUndoDraw(Player *, QString)), this, SLOT(logUndoDraw(Player *, QString)));
|
||||||
connect(player, SIGNAL(logRevealCards(Player *, CardZone *, int, QString, Player *, bool, int)), this,
|
connect(player, SIGNAL(logRevealCards(Player *, CardZone *, int, QString, Player *, bool, int)), this,
|
||||||
SLOT(logRevealCards(Player *, CardZone *, int, QString, Player *, bool, int)));
|
SLOT(logRevealCards(Player *, CardZone *, int, QString, Player *, bool, int)));
|
||||||
|
|
|
@ -56,7 +56,7 @@ public slots:
|
||||||
void logCreateToken(Player *player, QString cardName, QString pt);
|
void logCreateToken(Player *player, QString cardName, QString pt);
|
||||||
void logDeckSelect(Player *player, QString deckHash, int sideboardSize);
|
void logDeckSelect(Player *player, QString deckHash, int sideboardSize);
|
||||||
void logDestroyCard(Player *player, QString cardName);
|
void logDestroyCard(Player *player, QString cardName);
|
||||||
void logDrawCards(Player *player, int number);
|
void logDrawCards(Player *player, int number, bool deckIsEmpty);
|
||||||
void logDumpZone(Player *player, CardZone *zone, int numberCards);
|
void logDumpZone(Player *player, CardZone *zone, int numberCards);
|
||||||
void logFlipCard(Player *player, QString cardName, bool faceDown);
|
void logFlipCard(Player *player, QString cardName, bool faceDown);
|
||||||
void logGameClosed();
|
void logGameClosed();
|
||||||
|
|
|
@ -2216,7 +2216,7 @@ void Player::eventDrawCards(const Event_DrawCards &event)
|
||||||
|
|
||||||
hand->reorganizeCards();
|
hand->reorganizeCards();
|
||||||
deck->reorganizeCards();
|
deck->reorganizeCards();
|
||||||
emit logDrawCards(this, event.number());
|
emit logDrawCards(this, event.number(), deck->getCards().size() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::eventRevealCards(const Event_RevealCards &event)
|
void Player::eventRevealCards(const Event_RevealCards &event)
|
||||||
|
|
|
@ -120,7 +120,7 @@ signals:
|
||||||
QString targetCard,
|
QString targetCard,
|
||||||
bool _playerTarget);
|
bool _playerTarget);
|
||||||
void logCreateToken(Player *player, QString cardName, QString pt);
|
void logCreateToken(Player *player, QString cardName, QString pt);
|
||||||
void logDrawCards(Player *player, int number);
|
void logDrawCards(Player *player, int number, bool deckIsEmpty);
|
||||||
void logUndoDraw(Player *player, QString cardName);
|
void logUndoDraw(Player *player, QString cardName);
|
||||||
void logMoveCard(Player *player, CardItem *card, CardZone *startZone, int oldX, CardZone *targetZone, int newX);
|
void logMoveCard(Player *player, CardItem *card, CardZone *startZone, int oldX, CardZone *targetZone, int newX);
|
||||||
void logFlipCard(Player *player, QString cardName, bool faceDown);
|
void logFlipCard(Player *player, QString cardName, bool faceDown);
|
||||||
|
|
Loading…
Reference in a new issue