本文整理匯總了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);
}
示例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();
}
示例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);
}
}
示例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
}
示例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);
}
示例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);
}
}
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
}
示例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);
}
}
}
示例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());
}
}