當前位置: 首頁>>代碼示例>>C++>>正文


C++ AddPct函數代碼示例

本文整理匯總了C++中AddPct函數的典型用法代碼示例。如果您正苦於以下問題:C++ AddPct函數的具體用法?C++ AddPct怎麽用?C++ AddPct使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了AddPct函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: int32

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

    float bonusDamage = 0.0f;
    if (m_owner->GetTypeId() == TYPEID_PLAYER)
    {
        //force of nature
        if (GetEntry() == ENTRY_TREANT)
        {
            int32 spellDmg = int32(m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_NATURE)) + m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_NATURE);
            if (spellDmg > 0)
                bonusDamage = spellDmg * 0.09f;
        }
        //greater fire elemental
        else if (GetEntry() == ENTRY_FIRE_ELEMENTAL)
        {
            int32 spellDmg = int32(m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) + m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
            if (spellDmg > 0)
                bonusDamage = spellDmg * 0.4f;
        }
    }

    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);

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

    /// @todo: remove this
    Unit::AuraEffectList const& mDummy = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACKSPEED);
    for (Unit::AuraEffectList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr)
    {
        switch ((*itr)->GetSpellInfo()->Id)
        {
        case 61682:
        case 61683:
            AddPct(mindamage, -(*itr)->GetAmount());
            AddPct(maxdamage, -(*itr)->GetAmount());
            break;
        default:
            break;
        }
    }

    SetStatFloatValue(UNIT_FIELD_MINDAMAGE, mindamage);
    SetStatFloatValue(UNIT_FIELD_MAXDAMAGE, maxdamage);
}
開發者ID:TrueWoW,項目名稱:TrinityCore,代碼行數:58,代碼來源:StatSystem.cpp

示例2: AddPct

void FlightPathMovementGenerator::DoReset(Player* owner)
{
    if (!owner)
        return;

    if (!owner->isAlive())
        return;

    float playerFlightSpeed = 32.0f;

    // Add percentage from SPELL_AURA_MOD_TAXI_FLIGHT_SPEED.
    Unit::AuraEffectList const& mIncreaseTaxiFlightSpeed = owner->GetAuraEffectsByType(SPELL_AURA_MOD_TAXI_FLIGHT_SPEED);
    for (Unit::AuraEffectList::const_iterator i = mIncreaseTaxiFlightSpeed.begin(); i != mIncreaseTaxiFlightSpeed.end(); ++i)
        AddPct(playerFlightSpeed, (*i)->GetAmount());

    owner->getHostileRefManager().setOnlineOfflineState(false);
    owner->AddUnitState(UNIT_STATE_IN_FLIGHT);
    owner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);

    Movement::MoveSplineInit init(*owner);
    uint32 end = GetPathAtMapEnd();
    for (uint32 i = GetCurrentNode(); i != end; ++i)
    {
        G3D::Vector3 vertice((*i_path)[i].x, (*i_path)[i].y, (*i_path)[i].z);
        init.Path().push_back(vertice);
    }
    init.SetFirstPointId(GetCurrentNode());
    init.SetFly();
    init.SetSmooth();
    init.SetWalk(true);
    init.SetVelocity(playerFlightSpeed);
    init.Launch();
}
開發者ID:concept45,項目名稱:Core,代碼行數:33,代碼來源:WaypointMovementGenerator.cpp

示例3: CalculateAmount

            void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& canBeRecalculated)
            {
                canBeRecalculated = false;
                if (Unit* caster = GetCaster())
                {
                    // +87% from sp bonus
                    float bonus = 0.87f;

                    // Borrowed Time
                    if (AuraEffect const* borrowedTime = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, PRIEST_ICON_ID_BORROWED_TIME, EFFECT_1))
                        bonus += CalculatePct(1.0f, borrowedTime->GetAmount());

                    bonus *= caster->SpellBaseHealingBonusDone(GetSpellInfo()->GetSchoolMask());

                    // Improved PW: Shield: its weird having a SPELLMOD_ALL_EFFECTS here but its blizzards doing :)
                    // Improved PW: Shield is only applied at the spell healing bonus because it was already applied to the base value in CalculateSpellDamage
                    bonus = caster->ApplyEffectModifiers(GetSpellInfo(), aurEff->GetEffIndex(), bonus);
                    bonus *= caster->CalculateLevelPenalty(GetSpellInfo());

                    amount += int32(bonus);

                    // Twin Disciplines
                    if (AuraEffect const* twinDisciplines = caster->GetAuraEffectOfRankedSpell(SPELL_PRIEST_TWIN_DISCIPLINES_RANK_1, EFFECT_1))
                        AddPct(amount, twinDisciplines->GetAmount());

                    // Mastery: Shield Discipline
                    if (caster->HasAura(77484))
                        amount += caster->ToPlayer()->GetAura(77484)->GetEffect(0)->GetAmount() * amount / 100;

                    // Focused Power
                    amount *= caster->GetTotalAuraMultiplier(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
                }
            }
