diff --git a/libcockatrice_card/libcockatrice/card/card_info.cpp b/libcockatrice_card/libcockatrice/card/card_info.cpp index bb3242c8a..5889a69e1 100644 --- a/libcockatrice_card/libcockatrice/card/card_info.cpp +++ b/libcockatrice_card/libcockatrice/card/card_info.cpp @@ -346,9 +346,51 @@ QString CardInfo::getManaCost() const { return getEssenceCost(); } +QString CardInfo::getIdentity() const +{ + return hasProperty(ContinuumCardProperties::Identity) ? getProperty(ContinuumCardProperties::Identity) + : getProperty(ContinuumCardProperties::Alias); +} +QString CardInfo::getAttack() const +{ + if (hasProperty(ContinuumCardProperties::Attack)) { + return getProperty(ContinuumCardProperties::Attack); + } + if (hasProperty(ContinuumCardProperties::Strength)) { + return getProperty(ContinuumCardProperties::Strength); + } + const QString legacyStats = getProperty(Mtg::PowTough); + const qsizetype slash = legacyStats.indexOf(QLatin1Char('/')); + return slash < 0 ? QString() : legacyStats.left(slash); +} +QString CardInfo::getArmour() const +{ + return hasProperty(ContinuumCardProperties::Armour) ? getProperty(ContinuumCardProperties::Armour) + : getProperty(ContinuumCardProperties::Armor); +} +QString CardInfo::getHealth() const +{ + if (hasProperty(ContinuumCardProperties::Health)) { + return getProperty(ContinuumCardProperties::Health); + } + const QString legacyStats = getProperty(Mtg::PowTough); + const qsizetype slash = legacyStats.indexOf(QLatin1Char('/')); + return slash < 0 ? QString() : legacyStats.mid(slash + 1); +} +QString CardInfo::getAtkHp() const +{ + const QString attack = getAttack(); + const QString health = getHealth(); + if (attack.isEmpty() && health.isEmpty()) { + return QString(); + } + return (attack.isEmpty() ? QStringLiteral("?") : attack) + QLatin1Char('/') + + (health.isEmpty() ? QStringLiteral("?") : health); +} QString CardInfo::getPowTough() const { - return getProperty(Mtg::PowTough); + // Compatibility accessor. Display terminology is always ATK/HP. + return getAtkHp(); } void CardInfo::setPowTough(const QString &value) {