diff options
author | Michieru <Michieru@users.noreply.github.com> | 2014-11-03 11:46:22 +0100 |
---|---|---|
committer | Michieru <Michieru@users.noreply.github.com> | 2014-11-03 11:46:22 +0100 |
commit | b8abf962fd079bc3cad4498aa968f2318d1f5fde (patch) | |
tree | 941b9d312ded4e3b75360febb73922a79637c10c /src/map/mob.c | |
parent | 1c76a4249ea878bd133c16a7e8b799d51b7e8594 (diff) | |
download | hercules-b8abf962fd079bc3cad4498aa968f2318d1f5fde.tar.gz hercules-b8abf962fd079bc3cad4498aa968f2318d1f5fde.tar.bz2 hercules-b8abf962fd079bc3cad4498aa968f2318d1f5fde.tar.xz hercules-b8abf962fd079bc3cad4498aa968f2318d1f5fde.zip |
* No cell stacking implemented (official version)
- Split config cell_stack_limit into custom_cell_stack_limit (previous feature) and official_cell_stack_limit (see below)
- Expanded map_count_oncell by a flag parameter, currently only one flag is supported: only count standing units (needed for official cell stack feature)
- Added a new function map_closest_freecell that will return the closest free cell using the same order that official servers use
- Monsters will now actively search for a free cell when starting to walk randomly and when unlocking target
- When any unit finishes walking (regularly) and is not on a free cell, it will now actively search for a free cell
- Step actions will be delayed until a suitable cell was found, they will even be executed when the player walked slightly out of attack range
- Monsters will now stop instantly if their target is completely non-existent
* This is mainly for looters that had their loot taken
* Hide and most other situations still use the configuration setting monster_chase_refresh
Mega Thanks to Playtester
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index 23706d293..c05f4c4a2 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1303,6 +1303,10 @@ int mob_unlocktarget(struct mob_data *md, int64 tick) { md->ud.target_to = 0; unit->set_target(&md->ud, 0); } + if(map->count_oncell(md->bl.m, md->bl.x, md->bl.y, BL_CHAR|BL_NPC, 1) > battle_config.official_cell_stack_limit) {
+ unit->walktoxy(&md->bl, md->bl.x, md->bl.y, 8);
+ } + return 0; } /*========================================== @@ -1330,7 +1334,7 @@ int mob_randomwalk(struct mob_data *md, int64 tick) { x+=md->bl.x; y+=md->bl.y; - if(((x != md->bl.x) || (y != md->bl.y)) && map->getcell(md->bl.m,x,y,CELL_CHKPASS) && unit->walktoxy(&md->bl,x,y,0)){ + if(((x != md->bl.x) || (y != md->bl.y)) && map->getcell(md->bl.m,x,y,CELL_CHKPASS) && unit->walktoxy(&md->bl,x,y,8)){ break; } } @@ -1429,8 +1433,9 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { //No valid target if (mob->warpchase(md, tbl)) return true; //Chasing this target. - if(md->ud.walktimer != INVALID_TIMER && (!can_move || md->ud.walkpath.path_pos <= battle_config.mob_chase_refresh)) - return true; //Walk at least "mob_chase_refresh" cells before dropping the target + if(md->ud.walktimer != INVALID_TIMER && (!can_move || md->ud.walkpath.path_pos <= battle_config.mob_chase_refresh)
+ && (tbl || md->ud.walkpath.path_pos == 0))
+ return true; //Walk at least "mob_chase_refresh" cells before dropping the target unless target is non-existent mob_unlocktarget(md, tick); //Unlock target tbl = NULL; } |