Define native Identity Attack Armour Health with legacy card field fallbacks

This commit is contained in:
Christian Daniel Jensen 2026-11-03 13:12:27 -07:00
parent 44c0e1fef7
commit 08ac6ad7f3

View file

@ -346,9 +346,51 @@ QString CardInfo::getManaCost() const
{ {
return getEssenceCost(); 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 QString CardInfo::getPowTough() const
{ {
return getProperty(Mtg::PowTough); // Compatibility accessor. Display terminology is always ATK/HP.
return getAtkHp();
} }
void CardInfo::setPowTough(const QString &value) void CardInfo::setPowTough(const QString &value)
{ {