// solar: 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 void EntityList::AEBardPulse(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster) { Mob *curmob; float dist = caster->GetAOERange(spell_id); float dist2 = dist * dist; bool bad = IsDetrimentalSpell(spell_id); bool isnpc = caster->IsNPC(); for (auto it = mob_list.begin(); it != mob_list.end(); ++it) { curmob = it->second; 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; if (isnpc && curmob->IsNPC()) { //check npc->npc casting FACTION_VALUE f = curmob->GetReverseFactionCon(caster); if (bad) { //affect mobs that are on our hate list, or //which have bad faction with us if (!(caster->CheckAggro(curmob) || f == FACTION_THREATENLY || f == FACTION_SCOWLS) ) continue; } else { //only affect mobs we would assist. if (!(f <= FACTION_AMIABLE)) 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; AddHealAggro(curmob, caster, caster->CheckHealAggroAmount(spell_id, curmob)); } //if we get here... cast the spell. curmob->BardPulse(spell_id, caster); } if (caster->IsClient()) caster->CastToClient()->CheckSongSkillIncrease(spell_id); }
// solar: 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 void EntityList::AEBardPulse(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster) { LinkedListIterator<Mob*> iterator(mob_list); Mob *curmob; float dist = caster->GetAOERange(spell_id); float dist2 = dist * dist; bool bad = IsDetrimentalSpell(spell_id); bool isnpc = caster->IsNPC(); for(iterator.Reset(); iterator.MoreElements(); iterator.Advance()) { curmob = iterator.GetData(); if(curmob == center) //do not affect center continue; if(curmob == caster && !affect_caster) //watch for caster too continue; if(center->DistNoRoot(*curmob) > dist2) //make sure they are in range continue; if(isnpc && curmob->IsNPC()) { //check npc->npc casting FACTION_VALUE f = curmob->GetReverseFactionCon(caster); if(bad) { //affect mobs that are on our hate list, or //which have bad faction with us if( ! (caster->CheckAggro(curmob) || f == FACTION_THREATENLY || f == FACTION_SCOWLS) ) continue; } else { //only affect mobs we would assist. if( ! (f <= FACTION_AMIABLE)) continue; } } //finally, make sure they are within range if(bad) { if(!center->CheckLosFN(curmob)) continue; } //if we get here... cast the spell. curmob->BardPulse(spell_id, caster); } if(caster->IsClient()) caster->CastToClient()->CheckSongSkillIncrease(spell_id); }