本文整理汇总了C++中GetUnitOwner函数的典型用法代码示例。如果您正苦于以下问题:C++ GetUnitOwner函数的具体用法?C++ GetUnitOwner怎么用?C++ GetUnitOwner使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetUnitOwner函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandlePeriodic
void HandlePeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (aurEff->GetAmount() <= 0)
{
Unit* target = GetTarget();
uint32 spellId = SPELL_HUNTER_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_HUNTER_SNIPER_TRAINING_R1;
target->CastSpell(target, spellId, true, 0, aurEff);
if (Player* playerTarget = GetUnitOwner()->ToPlayer())
{
int32 baseAmount = aurEff->GetBaseAmount();
int32 amount = playerTarget->CalculateSpellDamage(playerTarget, GetSpellInfo(), aurEff->GetEffIndex(), &baseAmount);
GetEffect(EFFECT_0)->SetAmount(amount);
}
}
}
示例2: CalculateDamageDoneAmount
void CalculateDamageDoneAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* pet = GetUnitOwner())
if (pet->IsPet())
if (Unit* owner = pet->ToPet()->GetOwner())
{
//the damage bonus used for pets is either fire or shadow damage, whatever is higher
int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
int32 maximum = (fire > shadow) ? fire : shadow;
float bonusDamage = 0.0f;
if (maximum > 0)
bonusDamage = maximum * 0.15f;
amount += bonusDamage;
}
}
示例3: CalculateAmountExpertise
void CalculateAmountExpertise(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
{
if (Pet* pPet = GetUnitOwner()->ToPet())
{
if (pPet->GetOwnerScaling())
{
float bonus = 0.0f;
float hitchance = std::max(pPet->GetOwnerScaling()->CalculateScaling(STAT_IDENTIFIER_COMBAT_RATING, CR_HIT_MELEE, pPet->GetOwnerCombatRating(CR_HIT_MELEE)),
pPet->GetOwnerScaling()->CalculateScaling(STAT_IDENTIFIER_COMBAT_RATING, CR_HIT_SPELL, pPet->GetOwnerCombatRating(CR_HIT_SPELL)));
// Expertise should be at max if player has hit cap
if (hitchance >= PetSpellHitCapPct)
bonus = pPet->GetOwnerScaling()->CalculateScaling(STAT_IDENTIFIER_COMBAT_RATING, CR_EXPERTISE, 60.0f);
else
bonus = pPet->GetOwnerScaling()->CalculateScaling(STAT_IDENTIFIER_COMBAT_RATING, CR_EXPERTISE, pPet->GetOwnerCombatRating(CR_EXPERTISE));
amount += int32(bonus);
}
}
}
示例4: CalculateAmount
void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& canBeRecalculated)
{
if (Unit* caster = GetCaster())
{
canBeRecalculated = false;
// $0.2 * (($MWB + $mwb) / 2 + $AP / 14 * $MWS) bonus per tick
float ap = caster->GetTotalAttackPowerValue(BASE_ATTACK);
int32 mws = caster->GetAttackTime(BASE_ATTACK);
float mwbMin = caster->GetWeaponDamageRange(BASE_ATTACK, MINDAMAGE);
float mwbMax = caster->GetWeaponDamageRange(BASE_ATTACK, MAXDAMAGE);
float mwb = ((mwbMin + mwbMax) / 2 + ap * mws / 14000) * 0.2f;
amount += int32(caster->ApplyEffectModifiers(GetSpellInfo(), aurEff->GetEffIndex(), mwb));
// "If used while your target is above 75% health, Rend does 35% more damage."
// as for 3.1.3 only ranks above 9 (wrong tooltip?)
if (GetSpellInfo()->GetRank() >= 9)
{
if (GetUnitOwner()->HasAuraState(AURA_STATE_HEALTH_ABOVE_75_PERCENT, GetSpellInfo(), caster))
AddPct(amount, GetSpellInfo()->Effects[EFFECT_2].CalcValue(caster));
}
}
}
示例5: CalculateStrengthAmount
void CalculateStrengthAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
{
if (Guardian* pPet = GetUnitOwner()->ToGuardian())
{
if (Player* pPlayerOwner = pPet->GetOwner()->ToPlayer())
{
float add = 0.0f;
float bonusStr = 0.0f;
if (Aura* pAura = pPlayerOwner->GetAuraOfRankedSpell(TALENT_DK_RAVENOUS_DEAD))
add += pAura->GetSpellInfo()->Effects[EFFECT_1].BasePoints;
if (const AuraEffect* pAuraEffect = pPlayerOwner->GetAuraEffect(GLYPH_DK_GLYPH_OF_GHOUL, EFFECT_0))
add += pAuraEffect->GetAmount();
if (pPet->GetOwnerScaling())
bonusStr = pPet->GetOwnerScaling()->CalculateScaling(STAT_IDENTIFIER_UNIT_MOD, UNIT_MOD_STAT_STRENGTH,
pPet->GetOwnerStat(STAT_STRENGTH), add);
amount += int32(bonusStr);
}
}
}
示例6: HandleDispel
void HandleDispel(DispelInfo* dispelInfo)
{
if (Unit* target = GetUnitOwner())
{
if (AuraEffect const* aurEff = GetEffect(EFFECT_1))
{
// final heal
int32 healAmount = aurEff->GetAmount();
if (Unit* caster = GetCaster())
{
healAmount = caster->SpellHealingBonusDone(target, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges());
healAmount = target->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges());
target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID());
// restore mana
int32 returnMana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2;
caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, NULL, GetCasterGUID());
return;
}
target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID());
}
}
}
示例7: CalculateAmount
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
amount = GetUnitOwner()->CountPctFromMaxHealth(amount);
}
示例8: Load
bool Load()
{
absorbChance = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_0);
return GetUnitOwner()->ToPlayer();
}
示例9: Load
bool Load()
{
healPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_1);
absorbPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_0);
return GetUnitOwner()->ToPlayer();
}
示例10: OnApply
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
// Remove all auras with spell id 46221, except the one currently being applied
while (Aura* aur = GetUnitOwner()->GetOwnedAura(SPELL_ANIMAL_BLOOD, 0, 0, 0, GetAura()))
GetUnitOwner()->RemoveOwnedAura(aur);
}
示例11: HandlePeriodic
void HandlePeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL1, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL2), true);
}
示例12: CalculateAmount
void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
{
amount = CalculatePct(int32(GetUnitOwner()->GetCreatePowers(POWER_MANA) / aurEff->GetTotalTicks()), amount);
}
示例13: Absorb
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & /*absorbAmount*/)
{
if (Unit* owner = GetUnitOwner())
{
if (dmgInfo.GetSpellInfo())
{
if (uint32 poweringUp = sSpellMgr->GetSpellIdForDifficulty(SPELL_POWERING_UP, owner))
{
if (urand(0, 99) < 5)
GetTarget()->CastSpell(GetTarget(), spellId, true);
// Twin Vortex part
uint32 lightVortex = sSpellMgr->GetSpellIdForDifficulty(SPELL_LIGHT_VORTEX_DAMAGE, owner);
uint32 darkVortex = sSpellMgr->GetSpellIdForDifficulty(SPELL_DARK_VORTEX_DAMAGE, owner);
int32 stacksCount = int32(dmgInfo.GetSpellInfo()->Effects[EFFECT_0].CalcValue()) * 0.001 - 1;
if (lightVortex && darkVortex && stacksCount)
{
if (dmgInfo.GetSpellInfo()->Id == darkVortex || dmgInfo.GetSpellInfo()->Id == lightVortex)
{
Aura* pAura = owner->GetAura(poweringUp);
if (pAura)
{
pAura->ModStackAmount(stacksCount);
owner->CastSpell(owner, poweringUp, true);
}
else
{
owner->CastSpell(owner, poweringUp, true);
if (Aura* pTemp = owner->GetAura(poweringUp))
pTemp->ModStackAmount(stacksCount);
}
}
}
// Picking floating balls
uint32 unleashedDark = sSpellMgr->GetSpellIdForDifficulty(SPELL_UNLEASHED_DARK, owner);
uint32 unleashedLight = sSpellMgr->GetSpellIdForDifficulty(SPELL_UNLEASHED_LIGHT, owner);
if (unleashedDark && unleashedLight)
{
if (dmgInfo.GetSpellInfo()->Id == unleashedDark || dmgInfo.GetSpellInfo()->Id == unleashedLight)
{
// need to do the things in this order, else players might have 100 charges of Powering Up without anything happening
Aura* pAura = owner->GetAura(poweringUp);
if (pAura)
{
// 2 lines together add the correct amount of buff stacks
pAura->ModStackAmount(stacksCount);
owner->CastSpell(owner, poweringUp, true);
}
else
{
owner->CastSpell(owner, poweringUp, true);
if (Aura* pTemp = owner->GetAura(poweringUp))
pTemp->ModStackAmount(stacksCount);
}
}
}
}
}
}
}
示例14: OnRemove
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (GetUnitOwner()->GetAuraCount(GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell) == 5)
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_STONED, true);
}
示例15: Load
bool Load()
{
healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER;
}