diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-02-18 06:10:49 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-02-18 06:10:49 +0000 |
commit | 1f94317bebf10175fb02c0f22e32a9010033a6c9 (patch) | |
tree | 293b36db504bfe3015b967a517cfea2c87ab77ac /src | |
parent | 61047a615711051cd2896bec8c88816690a2bd0b (diff) | |
download | hercules-1f94317bebf10175fb02c0f22e32a9010033a6c9.tar.gz hercules-1f94317bebf10175fb02c0f22e32a9010033a6c9.tar.bz2 hercules-1f94317bebf10175fb02c0f22e32a9010033a6c9.tar.xz hercules-1f94317bebf10175fb02c0f22e32a9010033a6c9.zip |
- Added an alternate path searching method for non-stacking mode.
- Allowed pc_setpos to place players on top of cells that are stacked in CELL_NOSTACK mode.
- Fixed a missing break that was making Heal, Resurrection and some others become attack skills x.x'
- Fixed a logic bug in the mob-walk code that was making them get stuck and not move (triggered quite often when the cell no stack mod is enabled)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5320 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/mob.c | 35 | ||||
-rw-r--r-- | src/map/pc.c | 4 | ||||
-rw-r--r-- | src/map/skill.c | 1 |
3 files changed, 29 insertions, 11 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index 5cb4e5c92..6be660c9e 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -509,7 +509,6 @@ static int mob_walktoxy_sub(struct mob_data *md); */
static int mob_walk(struct mob_data *md,unsigned int tick,int data)
{
- int moveblock;
int i;
static int dirx[8]={0,-1,-1,-1,0,1,1,1};
static int diry[8]={1,1,0,-1,-1,-1,0,1};
@@ -550,8 +549,6 @@ static int mob_walk(struct mob_data *md,unsigned int tick,int data) return 0;
}
- moveblock = ( x/BLOCK_SIZE != (x+dx)/BLOCK_SIZE || y/BLOCK_SIZE != (y+dy)/BLOCK_SIZE);
-
md->state.state=MS_WALK;
map_foreachinmovearea(clif_moboutsight,md->bl.m,x-AREA_SIZE,y-AREA_SIZE,x+AREA_SIZE,y+AREA_SIZE,dx,dy,BL_PC,md);
@@ -787,7 +784,7 @@ int mob_changestate(struct mob_data *md,int state,int type) case MS_WALK:
if((i=calc_next_walk_step(md))>0){
i = i>>2;
- md->timer=add_timer(gettick()+i,mob_timer,md->bl.id,0);
+ md->timer=add_timer(gettick()+i,mob_timer,md->bl.id, md->walkpath.path_pos);
}
else
md->state.state=MS_IDLE;
@@ -890,20 +887,13 @@ static int mob_timer(int tid,unsigned int tick,int id,int data) static int mob_walktoxy_sub(struct mob_data *md)
{
struct walkpath_data wpd;
- int x,y;
- static int dirx[8]={0,-1,-1,-1,0,1,1,1};
- static int diry[8]={1,1,0,-1,-1,-1,0,1};
-
nullpo_retr(0, md);
-
memset(&wpd, 0, sizeof(wpd));
if(path_search(&wpd,md->bl.m,md->bl.x,md->bl.y,md->to_x,md->to_y,md->state.walk_easy))
return 1;
if (wpd.path[0] >= 8)
return 1;
- x = md->bl.x+dirx[wpd.path[0]];
- y = md->bl.y+diry[wpd.path[0]];
memcpy(&md->walkpath,&wpd,sizeof(wpd));
@@ -1753,6 +1743,28 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) else if (dx > 0) dx--;
if (dy < 0) dy++;
else if (dy > 0) dy--;
+#ifdef CELL_NOSTACK
+ while (mob_walktoxy(md, md->bl.x + dx, md->bl.y + dy, 0))
+ { //Attempt to chase to nearby blocks
+ do {
+ if (i < 5) {
+ dx = tbl->x - md->bl.x + rand()%3 - 1;
+ dy = tbl->y - md->bl.y + rand()%3 - 1;
+ } else { //Try some more...
+ dx = tbl->x - md->bl.x + rand()%5 - 2;
+ dy = tbl->y - md->bl.y + rand()%5 - 2;
+ }
+ i++;
+ } while (i < 15 && map_getcell(md->bl.m, md->bl.x+dx, md->bl.y+dy, CELL_CHKSTACK));
+ if (i >= 15) {
+ //On stacked mode, it is much more likely that you just can't reach the target. So unlock it
+ mob_unlocktarget(md, tick);
+ //Make it give up for 1 second to avoid unnecessary server load in case the target is already mobbed to death.
+ mob_changestate(md,MS_DELAY,1000);
+ return 0;
+ }
+ }
+#else
while (i < 5 && mob_walktoxy(md, md->bl.x + dx, md->bl.y + dy, 0))
{ //Attempt to chase to nearby blocks
dx = tbl->x - md->bl.x + rand()%3 - 1;
@@ -1766,6 +1778,7 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) if (dy < 0) dy = 2;
else if (dy > 0) dy = -2;
}
+#endif
md->next_walktime = tick + 500;
mob_walktoxy (md, md->bl.x+dx, md->bl.y+dy, 0);
return 0;
diff --git a/src/map/pc.c b/src/map/pc.c index 4a3381e4f..0d10dfc69 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3316,7 +3316,11 @@ int pc_setpos(struct map_session_data *sd,unsigned short mapindex,int x,int y,in if(x <0 || x >= map[m].xs || y <0 || y >= map[m].ys)
x=y=0;
if((x==0 && y==0) ||
+#ifndef CELL_NOSTACK
(map_getcell(m,x,y,CELL_CHKNOPASS) && !map_getcell(m, x, y, CELL_CHKICEWALL))
+#else
+ (map_getcell(m,x,y,CELL_CHKNOPASS) && !map_getcell(m, x, y, CELL_CHKICEWALL) && !map_getcell(m, x, y, CELL_CHKSTACK))
+#endif
){ //We allow placing players on top of an ICEWALL tile to prevent force-warping players when an ice wall is placed
//at spawn points from warps and the like. [Skotlex]
if(x||y) {
diff --git a/src/map/skill.c b/src/map/skill.c index 2e12158ab..d18b87c22 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -3079,6 +3079,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in }
return skill_castend_damage_id (src, bl, skillid, skilllv, tick, flag);
}
+ break;
case NPC_SMOKING: //Since it is a self skill, this one ends here rather than in damage_id. [Skotlex]
return skill_castend_damage_id (src, bl, skillid, skilllv, tick, flag);
case CR_GRANDCROSS:
|