virtual bool trigger(TriggerEvent event, ServerPlayer *player, QVariant &data) const{ if(player->isNude()) return false; Room *room = player->getRoom(); ServerPlayer *caopi = NULL; QList<ServerPlayer *> players = room->getOtherPlayers(player); foreach(ServerPlayer *p, players){ if(p->hasSkill(objectName())){ caopi = p; break; } } if(caopi && caopi->isAlive() && room->askForSkillInvoke(caopi, objectName())){ caopi->obtainCard(player->getWeapon()); caopi->obtainCard(player->getArmor()); caopi->obtainCard(player->getDefensiveHorse()); caopi->obtainCard(player->getOffensiveHorse()); DummyCard *all_cards = player->wholeHandCards(); if(all_cards){ room->moveCardTo(all_cards, caopi, Player::Hand, false); delete all_cards; } } return false; }
virtual bool trigger(TriggerEvent , ServerPlayer *player, QVariant &data) const{ if(player->isNude()) return false; Room *room = player->getRoom(); ServerPlayer *caopi = room->findPlayerBySkillName(objectName()); if(caopi && caopi->isAlive() && room->askForSkillInvoke(caopi, objectName(), data)){ if(player->isCaoCao()){ room->playSkillEffect(objectName(), 3); }else if(player->getGeneral()->isMale()) room->playSkillEffect(objectName(), 1); else room->playSkillEffect(objectName(), 2); caopi->obtainCard(player->getWeapon()); caopi->obtainCard(player->getArmor()); caopi->obtainCard(player->getDefensiveHorse()); caopi->obtainCard(player->getOffensiveHorse()); DummyCard *all_cards = player->wholeHandCards(); if(all_cards){ room->moveCardTo(all_cards, caopi, Player::Hand, false); delete all_cards; } } return false; }
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); }
void HuangtianCard::use(Room *room, ServerPlayer *, const QList<ServerPlayer *> &targets) const{ ServerPlayer *zhangjiao = targets.first(); if(zhangjiao->hasSkill("huangtian")){ zhangjiao->obtainCard(this); room->setEmotion(zhangjiao, "good"); } }
void FanjianCard::onEffect(const CardEffectStruct &effect) const{ ServerPlayer *zhouyu = effect.from; ServerPlayer *target = effect.to; Room *room = zhouyu->getRoom(); int card_id = zhouyu->getRandomHandCardId(); const Card *card = Sanguosha->getCard(card_id); Card::Suit suit = room->askForSuit(target); LogMessage log; log.type = "#ChooseSuit"; log.from = target; log.arg = Card::Suit2String(suit); room->sendLog(log); room->showCard(zhouyu, card_id); room->getThread()->delay(); if(card->getSuit() != suit){ DamageStruct damage; damage.card = NULL; damage.from = zhouyu; damage.to = target; room->damage(damage); } if(target->isAlive()){ target->obtainCard(card); } }
void NeoFanjianCard::onEffect(const CardEffectStruct &effect) const{ ServerPlayer *zhouyu = effect.from; ServerPlayer *target = effect.to; Room *room = zhouyu->getRoom(); room->broadcastSkillInvoke("fanjian"); const Card *card = Sanguosha->getCard(getSubcards().first()); int card_id = card->getEffectiveId(); Card::Suit suit = room->askForSuit(target, "neofanjian"); LogMessage log; log.type = "#ChooseSuit"; log.from = target; log.arg = Card::Suit2String(suit); room->sendLog(log); room->getThread()->delay(); target->obtainCard(this); room->showCard(target, card_id); if(card->getSuit() != suit){ DamageStruct damage; damage.card = NULL; damage.from = zhouyu; damage.to = target; room->damage(damage); } }
void HuangtianCard::use(Room *room, ServerPlayer *, const QList<ServerPlayer *> &targets) const{ ServerPlayer *zhangjiao = targets.first(); if(zhangjiao->hasLordSkill("huangtian")){ zhangjiao->obtainCard(this); QList<int> subcards = this->getSubcards(); foreach(int card_id, subcards) room->setCardFlag(card_id,"visible"); room->setEmotion(zhangjiao, "good"); }
void HuangtianCard::use(Room *room, ServerPlayer *source, QList<ServerPlayer *> &targets) const{ ServerPlayer *zhangjiao = targets.first(); if (zhangjiao->hasLordSkill("huangtian")) { room->setPlayerFlag(zhangjiao, "HuangtianInvoked"); room->broadcastSkillInvoke("huangtian"); room->notifySkillInvoked(zhangjiao, "huangtian"); zhangjiao->obtainCard(this); QList<ServerPlayer *> zhangjiaos; QList<ServerPlayer *> players = room->getOtherPlayers(source); foreach (ServerPlayer *p, players) { if (p->hasLordSkill("huangtian") && !p->hasFlag("HuangtianInvoked")) zhangjiaos << p; } if (zhangjiaos.empty()) room->setPlayerFlag(source, "ForbidHuangtian"); }
void ZiliangCard::use(Room *room, ServerPlayer *source, QList<ServerPlayer *> &) const { ServerPlayer *target = source->tag["ZiliangCurrentTarget"].value<ServerPlayer *>(); if (target == NULL) return; source->tag.remove("ZiliangCurrentTarget"); if (target == source) { LogMessage log; log.type = "$MoveCard"; log.from = source; log.to << source; log.card_str = QString::number(subcards.first()); room->sendLog(log); } target->obtainCard(this); }
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; }
void HuangtianCard::use(Room *room, ServerPlayer *source, QList<ServerPlayer *> &targets) const{ ServerPlayer *zhangjiao = targets.first(); if(zhangjiao->hasLordSkill("huangtian")){ room->setPlayerFlag(zhangjiao, "HuangtianInvoked"); room->broadcastSkillInvoke("huangtian"); zhangjiao->obtainCard(this); QList<int> subcards = this->getSubcards(); foreach(int card_id, subcards) room->setCardFlag(card_id,"visible"); room->setEmotion(zhangjiao, "good"); QList<ServerPlayer *> zhangjiaos; QList<ServerPlayer *> players = room->getOtherPlayers(source); foreach(ServerPlayer *p, players){ if(p->hasLordSkill("huangtian") && !p->hasFlag("HuangtianInvoked")){ zhangjiaos << p; } } if(zhangjiaos.empty()) room->setPlayerFlag(source, "ForbidHuangtian"); }
void SuperFanjianCard::onEffect(const CardEffectStruct &effect) const{ ServerPlayer *superzhouyu = effect.from; ServerPlayer *target = effect.to; Room *room = superzhouyu->getRoom(); int card_id = superzhouyu->getRandomHandCardId(); const Card *card = Sanguosha->getCard(card_id); Card::Suit suit = room->askForSuit(target); LogMessage log; log.type = "#ChooseSuit"; log.from = target; log.arg = Card::Suit2String(suit); room->sendLog(log); room->showCard(target, card_id); room->getThread()->delay(); if(card->getSuit() != suit){ DamageStruct damage; damage.card = NULL; damage.from = superzhouyu; damage.to = target; if(damage.from->hasSkill("jueqing")){ LogMessage log; log.type = "#Jueqing"; log.from = damage.from; log.to << damage.to; log.arg = QString::number(1); room->sendLog(log); room->playSkillEffect("jueqing"); room->loseHp(damage.to, 1); }else{ room->damage(damage); } } target->obtainCard(card); }