Guest User

Untitled

a guest
Dec 5th, 2017
1,497
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. Author: Chero <3dserver@post.sk> 2011-07-27 18:07:22
  2. Committer: Chero <3dserver@post.sk> 2011-07-27 18:07:22
  3. Parent: 73b7ccbd6ec7eae4f140b8f1238ae9bdc05ab9cd (* Corrected target for spell 13982)
  4. Child: bf421e153f7e3cf8c08d37e734615ec2404064bc (Implement Impossibility to Enter Instance when Encounter is in Progress.)
  5. Branches: master, remotes/origin/master
  6. Follows:
  7. Precedes:
  8.  
  9. * Fixed logical bug / exploit, which caused ranged creature using EventAI to stay in place when its target was not in LoS.
  10.  
  11. Signed-off-by: Chero <3dserver@post.sk>
  12.  
  13. ------------------------- src/game/CreatureEventAI.cpp -------------------------
  14. index e052e75..7c63989 100644
  15. @@ -1125,6 +1125,22 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
  16. if (!m_creature->isAlive())
  17. return;
  18.  
  19. + // Force m_creature to chase to its target when m_creature is ranged and target is not in LoS
  20. + if (Combat && !m_CombatMovementEnabled)
  21. + {
  22. + if (!m_creature->IsWithinLOSInMap(m_creature->getVictim()) && m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE)
  23. + {
  24. + m_creature->GetMotionMaster()->Clear(false);
  25. + m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), m_AttackDistance, m_AttackAngle);
  26. + }
  27. + else if (m_creature->IsWithinLOSInMap(m_creature->getVictim()) && m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
  28. + {
  29. + m_creature->GetMotionMaster()->Clear(false);
  30. + m_creature->GetMotionMaster()->MoveIdle();
  31. + m_creature->StopMoving();
  32. + }
  33. + }
  34. +
  35. if (!m_bEmptyList)
  36. {
  37. //Events are only updated once every EVENT_UPDATE_TIME ms to prevent lag with large amount of events
Add Comment
Please, Sign In to add comment