開發者ID:DSlayerMan,項目名稱:ArkCORE-NG,代碼行數:33,代碼來源:spell_priest.cpp

示例4: GetModifierValue

void Player::UpdateArmor()
{
    UnitMods unitMod = UNIT_MOD_ARMOR;

    float value = GetModifierValue(unitMod, BASE_VALUE);    // base armor (from items)
    value *= GetModifierValue(unitMod, BASE_PCT);           // armor percent from items
    value += GetModifierValue(unitMod, TOTAL_VALUE);

    //add dynamic flat mods
    AuraEffectList const& mResbyIntellect = GetAuraEffectsByType(SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT);
    for (AuraEffectList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i)
    {
        if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
            value += CalculatePct(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount());
    }

    if (GetShapeshiftForm() == FORM_BEAR)
        // Thick Hide
        if (AuraEffect* thickHide = GetDummyAuraEffect(SPELLFAMILY_GENERIC, 1558, EFFECT_1))
            AddPct(value, thickHide->GetAmount());

    value *= GetModifierValue(unitMod, TOTAL_PCT);
    SetArmor(int32(value));
    RecalculatePetsScalingResistance(SPELL_SCHOOL_NORMAL);
    UpdateAttackPowerAndDamage();                           // armor dependent auras update for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
}
開發者ID:Cryostorm,項目名稱:InfinityCore,代碼行數:26,代碼來源:StatSystem.cpp

示例5: HandleHit

        void HandleHit()
        {
            Player* const caster = GetCaster()->ToPlayer();
            Unit* const target = GetHitUnit();
            if (!target)
                return;

            int32 value = GetHitDamage();
            uint8 const cp = caster->GetComboPoints();
            float const ap = caster->GetTotalAttackPowerValue(BASE_ATTACK);

            value += int32(ap * cp * 0.091f);

            // Eviscerate and Envenom Bonus Damage
            if (AuraEffect const* const aurEff = caster->GetAuraEffect(SPELL_EVISCERATE_BONUS, EFFECT_0))
                value += cp * aurEff->GetAmount();

            // Revealing Strike
            if (AuraEffect const* const aurEff = target->GetAuraEffect(SPELL_REVEALING_STRIKE, EFFECT_2))
                AddPct(value, aurEff->GetAmount());

            // Serrated Blades
            if (AuraEffect const* const aurEff = caster->GetAuraEffectOfRankedSpell(SPELL_SERRATED_BLADES, EFFECT_0))
                if (roll_chance_i(aurEff->GetAmount() * cp))
                    if (Aura* const aura = target->GetAura(SPELL_RUPTURE, caster->GetGUID()))
                        aura->RefreshDuration();

            SetHitDamage(value);
        }
開發者ID:Tithand,項目名稱:TER-Server,代碼行數:29,代碼來源:spell_rogue.cpp

示例6: HandleAfterHit

            void HandleAfterHit()
            {
                if (Player* _plr = GetCaster()->ToPlayer())
                {
                    if (Unit* target = GetHitUnit())
                    {
                        if (_plr->GetTypeId() == TYPEID_PLAYER && _plr->HasAura(77513) && _plr->getLevel() >= 80)
                        {
                            // Check the Mastery aura while in Blood presence
                            if (_plr->HasAura(77513) && _plr->HasAura(48263))
                            {
								float Mastery = _plr->GetFloatValue(PLAYER_MASTERY) * 6.25f / 100.0f;

                                int32 bp = -int32(GetHitDamage() * Mastery);

                                if (Aura* scentOfBlood = _plr->GetAura(SPELL_DK_SCENT_OF_BLOOD))
                                    AddPct(bp, (scentOfBlood->GetStackAmount() * 20));

                                if (AuraEffect* bloodShield = target->GetAuraEffect(MASTERY_SPELL_BLOOD_SHIELD, EFFECT_0))
                                    bp += bloodShield->GetAmount();

                                bp = std::min(uint32(bp), target->GetMaxHealth());

                                _plr->CastCustomSpell(target, MASTERY_SPELL_BLOOD_SHIELD, &bp, NULL, NULL, true);
                            }
                        }
                    }
                }
            }
