virtual const Card *viewAs(const QList<CardItem *> &cards) const{
        if(cards.length() != 2)
            return NULL;

        DummyCard *card = new DummyCard;
        card->setSkillName(objectName());
        card->addSubcards(cards);
        return card;
    }
예제 #2
0
    virtual void onDamaged(ServerPlayer *target, const DamageStruct &damage) const{
        Room *room = target->getRoom();
        if (!target->askForSkillInvoke(objectName(), QVariant::fromValue(damage))) return;
        room->broadcastSkillInvoke(objectName());

        QList<int> card_ids = room->getNCards(4);
        room->fillAG(card_ids);

        QList<int> to_get, to_throw;
        while (true) {
            int sum = 0;
            foreach (int id, to_get)
                sum += Sanguosha->getCard(id)->getNumber();
            foreach (int id, card_ids) {
                if (sum + Sanguosha->getCard(id)->getNumber() >= 13) {
                    room->takeAG(NULL, id, false);
                    card_ids.removeOne(id);
                    to_throw << id;
                }
            }
            if (card_ids.isEmpty()) break;

            int card_id = room->askForAG(target, card_ids, card_ids.length() < 4, objectName());
            if (card_id == -1) break;
            card_ids.removeOne(card_id);
            to_get << card_id;
            room->takeAG(target, card_id, false);
            if (card_ids.isEmpty()) break;
        }
        DummyCard *dummy = new DummyCard;
        if (!to_get.isEmpty()) {
            dummy->addSubcards(to_get);
            target->obtainCard(dummy);
        }
        dummy->clearSubcards();
        if (!to_throw.isEmpty() || !card_ids.isEmpty()) {
            dummy->addSubcards(to_throw + card_ids);
            CardMoveReason reason(CardMoveReason::S_REASON_NATURAL_ENTER, target->objectName(), objectName(), QString());
            room->throwCard(dummy, reason, NULL);
        }
        delete dummy;

        room->clearAG();
    }
예제 #3
0
    virtual const Card *viewAs(const QList<CardItem *> &cards) const{
        int x = Self->getMark("BlackArmor");
        if(cards.length() != x)
            return NULL;

        DummyCard *card = new DummyCard;
        card->setSkillName(objectName());
        card->addSubcards(cards);
        return card;
    }