• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetTotalAuraModifier函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetTotalAuraModifier函数的典型用法代码示例。如果您正苦于以下问题:C++ GetTotalAuraModifier函数的具体用法?C++ GetTotalAuraModifier怎么用?C++ GetTotalAuraModifier使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetTotalAuraModifier函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: OCTRegenMPPerSpirit

void Player::UpdateManaRegen()
{
    // Mana regen from spirit
    float spirit_regen = OCTRegenMPPerSpirit();
    // Apply PCT bonus from SPELL_AURA_MOD_POWER_REGEN_PERCENT aura on spirit base regen
    spirit_regen *= GetTotalAuraMultiplierByMiscValue(SPELL_AURA_MOD_POWER_REGEN_PERCENT, POWER_MANA);

    // SpiritRegen(SPI, INT, LEVEL) = (0.001 + (SPI x sqrt(INT) x BASE_REGEN[LEVEL])) x 5
    if (GetStat(STAT_INTELLECT) > 0.0f)
        spirit_regen *= sqrt(GetStat(STAT_INTELLECT));

    // CombatRegen = 5% of Base Mana
    float base_regen = GetCreateMana() * 0.01f + GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) / 5.0f;

    // Set regen rate in cast state apply only on spirit based regen
    int32 modManaRegenInterrupt = GetTotalAuraModifier(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT);

    SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, base_regen + CalculatePct(spirit_regen, modManaRegenInterrupt));
    SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, 0.001f + spirit_regen + base_regen);
}
开发者ID:AnthoDevMoP,项目名称:Pandaren5.3.0,代码行数:20,代码来源:StatSystem.cpp


示例2: GetTotalAuraModifier

void Player::UpdateBlockPercentage()
{
    // No block
    float value = 0.0f;
    if (CanBlock())
    {
        // Base value
        value = 5.0f;
        // Increase from SPELL_AURA_MOD_BLOCK_PERCENT aura
        value += GetTotalAuraModifier(SPELL_AURA_MOD_BLOCK_PERCENT);
        // Increase from rating
        value += GetRatingBonusValue(CR_BLOCK);

        if (sWorld->getBoolConfig(CONFIG_STATS_LIMITS_ENABLE))
             value = value > sWorld->getFloatConfig(CONFIG_STATS_LIMITS_BLOCK) ? sWorld->getFloatConfig(CONFIG_STATS_LIMITS_BLOCK) : value;

        value = value < 0.0f ? 0.0f : value;
    }
    SetStatFloatValue(PLAYER_BLOCK_PERCENTAGE, value);
}
开发者ID:AnthoDevMoP,项目名称:Pandaren5.3.0,代码行数:20,代码来源:StatSystem.cpp


示例3: getClass

void Player::UpdateParryPercentage()
{ 
    const float parry_cap[MAX_CLASSES] =
    {
        47.003525f,     // Warrior
        47.003525f,     // Paladin
        145.560408f,    // Hunter
        145.560408f,    // Rogue
        0.0f,           // Priest
        47.003525f,     // DK
        145.560408f,    // Shaman
        0.0f,           // Mage
        0.0f,           // Warlock
        0.0f,           // ??
        0.0f            // Druid
    };

    // No parry
    float value = 0.0f;
	m_realParry = 0.0f;
    uint32 pclass = getClass()-1;
    if (CanParry() && parry_cap[pclass] > 0.0f)
    {
        float nondiminishing  = 5.0f;
        // Parry from rating
        float diminishing = GetRatingBonusValue(CR_PARRY);
        // Modify value from defense skill (only bonus from defense rating diminishes)
        nondiminishing += (GetSkillValue(SKILL_DEFENSE) - GetMaxSkillValueForLevel()) * 0.04f;
        diminishing += (int32(GetRatingBonusValue(CR_DEFENSE_SKILL))) * 0.04f;
        // Parry from SPELL_AURA_MOD_PARRY_PERCENT aura
        nondiminishing += GetTotalAuraModifier(SPELL_AURA_MOD_PARRY_PERCENT);
        // apply diminishing formula to diminishing parry chance
        m_realParry = nondiminishing + diminishing * parry_cap[pclass] / (diminishing + parry_cap[pclass] * m_diminishing_k[pclass]);
        m_realParry = m_realParry < 0.0f ? 0.0f : m_realParry;

		value = std::max(diminishing + nondiminishing, 0.0f);
    }

    SetStatFloatValue(PLAYER_PARRY_PERCENTAGE, value);
}
开发者ID:Cryostorm,项目名称:SunwellCore,代码行数:40,代码来源:StatSystem.cpp


