Index: src/game/Creature.cpp =================================================================== --- src/game/Creature.cpp (revision 4412) +++ src/game/Creature.cpp (working copy) @@ -241,8 +241,10 @@ { Unit::Update( diff ); i_motionMaster.UpdateMotion(diff); - i_AI->UpdateAI(diff); + if(!IsInEvadeMode()) + i_AI->UpdateAI(diff); + if(m_regenTimer > 0) { if(diff >= m_regenTimer) @@ -1681,3 +1683,8 @@ CreatureSpellCooldowns::const_iterator itr = m_CreatureSpellCooldowns.find(spell_id); return (itr != m_CreatureSpellCooldowns.end() && itr->second > time(NULL)) || m_GlobalCooldown > 0 || HasCategoryCooldown(spell_id); } + +bool Creature::IsInEvadeMode() const +{ + return !i_motionMaster.empty() && i_motionMaster.top()->GetMovementGeneratorType() == HOME_MOTION_TYPE; +} \ No newline at end of file Index: src/game/Creature.h =================================================================== --- src/game/Creature.h (revision 4412) +++ src/game/Creature.h (working copy) @@ -327,6 +327,8 @@ return GetCreatureInfo()->rank == CREATURE_ELITE_WORLDBOSS; } + bool IsInEvadeMode() const; + void AIM_Initialize(); MotionMaster* operator->(void) { return &i_motionMaster; } Index: src/game/GridNotifiersImpl.h =================================================================== --- src/game/GridNotifiersImpl.h (revision 4412) +++ src/game/GridNotifiersImpl.h (working copy) @@ -72,7 +72,7 @@ // Creature AI reaction if(!c->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) { - if( c->AI() && c->AI()->IsVisible(pl) ) + if( c->AI() && c->AI()->IsVisible(pl) && !c->IsInEvadeMode() ) c->AI()->MoveInLineOfSight(pl); } } @@ -81,13 +81,13 @@ { if(!c1->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) { - if( c1->AI() && c1->AI()->IsVisible(c2) ) + if( c1->AI() && c1->AI()->IsVisible(c2) && !c1->IsInEvadeMode() ) c1->AI()->MoveInLineOfSight(c2); } if(!c2->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) { - if( c2->AI() && c2->AI()->IsVisible(c1) ) + if( c2->AI() && c2->AI()->IsVisible(c1) && !c2->IsInEvadeMode() ) c2->AI()->MoveInLineOfSight(c1); } } @@ -142,6 +142,10 @@ if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) return; + // Evade target + if( target->GetTypeId()==TYPEID_UNIT && ((Creature*)target)->IsInEvadeMode() ) + return; + //Check player targets and remove if in GM mode or GM invisibility (for not self casting case) if( target->GetTypeId()==TYPEID_PLAYER && target != i_check && (((Player*)target)->isGameMaster() || ((Player*)target)->GetVisibility()==VISIBILITY_OFF) ) return; Index: src/game/MotionMaster.h =================================================================== --- src/game/MotionMaster.h (revision 4412) +++ src/game/MotionMaster.h (working copy) @@ -34,6 +34,7 @@ MovementGenerator* operator->(void) { return top(); } using std::stack::top; + using std::stack::empty; void UpdateMotion(const uint32 &diff); Index: src/game/Spell.cpp =================================================================== --- src/game/Spell.cpp (revision 4413) +++ src/game/Spell.cpp (working copy) @@ -454,6 +454,14 @@ continue; } + // Evade target + if( (*itr)->GetTypeId()==TYPEID_UNIT && ((Creature*)(*itr))->IsInEvadeMode() ) + { + m_caster->SendAttackStateUpdate(HITINFO_RESIST|HITINFO_SWINGNOHITSOUND, (*itr), 1, SpellSchools(m_spellInfo->School), 0, 0,0,VICTIMSTATE_EVADES,0); + itr = tmpUnitMap.erase(itr); + continue; + } + //Check player targets and remove if in GM mode or GM invisibility (for not self casting case) if( (*itr) != m_caster && (*itr)->GetTypeId()==TYPEID_PLAYER) { Index: src/game/Unit.cpp =================================================================== --- src/game/Unit.cpp (revision 4419) +++ src/game/Unit.cpp (working copy) @@ -391,7 +391,8 @@ void Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchools damageSchool, SpellEntry const *spellProto, uint32 procFlag, bool durabilityLoss) { - if (!pVictim->isAlive() || pVictim->isInFlight()) return; + if (!pVictim->isAlive() || pVictim->isInFlight() || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()) + return; //You don't lose health from damage taken from another player while in a sanctuary //You still see it in the combat log though @@ -1097,7 +1098,7 @@ case SPELL_SCHOOL_ARCANE: //Spell miss (sends resist message) - if(SpellMissChanceCalc(pVictim) > urand(0,10000)) + if( SpellMissChanceCalc(pVictim) > urand(0,10000) ) { cleanDamage->damage = 0; *damage = 0; @@ -2029,6 +2030,9 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 hit_chance) const { + if(pVictim->GetTypeId()==TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()) + return MELEE_HIT_MISS; + int32 skillDiff = GetWeaponSkillValue(attType) - pVictim->GetDefenseSkillValue(); // bonus from skills is 0.04% int32 skillBonus = skillDiff * 4; @@ -4407,8 +4411,16 @@ return false; // anyone don't must attack GM in GM-mode - if(victim->GetTypeId()==TYPEID_PLAYER && ((Player*)victim)->isGameMaster()) - return false; + if(victim->GetTypeId()==TYPEID_PLAYER) + { + if(((Player*)victim)->isGameMaster()) + return false; + } + else + { + if(((Creature*)victim)->IsInEvadeMode()) + return false; + } if (m_attacking) {