Progress.

This commit is contained in:
Skagra42 2026-08-12 01:53:59 -06:00
parent be2883ff01
commit 76c4556289
15 changed files with 81 additions and 3 deletions

View file

@ -504,7 +504,7 @@ private:
{"Player/aDoesntUntap", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Toggle Skip Untapping"),
parseSequenceString("Alt+U"),
ShortcutGroup::Playing_Area)},
{"Player/aDoesntUntapOnce", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Toggle Skip Untapping Once"),
{"Player/aDoesntUntapOnce", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Toggle Skip (One Turn)"),
parseSequenceString(""),
ShortcutGroup::Playing_Area)},
{"Player/aFlip", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Turn Card Over"),

View file

@ -89,6 +89,16 @@ void CardState::setDoesntUntap(bool _doesntUntap)
emit stateChanged();
}
void CardState::setDoesntUntapOnce(bool _doesntUntapOnce)
{
if (doesntUntapOnce == _doesntUntapOnce) {
return;
}
doesntUntapOnce = _doesntUntapOnce;
emit doesntUntapOnceChanged(_doesntUntapOnce);
emit stateChanged();
}
void CardState::setDestroyOnZoneChange(bool _destroyOnZoneChange)
{
if (destroyOnZoneChange == _destroyOnZoneChange) {

View file

@ -30,6 +30,7 @@ signals:
void annotationChanged(const QString &newAnnotation);
void ptChanged(const QString &newPt);
void doesntUntapChanged(bool newValue);
void doesntUntapOnceChanged(bool newValue);
void destroyOnZoneChangeChanged(bool newValue);
void attachedToChanged(CardItem *newAttachedTo);
void zoneChanged(CardState *changedCard, CardZoneLogic *newZone);
@ -86,6 +87,13 @@ public:
void setDoesntUntap(bool _doesntUntap);
bool getDoesntUntapOnce() const
{
return doesntUntapOnce;
}
void setDoesntUntapOnce(bool _doesntUntapOnce);
bool getDestroyOnZoneChange() const
{
return destroyOnZoneChange;

View file

@ -231,6 +231,12 @@ void PlayerEventHandler::setCardAttrHelper(const GameEventContext &context,
card->setDoesntUntap(value);
break;
}
case AttrDoesntUntapOnce: {
bool value = (avalue == "1");
emit logSetDoesntUntapOnce(player, card, value);
card->setDoesntUntapOnce(value);
break;
}
case AttrPT: {
emit logSetPT(player, card, avalue);
card->setPT(avalue);

View file

@ -69,6 +69,7 @@ signals:
void logSetTapped(PlayerLogic *player, CardItem *card, bool tapped);
void logSetCounter(PlayerLogic *player, QString counterName, int value, int oldValue);
void logSetDoesntUntap(PlayerLogic *player, CardItem *card, bool doesntUntap);
void logSetDoesntUntapOnce(PlayerLogic *player, CardItem *card, bool doesntUntapOnce);
void logSetPT(PlayerLogic *player, CardItem *card, QString newPT);
void logSetAnnotation(PlayerLogic *player, CardItem *card, QString newAnnotation);
void logDumpZone(PlayerLogic *player, CardZoneLogic *zone, int numberCards, bool isReversed = false);

View file

@ -173,6 +173,12 @@ void CardItem::setDoesntUntap(bool _doesntUntap)
update();
}
void CardItem::setDoesntUntapOnce(bool _doesntUntapOnce)
{
state->setDoesntUntapOnce(_doesntUntapOnce);
update();
}
void CardItem::setPT(const QString &_pt)
{
state->setPT(_pt);
@ -223,6 +229,7 @@ void CardItem::resetState(bool keepAnnotations)
attachedCards.clear();
setTapped(false, false);
setDoesntUntap(false);
setDoesntUntapOnce(false);
if (scene()) {
static_cast<GameScene *>(scene())->unregisterAnimationItem(this);
}
@ -248,6 +255,7 @@ void CardItem::processCardInfo(const ServerInfo_Card &_info)
setTapped(_info.tapped());
setDestroyOnZoneChange(_info.destroy_on_zone_change());
setDoesntUntap(_info.doesnt_untap());
setDoesntUntapOnce(_info.doesnt_untap_once());
}
CardDragItem *CardItem::createDragItem(int _id, const QPointF &_pos, const QPointF &_scenePos, bool forceFaceDown)

View file

@ -691,6 +691,17 @@ void MessageLogWidget::logSetDoesntUntap(PlayerLogic *player, CardItem *card, bo
appendHtmlServerMessage(str.arg(sanitizeHtml(player->getPlayerInfo()->getName())).arg(cardLink(card->getName())));
}
void MessageLogWidget::logSetDoesntUntapOnce(PlayerLogic *player, CardItem *card, bool doesntUntapOnce)
{
QString str;
if (doesntUntapOnce) {
str = tr("%1 sets %2 to not untap during the next untap step.");
} else {
str = tr("%1 sets %2 to untap normally.");
}
appendHtmlServerMessage(str.arg(sanitizeHtml(player->getPlayerInfo()->getName())).arg(cardLink(card->getName())));
}
void MessageLogWidget::logSetPT(PlayerLogic *player, CardItem *card, QString newPT)
{
if (currentContext == MessageContext_MoveCard) {
@ -837,6 +848,7 @@ void MessageLogWidget::connectToPlayerEventHandler(PlayerEventHandler *playerEve
connect(playerEventHandler, &PlayerEventHandler::logSetCardCounter, this, &MessageLogWidget::logSetCardCounter);
connect(playerEventHandler, &PlayerEventHandler::logSetTapped, this, &MessageLogWidget::logSetTapped);
connect(playerEventHandler, &PlayerEventHandler::logSetDoesntUntap, this, &MessageLogWidget::logSetDoesntUntap);
connect(playerEventHandler, &PlayerEventHandler::logSetDoesntUntapOnce, this, &MessageLogWidget::logSetDoesntUntapOnce);
connect(playerEventHandler, &PlayerEventHandler::logSetPT, this, &MessageLogWidget::logSetPT);
connect(playerEventHandler, &PlayerEventHandler::logSetAnnotation, this, &MessageLogWidget::logSetAnnotation);
connect(playerEventHandler, &PlayerEventHandler::logMoveCard, this, &MessageLogWidget::logMoveCard);

View file

@ -92,6 +92,7 @@ public slots:
void logSetCardCounter(PlayerLogic *player, QString cardName, int counterId, int value, int oldValue);
void logSetCounter(PlayerLogic *player, QString counterName, int value, int oldValue);
void logSetDoesntUntap(PlayerLogic *player, CardItem *card, bool doesntUntap);
void logSetDoesntUntapOnce(PlayerLogic *player, CardItem *card, bool doesntUntapOnce);
void logSetPT(PlayerLogic *player, CardItem *card, QString newPT);
void logSetSideboardLock(PlayerLogic *player, bool locked);
void logSetTapped(PlayerLogic *player, CardItem *card, bool tapped);

View file

@ -13,6 +13,7 @@ enum CardMenuActionType
cmTap,
cmUntap,
cmDoesntUntap,
cmDoesntUntapOnce,
cmFlip,
cmPeek,
cmClone,

View file

@ -493,7 +493,7 @@ void CardMenu::retranslateUi()
//: Turn sideways or back again
aTap->setText(tr("&Tap / Untap"));
aDoesntUntap->setText(tr("Skip &untapping"));
aDoesntUntapOnce->setText(tr("Skip &untapping once"));
aDoesntUntapOnce->setText(tr("Skip &Untapping (One Turn)"));
//: Turn face up/face down
aFlip->setText(tr("T&urn Over")); // Only the user facing names in client got renamed to "turn over"
// All code and proto bits are still unchanged (flip) for compatibility reasons

View file

@ -1075,6 +1075,11 @@ Server_AbstractPlayer::cmdCreateToken(const Command_CreateToken &cmd, ResponseCo
ges.enqueueGameEvent(event, playerId);
}
if (card->getDoesntUntapOnce() != targetCard->getDoesntUntapOnce()) {
card->setAttribute(AttrDoesntUntapOnce, QVariant(targetCard->getDoesntUntapOnce()).toString(), &event);
ges.enqueueGameEvent(event, playerId);
}
// Copy counters
QMapIterator<int, int> i(targetCard->getCounters());
while (i.hasNext()) {
@ -1432,6 +1437,7 @@ Server_AbstractPlayer::cmdDumpZone(const Command_DumpZone &cmd, ResponseContaine
cardInfo->set_annotation(card->getAnnotation().toStdString());
cardInfo->set_destroy_on_zone_change(card->getDestroyOnZoneChange());
cardInfo->set_doesnt_untap(card->getDoesntUntap());
cardInfo->set_doesnt_untap_once(card->getDoesntUntapOnce());
QMapIterator<int, int> cardCounterIterator(card->getCounters());
while (cardCounterIterator.hasNext()) {
@ -1544,6 +1550,7 @@ Server_AbstractPlayer::cmdRevealCards(const Command_RevealCards &cmd, ResponseCo
cardInfo->set_annotation(card->getAnnotation().toStdString());
cardInfo->set_destroy_on_zone_change(card->getDestroyOnZoneChange());
cardInfo->set_doesnt_untap(card->getDoesntUntap());
cardInfo->set_doesnt_untap_once(card->getDoesntUntapOnce());
QMapIterator<int, int> cardCounterIterator(card->getCounters());
while (cardCounterIterator.hasNext()) {

View file

@ -31,7 +31,7 @@
Server_Card::Server_Card(const CardRef &cardRef, int _id, int _coord_x, int _coord_y, Server_CardZone *_zone)
: zone(_zone), id(_id), coord_x(_coord_x), coord_y(_coord_y), cardRef(cardRef), tapped(false), attacking(false),
facedown(false), destroyOnZoneChange(false), doesntUntap(false), parentCard(0), stashedCard(nullptr)
facedown(false), destroyOnZoneChange(false), doesntUntap(false), doesntUntapOnce(false), parentCard(0), stashedCard(nullptr)
{
}
@ -66,6 +66,11 @@ void Server_Card::resetState(bool keepAnnotations)
QString Server_Card::setAttribute(CardAttribute attribute, const QString &avalue, bool allCards)
{
if (attribute == AttrTapped && avalue != "1" && allCards && doesntUntapOnce) {
setDoesntUntapOnce(false);
return QVariant(tapped).toString();
}
if (attribute == AttrTapped && avalue != "1" && allCards && doesntUntap) {
return QVariant(tapped).toString();
}
@ -105,6 +110,9 @@ QString Server_Card::setAttribute(CardAttribute attribute, const QString &avalue
case AttrDoesntUntap:
setDoesntUntap(avalue == "1");
break;
case AttrDoesntUntapOnce:
setDoesntUntapOnce(avalue == "1");
break;
}
if (event) {
event->set_attr_value(avalue.toStdString());
@ -204,6 +212,9 @@ void Server_Card::getInfo(ServerInfo_Card *info)
if (doesntUntap) {
info->set_doesnt_untap(true);
}
if (doesntUntapOnce) {
info->set_doesnt_untap_once(true);
}
QMapIterator<int, int> cardCounterIterator(counters);
while (cardCounterIterator.hasNext()) {

View file

@ -49,6 +49,7 @@ private:
QString annotation;
bool destroyOnZoneChange;
bool doesntUntap;
bool doesntUntapOnce;
Server_Card *parentCard;
QList<Server_Card *> attachedCards;
@ -127,6 +128,10 @@ public:
{
return doesntUntap;
}
bool getDoesntUntapOnce() const
{
return doesntUntapOnce;
}
bool getDestroyOnZoneChange() const
{
return destroyOnZoneChange;
@ -203,6 +208,10 @@ public:
{
doesntUntap = _doesntUntap;
}
void setDoesntUntapOnce(bool _doesntUntapOnce)
{
doesntUntapOnce = _doesntUntapOnce;
}
void setParentCard(Server_Card *_parentCard);
void addAttachedCard(Server_Card *card)
{

View file

@ -7,4 +7,5 @@ enum CardAttribute {
AttrPT = 5;
AttrAnnotation = 6;
AttrDoesntUntap = 7;
AttrDoesntUntapOnce = 8;
}

View file

@ -53,4 +53,7 @@ message ServerInfo_Card {
// unique id of this kind of card, extends the name to specify a specific printing of a card
optional string provider_id = 17;
// whether the card should not be untapped during its controller's next turn
optional bool doesnt_untap_once = 18;
}