示例4: SetFloatValue

void Player::UpdateSpellCritChance(uint32 school)
{
    // For normal school set zero crit chance
    if (school == SPELL_SCHOOL_NORMAL)
    {
        SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1, 0.0f);
        return;
    }
    // For others recalculate it from:
    float crit = 0.0f;
    // Crit from Intellect
    crit += GetSpellCritFromIntellect();
    // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
    crit += GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
    // Increase crit by school from SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
    crit += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, 1<<school);
    // Increase crit from spell crit ratings
    crit += GetRatingBonusValue(CR_CRIT_SPELL);

    // Store crit value
    SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + school, crit);
}
开发者ID:morno,项目名称:blizzlikecore,代码行数:22,代码来源:StatSystem.cpp


示例5: GetTotalAuraModifier

void Player::UpdateMasteryPercentage()
{
    // No mastery
    float value = 0.0f;
    if (CanMastery() && getLevel() >= 80)
    {
        // Mastery from SPELL_AURA_MASTERY aura
        value += GetTotalAuraModifier(SPELL_AURA_MASTERY);
        // Mastery from rating
        value += GetRatingBonusValue(CR_MASTERY);
        value = value < 0.0f ? 0.0f : value;
    }
    SetFloatValue(PLAYER_MASTERY, value);
    // Custom MoP Script
    // 76671 - Mastery : Divine Bulwark - Update Block Percentage
    // 76857 - Mastery : Critical Block - Update Block Percentage
    if (HasAura(76671) || HasAura(76857))
        UpdateBlockPercentage();
    // 77494 - Mastery : Nature's Guardian - Update Armor
    if (HasAura(77494))
        UpdateArmor();
}
开发者ID:AlucardVoss,项目名称:Patchs,代码行数:22,代码来源:StatSystem.cpp


示例6: GetStat

void Player::UpdateManaRegen()
{
    float Intellect = GetStat(STAT_INTELLECT);
    // Mana regen from spirit
    float power_regen = OCTRegenMPPerSpirit();
    // Apply PCT bonus from SPELL_AURA_MOD_POWER_REGEN_PERCENT aura on spirit base regen
    power_regen *= GetTotalAuraMultiplierByMiscValue(SPELL_AURA_MOD_POWER_REGEN_PERCENT, POWER_MANA);

    // Mana regen from SPELL_AURA_MOD_POWER_REGEN aura
    float power_regen_mp5 = GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) / 5.0f;

    // Get bonus from SPELL_AURA_MOD_MANA_REGEN_FROM_STAT aura
    AuraList const& regenAura = GetAurasByType(SPELL_AURA_MOD_MANA_REGEN_FROM_STAT);
    for(AuraList::const_iterator i = regenAura.begin();i != regenAura.end(); ++i)
    {
        Modifier* mod = (*i)->GetModifier();
        power_regen_mp5 += GetStat(Stats(mod->m_miscvalue)) * (*i)->GetModifierValue() / 500.0f;
    }

    // Bonus from some dummy auras
    AuraList const& mDummyAuras = GetAurasByType(SPELL_AURA_PERIODIC_DUMMY);
    for(AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i)
        if((*i)->GetId() == 34074)                          // Aspect of the Viper
        {
            power_regen_mp5 += (*i)->GetModifier()->m_amount * Intellect / 500.0f;
            // Add regen bonus from level in this dummy
            power_regen_mp5 += getLevel() * 35 / 100;
        }

    // Set regen rate in cast state apply only on spirit based regen
    int32 modManaRegenInterrupt = GetTotalAuraModifier(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT);
    if (modManaRegenInterrupt > 100)
        modManaRegenInterrupt = 100;

    m_modManaRegen[1] = power_regen_mp5 + power_regen * modManaRegenInterrupt / 100.0f ; // recent cast

    m_modManaRegen[0] = power_regen_mp5 + power_regen;
}
开发者ID:mynew,项目名称:TrinityCore-1,代码行数:38,代码来源:StatSystem.cpp


