Pārlūkot izejas kodu

- Added monster_ai&16 setting for executing the hard ai on ALL mobs in maps with players instead of just mobs in the vecinity of players.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5687 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 19 gadi atpakaļ
vecāks
revīzija
ee1080a99f
3 mainītis faili ar 23 papildinājumiem un 11 dzēšanām
  1. 2 0
      Changelog-Trunk.txt
  2. 2 0
      conf-tmpl/battle/monster.conf
  3. 19 11
      src/map/mob.c

+ 2 - 0
Changelog-Trunk.txt

@@ -6,6 +6,8 @@ GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALAR
 
 
 2006/03/18
+	* Added monster_ai&16 setting for executing the hard ai on ALL mobs in maps
+	  with players instead of just mobs in the vecinity of players. [Skotlex]
 	* Cleaned up some guild functions. [LuzZza]
 	- Now guild leaving/explusion packets sends correctly.
 	- Fix to prevent creation alliance/opposition with same guilds.

+ 2 - 0
conf-tmpl/battle/monster.conf

@@ -60,6 +60,8 @@ monster_max_aspd: 199
 //    to their last target tile. When set mobs also scatter as soon as they lose their target. Use this mode to 
 //    make it much harder to mob-train by hiding and collecting them on a single spot (ie: GrimTooth training)
 //16: If set, mob skills defined for friends will also trigger on themselves.
+//32: When set, the monster ai is executed for all monsters in maps that have 
+//    players on them, instead of only for mobs who are in the vecinity of players.
 monster_ai: 0
 
 // Allow monsters to be aggresive and attack first? (Note 1)

+ 19 - 11
src/map/mob.c

@@ -1957,17 +1957,6 @@ static int mob_ai_sub_foreachclient(struct map_session_data *sd,va_list ap)
 	return 0;
 }
 
-/*==========================================
- * Serious processing for mob in PC field of view   (interval timer function)
- *------------------------------------------
- */
-static int mob_ai_hard(int tid,unsigned int tick,int id,int data)
-{
-	clif_foreachclient(mob_ai_sub_foreachclient,tick);
-
-	return 0;
-}
-
 /*==========================================
  * Negligent mode MOB AI (PC is not in near)
  *------------------------------------------
@@ -1986,6 +1975,10 @@ static int mob_ai_sub_lazy(DBKey key,void * data,va_list app)
 		return 0;
 
 	ap = va_arg(app, va_list);
+
+	if (battle_config.mob_ai&32 && map[md->bl.m].users>0)
+		return mob_ai_sub_hard(&md->bl, ap);
+
 	tick=va_arg(ap,unsigned int);
 
 	if(DIFF_TICK(tick,md->last_thinktime)<MIN_MOBTHINKTIME*10)
@@ -2048,6 +2041,21 @@ static int mob_ai_lazy(int tid,unsigned int tick,int id,int data)
 	return 0;
 }
 
+/*==========================================
+ * Serious processing for mob in PC field of view   (interval timer function)
+ *------------------------------------------
+ */
+static int mob_ai_hard(int tid,unsigned int tick,int id,int data)
+{
+
+	if (battle_config.mob_ai&32)
+		map_foreachiddb(mob_ai_sub_lazy,tick);
+	else
+		clif_foreachclient(mob_ai_sub_foreachclient,tick);
+
+	return 0;
+}
+
 /*==========================================
  * The structure object for item drop with delay
  * Since it is only two being able to pass [ int ] a timer function