Esempio n. 1
0
void QuhuCard::use(Room *room, ServerPlayer *xunyu, QList<ServerPlayer *> &targets) const{
    ServerPlayer *tiger = targets.first();

    room->broadcastSkillInvoke("quhu", 1);

    bool success = xunyu->pindian(tiger, "quhu", NULL);
    if (success) {
        room->broadcastSkillInvoke("quhu", 2);

        QList<ServerPlayer *> players = room->getOtherPlayers(tiger), wolves;
        foreach (ServerPlayer *player, players) {
            if (tiger->inMyAttackRange(player))
                wolves << player;
        }

        if (wolves.isEmpty()) {
            LogMessage log;
            log.type = "#QuhuNoWolf";
            log.from = xunyu;
            log.to << tiger;
            room->sendLog(log);

            return;
        }

        ServerPlayer *wolf = room->askForPlayerChosen(xunyu, wolves, "quhu", QString("@quhu-damage:%1").arg(tiger->objectName()));
        room->damage(DamageStruct("quhu", tiger, wolf));
    } else {
Esempio n. 2
0
void QuhuCard::use(Room *room, ServerPlayer *xunyu, const QList<ServerPlayer *> &targets) const{
    ServerPlayer *tiger = targets.first();

    room->playSkillEffect("quhu", 1);

    bool success = xunyu->pindian(tiger, this);
    if(success){
        room->playSkillEffect("quhu", 2);

        QList<ServerPlayer *> players = room->getOtherPlayers(tiger), wolves;
        foreach(ServerPlayer *player, players){
            if(tiger->inMyAttackRange(player))
                wolves << player;
        }

        if(wolves.isEmpty())
            return;

        room->playSkillEffect("#tunlang");
        ServerPlayer *wolf = room->askForPlayerChosen(xunyu, wolves, "quhu");

        DamageStruct damage;
        damage.from = tiger;
        damage.to = wolf;

        room->damage(damage);        

    }else{
Esempio n. 3
0
void QuhuCard::use(Room *room, ServerPlayer *xunyu, const QList<ServerPlayer *> &targets) const {
    ServerPlayer *tiger = targets.first();

    room->broadcastSkillInvoke("quhu");

    bool success = xunyu->pindian(tiger, "quhu", this);
    if(success) {
        room->broadcastSkillInvoke("quhu");

        QList<ServerPlayer *> players = room->getOtherPlayers(tiger), wolves;
        foreach(ServerPlayer *player, players) {
            if(tiger->inMyAttackRange(player))
                wolves << player;
        }

        if(wolves.isEmpty()) {
            LogMessage log;
            log.type = "#QuhuNoWolf";
            log.from = xunyu;
            log.to << tiger;
            room->sendLog(log);

            return;
        }

        room->broadcastSkillInvoke("#tunlang");
        ServerPlayer *wolf = room->askForPlayerChosen(xunyu, wolves, "quhu");

        DamageStruct damage;
        damage.from = tiger;
        damage.to = wolf;

        room->damage(damage);

    } else {
Esempio n. 4
0
void QuhuCard::onEffect(const CardEffectStruct &effect) const{
    ServerPlayer *xunyu = effect.from;
    ServerPlayer *tiger = effect.to;
    Room *room = xunyu->getRoom();

    bool success = room->pindian(xunyu, tiger);
    if(success){
        QList<ServerPlayer *> players = room->getOtherPlayers(tiger), wolves;
        foreach(ServerPlayer *player, players){
            if(tiger->inMyAttackRange(player))
                wolves << player;
        }

        if(wolves.isEmpty())
            return;

        ServerPlayer *wolf = room->askForPlayerChosen(xunyu, wolves);

        DamageStruct damage;
        damage.from = tiger;
        damage.to = wolf;

        room->damage(damage);

    }else{
Esempio n. 5
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;
 }