virtual const Card *viewAs(const QList<CardItem *> &cards) const{ if(cards.length() < Self->getHandcardNum()) return NULL; if(ClientInstance->getStatus() == Client::Responsing){ QiceCard *card = new QiceCard; card->setUserString("nullification"); card->addSubcards(cards); return card; } CardStar c = Self->tag.value("qice").value<CardStar>(); if(c){ QiceCard *card = new QiceCard; card->setUserString(c->objectName()); card->addSubcards(cards); return card; }else return NULL; }
void DaojuCard::onUse(Room *room, const CardUseStruct &card_use) const{ CardStar ju = Sanguosha->getCard(card_use.from->getPile("gui").first()); const Card *first = Sanguosha->getCard(getSubcards().first()); const Card *second = Sanguosha->getCard(getSubcards().last()); Card::Suit suit = Card::NoSuit; if(first->isBlack() && second->isBlack()) suit = Card::Spade; else if(first->isRed() && second->isRed()) suit = Card::Heart; Card *new_card = Sanguosha->cloneCard(ju->objectName(), suit, (first->getNumber() + second->getNumber()) / 2); new_card->setSkillName("daoju"); new_card->addSubcard(first); new_card->addSubcard(second); CardUseStruct use; use.card = new_card; use.from = card_use.from; use.to = card_use.to; room->useCard(use); }