開發者ID:Rastrian,項目名稱:DeathCore_6.x-1,代碼行數:29,代碼來源:spell_mastery.cpp

示例7: HandleDummy

            void HandleDummy(SpellEffIndex /*effIndex*/)
            {
                Player* caster = GetCaster()->ToPlayer();
                if (Unit* target = GetHitUnit())
                {
                    int32 damage = GetEffectValue();
                    int32 mana = int32(damage + (caster->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+SPELL_SCHOOL_SHADOW) * 0.5f));

                    // Shouldn't Appear in Combat Log
                    target->ModifyHealth(-damage);

                    // Improved Life Tap mod
                    if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, WARLOCK_ICON_ID_IMPROVED_LIFE_TAP, 0))
                        AddPct(mana, aurEff->GetAmount());

                    caster->CastCustomSpell(target, SPELL_WARLOCK_LIFE_TAP_ENERGIZE, &mana, NULL, NULL, false);

                    // Mana Feed
                    int32 manaFeedVal = 0;
                    if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARLOCK, WARLOCK_ICON_ID_MANA_FEED, 0))
                        manaFeedVal = aurEff->GetAmount();

                    if (manaFeedVal > 0)
                    {
                        ApplyPct(manaFeedVal, mana);
                        caster->CastCustomSpell(caster, SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2, &manaFeedVal, NULL, NULL, true, NULL);
                    }
                }
            }
開發者ID:InkVisible,項目名稱:EscapeWoW3.3.5a,代碼行數:29,代碼來源:spell_warlock.cpp

示例8: xp

inline void KillRewarder::_RewardXP(Player* player, float rate)
{
    uint32 xp(_xp);
    if (_group)
    {
        // 4.2.1. If player is in group, adjust XP:
        //        * set to 0 if player's level is more than maximum level of not gray member;
        //        * cut XP in half if _isFullXP is false.
        if (_maxNotGrayMember && player->IsAlive() &&
            _maxNotGrayMember->getLevel() >= player->getLevel())
            xp = _isFullXP ?
            uint32(xp * rate) :             // Reward FULL XP if all group members are not gray.
            uint32(xp * rate / 2) + 1;      // Reward only HALF of XP if some of group members are gray.
        else
            xp = 0;
    }
    if (xp)
    {
        // 4.2.2. Apply auras modifying rewarded XP (SPELL_AURA_MOD_XP_PCT).
        for (auto const& aura : player->GetAuraEffectsByType(SPELL_AURA_MOD_XP_PCT))
            AddPct(xp, aura->GetAmount());

        // 4.2.3. Give XP to player.
        player->GiveXP(xp, _victim, _groupRate);
        if (Pet* pet = player->GetPet())
            // 4.2.4. If player has pet, reward pet with XP (100% for single player, 50% for group case).
            pet->GivePetXP(_group ? xp / 2 : xp);
    }
}
開發者ID:boom8866,項目名稱:MaddieCore,代碼行數:29,代碼來源:KillRewarder.cpp

示例9: HandleDummy

            void HandleDummy(SpellEffIndex /*effIndex*/)
            {
                Player* caster = GetCaster()->ToPlayer();
                if (Unit* target = GetHitUnit())
                {
                    int32 damage = caster->CountPctFromMaxHealth(GetSpellInfo()->Effects[EFFECT_2].CalcValue());
                    int32 mana = CalculatePct(damage, GetSpellInfo()->Effects[EFFECT_1].CalcValue());

                    // Shouldn't Appear in Combat Log
                    target->ModifyHealth(-damage);

                    // Improved Life Tap mod
                    if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, WARLOCK_ICON_ID_IMPROVED_LIFE_TAP, 0))
                        AddPct(mana, aurEff->GetAmount());

                    caster->CastCustomSpell(target, SPELL_WARLOCK_LIFE_TAP_ENERGIZE, &mana, NULL, NULL, false);

                    // Mana Feed
                    if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARLOCK, WARLOCK_ICON_ID_MANA_FEED, 0))
                    {
                        int32 manaFeedVal = aurEff->GetAmount();
                        ApplyPct(manaFeedVal, mana);
                        caster->CastCustomSpell(caster, SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2, &manaFeedVal, NULL, NULL, true, NULL);
                    }
                }
            }
開發者ID:PavelDev,項目名稱:wodnetcore,代碼行數:26,代碼來源:spell_warlock.cpp

