Make AttachTo tokens work from non-table zones (#5629)
Some checks failed
Build Desktop / Configure (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, 12) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, skip, 11) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Fedora, RPM, 41) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Fedora, RPM, skip, 40) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Ubuntu, DEB, 24.04) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Ubuntu, DEB, skip, 20.04) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Ubuntu, DEB, skip, 22.04) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (yes, Arch, skip) (push) Has been cancelled
Build Desktop / macOS ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (3, 1, macos-14, Apple, 14, Release, 15.4) (push) Has been cancelled
Build Desktop / macOS ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (3, 1, macos-15, Apple, 15, Release, 16.2) (push) Has been cancelled
Build Desktop / macOS ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (3, macos-15, Apple, 15, Debug, 16.2) (push) Has been cancelled
Build Desktop / macOS ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (4, 1, macos-13, Intel, 13, Release, 14.3.1) (push) Has been cancelled
Build Desktop / Windows ${{matrix.target}} (msvc2019_64, 5.15.*, 7) (push) Has been cancelled
Build Desktop / Windows ${{matrix.target}} (msvc2019_64, qtimageformats qtmultimedia qtwebsockets, 6.6.*, 10) (push) Has been cancelled

* move card to play before creating attached token

* leave comment

* hardcode createCard target zone to table

To get attached token from graveyard/exile to work
This commit is contained in:
RickyRister 2025-02-16 14:02:45 -08:00 committed by GitHub
parent 01d5e58a5f
commit 5c8d1f3cff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 4 deletions

View File

@ -1930,7 +1930,15 @@ bool Player::createRelatedFromRelation(const CardItem *sourceCard, const CardRel
createCard(sourceCard, dbName, CardRelation::DoesNotAttach, persistent);
}
} else {
createCard(sourceCard, dbName, cardRelation->getAttachType(), persistent);
auto attachType = cardRelation->getAttachType();
// move card onto table first if attaching from some other zone
// we only do this for AttachTo because cross-zone TransformInto is already handled server-side
if (attachType == CardRelation::AttachTo && sourceCard->getZone()->getName() != "table") {
playCardToTable(sourceCard, false);
}
createCard(sourceCard, dbName, attachType, persistent);
}
return true;
}
@ -1973,7 +1981,7 @@ void Player::createCard(const CardItem *sourceCard,
cmd.set_annotation("");
}
cmd.set_destroy_on_zone_change(!persistent);
cmd.set_target_zone(sourceCard->getZone()->getName().toStdString());
cmd.set_target_zone("table"); // we currently only support creating tokens on the table
cmd.set_x(gridPoint.x());
cmd.set_y(gridPoint.y());
@ -2754,7 +2762,7 @@ void Player::playCard(CardItem *card, bool faceDown)
* Like {@link Player::playCard}, but forces the card to be played to the table zone.
* Cards with tablerow 3 (the stack) will be played to tablerow 1 (the noncreatures row).
*/
void Player::playCardToTable(CardItem *card, bool faceDown)
void Player::playCardToTable(const CardItem *card, bool faceDown)
{
if (card == nullptr) {
return;

View File

@ -402,7 +402,7 @@ public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
void playCard(CardItem *c, bool faceDown);
void playCardToTable(CardItem *c, bool faceDown);
void playCardToTable(const CardItem *c, bool faceDown);
void addCard(CardItem *c);
void deleteCard(CardItem *c);
void addZone(CardZone *z);

View File

@ -1358,6 +1358,9 @@ Server_Player::cmdAttachCard(const Command_AttachCard &cmd, ResponseContainer &
return Response::RespNameNotFound;
}
}
// prevent attaching from non-table zones
// (attaching from non-table zones is handled client-side by moving the card to table zone first)
if (!startzone->hasCoords()) {
return Response::RespContextError;
}