示例7: getClass

void Player::UpdateParryPercentage()
{
    const float parry_cap[MAX_CLASSES] =
    {
        65.631440f,     // Warrior
        65.631440f,     // Paladin
        145.560408f,    // Hunter
        145.560408f,    // Rogue
        0.0f,           // Priest
        65.631440f,     // DK
        145.560408f,    // Shaman
        0.0f,           // Mage
        0.0f,           // Warlock
        90.6425f,       // Monk
        0.0f,           // Druid
        65.631440f      // Demon Hunter
    };

    // No parry
    float value = 0.0f;
    uint32 pclass = getClass()-1;
    if (CanParry() && parry_cap[pclass] > 0.0f)
    {
        float nondiminishing  = 5.0f;
        // Parry from rating
        float diminishing = GetRatingBonusValue(CR_PARRY);
        // Parry from SPELL_AURA_MOD_PARRY_PERCENT aura
        nondiminishing += GetTotalAuraModifier(SPELL_AURA_MOD_PARRY_PERCENT);
        // apply diminishing formula to diminishing parry chance
        value = nondiminishing + diminishing * parry_cap[pclass] / (diminishing + parry_cap[pclass] * m_diminishing_k[pclass]);

        if (sWorld->getBoolConfig(CONFIG_STATS_LIMITS_ENABLE))
             value = value > sWorld->getFloatConfig(CONFIG_STATS_LIMITS_PARRY) ? sWorld->getFloatConfig(CONFIG_STATS_LIMITS_PARRY) : value;

        value = value < 0.0f ? 0.0f : value;
    }
    SetStatFloatValue(PLAYER_PARRY_PERCENTAGE, value);
}
开发者ID:brecky,项目名称:TrinityCore,代码行数:38,代码来源:StatSystem.cpp


示例8: getClass

void Player::UpdateParryPercentage()
{
    const float parry_cap[MAX_CLASSES] =
    {
        65.631440f,     // Warrior
        65.631440f,     // Paladin
        145.560408f,    // Hunter
        145.560408f,    // Rogue
        0.0f,           // Priest
        65.631440f,     // DK
        145.560408f,    // Shaman
        0.0f,           // Mage
        0.0f,           // Warlock
        0.0f,           // ??
        0.0f            // Druid
    };

    // No parry
    float value = 0.0f;
    uint32 pclass = getClass() - 1;
    if (CanParry() && parry_cap[pclass] > 0.0f)
    {
        // Base parry
        float nondiminishing = 5.0f;
        float diminishing = 0.0f;
        GetParryFromStrength(diminishing, nondiminishing);
        // Parry from rating
        diminishing += GetRatingBonusValue(CR_PARRY);
        // Parry from SPELL_AURA_MOD_PARRY_PERCENT aura
        nondiminishing += GetTotalAuraModifier(SPELL_AURA_MOD_PARRY_PERCENT);
        // apply diminishing formula to diminishing parry chance
        value = nondiminishing + diminishing * parry_cap[pclass] /
                (diminishing + parry_cap[pclass] * m_diminishing_k[pclass]);
        value = value < 0.0f ? 0.0f : value;
    }
    SetStatFloatValue(PLAYER_PARRY_PERCENTAGE, value);
}
开发者ID:Calixa,项目名称:mangos-cata,代码行数:37,代码来源:StatSystem.cpp


示例9: SetFloatValue

