예제 #1
0
void ServerPlayer::throwAllEquips(){
    QList<const Card *> equips = getEquips();

    if(equips.isEmpty())
        return;

    DummyCard *card = new DummyCard;
    foreach(const Card *equip, equips)
        card->addSubcard(equip);
    room->throwCard(card, this);
    card->deleteLater();
}
예제 #2
0
int ServerPlayer::getRandomCardId(const QString &flags) const{
    QList<const Card *> cards;
    if(flags.contains("h"))
        cards << handcards;
    if(flags.contains("e"))
        cards << getEquips();
    if(flags.contains("j"))
        cards << getJudgingArea();
    if(cards.isEmpty())
        return -4;
    int index = qrand() % cards.length();
    return cards.at(index)->getEffectiveId();
}
예제 #3
0
QList<const Card *> ServerPlayer::getCards(const QString &flags) const{
    QList<const Card *> cards;
    if(flags.contains("h"))
        cards << handcards;

    if(flags.contains("e"))
        cards << getEquips();

    if(flags.contains("j")){
        QStack<const Card *> tricks = getJudgingArea();
        foreach(const Card *trick, tricks)
            cards << trick;
    }
예제 #4
0
void ServerPlayer::throwAllEquips(){
    QList<const Card *> equips = getEquips();

    if(equips.isEmpty())
        return;

    DummyCard *card = new DummyCard;
    foreach(const Card *equip, equips)
        card->addSubcard(equip);
    room->throwCard(card);

    CardStar card_star = card;
    QVariant data = QVariant::fromValue(card_star);
    room->getThread()->trigger(CardDiscarded, this, data);
    card->deleteLater();
}
예제 #5
0
bool Player::hasSkill(const QString &skill_name, bool include_lose) const{
    if (!include_lose) {
        if (!hasEquipSkill(skill_name)) {
            const Skill *skill = Sanguosha->getSkill(skill_name);
            if (phase == Player::NotActive) {
                const Player *current = NULL;
                foreach (const Player *p, getAliveSiblings()) {
                    if (p->getPhase() != Player::NotActive) {
                        current = p;
                        break;
                    }
                }
                if (current && current->hasSkill("huoshui") && hp >= (max_hp + 1) / 2 && (!skill || !skill->isAttachedLordSkill()))
                    return false;
                if (current && current->hasSkill("neo2013huoshui") && current->getEquips().length() >= getEquips().length()
                    && (!skill || !skill->isAttachedLordSkill()))
                    return false;
            }
            if (getMark("Qingcheng" + skill_name) > 0)
                return false;
            if (skill_name != "chanyuan" && hasSkill("chanyuan") && hp == 1 && (!skill || !skill->isAttachedLordSkill()))
                return false;
        } 
    }
    return head_skills.value(skill_name, false)
           || deputy_skills.value(skill_name, false)
           || acquired_skills.contains(skill_name);
}