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

        Room *room = player->getRoom();
        ServerPlayer *caopi = room->findPlayerBySkillName(objectName());
        if(caopi && 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;
            }
        }

        return false;
    }
Exemple #2
0
    virtual bool trigger(TriggerEvent event, ServerPlayer *player, QVariant &data) const{
        Room *room = player->getRoom();
        QList<const Card *> clubs;

        if(event == CardUsed){
            CardUseStruct use = data.value<CardUseStruct>();
            const SkillCard *skill_card = qobject_cast<const SkillCard *>(use.card);
            if(skill_card && skill_card->subcardsLength() > 0 && skill_card->willThrow()){
                clubs = getClubs(skill_card);
            }
        }else if(event == CardDiscarded){
            const Card *card = data.value<CardStar>();
            if(card->subcardsLength() == 0)
                return false;

            clubs = getClubs(card);
        }else if(event == FinishJudge){
            JudgeStar judge = data.value<JudgeStar>();
            if(room->getCardPlace(judge->card->getEffectiveId()) == Player::DiscardedPile
               && judge->card->getSuit() == Card::Club)
               clubs << judge->card;
        }

        if(clubs.isEmpty())
            return false;

        ServerPlayer *caozhi = room->findPlayerBySkillName(objectName());
        if(caozhi && caozhi->askForSkillInvoke(objectName(), data)){
            foreach(const Card *club, clubs)
                caozhi->obtainCard(club);
        }
    virtual bool onPhaseChange(ServerPlayer *player) const{
        if(player->getPhase() == Player::Start){
            Room *room = player->getRoom();
            player->setMark("juao", 0);
            ServerPlayer *xuyou = room->findPlayerBySkillName(objectName());
            foreach (int card_id, player->getPile("hautain")){
                if(!xuyou)
                {
                    CardMoveReason reason(CardMoveReason::S_REASON_REMOVE_FROM_PILE, QString(), "hautain", QString());
                    room->throwCard(Sanguosha->getCard(card_id), reason, NULL);
                }
                else
                    room->obtainCard(player, card_id);
            }
            if(!xuyou)
                return false;

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

            player->skip(Player::Draw);
        }
Exemple #4
0
 virtual bool trigger(TriggerEvent event, ServerPlayer *player, QVariant &data) const{
     Room *room = player->getRoom();
     ServerPlayer *skillowner = room->findPlayerBySkillName(objectName());
     if(!skillowner)
         return false;
     if(skillowner->getPhase() != Player::NotActive)
         return false;
     if(!skillowner->inMyAttackRange(player))
         return false;
     if(!skillowner->askForSkillInvoke(objectName(), data))
         return false;
     SlashEffectStruct effect = data.value<SlashEffectStruct>();
     if(!room->askForCard(skillowner, "Horse", "@diyxuelu-horse:"+effect.to->getGeneralName(), data)){
         room->loseHp(skillowner, 1);
         room->playSkillEffect("diyxuelu", 1);
         room->moveCardTo(effect.slash, skillowner, Player::Hand, true);
     }
     room->playSkillEffect("diyxuelu", 2);
     return true;
 }
Exemple #5
0
    virtual bool onPhaseChange(ServerPlayer *player) const{
        if(player->getPhase() == Player::Start){
            Room *room = player->getRoom();
            player->setMark("juao", 0);
            ServerPlayer *xuyou = room->findPlayerBySkillName(objectName());
            foreach(int card_id, player->getPile("hautain")){
                if(!xuyou)
                    room->throwCard(card_id);
                else
                    room->obtainCard(player, card_id);
            }
            if(!xuyou)
                return false;

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

            player->skip(Player::Draw);
        }
 virtual bool triggerable(const ServerPlayer *player) const{
     Room *room = player->getRoom();
     return player == room->findPlayerBySkillName(objectName());
 }