Changeset 186 for trunk/src/game/Unit.cpp
- Timestamp:
- 11/19/08 13:44:25 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Unit.cpp
r179 r186 464 464 } 465 465 466 void Unit::Remove InterruptableAura(uint32 flag)466 void Unit::RemoveAurasWithInterruptFlags(uint32 flag) 467 467 { 468 468 AuraList::iterator iter, next; … … 510 510 if( damagetype != DOT) 511 511 { 512 Remove InterruptableAura(AURA_INTERRUPT_FLAG_STEALTH);512 RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH); 513 513 514 514 if(pVictim->GetTypeId() == TYPEID_PLAYER && !pVictim->IsStandState() && !pVictim->hasUnitState(UNIT_STAT_STUNNED)) … … 4101 4101 ++iter; 4102 4102 } 4103 }4104 }4105 4106 void Unit::RemoveAurasWithInterruptFlags(uint32 flags)4107 {4108 for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); )4109 {4110 if (iter->second->GetSpellProto()->AuraInterruptFlags & flags)4111 RemoveAura(iter);4112 else4113 ++iter;4114 4103 } 4115 4104 } … … 8507 8496 } 8508 8497 8498 //TODO: remove this function 8509 8499 bool Unit::isTargetableForAttack() const 8510 8500 { 8511 if (GetTypeId()==TYPEID_PLAYER && ((Player *)this)->isGameMaster()) 8501 return isAttackableByAOE() && !hasUnitState(UNIT_STAT_DIED); 8502 } 8503 8504 bool Unit::canAttack(Unit const* target) const 8505 { 8506 assert(target); 8507 8508 if(!target->isAttackableByAOE() || target->hasUnitState(UNIT_STAT_DIED)) 8509 return false; 8510 8511 if((m_invisibilityMask || target->m_invisibilityMask) && !canDetectInvisibilityOf(target)) 8512 return false; 8513 8514 if(target->GetVisibility() == VISIBILITY_GROUP_STEALTH && !canDetectStealthOf(target, GetDistance(target))) 8515 return false; 8516 8517 return true; 8518 } 8519 8520 bool Unit::isAttackableByAOE() const 8521 { 8522 if(!isAlive()) 8512 8523 return false; 8513 8524 … … 8515 8526 return false; 8516 8527 8517 return isAlive() && !hasUnitState(UNIT_STAT_DIED)&& !isInFlight() /*&& !isStealth()*/; 8528 if(GetTypeId()==TYPEID_PLAYER && ((Player *)this)->isGameMaster()) 8529 return false; 8530 8531 return !isInFlight(); 8518 8532 } 8519 8533 … … 9067 9081 for(AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr) 9068 9082 { 9069 if( (*itr)->IsInMap(this) && (*itr)->isTargetableForAttack() && (*itr)->isInAccessablePlaceFor((Creature*)this) )9083 if( (*itr)->IsInMap(this) && canAttack(*itr) && (*itr)->isInAccessablePlaceFor((Creature*)this) ) 9070 9084 return false; 9071 9085 }