void DelayedTrick::onEffect(const CardEffectStruct &effect) const { Room *room = effect.to->getRoom(); CardMoveReason reason(CardMoveReason::S_REASON_USE, effect.to->objectName(), getSkillName(), QString()); room->moveCardTo(this, NULL, Player::PlaceTable, reason, true); LogMessage log; log.from = effect.to; log.type = "#DelayedTrick"; log.arg = effect.card->objectName(); room->sendLog(log); JudgeStruct judge_struct = judge; judge_struct.who = effect.to; room->judge(judge_struct); if (judge_struct.isBad()) { takeEffect(effect.to); if (room->getCardOwner(getEffectiveId()) == NULL) { CardMoveReason reason(CardMoveReason::S_REASON_NATURAL_ENTER, QString()); room->throwCard(this, reason, NULL); } } else if (movable) { onNullified(effect.to); } else { if (room->getCardOwner(getEffectiveId()) == NULL) { CardMoveReason reason(CardMoveReason::S_REASON_NATURAL_ENTER, QString()); room->throwCard(this, reason, NULL); } } }
void DelayedTrick::onEffect(const CardEffectStruct &effect) const { Room *room = effect.to->getRoom(); CardMoveReason reason(CardMoveReason::S_REASON_USE, effect.to->objectName(), getSkillName(), QString()); room->moveCardTo(this, NULL, Player::PlaceTable, reason, true); LogMessage log; log.from = effect.to; log.type = "#DelayedTrick"; log.arg = effect.card->objectName(); room->sendLog(log); JudgeStruct judge_struct = judge; judge_struct.who = effect.to; room->judge(judge_struct); if (judge_struct.negative == judge_struct.isBad()) { if (effect.to->isAlive()) takeEffect(effect.to); if (room->getCardOwner(getEffectiveId()) == NULL) { CardMoveReason reason(CardMoveReason::S_REASON_NATURAL_ENTER, QString()); room->throwCard(this, reason, NULL); } } else if (movable) { onNullified(effect.to); } else if (returnable && effect.to->isAlive()) { if (room->getCardOwner(getEffectiveId()) == NULL) { if (isVirtualCard()) { Card *delayTrick = Sanguosha->cloneCard(objectName()); WrappedCard *vs_card = Sanguosha->getWrappedCard(getEffectiveId()); vs_card->setSkillName(getSkillName()); vs_card->takeOver(delayTrick); room->broadcastUpdateCard(room->getAlivePlayers(), vs_card->getId(), vs_card); } CardsMoveStruct move; move.card_ids << getEffectiveId(); move.to = effect.to; move.to_place = Player::PlaceDelayedTrick; room->moveCardsAtomic(move, true); } } else { if (room->getCardOwner(getEffectiveId()) == NULL) { CardMoveReason reason(CardMoveReason::S_REASON_NATURAL_ENTER, QString()); room->throwCard(this, reason, NULL); } } }
bool viewFilter(const Card *to_select) const { Room *room = Sanguosha->currentRoom(); ServerPlayer *player = room->getCardOwner(to_select->getId()); return player != NULL && player->getHp() == 1 && to_select->isKindOf("Jink"); }