diff options
author | skyleo <skyleo@skyleo.de> | 2019-08-25 19:59:02 +0200 |
---|---|---|
committer | skyleo <skyleo@skyleo.de> | 2019-10-05 16:46:21 +0200 |
commit | 4f9cafbc0ecee81ff46a126cff1d789a9934cda4 (patch) | |
tree | 9c64885b95a337f4c8b08cef9b211f995beb05fb /src/map/mob.c | |
parent | d026e28fd78f60dfa21da381f17f2a8cc9ae3d11 (diff) | |
download | hercules-4f9cafbc0ecee81ff46a126cff1d789a9934cda4.tar.gz hercules-4f9cafbc0ecee81ff46a126cff1d789a9934cda4.tar.bz2 hercules-4f9cafbc0ecee81ff46a126cff1d789a9934cda4.tar.xz hercules-4f9cafbc0ecee81ff46a126cff1d789a9934cda4.zip |
Fix aggressive ranged mobs not attacking from above a cliff
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index e04d6944e..a463e3b9c 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1173,13 +1173,15 @@ static int mob_ai_sub_hard_activesearch(struct block_list *bl, va_list ap) battle->check_range(&md->bl,bl,md->db->range2) ) { //Pick closest target? #ifdef ACTIVEPATHSEARCH - struct walkpath_data wpd; - if (!path->search(&wpd, &md->bl, md->bl.m, md->bl.x, md->bl.y, bl->x, bl->y, 0, CELL_CHKNOPASS)) // Count walk path cells - return 0; - //Standing monsters use range2, walking monsters use range3 - if ((md->ud.walktimer == INVALID_TIMER && wpd.path_len > md->db->range2) - || (md->ud.walktimer != INVALID_TIMER && wpd.path_len > md->db->range3)) - return 0; + struct walkpath_data wpd; + bool is_standing = (md->ud.walktimer == INVALID_TIMER); + if (!path->search(&wpd, &md->bl, md->bl.m, md->bl.x, md->bl.y, bl->x, bl->y, 0, CELL_CHKNOPASS) // Count walk path cells + || (is_standing && wpd.path_len > md->db->range2) //Standing monsters use range2, walking monsters use range3 + || (!is_standing && wpd.path_len > md->db->range3)) { + if (!check_distance_bl(&md->bl, bl, md->status.rhw.range) + || !path->search_long(NULL, &md->bl, md->bl.m, md->bl.x, md->bl.y, bl->x, bl->y, CELL_CHKWALL)) + return 0; + } #endif (*target) = bl; md->target_id=bl->id; |