From dd2e4d4fea67858cb39260549de6a2ccb49eb7b9 Mon Sep 17 00:00:00 2001 From: skotlex Date: Wed, 7 Jun 2006 20:15:23 +0000 Subject: - Added config setting mob_npc_warp, when set to yes, enables mobs to be warped between maps when stepping on a npc-warp. - Added monster_ai setting &64, when enabled makes a mob run to any nearby npc-warp when their current target has switched maps. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7039 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/mob.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/map/mob.c') diff --git a/src/map/mob.c b/src/map/mob.c index 346003618..ea92b5122 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -866,6 +866,23 @@ static int mob_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap) return 0; } +static int mob_ai_sub_hard_warpsearch(struct block_list *bl,va_list ap) +{ + struct mob_data* md; + struct block_list **target; + + md=va_arg(ap,struct mob_data *); + target= va_arg(ap,struct block_list**); + + if (*target) return 0; + + if(bl->subtype == WARP) + { + *target = bl; + return 1; + } + return 0; +} /*========================================== * Processing of slave monsters *------------------------------------------ @@ -1077,7 +1094,13 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) tbl->type == BL_PC && !(mode&MD_BOSS) && ((TBL_PC*)tbl)->state.gangsterparadise )) { //Unlock current target. - if (battle_config.mob_ai&8) //Inmediately stop chasing. + if (tbl && tbl->m != md->bl.m && battle_config.mob_ai&64) + { //Chase to a nearby warp [Skotlex] + tbl = NULL; + map_foreachinrange (mob_ai_sub_hard_warpsearch, &md->bl, + view_range, BL_NPC, md, &tbl); + if (tbl) unit_walktobl(&md->bl, tbl, 0, 1); + } else if (battle_config.mob_ai&8) //Inmediately stop chasing. mob_stop_walking(md,1); mob_unlocktarget(md, tick-(battle_config.mob_ai&8?3000:0)); //Imediately do random walk. tbl = NULL; -- cgit v1.2.3-60-g2f50