diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/SharedDefines.h | 2 | ||||
-rw-r--r-- | src/game/Spell.cpp | 3 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 66 | ||||
-rw-r--r-- | src/game/SpellAuras.h | 1 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 78 | ||||
-rw-r--r-- | src/game/SpellMgr.cpp | 22 | ||||
-rw-r--r-- | src/game/SpellMgr.h | 3 | ||||
-rw-r--r-- | src/game/Unit.cpp | 32 |
8 files changed, 48 insertions, 159 deletions
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 56e3214538f..1a9d5e470a4 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -271,7 +271,7 @@ enum SpellCategory #define SPELL_ATTR_EX_UNK16 0x00010000 // 16 on immuniy #define SPELL_ATTR_EX_UNAUTOCASTABLE_BY_PET 0x00020000 // 17 #define SPELL_ATTR_EX_UNK18 0x00040000 // 18 -#define SPELL_ATTR_EX_UNK19 0x00080000 // 19 +#define SPELL_ATTR_EX_CANT_TARGET_SELF 0x00080000 // 19 Applies only to unit target - for example Divine Intervention (19752) #define SPELL_ATTR_EX_REQ_COMBO_POINTS1 0x00100000 // 20 Req combo points on target #define SPELL_ATTR_EX_UNK21 0x00200000 // 21 #define SPELL_ATTR_EX_REQ_COMBO_POINTS2 0x00400000 // 22 Req combo points on target diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index a501f83710d..090749b32db 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4341,6 +4341,9 @@ SpellCastResult Spell::CheckCast(bool strict) if(m_spellInfo->excludeTargetAuraSpell && target->HasAura(m_spellInfo->excludeTargetAuraSpell)) return SPELL_FAILED_TARGET_AURASTATE; + if(target == m_caster && m_spellInfo->AttributesEx & SPELL_ATTR_EX_CANT_TARGET_SELF) + return SPELL_FAILED_BAD_TARGETS; + if(target != m_caster) { // target state requirements (apply to non-self only), to allow cast affects to self like Dirty Deeds diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index c0b130b6bdf..c10f8a47b4d 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -4606,7 +4606,7 @@ void AuraEffect::HandlePeriodicEnergize(bool apply, bool Real, bool changeAmount if (m_spellProto->SpellIconID == 3184 && m_spellProto->SpellVisual[0] == 12495) m_amount = m_target->GetMaxPower(POWER_MANA) * 25 / 10000; else if (m_spellProto->Id == 29166) // Innervate - m_amount = m_target->GetCreatePowers(POWER_MANA) * m_amount / ((GetParentAura()->GetAuraMaxDuration() / 10.0f) * (m_amplitude / IN_MILISECONDS)); + m_amount = m_target->GetCreatePowers(POWER_MANA) * m_amount / (GetTotalTicks() * 100.0f); } } @@ -4702,17 +4702,6 @@ void AuraEffect::HandlePeriodicDamage(bool apply, bool Real, bool changeAmount) switch (m_spellProto->SpellFamilyName) { - case SPELLFAMILY_GENERIC: - { - // Pounce Bleed - if ( m_spellProto->SpellIconID == 147 && m_spellProto->SpellVisual[0] == 0 ) - { - // $AP*0.18/6 bonus per tick - m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 3 / 100); - return; - } - break; - } case SPELLFAMILY_WARRIOR: { // Rend @@ -4741,20 +4730,6 @@ void AuraEffect::HandlePeriodicDamage(bool apply, bool Real, bool changeAmount) } case SPELLFAMILY_DRUID: { - // Rake - if (m_spellProto->SpellFamilyFlags[0] & 0x1000) - { - // $AP*0.18 bonus per tick - m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 18 / 100); - return; - } - // Lacerate - if (m_spellProto->SpellFamilyFlags[1] & 0x0000000100) - { - // $AP*0.05/5 bonus per tick - m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100); - return; - } // Rip if (m_spellProto->SpellVisual[0] == 3941) { @@ -4777,13 +4752,6 @@ void AuraEffect::HandlePeriodicDamage(bool apply, bool Real, bool changeAmount) m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * cp / 100); return; } - // Lock Jaw - if (m_spellProto->SpellFamilyFlags[1] & 0x10000000) - { - // 0.15*$AP - m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 15 / 100); - return; - } break; } case SPELLFAMILY_ROGUE: @@ -4804,38 +4772,6 @@ void AuraEffect::HandlePeriodicDamage(bool apply, bool Real, bool changeAmount) m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * AP_per_combo[cp]); return; } - // Garrote - if (m_spellProto->SpellFamilyFlags[0] & 0x100) - { - // $AP*0.07 bonus per tick - m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 7 / 100); - return; - } - // Deadly Poison - if (m_spellProto->SpellFamilyFlags[0] & 0x10000) - { - // 0.08*$AP / 4 * amount of stack - m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 2 * GetParentAura()->GetStackAmount() / 100); - return; - } - break; - } - case SPELLFAMILY_HUNTER: - { - // Serpent Sting - if (m_spellProto->SpellFamilyFlags[0] & 0x4000) - { - // $RAP*0.1/5 bonus per tick - m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 10 / 500); - return; - } - // Immolation Trap - if (m_spellProto->SpellFamilyFlags[0] & 0x4 && m_spellProto->SpellIconID == 678) - { - // $RAP*0.1/5 bonus per tick - m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 10 / 500); - return; - } break; } default: diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index db747da3c54..4c37eeb121f 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -353,6 +353,7 @@ class TRINITY_DLL_SPEC AuraEffect virtual void Update(uint32 diff); uint32 GetTickNumber() const { return m_tickNumber; } + int32 GetTotalTicks () const { return m_amplitude ? (GetParentAura()->GetAuraMaxDuration() / m_amplitude) : 1;} bool IsAreaAura() const { return m_isAreaAura; } bool IsPeriodic() const { return m_isPeriodic; } bool IsPersistent() const { return m_isPersistent; } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index ebf0037781d..bd0b1766acb 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -386,13 +386,6 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) damage = 200; break; } - // Intercept (warrior spell trigger) - case 20253: - case 61491: - { - damage+= uint32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.12f); - break; - } // arcane charge. must only affect demons (also undead?) case 45072: { @@ -426,9 +419,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) { // Bloodthirst if(m_spellInfo->SpellFamilyFlags[1] & 0x400) - { damage = uint32(damage * (m_caster->GetTotalAttackPowerValue(BASE_ATTACK)) / 100); - } // Shield Slam else if(m_spellInfo->SpellFamilyFlags[1] & 0x200 && m_spellInfo->Category==1209) damage += int32(m_caster->GetShieldBlockValue()); @@ -438,12 +429,6 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) damage = uint32(damage * m_caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100); m_caster->ModifyAuraState(AURA_STATE_WARRIOR_VICTORY_RUSH, false); } - // Revenge ${$m1+$AP*0.207} to ${$M1+$AP*0.207} - else if(m_spellInfo->SpellFamilyFlags[0] & 0x400) - damage+= uint32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.207f); - // Heroic Throw ${$m1+$AP*.50} - else if(m_spellInfo->SpellFamilyFlags[1] & 0x00000001) - damage+= uint32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.5f); // Shockwave ${$m3/100*$AP} else if(m_spellInfo->SpellFamilyFlags[1] & 0x00008000) { @@ -452,12 +437,6 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) damage+= int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * pct / 100); break; } - // Thunder Clap - else if(m_spellInfo->SpellFamilyFlags[0] & 0x80) - { - damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 12 / 100); - break; - } break; } case SPELLFAMILY_WARLOCK: @@ -520,17 +499,6 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) damage += int32(energy * multiple); damage += int32(((Player*)m_caster)->GetComboPoints() * ap * 7 / 100); } - // Rake - else if(m_spellInfo->SpellFamilyFlags[0] & 0x1000 && m_spellInfo->Effect[2]==SPELL_EFFECT_ADD_COMBO_POINTS) - { - // $AP*0.01 bonus - damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100); - } - // Swipe - else if(m_spellInfo->SpellFamilyFlags[1] & 0x00100000) - { - damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.08f); - } break; } case SPELLFAMILY_ROGUE: @@ -582,53 +550,14 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) damage += combo*40; } } - // Gouge - else if(m_spellInfo->SpellFamilyFlags[0] & 0x8) - { - damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.21f); - } - // Instant Poison - else if(m_spellInfo->SpellFamilyFlags[0] & 0x2000) - { - damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.10f); - } - // Wound Poison - else if(m_spellInfo->SpellFamilyFlags[0] & 0x10000000) - { - damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.04f); - } break; } case SPELLFAMILY_HUNTER: { - // Gore - if (m_spellInfo->SpellIconID == 1578) - { - damage+= rand()%2 ? damage : 0; - } - // Mongoose Bite - else if((m_spellInfo->SpellFamilyFlags[0] & 0x2) && m_spellInfo->SpellVisual[0]==342) - { - damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.2f); - } - // Counterattack - else if(m_spellInfo->SpellFamilyFlags[1] & 0x00080000) - { - damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.2f); - } - // Arcane Shot - else if((m_spellInfo->SpellFamilyFlags[0] & 0x00000800) && m_spellInfo->maxLevel > 0) - { - damage += int32(m_caster->GetTotalAttackPowerValue(RANGED_ATTACK)*0.15f); - } // Steady Shot - else if(m_spellInfo->SpellFamilyFlags[1] & 0x1) + if(m_spellInfo->SpellFamilyFlags[1] & 0x1) { - int32 base = irand((int32)m_caster->GetWeaponDamageRange(RANGED_ATTACK, MINDAMAGE),(int32)m_caster->GetWeaponDamageRange(RANGED_ATTACK, MAXDAMAGE)); - damage += int32(float(base)/m_caster->GetAttackTime(RANGED_ATTACK)*2800 + m_caster->GetTotalAttackPowerValue(RANGED_ATTACK)*0.1f); - bool found = false; - // check dazed affect Unit::AuraEffectList const& decSpeedList = unitTarget->GetAurasByType(SPELL_AURA_MOD_DECREASE_SPEED); for(Unit::AuraEffectList::const_iterator iter = decSpeedList.begin(); iter != decSpeedList.end(); ++iter) @@ -644,11 +573,6 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) if(found) damage += m_spellInfo->EffectBasePoints[1]; } - // Explosive Trap Effect - else if(m_spellInfo->SpellFamilyFlags[0] & 0x00000004) - { - damage += int32(m_caster->GetTotalAttackPowerValue(RANGED_ATTACK)*0.1f); - } break; } case SPELLFAMILY_PALADIN: diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index eecfcb6b1c8..0002e967304 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1228,8 +1228,8 @@ void SpellMgr::LoadSpellBonusess() { mSpellBonusMap.clear(); // need for reload case uint32 count = 0; - // 0 1 2 3 - QueryResult *result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus FROM spell_bonus_data"); + // 0 1 2 3 4 + QueryResult *result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data"); if( !result ) { barGoLink bar( 1 ); @@ -1258,8 +1258,10 @@ void SpellMgr::LoadSpellBonusess() sbe.direct_damage = fields[1].GetFloat(); sbe.dot_damage = fields[2].GetFloat(); sbe.ap_bonus = fields[3].GetFloat(); + sbe.ap_dot_bonus = fields[4].GetFloat(); mSpellBonusMap[entry] = sbe; + ++count; } while( result->NextRow() ); delete result; @@ -1281,12 +1283,14 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr /* Check Periodic Auras - * Both hots and dots can trigger if spell has no PROC_FLAG_SUCCESSFUL_DAMAGING_SPELL_HIT - nor PROC_FLAG_SUCCESSFUL_HEALING_SPELL + *Dots can trigger if spell has no PROC_FLAG_SUCCESSFUL_NEGATIVE_MAGIC_SPELL + nor PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL + + *Only Hots can trigger if spell has PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL - *Only Hots can trigger if spell has PROC_FLAG_SUCCESSFUL_HEALING_SPELL + *Only dots can trigger if spell has both positivity flags or PROC_FLAG_SUCCESSFUL_NEGATIVE_MAGIC_SPELL - *Only dots can trigger if spell has both positivity flags or PROC_FLAG_SUCCESSFUL_DAMAGING_SPELL_HIT + *Aura has to have PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL or spellfamily specified to trigger from Hot */ @@ -1300,6 +1304,8 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr else if (EventProcFlag & PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL && !(procExtra & PROC_EX_INTERNAL_HOT)) return false; + else if (procExtra & PROC_EX_INTERNAL_HOT) + procExtra |= PROC_EX_INTERNAL_REQ_FAMILY; } if (procFlags & PROC_FLAG_ON_TAKE_PERIODIC) @@ -1312,6 +1318,8 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr else if (EventProcFlag & PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL && !(procExtra & PROC_EX_INTERNAL_HOT)) return false; + else if (procExtra & PROC_EX_INTERNAL_HOT) + procExtra |= PROC_EX_INTERNAL_REQ_FAMILY; } // Trap casts are active by default if (procFlags & PROC_FLAG_ON_TRAP_ACTIVATION) @@ -1356,7 +1364,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr } } - if (procExtra & (PROC_EX_INTERNAL_REQ_FAMILY | PROC_EX_INTERNAL_HOT)) + if (procExtra & (PROC_EX_INTERNAL_REQ_FAMILY)) { if (!hasFamilyMask) return false; diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index fe5da3cda55..da23bddc4af 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -322,7 +322,7 @@ inline bool IsAutoRepeatRangedSpell(SpellEntry const* spellInfo) inline bool IsRangedWeaponSpell(SpellEntry const* spellInfo) { //spell->DmgClass == SPELL_DAMAGE_CLASS_RANGED should be checked outside - return (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER) // for 53352, cannot find better way + return (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && !(spellInfo->SpellFamilyFlags[1] & 0x100000000)) // for 53352, cannot find better way || (spellInfo->EquippedItemSubClassMask & ITEM_SUBCLASS_MASK_WEAPON_RANGED); } @@ -500,6 +500,7 @@ struct SpellBonusEntry float direct_damage; float dot_damage; float ap_bonus; + float ap_dot_bonus; }; typedef UNORDERED_MAP<uint32, SpellProcEventEntry> SpellProcEventMap; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index c6154ab0853..15a52ff62f6 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9320,21 +9320,29 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 DoneAdvertisedBenefit += ((Guardian*)this)->GetBonusDamage(); // Check for table values - float coeff; + float coeff = 0; SpellBonusEntry const* bonus = spellmgr.GetSpellBonusData(spellProto->Id); if (bonus) { if (damagetype == DOT) + { coeff = bonus->dot_damage; + if (bonus->ap_dot_bonus > 0) + DoneTotal+=bonus->ap_dot_bonus * stack * ApCoeffMod * GetTotalAttackPowerValue( + (IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK); + } else + { coeff = bonus->direct_damage; - if (bonus->ap_bonus) - DoneTotal+=bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK) * stack * ApCoeffMod; + if (bonus->ap_bonus > 0) + DoneTotal+=bonus->ap_dot_bonus * stack * ApCoeffMod * GetTotalAttackPowerValue( + (IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK); + } } // Default calculation if (DoneAdvertisedBenefit || TakenAdvertisedBenefit) { - if(!bonus) + if(!bonus || coeff < 0) { // Damage Done from spell damage bonus int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); @@ -9787,16 +9795,24 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint // Check for table values SpellBonusEntry const* bonus = !scripted ? spellmgr.GetSpellBonusData(spellProto->Id) : NULL; - float coeff; + float coeff = 0; float factorMod = 1.0f; if (bonus) { if (damagetype == DOT) + { coeff = bonus->dot_damage; + if (bonus->ap_dot_bonus > 0) + DoneTotal+=bonus->ap_dot_bonus * stack * GetTotalAttackPowerValue( + (IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK); + } else + { coeff = bonus->direct_damage; - if (bonus->ap_bonus) - DoneTotal+=bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK) * stack; + if (bonus->ap_bonus > 0) + DoneTotal+=bonus->ap_dot_bonus * stack * GetTotalAttackPowerValue( + (IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK); + } } else // scripted bonus { @@ -9830,7 +9846,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint // Default calculation if (DoneAdvertisedBenefit || TakenAdvertisedBenefit) { - if(!bonus && !scripted) + if((!bonus && !scripted) || coeff < 0) { // Damage Done from spell damage bonus int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); |