From 0352df880b0e71766ce0c3886355e285e329429d Mon Sep 17 00:00:00 2001 From: shennetsind Date: Fri, 23 Mar 2012 08:27:26 +0000 Subject: Follow up r15777, reworked skill_icewall_block so that it stops any attacks against anyone who got blocked off the wall, not only caster. Modified iw block algorithim on mob_ai_sub_hard_activesearch git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15779 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/mob.c | 10 +++++++--- src/map/skill.c | 20 +++++++++----------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/map/mob.c b/src/map/mob.c index bdc661f58..27d696f88 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1016,10 +1016,14 @@ static int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap) dist = distance_bl(&md->bl, bl); if( ((*target) == NULL || !check_distance_bl(&md->bl, *target, dist)) && - battle_check_range(&md->bl,bl,md->db->range2) && ( map[bl->m].icewall_num && ( - check_distance_bl(&md->bl, bl, status_get_range(&md->bl) ) || - path_search_long(NULL,bl->m,md->bl.x,md->bl.y,bl->x,bl->y,CELL_CHKICEWALL) ) ) + battle_check_range(&md->bl,bl,md->db->range2) ) { //Pick closest target? + if( map[bl->m].icewall_num && + !path_search_long(NULL,bl->m,md->bl.x,md->bl.y,bl->x,bl->y,CELL_CHKICEWALL) ) { + + if( !check_distance_bl(&md->bl, bl, status_get_range(&md->bl) ) ) + return 0; + } (*target) = bl; md->target_id=bl->id; md->min_chase= dist + md->db->range3; diff --git a/src/map/skill.c b/src/map/skill.c index 2fe268eaa..c8dbd1d5f 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -9389,22 +9389,20 @@ static bool skill_dance_switch(struct skill_unit* unit, int flag) * Upon Ice Wall cast it checks all nearby mobs to find any who may be blocked by the IW **/ static int skill_icewall_block(struct block_list *bl,va_list ap) { - struct block_list *src; + struct block_list *target = NULL; struct mob_data *md = ((TBL_MOB*)bl); nullpo_ret(bl); - - src = va_arg(ap,struct block_list *); - - nullpo_ret(src); nullpo_ret(md); + if( !md->target_id ) + return 0; + nullpo_ret( ( target = map_id2bl(md->target_id) ) ); - if( md->target_id != src->id - || check_distance_bl(bl, src, status_get_range(bl) ) - || path_search_long(NULL,bl->m,bl->x,bl->y,src->x,src->y,CELL_CHKICEWALL) ) + if( path_search_long(NULL,bl->m,bl->x,bl->y,target->x,target->y,CELL_CHKICEWALL) ) return 0; - mob_unlocktarget(md,gettick()); + if( !check_distance_bl(bl, target, status_get_range(bl) ) ) + mob_unlocktarget(md,gettick()); return 0; } @@ -9820,8 +9818,8 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli //success, unit created. switch( skillid ) { - case WZ_ICEWALL: //Store number of tiles. - map_foreachinrange(skill_icewall_block, src, AREA_SIZE, BL_MOB, src); + case WZ_ICEWALL: + map_foreachinrange(skill_icewall_block, src, AREA_SIZE, BL_MOB); break; case NJ_TATAMIGAESHI: //Store number of tiles. group->val1 = group->alive_count; -- cgit v1.2.3-70-g09d2