void Slash::onUse(Room *room, const CardUseStruct &card_use) const{
    ServerPlayer *player = card_use.from;

    if(player->getPhase() == Player::Play
            && player->getMark("SlashCount") >= 1
            && player->hasSkill("paoxiao"))
        room->playSkillEffect("paoxiao");
    else if(player->getPhase() == Player::Play
            && player->hasSkill("huxiao") && player->getMark("huxiao") > 0) {
        bool toSunquan = false;
        foreach(ServerPlayer *p, card_use.to)
            if(p->getGeneralName().contains("sunquan")) {
            toSunquan = true;
            break;
        }
        if(toSunquan)
            room->playSkillEffect("huxiao", 3);
        else
            room->playSkillEffect("huxiao", 2);
    }
 void onDamaged(ServerPlayer *target, const DamageStruct &damage) const
 {
     Room *room = target->getRoom();
     for (int i = 1; i <= damage.damage; i++) {
         ServerPlayer *current = room->getCurrent();
         if (!current || current->isDead() || current->getPhase() == Player::NotActive)
             break;
         if (room->askForSkillInvoke(target, objectName(), QVariant::fromValue(current))) {
             room->broadcastSkillInvoke(objectName());
             room->addPlayerMark(current, "@hengjiang");
         }
     }
 }
Exemple #3
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;
 }