bool Analeptic::IsAvailable(const Player *player, const Card *analeptic){ Analeptic *newanal = new Analeptic(Card::NoSuit, 0); newanal->deleteLater(); if (player->isCardLimited(analeptic == NULL ? newanal : analeptic, Card::MethodUse) || player->isProhibited(player, analeptic == NULL ? newanal : analeptic)) return false; return player->usedTimes("Analeptic") <= Sanguosha->correctCardTarget(TargetModSkill::Residue, player, analeptic == NULL ? newanal : analeptic); }
bool Analeptic::IsAvailable(const Player *player, const Card *analeptic) { Analeptic *newanaleptic = new Analeptic(Card::NoSuit, 0); newanaleptic->deleteLater(); #define THIS_ANALEPTIC (analeptic == NULL ? newanaleptic : analeptic) if (player->isCardLimited(THIS_ANALEPTIC, Card::MethodUse) || player->isProhibited(player, THIS_ANALEPTIC)) return false; return player->usedTimes("Analeptic") <= Sanguosha->correctCardTarget(TargetModSkill::Residue, player, THIS_ANALEPTIC); #undef THIS_ANALEPTIC }
virtual const Card *viewAs(const Card *originalCard) const{ if (originalCard->isKindOf("Armor")) { Analeptic *anal = new Analeptic(originalCard->getSuit(), originalCard->getNumber()); anal->setSkillName(objectName()); anal->addSubcard(originalCard); return anal; } else if (originalCard->isKindOf("Weapon")) { KnownBoth *kb = new KnownBoth(originalCard->getSuit(), originalCard->getNumber()); kb->setSkillName(objectName()); kb->addSubcard(originalCard); return kb; } else if (originalCard->isKindOf("Horse")) { ExNihilo *en = new ExNihilo(originalCard->getSuit(), originalCard->getNumber()); en->setSkillName(objectName()); en->addSubcard(originalCard); return en; } else return NULL; }