diff options
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index 3e2386bfb..40eb49fe6 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1596,6 +1596,8 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) int i,dx,dy,ret,dist; int attack_type=0; int mode,race; + int search_size = AREA_SIZE*2; + int blind_flag = 0; nullpo_retr(0, bl); nullpo_retr(0, ap); @@ -1625,6 +1627,9 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) if((md->opt1 > 0 && md->opt1 != 6) || md->state.state==MS_DELAY || md->sc_data[SC_BLADESTOP].timer != -1) return 0; + if (md->sc_data && md->sc_data[SC_BLIND].timer != -1) + blind_flag = 1; + if(!(mode&0x80) && md->target_id > 0) md->target_id = 0; @@ -1649,7 +1654,8 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) if(abl->type==BL_PC) asd=(struct map_session_data *)abl; if(asd==NULL || md->bl.m != abl->m || abl->prev == NULL || asd->invincible_timer != -1 || pc_isinvisible(asd) || - (dist=distance(md->bl.x,md->bl.y,abl->x,abl->y))>=32 || battle_check_target(bl,abl,BCT_ENEMY)==0) + (dist=distance(md->bl.x,md->bl.y,abl->x,abl->y))>=32 || battle_check_target(bl,abl,BCT_ENEMY)==0 || + (blind_flag && dist>3)) md->attacked_id=0; else { //距離が遠い場合はタゲを変更しない @@ -1676,15 +1682,16 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) if( (!md->target_id || md->state.targettype == NONE_ATTACKABLE) && mode&0x04 && !md->state.master_check && battle_config.monster_active_enable){ i=0; + search_size = (blind_flag) ? 3 : AREA_SIZE*2; if(md->state.special_mob_ai){ map_foreachinarea(mob_ai_sub_hard_activesearch,md->bl.m, - md->bl.x-AREA_SIZE*2,md->bl.y-AREA_SIZE*2, - md->bl.x+AREA_SIZE*2,md->bl.y+AREA_SIZE*2, + md->bl.x-search_size,md->bl.y-search_size, + md->bl.x+search_size,md->bl.y+search_size, 0,md,&i); }else{ map_foreachinarea(mob_ai_sub_hard_activesearch,md->bl.m, - md->bl.x-AREA_SIZE*2,md->bl.y-AREA_SIZE*2, - md->bl.x+AREA_SIZE*2,md->bl.y+AREA_SIZE*2, + md->bl.x-search_size,md->bl.y-search_size, + md->bl.x+search_size,md->bl.y+search_size, BL_PC,md,&i); } } @@ -1692,9 +1699,10 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) // The item search of a route monster if( !md->target_id && mode&0x02 && !md->state.master_check){ i=0; + search_size = (blind_flag) ? 3 : AREA_SIZE*2; map_foreachinarea(mob_ai_sub_hard_lootsearch,md->bl.m, - md->bl.x-AREA_SIZE*2,md->bl.y-AREA_SIZE*2, - md->bl.x+AREA_SIZE*2,md->bl.y+AREA_SIZE*2, + md->bl.x-search_size,md->bl.y-search_size, + md->bl.x+search_size,md->bl.y+search_size, BL_ITEM,md,&i); } @@ -1706,7 +1714,7 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) else if(tbl->type==BL_MOB) tmd=(struct mob_data *)tbl; if(tsd || tmd) { - if(tbl->m != md->bl.m || tbl->prev == NULL || (dist=distance(md->bl.x,md->bl.y,tbl->x,tbl->y))>=md->min_chase) + if(tbl->m != md->bl.m || tbl->prev == NULL || (dist=distance(md->bl.x,md->bl.y,tbl->x,tbl->y)) >= search_size || (blind_flag && dist>3)) mob_unlocktarget(md,tick); // 別マップか、視界外 else if( tsd && !(mode&0x20) && (tsd->sc_data[SC_TRICKDEAD].timer != -1 || tsd->sc_data[SC_BASILICA].timer != -1 || ((pc_ishiding(tsd) || tsd->state.gangsterparadise) && @@ -1725,9 +1733,11 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) // if(md->timer != -1 && (DIFF_TICK(md->next_walktime,tick)<0 || distance(md->to_x,md->to_y,tsd->bl.x,tsd->bl.y)<2) ) if(md->timer != -1 && md->state.state!=MS_ATTACK && (DIFF_TICK(md->next_walktime,tick)<0 || distance(md->to_x,md->to_y,tbl->x,tbl->y)<2) ) return 0; // 既に移動中 - if( !mob_can_reach(md,tbl,(md->min_chase>13)?md->min_chase:13) ) + search_size = (blind_flag) ? 3 : + ((md->min_chase > 13) ? md->min_chase : 13); + if(!mob_can_reach(md,tbl, search_size)) mob_unlocktarget(md,tick); // 移動できないのでタゲ解除(IWとか?) - else{ + else { // 追跡 md->next_walktime=tick+500; i=0; @@ -1761,8 +1771,8 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) if(dy<0) dy=2; else if(dy>0) dy=-2; mob_walktoxy(md,md->bl.x+dx,md->bl.y+dy,0); + } } - } } else { // 攻撃射程範囲内 md->state.skillstate=MSS_ATTACK; if(md->state.state==MS_WALK) @@ -1770,23 +1780,17 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) if(md->state.state==MS_ATTACK) return 0; // 既に攻撃中 mob_changestate(md,MS_ATTACK,attack_type); - -/* if(mode&0x08){ // リンクモンスター - map_foreachinarea(mob_ai_sub_hard_linksearch,md->bl.m, - md->bl.x-13,md->bl.y-13, - md->bl.x+13,md->bl.y+13, - BL_MOB,md,&tsd->bl); - }*/ } return 0; - }else{ // ルートモンスター処理 + } else { // ルートモンスター処理 if(tbl == NULL || tbl->type != BL_ITEM ||tbl->m != md->bl.m || - (dist=distance(md->bl.x,md->bl.y,tbl->x,tbl->y))>=md->min_chase || !md->lootitem){ + (dist=distance(md->bl.x,md->bl.y,tbl->x,tbl->y))>=md->min_chase || !md->lootitem | + (blind_flag && dist>=4)){ // 遠すぎるかアイテムがなくなった mob_unlocktarget(md,tick); if(md->state.state==MS_WALK) mob_stop_walking(md,1); // 歩行中なら停止 - }else if(dist){ + } else if(dist) { if(!(mode&1)){ // 移動しないモード mob_unlocktarget(md,tick); return 0; |