[8760] fixed invisibleForAlive visibility-checks

those creatures shouldn't see alive creatures - else
it would be very unfair ;)

now it's also possible that they can fight against each other

this fixes the bug, that those creatures attacked living players
This commit is contained in:
balrok 2009-11-01 13:33:32 +01:00
parent 64baf661f5
commit 84573285db
2 changed files with 8 additions and 4 deletions

View file

@ -9623,7 +9623,8 @@ bool Unit::isTargetableForAttack(bool inverseAlive /*=false*/) const
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE))
return false;
if ((isAlive() && !isInvisibleForAlive()) == inverseAlive)
// inversealive is needed for some spells which need to be casted at dead targets (aoe)
if (isAlive() == inverseAlive)
return false;
return IsInWorld() && !hasUnitState(UNIT_STAT_DIED) && !isInFlight();
@ -9785,8 +9786,11 @@ bool Unit::isVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, boo
return false;
}
if (u->isAlive() && isInvisibleForAlive())
if (u->GetTypeId() == TYPEID_PLAYER && !((Player *)u)->isGameMaster())
// isInvisibleForAlive() those units can only be seen by dead or if other
// unit is also invisible for alive.. if an isinvisibleforalive unit dies we
// should be able to see it too
if (u->isAlive() && isAlive() && isInvisibleForAlive() != u->isInvisibleForAlive())
if (u->GetTypeId() != TYPEID_PLAYER || !((Player *)u)->isGameMaster())
return false;
// Visible units, always are visible for all units, except for units under invisibility and phases