当前位置: 首页>>代码示例>>C++>>正文


C++ DummyCard类代码示例

本文整理汇总了C++中DummyCard的典型用法代码示例。如果您正苦于以下问题:C++ DummyCard类的具体用法?C++ DummyCard怎么用?C++ DummyCard使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DummyCard类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pattern

const Card *Card::Parse(const QString &str){
    if(str.startsWith(QChar('@'))){
        // skill card
        static QRegExp pattern("@(\\w+)=(.+)");
        pattern.indexIn(str);
        QStringList texts = pattern.capturedTexts();
        QString card_name = texts.at(1);
        QStringList subcard_ids;
        QString subcard_str = texts.at(2);
        if(subcard_str != ".")
           subcard_ids = subcard_str.split("+");
        SkillCard *card = Sanguosha->cloneSkillCard(card_name);

        if(card == NULL)
            return NULL;

        foreach(QString subcard_id, subcard_ids)
            card->addSubcard(subcard_id.toInt());

        // skill name
        QString skill_name = card_name.remove("Card").toLower();
        card->setSkillName(skill_name);

        return card;        
    }else if(str.startsWith(QChar('$'))){
        QString copy = str;
        copy.remove(QChar('$'));
        QStringList card_strs = copy.split("+");
        DummyCard *dummy = new DummyCard;
        foreach(QString card_str, card_strs){
            dummy->addSubcard(card_str.toInt());
        }
开发者ID:upidea,项目名称:QSanguosha,代码行数:32,代码来源:card.cpp

示例2:

    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;
    }
开发者ID:kdashsoul,项目名称:QSanguoshaPassMode,代码行数:9,代码来源:standard-cards.cpp

示例3:

    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;
    }
开发者ID:Lycio,项目名称:FolkExtensionMod,代码行数:10,代码来源:chibi-card.cpp

示例4: wholeHandCards

void ServerPlayer::throwAllHandCards(){
    DummyCard *card = wholeHandCards();
    if(card == NULL)
        return;

    room->throwCard(card);
    CardStar card_star = card;
    QVariant data = QVariant::fromValue(card_star);
    room->getThread()->trigger(CardDiscarded, this, data);
    card->deleteLater();
}
开发者ID:chentao807,项目名称:QSanguosha,代码行数:11,代码来源:serverplayer.cpp

示例5: getEquips

void ServerPlayer::throwAllEquips() {
    QList<const Card *> equips = getEquips();

    if (equips.isEmpty()) return;

    DummyCard *card = new DummyCard;
    foreach (const Card *equip, equips) {
        if (!isJilei(card))
            card->addSubcard(equip);
    }
    if (card->subcardsLength() > 0)
        room->throwCard(card, this);
    delete card;
}
开发者ID:ABigBigWhale,项目名称:QSanguosha-Para,代码行数:14,代码来源:serverplayer.cpp

示例6: isKongcheng

void ServerPlayer::throwAllCards() {
    DummyCard *card = isKongcheng() ? new DummyCard : wholeHandCards();
    QList<const Card *> equips = getEquips();
    foreach (const Card *equip, equips)
        card->addSubcard(equip);
    if (card->subcardsLength() != 0)
        room->throwCard(card, this);
    delete card;

    QList<const Card *> tricks = getJudgingArea();
    foreach (const Card *trick, tricks) {
        CardMoveReason reason(CardMoveReason::S_REASON_THROW, this->objectName());
        room->throwCard(trick, reason, NULL);
    }
开发者ID:uchihajiji,项目名称:QSanguosha-Para-tangjs520,代码行数:14,代码来源:serverplayer.cpp

示例7: getEquips

void ServerPlayer::throwAllEquips(){
    QList<const Card *> equips = getEquips();

    if(equips.isEmpty())
        return;

    DummyCard *card = new DummyCard;
    foreach(const Card *equip, equips)
        card->addSubcard(equip);
    room->throwCard(card);

    CardStar card_star = card;
    QVariant data = QVariant::fromValue(card_star);
    room->getThread()->trigger(CardDiscarded, this, data);
    card->deleteLater();
}
开发者ID:chentao807,项目名称:QSanguosha,代码行数:16,代码来源:serverplayer.cpp

示例8: onDamaged

    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();
    }
