mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
Port AEBardPulse to use GetCloseMobList logic
This commit is contained in:
parent
233f26996b
commit
e531e68b6d
@ -930,58 +930,89 @@ void EntityList::MassGroupBuff(Mob *caster, Mob *center, uint16 spell_id, bool a
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// causes caster to hit every mob within dist range of center with
|
/**
|
||||||
// a bard pulse of spell_id.
|
* Causes caster to hit every mob within dist range of center with a bard pulse of spell_id
|
||||||
// NPC spells will only affect other NPCs with compatible faction
|
* NPC spells will only affect other NPCs with compatible faction
|
||||||
void EntityList::AEBardPulse(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster)
|
*
|
||||||
|
* @param caster
|
||||||
|
* @param center
|
||||||
|
* @param spell_id
|
||||||
|
* @param affect_caster
|
||||||
|
*/
|
||||||
|
void EntityList::AEBardPulse(
|
||||||
|
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);
|
||||||
|
bool is_npc = caster->IsNPC();
|
||||||
|
|
||||||
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);
|
/**
|
||||||
bool isnpc = caster->IsNPC();
|
* Skip self
|
||||||
|
*/
|
||||||
|
if (current_mob == center) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (auto it = mob_list.begin(); it != mob_list.end(); ++it) {
|
if (current_mob == caster && !affect_caster) {
|
||||||
curmob = it->second;
|
|
||||||
if (curmob == center) //do not affect center
|
|
||||||
continue;
|
continue;
|
||||||
if (curmob == caster && !affect_caster) //watch for caster too
|
}
|
||||||
|
|
||||||
|
if (DistanceSquared(center->GetPosition(), current_mob->GetPosition()) > distance_squared) { //make sure they are in range
|
||||||
continue;
|
continue;
|
||||||
if (DistanceSquared(center->GetPosition(), curmob->GetPosition()) > dist2) //make sure they are in range
|
}
|
||||||
continue;
|
|
||||||
if (isnpc && curmob->IsNPC()) { //check npc->npc casting
|
/**
|
||||||
FACTION_VALUE f = curmob->GetReverseFactionCon(caster);
|
* check npc->npc casting
|
||||||
if (bad) {
|
*/
|
||||||
|
if (is_npc && current_mob->IsNPC()) {
|
||||||
|
FACTION_VALUE faction = current_mob->GetReverseFactionCon(caster);
|
||||||
|
if (is_detrimental_spell) {
|
||||||
//affect mobs that are on our hate list, or
|
//affect mobs that are on our hate list, or
|
||||||
//which have bad faction with us
|
//which have bad faction with us
|
||||||
if (!(caster->CheckAggro(curmob) || f == FACTION_THREATENLY || f == FACTION_SCOWLS) )
|
if (!(caster->CheckAggro(current_mob) || faction == FACTION_THREATENLY || faction == FACTION_SCOWLS)) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
//only affect mobs we would assist.
|
//only affect mobs we would assist.
|
||||||
if (!(f <= FACTION_AMIABLE))
|
if (!(faction <= FACTION_AMIABLE)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//finally, make sure they are within range
|
|
||||||
if (bad) {
|
|
||||||
if (!center->CheckLosFN(curmob))
|
|
||||||
continue;
|
|
||||||
} else { // check to stop casting beneficial ae buffs (to wit: bard songs) on enemies...
|
|
||||||
// See notes in AESpell() above for more info.
|
|
||||||
if (caster->IsAttackAllowed(curmob, true))
|
|
||||||
continue;
|
|
||||||
if (caster->CheckAggro(curmob))
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//if we get here... cast the spell.
|
/**
|
||||||
curmob->BardPulse(spell_id, caster);
|
* LOS
|
||||||
|
*/
|
||||||
|
if (is_detrimental_spell) {
|
||||||
|
if (!center->CheckLosFN(current_mob)) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (caster->IsClient())
|
}
|
||||||
|
else { // check to stop casting beneficial ae buffs (to wit: bard songs) on enemies...
|
||||||
|
// See notes in AESpell() above for more info.
|
||||||
|
if (caster->IsAttackAllowed(current_mob, true)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (caster->CheckAggro(current_mob)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
current_mob->BardPulse(spell_id, caster);
|
||||||
|
}
|
||||||
|
if (caster->IsClient()) {
|
||||||
caster->CastToClient()->CheckSongSkillIncrease(spell_id);
|
caster->CastToClient()->CheckSongSkillIncrease(spell_id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Rampage and stuff for clients. Normal and Duration rampages
|
// Rampage and stuff for clients. Normal and Duration rampages
|
||||||
//NPCs handle it differently in Mob::Rampage
|
//NPCs handle it differently in Mob::Rampage
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user