mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 08:22:15 -07:00
refactor
This commit is contained in:
parent
ec536126b9
commit
c04e2a444b
1 changed files with 14 additions and 3 deletions
|
|
@ -107,6 +107,19 @@ QString OracleImporter::getMainCardType(const QStringList &typeList)
|
||||||
return typeList.first();
|
return typeList.first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses the card text to determine if the card enters the battlefield tapped.
|
||||||
|
*
|
||||||
|
* @param name The name of the card
|
||||||
|
* @param text The full oracle text of the card
|
||||||
|
*/
|
||||||
|
static bool parseCipt(const QString &name, const QString &text)
|
||||||
|
{
|
||||||
|
QRegularExpression ciptRegex("( it|" + QRegularExpression::escape(name) +
|
||||||
|
") enters( the battlefield)? tapped(?! unless)");
|
||||||
|
return ciptRegex.match(text).hasMatch();
|
||||||
|
}
|
||||||
|
|
||||||
CardInfoPtr OracleImporter::addCard(QString name,
|
CardInfoPtr OracleImporter::addCard(QString name,
|
||||||
QString text,
|
QString text,
|
||||||
bool isToken,
|
bool isToken,
|
||||||
|
|
@ -157,9 +170,7 @@ CardInfoPtr OracleImporter::addCard(QString name,
|
||||||
// DETECT CARD POSITIONING INFO
|
// DETECT CARD POSITIONING INFO
|
||||||
|
|
||||||
// cards that enter the field tapped
|
// cards that enter the field tapped
|
||||||
QRegularExpression ciptRegex("( it|" + QRegularExpression::escape(name) +
|
bool cipt = parseCipt(name, text);
|
||||||
") enters( the battlefield)? tapped(?! unless)");
|
|
||||||
bool cipt = ciptRegex.match(text).hasMatch();
|
|
||||||
|
|
||||||
bool landscapeOrientation = properties.value("maintype").toString() == "Battle" ||
|
bool landscapeOrientation = properties.value("maintype").toString() == "Battle" ||
|
||||||
properties.value("layout").toString() == "split" ||
|
properties.value("layout").toString() == "split" ||
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue