mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
Port MassGroupBuff
This commit is contained in:
parent
0f9c34cf3c
commit
54f73d7420
@ -907,41 +907,64 @@ void EntityList::AESpell(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityList::MassGroupBuff(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster)
|
/**
|
||||||
|
* @param caster
|
||||||
|
* @param center
|
||||||
|
* @param spell_id
|
||||||
|
* @param affect_caster
|
||||||
|
*/
|
||||||
|
void EntityList::MassGroupBuff(
|
||||||
|
Mob *caster,
|
||||||
|
Mob *center,
|
||||||
|
uint16 spell_id,
|
||||||
|
bool affect_caster)
|
||||||
{
|
{
|
||||||
Mob *curmob = nullptr;
|
Mob *current_mob = nullptr;
|
||||||
|
float distance = caster->GetAOERange(spell_id);
|
||||||
|
float distance_squared = distance * distance;
|
||||||
|
bool is_detrimental_spell = IsDetrimentalSpell(spell_id);
|
||||||
|
|
||||||
float dist = caster->GetAOERange(spell_id);
|
for (auto &it : entity_list.GetCloseMobList(caster, distance)) {
|
||||||
float dist2 = dist * dist;
|
current_mob = it.second;
|
||||||
|
|
||||||
bool bad = IsDetrimentalSpell(spell_id);
|
/**
|
||||||
|
* Skip center
|
||||||
for (auto & it : mob_list) {
|
*/
|
||||||
curmob = it.second;
|
if (current_mob == center) {
|
||||||
if (curmob == center) //do not affect center
|
|
||||||
continue;
|
|
||||||
if (curmob == caster && !affect_caster) //watch for caster too
|
|
||||||
continue;
|
|
||||||
if (DistanceSquared(center->GetPosition(), curmob->GetPosition()) > dist2) //make sure they are in range
|
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//Only npcs mgb should hit are client pets...
|
/**
|
||||||
if (curmob->IsNPC()) {
|
* Skip self
|
||||||
Mob *owner = curmob->GetOwner();
|
*/
|
||||||
|
if (current_mob == caster && !affect_caster) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DistanceSquared(center->GetPosition(), current_mob->GetPosition()) > distance_squared) { //make sure they are in range
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pets
|
||||||
|
*/
|
||||||
|
if (current_mob->IsNPC()) {
|
||||||
|
Mob *owner = current_mob->GetOwner();
|
||||||
if (owner) {
|
if (owner) {
|
||||||
if (!owner->IsClient()) {
|
if (!owner->IsClient()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bad) {
|
if (is_detrimental_spell) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
caster->SpellOnTarget(spell_id, curmob);
|
caster->SpellOnTarget(spell_id, current_mob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user