move card to play before creating attached token

This commit is contained in:
RickyRister 2025-02-16 01:08:27 -08:00
parent 01d5e58a5f
commit d2d6615d0f
2 changed files with 11 additions and 3 deletions

View file

@ -1930,7 +1930,15 @@ bool Player::createRelatedFromRelation(const CardItem *sourceCard, const CardRel
createCard(sourceCard, dbName, CardRelation::DoesNotAttach, persistent); createCard(sourceCard, dbName, CardRelation::DoesNotAttach, persistent);
} }
} else { } 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; return true;
} }
@ -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. * 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). * 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) { if (card == nullptr) {
return; return;

View file

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