开发者ID:guihuoliuying,项目名称:QSanguosha-Para,代码行数:44,代码来源:yjcm2013.cpp

示例9: trigger

    virtual bool trigger(TriggerEvent, Room *room, ServerPlayer *caopi, QVariant &data) const{
        DeathStruct death = data.value<DeathStruct>();
        ServerPlayer *player = death.who;
        if (player->isNude() || caopi == player)
            return false;
        if (caopi->isAlive() && room->askForSkillInvoke(caopi, objectName(), data)) {
            room->broadcastSkillInvoke(objectName());

            DummyCard *dummy = new DummyCard(player->handCards());
            QList <const Card *> equips = player->getEquips();
            foreach (const Card *card, equips)
                dummy->addSubcard(card);

            if (dummy->subcardsLength() > 0) {
                CardMoveReason reason(CardMoveReason::S_REASON_RECYCLE, caopi->objectName());
                room->obtainCard(caopi, dummy, reason, false);
            }
            delete dummy;
        }
开发者ID:bigambition,项目名称:QSanguosha-Para-tangjs520-yizhiyongheng,代码行数:19,代码来源:thicket.cpp

示例10: onPhaseChange

    virtual bool onPhaseChange(ServerPlayer *target) const{
        Room *room = target->getRoom();
        if (target->getPhase() == Player::Finish && target->isWounded() && target->askForSkillInvoke(objectName())) {
            room->broadcastSkillInvoke(objectName(), 1);
            QStringList draw_num;
            for (int i = 1; i <= target->getLostHp(); draw_num << QString::number(i++)) {}
            int num = room->askForChoice(target, "miji_draw", draw_num.join("+")).toInt();
            target->drawCards(num, objectName());

            if (!target->isKongcheng()) {
                int n = 0;
                forever {
                    int original_handcardnum = target->getHandcardNum();
                    if (n < num && !target->isKongcheng()) {
                        QList<int> handcards = target->handCards();
                        if (!room->askForYiji(target, handcards, objectName(), false, false, false, num - n))
                            break;
                        n += original_handcardnum - target->getHandcardNum();
                    } else {
                        break;
                    }
                }
                // give the rest cards randomly
                if (n < num && !target->isKongcheng()) {
                    int rest_num = num - n;
                    forever {
                        QList<int> handcard_list = target->handCards();
                        qShuffle(handcard_list);
                        int give = qrand() % rest_num + 1;
                        rest_num -= give;
                        QList<int> to_give = handcard_list.length() < give ? handcard_list : handcard_list.mid(0, give);
                        ServerPlayer *receiver = room->getOtherPlayers(target).at(qrand() % (target->aliveCount() - 1));
                        DummyCard *dummy = new DummyCard;
                        foreach (int id, to_give)
                            dummy->addSubcard(id);
                        room->obtainCard(receiver, dummy, false);
                        delete dummy;
                        if (rest_num == 0 || target->isKongcheng())
                            break;
                    }
                }
开发者ID:RocDeanGit,项目名称:QSanguosha-Para,代码行数:41,代码来源:yjcm2012.cpp

示例11: onPhaseChange

    bool onPhaseChange(ServerPlayer *player) const
    {
        if (player->getPhase() == Player::Start) {
            Room *room = player->getRoom();
            player->setMark("juao", 0);

            LogMessage log;
            log.type = "#JuaoObtain";
            log.from = player;
            log.arg = objectName();
            room->sendLog(log);

            DummyCard *dummy = new DummyCard;

            foreach (int card_id, player->getPile("hautain")) {
                dummy->addSubcard(card_id);
            }

            player->obtainCard(dummy, false);
            delete dummy;

            player->skip(Player::Draw);
        }
开发者ID:DGAH,项目名称:QSanguosha-v2,代码行数:23,代码来源:wisdom.cpp


注:本文中的DummyCard类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。