[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)) if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE))
return false; 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 false;
return IsInWorld() && !hasUnitState(UNIT_STAT_DIED) && !isInFlight(); return IsInWorld() && !hasUnitState(UNIT_STAT_DIED) && !isInFlight();
@ -9785,8 +9786,11 @@ bool Unit::isVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, boo
return false; return false;
} }
if (u->isAlive() && isInvisibleForAlive()) // isInvisibleForAlive() those units can only be seen by dead or if other
if (u->GetTypeId() == TYPEID_PLAYER && !((Player *)u)->isGameMaster()) // 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; return false;
// Visible units, always are visible for all units, except for units under invisibility and phases // Visible units, always are visible for all units, except for units under invisibility and phases

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8759" #define REVISION_NR "8760"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__