Skip to content
Permalink
Browse files

Merge pull request #2550 from skyleo/cliff_aggro_ranged_no_attack_fix

Fix aggressive ranged mobs not attacking from above a cliff
  • Loading branch information...
MishimaHaruna committed Oct 20, 2019
2 parents 275edef + 4f9cafb commit 436ae38fbd595cd49c047166e55899696cd72a4d
Showing with 9 additions and 7 deletions.
  1. +9 −7 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;

0 comments on commit 436ae38

Please sign in to comment.
You can’t perform that action at this time.