Esempio n. 1
0
void FurongCard::onEffect(const CardEffectStruct &effect) const
{
    Room *room = effect.from->getRoom();

    // copy Room::askForCard twice!!
    // anti-programming skill!!
    // wait for the final version.

    const Card *card1 = NULL;
    const Card *card2 = NULL;

    if (card1 == NULL || card2 == NULL)
        return;

    //for future use

    if (card1->isKindOf("Slash") && !card2->isKindOf("Jink"))
        room->damage(DamageStruct(objectName(), effect.from, effect.to));
    else if (!card1->isKindOf("Slash") && card2->isKindOf("Jink")) {
        if (!effect.to->isNude()) {
            int id = room->askForCardChosen(effect.from, effect.to, "he", objectName());
            room->obtainCard(effect.from, id, false);
        }
    }
}
Esempio n. 2
0
void TuxiCard::onEffect(const CardEffectStruct &effect) const{
    Room *room = effect.from->getRoom();
    if (effect.from->isAlive() && !effect.to->isKongcheng()) {
        int card_id = room->askForCardChosen(effect.from, effect.to, "h", "tuxi");
        CardMoveReason reason(CardMoveReason::S_REASON_EXTRACTION, effect.from->objectName());
        room->obtainCard(effect.from, Sanguosha->getCard(card_id), reason, false);
    }
}
Esempio n. 3
0
void TuxiCard::onEffect(const CardEffectStruct &effect) const{
    Room *room = effect.from->getRoom();
    int card_id = room->askForCardChosen(effect.from, effect.to, "h", "tuxi");
    const Card *card = Sanguosha->getCard(card_id);
    room->moveCardTo(card, effect.from, Player::Hand, false);

    room->setEmotion(effect.to, Room::Bad);
    room->setEmotion(effect.from, Room::Good);
}
 virtual void onDamaged(ServerPlayer *simayi, const DamageStruct &damage) const{
     Room *room = simayi->getRoom();
     int aidelay = Config.AIDelay;
     Config.AIDelay = 0;
     int card_id = room->askForCardChosen(simayi, damage.from, "he", objectName());
     Config.AIDelay = aidelay;
     CardMoveReason reason(CardMoveReason::S_REASON_EXTRACTION, simayi->objectName());
     room->obtainCard(simayi, Sanguosha->getCard(card_id), reason, false);
 }
Esempio n. 5
0
void XuanhuoCard::onEffect(const CardEffectStruct &effect) const{
    effect.to->obtainCard(this);

    Room *room = effect.from->getRoom();
    int card_id = room->askForCardChosen(effect.from, effect.to, "he", "xuanhuo");
    const Card *card = Sanguosha->getCard(card_id);
    room->moveCardTo(card, effect.from, Player::Hand, false);

    QList<ServerPlayer *> targets = room->getOtherPlayers(effect.to);
    ServerPlayer *target = room->askForPlayerChosen(effect.from, targets, "xuanhuo");
    if(target != effect.from)
        room->moveCardTo(card, target, Player::Hand, false);

    card_id = room->askForCardChosen(effect.from, effect.to, "he", "xuanhuo");
    card = Sanguosha->getCard(card_id);
    room->moveCardTo(card, effect.from, Player::Hand, false);
    targets = room->getOtherPlayers(effect.to);
    target = room->askForPlayerChosen(effect.from, targets, "xuanhuo");
    if(target != effect.from)
        room->moveCardTo(card, target, Player::Hand, false);
}
Esempio n. 6
0
    void doChongZhen(ServerPlayer *player, const Card *card) const{
        if(card->getSkillName() != "longdan")
            return;

        Room *room = player->getRoom();

        ServerPlayer *target = player->tag["ChongZhenTarget"].value<PlayerStar>();
        if(!target || target->isKongcheng() || !room->askForSkillInvoke(player, objectName()))
            return;

        int card_id = room->askForCardChosen(player, target, "h", objectName());
        room->moveCardTo(Sanguosha->getCard(card_id), player, Player::Hand, false);
    }
Esempio n. 7
0
void ThChayinCard::onEffect(const CardEffectStruct &effect) const{
    Room *room = effect.from->getRoom();
    bool has_suit = false;
    QList<int> disabled_ids;
    Suit suit = Sanguosha->getCard(subcards.first())->getSuit();
    foreach (const Card *c, effect.to->getCards("ej")) {
        if (c->getSuit() != suit)
            disabled_ids << c->getId();
        else
            has_suit = true;
    }
    if (!has_suit)
        return;
    int id = room->askForCardChosen(effect.from, effect.to, "ej", "thchayin", false, MethodNone, disabled_ids);
    if (id != -1)
        room->obtainCard(effect.from, id);
}
    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{
    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 {
Esempio n. 10
0
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);
    }
}
Esempio n. 11
0
    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{