コード例 #1
0
ファイル: bgm-package.cpp プロジェクト: saffahyjp/QSanguosha
    void doChongZhen(ServerPlayer *player, const Card *card) const{
        if(card->getSkillName() != "longdan")
            return;

        Room *room = player->getRoom();

        ServerPlayer *target = player->tag["ChongZhenTarget"].value<PlayerStar>();
        if(!target || target->isKongcheng() || !room->askForSkillInvoke(player, objectName()))
            return;

        int card_id = room->askForCardChosen(player, target, "h", objectName());
        room->moveCardTo(Sanguosha->getCard(card_id), player, Player::Hand, false);
    }
コード例 #2
0
ファイル: hegemony.cpp プロジェクト: Mystery333/QSanguosha
 virtual bool trigger(TriggerEvent , Room *room, ServerPlayer *player, QVariant &) const{
     if (player->getPhase() != Player::Finish)
         return false;
     ServerPlayer *yuejin = room->findPlayerBySkillName(objectName());
     if (!yuejin || yuejin == player)
         return false;
     if (!yuejin->isKongcheng() && room->askForCard(yuejin, ".Basic", "@xiaoguo", QVariant(), objectName())) {
         room->broadcastSkillInvoke(objectName(), 1);
         if (!room->askForCard(player, ".Equip", "@xiaoguo-discard", QVariant())) {
             room->broadcastSkillInvoke(objectName(), 2);
             DamageStruct damage;
             damage.card = NULL;
             damage.from = yuejin;
             damage.to = player;
             room->damage(damage);
         } else
             room->broadcastSkillInvoke(objectName(), 3);
     }
     return false;
 }