diff options
author | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-12-17 10:15:48 +0000 |
---|---|---|
committer | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-12-17 10:15:48 +0000 |
commit | a89c7dda8ac0eded573e3c24d59684d15957646d (patch) | |
tree | eae0f3b8223d6f61b54c4bec331ec1caa048e330 /src/map/mob.c | |
parent | 22c197474d2aa50781523a3d20fdf7f467d5bce2 (diff) | |
download | hercules-a89c7dda8ac0eded573e3c24d59684d15957646d.tar.gz hercules-a89c7dda8ac0eded573e3c24d59684d15957646d.tar.bz2 hercules-a89c7dda8ac0eded573e3c24d59684d15957646d.tar.xz hercules-a89c7dda8ac0eded573e3c24d59684d15957646d.zip |
* Updated Sphere Mine
* Updated Wind Walk
* Added effect for Deadly poison bottle and Ice cream
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@594 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index a057d12e1..a2ddc9e99 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -928,6 +928,7 @@ int mob_spawn(int id) md->to_x=md->bl.x=x; md->to_y=md->bl.y=y; md->dir=0; + md->target_dir=0; map_addblock(&md->bl); @@ -1492,17 +1493,28 @@ static int mob_randomwalk(struct mob_data *md,int tick) speed=battle_get_speed(&md->bl); if(DIFF_TICK(md->next_walktime,tick)<0){ int i,x,y,c,d=12-md->move_fail_count; + int mask[8][2] = {{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1},{1,0},{1,1}}; if(d<5) d=5; for(i=0;i<retrycount;i++){ // Search of a movable place int r=rand(); - x=md->bl.x+r%(d*2+1)-d; - y=md->bl.y+r/(d*2+1)%(d*2+1)-d; + x=r%(d*2+1)-d; + y=r/(d*2+1)%(d*2+1)-d; + if (md->target_dir){ + if (x<0) x=0-x; + if (y<0) y=0-y; + x *= mask[md->target_dir-1][0]; + y *= mask[md->target_dir-1][1]; + } + x+=md->bl.x; + y+=md->bl.y; + if((c=map_getcell(md->bl.m,x,y))!=1 && c!=5 && mob_walktoxy(md,x,y,1)==0){ md->move_fail_count=0; break; } if(i+1>=retrycount){ md->move_fail_count++; + md->target_dir = 0; if(md->move_fail_count>1000){ if(battle_config.error_log) printf("MOB cant move. random spawn %d, class = %d\n",md->bl.id,md->class); @@ -2278,6 +2290,8 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) mobskill_use_id(md,&md->bl,skillidx);//Ž©”š‰r¥ŠJŽn md->state.special_mob_ai++; } + if (md->master_id==src->id) + md->target_dir=map_calc_dir(src,md->bl.x,md->bl.y)+1; } if(md->hp>0){ |