const Card *HuanhuoCard::validate(CardUseStruct &card_use) const { ServerPlayer *yuji = card_use.from; Room *room = yuji->getRoom(); QString to_guhuo = user_string; if (user_string == "slash" && Sanguosha->currentRoomState()->getCurrentCardUseReason() == CardUseStruct::CARD_USE_REASON_RESPONSE_USE) { QStringList guhuo_list; guhuo_list << "slash"; if (!Config.BanPackages.contains("maneuvering")) guhuo_list << "normal_slash" << "thunder_slash" << "fire_slash"; to_guhuo = room->askForChoice(yuji, "guhuo_slash", guhuo_list.join("+")); } room->broadcastSkillInvoke("crhuanhuo"); LogMessage log; log.type = card_use.to.isEmpty() ? "#HuanhuoNoTarget" : "#Huanhuo"; log.from = yuji; log.to = card_use.to; log.arg = to_guhuo; log.arg2 = "crhuanhuo"; room->sendLog(log); QString user_str; if (to_guhuo == "normal_slash") user_str = "slash"; else user_str = to_guhuo; Card *use_card = Sanguosha->cloneCard(user_str, Card::NoSuit, 0); use_card->setSkillName("crhuanhuo"); use_card->deleteLater(); return use_card; }
void Shit::onMove(const CardMoveStruct &move) const{ ServerPlayer *from = move.from; if(from && move.from_place == Player::Hand && from->getRoom()->getCurrent() == move.from && move.to_place == Player::DiscardedPile && from->isAlive()){ DamageStruct damage; damage.from = damage.to = from; damage.card = this; damage.damage = 1; damage.nature = DamageStruct::Normal; from->getRoom()->damage(damage); } }
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 LeijiCard::onEffect(const CardEffectStruct &effect) const{ ServerPlayer *zhangjiao = effect.from; ServerPlayer *target = effect.to; Room *room = zhangjiao->getRoom(); room->setEmotion(target, "bad"); JudgeStruct judge; judge.pattern = QRegExp("(.*):(spade):(.*)"); judge.good = false; judge.reason = "leiji"; judge.who = target; room->judge(judge); if(judge.isBad()){ DamageStruct damage; damage.card = NULL; damage.damage = 2; damage.from = zhangjiao; damage.to = target; damage.nature = DamageStruct::Thunder; room->damage(damage); }else room->setEmotion(zhangjiao, "bad"); }
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 EOSCard::onEffect(const CardEffectStruct &effect) const{ ServerPlayer *jinteng = effect.from; Room *room = jinteng->getRoom(); QString choice = room->askForChoice(effect.from, "EOS", "fangju+fangyuma+jingongma"); if(choice == "fangju"){ if(effect.to->hasArmor()){ room->moveCardTo(this, effect.to, Player::Hand); room->moveCardTo(effect.to->getEquip(1), jinteng, Player::Hand); } }else if(choice == "fangyuma"){ if(effect.to->hasDefhorse()){ room->moveCardTo(this, effect.to, Player::Hand); room->moveCardTo(effect.to->getEquip(2), jinteng, Player::Hand); } }else{ if(effect.to->hasOffhorse()){ room->moveCardTo(this, effect.to, Player::Hand); room->moveCardTo(effect.to->getEquip(3), jinteng, Player::Hand); } } room->playSkillEffect("EOS"); return; }
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{
void Shit::onMove(const CardMoveStruct &move) const{ ServerPlayer *from = (ServerPlayer*)move.from; if(from && move.from_place == Player::PlaceHand && from->getRoom()->getCurrent() == move.from && (move.to_place == Player::DiscardPile || move.to_place == Player::TopDrawPile || move.to_place == Player::DealingArea) && move.to == NULL){ doDamage((ServerPlayer*)move.from); } }
void Shit::onMove(const CardMoveStruct &move) const{ ServerPlayer *from = (ServerPlayer*)move.from; if(from && move.from_place == Player::PlaceHand && from->getRoom()->getCurrent() == move.from && (move.to_place == Player::DiscardPile || move.to_place == Player::PlaceSpecial) && move.to == NULL && from->isAlive()){ LogMessage log; log.card_str = getEffectIdString(); log.from = from; Room *room = from->getRoom(); if(getSuit() == Spade){ log.type = "$ShitLostHp"; room->sendLog(log); room->loseHp(from); return; } DamageStruct damage; damage.from = damage.to = from; damage.card = this; switch(getSuit()){ case Club: damage.nature = DamageStruct::Thunder; break; case Heart: damage.nature = DamageStruct::Fire; break; default: damage.nature = DamageStruct::Normal; } log.type = "$ShitDamage"; room->sendLog(log); room->damage(damage); } }
void Shit::onMove(const CardMoveStruct &move) const{ ServerPlayer *from = move.from; if(from && move.from_place == Player::Hand && from->getRoom()->getCurrent() == move.from && (move.to_place == Player::DiscardedPile || move.to_place == Player::Special) && move.to == NULL && from->isAlive()){ DamageStruct damage; damage.from = damage.to = from; damage.card = this; switch(getSuit()){ case Club: damage.nature = DamageStruct::Thunder; break; case Heart: damage.nature = DamageStruct::Fire; break; default: damage.nature = DamageStruct::Normal; } from->getRoom()->damage(damage); } }
const Card *JijiangCard::validate(CardUseStruct &cardUse) const{ cardUse.m_isOwnerUse = false; ServerPlayer *liubei = cardUse.from; QList<ServerPlayer *> targets = cardUse.to; Room *room = liubei->getRoom(); liubei->broadcastSkillInvoke(this); room->notifySkillInvoked(liubei, "jijiang"); LogMessage log; log.from = liubei; log.to = targets; log.type = "#UseCard"; log.card_str = toString(); room->sendLog(log); const Card *slash = NULL; QList<ServerPlayer *> lieges = room->getLieges("shu", liubei); foreach (ServerPlayer *target, targets) target->setFlags("JijiangTarget"); foreach (ServerPlayer *liege, lieges) { try { slash = room->askForCard(liege, "slash", "@jijiang-slash:" + liubei->objectName(), QVariant(), Card::MethodResponse, liubei); } catch (TriggerEvent triggerEvent) { if (triggerEvent == TurnBroken || triggerEvent == StageChange) { foreach (ServerPlayer *target, targets) target->setFlags("-JijiangTarget"); } throw triggerEvent; } if (slash) { foreach (ServerPlayer *target, targets) target->setFlags("-JijiangTarget"); return slash; } } foreach (ServerPlayer *target, targets) target->setFlags("-JijiangTarget"); room->setPlayerFlag(liubei, "Global_JijiangFailed"); return NULL; }
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); }