summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index f4e30e51f..43597979e 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1316,8 +1316,18 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap)
return 0;
//Follow up if possible.
- if (!mob_can_reach(md, tbl, md->min_chase, MSS_RUSH) ||
- !unit_walktobl(&md->bl, tbl, md->status.rhw.range, 2))
+ if (mob_can_reach(md, tbl, md->min_chase, MSS_RUSH) &&
+ unit_walktobl(&md->bl, tbl, md->status.rhw.range, 2))
+ return 0; //Chasing.
+
+ //Can't chase locked target. Return to IDLE.
+ if(md->state.skillstate == MSS_IDLE ||
+ md->state.skillstate == MSS_WALK)
+ { //Mob is already idle, try a idle skill before giving up.
+ if (!(++md->ud.walk_count%IDLE_SKILL_INTERVAL))
+ mobskill_use(md, tick, -1);
+ md->target_id=0;
+ } else
mob_unlocktarget(md,tick);
return 0;
}