removes the pt of face down cards (#3542)
* removes the pt of face down cards Instead of setting the pt of a hidden card to the value only known to you, it's reset to nothing. Resetting a card while it's already reset does nothing. Removing the pt of a card is logged as "player removes the pt of card." instead of "player sets the pt of card to ." (note the missing value). * reset unknown cards to nothing instead * replace cardname with card id for unknown cards fixes #3543 * prefix #
This commit is contained in:
parent
c9c0fb28ee
commit
ba985f97e5
2 changed files with 24 additions and 10 deletions
|
@ -694,13 +694,22 @@ void MessageLogWidget::logSetDoesntUntap(Player *player, CardItem *card, bool do
|
|||
|
||||
void MessageLogWidget::logSetPT(Player *player, CardItem *card, QString newPT)
|
||||
{
|
||||
if (currentContext == MessageContext_MoveCard)
|
||||
if (currentContext == MessageContext_MoveCard) {
|
||||
moveCardPT.insert(card, newPT);
|
||||
else
|
||||
appendHtmlServerMessage(tr("%1 sets PT of %2 to %3.")
|
||||
.arg(sanitizeHtml(player->getName()))
|
||||
.arg(cardLink(card->getName()))
|
||||
.arg(QString("<font color=\"blue\">%1</font>").arg(sanitizeHtml(newPT))));
|
||||
} else {
|
||||
QString name = card->getName();
|
||||
if (name.isEmpty()) {
|
||||
name = QString("<font color=\"blue\">card #%1</font>").arg(sanitizeHtml(QString::number(card->getId())));
|
||||
} else {
|
||||
name = cardLink(name);
|
||||
}
|
||||
if (newPT.isEmpty()) {
|
||||
appendHtmlServerMessage(tr("%1 removes the PT of %2.").arg(sanitizeHtml(player->getName())).arg(name));
|
||||
} else {
|
||||
appendHtmlServerMessage(
|
||||
tr("%1 sets PT of %2 to %3.").arg(sanitizeHtml(player->getName())).arg(name).arg(newPT));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MessageLogWidget::logSetSideboardLock(Player *player, bool locked)
|
||||
|
|
|
@ -2514,16 +2514,21 @@ void Player::actResetPT()
|
|||
QListIterator<QGraphicsItem *> selected(scene()->selectedItems());
|
||||
while (selected.hasNext()) {
|
||||
auto *card = static_cast<CardItem *>(selected.next());
|
||||
CardInfoPtr info = card->getInfo();
|
||||
if (!info) {
|
||||
QString ptString;
|
||||
if (!card->getFaceDown()) { // leave the pt empty if the card is face down
|
||||
CardInfoPtr info = card->getInfo();
|
||||
if (info) {
|
||||
ptString = info->getPowTough();
|
||||
}
|
||||
}
|
||||
if (ptString == card->getPT()) {
|
||||
continue;
|
||||
}
|
||||
auto *cmd = new Command_SetCardAttr;
|
||||
QString zoneName = card->getZone()->getName();
|
||||
auto *cmd = new Command_SetCardAttr;
|
||||
cmd->set_zone(zoneName.toStdString());
|
||||
cmd->set_card_id(card->getId());
|
||||
cmd->set_attribute(AttrPT);
|
||||
QString ptString = info->getPowTough();
|
||||
cmd->set_attr_value(ptString.toStdString());
|
||||
commandList.append(cmd);
|
||||
|
||||
|
|
Loading…
Reference in a new issue