diff options
| author | maximius <none@none> | 2009-09-29 01:16:08 -0700 |
|---|---|---|
| committer | maximius <none@none> | 2009-09-29 01:16:08 -0700 |
| commit | aa5e2d3b2810ed38129254d007e943f155e79111 (patch) | |
| tree | 02914d1ca1a0d9075d867d35a906fcfed7331efb /src/game/Creature.cpp | |
| parent | 0a9addd224076f0a555535b6b08a342f61d056c8 (diff) | |
*The enemy of my enemy is my friend.
*Correct some reversed parameter ordering (team and vehId were swapped)
--HG--
branch : trunk
Diffstat (limited to 'src/game/Creature.cpp')
| -rw-r--r-- | src/game/Creature.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index b9499a9b8b5..3440c0793b9 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1524,7 +1524,7 @@ bool Creature::LoadFromDB(uint32 guid, Map *map) if (map->GetInstanceId() != 0) guid = objmgr.GenerateLowGuid(HIGHGUID_UNIT); uint16 team = 0; - if(!Create(guid,map,data->phaseMask,data->id,team,0,data->posX,data->posY,data->posZ,data->orientation,data)) + if(!Create(guid,map,data->phaseMask,data->id,0,team,data->posX,data->posY,data->posZ,data->orientation,data)) return false; //We should set first home position, because then AI calls home movement @@ -1689,6 +1689,10 @@ bool Creature::canStartAttack(Unit const* who, bool force) const if(!force) { + // if victim(1) has a victim(2), and victim(2) is a non-friendly player, don't attack victim(1) unless forced + if(who->getVictim() && who->getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself() && !IsFriendlyTo(who->getVictim()) + return false; + if(who->isInCombat()) if(Unit *victim = who->getAttackerForHelper()) if(IsWithinDistInMap(victim, sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS))) |
