aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Unit.cpp101
1 files changed, 48 insertions, 53 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 35f7cfd1555..28a82e4cd8a 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -9908,7 +9908,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
bool scripted = false;
- for (uint8 i=0; i<MAX_SPELL_EFFECTS; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
switch (spellProto->EffectApplyAuraName[i])
{
@@ -9973,7 +9973,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
// Default calculation
if (DoneAdvertisedBenefit || TakenAdvertisedBenefit)
{
- if((!bonus && !scripted) || coeff < 0)
+ if ((!bonus && !scripted) || coeff < 0)
{
// Damage Done from spell damage bonus
int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto);
@@ -9990,9 +9990,9 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
uint32 x = 0;
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; j++)
{
- if( spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && (
+ if (spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && (
spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE ||
- spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH) )
+ spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH))
{
x = j;
break;
@@ -10056,8 +10056,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[0] & 0x40)
{
// Search for Healing Way on Victim
- AuraEffect const* HealingWay = pVictim->GetAuraEffect(29203, 0);
- if (HealingWay)
+ if (AuraEffect const* HealingWay = pVictim->GetAuraEffect(29203, 0))
TakenTotalMod *= (HealingWay->GetAmount() + 100.0f) / 100.0f;
}
@@ -13545,7 +13544,7 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id)
bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *& spellProcEvent )
{
- SpellEntry const* spellProto = aura->GetSpellProto ();
+ SpellEntry const *spellProto = aura->GetSpellProto();
// Get proc Event Entry
spellProcEvent = spellmgr.GetSpellProcEvent(spellProto->Id);
@@ -13568,7 +13567,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellEntry co
}
// Check spellProcEvent data requirements
- if(!spellmgr.IsSpellProcEventCanTriggeredBy(spellProcEvent, EventProcFlag, procSpell, procFlag, procExtra, active))
+ if (!spellmgr.IsSpellProcEventCanTriggeredBy(spellProcEvent, EventProcFlag, procSpell, procFlag, procExtra, active))
return false;
// In most cases req get honor or XP from kill
if (EventProcFlag & PROC_FLAG_KILL && GetTypeId() == TYPEID_PLAYER)
@@ -13582,17 +13581,17 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellEntry co
}
// Aura added by spell can`t trigger from self (prevent drop charges/do triggers)
// But except periodic and kill triggers (can triggered from self)
- if(procSpell && procSpell->Id == spellProto->Id
+ if (procSpell && procSpell->Id == spellProto->Id
&& !(spellProto->procFlags&(PROC_FLAG_ON_TAKE_PERIODIC | PROC_FLAG_KILL)))
return false;
// Check if current equipment allows aura to proc
- if(!isVictim && GetTypeId() == TYPEID_PLAYER)
+ if (!isVictim && GetTypeId() == TYPEID_PLAYER)
{
- if(spellProto->EquippedItemClass == ITEM_CLASS_WEAPON)
+ if (spellProto->EquippedItemClass == ITEM_CLASS_WEAPON)
{
Item *item = NULL;
- if(attType == BASE_ATTACK)
+ if (attType == BASE_ATTACK)
item = ((Player*)this)->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
else if (attType == OFF_ATTACK)
item = ((Player*)this)->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
@@ -13602,10 +13601,10 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellEntry co
if (((Player*)this)->IsInFeralForm())
return false;
- if(!item || item->IsBroken() || item->GetProto()->Class != ITEM_CLASS_WEAPON || !((1<<item->GetProto()->SubClass) & spellProto->EquippedItemSubClassMask))
+ if (!item || item->IsBroken() || item->GetProto()->Class != ITEM_CLASS_WEAPON || !((1<<item->GetProto()->SubClass) & spellProto->EquippedItemSubClassMask))
return false;
}
- else if(spellProto->EquippedItemClass == ITEM_CLASS_ARMOR)
+ else if (spellProto->EquippedItemClass == ITEM_CLASS_ARMOR)
{
// Check if player is wearing shield
Item *item = ((Player*)this)->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
@@ -13614,14 +13613,14 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellEntry co
}
}
// Get chance from spell
- float chance = (float)spellProto->procChance;
+ float chance = float(spellProto->procChance);
// If in spellProcEvent exist custom chance, chance = spellProcEvent->customChance;
- if(spellProcEvent && spellProcEvent->customChance)
+ if (spellProcEvent && spellProcEvent->customChance)
chance = spellProcEvent->customChance;
// If PPM exist calculate chance from PPM
- if(spellProcEvent && spellProcEvent->ppmRate != 0)
+ if (spellProcEvent && spellProcEvent->ppmRate != 0)
{
- if(!isVictim)
+ if (!isVictim)
{
uint32 WeaponSpeed = GetAttackTime(attType);
chance = GetPPMProcChance(WeaponSpeed, spellProcEvent->ppmRate, spellProto);
@@ -13640,10 +13639,10 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellEntry co
return roll_chance_f(chance);
}
-bool Unit::HandleAuraRaidProcFromChargeWithValue( AuraEffect* triggeredByAura )
+bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect *triggeredByAura)
{
// aura can be deleted at casts
- SpellEntry const* spellProto = triggeredByAura->GetSpellProto();
+ SpellEntry const *spellProto = triggeredByAura->GetSpellProto();
uint32 effIdx = triggeredByAura->GetEffIndex();
int32 heal = triggeredByAura->GetAmount();
uint64 caster_guid = triggeredByAura->GetCasterGUID();
@@ -13655,7 +13654,7 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue( AuraEffect* triggeredByAura )
triggeredByAura->GetParentAura()->SetAuraCharges(1); // will removed at next charges decrease
// next target selection
- if(jumps > 0 && IS_PLAYER_GUID(caster_guid))
+ if (jumps > 0 && IS_PLAYER_GUID(caster_guid))
{
float radius;
if (spellProto->EffectRadiusIndex[effIdx])
@@ -13663,56 +13662,52 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue( AuraEffect* triggeredByAura )
else
radius = GetSpellMaxRangeForTarget(triggeredByAura->GetCaster(), sSpellRangeStore.LookupEntry(spellProto->rangeIndex));
- if(Player* caster = ((Player*)triggeredByAura->GetCaster()))
+ if(Player *caster = (Player*)triggeredByAura->GetCaster())
{
- caster->ApplySpellMod(spellProto->Id, SPELLMOD_RADIUS, radius,NULL);
- heal = caster->SpellHealingBonus(this, spellProto, heal, HEAL);
+ caster->ApplySpellMod(spellProto->Id, SPELLMOD_RADIUS, radius, NULL);
- if(Player *target = ((Player*)this)->GetNextRandomRaidMember(radius))
+ if (Unit *target = GetNextRandomRaidMemberOrPet(radius))
{
- // aura will applied from caster, but spell casted from current aura holder
- SpellModifier *mod = new SpellModifier;
- mod->op = SPELLMOD_CHARGES;
- mod->value = jumps-5; // negative
- mod->type = SPELLMOD_FLAT;
- mod->spellId = spellProto->Id;
- mod->mask = spellProto->SpellFamilyFlags;
- mod->charges = 0;
-
- caster->AddSpellMod(mod, true);
- CastCustomSpell(target,spellProto->Id,&heal,NULL,NULL,true,NULL,triggeredByAura,caster->GetGUID());
- caster->AddSpellMod(mod, false);
-
+ CastCustomSpell(target, spellProto->Id, &heal, NULL, NULL, true, NULL, triggeredByAura, caster->GetGUID());
+ if (Aura *aur = target->GetAura(spellProto->Id, caster->GetGUID()))
+ aur->SetAuraCharges(jumps);
heal = caster->SpellHealingBonus(this, spellProto, heal, HEAL);
}
}
}
// heal
- CastCustomSpell(this,33110,&heal,NULL,NULL,true,NULL,NULL,caster_guid);
+ CastCustomSpell(this, 33110, &heal, NULL, NULL, true, NULL, NULL, caster_guid);
return true;
}
-bool Unit::HandleAuraRaidProcFromCharge( AuraEffect* triggeredByAura )
+bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura)
{
// aura can be deleted at casts
SpellEntry const* spellProto = triggeredByAura->GetSpellProto();
uint32 damageSpellId;
- switch(spellProto->Id)
+ switch (spellProto->Id)
{
- case 57949: //shiver
- damageSpellId=57952;
-// animationSpellId=57951; dummy effects for jump spell have unknown use (see also 41637)
- break;
- case 59978: //shiver
- damageSpellId=59979;
- break;
- case 43593: //Cold Stare
- damageSpellId=43594;
- break;
- default:
- sLog.outError("Unit::HandleAuraRaidProcFromCharge, received not handled spell: %u", spellProto->Id);
+ case 57949: //shiver
+ damageSpellId = 57952;
+ //animationSpellId = 57951; dummy effects for jump spell have unknown use (see also 41637)
+ break;
+ case 59978: //shiver
+ damageSpellId = 59979;
+ break;
+ case 43593: //Cold Stare
+ damageSpellId = 43594;
+ break;
+ default:
+ sLog.outError("Unit::HandleAuraRaidProcFromCharge, received not handled spell: %u", spellProto->Id);
+ return false;
+ }
+
+ //Currently only Prayer of Mending
+ if (!(spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && spellProto->SpellFamilyFlags[1] & 0x20))
+ {
+ sLog.outDebug("Unit::HandleAuraRaidProcFromChargeWithValue, received not handled spell: %u", spellProto->Id);
return false;
}