diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-02-15 03:51:59 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-02-15 03:51:59 +0000 |
commit | 5a6c73fcc0948c1b570b5df99b191514d06337dd (patch) | |
tree | 8c545cf9b0134ead22a19e29ed65042d799b7b78 /src/map/mob.c | |
parent | 83e2e93b0fc640dfc733dd67f55bbb9cae3178cf (diff) | |
download | hercules-5a6c73fcc0948c1b570b5df99b191514d06337dd.tar.gz hercules-5a6c73fcc0948c1b570b5df99b191514d06337dd.tar.bz2 hercules-5a6c73fcc0948c1b570b5df99b191514d06337dd.tar.xz hercules-5a6c73fcc0948c1b570b5df99b191514d06337dd.zip |
- Some cleaning of the slave moving code.
- Fixed the icon for Provoke not showing.
- Fixed skill_timerskills (type was not being stored, water-ball at least got broken, doing only 1 hit always)
- pc_setinventorydata won't try to set data for positions with no item.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5283 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index 1c9ec49f3..40bf82cb6 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1420,34 +1420,30 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick) return 0;
}
- // Although there is the master, since it is somewhat far, it approaches.
- if((!md->target_id || md->state.targettype == NONE_ATTACKABLE) && mob_can_move(md) &&
- md->master_dist<md->db->range3 && (md->walkpath.path_pos>=md->walkpath.path_len || md->walkpath.path_len==0)){
+ // Approach master if within view range, chase back to Master's area also if standing on top of the master.
+ if(md->master_dist<md->db->range3 && (md->master_dist>MOB_SLAVEDISTANCE || md->master_dist == 0) &&
+ mob_can_move(md) && md->state.state == MS_IDLE)
+ {
int i=0,dx,dy,ret;
- if(md->master_dist>MOB_SLAVEDISTANCE || md->master_dist == 0)
- { //Chase back to Master's area also if standing on top of the master.
- do {
- if(i<=5){
- dx=bl->x - md->bl.x;
- dy=bl->y - md->bl.y;
+ do {
+ if(i<=5){
+ dx=bl->x - md->bl.x;
+ dy=bl->y - md->bl.y;
- if(dx<0) dx+=rand()%MOB_SLAVEDISTANCE +1;
- else if(dx>0) dx-=rand()%MOB_SLAVEDISTANCE +1;
-
- if(dy<0) dy+=rand()%MOB_SLAVEDISTANCE +1;
- else if(dy>0) dy-=rand()%MOB_SLAVEDISTANCE +1;
+ if(dx<0) dx+=rand()%MOB_SLAVEDISTANCE +1;
+ else if(dx>0) dx-=rand()%MOB_SLAVEDISTANCE +1;
+ if(dy<0) dy+=rand()%MOB_SLAVEDISTANCE +1;
+ else if(dy>0) dy-=rand()%MOB_SLAVEDISTANCE +1;
- }else{
- ret = MOB_SLAVEDISTANCE*2+1;
- dx=bl->x - md->bl.x + rand()%ret - MOB_SLAVEDISTANCE;
- dy=bl->y - md->bl.y + rand()%ret - MOB_SLAVEDISTANCE;
- }
+ }else{
+ ret = MOB_SLAVEDISTANCE*2+1;
+ dx=bl->x - md->bl.x + rand()%ret - MOB_SLAVEDISTANCE;
+ dy=bl->y - md->bl.y + rand()%ret - MOB_SLAVEDISTANCE;
+ }
- ret=mob_walktoxy(md,md->bl.x+dx,md->bl.y+dy,0);
- i++;
- } while(ret && i<10);
- md->next_walktime=tick+1000;
- }
+ ret=mob_walktoxy(md,md->bl.x+dx,md->bl.y+dy,0);
+ i++;
+ } while(ret && i<10);
}
} else if (bl->m != md->bl.m && map_flag_gvg(md->bl.m)) {
//Delete the summoned mob if it's in a gvg ground and the master is elsewhere. [Skotlex]
|