virtual bool trigger(TriggerEvent , Room* room, ServerPlayer *, QVariant &data) const{ ServerPlayer *caozhi = room->findPlayerBySkillName(objectName()); CardsMoveOneTimeStar move = data.value<CardsMoveOneTimeStar>(); if(move->from_places.contains(Player::PlaceDelayedTrick) || move->from_places.contains(Player::PlaceSpecial)) return false; if(move->to_place == Player::DiscardPile && move->from && move->from->objectName() != caozhi->objectName() && (move->reason.m_reason & CardMoveReason::S_MASK_BASIC_REASON) == CardMoveReason::S_REASON_DISCARD){ QList<CardsMoveStruct> exchangeMove; CardsMoveStruct luoyingget; foreach(int card_id, move->card_ids){ if(Sanguosha->getCard(card_id)->getSuit() == Card::Club && Sanguosha->getCard(card_id)->objectName() != "shit"){ luoyingget.card_ids << card_id; luoyingget.to = caozhi; luoyingget.to_place = Player::PlaceHand; } } if(luoyingget.card_ids.empty()) return false; else{ if(move->reason.m_reason == CardMoveReason::S_REASON_THROW && caozhi->askForSkillInvoke(objectName(), data)){ if(move->from->getGeneralName() == "zhenji") room->broadcastSkillInvoke("luoying", 2); else room->broadcastSkillInvoke("luoying", 1); exchangeMove.push_back(luoyingget); // iwillback room->moveCards(exchangeMove, true); } else{ foreach(int card_id, luoyingget.card_ids){ if(caozhi->askForSkillInvoke(objectName(), data)){ if(move->from->getGeneralName() == "zhenji") room->broadcastSkillInvoke("luoying", 2); else room->broadcastSkillInvoke("luoying", 1); CardMoveReason reason(CardMoveReason::S_REASON_RECYCLE, caozhi->objectName()); room->obtainCard(caozhi, Sanguosha->getCard(card_id), reason); } } } } }
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 trigger(TriggerEvent , Room* room, ServerPlayer *, QVariant &data) const{ ServerPlayer *caozhi = room->findPlayerBySkillName(objectName()); if(!caozhi) return false; CardsMoveOneTimeStar move = data.value<CardsMoveOneTimeStar>(); if(move->from_places.contains(Player::PlaceDelayedTrick) || move->from_places.contains(Player::PlaceSpecial)) return false; if(move->to_place == Player::DiscardPile && move->from && move->from != caozhi && ((move->reason.m_reason & CardMoveReason::S_MASK_BASIC_REASON) == CardMoveReason::S_REASON_DISCARD)){ QList<CardsMoveStruct> exchangeMove; CardsMoveStruct luoyingget; luoyingget.to = caozhi; luoyingget.to_place = Player::PlaceHand; foreach(int card_id, move->card_ids){ if(Sanguosha->getCard(card_id)->getSuit() == Card::Club){ luoyingget.card_ids << card_id; } } if(luoyingget.card_ids.empty()) return false; else if(caozhi->askForSkillInvoke(objectName(), data)){ while(!luoyingget.card_ids.isEmpty()) { room->fillAG(luoyingget.card_ids, caozhi); int id = room->askForAG(caozhi, luoyingget.card_ids, true, objectName()); if(id == -1) { caozhi->invoke("clearAG"); break; } luoyingget.card_ids.removeOne(id); caozhi->invoke("clearAG"); } if(!luoyingget.card_ids.empty()){ exchangeMove.push_back(luoyingget); if(Config.SoundEffectMode == "Qsgs") { if(move->from->getGeneralName() == "zhenji") room->playSkillEffect("luoying", 2); else room->playSkillEffect("luoying", 1); } else room->playSkillEffect("luoying"); room->moveCards(exchangeMove, true); } } }
virtual bool trigger(TriggerEvent event, Room* room, ServerPlayer *player, QVariant &data) const{ 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; } ServerPlayer *caozhi = room->findPlayerBySkillName(objectName()); foreach(const Card* card, clubs) if(card->objectName() == "shit") if(caozhi && room->askForChoice(caozhi, objectName(), "yes+no") == "no") clubs.removeOne(card); if(clubs.isEmpty()) return false; if(caozhi && caozhi->askForSkillInvoke(objectName(), data)){ if(player->getGeneralName() == "zhenji") room->playSkillEffect("luoying", 2); else room->playSkillEffect("luoying", 1); foreach(const Card *club, clubs) caozhi->obtainCard(club); } return false; }
virtual bool trigger(TriggerEvent, Room* room, ServerPlayer *player, QVariant &data) const{ if(player->getPhase() != Player::Play) return false; CardUseStruct use = data.value<CardUseStruct>(); ServerPlayer *liru = room->findPlayerBySkillName(objectName()); if(!liru || liru->getPile("du").isEmpty()) return false; if(use.card->inherits("Slash") && !player->hasFlag("drank") && liru->askForSkillInvoke(objectName())){ room->playSkillEffect(objectName(), 2); room->obtainCard(player, liru->getPile("du").first()); room->setPlayerFlag(player, "drank"); if(room->askForChoice(player, objectName(), "turn+lp") == "turn") player->turnOver(); else room->loseHp(player); } return false; }
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; }