void Player::UpdateMastery()
{
    if (!CanUseMastery())
    {
        SetFloatValue(PLAYER_MASTERY, 0.0f);
        return;
    }

    float value = GetTotalAuraModifier(SPELL_AURA_MASTERY);
    value += GetRatingBonusValue(CR_MASTERY);
    SetFloatValue(PLAYER_MASTERY, value);

    ChrSpecializationEntry const* chrSpec = sChrSpecializationStore.LookupEntry(GetActiveTalentSpec());
    if (!chrSpec)
        return;

    for (uint32 i = 0; i < MAX_MASTERY_SPELLS; ++i)
    {
        if (!chrSpec->MasterySpellID[i])
            continue;

        if (Aura* aura = GetAura(chrSpec->MasterySpellID[i]))
        {
            for (SpellEffectInfo const* effect : aura->GetSpellEffectInfos())
            {
                if (!effect)
                    continue;

                float mult = effect->BonusCoefficient;
                if (G3D::fuzzyEq(mult, 0.0f))
                    continue;

                aura->GetEffect(effect->EffectIndex)->ChangeAmount(int32(value * effect->BonusCoefficient));
            }
        }
    }
}
开发者ID:TrueWoW,项目名称:TrinityCore,代码行数:37,代码来源:StatSystem.cpp


示例10: SetFloatValue

void Player::UpdateMastery()
{
    if (!CanUseMastery())
    {
        SetFloatValue(PLAYER_FIELD_MASTERY, 0.0f);
        return;
    }

    float value = GetTotalAuraModifier(SPELL_AURA_MASTERY);
    value += GetRatingBonusValue(CR_MASTERY);
    SetFloatValue(PLAYER_FIELD_MASTERY, value);
    /*
    TalentTabEntry const* talentTab = sTalentTabStore.LookupEntry(GetTalentSpecialization(GetActiveSpec()));
    if (!talentTab)
        return;

    for (uint32 i = 0; i < MAX_MASTERY_SPELLS; ++i)
    {
        if (!talentTab->MasterySpellId[i])
            continue;

        if (Aura* aura = GetAura(talentTab->MasterySpellId[i]))
        {
            for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
            {
                if (!aura->HasEffect(j))
                    continue;

                float mult = aura->GetSpellInfo()->Effects[j].BonusMultiplier;
                if (G3D::fuzzyEq(mult, 0.0f))
                    continue;

                aura->GetEffect(j)->ChangeAmount(int32(value * aura->GetSpellInfo()->Effects[j].BonusMultiplier));
            }
        }
    }*/
}
开发者ID:AnthoDevMoP,项目名称:SkyFire_5xx,代码行数:37,代码来源:StatSystem.cpp


示例11: SetFloatValue

void Player::UpdateMastery()
{
    if (!IsMasteryLearned())
    {
        SetFloatValue(PLAYER_MASTERY, 0.0f);
        return;
    }

    TalentTabEntry const* talentTab = sTalentTabStore.LookupEntry(GetPrimaryTalentTree(GetActiveSpec()));
    if (!talentTab)
    {
        SetFloatValue(PLAYER_MASTERY, 0.0f);
        return;
    }

    float value = GetTotalAuraModifier(SPELL_AURA_MASTERY);
    value += GetRatingBonusValue(CR_MASTERY);
    SetFloatValue(PLAYER_MASTERY, value);

    for (uint32 i = 0; i < MAX_MASTERY_SPELLS; ++i)
    {
        if (!talentTab->MasterySpells[i])
            continue;

        if (Aura* aura = GetAura(talentTab->MasterySpells[i]))
        {
            for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
            {
                if (!aura->HasEffect(j))
                    continue;

                if (aura->GetSpellInfo()->Effects[j].BasePoints == 0)
                    aura->GetEffect(j)->ChangeAmount(int32(value * aura->GetSpellInfo()->Effects[j].BonusMultiplier));
            }
        }
    }
}
开发者ID:xIchigox,项目名称:SoDCore.434,代码行数:37,代码来源:StatSystem.cpp


示例12: int32

