Skip to content

Commit

Permalink
Bug 732411: Fix a rare case where a mob stuck on top of a player woul…
Browse files Browse the repository at this point in the history
…d slow the game down
  • Loading branch information
sork committed Mar 26, 2012
1 parent 749fc5a commit 5c10b3a
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions client/js/game.js
Expand Up @@ -1150,15 +1150,22 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT
});

entity.onRequestPath(function(x, y) {
var ignored = [entity]; // Always ignore self

var ignored = [entity], // Always ignore self
ignoreTarget = function(target) {
ignored.push(target);

// also ignore other attackers of the target entity
target.forEachAttacker(function(attacker) {
ignored.push(attacker);
});
};

if(entity.hasTarget()) {
ignored.push(entity.target);

// also ignore other attackers of the target entity
entity.target.forEachAttacker(function(attacker) {
ignored.push(attacker);
});
ignoreTarget(entity.target);
} else if(entity.previousTarget) {
// If repositioning before attacking again, ignore previous target
// See: tryMovingToADifferentTile()
ignoreTarget(entity.previousTarget);
}

return self.findPath(entity, x, y, ignored);
Expand Down

0 comments on commit 5c10b3a

Please sign in to comment.