コード例 #1
0
bool QiceCard::targetFixed() const{
    if(ClientInstance->getStatus() == Client::Responsing)
        return true;

    CardStar card = Self->tag.value("qice").value<CardStar>();
    return card && card->targetFixed();
}
コード例 #2
0
    virtual bool trigger(TriggerEvent, ServerPlayer *player, QVariant &data) const{
        SlashEffectStruct effect = data.value<SlashEffectStruct>();

        Room *room = player->getRoom();
        CardStar card = room->askForCard(player, "@axe", "@axe:" + effect.to->objectName(),data, CardDiscarded);
        if(card){
            QList<int> card_ids = card->getSubcards();
            foreach(int card_id, card_ids){
                LogMessage log;
                log.type = "$DiscardCard";
                log.from = player;
                log.card_str = QString::number(card_id);

                room->sendLog(log);
            }

            LogMessage log;
            log.type = "#AxeSkill";
            log.from = player;
            log.to << effect.to;
            log.arg = objectName();
            room->sendLog(log);

            room->slashResult(effect, NULL);
        }
コード例 #3
0
ファイル: chibi-card.cpp プロジェクト: Lycio/FolkExtensionMod
    virtual bool trigger(TriggerEvent, ServerPlayer *player, QVariant &data) const{
        Room *room = player->getRoom();
        DamageStruct damage = data.value<DamageStruct>();
        room->setPlayerMark(player, "BlackArmor", damage.damage);
        if(!player->isWounded() || player->getCards("h").length() < damage.damage)
            return false;

        CardStar card = room->askForCard(player, "@black_armor", "@black_armor");
        if(card){
            QList<int> card_ids = card->getSubcards();
            foreach(int card_id, card_ids){
                LogMessage log;
                log.type = "$DiscardCard";
                log.from = player;
                log.card_str = QString::number(card_id);

                room->sendLog(log);
            }

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

            RecoverStruct recover;
            recover.card = card;
            recover.recover = qMin(damage.damage, player->getLostHp());
            recover.who = player;
            room->recover(player, recover);

            room->setPlayerMark(player, "BlackArmor", 0);
            return true;
        }
コード例 #4
0
ファイル: nostalgia.cpp プロジェクト: Death-/QSanguosha
    virtual bool trigger(TriggerEvent triggerEvent, Room* room, ServerPlayer *player, QVariant &data) const{
        if(player->getPhase() != Player::NotActive)
            return false;

        CardStar card = NULL;
        if(triggerEvent == CardFinished){
            CardUseStruct card_use = data.value<CardUseStruct>();
            card = card_use.card;

            if(card == player->tag["MoonSpearSlash"].value<CardStar>()){
                card = NULL;
            }
        }else if(triggerEvent == CardResponsed){
            card = data.value<ResponsedStruct>().m_card;
            player->tag["MoonSpearSlash"] = data;
        }

        if(card == NULL || !card->isBlack())
            return false;

        //@todo: askForUseCard combines asking and using the card.
        //animating weapon effect should happen in-between.
        //we should come back after the askFor methods are restructured.
        room->askForUseCard(player, "slash", "@moon-spear-slash");

        return false;
    }
コード例 #5
0
ファイル: nostalgia.cpp プロジェクト: ubun/3DMODCase
    virtual bool trigger(TriggerEvent event, ServerPlayer *player, QVariant &data) const{
        if(player->getPhase() != Player::NotActive)
            return false;

        CardStar card = NULL;
        if(event == CardFinished){
            CardUseStruct card_use = data.value<CardUseStruct>();
            card = card_use.card;

            if(card == player->tag["MoonSpearSlash"].value<CardStar>()){
                card = NULL;
            }
        }else if(event == CardResponsed){
            card = data.value<CardStar>();
            player->tag["MoonSpearSlash"] = data;
        }

        if(card == NULL || !card->isBlack())
            return false;

        Room *room = player->getRoom();
        room->askForUseCard(player, "slash", "@moon-spear-slash");

        return false;
    }
コード例 #6
0
ファイル: standard-cards.cpp プロジェクト: unowoo/QSanguosha
    virtual bool trigger(TriggerEvent, ServerPlayer *player, QVariant &data) const{
        SlashResultStruct result = data.value<SlashResultStruct>();
        if(!result.success){
            Room *room = player->getRoom();
            CardStar card = room->askForCard(player, "@axe-card", "axe-card");
            if(card){
                QList<int> card_ids = card->getSubcards();
                foreach(int card_id, card_ids){
                    LogMessage log;
                    log.type = "$DiscardCard";
                    log.from = player;
                    log.card_str = QString::number(card_id);

                    room->sendLog(log);
                }

                LogMessage log;
                log.type = "#AxeSkill";
                log.from = player;
                log.to << result.to;
                room->sendLog(log);

                result.success = true;
                data = QVariant::fromValue(result);
            }
コード例 #7
0
ファイル: thicket.cpp プロジェクト: mjzrytl/QSanguosha
    virtual bool trigger(TriggerEvent , ServerPlayer *player, QVariant &data) const{
        JudgeStar judge = data.value<JudgeStar>();
        CardStar card = judge->card;

        if(card->isBlack()){
            Room *room = player->getRoom();
            QList<ServerPlayer *> players = room->getOtherPlayers(player);
            foreach(ServerPlayer *p, players){
                QVariant who = QVariant::fromValue(p);
                if(p->hasLordSkill("songwei") && player->askForSkillInvoke("songwei", who)){
                    room->playSkillEffect(objectName(), 1);
                    p->drawCards(1);
                }
            }
コード例 #8
0
ファイル: thicket.cpp プロジェクト: eraser0/QSanguosha
    virtual bool trigger(TriggerEvent , ServerPlayer *player, QVariant &data) const{
        CardStar card = data.value<CardStar>();

        if(card->isBlack()){
            Room *room = player->getRoom();
            if(room->askForSkillInvoke(player, objectName())){
                room->playSkillEffect(objectName());

                QList<ServerPlayer *> players = room->getOtherPlayers(player);
                foreach(ServerPlayer *p, players){
                    if(p->hasSkill(objectName())){                        
                        p->drawCards(1);
                        break;
                    }
                }
            }
コード例 #9
0
    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;
    }
コード例 #10
0
ファイル: 3d_zhimeng.cpp プロジェクト: duangege815/QSanguosha
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);
}
コード例 #11
0
    virtual bool trigger(TriggerEvent triggerEvent, Room *room, ServerPlayer *player, QVariant &data) const{
        if (player->getPhase() != Player::NotActive)
            return false;

        CardStar card = NULL;
        if (triggerEvent == CardUsed) {
            CardUseStruct card_use = data.value<CardUseStruct>();
            card = card_use.card;
        } else if (triggerEvent == CardResponded) {
            card = data.value<CardResponseStruct>().m_card;
        }

        if (card == NULL || !card->isBlack()
            || (card->getHandlingMethod() != Card::MethodUse && card->getHandlingMethod() != Card::MethodResponse))
            return false;

        player->setFlags("MoonspearUse");
        if (!room->askForUseCard(player, "slash", "@moon-spear-slash", -1, Card::MethodUse, false))
            player->setFlags("-MoonspearUse");

        return false;
    }
コード例 #12
0
bool QiceCard::targetsFeasible(const QList<const Player *> &targets, const Player *Self) const{
    CardStar card = Self->tag.value("qice").value<CardStar>();
    return card && card->targetsFeasible(targets, Self);
}
コード例 #13
0
bool QiceCard::targetFilter(const QList<const Player *> &targets, const Player *to_select, const Player *Self) const{
    CardStar card = Sanguosha->cloneCard(user_string, getSuit(this->getSubcards()), getNumber(this->getSubcards()));
    return card && card->targetFilter(targets, to_select, Self) && !Self->isProhibited(to_select, card);
}
コード例 #14
0
ファイル: 3d_zhimeng.cpp プロジェクト: duangege815/QSanguosha
bool DaojuCard::targetsFeasible(const QList<const Player *> &targets, const Player *Self) const{
    CardStar card = Sanguosha->getCard(Self->getPile("gui").first());
    return card && card->targetsFeasible(targets, Self);
}
コード例 #15
0
ファイル: 3d_zhimeng.cpp プロジェクト: duangege815/QSanguosha
bool DaojuCard::targetFixed() const{
    CardStar card = Sanguosha->getCard(Self->getPile("gui").first());
    return card && card->targetFixed();
}
コード例 #16
0
ファイル: 3d_zhimeng.cpp プロジェクト: duangege815/QSanguosha
bool DaojuCard::targetFilter(const QList<const Player *> &targets, const Player *to_select, const Player *Self) const{
    CardStar card = Sanguosha->getCard(Self->getPile("gui").first());
    return card && card->targetFilter(targets, to_select, Self) && !Self->isProhibited(to_select, card);
}