コード例 #1
0
int Player::getAttackRange(bool include_weapon) const{
    int original_range = 1;
    if (hasSkill("zhengfeng") && !weapon && hp > 1) original_range = hp; // @todo_P: new way to remove coupling or just put it into TargetModSkill
    if (hasFlag("InfinityAttackRange") || getMark("InfinityAttackRange") > 0) original_range = 10000; // Actually infinity
    int weapon_range = 0;
    if (include_weapon && weapon != NULL) {
        const Weapon *card = qobject_cast<const Weapon *>(weapon->getRealCard());
        Q_ASSERT(card);
        weapon_range = card->getRange();
    }
    return qMax(original_range, weapon_range) + (hasSkill("fentian") ? getPile("burn").length() : 0);
}
コード例 #2
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);
}
コード例 #3
0
ファイル: player.cpp プロジェクト: BruceLiCong/QSanguosha
int Player::getAttackRange() const{
    if(weapon)
        return weapon->getRange();
    else if(hasSkill("zhengfeng"))
        return hp;
    else
        return 1;
}
コード例 #4
0
ファイル: player.cpp プロジェクト: hitgy09/QSanguosha
int Player::getAttackRange() const {
    if(hasFlag("tianyi_success") || hasFlag("jiangchi_invoke"))
        return 1000;
    if(weapon)
        return weapon->getRange();
    else if(hasSkill("zhengfeng"))
        return hp;
    else
        return 1;
}
コード例 #5
0
ファイル: player.cpp プロジェクト: Lycio/FolkExtensionMod
int Player::getAttackRange() const{
    if(hasFlag("tianyi_success") || hasFlag("jiangchi_invoke"))
        return 1000;

    if(weapon){
        if(weapon->objectName() == "luofeng_bow")
            return hp;
        else if(weapon->objectName() == "tianlangh")
            return qMax(getMark("@tianlang"), 1);
        else
            return weapon->getRange();
    }
    else if(hasSkill("zhengfeng"))
        return hp;
    else if(hasSkill("CBZhangBa"))
        return 3;
    else
        return 1;
}
コード例 #6
0
ファイル: player.cpp プロジェクト: 43501474/QSanguosha
int Player::getAttackRange() const{
    if(weapon > 0){
        const Weapon *card = qobject_cast<const Weapon*>(weapon->getRealCard());
        Q_ASSERT(card);
        return card->getRange();
    }
    else if(hasSkill("zhengfeng"))
        return hp;
    else
        return 1;
}
コード例 #7
0
ファイル: player.cpp プロジェクト: ubun/SakuraSlash
int Player::distanceTo(const Player *other) const{
    if(this == other)
        return 0;

    if(fixed_distance.contains(other))
        return fixed_distance.value(other);

    int right = qAbs(seat - other->seat);
    int left = aliveCount() - right;
    int distance = qMin(left, right);

    // the shorten ways of distance
    if(getOffensiveHorse())
        distance --;

    if(hasSkill("mashu"))
        distance --;

    if(hasSkill("yicong") && getHp() > 2)
        distance --;

    // the lengthen ways of distance
    if(other->getDefensiveHorse())
        distance ++;

    if(other->hasSkill("feiying"))
        distance ++;

    if(other->hasSkill("yicong") && other->getHp() <= 2)
        distance ++;

    // keep the distance >=1
    if(distance < 1)
        distance = 1;

    return distance;
}
コード例 #8
0
ファイル: player.cpp プロジェクト: hitgy09/QSanguosha
bool Player::hasLordSkill(const QString &skill_name) const {
    if(acquired_skills.contains(skill_name))
        return true;

    QString mode = getGameMode();
    if(mode == "06_3v3" || mode == "02_1v1")
        return false;

    if(isLord() || ServerInfo.EnableHegemony)
        return hasInnateSkill(skill_name);

    if(hasSkill("weidi")) {
        foreach(const Player *player, getSiblings()) {
            if(player->isLord())
                return player->hasLordSkill(skill_name);
        }
    }
コード例 #9
0
ファイル: player.cpp プロジェクト: ruoxuwu/msgs
bool Player::hasLordSkill(const QString &skill_name) const{
    if(acquired_skills.contains(skill_name))
        return true;

    QString mode = getGameMode();
    if(mode == "06_3v3" || mode == "02_1v1" || mode == "02p")
        return false;

    if(isLord())
        return hasInnateSkill(skill_name);

    if(hasSkill("weidi")){
        foreach(const Player *player, parent()->findChildren<const Player *>()){
            if(player->isLord())
                return player->hasLordSkill(skill_name);
        }
    }
コード例 #10
0
ファイル: player.cpp プロジェクト: fpjk/QSanguosha-v2
int Player::distanceTo(const Player *other, int distance_fix) const
{
    if (this == other)
        return 0;

    if (hasSkill("zhuiji") && other->getHp() < getHp())
        return 1;

    if (fixed_distance.contains(other)) {
        QList<int> distance_list = fixed_distance.values(other);
        int min = 10000;
        foreach (int d, distance_list) {
            if (min > d)
                min = d;
        }

        return min;
    }
コード例 #11
0
ファイル: Skills.cpp プロジェクト: Thoronador/morrowtools
int Skills::readRecordSKIL(std::ifstream& in_File)
{
  SkillRecord temp;
  if (temp.loadFromStream(in_File))
  {
    if (hasSkill(temp.SkillIndex))
    {
      if (getSkillData(temp.SkillIndex).equals(temp))
      {
        //Skill is equal to the already present skill record, return zero.
        return 0;
      }
    }//if skill present
    //add new or changed skill
    addSkill(temp);
    return 1;
  }
  std::cout << "readRecordSKIL: Error while reading record.\n";
  return -1;
}//readRecordSKIL
コード例 #12
0
ファイル: player.cpp プロジェクト: KenKic/QSanguosha
int Player::distanceTo(const Player *other) const{
    if(this == other)
        return 0;

    if(hasSkill("changqu") && other->getRoleEnum() == Player::Lord)
        return 1;

    int right = qAbs(seat - other->seat);
    int left = aliveCount() - right;
    int distance = qMin(left, right);

    distance += correct.equip_src;
    distance += correct.skill_src;

    distance += other->correct.equip_dest;
    distance += other->correct.skill_dest;

    if(distance < 1)
        distance = 1;
    return distance;
}