diff options
-rw-r--r-- | sql/updates/world/3.3.5/2018_99_99_99_world_21395.sql | 17 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 15 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 2 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 12 | ||||
-rw-r--r-- | src/server/game/Spells/SpellInfo.h | 1 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 6 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.h | 5 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_dk.cpp | 3 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_druid.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_hunter.cpp | 5 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_mage.cpp | 1 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_paladin.cpp | 6 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_priest.cpp | 3 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_shaman.cpp | 6 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_warrior.cpp | 3 |
15 files changed, 36 insertions, 51 deletions
diff --git a/sql/updates/world/3.3.5/2018_99_99_99_world_21395.sql b/sql/updates/world/3.3.5/2018_99_99_99_world_21395.sql new file mode 100644 index 00000000000..a62409266c1 --- /dev/null +++ b/sql/updates/world/3.3.5/2018_99_99_99_world_21395.sql @@ -0,0 +1,17 @@ +DELETE FROM `spell_custom_attr` WHERE `entry` IN (50536, 71023, 63468, 12654, 61840, 54203, 64891, 27813, 27817, 27818, 70772, 64930, 71824, 70809, 12721); +INSERT INTO `spell_custom_attr` (`entry`, `attributes`) VALUES +(50536, 2048), -- Unholy Blight +(71023, 2048), -- Languish +(63468, 2048), -- Piercing Shots +(12654, 2048), -- Ignite +(61840, 2048), -- Righteous Vengeance +(54203, 2048), -- Sheath of Light +(64891, 2048), -- Holy Mending +(27813, 2048), -- Blessed Recovery (Rank 1) +(27817, 2048), -- Blessed Recovery (Rank 2) +(27818, 2048), -- Blessed Recovery (Rank 3) +(70772, 2048), -- Blessed Healing +(64930, 2048), -- Electrified +(71824, 2048), -- Lava Burst Bonus +(70809, 2048), -- Chained Heal +(12721, 2048); -- Deep Wounds diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index c8610ab2eef..5989a95df35 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -12967,21 +12967,6 @@ void Unit::OutDebugInfo() const TC_LOG_DEBUG("entities.unit", "On vehicle %u.", GetVehicleBase()->GetEntry()); } -uint32 Unit::GetRemainingPeriodicAmount(ObjectGuid caster, uint32 spellId, AuraType auraType, uint8 effectIndex) const -{ - uint32 amount = 0; - AuraEffectList const& periodicAuras = GetAuraEffectsByType(auraType); - for (AuraEffect const* aurEff : periodicAuras) - { - if (aurEff->GetCasterGUID() != caster || aurEff->GetId() != spellId || aurEff->GetEffIndex() != effectIndex || !aurEff->GetTotalTicks()) - continue; - amount += uint32((aurEff->GetAmount() * static_cast<int32>(aurEff->GetRemainingTicks())) / aurEff->GetTotalTicks()); - break; - } - - return amount; -} - void Unit::SendClearTarget() { WorldPacket data(SMSG_BREAK_TARGET, GetPackGUID().size()); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index c5a1f02c1a7..c129aab8296 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1504,8 +1504,6 @@ class TC_GAME_API Unit : public WorldObject uint32 GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const; float CalculateDefaultCoefficient(SpellInfo const* spellInfo, DamageEffectType damagetype) const; - uint32 GetRemainingPeriodicAmount(ObjectGuid caster, uint32 spellId, AuraType auraType, uint8 effectIndex = 0) const; - void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply); virtual bool IsImmunedToSpell(SpellInfo const* spellInfo, WorldObject const* caster) const; uint32 GetSchoolImmunityMask() const; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 0db545aa67b..69ea2a8d3f8 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -43,6 +43,7 @@ #include "Util.h" #include "Vehicle.h" #include "WorldPacket.h" +#include <numeric> // // EFFECT HANDLER NOTES @@ -518,6 +519,17 @@ int32 AuraEffect::CalculateAmount(Unit* caster) } } + if (GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_ROLLING_PERIODIC)) + { + Unit::AuraEffectList const& periodicAuras = GetBase()->GetUnitOwner()->GetAuraEffectsByType(GetAuraType()); + amount = std::accumulate(std::begin(periodicAuras), std::end(periodicAuras), amount, [this](int32 val, AuraEffect const* aurEff) + { + if (aurEff->GetCasterGUID() == GetCasterGUID() && aurEff->GetId() == GetId() && aurEff->GetEffIndex() == GetEffIndex() && aurEff->GetTotalTicks() > 0) + val += aurEff->GetAmount() * static_cast<int32>(aurEff->GetRemainingTicks()) / static_cast<int32>(aurEff->GetTotalTicks()); + return val; + }); + } + GetBase()->CallScriptEffectCalcAmountHandlers(this, amount, m_canBeRecalculated); amount *= GetBase()->GetStackAmount(); return amount; diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index a0089b7eb7f..7aa07194958 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -186,6 +186,7 @@ enum SpellCustomAttributes SPELL_ATTR0_CU_DIRECT_DAMAGE = 0x00000100, SPELL_ATTR0_CU_CHARGE = 0x00000200, SPELL_ATTR0_CU_PICKPOCKET = 0x00000400, + SPELL_ATTR0_CU_ROLLING_PERIODIC = 0x00000800, SPELL_ATTR0_CU_NEGATIVE_EFF0 = 0x00001000, SPELL_ATTR0_CU_NEGATIVE_EFF1 = 0x00002000, SPELL_ATTR0_CU_NEGATIVE_EFF2 = 0x00004000, diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index bea1c1b5da3..cc6812a0ea8 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -21,6 +21,7 @@ #include "BattlefieldWG.h" #include "BattlegroundMgr.h" #include "Chat.h" +#include "Containers.h" #include "DatabaseEnv.h" #include "DBCStores.h" #include "Log.h" @@ -640,10 +641,9 @@ bool SpellMgr::IsArenaAllowedEnchancment(uint32 ench_id) const return mEnchantCustomAttr[ench_id]; } -const std::vector<int32>* SpellMgr::GetSpellLinked(int32 spell_id) const +std::vector<int32> const* SpellMgr::GetSpellLinked(int32 spell_id) const { - SpellLinkedMap::const_iterator itr = mSpellLinkedMap.find(spell_id); - return itr != mSpellLinkedMap.end() ? &(itr->second) : nullptr; + return Trinity::Containers::MapGetValuePtr(mSpellLinkedMap, spell_id); } PetLevelupSpellSet const* SpellMgr::GetPetLevelupSpellList(uint32 petFamily) const diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index 698234e2da2..59117c66498 100644 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -553,12 +553,11 @@ struct PetDefaultSpellsEntry // < 0 for petspelldata id, > 0 for creature_id typedef std::map<int32, PetDefaultSpellsEntry> PetDefaultSpellsMap; -typedef std::vector<uint32> SpellCustomAttribute; typedef std::vector<bool> EnchantCustomAttribute; typedef std::vector<SpellInfo*> SpellInfoMap; -typedef std::map<int32, std::vector<int32> > SpellLinkedMap; +typedef std::unordered_map<int32, std::vector<int32>> SpellLinkedMap; bool IsPrimaryProfessionSkill(uint32 skill); @@ -648,7 +647,7 @@ class TC_GAME_API SpellMgr SpellEnchantProcEntry const* GetSpellEnchantProcEvent(uint32 enchId) const; bool IsArenaAllowedEnchancment(uint32 ench_id) const; - const std::vector<int32> *GetSpellLinked(int32 spell_id) const; + std::vector<int32> const* GetSpellLinked(int32 spell_id) const; PetLevelupSpellSet const* GetPetLevelupSpellList(uint32 petFamily) const; PetDefaultSpellsEntry const* GetPetDefaultSpellsEntry(int32 id) const; diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index deddf88b3dc..9d79f6d2398 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -2463,9 +2463,6 @@ class spell_dk_unholy_blight : public SpellScriptLoader ASSERT(spellInfo->GetMaxTicks() > 0); amount /= spellInfo->GetMaxTicks(); - // Add remaining ticks to healing done - amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_DK_UNHOLY_BLIGHT_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE); - CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); caster->CastSpell(target, SPELL_DK_UNHOLY_BLIGHT_DAMAGE, args); diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 1a0ffe8318a..61db9b82bc5 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -2111,8 +2111,6 @@ class spell_dru_t10_balance_4p_bonus : public SpellScriptLoader ASSERT(spellInfo->GetMaxTicks() > 0); amount /= spellInfo->GetMaxTicks(); - // Add remaining ticks to damage done - amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_DRUID_LANGUISH, SPELL_AURA_PERIODIC_DAMAGE); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index b27267571d8..69b48fde85d 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -1091,12 +1091,9 @@ public: if (DamageInfo* dmgInfo = eventInfo.GetDamageInfo()) { SpellInfo const* piercingShots = sSpellMgr->AssertSpellInfo(SPELL_HUNTER_PIERCING_SHOTS); - int32 duration = piercingShots->GetMaxDuration(); - uint32 amplitude = piercingShots->Effects[EFFECT_0].Amplitude; uint32 dmg = dmgInfo->GetDamage(); - uint32 bp = CalculatePct(int32(dmg), aurEff->GetAmount()) / (duration / int32(amplitude)); - bp += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_HUNTER_PIERCING_SHOTS, SPELL_AURA_PERIODIC_DAMAGE); + int32 bp = CalculatePct(int32(dmg), aurEff->GetAmount()) / static_cast<int32>(piercingShots->GetMaxTicks()); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(bp); diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 0c122bfc685..a8b719afb93 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -995,7 +995,6 @@ class spell_mage_ignite : public SpellScriptLoader ASSERT(igniteDot->GetMaxTicks() > 0); int32 amount = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), pct) / igniteDot->GetMaxTicks()); - amount += eventInfo.GetProcTarget()->GetRemainingPeriodicAmount(eventInfo.GetActor()->GetGUID(), SPELL_MAGE_IGNITE, SPELL_AURA_PERIODIC_DAMAGE); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 928be5a79a6..1eb5ca247a6 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -1838,8 +1838,6 @@ class spell_pal_righteous_vengeance : public SpellScriptLoader ASSERT(spellInfo->GetMaxTicks() > 0); amount /= spellInfo->GetMaxTicks(); - // Add remaining ticks to damage done - amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_PALADIN_RIGHTEOUS_VENGEANCE_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); @@ -2221,8 +2219,6 @@ class spell_pal_sheath_of_light : public SpellScriptLoader ASSERT(spellInfo->GetMaxTicks() > 0); amount /= spellInfo->GetMaxTicks(); - // Add remaining ticks to healing done - amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_PALADIN_SHEATH_OF_LIGHT_HEAL, SPELL_AURA_PERIODIC_HEAL); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); @@ -2339,8 +2335,6 @@ class spell_pal_t8_2p_bonus : public SpellScriptLoader ASSERT(spellInfo->GetMaxTicks() > 0); amount /= spellInfo->GetMaxTicks(); - // Add remaining ticks to healing done - amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_PALADIN_HOLY_MENDING, SPELL_AURA_PERIODIC_HEAL); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index aa8b5a5f91d..fc9991a55ae 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -177,7 +177,6 @@ public: ASSERT(triggerInfo->GetMaxTicks() > 0); bp /= triggerInfo->GetMaxTicks(); - bp += target->GetRemainingPeriodicAmount(target->GetGUID(), triggerSpell, SPELL_AURA_PERIODIC_HEAL); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(bp); @@ -1403,10 +1402,8 @@ class spell_pri_t10_heal_2p_bonus : public SpellScriptLoader ASSERT(spellInfo->GetMaxTicks() > 0); amount /= spellInfo->GetMaxTicks(); - // Add remaining ticks to healing done Unit* caster = eventInfo.GetActor(); Unit* target = eventInfo.GetProcTarget(); - amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_PRIEST_BLESSED_HEALING, SPELL_AURA_PERIODIC_HEAL); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index a01be4e24f6..e4519b03404 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -2079,10 +2079,8 @@ class spell_sha_t8_elemental_4p_bonus : public SpellScriptLoader ASSERT(spellInfo->GetMaxTicks() > 0); amount /= spellInfo->GetMaxTicks(); - // Add remaining ticks to damage done Unit* caster = eventInfo.GetActor(); Unit* target = eventInfo.GetProcTarget(); - amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_SHAMAN_ELECTRIFIED, SPELL_AURA_PERIODIC_DAMAGE); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); @@ -2130,10 +2128,8 @@ class spell_sha_t9_elemental_4p_bonus : public SpellScriptLoader ASSERT(spellInfo->GetMaxTicks() > 0); amount /= spellInfo->GetMaxTicks(); - // Add remaining ticks to damage done Unit* caster = eventInfo.GetActor(); Unit* target = eventInfo.GetProcTarget(); - amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_SHAMAN_LAVA_BURST_BONUS_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); @@ -2226,10 +2222,8 @@ class spell_sha_t10_restoration_4p_bonus : public SpellScriptLoader ASSERT(spellInfo->GetMaxTicks() > 0); amount /= spellInfo->GetMaxTicks(); - // Add remaining ticks to healing done Unit* caster = eventInfo.GetActor(); Unit* target = eventInfo.GetProcTarget(); - amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_SHAMAN_CHAINED_HEAL, SPELL_AURA_PERIODIC_HEAL); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index bb787d828ac..339b5cb2f42 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -296,9 +296,6 @@ class spell_warr_deep_wounds : public SpellScriptLoader ASSERT(spellInfo->GetMaxTicks() > 0); damage /= spellInfo->GetMaxTicks(); - // Add remaining ticks to damage done - damage += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_WARRIOR_DEEP_WOUNDS_PERIODIC, SPELL_AURA_PERIODIC_DAMAGE); - CastSpellExtraArgs args(TRIGGERED_FULL_MASK); args.AddSpellBP0(damage); caster->CastSpell(target, SPELL_WARRIOR_DEEP_WOUNDS_PERIODIC, args); |