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 void onDamaged(ServerPlayer *caocao, const DamageStruct &damage) const{ Room *room = caocao->getRoom(); const Card *card = damage.card; if(card && room->getCardPlace(card->getEffectiveId()) == Player::PlaceTable){ QVariant data = QVariant::fromValue(card); if(room->askForSkillInvoke(caocao, "jianxiong", data)){ room->broadcastSkillInvoke(objectName()); caocao->obtainCard(card); } } }
virtual bool onPhaseChange(ServerPlayer *player) const{ if(player->getPhase() != Player::Draw) return false; Room *room = player->getRoom(); QList<ServerPlayer *> players = room->getOtherPlayers(player); bool has_frantic = player->getMark("@frantic")>0; if(has_frantic){ room->playSkillEffect(objectName(), player->getGender() == General::Male ? 2: 4); foreach(ServerPlayer *target, players){ if(target->getCards("he").length() == 0) continue; int card_id = room->askForCardChosen(player, target, "he", objectName()); room->obtainCard(player, card_id, room->getCardPlace(card_id) != Player::Hand); } return true; } else{
virtual bool trigger(TriggerEvent , ServerPlayer *player, QVariant &data) const { CardUseStruct use = data.value<CardUseStruct>(); if(use.card->inherits("NeptunianAttack") && ((!use.card->isVirtualCard()) || (use.card->getSubcards().length() == 1 && Bang->getCard(use.card->getSubcards().first())->inherits("NeptunianAttack")))) { Room *room = player->getRoom(); if(room->getCardPlace(use.card->getEffectiveId()) == Player::DiscardPile) { QList<ServerPlayer *> players = room->getAllPlayers(); foreach(ServerPlayer *p, players) { if(p->hasSkill(objectName())) { p->obtainCard(use.card); room->playSkillEffect(objectName()); break; } } }
virtual bool trigger(TriggerEvent event, ServerPlayer *diaochan, QVariant &data) const{ Room *room = diaochan->getRoom(); if(event == PhaseChange && diaochan->getPhase() == Player::Discard){ ServerPlayer *target = room->getTag("LihunTarget").value<PlayerStar>(); if(!target || target->isDead()) return false; int hp = target->isAlive() ? target->getHp() : 0; if(diaochan->getCards("he").length() <= hp){ foreach(const Card *card, diaochan->getCards("he")){ room->moveCardTo(card, target, Player::Hand, room->getCardPlace(card->getEffectiveId()) == Player::Hand ? false : true); } }
bool onPhaseChange(ServerPlayer *player) const { if (player->getPhase() != Player::Draw) return false; Room *room = player->getRoom(); QList<ServerPlayer *> players = room->getOtherPlayers(player); bool has_frantic = player->getMark("@frantic") > 0; room->broadcastSkillInvoke(objectName()); if (has_frantic) { foreach (ServerPlayer *target, players) { if (target->getCards("he").length() == 0) continue; int card_id = room->askForCardChosen(player, target, "he", objectName()); room->obtainCard(player, card_id, room->getCardPlace(card_id) != Player::PlaceHand); } return true; } else {
void DiyShenZhiCard::onEffect(const CardEffectStruct &effect) const{ Room *room = effect.from->getRoom(); const Card *card = Sanguosha->getCard(this->subcards.first()); room->showCard(effect.from, card->getEffectiveId(), effect.to); QString choice = room->askForChoice(effect.to, "diyshenzhi", "obtain+reject"); if(choice == "obtain"){ room->moveCardTo(card, effect.to, Player::Hand, false); effect.to->drawCards(1); room->loseHp(effect.to, 1); room->playSkillEffect("diyshenzhi", 1); }else{ room->throwCard(this, effect.from); int card_id = room->askForCardChosen(effect.from, effect.to, "he", "diyshenzhi"); const Card *card = Sanguosha->getCard(card_id); bool is_public = room->getCardPlace(card_id) != Player::Hand; room->moveCardTo(card, effect.from, Player::Hand, is_public ? true : false); room->playSkillEffect("diyshenzhi", 2); } }
virtual bool onPhaseChange(ServerPlayer *player) const{ if(player->getPhase() != Player::Draw) return false; Room *room = player->getRoom(); QList<ServerPlayer *> players = room->getOtherPlayers(player); bool has_frantic = player->getMark("@frantic")>0; room->playSkillEffect(objectName()); if(has_frantic){ foreach(ServerPlayer *target, players){ if(target->getCards("he").length() == 0) continue; int card_id = room->askForCardChosen(player, target, "he", objectName()); if(room->getCardPlace(card_id) == Player::Hand) room->moveCardTo(Sanguosha->getCard(card_id), player, Player::Hand, false); else room->obtainCard(player, card_id); } return true; } else{
virtual bool viewFilter(const Card *to_select) const{ Room *room = Sanguosha->currentRoom(); Player::Place place = room->getCardPlace(to_select->getEffectiveId()); return to_select->getSuit() == Card::Heart && place == Player::PlaceHand; }