Skip to content

Commit

Permalink
Bug 738312: Attack animations of other players are always visible
Browse files Browse the repository at this point in the history
  • Loading branch information
sork committed Mar 23, 2012
1 parent fdd42db commit bacd714
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 8 additions & 1 deletion client/js/character.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,14 @@ define(['entity', 'transition', 'timer'], function(Entity, Transition, Timer) {
*
*/
canAttack: function(time) {
if(this.hasTarget() && this.isAdjacentNonDiagonal(this.target) && this.attackCooldown.isOver(time)) {
if(this.canReachTarget() && this.attackCooldown.isOver(time)) {
return true;
}
return false;
},

canReachTarget: function() {
if(this.hasTarget() && this.isAdjacentNonDiagonal(this.target)) {
return true;
}
return false;
Expand Down
6 changes: 6 additions & 0 deletions client/js/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -1229,10 +1229,16 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT
if(entity instanceof Item) {
self.removeItem(entity);
} else if(entity instanceof Character) {
entity.forEachAttacker(function(attacker) {
if(attacker.canReachTarget()) {
attacker.hit();
}
});
entity.die();
} else if(entity instanceof Chest) {
entity.open();
}

entity.clean();
}
});
Expand Down

0 comments on commit bacd714

Please sign in to comment.