diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Level3.cpp | 2 | ||||
-rw-r--r-- | src/game/SharedDefines.h | 7 | ||||
-rw-r--r-- | src/game/Spell.cpp | 21 | ||||
-rw-r--r-- | src/game/SpellAuraDefines.h | 2 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 61 | ||||
-rw-r--r-- | src/game/SpellAuras.h | 9 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 64 | ||||
-rw-r--r-- | src/game/Unit.cpp | 493 | ||||
-rw-r--r-- | src/game/Unit.h | 3 | ||||
-rw-r--r-- | src/game/WorldSocket.cpp | 25 | ||||
-rw-r--r-- | src/shared/revision_nr.h | 2 |
11 files changed, 350 insertions, 339 deletions
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 74f012b55d7..7555e5eda9d 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -1292,7 +1292,7 @@ bool ChatHandler::HandleSetSkillCommand(const char* args) { // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r char* skill_p = extractKeyFromLink((char*)args,"Hskill"); - if(!skill_p) + if(!skill_p) return false; char *level_p = strtok (NULL, " "); diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 02c7fb6adc8..dc0b7e3dfa8 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -806,10 +806,9 @@ enum Targets { TARGET_SELF = 1, TARGET_UNIT_CASTER = 1, - TARGET_RANDOM_ENEMY_CHAIN_IN_AREA = 2, // only one spell has that, but regardless, it's a target type after all - //TARGET_UNIT_NEARBY_ENEMY - TARGET_UNIT_SINGLE_UNKNOWN = 3, - TARGET_UNIT_NEARBY_ALLY = 4, + TARGET_UNIT_NEARBY_ENEMY = 2, + TARGET_UNIT_NEARBY_ALLY = 3, + TARGET_UNIT_NEARBY_ALLY_UNK = 4, TARGET_PET = 5, TARGET_UNIT_PET = 5, TARGET_CHAIN_DAMAGE = 6, diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index f2f03249e22..af32b98a821 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -933,7 +933,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) if (crit) { procEx |= PROC_EX_CRITICAL_HIT; - addhealth = caster->SpellCriticalBonus(m_spellInfo, addhealth, NULL); + addhealth = caster->SpellCriticalHealingBonus(m_spellInfo, addhealth, NULL); } else procEx |= PROC_EX_NORMAL_HIT; @@ -1612,11 +1612,12 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) // nearby target case TARGET_UNIT_NEARBY_ALLY: + case TARGET_UNIT_NEARBY_ALLY_UNK: { if(Unit* pUnitTarget = SearchNearbyTarget(radius, SPELL_TARGETS_FRIENDLY)) TagUnitMap.push_back(pUnitTarget); }break; - case TARGET_RANDOM_ENEMY_CHAIN_IN_AREA: + case TARGET_UNIT_NEARBY_ENEMY: { if(EffectChainTarget <= 1) { @@ -2637,30 +2638,28 @@ void Spell::finish(bool ok) if (m_caster->GetTypeId() == TYPEID_PLAYER) ((Player*)m_caster)->RemoveSpellMods(this); - //handle SPELL_AURA_ADD_TARGET_TRIGGER auras + // handle SPELL_AURA_ADD_TARGET_TRIGGER auras Unit::AuraList const& targetTriggers = m_caster->GetAurasByType(SPELL_AURA_ADD_TARGET_TRIGGER); for(Unit::AuraList::const_iterator i = targetTriggers.begin(); i != targetTriggers.end(); ++i) { - SpellEntry const *auraSpellInfo = (*i)->GetSpellProto(); - uint32 auraSpellIdx = (*i)->GetEffIndex(); - if (IsAffectedByAura((*i))) - { - for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) - if( ihit->effectMask & (1<<auraSpellIdx) ) + if (!(*i)->isAffectedOnSpell(m_spellInfo)) + continue; + for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + if( ihit->missCondition == SPELL_MISS_NONE ) { // check m_caster->GetGUID() let load auras at login and speedup most often case Unit *unit = m_caster->GetGUID()== ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); if (unit && unit->isAlive()) { + SpellEntry const *auraSpellInfo = (*i)->GetSpellProto(); + uint32 auraSpellIdx = (*i)->GetEffIndex(); // Calculate chance at that moment (can be depend for example from combo points) int32 chance = m_caster->CalculateSpellDamage(auraSpellInfo, auraSpellIdx, (*i)->GetBasePoints(),unit); - if(roll_chance_i(chance)) for (int j=0; j != (*i)->GetStackAmount(); ++j) m_caster->CastSpell(unit, auraSpellInfo->EffectTriggerSpell[auraSpellIdx], true, NULL, (*i)); } } - } } // Heal caster for all health leech from all targets diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h index a958722b0f9..eb23306b5b1 100644 --- a/src/game/SpellAuraDefines.h +++ b/src/game/SpellAuraDefines.h @@ -94,7 +94,7 @@ enum AuraType SPELL_AURA_MOD_PARRY_PERCENT = 47, SPELL_AURA_MOD_DODGE_SKILL = 48, SPELL_AURA_MOD_DODGE_PERCENT = 49, - SPELL_AURA_MOD_BLOCK_SKILL = 50, + SPELL_AURA_MOD_CRITICAL_HEALING_BONUS = 50, SPELL_AURA_MOD_BLOCK_PERCENT = 51, SPELL_AURA_MOD_CRIT_PERCENT = 52, SPELL_AURA_PERIODIC_LEECH = 53, diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index c67fd23bdec..8af4f59124f 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -104,7 +104,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleAuraModParryPercent, // 47 SPELL_AURA_MOD_PARRY_PERCENT &Aura::HandleUnused, // 48 SPELL_AURA_MOD_DODGE_SKILL obsolete? &Aura::HandleAuraModDodgePercent, // 49 SPELL_AURA_MOD_DODGE_PERCENT - &Aura::HandleUnused, // 50 SPELL_AURA_MOD_BLOCK_SKILL obsolete? + &Aura::HandleNoImmediateEffect, // 50 SPELL_AURA_MOD_CRITICAL_HEALING_BONUS &Aura::HandleAuraModBlockPercent, // 51 SPELL_AURA_MOD_BLOCK_PERCENT &Aura::HandleAuraModCritPercent, // 52 SPELL_AURA_MOD_CRIT_PERCENT &Aura::HandlePeriodicLeech, // 53 SPELL_AURA_PERIODIC_LEECH @@ -337,7 +337,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNULL, //280 SPELL_AURA_MOD_TARGET_ARMOR_PCT &Aura::HandleNULL, //281 SPELL_AURA_MOD_HONOR_GAIN &Aura::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT - &Aura::HandleNULL //283 SPD/heal from AP? + &Aura::HandleNoImmediateEffect //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus }; Aura::Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem) : @@ -3974,40 +3974,6 @@ void Aura::HandleAuraPeriodicDummy(bool apply, bool Real) void Aura::HandlePeriodicHeal(bool apply, bool Real) { m_isPeriodic = apply; - - // For prevent double apply bonuses - bool loading = (m_target->GetTypeId() == TYPEID_PLAYER && ((Player*)m_target)->GetSession()->PlayerLoading()); - - if(!loading && apply) - { - switch (m_spellProto->SpellFamilyName) - { - case SPELLFAMILY_DRUID: - { - // Rejuvenation - if(m_spellProto->SpellFamilyFlags & 0x0000000000000010LL) - { - if(Unit* caster = GetCaster()) - { - Unit::AuraList const& classScripts = caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(Unit::AuraList::const_iterator k = classScripts.begin(); k != classScripts.end(); ++k) - { - int32 tickcount = GetSpellDuration(m_spellProto) / m_spellProto->EffectAmplitude[m_effIndex]; - switch((*k)->GetModifier()->m_miscvalue) - { - case 4953: // Increased Rejuvenation Healing - Harold's Rejuvenating Broach Aura - case 4415: // Increased Rejuvenation Healing - Idol of Rejuvenation Aura - { - m_modifier.m_amount += (*k)->GetModifier()->m_amount / tickcount; - break; - } - } - } - } - } - } - } - } } void Aura::HandlePeriodicDamage(bool apply, bool Real) @@ -4166,21 +4132,6 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) int32 holy = caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) + caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellProto), m_target); m_modifier.m_amount += int32(0.04f*holy + 0.04f*ap); - - // Improved Consecration - Libram of the Eternal Rest - Unit::AuraList const& classScripts = caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(Unit::AuraList::const_iterator k = classScripts.begin(); k != classScripts.end(); ++k) - { - switch((*k)->GetModifier()->m_miscvalue) - { - case 5147: - { - int32 tickcount = GetSpellDuration(m_spellProto) / m_spellProto->EffectAmplitude[m_effIndex]; - m_modifier.m_amount += (*k)->GetModifier()->m_amount / tickcount; - break; - } - } - } return; } // Seal of Vengeance 0.013*$SPH+0.025*$AP per tick (also can stack) @@ -5386,6 +5337,14 @@ void Aura::HandleSpiritOfRedemption( bool apply, bool Real ) void Aura::CleanupTriggeredSpells() { + if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR && m_spellProto->SpellFamilyFlags & 0x0000001000000020LL) + { + // Blood Frenzy remove + m_target->RemoveAurasDueToSpell(30069); + m_target->RemoveAurasDueToSpell(30070); + return; + } + uint32 tSpellId = m_spellProto->EffectTriggerSpell[GetEffIndex()]; if(!tSpellId) return; diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 863d46e4a6a..4cbb531ea6d 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -22,15 +22,6 @@ #include "SpellAuraDefines.h" -struct DamageManaShield -{ - uint32 m_spellId; - uint32 m_modType; - int32 m_schoolType; - uint32 m_totalAbsorb; - uint32 m_currAbsorb; -}; - struct Modifier { AuraType m_auraname; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 1cc4911a05a..107265d9432 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -474,38 +474,6 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) { damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.08f); } - // Starfire - else if ( m_spellInfo->SpellFamilyFlags & 0x0004LL ) - { - Unit::AuraList const& m_OverrideClassScript = m_caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(Unit::AuraList::const_iterator i = m_OverrideClassScript.begin(); i != m_OverrideClassScript.end(); ++i) - { - // Starfire Bonus (caster) - switch((*i)->GetModifier()->m_miscvalue) - { - case 5481: // Nordrassil Regalia - bonus - { - Unit::AuraList const& m_periodicDamageAuras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); - for(Unit::AuraList::const_iterator itr = m_periodicDamageAuras.begin(); itr != m_periodicDamageAuras.end(); ++itr) - { - // Moonfire or Insect Swarm (target debuff from any casters) - if ( (*itr)->GetSpellProto()->SpellFamilyFlags & 0x00200002LL ) - { - int32 mod = (*i)->GetModifier()->m_amount; - damage += damage*mod/100; - break; - } - } - break; - } - case 5148: //Improved Starfire - Ivory Idol of the Moongoddes Aura - { - damage += (*i)->GetModifier()->m_amount; - break; - } - } - } - } //Mangle Bonus for the initial damage of Lacerate and Rake if((m_spellInfo->SpellFamilyFlags==0x0000000000001000LL && m_spellInfo->SpellIconID==494) || (m_spellInfo->SpellFamilyFlags==0x0000010000000000LL && m_spellInfo->SpellIconID==2246)) @@ -1360,6 +1328,15 @@ void Spell::EffectDummy(uint32 i) m_caster->SetPower(POWER_RAGE,0); return; } + // Slam + if(m_spellInfo->SpellFamilyFlags & 0x0000000000200000LL) + { + if(!unitTarget) + return; + m_damage+=m_caster->CalculateDamage(m_attackType, false); + m_damage+=damage; + return; + } switch(m_spellInfo->Id) { // Warrior's Wrath @@ -1792,12 +1769,29 @@ void Spell::EffectDummy(uint32 i) } return; } - - if(m_spellInfo->Id == 39610) // Mana-Tide Totem effect + // Healing Stream Totem + if(m_spellInfo->SpellFamilyFlags & 0x0000000000002000LL) + { + m_caster->CastCustomSpell(unitTarget, 52042, &damage, 0, 0, true, 0, 0, m_originalCasterGUID); + return; + } + // Mana Spring Totem + if(m_spellInfo->SpellFamilyFlags & 0x0000000000004000LL) + { + if(unitTarget->getPowerType()!=POWER_MANA) + return; + m_caster->CastCustomSpell(unitTarget, 52032, &damage, 0, 0, true, 0, 0, m_originalCasterGUID); + return; + } + if(m_spellInfo->Id == 39610) // Mana Tide Totem effect { if(!unitTarget || unitTarget->getPowerType() != POWER_MANA) return; - + // Glyph of Mana Tide + Unit *owner = m_caster->GetOwner(); + if (owner) + if (Aura *dummy = owner->GetDummyAura(55441)) + damage+=dummy->GetModifier()->m_amount; // Regenerate 6% of Total Mana Every 3 secs int32 EffectBasePoints0 = unitTarget->GetMaxPower(POWER_MANA) * damage / 100; m_caster->CastCustomSpell(unitTarget,39609,&EffectBasePoints0,NULL,NULL,true,NULL,NULL,m_originalCasterGUID); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 608597174c8..7b5b9f09511 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1255,7 +1255,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 dama if (crit) { damageInfo->HitInfo|= SPELL_HIT_TYPE_CRIT; - damage = SpellCriticalBonus(spellInfo, damage, pVictim); + damage = SpellCriticalDamageBonus(spellInfo, damage, pVictim); // Resilience - reduce crit damage if (pVictim->GetTypeId()==TYPEID_PLAYER) damage -= ((Player*)pVictim)->GetSpellCritDamageReduction(damage); @@ -3707,65 +3707,36 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) for(int j = 0; j < 3; ++j) if (i_spellProto->EffectTriggerSpell[j] == spellProto->Id) is_triggered_by_spell = true; - if (is_triggered_by_spell) continue; - for(int j = 0; j < 3; ++j) - { - // prevent remove dummy triggered spells at next effect aura add - switch(spellProto->Effect[j]) // main spell auras added added after triggered spell - { - case SPELL_EFFECT_DUMMY: - switch(spellId) - { - case 5420: if(i_spellId==34123) is_triggered_by_spell = true; break; - } - break; - } + if (is_triggered_by_spell) + continue; - if(is_triggered_by_spell) - break; + // check if they can stack + bool sameCaster = Aur->GetCasterGUID() == (*i).second->GetCasterGUID(); + if(!spellmgr.IsNoStackSpellDueToSpell(spellId, i_spellId, sameCaster)) + continue; - // prevent remove form main spell by triggered passive spells - switch(i_spellProto->EffectApplyAuraName[j]) // main aura added before triggered spell - { - case SPELL_AURA_MOD_SHAPESHIFT: - switch(i_spellId) - { - case 24858: if(spellId==24905) is_triggered_by_spell = true; break; - case 33891: if(spellId==5420 || spellId==34123) is_triggered_by_spell = true; break; - case 34551: if(spellId==22688) is_triggered_by_spell = true; break; - } - break; - } - } + //some spells should be not removed by lower rank of them (totem, paladin aura) + if (!sameCaster + &&(spellProto->Effect[effIndex]==SPELL_EFFECT_APPLY_AREA_AURA_PARTY) + &&(spellProto->DurationIndex==21) + &&(spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId)) + &&(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0)) + return false; - if(!is_triggered_by_spell) + // Its a parent aura (create this aura in ApplyModifier) + if ((*i).second->IsInUse()) { - bool sameCaster = Aur->GetCasterGUID() == (*i).second->GetCasterGUID(); - if( spellmgr.IsNoStackSpellDueToSpell(spellId, i_spellId, sameCaster) ) - { - //some spells should be not removed by lower rank of them (totem, paladin aura) - if (!sameCaster - &&(spellProto->Effect[effIndex]==SPELL_EFFECT_APPLY_AREA_AURA_PARTY) - &&(spellProto->DurationIndex==21) - &&(spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId)) - &&(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0)) - return false; + sLog.outError("Aura (Spell %u Effect %u) is in process but attempt removed at aura (Spell %u Effect %u) adding, need add stack rule for Unit::RemoveNoStackAurasDueToAura", i->second->GetId(), i->second->GetEffIndex(),Aur->GetId(), Aur->GetEffIndex()); + continue; + } - // Its a parent aura (create this aura in ApplyModifier) - if ((*i).second->IsInUse()) - { - sLog.outError("Aura (Spell %u Effect %u) is in process but attempt removed at aura (Spell %u Effect %u) adding, need add stack rule for Unit::RemoveNoStackAurasDueToAura", i->second->GetId(), i->second->GetEffIndex(),Aur->GetId(), Aur->GetEffIndex()); - continue; - } - RemoveAurasDueToSpell(i_spellId); + RemoveAurasDueToSpell(i_spellId); - if( m_Auras.empty() ) - break; - else - next = m_Auras.begin(); - } - } + if( m_Auras.empty() ) + break; + else + next = m_Auras.begin(); } return true; } @@ -6775,7 +6746,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB if(!procSpell) return false; // For trigger from Blizzard need exist Improved Blizzard - if (procSpell->SpellFamilyName==SPELLFAMILY_MAGE && procSpell->SpellFamilyFlags & 0x0000000000000080) + if (procSpell->SpellFamilyName==SPELLFAMILY_MAGE && procSpell->SpellFamilyFlags & 0x0000000000000080LL) { bool found = false; AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); @@ -7630,71 +7601,24 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 if(!spellProto || !pVictim || damagetype==DIRECT_DAMAGE ) return pdamage; - //if(spellProto->SchoolMask == SPELL_SCHOOL_MASK_NORMAL) - // return pdamage; - //damage = CalcArmorReducedDamage(pVictim, damage); - - int32 BonusDamage = 0; - if( GetTypeId()==TYPEID_UNIT ) - { - // Pets just add their bonus damage to their spell damage - // note that their spell damage is just gain of their own auras - if (((Creature*)this)->isPet()) - { - BonusDamage = ((Pet*)this)->GetBonusDamage(); - } - // For totems get damage bonus from owner (statue isn't totem in fact) - else if (((Creature*)this)->isTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE) - { - if(Unit* owner = GetOwner()) - return owner->SpellDamageBonus(pVictim, spellProto, pdamage, damagetype); - } - } - - // Damage Done - uint32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); - - // Taken/Done fixed damage bonus auras - int32 DoneAdvertisedBenefit = SpellBaseDamageBonus(GetSpellSchoolMask(spellProto))+BonusDamage; - int32 TakenAdvertisedBenefit = SpellBaseDamageBonusForVictim(GetSpellSchoolMask(spellProto), pVictim); - - // Damage over Time spells bonus calculation - float DotFactor = 1.0f; - if(damagetype == DOT) + // For totems get damage bonus from owner (statue isn't totem in fact) + if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->isTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE) { - int32 DotDuration = GetSpellDuration(spellProto); - // 200% limit - if(DotDuration > 0) - { - if(DotDuration > 30000) DotDuration = 30000; - if(!IsChanneledSpell(spellProto)) DotFactor = DotDuration / 15000.0f; - int x = 0; - for(int j = 0; j < 3; j++) - { - if( spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && ( - spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE || - spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH) ) - { - x = j; - break; - } - } - int DotTicks = 6; - if(spellProto->EffectAmplitude[x] != 0) - DotTicks = DotDuration / spellProto->EffectAmplitude[x]; - if(DotTicks) - { - DoneAdvertisedBenefit /= DotTicks; - TakenAdvertisedBenefit /= DotTicks; - } - } + if(Unit* owner = GetOwner()) + return owner->SpellDamageBonus(pVictim, spellProto, pdamage, damagetype); } // Taken/Done total percent damage auras float DoneTotalMod = 1.0f; float TakenTotalMod = 1.0f; + uint32 DoneTotal = 0; + uint32 TakenTotal = 0; // ..done + // Pet damage + if( GetTypeId() == TYPEID_UNIT && !((Creature*)this)->isPet() ) + DoneTotalMod *= ((Creature*)this)->GetSpellDamageMod(((Creature*)this)->GetCreatureInfo()->rank); + AuraList const& mModDamagePercentDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); for(AuraList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) { @@ -7709,17 +7633,13 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 } uint32 creatureTypeMask = pVictim->GetCreatureTypeMask(); + // Add flat bonus from spell damage versus + DoneTotal += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS, creatureTypeMask); 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; - // ..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; - // done scripted mod (take it from owner) Unit *owner = GetOwner(); if (!owner) owner = this; @@ -7730,12 +7650,14 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 continue; switch((*i)->GetModifier()->m_miscvalue) { - // Molten Fury - case 4920: + case 4920: // Molten Fury case 4919: + case 6917: // Death's Embrace + case 6926: + case 6928: { if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) - TakenTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; + DoneTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; break; } // Soul Siphon @@ -7748,13 +7670,13 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 int32 stepPercent = CalculateSpellDamage((*i)->GetSpellProto(), 0, (*i)->GetSpellProto()->EffectBasePoints[0], this); // count affliction effects and calc additional damage in percentage int32 modPercent = 0; - Unit::AuraMap const& victimAuras = pVictim->GetAuras(); - for (Unit::AuraMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr) + AuraMap const& victimAuras = pVictim->GetAuras(); + for (AuraMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr) { SpellEntry const* m_spell = itr->second->GetSpellProto(); if (m_spell->SpellFamilyName != SPELLFAMILY_WARLOCK || !(m_spell->SpellFamilyFlags & 0x0004071B8044C402LL)) continue; - modPercent += stepPercent; + modPercent += stepPercent * itr->second->GetStackAmount(); if (modPercent >= maxPercent) { modPercent = maxPercent; @@ -7764,8 +7686,13 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 DoneTotalMod *= (modPercent+100.0f)/100.0f; break; } - // Starfire Bonus - case 5481: + case 6916: // Death's Embrace + case 6925: + case 6927: + if (HasAuraState(AURA_STATE_HEALTHLESS_20_PERCENT)) + DoneTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; + break; + case 5481: // Starfire Bonus { AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); for(AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) @@ -7784,11 +7711,11 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 case 4554: // Increased Lightning Damage case 4555: // Improved Moonfire case 5142: // Increased Lightning Damage - case 5147: // Improved Consecration + case 5147: // Improved Consecration / Libram of Resurgence case 5148: // Idol of the Shooting Star case 6008: // Increased Lightning Damage / Totem of Hex { - pdamage+=(*i)->GetModifier()->m_amount; + DoneTotal+=(*i)->GetModifier()->m_amount; break; } // Tundra Stalker @@ -7799,7 +7726,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 if ((*i)->GetSpellProto()->SpellIconID == 2656) { if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) - TakenTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; + DoneTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; } else // Tundra Stalker { @@ -7817,7 +7744,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 } break; } - case 7293: + case 7293: // Rage of Rivendare { AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); for(AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) @@ -7871,6 +7798,13 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 } } } + + // ..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; + // .. taken pct: dummy auras AuraList const& mDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY); for(AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) @@ -7889,19 +7823,6 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 TakenTotalMod *= (mod+100.0f)/100.0f; } break; - //This is changed in WLK, using aura 255 - // Mangle - /*case 2312: - case 44955: - for(int j=0;j<3;j++) - { - if(GetEffectMechanic(spellProto, j)==MECHANIC_BLEED) - { - TakenTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; - break; - } - } - break;*/ } } @@ -7921,6 +7842,49 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; } + // Damage Done from spell damage bonus + uint32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); + + // Taken/Done fixed damage bonus auras + int32 DoneAdvertisedBenefit = SpellBaseDamageBonus(GetSpellSchoolMask(spellProto)); + int32 TakenAdvertisedBenefit = SpellBaseDamageBonusForVictim(GetSpellSchoolMask(spellProto), pVictim); + + // Pets just add their bonus damage to their spell damage + // note that their spell damage is just gain of their own auras + if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet()) + DoneAdvertisedBenefit += ((Pet*)this)->GetBonusDamage(); + + // Damage over Time spells bonus calculation + float DotFactor = 1.0f; + if(damagetype == DOT) + { + int32 DotDuration = GetSpellDuration(spellProto); + // 200% limit + if(DotDuration > 0) + { + if(DotDuration > 30000) DotDuration = 30000; + if(!IsChanneledSpell(spellProto)) DotFactor = DotDuration / 15000.0f; + int x = 0; + for(int j = 0; j < 3; j++) + { + if( spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && ( + spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE || + spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH) ) + { + x = j; + break; + } + } + int DotTicks = 6; + if(spellProto->EffectAmplitude[x] != 0) + DotTicks = DotDuration / spellProto->EffectAmplitude[x]; + if(DotTicks) + { + DoneAdvertisedBenefit /= DotTicks; + TakenAdvertisedBenefit /= DotTicks; + } + } + } // Distribute Damage over multiple effects, reduce by AoE CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime ); @@ -8165,19 +8129,12 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 if(spellProto->SpellFamilyName && spellProto->SchoolMask != SPELL_SCHOOL_MASK_NORMAL) TakenActualBenefit *= ((float)CastingTime / 3500.0f); - float tmpDamage = (float(pdamage)+DoneActualBenefit)*DoneTotalMod; - - // Add flat bonus from spell damage versus - tmpDamage += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS, creatureTypeMask); - - // apply spellmod to Done damage + float tmpDamage = (float(pdamage)+DoneActualBenefit + DoneTotal)*DoneTotalMod; + // apply spellmod to Done damage (flat and pct) if(Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, tmpDamage); - tmpDamage = (tmpDamage+TakenActualBenefit)*TakenTotalMod; - - if( GetTypeId() == TYPEID_UNIT && !((Creature*)this)->isPet() ) - tmpDamage *= ((Creature*)this)->GetSpellDamageMod(((Creature*)this)->GetCreatureInfo()->rank); + tmpDamage = (tmpDamage + TakenActualBenefit + TakenTotal)*TakenTotalMod; return tmpDamage > 0 ? uint32(tmpDamage) : 0; } @@ -8275,30 +8232,38 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM // Modify by player victim resilience if (pVictim->GetTypeId() == TYPEID_PLAYER) crit_chance -= ((Player*)pVictim)->GetRatingBonusValue(CR_CRIT_TAKEN_SPELL); + // scripted (increase crit chance ... against ... target by x% - if(pVictim->isFrozen()) // Shatter + AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); + for(AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) { - AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) + if (!((*i)->isAffectedOnSpell(spellProto))) + continue; + switch((*i)->GetModifier()->m_miscvalue) { - switch((*i)->GetModifier()->m_miscvalue) - { - case 849: crit_chance+= 17.0f; break; //Shatter Rank 1 - case 910: crit_chance+= 34.0f; break; //Shatter Rank 2 - case 911: crit_chance+= 50.0f; break; //Shatter Rank 3 - } + case 849: if (pVictim->isFrozen()) crit_chance+= 17.0f; break; //Shatter Rank 1 + case 910: if (pVictim->isFrozen()) crit_chance+= 34.0f; break; //Shatter Rank 2 + case 911: if (pVictim->isFrozen()) crit_chance+= 50.0f; break; //Shatter Rank 3 + case 7917: // Glyph of Shadowburn + if (pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) + crit_chance+=(*i)->GetModifier()->m_amount; + break; + case 7997: // Renewed Hope + case 7998: + if (pVictim->HasAura(6788)) + crit_chance+=(*i)->GetModifier()->m_amount; + break; + case 21: // Test of Faith + case 6935: + case 6918: + if (pVictim->GetHealth() < pVictim->GetMaxHealth()/2) + crit_chance+=(*i)->GetModifier()->m_amount; + break; + default: + break; } } - // Glyph of Shadowburn - if (spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK && - spellProto->SpellFamilyFlags & 0x0000000000000080LL && - pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) - { - AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) - if((*i)->GetModifier()->m_miscvalue == 7917) - crit_chance+=(*i)->GetModifier()->m_amount; - } + // Sacred Shield if (spellProto->SpellFamilyName == SPELLFAMILY_PALADIN && spellProto->SpellFamilyFlags & 0x0000000040000000LL) @@ -8334,7 +8299,7 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM return false; } -uint32 Unit::SpellCriticalBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim) +uint32 Unit::SpellCriticalDamageBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim) { // Calculate critical bonus int32 crit_bonus; @@ -8366,6 +8331,36 @@ uint32 Unit::SpellCriticalBonus(SpellEntry const *spellProto, uint32 damage, Uni return damage; } +uint32 Unit::SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim) +{ + // Calculate critical bonus + int32 crit_bonus; + switch(spellProto->DmgClass) + { + case SPELL_DAMAGE_CLASS_MELEE: // for melee based spells is 100% + case SPELL_DAMAGE_CLASS_RANGED: + // TODO: write here full calculation for melee/ranged spells + crit_bonus = damage; + break; + default: + crit_bonus = damage / 2; // for spells is 50% + break; + } + + crit_bonus = int32(crit_bonus * GetTotalAuraMultiplier(SPELL_AURA_MOD_CRITICAL_HEALING_BONUS)); + + if(pVictim) + { + uint32 creatureTypeMask = pVictim->GetCreatureTypeMask(); + crit_bonus = int32(crit_bonus * GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, creatureTypeMask)); + } + + if(crit_bonus > 0) + damage += crit_bonus; + + return damage; +} + uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, DamageEffectType damagetype, Unit *pVictim) { // For totems get healing bonus from owner (statue isn't totem in fact) @@ -8383,33 +8378,101 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, spellProto->Id == 34299) return healamount; - int32 AdvertisedBenefit = SpellBaseHealingBonus(GetSpellSchoolMask(spellProto)); - uint32 CastingTime = GetSpellCastTime(spellProto); + // Taken/Done total percent damage auras + float DoneTotalMod = 1.0f; + float TakenTotalMod = 1.0f; + uint32 DoneTotal = 0; + uint32 TakenTotal = 0; - // Healing Taken - AdvertisedBenefit += SpellBaseHealingBonusForVictim(GetSpellSchoolMask(spellProto), pVictim); + // Healing done percent + AuraList const& mHealingDonePct = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT); + for(AuraList::const_iterator i = mHealingDonePct.begin();i != mHealingDonePct.end(); ++i) + DoneTotalMod *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f; - // Blessing of Light dummy effects healing taken from Holy Light and Flash of Light - if (spellProto->SpellFamilyName == SPELLFAMILY_PALADIN && (spellProto->SpellFamilyFlags & 0x00000000C0000000LL)) + // done scripted mod (take it from owner) + Unit *owner = GetOwner(); + if (!owner) owner = this; + AuraList const& mOverrideClassScript= owner->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); + for(AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) { - AuraList const& mDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY); - for(AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i) + if (!(*i)->isAffectedOnSpell(spellProto)) + continue; + switch((*i)->GetModifier()->m_miscvalue) { - if((*i)->GetSpellProto()->SpellVisual[0] == 9180) + case 4415: // Increased Rejuvenation Healing + case 4953: + case 3736: // Hateful Totem of the Third Wind / Increased Lesser Healing Wave / LK Arena (4/5/6) Totem of the Third Wind / Savage Totem of the Third Wind + DoneTotal+=(*i)->GetModifier()->m_amount; + break; + case 7997: // Renewed Hope + case 7998: + if (pVictim->HasAura(6788)) + DoneTotalMod *=((*i)->GetModifier()->m_amount + 100.0f)/100.0f; + break; + case 21: // Test of Faith + case 6935: + case 6918: + if (pVictim->GetHealth() < pVictim->GetMaxHealth()/2) + DoneTotalMod *=((*i)->GetModifier()->m_amount + 100.0f)/100.0f; + break; + case 7798: // Glyph of Regrowth + { + AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_HEAL); + for(AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + SpellEntry const* m_spell = (*itr)->GetSpellProto(); + if (m_spell->SpellFamilyName == SPELLFAMILY_DRUID && + m_spell->SpellFamilyFlags & 0x0000000000000040LL) + { + DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + break; + } + } + break; + } + case 8477: // Nourish Heal Boost + { + int32 stepPercent = (*i)->GetModifier()->m_amount; + int32 modPercent = 0; + AuraMap const& victimAuras = pVictim->GetAuras(); + for (AuraMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr) + { + if (itr->second->GetCasterGUID()!=GetGUID()) + continue; + SpellEntry const* m_spell = itr->second->GetSpellProto(); + if ( m_spell->SpellFamilyName != SPELLFAMILY_DRUID || + !(m_spell->SpellFamilyFlags & 0x0000001000000050LL)) + continue; + modPercent += stepPercent * itr->second->GetStackAmount(); + } + DoneTotalMod *= (modPercent+100.0f)/100.0f; + break; + } + case 7871: // Glyph of Lesser Healing Wave { - // Flash of Light - if ((spellProto->SpellFamilyFlags & 0x0000000040000000LL) && (*i)->GetEffIndex() == 1) - AdvertisedBenefit += (*i)->GetModifier()->m_amount; - // Holy Light - else if ((spellProto->SpellFamilyFlags & 0x0000000080000000LL) && (*i)->GetEffIndex() == 0) - AdvertisedBenefit += (*i)->GetModifier()->m_amount; + AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_DUMMY); + for(AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + if ((*itr)->GetCasterGUID()!=GetGUID()) + continue; + SpellEntry const* m_spell = (*itr)->GetSpellProto(); + if (m_spell->SpellFamilyName == SPELLFAMILY_SHAMAN && + m_spell->SpellFamilyFlags & 0x0000040000000000LL) + { + DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + break; + } + } + break; } + default: + break; } } - float ActualBenefit = 0.0f; - - if (AdvertisedBenefit != 0) + int32 DoneAdvertisedBenefit = SpellBaseHealingBonus(GetSpellSchoolMask(spellProto)); + int32 TakenAdvertisedBenefit = SpellBaseHealingBonusForVictim(GetSpellSchoolMask(spellProto), pVictim); + if (DoneAdvertisedBenefit != 0 && TakenAdvertisedBenefit!=0) { // Healing over Time spells float DotFactor = 1.0f; @@ -8436,9 +8499,13 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, if(spellProto->EffectAmplitude[x] != 0) DotTicks = DotDuration / spellProto->EffectAmplitude[x]; if(DotTicks) - AdvertisedBenefit /= DotTicks; + { + DoneAdvertisedBenefit /= DotTicks; + TakenAdvertisedBenefit /= DotTicks; + } } } + uint32 CastingTime = GetSpellCastTime(spellProto); // distribute healing to all effects, reduce AoE damage CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime ); @@ -8457,12 +8524,15 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, // Exception switch (spellProto->SpellFamilyName) { - case SPELLFAMILY_SHAMAN: + case SPELLFAMILY_GENERIC: // Healing stream from totem (add 6% per tick from hill bonus owner) - if (spellProto->SpellFamilyFlags & 0x000000002000LL) + // Possibly need do it on apply dummy aura + if (spellProto->Id == 52042) CastingTime = 210; + break; + case SPELLFAMILY_SHAMAN: // Earth Shield 30% per charge - else if (spellProto->SpellFamilyFlags & 0x40000000000LL) + if (spellProto->SpellFamilyFlags & 0x40000000000LL) CastingTime = 1050; break; case SPELLFAMILY_DRUID: @@ -8521,49 +8591,44 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, //SpellModSpellDamage /= 100.0f; CoefficientPtc /= 100.0f; - //ActualBenefit = (float)AdvertisedBenefit * ((float)CastingTime / 3500.0f) * DotFactor * SpellModSpellDamage * LvlPenalty; - ActualBenefit = (float)AdvertisedBenefit * CoefficientPtc * LvlPenalty; + DoneTotal += (float)DoneAdvertisedBenefit * CoefficientPtc * LvlPenalty; + TakenTotal += (float)TakenAdvertisedBenefit * CoefficientPtc * LvlPenalty; } // use float as more appropriate for negative values and percent applying - float heal = healamount + ActualBenefit; - - // TODO: check for ALL/SPELLS type - // 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; - + float heal = (healamount + DoneTotal)*DoneTotalMod; // apply spellmod to Done amount if(Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal); + // Taken mods // Healing Wave cast if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags & 0x0000000000000040LL) { - // Search for Healing Way on Victim (stack up to 3 time) - int32 pctMod = 0; + // Search for Healing Way on Victim Unit::AuraList const& auraDummy = pVictim->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator itr = auraDummy.begin(); itr!=auraDummy.end(); ++itr) if((*itr)->GetId() == 29203) - pctMod += (*itr)->GetModifier()->m_amount; - // Apply bonus - if (pctMod) - heal = heal * (100 + pctMod) / 100; + TakenTotalMod *= (*itr)->GetModifier()->m_amount; } // Healing taken percent float minval = pVictim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT); if(minval) - heal *= (100.0f + minval) / 100.0f; + TakenTotalMod *= (100.0f + minval) / 100.0f; float maxval = pVictim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT); if(maxval) - heal *= (100.0f + maxval) / 100.0f; + TakenTotalMod *= (100.0f + maxval) / 100.0f; + + AuraList const& mHealingGet= pVictim->GetAurasByType(SPELL_AURA_MOD_HEALING_RECEIVED); + for(AuraList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i) + if ((*i)->isAffectedOnSpell(spellProto)) + TakenTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f; - if (heal < 0) heal = 0; + heal = (heal + TakenTotal) * TakenTotalMod; - return uint32(heal); + return heal < 0 ? 0 : uint32(heal); } int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask) diff --git a/src/game/Unit.h b/src/game/Unit.h index 669bc8a405f..990e1fe020b 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1355,7 +1355,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject uint32 SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, DamageEffectType damagetype, Unit *pVictim); bool isSpellBlocked(Unit *pVictim, SpellEntry const *spellProto, WeaponAttackType attackType = BASE_ATTACK); bool isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK); - uint32 SpellCriticalBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim); + uint32 SpellCriticalDamageBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim); + uint32 SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim); void SetLastManaUse(uint32 spellCastTime) { m_lastManaUse = spellCastTime; } bool IsUnderLastManaUseEffect() const; diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index a25d05567b3..9e1737d13e1 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -793,17 +793,17 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) QueryResult *result = LoginDatabase.PQuery ("SELECT " - "id, " //0 - "gmlevel, " //1 - "sessionkey, " //2 - "last_ip, " //3 - "locked, " //4 - "sha_pass_hash, " //5 - "v, " //6 - "s, " //7 - "expansion, " //8 - "mutetime, " //9 - "locale " //10 + "id, " //0 + "gmlevel, " //1 + "sessionkey, " //2 + "last_ip, " //3 + "locked, " //4 + "sha_pass_hash, " //5 + "v, " //6 + "s, " //7 + "expansion, " //8 + "mutetime, " //9 + "locale " //10 "FROM account " "WHERE username = '%s'", safe_account.c_str ()); @@ -897,6 +897,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) id = fields[0].GetUInt32 (); security = fields[1].GetUInt16 (); + if(security > SEC_ADMINISTRATOR) // prevent invalid security settings in DB + security = SEC_ADMINISTRATOR; + K.SetHexStr (fields[2].GetString ()); time_t mutetime = time_t (fields[9].GetUInt64 ()); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7b21feb017a..71d4d56a995 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7187" + #define REVISION_NR "7190" #endif // __REVISION_NR_H__ |