summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-19 14:03:40 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-19 14:03:40 +0000
commit5333c3d2c92c21b0ffc709acae24e32129cd8aec (patch)
tree1ff0486669290e7b07525b44ae565621fafed2c4 /src/map/mob.c
parente076fe68e16cea8a4da725cec4f91d9870f2d666 (diff)
downloadhercules-5333c3d2c92c21b0ffc709acae24e32129cd8aec.tar.gz
hercules-5333c3d2c92c21b0ffc709acae24e32129cd8aec.tar.bz2
hercules-5333c3d2c92c21b0ffc709acae24e32129cd8aec.tar.xz
hercules-5333c3d2c92c21b0ffc709acae24e32129cd8aec.zip
- Updated mob ai behaviour so that mobs use IDLE state skills when their current target cannot be reached for melee fighting.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6655 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 0328e42d1..c723b2dab 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1191,14 +1191,19 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap)
{ //Out of range...
if (!(mode&MD_CANMOVE))
{ //Can't chase. Attempt to use a ranged skill at least?
- md->state.skillstate = md->state.aggressive?MSS_ANGRY:MSS_BERSERK;
- mobskill_use(md, tick, -1);
- mob_unlocktarget(md,tick);
+ md->state.skillstate = MSS_IDLE;
+ if (!mobskill_use(md, tick, -1))
+ mob_unlocktarget(md,tick);
return 0;
}
- if (!can_move) //Stuck. Wait before walking.
+ if (!can_move)
+ { //Stuck. Use an idle skill. o.O'
+ md->state.skillstate = MSS_IDLE;
+ if (!(++md->ud.walk_count%IDLE_SKILL_INTERVAL))
+ mobskill_use(md, tick, -1);
return 0;
+ }
md->state.skillstate = md->state.aggressive?MSS_FOLLOW:MSS_RUSH;
if (md->ud.walktimer != -1 && md->ud.target == tbl->id &&