diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Pet.cpp | 2 | ||||
-rw-r--r-- | src/game/Player.cpp | 12 | ||||
-rw-r--r-- | src/game/Spell.cpp | 3 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 270 | ||||
-rw-r--r-- | src/game/SpellAuras.h | 8 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 29 | ||||
-rw-r--r-- | src/game/SpellHandler.cpp | 22 | ||||
-rw-r--r-- | src/game/StatSystem.cpp | 10 | ||||
-rw-r--r-- | src/game/Unit.cpp | 168 | ||||
-rw-r--r-- | src/game/Unit.h | 3 |
10 files changed, 285 insertions, 242 deletions
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 65d5fd73199..7ffa3427149 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -628,7 +628,7 @@ void Pet::RegenerateFocus() AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT); for(AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i) if ((*i)->GetModifier()->m_miscvalue == POWER_FOCUS) - addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f; + addvalue *= ((*i)->GetModifierValue() + 100) / 100.0f; ModifyPower(POWER_FOCUS, (int32)addvalue); } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 1a5775845b1..b9ccab4b90c 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -840,7 +840,7 @@ void Player::HandleDrowning() AuraList const& mModWaterBreathing = GetAurasByType(SPELL_AURA_MOD_WATER_BREATHING); for(AuraList::const_iterator i = mModWaterBreathing.begin(); i != mModWaterBreathing.end(); ++i) - UnderWaterTime = uint32(UnderWaterTime * (100.0f + (*i)->GetModifier()->m_amount) / 100.0f); + UnderWaterTime = uint32(UnderWaterTime * (100.0f + (*i)->GetModifierValue()) / 100.0f); if ((m_isunderwater & 0x01) && !(m_isunderwater & 0x80) && isAlive()) { @@ -1892,7 +1892,7 @@ void Player::Regenerate(Powers power) AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT); for(AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i) if ((*i)->GetModifier()->m_miscvalue == power) - addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f; + addvalue *= ((*i)->GetModifierValue() + 100) / 100.0f; } if (power != POWER_RAGE) @@ -1933,7 +1933,7 @@ void Player::RegenerateHealth() { AuraList const& mModHealthRegenPct = GetAurasByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT); for(AuraList::const_iterator i = mModHealthRegenPct.begin(); i != mModHealthRegenPct.end(); ++i) - addvalue *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f; + addvalue *= (100.0f + (*i)->GetModifierValue()) / 100.0f; } else if(HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT)) addvalue *= GetTotalAuraModifier(SPELL_AURA_MOD_REGEN_DURING_COMBAT) / 100.0f; @@ -2130,7 +2130,7 @@ void Player::GiveXP(uint32 xp, Unit* victim) // handle SPELL_AURA_MOD_XP_PCT auras Unit::AuraList const& ModXPPctAuras = GetAurasByType(SPELL_AURA_MOD_XP_PCT); for(Unit::AuraList::const_iterator i = ModXPPctAuras.begin();i != ModXPPctAuras.end(); ++i) - xp = uint32(xp*(1.0f + (*i)->GetModifier()->m_amount / 100.0f)); + xp = uint32(xp*(1.0f + (*i)->GetModifierValue() / 100.0f)); // XP resting bonus for kill uint32 rested_bonus_xp = victim ? GetXPRestBonus(xp) : 0; @@ -6766,7 +6766,7 @@ void Player::_ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attac if (item->IsFitToSpellRequirements(aura->GetSpellProto())) { - HandleBaseModValue(mod, FLAT_MOD, float (aura->GetModifier()->m_amount), apply); + HandleBaseModValue(mod, FLAT_MOD, float (aura->GetModifierValue()), apply); } } @@ -6800,7 +6800,7 @@ void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType att if (item->IsFitToSpellRequirements(aura->GetSpellProto())) { - HandleStatModifier(unitMod, unitModType, float(modifier->m_amount),apply); + HandleStatModifier(unitMod, unitModType, float(aura->GetModifierValue()),apply); } } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 57844782b8a..1aa916f3f56 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2920,7 +2920,8 @@ void Spell::finish(bool ok) int32 chance = m_caster->CalculateSpellDamage(auraSpellInfo, auraSpellIdx, (*i)->GetBasePoints(),unit); if(roll_chance_i(chance)) - m_caster->CastSpell(unit, auraSpellInfo->EffectTriggerSpell[auraSpellIdx], true, NULL, (*i)); + for (int j=0; j != (*i)->GetStackAmount(); ++j) + m_caster->CastSpell(unit, auraSpellInfo->EffectTriggerSpell[auraSpellIdx], true, NULL, (*i)); } } } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 9bac84ed555..a54077573cf 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -319,7 +319,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= }; Aura::Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem) : -m_procCharges(0), m_spellmod(NULL), m_effIndex(eff), m_caster_guid(0), m_target(target), +m_procCharges(0), m_stackAmount(1), m_spellmod(NULL), m_effIndex(eff), m_caster_guid(0), m_target(target), m_timeCla(1000), m_castItemGuid(castItem?castItem->GetGUID():0), m_auraSlot(MAX_AURAS), m_positive(false), m_permanent(false), m_isPeriodic(false), m_isTrigger(false), m_isAreaAura(false), m_isPersistent(false), m_updated(false), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_isRemovedOnShapeLost(true), m_in_use(false), @@ -836,7 +836,6 @@ void Aura::_AddAura() return; // we can found aura in NULL_AURA_SLOT and then need store state instead check slot != NULL_AURA_SLOT - bool samespell = false; bool secondaura = false; uint8 slot = NULL_AURA_SLOT; @@ -848,15 +847,13 @@ void Aura::_AddAura() // allow use single slot only by auras from same caster if(itr->second->GetCasterGUID()==GetCasterGUID()) { - samespell = true; - if (m_effIndex > itr->second->GetEffIndex()) - secondaura = true; + secondaura = true; slot = itr->second->GetAuraSlot(); break; } } - if(samespell) + if(secondaura) break; } @@ -885,7 +882,7 @@ void Aura::_AddAura() if((!m_isPassive || (caster && caster->GetTypeId() == TYPEID_UNIT && ((Creature*)caster)->isTotem())) && (m_spellProto->Effect[GetEffIndex()] != SPELL_EFFECT_APPLY_AREA_AURA_ENEMY || m_target != caster)) { - if(!samespell) // new slot need + if(!secondaura) // new slot need { if (IsPositive()) // empty positive slot { @@ -913,29 +910,23 @@ void Aura::_AddAura() SetAuraSlot( slot ); // Not update fields for not first spell's aura, all data already in fields - if(!secondaura) + if(slot < MAX_AURAS) // slot found { - if(slot < MAX_AURAS) // slot found - { - SetAura(slot, false); - SetAuraFlag(slot, true); - SetAuraLevel(slot,caster ? caster->getLevel() : sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)); - UpdateAuraCharges(); - - // update for out of range group members - m_target->UpdateAuraForGroup(slot); - } - - UpdateAuraDuration(); + SetAura(slot, false); + SetAuraFlag(slot, true); + SetAuraLevel(slot,caster ? caster->getLevel() : sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)); + UpdateAuraCharges(); + + // update for out of range group members + m_target->UpdateAuraForGroup(slot); } } else // use found slot { SetAuraSlot( slot ); - // Not recalculate stack count for second aura of the same spell - if (!secondaura) - UpdateSlotCounterAndDuration(true); } + + UpdateSlotCounterAndDuration(); // Update Seals information if( IsSealSpell(GetSpellProto()) ) @@ -987,7 +978,6 @@ void Aura::_RemoveAura() return; bool samespell = false; - bool sameaura = false; // find other aura in same slot (current already removed from list) for(uint8 i = 0; i < 3; i++) @@ -999,9 +989,6 @@ void Aura::_RemoveAura() { samespell = true; - if(GetEffIndex()==i) - sameaura = true; - break; } } @@ -1053,8 +1040,6 @@ void Aura::_RemoveAura() ((Player*)caster)->SendCooldownEvent(GetSpellProto()); } } - else if(sameaura) // decrease count for spell, only for same aura effect, or this spell auras in remove process. - UpdateSlotCounterAndDuration(false); } void Aura::SetAuraFlag(uint32 slot, bool add) @@ -1093,35 +1078,13 @@ void Aura::SetAuraApplication(uint32 slot, int8 count) m_target->SetUInt32Value(UNIT_FIELD_AURAAPPLICATIONS + index, val); } -void Aura::UpdateSlotCounterAndDuration(bool add) +void Aura::UpdateSlotCounterAndDuration() { uint8 slot = GetAuraSlot(); if(slot >= MAX_AURAS) return; - // calculate amount of similar auras by same effect index (similar different spells) - int8 count = 0; - - // calculate auras and update durations in case aura adding - Unit::AuraList const& aura_list = m_target->GetAurasByType(GetModifier()->m_auraname); - for(Unit::AuraList::const_iterator i = aura_list.begin();i != aura_list.end(); ++i) - { - if( (*i)->GetId()==GetId() && (*i)->GetEffIndex()==m_effIndex && - (*i)->GetCasterGUID()==GetCasterGUID() ) - { - ++count; - - if(add) - (*i)->SetAuraDuration(GetAuraDuration()); - } - } - - // at aura add aura not added yet, at aura remove aura already removed - // in field stored (count-1) - if(!add) - --count; - - SetAuraApplication(slot, count); + SetAuraApplication(slot, m_stackAmount-1); UpdateAuraDuration(); } @@ -1155,7 +1118,7 @@ void Aura::HandleAddModifier(bool apply, bool Real) SpellModifier *mod = new SpellModifier; mod->op = SpellModOp(m_modifier.m_miscvalue); - mod->value = m_modifier.m_amount; + mod->value = GetModifierValue(); mod->type = SpellModType(m_modifier.m_auraname); // SpellModType value == spell aura types mod->spellId = GetId(); mod->effectId = m_effIndex; @@ -1869,8 +1832,8 @@ void Aura::TriggerSpell() { switch((*i)->GetModifier()->m_miscvalue) { - case STAT_INTELLECT: intellectLoss += (*i)->GetModifier()->m_amount; break; - case STAT_SPIRIT: spiritLoss += (*i)->GetModifier()->m_amount; break; + case STAT_INTELLECT: intellectLoss += (*i)->GetModifierValue(); break; + case STAT_SPIRIT: spiritLoss += (*i)->GetModifierValue(); break; default: break; } } @@ -2131,21 +2094,26 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if(m_target->GetTypeId()!=TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading()) m_modifier.m_amount = caster->SpellHealingBonus(GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE, m_target); } - else + // Do final heal for real apply + else if (Real) { - // Final heal only on dispelled or duration end - if ( !(GetAuraDuration() <= 0 || m_removeMode==AURA_REMOVE_BY_DISPEL) ) - return; - - // have a look if there is still some other Lifebloom dummy aura - Unit::AuraList auras = m_target->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::iterator itr = auras.begin(); itr!=auras.end(); itr++) - if((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && - (*itr)->GetSpellProto()->SpellFamilyFlags & 0x1000000000LL) - return; - // final heal - m_target->CastCustomSpell(m_target,33778,&m_modifier.m_amount,NULL,NULL,true,NULL,this,GetCasterGUID()); + // Final heal only on dispelled or duration end or 1 stack + if (!(GetAuraDuration() <= 0 || (m_removeMode==AURA_REMOVE_BY_DISPEL))) + { + // have a look if there is still some other Lifebloom dummy aura + Unit::AuraList auras = m_target->GetAurasByType(SPELL_AURA_DUMMY); + for(Unit::AuraList::iterator itr = auras.begin(); itr!=auras.end(); itr++) + if((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && + (*itr)->GetSpellProto()->SpellFamilyFlags & 0x1000000000LL) + if((*itr)->GetCasterGUID() == GetCasterGUID()) + return; + } + else + { + // final heal + m_target->CastCustomSpell(m_target,33778,&m_modifier.m_amount,NULL,NULL,true,NULL,this,GetCasterGUID()); + } } return; } @@ -2817,7 +2785,7 @@ void Aura::HandleAuraModSkill(bool apply, bool Real) return; uint32 prot=GetSpellProto()->EffectMiscValue[m_effIndex]; - int32 points = GetModifier()->m_amount; + int32 points = GetModifierValue(); ((Player*)m_target)->ModifySkillBonus(prot,(apply ? points: -points),m_modifier.m_auraname==SPELL_AURA_MOD_SKILL_TALENT); if(prot == SKILL_DEFENSE) @@ -2909,7 +2877,7 @@ void Aura::HandleAuraTrackStealthed(bool apply, bool Real) void Aura::HandleAuraModScale(bool apply, bool Real) { - m_target->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X,m_modifier.m_amount,apply); + m_target->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X,GetModifierValue(),apply); } void Aura::HandleModPossess(bool apply, bool Real) @@ -3498,15 +3466,11 @@ void Aura::HandleAuraModSilence(bool apply, bool Real) return; // Search Mana Tap auras on caster - int32 energy = 0; - Unit::AuraList const& m_dummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator i = m_dummyAuras.begin(); i != m_dummyAuras.end(); ++i) - if ((*i)->GetId() == 28734) - ++energy; - if (energy) + Aura * dummy = caster->GetDummyAura(28734); + if (dummy) { - energy *= 10; - caster->CastCustomSpell(caster, 25048, &energy, NULL, NULL, true); + int32 bp = dummy->m_stackAmount * 10; + caster->CastCustomSpell(caster, 25048, &bp, NULL, NULL, true); caster->RemoveAurasDueToSpell(28734); } } @@ -3559,7 +3523,7 @@ void Aura::HandleModThreat(bool apply, bool Real) if(m_modifier.m_miscvalue & int32(1<<x)) { if(m_target->GetTypeId() == TYPEID_PLAYER) - ApplyPercentModFloatVar(m_target->m_threatModifier[x], m_positive ? m_modifier.m_amount : -m_modifier.m_amount, apply); + ApplyPercentModFloatVar(m_target->m_threatModifier[x], m_positive ? GetModifierValue() : -GetModifierValue(), apply); } } } @@ -3580,9 +3544,9 @@ void Aura::HandleAuraModTotalThreat(bool apply, bool Real) float threatMod = 0.0f; if(apply) - threatMod = float(m_modifier.m_amount); + threatMod = float(GetModifierValue()); else - threatMod = float(-m_modifier.m_amount); + threatMod = float(-GetModifierValue()); m_target->getHostilRefManager().threatAssist(caster, threatMod); } @@ -4242,9 +4206,9 @@ void Aura::HandleAuraModResistanceExclusive(bool apply, bool Real) { if(m_modifier.m_miscvalue & int32(1<<x)) { - m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, float(GetModifierValue()), apply); if(m_target->GetTypeId() == TYPEID_PLAYER) - m_target->ApplyResistanceBuffModsMod(SpellSchools(x),m_positive,m_modifier.m_amount, apply); + m_target->ApplyResistanceBuffModsMod(SpellSchools(x),m_positive,GetModifierValue(), apply); } } } @@ -4255,9 +4219,9 @@ void Aura::HandleAuraModResistance(bool apply, bool Real) { if(m_modifier.m_miscvalue & int32(1<<x)) { - m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(GetModifierValue()), apply); if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) - m_target->ApplyResistanceBuffModsMod(SpellSchools(x),m_positive,m_modifier.m_amount, apply); + m_target->ApplyResistanceBuffModsMod(SpellSchools(x),m_positive,GetModifierValue(), apply); } } @@ -4277,14 +4241,14 @@ void Aura::HandleAuraModBaseResistancePCT(bool apply, bool Real) { //pets only have base armor if(((Creature*)m_target)->isPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) - m_target->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(GetModifierValue()), apply); } else { for(int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL;x++) { if(m_modifier.m_miscvalue & int32(1<<x)) - m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_PCT, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_PCT, float(GetModifierValue()), apply); } } } @@ -4295,11 +4259,11 @@ void Aura::HandleModResistancePercent(bool apply, bool Real) { if(m_modifier.m_miscvalue & int32(1<<i)) { - m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(GetModifierValue()), apply); if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) { - m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),true,m_modifier.m_amount, apply); - m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),false,m_modifier.m_amount, apply); + m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),true,GetModifierValue(), apply); + m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),false,GetModifierValue(), apply); } } } @@ -4312,13 +4276,13 @@ void Aura::HandleModBaseResistance(bool apply, bool Real) { //only pets have base stats if(((Creature*)m_target)->isPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) - m_target->HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(GetModifierValue()), apply); } else { for(int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++) if(m_modifier.m_miscvalue & (1<<i)) - m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_VALUE, float(GetModifierValue()), apply); } } @@ -4340,9 +4304,9 @@ void Aura::HandleAuraModStat(bool apply, bool Real) if (m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue == i) { //m_target->ApplyStatMod(Stats(i), m_modifier.m_amount,apply); - m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(GetModifierValue()), apply); if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) - m_target->ApplyStatBuffMod(Stats(i),m_modifier.m_amount,apply); + m_target->ApplyStatBuffMod(Stats(i),GetModifierValue(),apply); } } } @@ -4362,7 +4326,7 @@ void Aura::HandleModPercentStat(bool apply, bool Real) for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i) { if(m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1) - m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(GetModifierValue()), apply); } } @@ -4440,9 +4404,9 @@ void Aura::HandleModTotalPercentStat(bool apply, bool Real) { if(m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1) { - m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(GetModifierValue()), apply); if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) - m_target->ApplyStatPercentBuffMod(Stats(i), m_modifier.m_amount, apply ); + m_target->ApplyStatPercentBuffMod(Stats(i), GetModifierValue(), apply ); } } @@ -4540,7 +4504,7 @@ void Aura::HandleModRegen(bool apply, bool Real) // eating if(m_periodicTimer <= 0) { m_periodicTimer += 5000; - int32 gain = m_target->ModifyHealth(m_modifier.m_amount); + int32 gain = m_target->ModifyHealth(GetModifierValue()); Unit *caster = GetCaster(); if (caster) { @@ -4631,7 +4595,7 @@ void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real) { if(apply) { - m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetModifierValue()), apply); m_target->ModifyHealth(m_modifier.m_amount); } else @@ -4640,7 +4604,7 @@ void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real) m_target->ModifyHealth(-m_modifier.m_amount); else m_target->SetHealth(1); - m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetModifierValue()), apply); } } } @@ -4669,7 +4633,7 @@ void Aura::HandleAuraModIncreaseEnergy(bool apply, bool Real) if(int32(powerType) != m_modifier.m_miscvalue) return; - m_target->HandleStatModifier(UnitMods(UNIT_MOD_POWER_START + powerType), TOTAL_VALUE, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_POWER_START + powerType), TOTAL_VALUE, float(GetModifierValue()), apply); } void Aura::HandleAuraModIncreaseEnergyPercent(bool apply, bool Real) @@ -4678,13 +4642,13 @@ void Aura::HandleAuraModIncreaseEnergyPercent(bool apply, bool Real) if(int32(powerType) != m_modifier.m_miscvalue) return; - m_target->HandleStatModifier(UnitMods(UNIT_MOD_POWER_START + powerType), TOTAL_PCT, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_POWER_START + powerType), TOTAL_PCT, float(GetModifierValue()), apply); } void Aura::HandleAuraModIncreaseHealthPercent(bool apply, bool Real) { //m_target->ApplyMaxHealthPercentMod(m_modifier.m_amount,apply); - m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(GetModifierValue()), apply); } /********************************/ @@ -4748,9 +4712,9 @@ void Aura::HandleAuraModCritPercent(bool apply, bool Real) if (GetSpellProto()->EquippedItemClass == -1) { - ((Player*)m_target)->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); - ((Player*)m_target)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); - ((Player*)m_target)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); + ((Player*)m_target)->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (GetModifierValue()), apply); + ((Player*)m_target)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (GetModifierValue()), apply); + ((Player*)m_target)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (GetModifierValue()), apply); } else { @@ -4760,13 +4724,13 @@ void Aura::HandleAuraModCritPercent(bool apply, bool Real) void Aura::HandleModHitChance(bool apply, bool Real) { - m_target->m_modMeleeHitChance += apply ? m_modifier.m_amount : (-m_modifier.m_amount); - m_target->m_modRangedHitChance += apply ? m_modifier.m_amount : (-m_modifier.m_amount); + m_target->m_modMeleeHitChance += apply ? GetModifierValue() : -GetModifierValue(); + m_target->m_modRangedHitChance += apply ? GetModifierValue() : -GetModifierValue(); } void Aura::HandleModSpellHitChance(bool apply, bool Real) { - m_target->m_modSpellHitChance += apply ? m_modifier.m_amount: (-m_modifier.m_amount); + m_target->m_modSpellHitChance += apply ? GetModifierValue(): -GetModifierValue(); } void Aura::HandleModSpellCritChance(bool apply, bool Real) @@ -4781,7 +4745,7 @@ void Aura::HandleModSpellCritChance(bool apply, bool Real) } else { - m_target->m_baseSpellCritChance += apply ? m_modifier.m_amount:(-m_modifier.m_amount); + m_target->m_baseSpellCritChance += apply ? GetModifierValue():-GetModifierValue(); } } @@ -4805,22 +4769,22 @@ void Aura::HandleModSpellCritChanceShool(bool /*apply*/, bool Real) void Aura::HandleModCastingSpeed(bool apply, bool Real) { - m_target->ApplyCastTimePercentMod(m_modifier.m_amount,apply); + m_target->ApplyCastTimePercentMod(GetModifierValue(),apply); } void Aura::HandleModMeleeRangedSpeedPct(bool apply, bool Real) { - m_target->ApplyAttackTimePercentMod(BASE_ATTACK,m_modifier.m_amount,apply); - m_target->ApplyAttackTimePercentMod(OFF_ATTACK,m_modifier.m_amount,apply); - m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_modifier.m_amount, apply); + m_target->ApplyAttackTimePercentMod(BASE_ATTACK,GetModifierValue(),apply); + m_target->ApplyAttackTimePercentMod(OFF_ATTACK,GetModifierValue(),apply); + m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, GetModifierValue(), apply); } void Aura::HandleModCombatSpeedPct(bool apply, bool Real) { - m_target->ApplyCastTimePercentMod(m_modifier.m_amount,apply); - m_target->ApplyAttackTimePercentMod(BASE_ATTACK,m_modifier.m_amount,apply); - m_target->ApplyAttackTimePercentMod(OFF_ATTACK,m_modifier.m_amount,apply); - m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_modifier.m_amount, apply); + m_target->ApplyCastTimePercentMod(GetModifierValue(),apply); + m_target->ApplyAttackTimePercentMod(BASE_ATTACK,GetModifierValue(),apply); + m_target->ApplyAttackTimePercentMod(OFF_ATTACK,GetModifierValue(),apply); + m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, GetModifierValue(), apply); } void Aura::HandleModAttackSpeed(bool apply, bool Real) @@ -4828,26 +4792,26 @@ void Aura::HandleModAttackSpeed(bool apply, bool Real) if(!m_target->isAlive() ) return; - m_target->ApplyAttackTimePercentMod(BASE_ATTACK,m_modifier.m_amount,apply); + m_target->ApplyAttackTimePercentMod(BASE_ATTACK,GetModifierValue(),apply); } void Aura::HandleHaste(bool apply, bool Real) { - m_target->ApplyAttackTimePercentMod(BASE_ATTACK, m_modifier.m_amount,apply); - m_target->ApplyAttackTimePercentMod(OFF_ATTACK, m_modifier.m_amount,apply); - m_target->ApplyAttackTimePercentMod(RANGED_ATTACK,m_modifier.m_amount,apply); + m_target->ApplyAttackTimePercentMod(BASE_ATTACK, GetModifierValue(),apply); + m_target->ApplyAttackTimePercentMod(OFF_ATTACK, GetModifierValue(),apply); + m_target->ApplyAttackTimePercentMod(RANGED_ATTACK,GetModifierValue(),apply); } void Aura::HandleAuraModRangedHaste(bool apply, bool Real) { - m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_modifier.m_amount, apply); + m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, GetModifierValue(), apply); } void Aura::HandleRangedAmmoHaste(bool apply, bool Real) { if(m_target->GetTypeId() != TYPEID_PLAYER) return; - m_target->ApplyAttackTimePercentMod(RANGED_ATTACK,m_modifier.m_amount, apply); + m_target->ApplyAttackTimePercentMod(RANGED_ATTACK,GetModifierValue(), apply); } /********************************/ @@ -4856,7 +4820,7 @@ void Aura::HandleRangedAmmoHaste(bool apply, bool Real) void Aura::HandleAuraModAttackPower(bool apply, bool Real) { - m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(GetModifierValue()), apply); } void Aura::HandleAuraModRangedAttackPower(bool apply, bool Real) @@ -4864,13 +4828,13 @@ void Aura::HandleAuraModRangedAttackPower(bool apply, bool Real) if((m_target->getClassMask() & CLASSMASK_WAND_USERS)!=0) return; - m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(GetModifierValue()), apply); } void Aura::HandleAuraModAttackPowerPercent(bool apply, bool Real) { //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1 - m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_PCT, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_PCT, float(GetModifierValue()), apply); } void Aura::HandleAuraModRangedAttackPowerPercent(bool apply, bool Real) @@ -4879,7 +4843,7 @@ void Aura::HandleAuraModRangedAttackPowerPercent(bool apply, bool Real) return; //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1 - m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_PCT, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_PCT, float(GetModifierValue()), apply); } void Aura::HandleAuraModRangedAttackPowerOfStatPercent(bool apply, bool Real) @@ -4929,9 +4893,9 @@ void Aura::HandleModDamageDone(bool apply, bool Real) // apply generic physical damage bonuses including wand case if (GetSpellProto()->EquippedItemClass == -1 || m_target->GetTypeId() != TYPEID_PLAYER) { - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, float(m_modifier.m_amount), apply); - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(m_modifier.m_amount), apply); - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(GetModifierValue()), apply); } else { @@ -4941,9 +4905,9 @@ void Aura::HandleModDamageDone(bool apply, bool Real) if(m_target->GetTypeId() == TYPEID_PLAYER) { if(m_positive) - m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS,m_modifier.m_amount,apply); + m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS,GetModifierValue(),apply); else - m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG,m_modifier.m_amount,apply); + m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG,GetModifierValue(),apply); } } @@ -4969,7 +4933,7 @@ void Aura::HandleModDamageDone(bool apply, bool Real) for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++) { if((m_modifier.m_miscvalue & (1<<i)) != 0) - m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i,m_modifier.m_amount,apply); + m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i,GetModifierValue(),apply); } } else @@ -4977,7 +4941,7 @@ void Aura::HandleModDamageDone(bool apply, bool Real) for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++) { if((m_modifier.m_miscvalue & (1<<i)) != 0) - m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+i,m_modifier.m_amount,apply); + m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+i,GetModifierValue(),apply); } } Pet* pet = m_target->GetPet(); @@ -5012,9 +4976,9 @@ void Aura::HandleModDamagePercentDone(bool apply, bool Real) // apply generic physical damage bonuses including wand case if (GetSpellProto()->EquippedItemClass == -1 || m_target->GetTypeId() != TYPEID_PLAYER) { - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, float(m_modifier.m_amount), apply); - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(m_modifier.m_amount), apply); - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_PCT, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_PCT, float(GetModifierValue()), apply); } else { @@ -5053,7 +5017,7 @@ void Aura::HandleModOffhandDamagePercent(bool apply, bool Real) sLog.outDebug("AURA MOD OFFHAND DAMAGE"); - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(GetModifierValue()), apply); } /********************************/ @@ -5066,7 +5030,7 @@ void Aura::HandleModPowerCostPCT(bool apply, bool Real) if(!Real) return; - float amount = m_modifier.m_amount/100.0f; + float amount = GetModifierValue() /100.0f; for(int i = 0; i < MAX_SPELL_SCHOOL; ++i) if(m_modifier.m_miscvalue & (1<<i)) m_target->ApplyModSignedFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER+i,amount,apply); @@ -5080,7 +5044,7 @@ void Aura::HandleModPowerCost(bool apply, bool Real) for(int i = 0; i < MAX_SPELL_SCHOOL; ++i) if(m_modifier.m_miscvalue & (1<<i)) - m_target->ApplyModInt32Value(UNIT_FIELD_POWER_COST_MODIFIER+i,m_modifier.m_amount,apply); + m_target->ApplyModInt32Value(UNIT_FIELD_POWER_COST_MODIFIER+i,GetModifierValue(),apply); } /*********************************************************/ @@ -5301,7 +5265,7 @@ void Aura::HandleModRating(bool apply, bool Real) for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating) if (m_modifier.m_miscvalue & (1 << rating)) - ((Player*)m_target)->ApplyRatingMod(CombatRating(rating), m_modifier.m_amount, apply); + ((Player*)m_target)->ApplyRatingMod(CombatRating(rating), GetModifierValue(), apply); } void Aura::HandleForceMoveForward(bool apply, bool Real) @@ -5332,11 +5296,11 @@ void Aura::HandleModTargetResistance(bool apply, bool Real) // show armor penetration if (m_target->GetTypeId() == TYPEID_PLAYER && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) - m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE,m_modifier.m_amount, apply); + m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE,GetModifierValue(), apply); // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy if (m_target->GetTypeId() == TYPEID_PLAYER && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_SPELL)==SPELL_SCHOOL_MASK_SPELL) - m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE,m_modifier.m_amount, apply); + m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE,GetModifierValue(), apply); } void Aura::HandleShieldBlockValue(bool apply, bool Real) @@ -5346,7 +5310,7 @@ void Aura::HandleShieldBlockValue(bool apply, bool Real) modType = PCT_MOD; if(m_target->GetTypeId() == TYPEID_PLAYER) - ((Player*)m_target)->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(m_modifier.m_amount), apply); + ((Player*)m_target)->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(GetModifierValue()), apply); } void Aura::HandleAuraRetainComboPoints(bool apply, bool Real) @@ -5364,7 +5328,7 @@ void Aura::HandleAuraRetainComboPoints(bool apply, bool Real) // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost) if( !apply && m_duration==0 && target->GetComboTarget()) if(Unit* unit = ObjectAccessor::GetUnit(*m_target,target->GetComboTarget())) - target->AddComboPoints(unit, -m_modifier.m_amount); + target->AddComboPoints(unit, -GetModifierValue()); } void Aura::HandleModUnattackable( bool Apply, bool Real ) @@ -5556,7 +5520,7 @@ void Aura::PeriodicTick() CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL ); // ignore non positive values (can be result apply spellmods to aura damage - uint32 amount = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; + uint32 amount = GetModifierValue() > 0 ? GetModifierValue() : 0; uint32 pdamage; @@ -5775,7 +5739,7 @@ void Aura::PeriodicTick() return; // ignore non positive values (can be result apply spellmods to aura damage - uint32 amount = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; + uint32 amount = GetModifierValue() > 0 ? GetModifierValue() : 0; uint32 pdamage; @@ -5867,7 +5831,7 @@ void Aura::PeriodicTick() return; // ignore non positive values (can be result apply spellmods to aura damage - uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; + uint32 pdamage = GetModifierValue() > 0 ? GetModifierValue() : 0; sLog.outDetail("PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId()); @@ -5922,7 +5886,7 @@ void Aura::PeriodicTick() case SPELL_AURA_PERIODIC_ENERGIZE: { // ignore non positive values (can be result apply spellmods to aura damage - uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; + uint32 pdamage = GetModifierValue() > 0 ? GetModifierValue() : 0; sLog.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId()); @@ -5954,7 +5918,7 @@ void Aura::PeriodicTick() case SPELL_AURA_OBS_MOD_MANA: { // ignore non positive values (can be result apply spellmods to aura damage - uint32 amount = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; + uint32 amount = GetModifierValue() > 0 ? GetModifierValue() : 0; uint32 pdamage = uint32(m_target->GetMaxPower(POWER_MANA) * amount/100); @@ -5990,7 +5954,7 @@ void Aura::PeriodicTick() if(m_target->IsImmunedToDamage(GetSpellSchoolMask(GetSpellProto()))) return; - int32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; + int32 pdamage = GetModifierValue() > 0 ? GetModifierValue() : 0; Powers powerType = Powers(m_modifier.m_miscvalue); diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index d803d9ede13..4762755bc40 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -214,6 +214,7 @@ class TRINITY_DLL_SPEC Aura void SetModifier(AuraType t, int32 a, uint32 pt, int32 miscValue); Modifier* GetModifier() {return &m_modifier;} + int32 GetModifierValue() {return m_modifier.m_amount * m_stackAmount;} int32 GetMiscValue() {return m_spellProto->EffectMiscValue[m_effIndex];} int32 GetMiscBValue() {return m_spellProto->EffectMiscValueB[m_effIndex];} @@ -230,6 +231,7 @@ class TRINITY_DLL_SPEC Aura time_t GetAuraApplyTime() { return m_applyTime; } void UpdateAuraDuration(); void SendAuraDurationForCaster(Player* caster); + void UpdateSlotCounterAndDuration(); uint64 const& GetCasterGUID() const { return m_caster_guid; } Unit* GetCaster() const; @@ -295,6 +297,9 @@ class TRINITY_DLL_SPEC Aura void PeriodicTick(); void PeriodicDummyTick(); + + int32 GetStackAmount() {return m_stackAmount;} + void SetStackAmount(int32 amount) {m_stackAmount=amount;} protected: Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL); @@ -330,8 +335,9 @@ class TRINITY_DLL_SPEC Aura int32 m_periodicTimer; uint32 m_PeriodicEventId; DiminishingGroup m_AuraDRGroup; + + int32 m_stackAmount; private: - void UpdateSlotCounterAndDuration(bool add); void CleanupTriggeredSpells(); void SetAura(uint32 slot, bool remove) { m_target->SetUInt32Value(UNIT_FIELD_AURA + slot, remove ? 0 : GetId()); } void SetAuraFlag(uint32 slot, bool add); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index e7e1302ab58..c038a43051f 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -958,16 +958,12 @@ void Spell::EffectDummy(uint32 i) } case 28730: // Arcane Torrent (Mana) { - int32 count = 0; - Unit::AuraList const& m_dummyAuras = m_caster->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator i = m_dummyAuras.begin(); i != m_dummyAuras.end(); ++i) - if ((*i)->GetId() == 28734) - ++count; - if (count) - { - m_caster->RemoveAurasDueToSpell(28734); - int32 bp = damage * count; + Aura * dummy = m_caster->GetDummyAura(28734); + if (dummy) + { + int32 bp = damage * dummy->GetStackAmount(); m_caster->CastCustomSpell(m_caster, 28733, &bp, NULL, NULL, true); + m_caster->RemoveAurasDueToSpell(28734); } return; } @@ -2318,7 +2314,7 @@ void Spell::EffectHeal( uint32 /*i*/ ) Unit::AuraList const& mDummyAuras = m_caster->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i) if((*i)->GetId() == 45062) - damageAmount+=(*i)->GetModifier()->m_amount; + damageAmount+=(*i)->GetModifierValue(); if (damageAmount) m_caster->RemoveAurasDueToSpell(45062); @@ -3321,8 +3317,14 @@ void Spell::EffectDispel(uint32 i) SpellEntry const* spellInfo = sSpellStore.LookupEntry(j->first); data << uint32(spellInfo->Id); // Spell Id data << uint8(0); // 0 - dispelled !=0 cleansed - unitTarget->RemoveAurasDueToSpellByDispel(spellInfo->Id, j->second, m_caster); - } + if(spellInfo->StackAmount!= 0) + { + //Why are Aura's Removed by EffIndex? Auras should be removed as a whole..... + unitTarget->RemoveSingleAuraFromStackByDispel(spellInfo->Id); + } + else + unitTarget->RemoveAurasDueToSpellByDispel(spellInfo->Id, j->second, m_caster); + } m_caster->SendMessageToSet(&data, true); // On succes dispel @@ -4219,7 +4221,8 @@ void Spell::EffectWeaponDmg(uint32 i) int32 duration = GetSpellDuration(proto); (*itr)->SetAuraDuration(duration); (*itr)->UpdateAuraDuration(); - ++stack; + stack = (*itr)->GetStackAmount(); + break; } } diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index f0d004a0329..77f2ab8f1d6 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -362,6 +362,28 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket) if(!IsPositiveSpell(spellId) || (spellInfo->Attributes & SPELL_ATTR_CANT_CANCEL)) return; + // lifebloom must delete final heal effect + if (spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && (spellInfo->SpellFamilyFlags & 0x1000000000LL) ) + { + Unit::AuraMap::iterator iter; + while((iter = _player->m_Auras.find(Unit::spellEffectPair(spellId, 1))) != _player->m_Auras.end()) + { + _player->m_modAuras[SPELL_AURA_DUMMY].remove(iter->second); + + Aura* Aur = iter->second; + _player->m_Auras.erase(iter); + ++_player->m_removedAuras; // internal count used by unit update + + delete Aur; + + if( _player->m_Auras.empty() ) + iter = _player->m_Auras.end(); + else + iter = _player->m_Auras.begin(); + + } + } + // channeled spell case (it currently casted then) if(IsChanneledSpell(spellInfo)) { diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index af1f2302482..ca561dd4b36 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -155,7 +155,7 @@ void Player::UpdateArmor() { Modifier* mod = (*i)->GetModifier(); if(mod->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL) - value += int32(GetStat(Stats((*i)->GetMiscBValue())) * mod->m_amount / 100.0f); + value += int32(GetStat(Stats((*i)->GetMiscBValue())) * (*i)->GetModifierValue() / 100.0f); } value *= GetModifierValue(unitMod, TOTAL_PCT); @@ -313,7 +313,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged ) { AuraList const& mRAPbyIntellect = GetAurasByType(SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT); for(AuraList::const_iterator i = mRAPbyIntellect.begin();i != mRAPbyIntellect.end(); ++i) - attPowerMod += int32(GetStat(Stats((*i)->GetModifier()->m_miscvalue)) * (*i)->GetModifier()->m_amount / 100.0f); + attPowerMod += int32(GetStat(Stats((*i)->GetModifier()->m_miscvalue)) * (*i)->GetModifierValue() / 100.0f); } float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f; @@ -572,10 +572,10 @@ void Player::UpdateExpertise(WeaponAttackType attack) { // item neutral spell if((*itr)->GetSpellProto()->EquippedItemClass == -1) - expertise += (*itr)->GetModifier()->m_amount; + expertise += (*itr)->GetModifierValue(); // item dependent spell else if(weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto())) - expertise += (*itr)->GetModifier()->m_amount; + expertise += (*itr)->GetModifierValue(); } if(expertise < 0) @@ -605,7 +605,7 @@ void Player::UpdateManaRegen() for(AuraList::const_iterator i = regenAura.begin();i != regenAura.end(); ++i) { Modifier* mod = (*i)->GetModifier(); - power_regen_mp5 += GetStat(Stats(mod->m_miscvalue)) * mod->m_amount / 500.0f; + power_regen_mp5 += GetStat(Stats(mod->m_miscvalue)) * (*i)->GetModifierValue() / 500.0f; } // Bonus from some dummy auras diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index c8c5689fce0..36f9fcecf48 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1209,7 +1209,7 @@ void Unit::DealFlatDamage(Unit *pVictim, SpellEntry const *spellInfo, uint32 *da AuraList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS); for(AuraList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) - bonusDmg = uint32(bonusDmg * ((*i)->GetModifier()->m_amount+100.0f)/100.0f); + bonusDmg = uint32(bonusDmg * ((*i)->GetModifierValue()+100.0f)/100.0f); *damage += bonusDmg; @@ -2464,7 +2464,7 @@ void Unit::DoAttackDamage (Unit *pVictim, uint32 *damage, CleanDamage *cleanDama AuraList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS); for(AuraList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) - crit_bonus = uint32(crit_bonus * ((*i)->GetModifier()->m_amount+100.0f)/100.0f); + crit_bonus = uint32(crit_bonus * ((*i)->GetModifierValue()+100.0f)/100.0f); } *damage += crit_bonus; @@ -2742,9 +2742,7 @@ void Unit::DoAttackDamage (Unit *pVictim, uint32 *damage, CleanDamage *cleanDama } } - CastMeleeProcDamageAndSpell(pVictim, (*damage - *absorbDamage - *resistDamage - *blocked_amount), damageSchoolMask, attType, outcome, spellCasted, isTriggeredSpell); - - // victim's damage shield + CastMeleeProcDamageAndSpell(pVictim, (*damage - *absorbDamage pVictim->SpellNonMeleeDamageLog(this, (*i)->GetId(), (*i)->GetModifier()->m_amount, false, false);eld // yet another hack to fix crashes related to the aura getting removed during iteration std::set<Aura*> alreadyDone; uint32 removedAuras = pVictim->m_removedAuras; @@ -2755,7 +2753,7 @@ void Unit::DoAttackDamage (Unit *pVictim, uint32 *damage, CleanDamage *cleanDama if (alreadyDone.find(*i) == alreadyDone.end()) { alreadyDone.insert(*i); - pVictim->SpellNonMeleeDamageLog(this, (*i)->GetId(), (*i)->GetModifier()->m_amount, false, false); + pVictim->SpellNonMeleeDamageLog(this, (*i)->GetId(), (*i)->GetModifierValue(), false, false); if (pVictim->m_removedAuras > removedAuras) { removedAuras = pVictim->m_removedAuras; @@ -3407,7 +3405,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool Unit::AuraList const& mReflectSpellsSchool = pVictim->GetAurasByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL); for(Unit::AuraList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i) if((*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spell)) - reflectchance += (*i)->GetModifier()->m_amount; + reflectchance = (*i)->GetModifierValue(); if (reflectchance > 0 && roll_chance_i(reflectchance)) { // Start triggers for remove charges if need (trigger only for victim, and mark as active spell) @@ -4016,7 +4014,7 @@ int32 Unit::GetTotalAuraModifier(AuraType auratype) const AuraList const& mTotalAuraList = GetAurasByType(auratype); for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) - modifier += (*i)->GetModifier()->m_amount; + modifier += (*i)->GetModifierValue(); return modifier; } @@ -4027,7 +4025,7 @@ float Unit::GetTotalAuraMultiplier(AuraType auratype) const AuraList const& mTotalAuraList = GetAurasByType(auratype); for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) - multiplier *= (100.0f + (*i)->GetModifier()->m_amount)/100.0f; + multiplier *= (100.0f + (*i)->GetModifierValue())/100.0f; return multiplier; } @@ -4038,8 +4036,11 @@ int32 Unit::GetMaxPositiveAuraModifier(AuraType auratype) const AuraList const& mTotalAuraList = GetAurasByType(auratype); for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) - if ((*i)->GetModifier()->m_amount > modifier) - modifier = (*i)->GetModifier()->m_amount; + { + int32 amount = (*i)->GetModifierValue(); + if (amount > modifier) + modifier = amount; + } return modifier; } @@ -4050,8 +4051,11 @@ int32 Unit::GetMaxNegativeAuraModifier(AuraType auratype) const AuraList const& mTotalAuraList = GetAurasByType(auratype); for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) - if ((*i)->GetModifier()->m_amount < modifier) - modifier = (*i)->GetModifier()->m_amount; + { + int32 amount = (*i)->GetModifierValue(); + if (amount < modifier) + modifier = amount; + } return modifier; } @@ -4065,7 +4069,7 @@ int32 Unit::GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) { Modifier* mod = (*i)->GetModifier(); if (mod->m_miscvalue & misc_mask) - modifier += mod->m_amount; + modifier += (*i)->GetModifierValue(); } return modifier; } @@ -4079,7 +4083,7 @@ float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask { Modifier* mod = (*i)->GetModifier(); if (mod->m_miscvalue & misc_mask) - multiplier *= (100.0f + mod->m_amount)/100.0f; + multiplier *= (100.0f + (*i)->GetModifierValue())/100.0f; } return multiplier; } @@ -4092,8 +4096,9 @@ int32 Unit::GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_ for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) { Modifier* mod = (*i)->GetModifier(); - if (mod->m_miscvalue & misc_mask && mod->m_amount > modifier) - modifier = mod->m_amount; + int32 amount = (*i)->GetModifierValue(); + if (mod->m_miscvalue & misc_mask && amount > modifier) + modifier = amount; } return modifier; @@ -4107,8 +4112,9 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_ for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) { Modifier* mod = (*i)->GetModifier(); - if (mod->m_miscvalue & misc_mask && mod->m_amount < modifier) - modifier = mod->m_amount; + int32 amount = (*i)->GetModifierValue(); + if (mod->m_miscvalue & misc_mask && amount < modifier) + modifier = amount; } return modifier; @@ -4123,7 +4129,7 @@ int32 Unit::GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) { Modifier* mod = (*i)->GetModifier(); if (mod->m_miscvalue == misc_value) - modifier += mod->m_amount; + modifier += (*i)->GetModifierValue(); } return modifier; } @@ -4137,7 +4143,7 @@ float Unit::GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_valu { Modifier* mod = (*i)->GetModifier(); if (mod->m_miscvalue == misc_value) - multiplier *= (100.0f + mod->m_amount)/100.0f; + multiplier *= (100.0f + (*i)->GetModifierValue())/100.0f; } return multiplier; } @@ -4150,8 +4156,9 @@ int32 Unit::GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_ for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) { Modifier* mod = (*i)->GetModifier(); - if (mod->m_miscvalue == misc_value && mod->m_amount > modifier) - modifier = mod->m_amount; + int32 amount = (*i)->GetModifierValue(); + if (mod->m_miscvalue == misc_value && amount > modifier) + modifier = amount; } return modifier; @@ -4165,8 +4172,9 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_ for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) { Modifier* mod = (*i)->GetModifier(); - if (mod->m_miscvalue == misc_value && mod->m_amount < modifier) - modifier = mod->m_amount; + int32 amount = (*i)->GetModifierValue(); + if (mod->m_miscvalue == misc_value && amount < modifier) + modifier = amount; } return modifier; @@ -4205,8 +4213,10 @@ bool Unit::AddAura(Aura *Aur) // replace aura if next will > spell StackAmount if(aurSpellInfo->StackAmount) { - if(m_Auras.count(spair) >= aurSpellInfo->StackAmount) - RemoveAura(i,AURA_REMOVE_BY_STACK); + Aur->SetStackAmount(i->second->GetStackAmount()); + if(Aur->GetStackAmount() < aurSpellInfo->StackAmount) + Aur->SetStackAmount(Aur->GetStackAmount()+1); + RemoveAura(i,AURA_REMOVE_BY_STACK); } // if StackAmount==0 not allow auras from same caster else @@ -4562,11 +4572,48 @@ void Unit::RemoveAurasWithDispelType( DispelType type ) } } +void Unit::RemoveSingleAuraFromStackByDispel(uint32 spellId) +{ + for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); ) + { + Aura *aur = iter->second; + if (aur->GetId() == spellId) + { + if(iter->second->GetStackAmount() > 1) + { + // reapply modifier with reduced stack amount + iter->second->ApplyModifier(false,true); + iter->second->SetStackAmount(iter->second->GetStackAmount()-1); + iter->second->ApplyModifier(true,true); + + iter->second->UpdateSlotCounterAndDuration(); + return; // not remove aura if stack amount > 1 + } + else + RemoveAura(iter,AURA_REMOVE_BY_DISPEL); + } + else + ++iter; + } +} + void Unit::RemoveSingleAuraFromStack(uint32 spellId, uint32 effindex) { AuraMap::iterator iter = m_Auras.find(spellEffectPair(spellId, effindex)); if(iter != m_Auras.end()) + { + if(iter->second->GetStackAmount() > 1) + { + // reapply modifier with reduced stack amount + iter->second->ApplyModifier(false,true); + iter->second->SetStackAmount(iter->second->GetStackAmount()-1); + iter->second->ApplyModifier(true,true); + + iter->second->UpdateSlotCounterAndDuration(); + return; // not remove aura if stack amount > 1 + } RemoveAura(iter); + } } void Unit::RemoveAurasDueToSpell(uint32 spellId, Aura* except) @@ -4693,6 +4740,9 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) sLog.outDebug("Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode); assert(!Aur->IsInUse()); Aur->ApplyModifier(false,true); + + Aur->SetStackAmount(0); + Aur->_RemoveAura(); delete Aur; @@ -6751,14 +6801,12 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB ((Player*)this)->AddSpellCooldown(37657,0,time(NULL)+(roll_chance_i(50) ? 2 : 3)); // counting - uint32 count = 0; - AuraList const& dummyAura = GetAurasByType(SPELL_AURA_DUMMY); - for(AuraList::const_iterator itr = dummyAura.begin(); itr != dummyAura.end(); ++itr) - if((*itr)->GetId()==37658) - ++count; + Aura * dummy = GetDummyAura(37658); + if (!dummy) + return false; // release at 3 aura in stack - if(count <= 2) + if(dummy->GetStackAmount() <= 2) return true; // main triggered spell casted anyway RemoveAurasDueToSpell(37658); @@ -7508,13 +7556,11 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB // stacking CastSpell(this, 37658, true, NULL, triggeredByAura); // counting - uint32 count = 0; - AuraList const& dummyAura = GetAurasByType(SPELL_AURA_DUMMY); - for(AuraList::const_iterator itr = dummyAura.begin(); itr != dummyAura.end(); ++itr) - if((*itr)->GetId()==37658) - ++count; + Aura * dummy = GetDummyAura(37658); + if (!dummy) + return false; // release at 3 aura in stack (cont contain in basepoint of trigger aura) - if(count < triggerAmount) + if(dummy->GetStackAmount() <= 2) return false; RemoveAurasDueToSpell(37658); @@ -8583,7 +8629,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 (*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0 ) // 0 == any inventory type (not wand then) { - DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + DoneTotalMod *= ((*i)->GetModifierValue() +100.0f)/100.0f; } } @@ -8591,13 +8637,13 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 AuraList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS); for(AuraList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) - DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + DoneTotalMod *= ((*i)->GetModifierValue() +100.0f)/100.0f; // ..taken AuraList const& mModDamagePercentTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN); for(AuraList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i) if( (*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto) ) - TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + TakenTotalMod *= ((*i)->GetModifierValue() +100.0f)/100.0f; // .. taken pct: scripted (increases damage of * against targets *) AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); @@ -8778,7 +8824,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 // Seal of Vengeance - 17% per Fully Stacked Tick - 5 Applications else if ((spellProto->SpellFamilyFlags & 0x80000000000LL) && spellProto->SpellIconID == 2292) { - DotFactor = 0.17f; + DotFactor = 0.85f; CastingTime = 3500; } // Holy shield - 5% of Holy Damage @@ -8910,7 +8956,7 @@ int32 Unit::SpellBaseDamageBonus(SpellSchoolMask schoolMask) // -1 == any item class (not wand then) (*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0 ) // 0 == any inventory type (not wand then) - DoneAdvertisedBenefit += (*i)->GetModifier()->m_amount; + DoneAdvertisedBenefit += (*i)->GetModifierValue(); if (GetTypeId() == TYPEID_PLAYER) { @@ -8928,14 +8974,14 @@ int32 Unit::SpellBaseDamageBonus(SpellSchoolMask schoolMask) if(eff < 2 && iSpellProto->EffectApplyAuraName[eff+1]==SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT) usedStat = Stats(iSpellProto->EffectMiscValue[eff+1]); - DoneAdvertisedBenefit += int32(GetStat(usedStat) * (*i)->GetModifier()->m_amount / 100.0f); + DoneAdvertisedBenefit += int32(GetStat(usedStat) * (*i)->GetModifierValue() / 100.0f); } } // ... and attack power AuraList const& mDamageDonebyAP = GetAurasByType(SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER); for(AuraList::const_iterator i =mDamageDonebyAP.begin();i != mDamageDonebyAP.end(); ++i) if ((*i)->GetModifier()->m_miscvalue & schoolMask) - DoneAdvertisedBenefit += int32(GetTotalAttackPowerValue(BASE_ATTACK) * (*i)->GetModifier()->m_amount / 100.0f); + DoneAdvertisedBenefit += int32(GetTotalAttackPowerValue(BASE_ATTACK) * (*i)->GetModifierValue() / 100.0f); } return DoneAdvertisedBenefit; @@ -8950,13 +8996,13 @@ int32 Unit::SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit *pVic AuraList const& mDamageDoneCreature = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE); for(AuraList::const_iterator i = mDamageDoneCreature.begin();i != mDamageDoneCreature.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) - TakenAdvertisedBenefit += (*i)->GetModifier()->m_amount; + TakenAdvertisedBenefit += (*i)->GetModifierValue(); // ..taken AuraList const& mDamageTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_TAKEN); for(AuraList::const_iterator i = mDamageTaken.begin();i != mDamageTaken.end(); ++i) if(((*i)->GetModifier()->m_miscvalue & schoolMask) != 0) - TakenAdvertisedBenefit += (*i)->GetModifier()->m_amount; + TakenAdvertisedBenefit += (*i)->GetModifierValue(); return TakenAdvertisedBenefit; } @@ -9224,7 +9270,7 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, // Healing done percent AuraList const& mHealingDonePct = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT); for(AuraList::const_iterator i = mHealingDonePct.begin();i != mHealingDonePct.end(); ++i) - heal *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f; + heal *= (100.0f + (*i)->GetModifierValue()) / 100.0f; // apply spellmod to Done amount if(Player* modOwner = GetSpellModOwner()) @@ -9265,7 +9311,7 @@ int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask) AuraList const& mHealingDone = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE); for(AuraList::const_iterator i = mHealingDone.begin();i != mHealingDone.end(); ++i) if(((*i)->GetModifier()->m_miscvalue & schoolMask) != 0) - AdvertisedBenefit += (*i)->GetModifier()->m_amount; + AdvertisedBenefit += (*i)->GetModifierValue(); // Healing bonus of spirit, intellect and strength if (GetTypeId() == TYPEID_PLAYER) @@ -9276,14 +9322,14 @@ int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask) { // stat used dependent from misc value (stat index) Stats usedStat = Stats((*i)->GetSpellProto()->EffectMiscValue[(*i)->GetEffIndex()]); - AdvertisedBenefit += int32(GetStat(usedStat) * (*i)->GetModifier()->m_amount / 100.0f); + AdvertisedBenefit += int32(GetStat(usedStat) * (*i)->GetModifierValue() / 100.0f); } // ... and attack power AuraList const& mHealingDonebyAP = GetAurasByType(SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER); for(AuraList::const_iterator i = mHealingDonebyAP.begin();i != mHealingDonebyAP.end(); ++i) if ((*i)->GetModifier()->m_miscvalue & schoolMask) - AdvertisedBenefit += int32(GetTotalAttackPowerValue(BASE_ATTACK) * (*i)->GetModifier()->m_amount / 100.0f); + AdvertisedBenefit += int32(GetTotalAttackPowerValue(BASE_ATTACK) * (*i)->GetModifierValue() / 100.0f); } return AdvertisedBenefit; } @@ -9294,7 +9340,7 @@ int32 Unit::SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask, Unit *pVi AuraList const& mDamageTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_HEALING); for(AuraList::const_iterator i = mDamageTaken.begin();i != mDamageTaken.end(); ++i) if(((*i)->GetModifier()->m_miscvalue & schoolMask) != 0) - AdvertisedBenefit += (*i)->GetModifier()->m_amount; + AdvertisedBenefit += (*i)->GetModifierValue(); return AdvertisedBenefit; } @@ -9403,7 +9449,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT AuraList const& mDamageDoneCreature = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE); for(AuraList::const_iterator i = mDamageDoneCreature.begin();i != mDamageDoneCreature.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) - DoneFlatBenefit += (*i)->GetModifier()->m_amount; + DoneFlatBenefit += (*i)->GetModifierValue(); // ..done // SPELL_AURA_MOD_DAMAGE_DONE included in weapon damage @@ -9418,7 +9464,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT AuraList const& mCreatureAttackPower = GetAurasByType(SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS); for(AuraList::const_iterator i = mCreatureAttackPower.begin();i != mCreatureAttackPower.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) - APbonus += (*i)->GetModifier()->m_amount; + APbonus += (*i)->GetModifierValue(); } else { @@ -9428,7 +9474,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT AuraList const& mCreatureAttackPower = GetAurasByType(SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS); for(AuraList::const_iterator i = mCreatureAttackPower.begin();i != mCreatureAttackPower.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) - APbonus += (*i)->GetModifier()->m_amount; + APbonus += (*i)->GetModifierValue(); } if (APbonus!=0) // Can be negative @@ -9453,7 +9499,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT AuraList const& mDamageTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_TAKEN); for(AuraList::const_iterator i = mDamageTaken.begin();i != mDamageTaken.end(); ++i) if((*i)->GetModifier()->m_miscvalue & GetMeleeDamageSchoolMask()) - TakenFlatBenefit += (*i)->GetModifier()->m_amount; + TakenFlatBenefit += (*i)->GetModifierValue(); if(attType!=RANGED_ATTACK) TakenFlatBenefit += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN); @@ -9471,13 +9517,13 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT AuraList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS); for(AuraList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) - DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + DoneTotalMod *= ((*i)->GetModifierValue()+100.0f)/100.0f; // ..taken AuraList const& mModDamagePercentTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN); for(AuraList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i) if((*i)->GetModifier()->m_miscvalue & GetMeleeDamageSchoolMask()) - TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + TakenTotalMod *= ((*i)->GetModifierValue()+100.0f)/100.0f; // .. taken pct: dummy auras AuraList const& mDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY); @@ -9535,13 +9581,13 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT { AuraList const& mModMeleeDamageTakenPercent = pVictim->GetAurasByType(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT); for(AuraList::const_iterator i = mModMeleeDamageTakenPercent.begin(); i != mModMeleeDamageTakenPercent.end(); ++i) - TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + TakenTotalMod *= ((*i)->GetModifierValue()+100.0f)/100.0f; } else { AuraList const& mModRangedDamageTakenPercent = pVictim->GetAurasByType(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT); for(AuraList::const_iterator i = mModRangedDamageTakenPercent.begin(); i != mModRangedDamageTakenPercent.end(); ++i) - TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + TakenTotalMod *= ((*i)->GetModifierValue()+100.0f)/100.0f; } float tmpDamage = float(int32(*pdamage) + DoneFlatBenefit) * DoneTotalMod; diff --git a/src/game/Unit.h b/src/game/Unit.h index 75861f12b4a..7b2ddc22631 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1090,7 +1090,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); void RemoveAura(uint32 spellId, uint32 effindex, Aura* except = NULL); - void RemoveSingleAuraFromStack(uint32 spellId, uint32 effindex); + void RemoveSingleAuraFromStackByDispel(uint32 spellId); + void RemoveSingleAuraFromStack(uint32 spellId, uint32 effindex); void RemoveAurasDueToSpell(uint32 spellId, Aura* except = NULL); void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId); void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler); |