Core/Auras: Fix aura positivity check after rev bb4bd46d21.

This commit is contained in:
QAston
2010-12-31 16:12:29 +01:00
parent dd5a77bebc
commit 1b18a0ac65
2 changed files with 28 additions and 15 deletions
+2 -2
View File
@@ -16330,7 +16330,7 @@ void Unit::EnterVehicle(Vehicle *vehicle, int8 seatId, AuraApplication const * a
if (seatId >= 0 && seatId != GetTransSeat()) if (seatId >= 0 && seatId != GetTransSeat())
{ {
sLog->outDebug("EnterVehicle: %u leave vehicle %u seat %d and enter %d.", GetEntry(), m_vehicle->GetBase()->GetEntry(), GetTransSeat(), seatId); sLog->outDebug("EnterVehicle: %u leave vehicle %u seat %d and enter %d.", GetEntry(), m_vehicle->GetBase()->GetEntry(), GetTransSeat(), seatId);
ChangeSeat(seatId, bool(aurApp)); ChangeSeat(seatId, aurApp != NULL);
} }
return; return;
} }
@@ -16364,7 +16364,7 @@ void Unit::EnterVehicle(Vehicle *vehicle, int8 seatId, AuraApplication const * a
ASSERT(!m_vehicle); ASSERT(!m_vehicle);
m_vehicle = vehicle; m_vehicle = vehicle;
if (!m_vehicle->AddPassenger(this, seatId, bool(aurApp))) if (!m_vehicle->AddPassenger(this, seatId, aurApp != NULL))
{ {
m_vehicle = NULL; m_vehicle = NULL;
return; return;
+26 -13
View File
@@ -116,23 +116,36 @@ void AuraApplication::_InitFlags(Unit * caster, uint8 effMask)
// mark as selfcasted if needed // mark as selfcasted if needed
m_flags |= (GetBase()->GetCasterGUID() == GetTarget()->GetGUID()) ? AFLAG_CASTER : AFLAG_NONE; m_flags |= (GetBase()->GetCasterGUID() == GetTarget()->GetGUID()) ? AFLAG_CASTER : AFLAG_NONE;
// Aura is positive when it is casted by friend and at least one aura is positive // aura is casted by self or an enemy
// or when it is casted by enemy and at least one aura is negative // one negative effect and we know aura is negative
bool needManyNegEffects = false; if (IsSelfcasted() || !caster || !caster->IsFriendlyTo(GetTarget()))
if (IsSelfcasted())
needManyNegEffects = false;
else if (caster)
needManyNegEffects = caster->IsFriendlyTo(GetTarget());
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{ {
if ((1<<i) & effMask) bool negativeFound = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{ {
if (needManyNegEffects == IsPositiveEffect(GetBase()->GetId(), i)) if (((1<<i) & effMask) && !IsPositiveEffect(GetBase()->GetId(), i))
m_flags |= needManyNegEffects ? AFLAG_POSITIVE : AFLAG_NEGATIVE; {
negativeFound = true;
break;
}
} }
m_flags |= negativeFound ? AFLAG_NEGATIVE : AFLAG_POSITIVE;
}
// aura is casted by friend
// one positive effect and we know aura is positive
else
{
bool positiveFound = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (((1<<i) & effMask) && IsPositiveEffect(GetBase()->GetId(), i))
{
positiveFound = true;
break;
}
}
m_flags |= positiveFound ? AFLAG_POSITIVE : AFLAG_NEGATIVE;
} }
m_flags |= !needManyNegEffects ? AFLAG_POSITIVE : AFLAG_NEGATIVE;
} }
void AuraApplication::_HandleEffect(uint8 effIndex, bool apply) void AuraApplication::_HandleEffect(uint8 effIndex, bool apply)