Scripts/Spells: fixed Beacon of Light

# Conflicts:
#	src/server/game/Entities/Unit/Unit.cpp
#	src/server/game/Entities/Unit/Unit.h
#	src/server/scripts/Spells/spell_paladin.cpp
This commit is contained in:
joschiwald
2016-01-17 01:52:22 +01:00
parent 2940872b16
commit 09adf4d0ad
5 changed files with 92 additions and 89 deletions
@@ -0,0 +1,3 @@
DELETE FROM `spell_script_names` WHERE `spell_id`=53651;
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(53651, 'spell_pal_light_s_beacon');
+6 -6
View File
@@ -177,8 +177,8 @@ SpellInfo const* ProcEventInfo::GetSpellInfo() const
return _spell->GetSpellInfo();
if (_damageInfo)
return _damageInfo->GetSpellInfo();
/*if (_healInfo)
return _healInfo->GetSpellInfo();*/
if (_healInfo)
return _healInfo->GetSpellInfo();
return nullptr;
}
@@ -189,8 +189,8 @@ SpellSchoolMask ProcEventInfo::GetSchoolMask() const
return _spell->GetSpellInfo()->GetSchoolMask();
if (_damageInfo)
return _damageInfo->GetSchoolMask();
/*if (_healInfo)
return _healInfo->GetSchoolMask();*/
if (_healInfo)
return _healInfo->GetSchoolMask();
return SPELL_SCHOOL_MASK_NONE;
}
@@ -12274,8 +12274,8 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
Unit* actionTarget = !isVictim ? target : this;
DamageInfo damageInfo = DamageInfo(actor, actionTarget, damage, procSpell, procSpell ? SpellSchoolMask(procSpell->SchoolMask) : SPELL_SCHOOL_MASK_NORMAL, SPELL_DIRECT_DAMAGE);
HealInfo healInfo = HealInfo(damage);
ProcEventInfo eventInfo = ProcEventInfo(actor, actionTarget, target, procFlag, 0, 0, procExtra, NULL, &damageInfo, &healInfo);
HealInfo healInfo = HealInfo(actor, actionTarget, damage, procSpell, procSpell ? SpellSchoolMask(procSpell->SchoolMask) : SPELL_SCHOOL_MASK_NORMAL);
ProcEventInfo eventInfo = ProcEventInfo(actor, actionTarget, target, procFlag, 0, 0, procExtra, nullptr, &damageInfo, &healInfo);
ProcTriggeredList procTriggered;
// Fill procTriggered list
+18 -16
View File
@@ -955,22 +955,30 @@ public:
class HealInfo
{
private:
uint32 m_heal;
uint32 m_absorb;
Unit* const _healer;
Unit* const _target;
uint32 _heal;
uint32 _absorb;
SpellInfo const* const _spellInfo;
SpellSchoolMask const _schoolMask;
public:
explicit HealInfo(uint32 heal)
: m_heal(heal)
{
m_absorb = 0;
}
explicit HealInfo(Unit* healer, Unit* target, uint32 heal, SpellInfo const* spellInfo, SpellSchoolMask schoolMask)
: _healer(healer), _target(target), _heal(heal), _absorb(0), _spellInfo(spellInfo), _schoolMask(schoolMask) { }
void AbsorbHeal(uint32 amount)
{
amount = std::min(amount, GetHeal());
m_absorb += amount;
m_heal -= amount;
_absorb += amount;
_heal -= amount;
}
uint32 GetHeal() const { return m_heal; }
Unit* GetHealer() const { return _healer; }
Unit* GetTarget() const { return _target; }
uint32 GetHeal() const { return _heal; }
uint32 GetAbsorb() const { return _absorb; }
SpellInfo const* GetSpellInfo() const { return _spellInfo; };
SpellSchoolMask GetSchoolMask() const { return _schoolMask; };
};
class ProcEventInfo
@@ -990,12 +998,6 @@ public:
uint32 GetHitMask() const { return _hitMask; }
SpellInfo const* GetSpellInfo() const;
SpellInfo const* EnsureSpellInfo() const
{
SpellInfo const* spellInfo = GetSpellInfo();
ASSERT(spellInfo);
return spellInfo;
}
SpellSchoolMask GetSchoolMask() const;
DamageInfo* GetDamageInfo() const { return _damageInfo; }
+5 -3
View File
@@ -1019,10 +1019,12 @@ bool SpellMgr::CanSpellTriggerProcOnEvent(SpellProcEntry const& procEntry, ProcE
// check spell family name/flags (if set) for spells
if (eventInfo.GetTypeMask() & (PERIODIC_PROC_FLAG_MASK | SPELL_PROC_FLAG_MASK | PROC_FLAG_DONE_TRAP_ACTIVATION))
{
if (procEntry.spellFamilyName && eventInfo.GetSpellInfo() && (procEntry.spellFamilyName != eventInfo.EnsureSpellInfo()->SpellFamilyName))
SpellInfo const* eventSpellInfo = eventInfo.GetSpellInfo();
if (procEntry.spellFamilyName && eventSpellInfo && (procEntry.spellFamilyName != eventSpellInfo->SpellFamilyName))
return false;
if (procEntry.spellFamilyMask && eventInfo.GetSpellInfo() && !(procEntry.spellFamilyMask & eventInfo.EnsureSpellInfo()->SpellFamilyFlags))
if (procEntry.spellFamilyMask && eventSpellInfo && !(procEntry.spellFamilyMask & eventSpellInfo->SpellFamilyFlags))
return false;
}
@@ -3222,6 +3224,7 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->Attributes |= SPELL_ATTR0_PASSIVE;
break;
case 17364: // Stormstrike
case 48278: // Paralyze
spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS;
break;
case 51798: // Brewfest - Relay Race - Intro - Quest Complete
@@ -3379,7 +3382,6 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->RequiredAreasID = 0; // originally, these require area 4522, which is... outside of Icecrown Citadel
break;
case 70602: // Corruption
case 48278: // Paralyze
spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS;
break;
case 70715: // Column of Frost (visual marker)
+60 -64
View File
@@ -32,7 +32,7 @@ enum PaladinSpells
{
SPELL_PALADIN_AVENGERS_SHIELD = 31935,
SPELL_PALADIN_AURA_MASTERY_IMMUNE = 64364,
SPELL_PALADIN_BEACON_OF_LIGHT_MARKER = 53563,
SPELL_PALADIN_BEACON_OF_LIGHT = 53563,
SPELL_PALADIN_BEACON_OF_LIGHT_HEAL = 53652,
SPELL_PALADIN_BLESSING_OF_LOWER_CITY_DRUID = 37878,
SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PALADIN = 37879,
@@ -284,68 +284,6 @@ class spell_pal_avenging_wrath : public SpellScriptLoader
}
};
// 53651 - Beacon of Light
class spell_pal_beacon_of_light : public SpellScriptLoader
{
public:
spell_pal_beacon_of_light() : SpellScriptLoader("spell_pal_beacon_of_light") { }
class spell_pal_beacon_of_light_AuraScript : public AuraScript
{
PrepareAuraScript(spell_pal_beacon_of_light_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_BEACON_OF_LIGHT_HEAL))
return false;
return true;
}
bool CheckProc(ProcEventInfo& eventInfo)
{
if (eventInfo.GetActionTarget()->GetAura(SPELL_PALADIN_BEACON_OF_LIGHT_MARKER, GetCasterGUID()))
return false;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
int32 heal = eventInfo.GetHealInfo()->GetHeal();
if (eventInfo.GetDamageInfo()->GetSpellInfo()->Id != SPELL_PALADIN_HOLY_LIGHT)
heal = int32(CalculatePct(heal, aurEff->GetAmount()));
Unit::AuraList const& auras = GetCaster()->GetSingleCastAuras();
for (Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
if ((*itr)->GetId() == SPELL_PALADIN_BEACON_OF_LIGHT_MARKER)
{
std::list<AuraApplication*> applications;
(*itr)->GetApplicationList(applications);
if (applications.empty())
return;
GetCaster()->CastCustomSpell(SPELL_PALADIN_BEACON_OF_LIGHT_HEAL, SPELLVALUE_BASE_POINT0, heal, applications.front()->GetTarget(), true, NULL, aurEff);
return;
}
}
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_pal_beacon_of_light_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_pal_beacon_of_light_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_pal_beacon_of_light_AuraScript();
}
};
// 37877 - Blessing of Faith
class spell_pal_blessing_of_faith : public SpellScriptLoader
{
@@ -954,6 +892,64 @@ class spell_pal_lay_on_hands : public SpellScriptLoader
}
};
// 53651 - Light's Beacon - Beacon of Light
class spell_pal_light_s_beacon : public SpellScriptLoader
{
public:
spell_pal_light_s_beacon() : SpellScriptLoader("spell_pal_light_s_beacon") { }
class spell_pal_light_s_beacon_AuraScript : public AuraScript
{
PrepareAuraScript(spell_pal_light_s_beacon_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_BEACON_OF_LIGHT)
|| !sSpellMgr->GetSpellInfo(SPELL_PALADIN_BEACON_OF_LIGHT_HEAL))
return false;
return true;
}
bool CheckProc(ProcEventInfo& eventInfo)
{
if (eventInfo.GetActionTarget()->HasAura(SPELL_PALADIN_BEACON_OF_LIGHT, eventInfo.GetActor()->GetGUID()))
return false;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
uint32 heal = CalculatePct(eventInfo.GetHealInfo()->GetHeal(), aurEff->GetAmount());
Unit::AuraList const& auras = GetCaster()->GetSingleCastAuras();
for (Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
if ((*itr)->GetId() == SPELL_PALADIN_BEACON_OF_LIGHT)
{
std::list<AuraApplication*> applications;
(*itr)->GetApplicationList(applications);
if (!applications.empty())
eventInfo.GetActor()->CastCustomSpell(SPELL_PALADIN_BEACON_OF_LIGHT_HEAL, SPELLVALUE_BASE_POINT0, heal, applications.front()->GetTarget(), true);
return;
}
}
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_pal_light_s_beacon_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_pal_light_s_beacon_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_pal_light_s_beacon_AuraScript();
}
};
// 31789 - Righteous Defense
class spell_pal_righteous_defense : public SpellScriptLoader
{
@@ -1222,7 +1218,6 @@ void AddSC_paladin_spell_scripts()
new spell_pal_aura_mastery();
new spell_pal_aura_mastery_immune();
new spell_pal_avenging_wrath();
new spell_pal_beacon_of_light();
new spell_pal_blessing_of_faith();
new spell_pal_divine_storm();
new spell_pal_divine_storm_dummy();
@@ -1238,6 +1233,7 @@ void AddSC_paladin_spell_scripts()
new spell_pal_item_healing_discount();
new spell_pal_judgement();
new spell_pal_lay_on_hands();
new spell_pal_light_s_beacon();
new spell_pal_righteous_defense();
new spell_pal_sacred_shield();
new spell_pal_shield_of_the_righteous();