refactor(Scripts/Spells): code cleanup (part 9) (#6946)

This commit is contained in:
Francesco Borzì
2021-07-22 01:12:28 +02:00
committed by GitHub
parent 9ab6ba9664
commit 3b752dd796
7 changed files with 36 additions and 17 deletions

View File

@@ -9,7 +9,6 @@
#include "CellImpl.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Item.h"
#include "ObjectMgr.h"
#include "ScriptedCreature.h"
#include "Spell.h"

View File

@@ -886,8 +886,8 @@ public:
if (AuraEffect const* idol = caster->GetAuraEffect(SPELL_DRUID_IDOL_OF_FERAL_SHADOWS, EFFECT_0))
amount += cp * idol->GetAmount();
// Idol of Worship. Can't be handled as SpellMod due its dependency from CPs
else if (AuraEffect const* idol = caster->GetAuraEffect(SPELL_DRUID_IDOL_OF_WORSHIP, EFFECT_0))
amount += cp * idol->GetAmount();
else if (AuraEffect const* idol2 = caster->GetAuraEffect(SPELL_DRUID_IDOL_OF_WORSHIP, EFFECT_0))
amount += cp * idol2->GetAmount();
amount += int32(CalculatePct(caster->GetTotalAttackPowerValue(BASE_ATTACK), cp));
}

View File

@@ -19,10 +19,8 @@
#include "CellImpl.h"
#include "Chat.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "InstanceScript.h"
#include "LFGMgr.h"
#include "Pet.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
@@ -32,6 +30,11 @@
#include "Vehicle.h"
#include <array>
// TODO: this import is not necessary for compilation and marked as unused by the IDE
// however, for some reasons removing it would cause a damn linking issue
// there is probably some underlying problem with imports which should properly addressed
#include "GridNotifiersImpl.h"
// Ours
class spell_gen_model_visible : public SpellScriptLoader
{
@@ -4713,15 +4716,19 @@ public:
{
Aura const* aura = GetHitAura();
if (!(aura && aura->GetStackAmount() == 3))
{
return;
}
target->CastSpell(target, SPELL_FOAM_SWORD_DEFEAT, true);
target->RemoveAurasDueToSpell(SPELL_BONKED);
if (Aura const* aura = target->GetAura(SPELL_ON_GUARD))
if (Aura const* onGuardAura = target->GetAura(SPELL_ON_GUARD))
{
if (Item* item = target->GetItemByGuid(aura->GetCastItemGUID()))
if (Item* item = target->GetItemByGuid(onGuardAura->GetCastItemGUID()))
{
target->DestroyItemCount(item->GetEntry(), 1, true);
}
}
}
}

View File

@@ -13,12 +13,16 @@
#include "Cell.h"
#include "CellImpl.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Pet.h"
#include "ScriptMgr.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
// TODO: this import is not necessary for compilation and marked as unused by the IDE
// however, for some reasons removing it would cause a damn linking issue
// there is probably some underlying problem with imports which should properly addressed
#include "GridNotifiersImpl.h"
enum HunterSpells
{
// Ours

View File

@@ -227,10 +227,14 @@ public:
// Xinef: removed divine guardian because it will affect triggered spell with increased amount
// Arena - Dampening
if (AuraEffect const* dampening = caster->GetAuraEffect(SPELL_GENERIC_ARENA_DAMPENING, EFFECT_0))
{
AddPct(amount, dampening->GetAmount());
}
// Battleground - Dampening
else if (AuraEffect const* dampening = caster->GetAuraEffect(SPELL_GENERIC_BATTLEGROUND_DAMPENING, EFFECT_0))
AddPct(amount, dampening->GetAmount());
else if (AuraEffect const* dampening2 = caster->GetAuraEffect(SPELL_GENERIC_BATTLEGROUND_DAMPENING, EFFECT_0))
{
AddPct(amount, dampening2->GetAmount());
}
}
}
@@ -1259,8 +1263,10 @@ public:
holy += eventInfo.GetProcTarget()->SpellBaseDamageBonusTaken(SPELL_SCHOOL_MASK_HOLY);
// Xinef: Libram of Divine Purpose
if (AuraEffect* aurEff = GetTarget()->GetDummyAuraEffect(SPELLFAMILY_PALADIN, 2025, EFFECT_0))
holy += aurEff->GetAmount();
if (AuraEffect* aurEffPaladin = GetTarget()->GetDummyAuraEffect(SPELLFAMILY_PALADIN, 2025, EFFECT_0))
{
holy += aurEffPaladin->GetAmount();
}
int32 bp = std::max<int32>(0, int32((ap * 0.022f + 0.044f * holy) * GetTarget()->GetAttackTime(BASE_ATTACK) / 1000));
GetTarget()->CastCustomSpell(SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS, SPELLVALUE_BASE_POINT0, bp, eventInfo.GetProcTarget(), true, nullptr, aurEff);

View File

@@ -713,11 +713,15 @@ public:
AddPct(amount, healModifier);
// Arena - Dampening
if (AuraEffect const* dampening = caster->GetAuraEffect(SPELL_GENERIC_ARENA_DAMPENING, EFFECT_0))
AddPct(amount, dampening->GetAmount());
if (AuraEffect const* arenaDampening = caster->GetAuraEffect(SPELL_GENERIC_ARENA_DAMPENING, EFFECT_0))
{
AddPct(amount, arenaDampening->GetAmount());
}
// Battleground - Dampening
else if (AuraEffect const* dampening = caster->GetAuraEffect(SPELL_GENERIC_BATTLEGROUND_DAMPENING, EFFECT_0))
AddPct(amount, dampening->GetAmount());
else if (AuraEffect const* bgDampening = caster->GetAuraEffect(SPELL_GENERIC_BATTLEGROUND_DAMPENING, EFFECT_0))
{
AddPct(amount, bgDampening->GetAmount());
}
return amount;
}

View File

@@ -12,7 +12,6 @@
#include "CellImpl.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "ScriptMgr.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"