コード例 #1
0
    virtual bool onPhaseChange(ServerPlayer *zhangliang) const{
        Room *room = zhangliang->getRoom();

        if(zhangliang->getPhase() != Player::Draw)
            return false;

        QList<ServerPlayer *> players = room->getOtherPlayers(zhangliang);
        foreach(ServerPlayer *p, players){
            if(p->isKongcheng())
                players.removeOne(p);
        }

        if(players.isEmpty() || !zhangliang->askForSkillInvoke(objectName()))
            return false;

        room->playSkillEffect(objectName());

        ServerPlayer *rengonger = room->askForPlayerChosen(zhangliang, players, objectName());
        QList<int> handcards = rengonger->handCards();

        room->fillAG(handcards, zhangliang);
        int card_id = room->askForAG(zhangliang, handcards, false, objectName());
        room->moveCardTo(Sanguosha->getCard(card_id), zhangliang, Player::Hand, false);
        room->broadcastInvoke("clearAG");

        return true;
    }
コード例 #2
0
    virtual bool trigger(TriggerEvent, Room *room, ServerPlayer *caopi, QVariant &data) const{
        DeathStruct death = data.value<DeathStruct>();
        ServerPlayer *player = death.who;
        if (player->isNude() || caopi == player)
            return false;
        if (caopi->isAlive() && room->askForSkillInvoke(caopi, objectName(), data)) {
            room->broadcastSkillInvoke(objectName());

            DummyCard *dummy = new DummyCard(player->handCards());
            QList <const Card *> equips = player->getEquips();
            foreach (const Card *card, equips)
                dummy->addSubcard(card);

            if (dummy->subcardsLength() > 0) {
                CardMoveReason reason(CardMoveReason::S_REASON_RECYCLE, caopi->objectName());
                room->obtainCard(caopi, dummy, reason, false);
            }
            delete dummy;
        }