Procházet zdrojové kódy

- Updated mob ai behaviour so that mobs use IDLE state skills when their current target cannot be reached for melee fighting.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6655 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex před 19 roky
rodič
revize
5e600508f8
2 změnil soubory, kde provedl 12 přidání a 4 odebrání
  1. 3 0
      Changelog-Trunk.txt
  2. 9 4
      src/map/mob.c

+ 3 - 0
Changelog-Trunk.txt

@@ -3,6 +3,9 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2006/05/19
+	* Updated mob ai behaviour so that mobs use IDLE state skills when their
+	  current target cannot be reached for melee fighting. [Skotlex]
 2006/05/18
 	* Added 5 config settings to adjust damage in pk-mode servers (misc.conf)
 	  [Skotlex]

+ 9 - 4
src/map/mob.c

@@ -1191,14 +1191,19 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap)
 			{	//Out of range...
 				if (!(mode&MD_CANMOVE))
 				{	//Can't chase. Attempt to use a ranged skill at least?
-					md->state.skillstate = md->state.aggressive?MSS_ANGRY:MSS_BERSERK;
-					mobskill_use(md, tick, -1);
-					mob_unlocktarget(md,tick);
+					md->state.skillstate = MSS_IDLE;
+					if (!mobskill_use(md, tick, -1))
+						mob_unlocktarget(md,tick);
 					return 0;
 				}
 
-				if (!can_move) //Stuck. Wait before walking.
+				if (!can_move)
+			  	{	//Stuck. Use an idle skill. o.O'
+					md->state.skillstate = MSS_IDLE;
+					if (!(++md->ud.walk_count%IDLE_SKILL_INTERVAL))
+						mobskill_use(md, tick, -1);
 					return 0;
+				}
 
 				md->state.skillstate = md->state.aggressive?MSS_FOLLOW:MSS_RUSH;
 				if (md->ud.walktimer != -1 && md->ud.target == tbl->id &&