diff --git a/src/map/mob.c b/src/map/mob.c index 83ab17bd82..9cc19f52ca 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1180,12 +1180,11 @@ static int mob_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap) target = va_arg(ap,struct block_list**); dist = distance_bl(&md->bl, bl); - if (mob_can_reach(md,bl,dist+1, MSS_LOOT) && (*target) == NULL) { + if (mob_can_reach(md,bl,dist+1, MSS_LOOT) && ((*target) == NULL || md->target_id > bl->id)) { (*target) = bl; md->target_id = bl->id; md->min_chase = md->db->range3; - } else - mob_stop_walking(md, 1); // Stop walking immediately if item is no longer on the ground. + } return 0; } @@ -1561,7 +1560,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick) if (!tbl && mode&MD_LOOTER && md->lootitem && DIFF_TICK(tick, md->ud.canact_tick) > 0 && (md->lootitem_count < LOOTITEM_SIZE || battle_config.monster_loot_type != 1)) { // Scan area for items to loot, avoid trying to loot if the mob is full and can't consume the items. - map_foreachinrange (mob_ai_sub_hard_lootsearch, &md->bl, view_range, BL_ITEM, md, &tbl); + map_foreachinshootrange (mob_ai_sub_hard_lootsearch, &md->bl, view_range, BL_ITEM, md, &tbl); } if ((!tbl && mode&MD_AGGRESSIVE) || md->state.skillstate == MSS_FOLLOW) @@ -1607,7 +1606,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick) mob_unlocktarget(md, tick); return true; } - if (!check_distance_bl(&md->bl, tbl, 1)) + if (!check_distance_bl(&md->bl, tbl, 0)) { //Still not within loot range. if (!(mode&MD_CANMOVE)) { //A looter that can't move? Real smart. @@ -1617,7 +1616,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick) if (!can_move) //Stuck. Wait before walking. return true; md->state.skillstate = MSS_LOOT; - if (!unit_walktobl(&md->bl, tbl, 1, 1)) + if (!unit_walktobl(&md->bl, tbl, 0, 1)) mob_unlocktarget(md, tick); //Can't loot... return true; } diff --git a/src/map/skill.c b/src/map/skill.c index 3bb042b883..87143528d9 100755 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -11664,7 +11664,6 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char } pc_stop_attack(sd); - pc_stop_walking(sd,0); if(battle_config.skill_log && battle_config.skill_log&BL_PC) ShowInfo("PC %d skill castend skill =%d map=%s\n",sd->bl.id,skill_id,mapname); diff --git a/src/map/unit.c b/src/map/unit.c index 15a3b8a66a..bde0c9db09 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -722,7 +722,7 @@ static int unit_walktobl_sub(int tid, unsigned int tick, int id, intptr_t data) * @param tbl: Target object * @param range: How close to get to target (or attack range if flag&2) * @param flag: Extra behaviour - * &1: Use hard path seek (obstacles will be walked around if possible) + * &1: Use easy path seek (obstacles will not be walked around) * &2: Start attacking upon arrival within range, otherwise just walk to target * @return 1: Started walking or set timer 0: Failed */ @@ -748,6 +748,10 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, unsi ud->target_to = 0; return 0; + } else if (range == 0) { + //Should walk on the same cell as target (for looters) + ud->to_x = tbl->x; + ud->to_y = tbl->y; } ud->state.walk_easy = flag&1;