diff options
| author | Shauren <shauren.trinity@gmail.com> | 2021-09-04 15:13:15 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-09-04 15:13:15 +0200 |
| commit | 8a4e1119ac21e2d1112d1717337597fe073e495f (patch) | |
| tree | 34f3215bec2096b59e3d9b2353661e1c137ff8b4 /src/server/scripts/Northrend | |
| parent | 16ed458eeeebe436f05c43686928252992ae2a20 (diff) | |
Core/Spells: Unify spell effect access api in both branches
Diffstat (limited to 'src/server/scripts/Northrend')
27 files changed, 99 insertions, 97 deletions
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp index 5e896f3b462..3b6c5828ac5 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp @@ -148,7 +148,7 @@ public: // clone player->CastSpell(summon, SPELL_CLONE_PLAYER, true); // phase the summon - PhasingHandler::AddPhase(summon, spellInfo->GetEffect(EFFECT_0)->MiscValueB, true); + PhasingHandler::AddPhase(summon, spellInfo->GetEffect(EFFECT_0).MiscValueB, true); } } ++insanityHandled; diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index 1356b00a181..c12fbab7b88 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -1500,7 +1500,7 @@ class spell_halion_combustion_consumption_periodic : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0)->TriggerSpell }); + return !spellInfo->GetEffects().empty() && ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void HandleTick(AuraEffect const* aurEff) @@ -1510,7 +1510,7 @@ class spell_halion_combustion_consumption_periodic : public SpellScriptLoader if (!caster) return; - uint32 triggerSpell = aurEff->GetSpellEffectInfo()->TriggerSpell; + uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell; int32 radius = caster->GetObjectScale() * M_PI * 10000 / 3; CastSpellExtraArgs args(aurEff); @@ -1606,8 +1606,8 @@ class spell_halion_damage_aoe_summon : public SpellScriptLoader { PreventHitDefaultEffect(effIndex); Unit* caster = GetCaster(); - uint32 entry = uint32(GetSpellInfo()->GetEffect(effIndex)->MiscValue); - SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetSpellInfo()->GetEffect(effIndex)->MiscValueB)); + uint32 entry = uint32(GetEffectInfo().MiscValue); + SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetEffectInfo().MiscValueB)); uint32 duration = uint32(GetSpellInfo()->GetDuration()); Position pos = caster->GetPosition(); @@ -1707,10 +1707,10 @@ class spell_halion_clear_debuffs : public SpellScriptLoader return ValidateSpellInfo({ SPELL_CLEAR_DEBUFFS, SPELL_TWILIGHT_REALM }); } - void HandleScript(SpellEffIndex effIndex) + void HandleScript(SpellEffIndex /*effIndex*/) { - if (GetHitUnit()->HasAura(GetSpellInfo()->GetEffect(effIndex)->CalcValue())) - GetHitUnit()->RemoveAurasDueToSpell(GetSpellInfo()->GetEffect(effIndex)->CalcValue()); + if (GetHitUnit()->HasAura(GetEffectInfo().CalcValue())) + GetHitUnit()->RemoveAurasDueToSpell(GetEffectInfo().CalcValue()); } void Register() override @@ -1891,7 +1891,7 @@ class spell_halion_blazing_aura : public SpellScriptLoader void HandleScript(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - GetHitUnit()->CastSpell(GetHitUnit(), GetSpellInfo()->GetEffect(EFFECT_1)->TriggerSpell); + GetHitUnit()->CastSpell(GetHitUnit(), GetEffectInfo().TriggerSpell); } void Register() override diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index 747546b9d12..8b341661df4 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -499,8 +499,7 @@ class spell_mistress_kiss_area : public SpellScript bool Validate(SpellInfo const* spellInfo) override { - SpellEffectInfo const* effect0 = spellInfo->GetEffect(EFFECT_0); - return effect0 && ValidateSpellInfo({ static_cast<uint32>(effect0->CalcValue()) }); + return !spellInfo->GetEffects().empty() && ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); } void FilterTargets(std::list<WorldObject*>& targets) @@ -538,8 +537,7 @@ class spell_fel_streak_visual : public SpellScript bool Validate(SpellInfo const* spellInfo) override { - SpellEffectInfo const* effect0 = spellInfo->GetEffect(EFFECT_0); - return effect0 && ValidateSpellInfo({ static_cast<uint32>(effect0->CalcValue()) }); + return !spellInfo->GetEffects().empty() && ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); } void HandleScript(SpellEffIndex /*effIndex*/) diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index 5a067e8aad3..b2658110776 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -1189,7 +1189,7 @@ class spell_jormungars_slime_pool : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0)->TriggerSpell }); + return !spellInfo->GetEffects().empty() && ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void PeriodicTick(AuraEffect const* aurEff) @@ -1199,7 +1199,7 @@ class spell_jormungars_slime_pool : public AuraScript int32 const radius = static_cast<int32>(((aurEff->GetTickNumber() / 60.f) * 0.9f + 0.1f) * 10000.f * 2.f / 3.f); CastSpellExtraArgs args(aurEff); args.AddSpellMod(SPELLVALUE_RADIUS_MOD, radius); - GetTarget()->CastSpell(nullptr, GetSpellInfo()->GetEffect(aurEff->GetEffIndex())->TriggerSpell, args); + GetTarget()->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, args); } void Register() override @@ -1277,12 +1277,12 @@ class spell_icehowl_arctic_breath : public SpellScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0)->CalcValue()) }); + return !spellInfo->GetEffects().empty() && ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); } - void HandleScriptEffect(SpellEffIndex effIndex) + void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - uint32 spellId = GetSpellInfo()->GetEffect(effIndex)->CalcValue(); + uint32 spellId = GetEffectInfo().CalcValue(); GetCaster()->CastSpell(GetHitUnit(), spellId, true); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index e70810e6182..06c786ff2ab 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -811,7 +811,7 @@ class spell_valkyr_essences : public SpellScriptLoader GetTarget()->CastSpell(GetTarget(), SPELL_SURGE_OF_SPEED, true); // Twin Vortex part - int32 stacksCount = dmgInfo.GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue() / 1000 - 1; + int32 stacksCount = dmgInfo.GetSpellInfo()->GetEffect(EFFECT_0).CalcValue() / 1000 - 1; if (stacksCount) { diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp index d05bff6386b..cbb468ad3dd 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp @@ -311,7 +311,7 @@ class spell_trollgore_invader_taunt : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - return spellInfo->GetEffect(EFFECT_0) && ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0)->CalcValue()) }); + return !spellInfo->GetEffects().empty() && ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); } void HandleTaunt(SpellEffIndex /*effIndex*/) diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 84688b9a380..7cc0f87bd51 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -2791,7 +2791,7 @@ class spell_hor_evasion : public SpellScriptLoader return; float angle = pos.GetAngle(&home); - float dist = GetSpellInfo()->GetEffect(EFFECT_0)->CalcRadius(GetCaster()); + float dist = GetEffectInfo().CalcRadius(GetCaster()); target->MovePosition(pos, dist, angle); dest.Relocate(pos); @@ -2849,7 +2849,7 @@ class spell_hor_quel_delars_will : public SpellScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0)->TriggerSpell }); + return !spellInfo->GetEffects().empty() && ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void HandleReagent(SpellEffIndex effIndex) @@ -2857,7 +2857,7 @@ class spell_hor_quel_delars_will : public SpellScript PreventHitDefaultEffect(effIndex); // dummy spell consumes reagent, don't ignore it - GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->GetEffect(effIndex)->TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)); + GetHitUnit()->CastSpell(GetCaster(), GetEffectInfo().TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)); } void Register() override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index a8bf0718f8b..515501dafcf 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -813,7 +813,7 @@ class spell_blood_queen_pact_of_the_darkfallen_dmg : public SpellScriptLoader void PeriodicTick(AuraEffect const* aurEff) { SpellInfo const* damageSpell = sSpellMgr->AssertSpellInfo(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE, GetCastDifficulty()); - int32 damage = damageSpell->GetEffect(EFFECT_0)->CalcValue(); + int32 damage = damageSpell->GetEffect(EFFECT_0).CalcValue(); float multiplier = 0.3375f + 0.1f * uint32(aurEff->GetTickNumber() / 10); // do not convert to 0.01f - we need tick number/10 as INT (damage increases every 10 ticks) damage = int32(damage * multiplier); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp index c29683fa748..092cd40bf29 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp @@ -1829,7 +1829,8 @@ class spell_igb_rocket_pack : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - return ValidateSpellInfo({ SPELL_ROCKET_PACK_DAMAGE, SPELL_ROCKET_BURST }); + return ValidateSpellInfo({ SPELL_ROCKET_PACK_DAMAGE, SPELL_ROCKET_BURST }) + && !sSpellMgr->AssertSpellInfo(SPELL_ROCKET_PACK_DAMAGE, DIFFICULTY_NONE)->GetEffects().empty(); } void HandlePeriodic(AuraEffect const* /*aurEff*/) @@ -1843,7 +1844,7 @@ class spell_igb_rocket_pack : public SpellScriptLoader SpellInfo const* damageInfo = sSpellMgr->AssertSpellInfo(SPELL_ROCKET_PACK_DAMAGE, GetCastDifficulty()); CastSpellExtraArgs args(TRIGGERED_FULL_MASK); args.CastDifficulty = GetCastDifficulty(); - args.AddSpellBP0(2 * (damageInfo->GetEffect(EFFECT_0)->CalcValue() + aurEff->GetTickNumber() * aurEff->GetPeriod())); + args.AddSpellBP0(2 * (damageInfo->GetEffect(EFFECT_0).CalcValue() + aurEff->GetTickNumber() * aurEff->GetPeriod())); GetTarget()->CastSpell(nullptr, SPELL_ROCKET_PACK_DAMAGE, args); GetTarget()->CastSpell(nullptr, SPELL_ROCKET_BURST, TRIGGERED_FULL_MASK); } @@ -1971,10 +1972,10 @@ class spell_igb_periodic_trigger_with_power_cost : public SpellScriptLoader { PrepareAuraScript(spell_igb_periodic_trigger_with_power_cost_AuraScript); - void HandlePeriodicTick(AuraEffect const* /*aurEff*/) + void HandlePeriodicTick(AuraEffect const* aurEff) { PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), GetSpellInfo()->GetEffect(EFFECT_0)->TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)); + GetTarget()->CastSpell(GetTarget(), aurEff->GetSpellEffectInfo().TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)); } void Register() override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index 8be4018532d..ddec000524b 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -582,9 +582,8 @@ class spell_marrowgar_coldflame_damage : public SpellScriptLoader if (target->HasAura(SPELL_IMPALED)) return false; - if (SpellEffectInfo const* effect = GetSpellInfo()->GetEffect(EFFECT_0)) - if (target->GetExactDist2d(GetOwner()) > effect->CalcRadius()) - return false; + if (target->GetExactDist2d(GetOwner()) > GetEffectInfo(EFFECT_0).CalcRadius()) + return false; if (Aura* aur = target->GetAura(GetId())) if (aur->GetOwner() != GetOwner()) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index 233c1f35644..d09530233f7 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -1057,7 +1057,7 @@ class spell_putricide_unstable_experiment : public SpellScriptLoader break; } - GetCaster()->CastSpell(target, uint32(GetSpellInfo()->GetEffect(stage)->CalcValue()), true); + GetCaster()->CastSpell(target, uint32(GetEffectInfo(SpellEffIndex(stage)).CalcValue()), true); } void Register() override @@ -1114,9 +1114,8 @@ class spell_putricide_ooze_tank_protection : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - SpellEffectInfo const* effect0 = spellInfo->GetEffect(EFFECT_0); - SpellEffectInfo const* effect1 = spellInfo->GetEffect(EFFECT_1); - return effect0 && effect1 && ValidateSpellInfo({ effect0->TriggerSpell, effect1->TriggerSpell }); + return spellInfo->GetEffects().size() > EFFECT_1 + && ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell, spellInfo->GetEffect(EFFECT_1).TriggerSpell }); } void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo) @@ -1124,7 +1123,7 @@ class spell_putricide_ooze_tank_protection : public SpellScriptLoader PreventDefaultAction(); Unit* actionTarget = eventInfo.GetActionTarget(); - actionTarget->CastSpell(nullptr, aurEff->GetSpellEffectInfo()->TriggerSpell, aurEff); + actionTarget->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, aurEff); } void Register() override @@ -1152,12 +1151,12 @@ class spell_putricide_choking_gas_bomb : public SpellScriptLoader void HandleScript(SpellEffIndex /*effIndex*/) { uint32 skipIndex = urand(0, 2); - for (SpellEffectInfo const* effect : GetSpellInfo()->GetEffects()) + for (SpellEffectInfo const& spellEffectInfo : GetSpellInfo()->GetEffects()) { - if (!effect || effect->EffectIndex == skipIndex) + if (spellEffectInfo.EffectIndex == skipIndex) continue; - uint32 spellId = uint32(effect->CalcValue()); + uint32 spellId = uint32(spellEffectInfo.CalcValue()); GetCaster()->CastSpell(GetCaster(), spellId, GetCaster()->GetGUID()); } } @@ -1314,10 +1313,10 @@ class spell_putricide_mutated_plague : public SpellScriptLoader if (!caster) return; - uint32 triggerSpell = aurEff->GetSpellEffectInfo()->TriggerSpell; + uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell; SpellInfo const* spell = sSpellMgr->AssertSpellInfo(triggerSpell, GetCastDifficulty()); - int32 damage = spell->GetEffect(EFFECT_0)->CalcValue(caster); + int32 damage = spell->GetEffect(EFFECT_0).CalcValue(caster); float multiplier = 2.0f; if (GetTarget()->GetMap()->Is25ManRaid()) multiplier = 3.0f; @@ -1331,15 +1330,15 @@ class spell_putricide_mutated_plague : public SpellScriptLoader GetTarget()->CastSpell(GetTarget(), triggerSpell, args); } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - uint32 healSpell = uint32(GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue()); + uint32 healSpell = uint32(aurEff->GetSpellEffectInfo().CalcValue()); SpellInfo const* healSpellInfo = sSpellMgr->GetSpellInfo(healSpell, GetCastDifficulty()); if (!healSpellInfo) return; - int32 heal = healSpellInfo->GetEffect(EFFECT_0)->CalcValue() * GetStackAmount(); + int32 heal = healSpellInfo->GetEffect(EFFECT_0).CalcValue() * GetStackAmount(); CastSpellExtraArgs args(GetCasterGUID()); args.AddSpellBP0(heal); GetTarget()->CastSpell(GetTarget(), healSpell, args); @@ -1505,8 +1504,8 @@ class spell_putricide_mutated_transformation : public SpellScriptLoader return; } - uint32 entry = uint32(GetSpellInfo()->GetEffect(effIndex)->MiscValue); - SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetSpellInfo()->GetEffect(effIndex)->MiscValueB)); + uint32 entry = uint32(GetEffectInfo().MiscValue); + SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetEffectInfo().MiscValueB)); uint32 duration = uint32(GetSpellInfo()->GetDuration()); Position pos = caster->GetPosition(); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index f15e751157d..94bc9d0310d 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -550,14 +550,13 @@ class spell_rotface_mutated_infection : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - SpellEffectInfo const* effect = spellInfo->GetEffect(EFFECT_2); - return effect && ValidateSpellInfo({ uint32(effect->CalcValue()) }); + return spellInfo->GetEffects().size() > EFFECT_2 && ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_2).CalcValue()) }); } void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - target->CastSpell(target, uint32(GetSpellInfo()->GetEffect(EFFECT_2)->CalcValue()), { aurEff, GetCasterGUID() }); + target->CastSpell(target, uint32(GetEffectInfo(EFFECT_2).CalcValue()), { aurEff, GetCasterGUID() }); } void Register() override @@ -776,11 +775,11 @@ class spell_rotface_unstable_ooze_explosion : public SpellScriptLoader void CheckTarget(SpellEffIndex effIndex) { - PreventHitDefaultEffect(EFFECT_0); + PreventHitDefaultEffect(effIndex); if (!GetExplTargetDest()) return; - uint32 triggered_spell_id = GetSpellInfo()->GetEffect(effIndex)->TriggerSpell; + uint32 triggered_spell_id = GetEffectInfo().TriggerSpell; float x, y, z; GetExplTargetDest()->GetPosition(x, y, z); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 158b63ab4f2..6d249e6ce16 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -1571,14 +1571,17 @@ class spell_frostwarden_handler_focus_fire : public SpellScriptLoader { PrepareAuraScript(spell_frostwarden_handler_focus_fire_AuraScript); + bool Validate(SpellInfo const* spellInfo) override + { + return spellInfo->GetEffects().size() > EFFECT_1; + } + void PeriodicTick(AuraEffect const* /*aurEff*/) { PreventDefaultAction(); if (Unit* caster = GetCaster()) { - if (SpellEffectInfo const* effect = GetSpellInfo()->GetEffect(EFFECT_1)) - caster->GetThreatManager().AddThreat(GetTarget(), -float(effect->CalcValue()), GetSpellInfo(), true, true); - + caster->GetThreatManager().AddThreat(GetTarget(), -float(GetEffectInfo(EFFECT_1).CalcValue()), GetSpellInfo(), true, true); caster->GetAI()->SetData(DATA_WHELP_MARKER, 0); } } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 54605a25996..9b33c7b53ae 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -2494,14 +2494,14 @@ class spell_the_lich_king_summon_into_air : public SpellScriptLoader { PrepareSpellScript(spell_the_lich_king_summon_into_air_SpellScript); - void ModDestHeight(SpellEffIndex effIndex) + void ModDestHeight(SpellEffIndex /*effIndex*/) { static Position const offset = {0.0f, 0.0f, 15.0f, 0.0f}; WorldLocation* dest = const_cast<WorldLocation*>(GetExplTargetDest()); dest->RelocateOffset(offset); GetHitDest()->RelocateOffset(offset); // spirit bombs get higher - if (GetSpellInfo()->GetEffect(effIndex)->MiscValue == NPC_SPIRIT_BOMB) + if (GetEffectInfo().MiscValue == NPC_SPIRIT_BOMB) { static Position const offsetExtra = { 0.0f, 0.0f, 5.0f, 0.0f }; dest->RelocateOffset(offsetExtra); @@ -2695,7 +2695,7 @@ class spell_the_lich_king_vile_spirits : public SpellScriptLoader void OnPeriodic(AuraEffect const* aurEff) { if (_is25Man || ((aurEff->GetTickNumber() - 1) % 5)) - GetTarget()->CastSpell(nullptr, aurEff->GetSpellEffectInfo()->TriggerSpell, { aurEff, GetCasterGUID() }); + GetTarget()->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, { aurEff, GetCasterGUID() }); } void Register() override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index bbd04e7890b..baec83a7608 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -248,7 +248,7 @@ class ValithriaDespawner : public BasicEvent default: return; } - + creature->DespawnOrUnsummon(0, 10s); } @@ -1235,7 +1235,7 @@ class spell_dreamwalker_summoner : public SpellScriptLoader if (!GetHitUnit()) return; - GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->GetEffect(effIndex)->TriggerSpell, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING)); + GetHitUnit()->CastSpell(GetCaster(), GetEffectInfo().TriggerSpell, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING)); } void Register() override @@ -1326,7 +1326,7 @@ class spell_dreamwalker_summon_suppresser_effect : public SpellScriptLoader if (!GetHitUnit()) return; - GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->GetEffect(effIndex)->TriggerSpell, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING)); + GetHitUnit()->CastSpell(GetCaster(), GetEffectInfo().TriggerSpell, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING)); } void Register() override @@ -1462,7 +1462,7 @@ class spell_dreamwalker_twisted_nightmares : public SpellScriptLoader // return; if (InstanceScript* instance = GetHitUnit()->GetInstanceScript()) - GetHitUnit()->CastSpell(nullptr, GetSpellInfo()->GetEffect(effIndex)->TriggerSpell, instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER)); + GetHitUnit()->CastSpell(nullptr, GetEffectInfo().TriggerSpell, instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER)); } void Register() override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index a1b4698a37c..1500349fd50 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -1847,7 +1847,7 @@ class spell_icc_sprit_alarm : public SpellScriptLoader { PreventHitDefaultEffect(effIndex); uint32 trapId = 0; - switch (GetSpellInfo()->GetEffect(effIndex)->MiscValue) + switch (GetEffectInfo().MiscValue) { case EVENT_AWAKEN_WARD_1: trapId = GO_SPIRIT_ALARM_1; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp index c529a580917..33ba844ca4a 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp @@ -193,8 +193,8 @@ class spell_grobbulus_poison_cloud : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - SpellEffectInfo const* effect0 = spellInfo->GetEffect(EFFECT_0); - return effect0 && ValidateSpellInfo({ effect0->TriggerSpell }); + return !spellInfo->GetEffects().empty() + && ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void PeriodicTick(AuraEffect const* aurEff) @@ -203,7 +203,7 @@ class spell_grobbulus_poison_cloud : public SpellScriptLoader if (!aurEff->GetTotalTicks()) return; - uint32 triggerSpell = aurEff->GetSpellEffectInfo()->TriggerSpell; + uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell; int32 mod = int32(((float(aurEff->GetTickNumber()) / aurEff->GetTotalTicks()) * 0.9f + 0.1f) * 10000 * 2 / 3); CastSpellExtraArgs args(aurEff); diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 60152408e4c..aa31ee41ea6 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -1899,7 +1899,7 @@ class spell_arcane_overload : public SpellScriptLoader { Creature* arcaneOverload = GetCaster()->ToCreature(); targets.remove_if(ExactDistanceCheck(arcaneOverload, - GetSpellInfo()->GetEffect(EFFECT_0)->CalcRadius(arcaneOverload) * arcaneOverload->GetObjectScale())); + GetEffectInfo(EFFECT_0).CalcRadius(arcaneOverload) * arcaneOverload->GetObjectScale())); } void Register() override diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index f61ab9bf2b3..a87a11e9076 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -453,7 +453,7 @@ class spell_oculus_ride_ruby_emerald_amber_drake_que : public SpellScriptLoader // caster of the triggered spell is wrong for an unknown reason, handle it here correctly PreventDefaultAction(); if (Unit* caster = GetCaster()) - GetTarget()->CastSpell(caster, aurEff->GetSpellEffectInfo()->TriggerSpell, true); + GetTarget()->CastSpell(caster, aurEff->GetSpellEffectInfo().TriggerSpell, true); } void Register() override diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp index a8f0924c9e4..59ca0c6e0f9 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp @@ -181,12 +181,17 @@ class spell_krystallus_shatter_effect : public SpellScriptLoader { PrepareSpellScript(spell_krystallus_shatter_effect_SpellScript); + bool Validate(SpellInfo const* spellInfo) override + { + return !spellInfo->GetEffects().empty(); + } + void CalculateDamage() { if (!GetHitUnit()) return; - float radius = GetSpellInfo()->GetEffect(EFFECT_0)->CalcRadius(GetCaster()); + float radius = GetSpellInfo()->GetEffect(EFFECT_0).CalcRadius(GetCaster()); if (!radius) return; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 6db930756a2..c704265493a 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -1526,13 +1526,13 @@ class spell_tar_blaze : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0)->TriggerSpell }); + return !spellInfo->GetEffects().empty() && ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void PeriodicTick(AuraEffect const* aurEff) { // should we use custom damage? - GetTarget()->CastSpell(nullptr, GetSpellInfo()->GetEffect(aurEff->GetEffIndex())->TriggerSpell, true); + GetTarget()->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, true); } void Register() override @@ -1792,7 +1792,7 @@ class spell_vehicle_throw_passenger : public SpellScriptLoader class spell_vehicle_throw_passenger_SpellScript : public SpellScript { PrepareSpellScript(spell_vehicle_throw_passenger_SpellScript); - void HandleScript(SpellEffIndex effIndex) + void HandleScript(SpellEffIndex /*effIndex*/) { Spell* baseSpell = GetSpell(); SpellCastTargets targets = baseSpell->m_targets; @@ -1825,7 +1825,7 @@ class spell_vehicle_throw_passenger : public SpellScriptLoader } } } - if (target && target->IsWithinDist2d(targets.GetDstPos(), GetSpellInfo()->GetEffect(effIndex)->CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct + if (target && target->IsWithinDist2d(targets.GetDstPos(), GetEffectInfo().CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct passenger->EnterVehicle(target, 0); else { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index 083c37d4763..a0f3d711bee 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -1583,7 +1583,7 @@ class spell_freya_iron_roots : public SpellScriptLoader void HandleSummon(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - uint32 entry = uint32(GetSpellInfo()->GetEffect(effIndex)->MiscValue); + uint32 entry = uint32(GetEffectInfo().MiscValue); Position pos = GetCaster()->GetPosition(); // Not good at all, but this prevents having roots in a different position then player diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index e1c81c0a286..9d234ce1888 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -448,23 +448,22 @@ class spell_ulduar_cancel_stone_grip : public SpellScriptLoader { PrepareSpellScript(spell_ulduar_cancel_stone_gripSpellScript); + bool Validate(SpellInfo const* spellInfo) override + { + return spellInfo->GetEffects().size() > EFFECT_1; + } + void HandleScript(SpellEffIndex /*effIndex*/) { Unit* target = GetHitUnit(); if (!target || !target->GetVehicle()) return; - switch (target->GetMap()->GetDifficultyID()) - { - case DIFFICULTY_10_N: - target->RemoveAura(GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue()); - break; - case DIFFICULTY_25_N: - target->RemoveAura(GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue()); - break; - default: - break; - } + SpellEffIndex effectIndexToCancel = EFFECT_0; + if (target->GetMap()->Is25ManRaid()) + effectIndexToCancel = EFFECT_1; + + target->RemoveAura(GetEffectInfo(effectIndexToCancel).CalcValue()); } void Register() override @@ -647,7 +646,7 @@ class spell_kologarn_summon_focused_eyebeam : public SpellScriptLoader void HandleForceCast(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - GetCaster()->CastSpell(GetCaster(), GetSpellInfo()->GetEffect(effIndex)->TriggerSpell, true); + GetCaster()->CastSpell(GetCaster(), GetEffectInfo().TriggerSpell, true); } void Register() override diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp index 66f2eae6fe0..e72c83742e1 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp @@ -959,13 +959,13 @@ struct npc_thorim_trashAI : public ScriptedAI static uint32 GetTotalHeal(SpellInfo const* spellInfo, Unit const* caster) { uint32 heal = 0; - for (SpellEffectInfo const* effect : spellInfo->GetEffects()) + for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects()) { - if (effect->IsEffect(SPELL_EFFECT_HEAL)) - heal += effect->CalcValue(caster); + if (spellEffectInfo.IsEffect(SPELL_EFFECT_HEAL)) + heal += spellEffectInfo.CalcValue(caster); - if (effect->IsEffect(SPELL_EFFECT_APPLY_AURA) && effect->IsAura(SPELL_AURA_PERIODIC_HEAL)) - heal += spellInfo->GetMaxTicks() * effect->CalcValue(caster); + if (spellEffectInfo.IsEffect(SPELL_EFFECT_APPLY_AURA) && spellEffectInfo.IsAura(SPELL_AURA_PERIODIC_HEAL)) + heal += spellInfo->GetMaxTicks() * spellEffectInfo.CalcValue(caster); } return heal; } diff --git a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp index db2946ce825..2a2737bd127 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp @@ -108,7 +108,7 @@ class spell_moragg_ray : public SpellScriptLoader if (Unit* target = GetTarget()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true)) { - uint32 triggerSpell = aurEff->GetSpellEffectInfo()->TriggerSpell; + uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell; GetTarget()->CastSpell(target, triggerSpell, aurEff); } } diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp index 4beecee5eed..e581a8d742d 100644 --- a/src/server/scripts/Northrend/zone_storm_peaks.cpp +++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp @@ -1327,7 +1327,7 @@ public: bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0)->CalcValue()) }); + return !spellInfo->GetEffects().empty() && ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); } void HandleScript(SpellEffIndex /*effIndex*/) diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp index a7db09490ad..0924cdf16cf 100644 --- a/src/server/scripts/Northrend/zone_wintergrasp.cpp +++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp @@ -590,10 +590,9 @@ class spell_wintergrasp_tenacity_refresh : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - SpellEffectInfo const* effect2 = spellInfo->GetEffect(EFFECT_2); - if (!effect2) + if (spellInfo->GetEffects().size() <= EFFECT_2) return false; - uint32 triggeredSpellId = effect2->CalcValue(); + uint32 triggeredSpellId = spellInfo->GetEffect(EFFECT_2).CalcValue(); return !triggeredSpellId || ValidateSpellInfo({ triggeredSpellId }); } @@ -601,7 +600,7 @@ class spell_wintergrasp_tenacity_refresh : public AuraScript { PreventDefaultAction(); - if (uint32 triggeredSpellId = aurEff->GetSpellEffectInfo()->CalcValue()) + if (uint32 triggeredSpellId = aurEff->GetSpellEffectInfo().CalcValue()) { int32 bp = 0; if (AuraEffect const* healEffect = GetEffect(EFFECT_0)) @@ -619,7 +618,7 @@ class spell_wintergrasp_tenacity_refresh : public AuraScript void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - if (uint32 triggeredSpellId = aurEff->GetSpellEffectInfo()->CalcValue()) + if (uint32 triggeredSpellId = aurEff->GetSpellEffectInfo().CalcValue()) GetTarget()->RemoveAurasDueToSpell(triggeredSpellId); } |