void Guardian::UpdateDamagePhysical(WeaponAttackType attType)
{
    if (attType > BASE_ATTACK)
        return;

    float bonusDamage = 0.0f;
    if (Unit* owner = GetOwner())
    {
        //force of nature
        if (GetEntry() == 1964)
        {
            int32 spellDmg = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_NATURE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_NATURE);
            if (spellDmg > 0)
                bonusDamage = spellDmg * 0.09f;
        }
        //greater fire elemental
        else if (GetEntry() == 15438)
        {
            if (Unit* shaman = owner->GetOwner())
            {
                int32 spellDmg = int32(shaman->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - shaman->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
                if (spellDmg > 0)
                    bonusDamage = spellDmg * 0.4f;
            }
        }
        // shadowfiend 65.7% per 10 hits so 6.57 per hit
        else if (GetEntry() == 19668)
        {
            if (Unit* owner = GetOwner())
            {
                int32 spellDmg = int32(owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_SHADOW));
                if (spellDmg > 0)
                    bonusDamage = spellDmg * 0.0657f;
            }
        }
    }

    UnitMods unitMod = UNIT_MOD_DAMAGE_MAINHAND;

    float att_speed = float(GetAttackTime(BASE_ATTACK))/1000.0f;

    float base_value  = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType)/ 14.0f * att_speed  + bonusDamage;
    float base_pct    = GetModifierValue(unitMod, BASE_PCT);
    float total_value = GetModifierValue(unitMod, TOTAL_VALUE);
    float total_pct   = GetModifierValue(unitMod, TOTAL_PCT);

    float weapon_mindamage = GetWeaponDamageRange(BASE_ATTACK, MINDAMAGE);
    float weapon_maxdamage = GetWeaponDamageRange(BASE_ATTACK, MAXDAMAGE);

    int32 speed_mod = GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKSPEED);
    base_pct *= 100.0f/(100.0f+float(speed_mod/2));

    float mindamage = ((base_value + weapon_mindamage) * base_pct + total_value) * total_pct;
    float maxdamage = ((base_value + weapon_maxdamage) * base_pct + total_value) * total_pct;

    //  Pet's base damage changes depending on happiness
    if (isHunterPet() && attType == BASE_ATTACK)
    {
        switch (ToPet()->GetHappinessState())
        {
            case HAPPY:
                // 125% of normal damage
                mindamage = mindamage * 1.25f;
                maxdamage = maxdamage * 1.25f;
                break;
            case CONTENT:
                // 100% of normal damage, nothing to modify
                break;
            case UNHAPPY:
                // 75% of normal damage
                mindamage = mindamage * 0.75f;
                maxdamage = maxdamage * 0.75f;
                break;
        }
    }

    SetStatFloatValue(UNIT_FIELD_MINDAMAGE, mindamage);
    SetStatFloatValue(UNIT_FIELD_MAXDAMAGE, maxdamage);
}
开发者ID:morno,项目名称:blizzlikecore,代码行数:79,代码来源:StatSystem.cpp


示例13: getClass

void Player::UpdateDodgePercentage()
{
    // Table for base dodge values
    const int dodge_base[MAX_CLASSES] =
    {
        3, // Warrior
        3, // Paladin
        3, // Hunter
        3, // Rogue
        3, // Priest
        5, // DK
        3, // Shaman
        3, // Mage
        3, // Warlock
        3, // Monk
        5  // Druid
    };
    // Table for dodge cap values
    const float dodge_cap[MAX_CLASSES] =
    {
        90.6425f,       // Warrior
        66.567f,        // Paladin
        145.560408f,    // Hunter
        145.560408f,    // Rogue
        150.375940f,    // Priest
        90.6426f,       // DK
        66.567f,        // Shaman
        150.375940f,    // Mage
        150.375940f,    // Warlock
        501.253f,       // Monk
        150.375940f     // Druid
    };

    float diminishing = 0.0f, nondiminishing = 0.0f;
    uint32 pclass = getClass() - 1;
    // Warriors, Death Knights and Paladins no longer gain dodge from agility
    if (getClass() != CLASS_WARRIOR && getClass() != CLASS_DEATH_KNIGHT && getClass() != CLASS_PALADIN)
    {
        // TODO: research if talents/effects that increase total agility by x% should increase non-diminishing part
        float base_agility = GetCreateStat(STAT_AGILITY) * m_auraModifiersGroup[UNIT_MOD_STAT_START + STAT_AGILITY][BASE_PCT];
        float bonus_agility = GetTotalStatValue(STAT_AGILITY) - base_agility;
        float perc_cap = sObjectMgr->GetDodgeCapForClassLevel(pclass * GT_MAX_LEVEL + getLevel() - 1);

        // calculate diminishing (green in char screen) and non-diminishing (white) contribution
        diminishing = (bonus_agility / perc_cap) / ((bonus_agility / perc_cap) / dodge_cap[pclass] + m_diminishing_k[pclass]);
        nondiminishing = dodge_base[pclass] + base_agility / perc_cap;
    }
    else
        nondiminishing = dodge_base[pclass];

    // Dodge from SPELL_AURA_MOD_DODGE_PERCENT aura
    nondiminishing += GetTotalAuraModifier(SPELL_AURA_MOD_DODGE_PERCENT);
    // Dodge from rating
    diminishing += GetRatingBonusValue(CR_DODGE);
    // apply diminishing formula to diminishing dodge chance
    float value = nondiminishing + diminishing;

    if (sWorld->getBoolConfig(CONFIG_STATS_LIMITS_ENABLE))
        value = value > sWorld->getFloatConfig(CONFIG_STATS_LIMITS_DODGE) ? sWorld->getFloatConfig(CONFIG_STATS_LIMITS_DODGE) : value;

    value = value < 0.0f ? 0.0f : value;
    SetStatFloatValue(PLAYER_DODGE_PERCENTAGE, value);
}
开发者ID:Exodius,项目名称:chuspi,代码行数:63,代码来源:StatSystem.cpp


