Core/Spells: Implemented multiple spell power costs

This commit is contained in:
Shauren
2015-03-08 13:31:57 +01:00
parent 9ffeb58d09
commit 0ba2e0d5ee
30 changed files with 537 additions and 421 deletions
+8 -5
View File
@@ -1004,11 +1004,14 @@ class spell_mage_master_of_elements : public SpellScriptLoader
{
PreventDefaultAction();
int32 mana = int32(eventInfo.GetDamageInfo()->GetSpellInfo()->CalcPowerCost(GetTarget(), eventInfo.GetDamageInfo()->GetSchoolMask()));
mana = CalculatePct(mana, aurEff->GetAmount());
if (mana > 0)
GetTarget()->CastCustomSpell(SPELL_MAGE_MASTER_OF_ELEMENTS_ENERGIZE, SPELLVALUE_BASE_POINT0, mana, GetTarget(), true, NULL, aurEff);
std::vector<SpellInfo::CostData> costs = eventInfo.GetDamageInfo()->GetSpellInfo()->CalcPowerCost(GetTarget(), eventInfo.GetDamageInfo()->GetSchoolMask());
auto m = std::find_if(costs.begin(), costs.end(), [](SpellInfo::CostData const& cost) { return cost.Power == POWER_MANA; });
if (m != costs.end())
{
int32 mana = CalculatePct(m->Amount, aurEff->GetAmount());
if (mana > 0)
GetTarget()->CastCustomSpell(SPELL_MAGE_MASTER_OF_ELEMENTS_ENERGIZE, SPELLVALUE_BASE_POINT0, mana, GetTarget(), true, NULL, aurEff);
}
}
void Register() override