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/Kalimdor | |
| parent | 16ed458eeeebe436f05c43686928252992ae2a20 (diff) | |
Core/Spells: Unify spell effect access api in both branches
Diffstat (limited to 'src/server/scripts/Kalimdor')
5 files changed, 16 insertions, 15 deletions
diff --git a/src/server/scripts/Kalimdor/Firelands/boss_baleroc.cpp b/src/server/scripts/Kalimdor/Firelands/boss_baleroc.cpp index 7699375c69a..2307954145d 100644 --- a/src/server/scripts/Kalimdor/Firelands/boss_baleroc.cpp +++ b/src/server/scripts/Kalimdor/Firelands/boss_baleroc.cpp @@ -417,16 +417,16 @@ class spell_baleroc_decimating_strike : public SpellScript bool Validate(SpellInfo const* spellInfo) override { - if (!spellInfo->GetEffect(EFFECT_0)) + if (spellInfo->GetEffects().size() <= EFFECT_2) return false; - SpellEffectInfo const* spellEffectInfo = spellInfo->GetEffect(EFFECT_2); - return spellEffectInfo && ValidateSpellInfo({ uint32(spellEffectInfo->BasePoints) }); + SpellEffectInfo const& spellEffectInfo = spellInfo->GetEffect(EFFECT_2); + return ValidateSpellInfo({ uint32(spellEffectInfo.CalcValue()) }); } void ChangeDamage() { - int32 healthPctDmg = GetHitUnit()->CountPctFromMaxHealth(GetSpellInfo()->GetEffect(EFFECT_0)->BasePoints); - int32 flatDmg = GetSpellInfo()->GetEffect(EFFECT_2)->BasePoints; + int32 healthPctDmg = GetHitUnit()->CountPctFromMaxHealth(GetEffectInfo(EFFECT_0).CalcValue(GetCaster())); + int32 flatDmg = GetEffectInfo(EFFECT_2).CalcValue(GetCaster()); SetHitDamage(healthPctDmg < flatDmg ? flatDmg : healthPctDmg); } @@ -800,7 +800,8 @@ class spell_baleroc_vital_flame : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override { - return ValidateSpellInfo({ SPELL_VITAL_SPARK }); + return ValidateSpellInfo({ SPELL_VITAL_SPARK }) + && !sSpellMgr->AssertSpellInfo(SPELL_VITAL_SPARK, DIFFICULTY_NONE)->GetEffects().empty(); } void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -812,7 +813,7 @@ class spell_baleroc_vital_flame : public AuraScript } stacks = GetCaster()->GetAuraCount(SPELL_VITAL_SPARK); - int32 healingPct = sSpellMgr->AssertSpellInfo(SPELL_VITAL_SPARK, GetCastDifficulty())->GetEffect(EFFECT_0)->BasePoints * stacks; + int32 healingPct = sSpellMgr->AssertSpellInfo(SPELL_VITAL_SPARK, GetCastDifficulty())->GetEffect(EFFECT_0).CalcValue(GetCaster()) * stacks; if (GetAura()->GetEffect(EFFECT_0)->GetAmount() < healingPct) GetAura()->GetEffect(EFFECT_0)->SetAmount(healingPct); diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp index 907ccb7abb2..d92b75fa020 100644 --- a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp +++ b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp @@ -540,7 +540,7 @@ public: /// TODO: Remove this once we find a general rule for WorldObject::MovePosition (this spell shouldn't take the Z change into consideration) Unit* caster = GetCaster(); float angle = float(rand_norm()) * static_cast<float>(2 * M_PI); - uint32 dist = caster->GetCombatReach() + GetSpellInfo()->GetEffect(EFFECT_0)->CalcRadius(caster) * (float)rand_norm(); + uint32 dist = caster->GetCombatReach() + GetSpellInfo()->GetEffect(EFFECT_0).CalcRadius(caster) * (float)rand_norm(); float x = caster->GetPositionX() + dist * std::cos(angle); float y = caster->GetPositionY() + dist * std::sin(angle); diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp index e125af5d46b..7adb716efb4 100644 --- a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp +++ b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp @@ -387,7 +387,7 @@ public: { CastSpellExtraArgs args; args.AddSpellMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount()); - caster->CastSpell(GetTarget(), aurEff->GetSpellEffectInfo()->TriggerSpell, args); + caster->CastSpell(GetTarget(), aurEff->GetSpellEffectInfo().TriggerSpell, args); } } diff --git a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp index c5cf1f86109..392706bcc5f 100644 --- a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp @@ -242,14 +242,14 @@ class spell_ooze_zap : public SpellScriptLoader { PrepareSpellScript(spell_ooze_zap_SpellScript); - bool Validate(SpellInfo const* /*spellInfo*/) override + bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ SPELL_OOZE_ZAP }); + return spellInfo->GetEffects().size() > EFFECT_1 && ValidateSpellInfo({ SPELL_OOZE_ZAP }); } SpellCastResult CheckRequirement() { - if (!GetCaster()->HasAura(GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue())) + if (!GetCaster()->HasAura(GetEffectInfo(EFFECT_1).CalcValue())) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct if (!GetExplTargetUnit()) @@ -330,7 +330,7 @@ class spell_energize_aoe : public SpellScriptLoader { for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();) { - if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue()) == QUEST_STATUS_INCOMPLETE) + if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetEffectInfo(EFFECT_1).CalcValue()) == QUEST_STATUS_INCOMPLETE) ++itr; else targets.erase(itr++); diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp index 5f7c1745a22..16398d42ee3 100644 --- a/src/server/scripts/Kalimdor/zone_silithus.cpp +++ b/src/server/scripts/Kalimdor/zone_silithus.cpp @@ -1409,7 +1409,7 @@ class spell_silithus_summon_cultist_periodic : 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) @@ -1419,7 +1419,7 @@ class spell_silithus_summon_cultist_periodic : public AuraScript // All these spells trigger a spell that requires reagents; if the // triggered spell is cast as "triggered", reagents are not consumed if (Unit* caster = GetCaster()) - caster->CastSpell(nullptr, GetSpellInfo()->GetEffect(aurEff->GetEffIndex())->TriggerSpell, CastSpellExtraArgs(TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)).SetTriggeringAura(aurEff)); + caster->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, CastSpellExtraArgs(TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)).SetTriggeringAura(aurEff)); } void Register() override |
