Esempio n. 1
0
bool LifeBloom(uint32 i, Aura* a, bool apply)
{
    Unit* m_target = a->GetTarget();

    if(apply)
        return true;

    // apply ONCE only.
    if(a->m_ignoreunapply)
        return true;

    Unit* pCaster = a->GetUnitCaster();
    if(pCaster == NULL)
        pCaster = m_target;

    // Remove other Lifeblooms - but do NOT handle unapply again
    bool expired = true;
    for(uint32 x = MAX_POSITIVE_AURAS_EXTEDED_START; x < MAX_POSITIVE_AURAS_EXTEDED_END; x++)
    {
        if(m_target->m_auras[x])
        {
            if(m_target->m_auras[x]->GetSpellId() == a->GetSpellId())
            {
                m_target->m_auras[x]->m_ignoreunapply = true;
                if(m_target->m_auras[x]->GetTimeLeft())
                    expired = false;
                m_target->m_auras[x]->Remove();
            }
        }
    }

    if(expired)
    {
        Spell* spell = sSpellFactoryMgr.NewSpell(pCaster, a->GetSpellProto(), true, NULL);
        spell->SetUnitTarget(m_target);
        spell->Heal(a->GetModAmount(i));
        delete spell;
    }

    return true;
}