summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-07 20:15:23 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-07 20:15:23 +0000
commitdd2e4d4fea67858cb39260549de6a2ccb49eb7b9 (patch)
tree2f94180e9494eefcaf6f8a2dd7b0b0c74b5c7da8 /src/map/mob.c
parent5d9d254ef290e9cc8acfdd08af279fdc1a439853 (diff)
downloadhercules-dd2e4d4fea67858cb39260549de6a2ccb49eb7b9.tar.gz
hercules-dd2e4d4fea67858cb39260549de6a2ccb49eb7b9.tar.bz2
hercules-dd2e4d4fea67858cb39260549de6a2ccb49eb7b9.tar.xz
hercules-dd2e4d4fea67858cb39260549de6a2ccb49eb7b9.zip
- 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
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c25
1 files changed, 24 insertions, 1 deletions
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;