Example #1
0
    virtual bool trigger(TriggerEvent , ServerPlayer *player, QVariant &data) const{
        if(player->isNude())
            return false;

        Room *room = player->getRoom();
        QList<ServerPlayer *> caopis = room->findPlayersBySkillName(objectName());
        foreach(ServerPlayer *caopi, caopis){
            if(caopi->isAlive() && room->askForSkillInvoke(caopi, objectName(), data)){
                if(player->isCaoCao()){
                    room->playSkillEffect(objectName(), 3);
                }else if(player->getGeneral()->isMale())
                    room->playSkillEffect(objectName(), 1);
                else
                    room->playSkillEffect(objectName(), 2);

                caopi->obtainCard(player->getWeapon());
                caopi->obtainCard(player->getArmor());
                caopi->obtainCard(player->getDefensiveHorse());
                caopi->obtainCard(player->getOffensiveHorse());

                DummyCard *all_cards = player->wholeHandCards();
                if(all_cards){
                    room->moveCardTo(all_cards, caopi, Player::Hand, false);
                    delete all_cards;
                }
                break;
            }
        }
        return false;
    }
Example #2
0
    virtual bool onPhaseChange(ServerPlayer *player) const{
        if(player->getPhase() != Player::Finish)
            return false;
        Room *room = player->getRoom();
        QList<ServerPlayer *> splayers = room->findPlayersBySkillName(objectName());
        foreach(ServerPlayer *splayer, splayers){
            if(player == splayer || splayer->isKongcheng())
                continue;
            if(room->askForCard(splayer, "BasicCard", "@xiaoguo:" + player->objectName(), QVariant::fromValue((PlayerStar)player), CardDiscarded)){
                LogMessage log;
                log.type = "#InvokeSkill";
                log.from = splayer;
                log.arg = objectName();
                room->sendLog(log);
                if(!room->askForCard(player, "EquipCard,TrickCard", "@xiaoguoresponse:" + splayer->objectName(), QVariant(), CardDiscarded)){
                    room->playSkillEffect(objectName(), qrand() % 2 + 1);

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

                    DamageStruct damage;
                    damage.from = splayer;
                    damage.to = player;
                    room->damage(damage);
                }
                else
                    room->playSkillEffect(objectName(), 3);
            }
        }

        return false;
    }