示例10: HandleDamage

            void HandleDamage()
            {
                int32 damage = GetHitDamage();

                // Pain and Suffering reduces damage
                if (AuraEffect* aurEff = GetCaster()->GetDummyAuraEffect(SPELLFAMILY_PRIEST, PRIEST_ICON_ID_PAIN_AND_SUFFERING, EFFECT_1))
                    AddPct(damage, aurEff->GetAmount());

                GetCaster()->CastCustomSpell(GetCaster(), SPELL_PRIEST_SHADOW_WORD_DEATH, &damage, 0, 0, true);
            }
開發者ID:Stylerdk,項目名稱:TrinityCore,代碼行數:10,代碼來源:spell_priest.cpp

示例11: OnProc

            void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
            {
                PreventDefaultAction();

                int32 amount = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount()));
                // Glyph of Siphon Life
                if (AuraEffect const* glyph = GetTarget()->GetAuraEffect(SPELL_WARLOCK_GLYPH_OF_SIPHON_LIFE, EFFECT_0))
                    AddPct(amount, glyph->GetAmount());

                GetTarget()->CastCustomSpell(SPELL_WARLOCK_SIPHON_LIFE_HEAL, SPELLVALUE_BASE_POINT0, amount, GetTarget(), true, NULL, aurEff);
            }
開發者ID:InkVisible,項目名稱:EscapeWoW3.3.5a,代碼行數:11,代碼來源:spell_warlock.cpp

示例12: AddPct

void HostileReference::addThreatPercent(int32 percent)
{
    // Xinef: Do not allow to modify threat by percent if threat is negative (forced to big value < 0 by spells adding temporary threat)
    // Xinef: When the temporary effect ends, temporary threat is added back which results in huge additional amount of threat
    if (iThreat <= 0)
        return;

    float tmpThreat = iThreat;
    AddPct(tmpThreat, percent);
    addThreat(tmpThreat - iThreat);
}
開發者ID:Helias,項目名稱:azerothcore-wotlk,代碼行數:11,代碼來源:ThreatManager.cpp

示例13: HandleDummy

 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     Unit* caster = GetCaster();
     if (Unit* unitTarget = GetHitUnit())
     {
         multiplier = (GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()) / 100.f);
         // Death Knight T8 Melee 4P Bonus
         if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_ITEM_T8_MELEE_4P_BONUS, EFFECT_0))
             AddPct(multiplier, aurEff->GetAmount());
     }
 }
開發者ID:AlucardVoss,項目名稱:Patchs,代碼行數:11,代碼來源:spell_dk.cpp

示例14: HandleHeal

 void HandleHeal(SpellEffIndex /*effIndex*/)
 {
     if (Unit* caster = GetOriginalCaster())
     {
         if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_PRIEST_T9_HEALING_2P, EFFECT_0))
         {
             int32 heal = GetHitHeal();
             AddPct(heal, aurEff->GetAmount());
             SetHitHeal(heal);
         }
     }
 }
開發者ID:Stylerdk,項目名稱:TrinityCore,代碼行數:12,代碼來源:spell_priest.cpp

示例15: CalculateAmount

        void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
        {
            if (Unit* caster = GetCaster())
            {
                // +75.00% from sp bonus
                float bonus = CalculatePct(caster->SpellBaseHealingBonusDone(GetSpellInfo()->GetSchoolMask()), 75.0f);

                // Divine Guardian is only applied at the spell healing bonus because it was already applied to the base value in CalculateSpellDamage
                bonus = caster->ApplyEffectModifiers(GetSpellInfo(), aurEff->GetEffIndex(), bonus);
                bonus *= caster->CalculateLevelPenalty(GetSpellInfo());

                amount += int32(bonus);

                // Arena - Dampening
                if (AuraEffect const* auraEffArenaDampening = caster->GetAuraEffect(SPELL_GENERIC_ARENA_DAMPENING, EFFECT_0))
                    AddPct(amount, auraEffArenaDampening->GetAmount());
                // Battleground - Dampening
                else if (AuraEffect const* auraEffBattlegroudDampening = caster->GetAuraEffect(SPELL_GENERIC_BATTLEGROUND_DAMPENING, EFFECT_0))
                    AddPct(amount, auraEffBattlegroudDampening->GetAmount());
            }
        }
開發者ID:mynew3,項目名稱:LordPsyanBots,代碼行數:21,代碼來源:spell_paladin.cpp


注:本文中的AddPct函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。