Add NPC NPC faction check to BeamDirectional

This commit is contained in:
Michael Cook (mackal) 2016-10-14 13:59:45 -04:00
parent 46cbd147b5
commit e86fca3aff

View File

@ -5643,6 +5643,19 @@ void Mob::BeamDirectional(uint16 spell_id, int16 resist_adjust)
continue;
}
if (IsNPC() && (*iter)->IsNPC()) {
auto fac = (*iter)->GetReverseFactionCon(this);
if (beneficial_targets) {
// only affect mobs we would assist.
if (!(fac <= FACTION_AMIABLE))
continue;
} else {
// affect mobs that are on our hate list, or which have bad faction with us
if (!(CheckAggro(*iter) || fac == FACTION_THREATENLY || fac == FACTION_SCOWLS))
continue;
}
}
//# shortest distance from line to target point
float d = std::abs((*iter)->GetY() - m * (*iter)->GetX() - b) / sqrt(m * m + 1);