Пример #1
0
void NewLeijiCard::onEffect(const CardEffectStruct &effect) const{
    ServerPlayer *zhangjiao = effect.from;
    ServerPlayer *target = effect.to;

    Room *room = zhangjiao->getRoom();
    room->setEmotion(target, "bad");

    JudgeStruct judge;
    judge.pattern = QRegExp("(.*):(spade|club):(.*)");
    judge.good = false;
    judge.reason = "new_leiji";
    judge.who = target;

    room->judge(judge);

    if(judge.isBad()){
        DamageStruct damage;
        damage.card = NULL;
        damage.from = zhangjiao;
        damage.to = target;
        damage.nature = DamageStruct::Thunder;

        room->damage(damage);
        if(zhangjiao->isWounded()){
            RecoverStruct rec;
            room->recover(zhangjiao, rec);
        }
    }else
        room->setEmotion(zhangjiao, "bad");
}
Пример #2
0
 virtual bool trigger(TriggerEvent, Room *room, ServerPlayer *player, QVariant &data) const{
     RecoverStruct recover_struct = data.value<RecoverStruct>();
     int recover = recover_struct.recover;
     for (int i = 0; i < recover; i++) {
         ServerPlayer *target = room->askForPlayerChosen(player, room->getOtherPlayers(player), objectName(), "shushen-invoke", true, true);
         if (target) {
             room->broadcastSkillInvoke(objectName(), target->getGeneralName().contains("liubei") ? 2 : 1);
             if (target->isWounded() && room->askForChoice(player, objectName(), "recover+draw", QVariant::fromValue(target)) == "recover")
                 room->recover(target, RecoverStruct(player));
             else
                 target->drawCards(2, objectName());
         } else {
             break;
         }
     }
     return false;
 }
Пример #3
0
    virtual void onDamaged(ServerPlayer *huaxiong, const DamageStruct &damage) const{
        ServerPlayer *from = damage.from;
        Room *room = huaxiong->getRoom();

        if(from && from->isAlive() && damage.card && damage.card->isKindOf("Slash") && damage.card->isRed()){
            room->playSkillEffect(objectName());
            LogMessage log;
            log.from = huaxiong;
            log.arg = objectName();
            log.type = "#TriggerSkill";
            room->sendLog(log);

            if(from->isWounded())
                room->recover(from, RecoverStruct(), true);
            else
                from->drawCards(1);
        }
    }