diff options
| author | QAston <none@none> | 2009-06-28 17:18:46 +0200 |
|---|---|---|
| committer | QAston <none@none> | 2009-06-28 17:18:46 +0200 |
| commit | 3e079669860569990a179894b6861177fb1bef2d (patch) | |
| tree | 9f17f939aa95a50ee11cbb829a85bcf331ec260f /src/game/Unit.cpp | |
| parent | d529ab76c5a414c115a8a6605fde9b43a19db18a (diff) | |
*Fix the bug that pet is still attacking his enemy even if enemy has just entered sanctuary.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
| -rw-r--r-- | src/game/Unit.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 73d726d300a..4694dd08bf0 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -605,10 +605,10 @@ void Unit::DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb) //You don't lose health from damage taken from another player while in a sanctuary //You still see it in the combat log though - if(pVictim != this && GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER) + if(pVictim != this && IsControlledByPlayer() && pVictim->IsControlledByPlayer()) { const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId()); - if(area && area->flags & AREA_FLAG_SANCTUARY) //sanctuary + if(area && area->IsSanctuary()) //sanctuary { if(absorb) absorb += damage; @@ -1380,7 +1380,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss) Unit *pVictim = damageInfo->target; - if(!this || !pVictim) + if(!pVictim) return; if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()) @@ -1395,10 +1395,10 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss) //You don't lose health from damage taken from another player while in a sanctuary //You still see it in the combat log though - if(pVictim != this && GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER) + if(pVictim != this && IsControlledByPlayer() && pVictim->IsControlledByPlayer()) { const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId()); - if(area && area->flags & AREA_FLAG_SANCTUARY) // sanctuary + if(area && area->IsSanctuary()) // sanctuary return; } @@ -1623,7 +1623,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) if (damageInfo==0) return; Unit *pVictim = damageInfo->target; - if(!this || !pVictim) + if(!pVictim) return; if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()) @@ -1631,10 +1631,10 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) //You don't lose health from damage taken from another player while in a sanctuary //You still see it in the combat log though - if(pVictim != this && GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER) + if(pVictim != this && IsControlledByPlayer() && pVictim->IsControlledByPlayer()) { const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId()); - if(area && area->flags & AREA_FLAG_SANCTUARY) // sanctuary + if(area && area->IsSanctuary()) // sanctuary return; } |
