[Card] Add facedown property to CardRelation (#6997)
Some checks are pending
Build Desktop / Configure (push) Waiting to run
Build Desktop / Debian 13 (push) Blocked by required conditions
Build Desktop / Debian 12 (push) Blocked by required conditions
Build Desktop / Fedora 44 (push) Blocked by required conditions
Build Desktop / Fedora 43 (push) Blocked by required conditions
Build Desktop / Servatrice_Debian 12 (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 (push) Blocked by required conditions
Build Desktop / Ubuntu 24.04 (push) Blocked by required conditions
Build Desktop / Arch (push) Blocked by required conditions
Build Desktop / macOS 14 (push) Blocked by required conditions
Build Desktop / macOS 15 (push) Blocked by required conditions
Build Desktop / macOS 13 Intel (push) Blocked by required conditions
Build Desktop / macOS 15 Debug (push) Blocked by required conditions
Build Desktop / Windows 10 (push) Blocked by required conditions
Build Docker Image / amd64 & arm64 (push) Waiting to run

* [Card] Add facedown property to CardRelation

* trailing newline

* fix comments

* update schema
This commit is contained in:
RickyRister 2026-06-28 02:03:07 -07:00 committed by GitHub
parent 055ba9a16f
commit fcac7493ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 45 additions and 13 deletions

View file

@ -1018,8 +1018,9 @@ void PlayerActions::actCreateAllRelatedCards()
if (!cardRelationAll->getDoesAttach() && !cardRelationAll->getIsVariable()) {
dbName = cardRelationAll->getName();
bool persistent = cardRelationAll->getIsPersistent();
bool faceDown = cardRelationAll->getIsFaceDown();
for (int i = 0; i < cardRelationAll->getDefaultCount(); ++i) {
createCard(sourceCard, dbName, CardRelationType::DoesNotAttach, persistent);
createCard(sourceCard, dbName, CardRelationType::DoesNotAttach, persistent, faceDown);
}
++tokensTypesCreated;
if (tokensTypesCreated == 1) {
@ -1034,8 +1035,9 @@ void PlayerActions::actCreateAllRelatedCards()
if (!cardRelationNotExcluded->getDoesAttach() && !cardRelationNotExcluded->getIsVariable()) {
dbName = cardRelationNotExcluded->getName();
bool persistent = cardRelationNotExcluded->getIsPersistent();
bool faceDown = cardRelationNotExcluded->getIsFaceDown();
for (int i = 0; i < cardRelationNotExcluded->getDefaultCount(); ++i) {
createCard(sourceCard, dbName, CardRelationType::DoesNotAttach, persistent);
createCard(sourceCard, dbName, CardRelationType::DoesNotAttach, persistent, faceDown);
}
++tokensTypesCreated;
if (tokensTypesCreated == 1) {
@ -1073,6 +1075,7 @@ bool PlayerActions::createRelatedFromRelation(const CardItem *sourceCard,
const QString dbName = cardRelation->getName();
const bool persistent = cardRelation->getIsPersistent();
const bool faceDown = cardRelation->getIsFaceDown();
// Variable relations always use DoesNotAttach, regardless of the count the user
// entered.
@ -1081,7 +1084,7 @@ bool PlayerActions::createRelatedFromRelation(const CardItem *sourceCard,
return false;
}
for (int i = 0; i < variableCount; ++i) {
createCard(sourceCard, dbName, CardRelationType::DoesNotAttach, persistent);
createCard(sourceCard, dbName, CardRelationType::DoesNotAttach, persistent, faceDown);
}
return true;
}
@ -1090,7 +1093,7 @@ bool PlayerActions::createRelatedFromRelation(const CardItem *sourceCard,
if (count > 1) {
for (int i = 0; i < count; ++i) {
createCard(sourceCard, dbName, CardRelationType::DoesNotAttach, persistent);
createCard(sourceCard, dbName, CardRelationType::DoesNotAttach, persistent, faceDown);
}
return true;
}
@ -1110,7 +1113,7 @@ bool PlayerActions::createRelatedFromRelation(const CardItem *sourceCard,
playCardToTable(sourceCard, false);
}
createCard(sourceCard, dbName, attachType, persistent);
createCard(sourceCard, dbName, attachType, persistent, faceDown);
return true;
}
@ -1137,7 +1140,8 @@ void PlayerActions::onRelatedCardCreated(const CardItem *sourceCard, const CardR
void PlayerActions::createCard(const CardItem *sourceCard,
const QString &dbCardName,
CardRelationType attachType,
bool persistent)
bool persistent,
bool faceDown)
{
CardInfoPtr cardInfo = CardDatabaseManager::query()->getCardInfo(dbCardName);
@ -1172,6 +1176,7 @@ void PlayerActions::createCard(const CardItem *sourceCard,
cmd.set_destroy_on_zone_change(!persistent);
cmd.set_x(gridPoint.x());
cmd.set_y(gridPoint.y());
cmd.set_face_down(faceDown);
ExactCard relatedCard =
CardDatabaseManager::query()->getCardFromSameSet(cardInfo->getName(), sourceCard->getCard().getPrinting());

View file

@ -240,7 +240,8 @@ private:
void createCard(const CardItem *sourceCard,
const QString &dbCardName,
CardRelationType attach = CardRelationType::DoesNotAttach,
bool persistent = false);
bool persistent = false,
bool faceDown = false);
void playSelectedCards(QList<CardItem *> selectedCards, bool faceDown = false);