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);
        }
Example #2
0
    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;
        }
Example #3
0
    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);
            }