mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-02 07:07:29 +01:00
*Placeholder for special target selection for spell 57669. Patch writed by kozelo, rechapa79 with active support from Lightguard.
*Not really implemented. Need to find a good way. --HG-- branch : trunk
This commit is contained in:
@@ -1983,9 +1983,70 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
|
||||
advance(itr, urand(0, TagUnitMap.size() - 1));
|
||||
TagUnitMap.erase(itr);
|
||||
}
|
||||
|
||||
/*if(m_spellInfo->Id==57669) //Replenishment (special target selection)
|
||||
{
|
||||
if(pGroup)
|
||||
{
|
||||
typedef std::priority_queue<PrioritizeManaPlayerWraper, std::vector<PrioritizeManaPlayerWraper>, PrioritizeMana> Top10;
|
||||
Top10 manaUsers;
|
||||
|
||||
for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL && manaUsers.size() < 10; itr = itr->next())
|
||||
{
|
||||
Player* Target = itr->getSource();
|
||||
if (m_caster->GetGUID() != Target->GetGUID() && Target->getPowerType() == POWER_MANA &&
|
||||
!Target->isDead() && m_caster->IsWithinDistInMap(Target, radius))
|
||||
{
|
||||
PrioritizeManaPlayerWraper WTarget(Target);
|
||||
manaUsers.push(WTarget);
|
||||
}
|
||||
}
|
||||
|
||||
while(!manaUsers.empty())
|
||||
{
|
||||
TagUnitMap.push_back(manaUsers.top().getPlayer());
|
||||
manaUsers.pop();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Unit* ownerOrSelf = pTarget ? pTarget : m_caster->GetCharmerOrOwnerOrSelf();
|
||||
if ((ownerOrSelf==m_caster || m_caster->IsWithinDistInMap(ownerOrSelf, radius)) &&
|
||||
ownerOrSelf->getPowerType() == POWER_MANA)
|
||||
TagUnitMap.push_back(ownerOrSelf);
|
||||
|
||||
if(Pet* pet = ownerOrSelf->GetPet())
|
||||
if( m_caster->IsWithinDistInMap(pet, radius) && pet->getPowerType() == POWER_MANA )
|
||||
TagUnitMap.push_back(pet);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
class PrioritizeManaPlayerWraper
|
||||
{
|
||||
friend struct PrioritizeMana;
|
||||
|
||||
public:
|
||||
explicit PrioritizeManaPlayerWraper(Player* player) : player(player)
|
||||
{
|
||||
uint32 maxmana = player->GetMaxPower(POWER_MANA);
|
||||
percentMana = maxmana ? player->GetPower(POWER_MANA) * 100 / maxmana : 101;
|
||||
}
|
||||
Player* getPlayer() const { return player; }
|
||||
private:
|
||||
Player* player;
|
||||
uint32 percentMana;
|
||||
};
|
||||
|
||||
struct PrioritizeMana
|
||||
{
|
||||
int operator()( PrioritizeManaPlayerWraper const& x, PrioritizeManaPlayerWraper const& y ) const
|
||||
{
|
||||
return x.percentMana < y.percentMana;
|
||||
}
|
||||
};
|
||||
|
||||
void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
|
||||
{
|
||||
if(m_CastItem)
|
||||
|
||||
Reference in New Issue
Block a user