summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorMichieru <Michieru@users.noreply.github.com>2014-11-24 14:48:59 +0100
committerMichieru <Michieru@users.noreply.github.com>2014-11-24 14:48:59 +0100
commit0623d4ff87906d9ea0aee7bf612da2d1afdee1cd (patch)
tree65c704a8ca804f3bcfe8375c488a62acef14510b /src/map/mob.c
parent308570a239a7211aed068c3855d15c7d16f3d3b4 (diff)
downloadhercules-0623d4ff87906d9ea0aee7bf612da2d1afdee1cd.tar.gz
hercules-0623d4ff87906d9ea0aee7bf612da2d1afdee1cd.tar.bz2
hercules-0623d4ff87906d9ea0aee7bf612da2d1afdee1cd.tar.xz
hercules-0623d4ff87906d9ea0aee7bf612da2d1afdee1cd.zip
* 1st Transcendent Spirit, monster position lag fixes
- 1st Transcendent Spirit will now work as on official servers (#116) * The max total stat that is granted by the skill is now BaseLevel-10 with a maximum of 50 instead of always 50 * It will now work as Marionette Control and calculate the bonus at cast time rather than overwrite all existing bonuses * Agi Up and Blessing will now cancel the soul link - Fixed various problems that caused position lags on the client (#118) * Added a define ACTIVEPATHSEARCH in mob.c; if active (default and official), monsters will only grab targets if the walk path to the target is shorter or equal their search range; search range depends on whether the monster is moving or not (range2 for standing monsters and range3 for walking monsters); this requires a lot of CPU load, if it causes trouble, just comment the define for old behavior * Fixed a bug that made monsters display "irregular movement with position lag" continuously when a status change ended that changed their walk speed * OFFICIAL_WALKPATH now also applies to monsters * If the path search fails while a unit is already moving, we will now issue of fixpos packet so that the unit does not only stop moving on the server, but also on the client * Direction fixes - Updated the config setting attack_direction_change from 15 to 0 (official value); that means that a unit's direction will no longer change when it attacks; knock-back effects from e.g. Firewall will depend on the last direction the target walked into instead (bugreport:1322) - Ensured that the default direction of a monster is always "north", so that immobile monsters will now always be knocked back to the south by e.g. Firewall on default settings, unless a skill like e.g. Backstab changes their direction (bugreport:1322) - Fixed a bug that stopped characters server-sided and caused position lag when closing a skill menu * Magnum Break damage fixed - Targets two cells away will now only take 100%+10%*level damage (#108)
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 28e70c5c0..cb22f71c0 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -941,6 +941,7 @@ int mob_spawn (struct mob_data *md)
md->move_fail_count = 0;
md->ud.state.attack_continue = 0;
md->ud.target_to = 0;
+ md->ud.dir = 0;
if( md->spawn_timer != INVALID_TIMER )
{
timer->delete(md->spawn_timer, mob->delayspawn);
@@ -1080,6 +1081,15 @@ int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap)
((*target) == NULL || !check_distance_bl(&md->bl, *target, dist)) &&
battle->check_range(&md->bl,bl,md->db->range2)
) { //Pick closest target?
+#ifdef ACTIVEPATHSEARCH
+ struct walkpath_data wpd;
+ if (!path->search(&wpd, md->bl.m, md->bl.x, md->bl.y, bl->x, bl->y, 0, CELL_CHKNOPASS)) // Count walk path cells
+ return 0;
+ //Standing monsters use range2, walking monsters use range3
+ if ((md->ud.walktimer == INVALID_TIMER && wpd.path_len > md->db->range2)
+ || (md->ud.walktimer != INVALID_TIMER && wpd.path_len > md->db->range3))
+ return 0;
+#endif
(*target) = bl;
md->target_id=bl->id;
md->min_chase= dist + md->db->range3;