示例14: UpdateRangedHitChances

void Player::UpdateRangedHitChances()
{
    m_modRangedHitChance = (float)GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
    m_modRangedHitChance += GetRatingBonusValue(CR_HIT_RANGED);
}
开发者ID:AnthoDevMoP,项目名称:SkyFire_5xx,代码行数:5,代码来源:StatSystem.cpp


示例15: float

void Player::UpdateAttackPowerAndDamage(bool ranged)
{
    float val2 = 0.0f;
    float level = float(getLevel());

    ChrClassesEntry const* entry = sChrClassesStore.LookupEntry(getClass());
    UnitMods unitMod = ranged ? UNIT_MOD_ATTACK_POWER_RANGED : UNIT_MOD_ATTACK_POWER;

    uint16 index = UNIT_FIELD_ATTACK_POWER;
    uint16 index_mod_pos = UNIT_FIELD_ATTACK_POWER_MOD_POS;
    uint16 index_mod_neg = UNIT_FIELD_ATTACK_POWER_MOD_NEG;

    if (ranged)
    {
        index = UNIT_FIELD_RANGED_ATTACK_POWER;
        val2 = (level + std::max(GetStat(STAT_AGILITY) - 10.0f, 0.0f)) * entry->RAPPerAgility;

        if (unitMod == UNIT_MOD_ATTACK_POWER_RANGED)
        {
            index_mod_pos = UNIT_FIELD_RANGED_ATTACK_POWER_MOD_POS;
            index_mod_neg = UNIT_FIELD_RANGED_ATTACK_POWER_MOD_NEG;
            val2 += GetTotalAuraModifier(SPELL_AURA_MOD_RANGED_ATTACK_POWER);
        }
    }
    else
    {
        float strengthValue = std::max((GetStat(STAT_STRENGTH) - 10.0f) * entry->APPerStrenth, 0.0f);
        float agilityValue = std::max((GetStat(STAT_AGILITY) - 10.0f) * entry->APPerAgility, 0.0f);

        SpellShapeshiftFormEntry const* form = sSpellShapeshiftFormStore.LookupEntry(GetShapeshiftForm());
        // Directly taken from client, SHAPESHIFT_FLAG_AP_FROM_STRENGTH ?
        if (form && form->flags1 & 0x20)
        {
            agilityValue = std::max((GetStat(STAT_AGILITY) - 10.0f) * 2.0f, 0.0f);
            strengthValue = std::max((GetStat(STAT_STRENGTH) - 10.0f) * 2.0f, 0.0f);
        }

        val2 = strengthValue + agilityValue;
    }

    SetModifierValue(unitMod, BASE_VALUE, val2);

    float base_attPower  = GetModifierValue(unitMod, BASE_VALUE) * GetModifierValue(unitMod, BASE_PCT);
    float attPowerMod_pos = GetModifierValue(unitMod, TOTAL_VALUE);
    float attPowerMod_neg = 0.0f;

    // Check if we have to subcract or increase AP
    if (attPowerMod_pos < 0)
    {    
        attPowerMod_pos = 0;
        attPowerMod_neg = -attPowerMod_pos;
    }

    if (ranged)
    {
        attPowerMod_pos = 0.0f;
        attPowerMod_neg = 0.0f;
    }

    // Check this
    base_attPower *= GetModifierValue(unitMod, TOTAL_PCT);

    //add dynamic flat mods
    if (!ranged)
    {
        AuraEffectList const& mAPbyArmor = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR);
        for (AuraEffectList::const_iterator iter = mAPbyArmor.begin(); iter != mAPbyArmor.end(); ++iter)
        {
            // always: ((*i)->GetModifier()->m_miscvalue == 1 == SPELL_SCHOOL_MASK_NORMAL)

            int32 temp = int32(GetArmor() / (*iter)->GetAmount());
            if (temp > 0)
                attPowerMod_pos += temp;
            else
                attPowerMod_neg -= temp;
        }
    }

    SetInt32Value(index, (uint32)base_attPower);                //UNIT_FIELD_(RANGED)_ATTACK_POWER field
    SetInt32Value(index_mod_pos, (uint32) attPowerMod_pos);     //UNIT_FIELD_(RANGED)_ATTACK_POWER_MOD_POS field
    SetInt32Value(index_mod_neg, (uint32) attPowerMod_neg);     //UNIT_FIELD_(RANGED)_ATTACK_POWER_MOD_NEG field

    Pet* pet = GetPet();                                //update pet's AP
    Guardian* guardian = GetGuardianPet();
    //automatically update weapon damage after attack power modification
    if (ranged)
    {
        UpdateDamagePhysical(RANGED_ATTACK);
        if (pet && pet->isHunterPet()) // At ranged attack change for hunter pet
            pet->UpdateAttackPowerAndDamage();
    }
    else
    {
        UpdateDamagePhysical(BASE_ATTACK);
        if (CanDualWield() && haveOffhandWeapon())           //allow update offhand damage only if player knows DualWield Spec and has equipped offhand weapon
            UpdateDamagePhysical(OFF_ATTACK);
        if (getClass() == CLASS_SHAMAN || getClass() == CLASS_PALADIN)                      // mental quickness
            UpdateSpellDamageAndHealingBonus();

        if (pet && pet->IsPetGhoul()) // At melee attack power change for DK pet
//.........这里部分代码省略.........
开发者ID:Jildor,项目名称:4.3.4-Core,代码行数:101,代码来源:StatSystem.cpp


示例16: UpdateMeleeHitChances

void Player::UpdateMeleeHitChances()
{
    m_modMeleeHitChance = (float)GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
    m_modMeleeHitChance += GetRatingBonusValue(CR_HIT_MELEE);
}
开发者ID:AnthoDevMoP,项目名称:SkyFire_5xx,代码行数:5,代码来源:StatSystem.cpp


示例17: GetRatingBonusValue

void Player::UpdateRangedHitChances()
{
    m_modRangedHitChance = (float)GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
    m_modRangedHitChance += GetRatingBonusValue(CR_HIT_RANGED);
    SetFloatValue(PLAYER_FIELD_UI_HIT_MODIFIER, (float)GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE));
}
开发者ID:xIchigox,项目名称:SoDCore.434,代码行数:6,代码来源:StatSystem.cpp


示例18: UpdateSpellHitChances

void Player::UpdateSpellHitChances()
{
    m_modSpellHitChance = (float)GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
    m_modSpellHitChance += GetRatingBonusValue(CR_HIT_SPELL);
}
开发者ID:AnthoDevMoP,项目名称:SkyFire_5xx,代码行数:5,代码来源:StatSystem.cpp



注:本文中的GetTotalAuraModifier函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetTotalAuraMultiplierByMiscValue函数代码示例发布时间:2022-05-30
下一篇:
C++ GetTotalAuraModValue函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap