Beispiel #1
0
    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;
    }
    virtual bool onPhaseChange(ServerPlayer *target) const{
        if(target->getPhase() == Player::Start){
            if(target->getEquips().length() < 2)
                return false;

            Room *room = target->getRoom();
            room->askForUseCard(target, "@@dujiang", "@dujiang-card");
        }

        return false;
    }
    virtual bool trigger(TriggerEvent event, ServerPlayer *xiaoqiao, QVariant &data) const {
        if(!xiaoqiao->isKongcheng()) {
            DamageStruct damage = data.value<DamageStruct>();
            Room *room = xiaoqiao->getRoom();

            room->setTag("TianxiangDamage", QVariant::fromValue(damage));
            if(room->askForUseCard(xiaoqiao, "@tianxiang", "@@tianxiang-card"))
                return true;
        }

        return false;
    }
    virtual bool onPhaseChange(ServerPlayer *zhangliao) const{
        if (zhangliao->getPhase() == Player::Draw) {
            Room *room = zhangliao->getRoom();
            bool can_invoke = false;
            QList<ServerPlayer *> other_players = room->getOtherPlayers(zhangliao);
            foreach (ServerPlayer *player, other_players) {
                if (!player->isKongcheng()) {
                    can_invoke = true;
                    break;
                }
            }

            if (can_invoke && room->askForUseCard(zhangliao, "@@smalltuxi", "@smalltuxi-card"))
                return true;
        }
Beispiel #5
0
    virtual bool onPhaseChange(ServerPlayer *wangyi) const{
        if(wangyi->getPhase() == Player::Finish && wangyi->isWounded()){
            Room *room = wangyi->getRoom();
            QStringList choices;
            for(int i = wangyi->getLostHp(); i > 0; i--)
                choices << QString::number(i);
            choices.append("cancel");
            QString choice = room->askForChoice(wangyi, objectName(), choices.join("+"));
            if(choice == "cancel")
                return false;
            int x = choice.toInt();
            wangyi->drawCards(x);
            room->setPlayerMark(wangyi, "miji", x);
            bool used = room->askForUseCard(wangyi, "@@miji!", "@miji:::" + choice);

            if(!used){
                QList<int> to_give = wangyi->handCards().mid(0, x);
                MijiCard *miji_card = new MijiCard;
                foreach(int card_id, to_give)
                    miji_card->addSubcard(card_id);
                QList<ServerPlayer *> targets = room->getOtherPlayers(wangyi);
                miji_card->use(room, wangyi, targets);
                delete miji_card;
            }
Beispiel #6
0
 virtual void onDamaged(ServerPlayer *caopi, const DamageStruct &damage) const{
     Room *room = caopi->getRoom();
     room->askForUseCard(caopi, "@@fangzhu", "@fangzhu");
 }