mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-13 05:20:00 -08:00
Define native Identity Attack Armour Health with legacy card field fallbacks
This commit is contained in:
parent
44c0e1fef7
commit
08ac6ad7f3
1 changed files with 43 additions and 1 deletions
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue