From 3be4acc3f4d83cfb8558fbe129edee90668db443 Mon Sep 17 00:00:00 2001 From: skotlex Date: Wed, 8 Mar 2006 18:00:19 +0000 Subject: - Mobs will now chase you even if you hit them from outside their range of view. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5519 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 2 ++ src/map/mob.c | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index d4d5419d3..d17914f97 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -5,6 +5,8 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EV GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS 2006/03/08 + * Mobs will now chase you even if you hit them from outside their range of + view. [Skotlex] * Fixed item disappearing from the floor when you attempted to pick it up and there was no room in your inventory. [Skotlex] * About half-ish nj/gs skills are semi/fully-done. No effect/status yet though. [Vicious] diff --git a/src/map/mob.c b/src/map/mob.c index 3995eba31..036461ea3 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -41,6 +41,8 @@ #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]; struct mob_db *mob_dummy = NULL; //Dummy mob to be returned when a non-existant one is requested. @@ -1294,8 +1296,8 @@ int mob_target(struct mob_data *md,struct block_list *bl,int dist) if (md->state.provoke_flag) md->state.provoke_flag = 0; md->min_chase=dist+md->db->range2; - if(md->min_chase>26) - md->min_chase=26; + if(md->min_chase>MAX_MINCHASE) + md->min_chase=MAX_MINCHASE; return 0; } @@ -1496,6 +1498,8 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick) md->state.targettype = ATTACKABLE; md->state.aggressive = (status_get_mode(&md->bl)&MD_ANGRY)?1:0; md->min_chase=md->db->range2+distance_bl(&md->bl, tbl); + if(md->min_chase>MAX_MINCHASE) + md->min_chase=MAX_MINCHASE; } } break; @@ -1515,6 +1519,8 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick) md->state.targettype = ATTACKABLE; md->state.aggressive = (status_get_mode(&md->bl)&MD_ANGRY)?1:0; md->min_chase=md->db->range2+distance_bl(&md->bl, tbl); + if(md->min_chase>MAX_MINCHASE) + md->min_chase=MAX_MINCHASE; } } break; @@ -1660,7 +1666,7 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) (dist = distance_bl(&md->bl, abl)) >= 32 || battle_check_target(bl, abl, BCT_ENEMY) <= 0 || (battle_config.mob_ai&2 && !status_check_skilluse(bl, abl, 0, 0)) || - !mob_can_reach(md, abl, md->db->range2, MSS_RUSH) || + !mob_can_reach(md, abl, dist+2, MSS_RUSH) || ( //Gangster Paradise check abl->type == BL_PC && !(mode&MD_BOSS) && ((struct map_session_data*)abl)->state.gangsterparadise @@ -1700,9 +1706,9 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) md->state.aggressive = 0; //Retaliating. attack_type = 1; md->attacked_count = 0; - md->min_chase = dist + md->db->range2; - if (md->min_chase > 26) - md->min_chase = 26; + md->min_chase = dist+md->db->range2; + if(md->min_chase>MAX_MINCHASE) + md->min_chase=MAX_MINCHASE; tbl = abl; //Set the new target } } @@ -1780,7 +1786,7 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) ) { return 0; //No need to follow, already doing it? } - search_size = (blind_flag) ? 3 : ((md->min_chase > md->db->range2) ? md->min_chase : md->db->range2); + search_size = blind_flag?3: md->min_chase; if (!mob_can_reach(md, tbl, search_size, MSS_RUSH)) { //Can't reach mob_unlocktarget(md,tick); -- cgit v1.2.3-70-g09d2