Conjured tokens xml attribute (#4646)

* Conjured xml attr

Add conjured attribute to related xml tags that makes those cards not be destroyed when they leave the battlefield.

* fix build errors, add sarkhan to test

* update oracle importer to support spellbooks from json

* debugging

* fix weird spacing

* fix oracle spacing too

* simplify if/else

Co-authored-by: Zach H <zahalpern+github@gmail.com>

* rename, remove oracle update

* remove extra linebreak

* run format.sh again
This commit is contained in:
cajun 2022-09-01 01:45:04 -05:00 committed by GitHub
parent 54b7943d17
commit 40c88fe385
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 17 deletions

View file

@ -1655,8 +1655,9 @@ void Player::actCreateAllRelatedCards()
for (CardRelation *cardRelationAll : relatedCards) {
if (!cardRelationAll->getDoesAttach() && !cardRelationAll->getIsVariable()) {
dbName = cardRelationAll->getName();
bool persistent = cardRelationAll->getIsPersistent();
for (int i = 0; i < cardRelationAll->getDefaultCount(); ++i) {
createCard(sourceCard, dbName);
createCard(sourceCard, dbName, false, persistent);
}
++tokensTypesCreated;
if (tokensTypesCreated == 1) {
@ -1669,8 +1670,9 @@ void Player::actCreateAllRelatedCards()
for (CardRelation *cardRelationNotExcluded : nonExcludedRelatedCards) {
if (!cardRelationNotExcluded->getDoesAttach() && !cardRelationNotExcluded->getIsVariable()) {
dbName = cardRelationNotExcluded->getName();
bool persistent = cardRelationNotExcluded->getIsPersistent();
for (int i = 0; i < cardRelationNotExcluded->getDefaultCount(); ++i) {
createCard(sourceCard, dbName);
createCard(sourceCard, dbName, false, persistent);
}
++tokensTypesCreated;
if (tokensTypesCreated == 1) {
@ -1698,6 +1700,7 @@ bool Player::createRelatedFromRelation(const CardItem *sourceCard, const CardRel
return false;
}
QString dbName = cardRelation->getName();
bool persistent = cardRelation->getIsPersistent();
if (cardRelation->getIsVariable()) {
bool ok;
dialogSemaphore = true;
@ -1708,23 +1711,23 @@ bool Player::createRelatedFromRelation(const CardItem *sourceCard, const CardRel
return false;
}
for (int i = 0; i < count; ++i) {
createCard(sourceCard, dbName);
createCard(sourceCard, dbName, false, persistent);
}
} else if (cardRelation->getDefaultCount() > 1) {
for (int i = 0; i < cardRelation->getDefaultCount(); ++i) {
createCard(sourceCard, dbName);
createCard(sourceCard, dbName, false, persistent);
}
} else {
if (cardRelation->getDoesAttach()) {
createAttachedCard(sourceCard, dbName);
createAttachedCard(sourceCard, dbName, persistent);
} else {
createCard(sourceCard, dbName);
createCard(sourceCard, dbName, false, persistent);
}
}
return true;
}
void Player::createCard(const CardItem *sourceCard, const QString &dbCardName, bool attach)
void Player::createCard(const CardItem *sourceCard, const QString &dbCardName, bool attach, bool persistent)
{
CardInfoPtr cardInfo = db->getCard(dbCardName);
@ -1758,7 +1761,7 @@ void Player::createCard(const CardItem *sourceCard, const QString &dbCardName, b
} else {
cmd.set_annotation("");
}
cmd.set_destroy_on_zone_change(true);
cmd.set_destroy_on_zone_change(!persistent);
cmd.set_target_zone(sourceCard->getZone()->getName().toStdString());
cmd.set_x(gridPoint.x());
cmd.set_y(gridPoint.y());
@ -1770,9 +1773,9 @@ void Player::createCard(const CardItem *sourceCard, const QString &dbCardName, b
sendGameCommand(cmd);
}
void Player::createAttachedCard(const CardItem *sourceCard, const QString &dbCardName)
void Player::createAttachedCard(const CardItem *sourceCard, const QString &dbCardName, bool persistent)
{
createCard(sourceCard, dbCardName, true);
createCard(sourceCard, dbCardName, true, persistent);
}
void Player::actSayMessage()