mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 02:46:33 +01:00
Core/Spells: implement Mad/Crazy Alchemist's potions
This commit is contained in:
@@ -1814,52 +1814,6 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
|
||||
return;
|
||||
|
||||
m_caster->EnergizeBySpell(unitTarget, m_spellInfo->Id, damage, power);
|
||||
|
||||
// Mad Alchemist's Potion
|
||||
if (m_spellInfo->Id == 45051)
|
||||
{
|
||||
// find elixirs on target
|
||||
bool guardianFound = false;
|
||||
bool battleFound = false;
|
||||
Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras();
|
||||
for (Unit::AuraApplicationMap::iterator itr = Auras.begin(); itr != Auras.end(); ++itr)
|
||||
{
|
||||
uint32 spell_id = itr->second->GetBase()->GetId();
|
||||
if (!guardianFound)
|
||||
if (sSpellMgr->IsSpellMemberOfSpellGroup(spell_id, SPELL_GROUP_ELIXIR_GUARDIAN))
|
||||
guardianFound = true;
|
||||
if (!battleFound)
|
||||
if (sSpellMgr->IsSpellMemberOfSpellGroup(spell_id, SPELL_GROUP_ELIXIR_BATTLE))
|
||||
battleFound = true;
|
||||
if (battleFound && guardianFound)
|
||||
break;
|
||||
}
|
||||
|
||||
// get all available elixirs by mask and spell level
|
||||
std::set<uint32> avalibleElixirs;
|
||||
if (!guardianFound)
|
||||
sSpellMgr->GetSetOfSpellsInSpellGroup(SPELL_GROUP_ELIXIR_GUARDIAN, avalibleElixirs);
|
||||
if (!battleFound)
|
||||
sSpellMgr->GetSetOfSpellsInSpellGroup(SPELL_GROUP_ELIXIR_BATTLE, avalibleElixirs);
|
||||
for (std::set<uint32>::iterator itr = avalibleElixirs.begin(); itr != avalibleElixirs.end();)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(*itr);
|
||||
if (spellInfo->SpellLevel < m_spellInfo->SpellLevel || spellInfo->SpellLevel > unitTarget->getLevel())
|
||||
avalibleElixirs.erase(itr++);
|
||||
else if (sSpellMgr->IsSpellMemberOfSpellGroup(*itr, SPELL_GROUP_ELIXIR_SHATTRATH))
|
||||
avalibleElixirs.erase(itr++);
|
||||
else if (sSpellMgr->IsSpellMemberOfSpellGroup(*itr, SPELL_GROUP_ELIXIR_UNSTABLE))
|
||||
avalibleElixirs.erase(itr++);
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
|
||||
if (!avalibleElixirs.empty())
|
||||
{
|
||||
// cast random elixir on target
|
||||
m_caster->CastSpell(unitTarget, Trinity::Containers::SelectRandomContainerElement(avalibleElixirs), true, m_CastItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::EffectEnergizePct(SpellEffIndex effIndex)
|
||||
|
||||
Reference in New Issue
Block a user