From e86fca3affc4e5e97cabfdc3f1a5ef85172206ca Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 14 Oct 2016 13:59:45 -0400 Subject: [PATCH] Add NPC NPC faction check to BeamDirectional --- zone/spells.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/zone/spells.cpp b/zone/spells.cpp index f744541e0..04129b554 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -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);