summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-12 15:19:49 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-12 15:19:49 +0000
commitd3446b8051e0f084721198b85c067597f26c5dfd (patch)
treecf3b13227a8de1a1c7c8b131c6b3bd96e94bdc7f /src/map/mob.c
parent55ba4be17e2abefa0fdaa25c387bf30bdaf49332 (diff)
downloadhercules-d3446b8051e0f084721198b85c067597f26c5dfd.tar.gz
hercules-d3446b8051e0f084721198b85c067597f26c5dfd.tar.bz2
hercules-d3446b8051e0f084721198b85c067597f26c5dfd.tar.xz
hercules-d3446b8051e0f084721198b85c067597f26c5dfd.zip
- Changed the meaning of inf2=0x1000. Now it is used to "disable usage on enemies", which only works for non-aggressive (inf!=1) skills.
- If a skill is party/guild only (inf2 0x400/0x800) it will also be castable on enemies if the skill's inf is 1 (offensive target) - Corrected the mob behaviour when it locks into an enemy it can't chase. Previously it would get stuck on a lock->unlock->lock loop, with each unlock resetting the "random walk" timer, causing the mob to just idle in place. Now they will attempt idle skills and no longer reset the "random walk" timer, so they behave as if they were in Idle state properly. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10234 54d463be-8e91-2dee-dedb-b68131a5f0ec
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;
}