summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--src/map/mob.c24
-rw-r--r--src/map/mob.h3
-rw-r--r--src/map/skill.c2
4 files changed, 14 insertions, 16 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 35a2dfd86..a3ee9e22f 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/06/02
+ * Some cleaning of the mob slave ai. [Skotlex]
* Corrected Brandish Spear to work on levels above 10. [Skotlex]
* Updated Two-HandQuicken, One-HandQuicken to give 30 +2*lv% aspd-rate for
skill levels above 10 (meant for boss casted skills) [Skotlex]
diff --git a/src/map/mob.c b/src/map/mob.c
index c18f83b66..55bc02af9 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -41,8 +41,6 @@
#define MOB_LAZYMOVEPERC 50 // Move probability in the negligent mode MOB (rate of 1000 minute)
#define MOB_LAZYWARPPERC 20 // Warp probability in the negligent mode MOB (rate of 1000 minute)
-#define MOB_SLAVEDISTANCE 2 //Distance that slaves should keep from their master.
-
#define MAX_MINCHASE 30 //Max minimum chase value to use for mobs.
//Dynamic mob database, allows saving of memory when there's big gaps in the mob_db [Skotlex]
struct mob_db *mob_db_data[MAX_MOB_DB+1];
@@ -879,7 +877,7 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
bl=map_id2bl(md->master_id);
- if (!bl || status_isdead(bl)) { //主が死亡しているか見つからない
+ if (!bl || status_isdead(bl)) {
status_kill(&md->bl);
return 0;
}
@@ -887,27 +885,22 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
if(status_get_mode(&md->bl)&MD_CANMOVE)
{ //If the mob can move, follow around. [Check by Skotlex]
- if(bl->m != md->bl.m || md->master_dist > 30)
- { // Since it is not in the same map (or is way to far), just warp it
- unit_warp(&md->bl,bl->m,bl->x,bl->y,3);
- md->master_dist = 0;
- return 0;
- }
-
// Distance with between slave and master is measured.
old_dist=md->master_dist;
md->master_dist=distance_bl(&md->bl, bl);
// Since the master was in near immediately before, teleport is carried out and it pursues.
- if(old_dist<10 && md->master_dist>18){
- unit_warp(&md->bl,-1,bl->x,bl->y,3);
+ if(bl->m != md->bl.m ||
+ (old_dist<10 && md->master_dist>18) ||
+ md->master_dist > MAX_MINCHASE
+ ){
md->master_dist = 0;
+ unit_warp(&md->bl,bl->m,bl->x,bl->y,3);
return 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<AREA_SIZE &&
- (md->master_dist>MOB_SLAVEDISTANCE || md->master_dist == 0) &&
+ if((md->master_dist>MOB_SLAVEDISTANCE || md->master_dist == 0) &&
unit_can_move(&md->bl))
{
short x = bl->x, y = bl->y;
@@ -922,7 +915,8 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
}
//Avoid attempting to lock the master's target too often to avoid unnecessary overload. [Skotlex]
- if (DIFF_TICK(md->last_linktime, tick) < MIN_MOBLINKTIME && !md->target_id) {
+ if (DIFF_TICK(md->last_linktime, tick) < MIN_MOBLINKTIME && !md->target_id)
+ {
struct unit_data *ud = unit_bl2ud(bl);
md->last_linktime = tick;
diff --git a/src/map/mob.h b/src/map/mob.h
index 64f234285..4bfc76603 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -18,6 +18,9 @@
//Min time before mobs do a check to call nearby friends for help (or for slaves to support their master)
#define MIN_MOBLINKTIME 1000
+//Distance that slaves should keep from their master.
+#define MOB_SLAVEDISTANCE 2
+
// These define the range of available IDs for clones. [Valaris]
#define MOB_CLONE_START 9001
#define MOB_CLONE_END 10000
diff --git a/src/map/skill.c b/src/map/skill.c
index b5a54e041..6c12f7a20 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -4828,7 +4828,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
case NPC_CALLSLAVE:
- mob_warpslave(src,2);
+ mob_warpslave(src,MOB_SLAVEDISTANCE);
break;
case NPC_RANDOMMOVE: