Browse Source

- Added event 8 for mobspawns that should spawn with special ai set.
- Modified battle_check_target so that mobs with special ai's default enemy are mobs with no special ai.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5448 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 năm trước cách đây
mục cha
commit
373436fbde
5 tập tin đã thay đổi với 17 bổ sung5 xóa
  1. 8 0
      Changelog-Trunk.txt
  2. 4 2
      src/map/battle.c
  3. 1 1
      src/map/clif.c
  4. 3 1
      src/map/npc.c
  5. 1 1
      src/map/skill.c

+ 8 - 0
Changelog-Trunk.txt

@@ -5,6 +5,14 @@ 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/03
+	* Added event 8 for mobspawns that should spawn with special ai set. This
+	  means that now in the mob_spawn files if you use 8 as the last entry, the
+	  mob will use the special ai, and as such, it will only attack other mobs,
+	  not players (can obviously be combined with 2 for small mobs and 4 for
+	  large mobs, eg: 10 for a small mob with special ai set) [Skotlex]
+	* Modifed battle_check_target so that mobs with special ai will only target
+	  by default mobs without said state (this will prevent normal clones from
+	  fighting among themselves, for example) [Skotlex]
 	* Trick dead now ends on logout [Skotlex]
 	* Added mapflag nocommand which blocks @/# commands unless your gm level is
 	  above gm_skill_unconditional's level. [Skotlex]

+ 4 - 2
src/map/battle.c

@@ -3387,8 +3387,10 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
 					state |= BCT_PARTY; //Normal mobs with no ai are friends.
 				else
 					state |= BCT_ENEMY; //However, all else are enemies.
-			} else if (t_bl->type != BL_PC)
-				state |= BCT_ENEMY; //Natural enemy for AI mobs are nonplayers.
+			} else {
+				if (t_bl->type == BL_MOB && !((struct mob_data*)t_bl)->special_state.ai)
+					state |= BCT_ENEMY; //Natural enemy for AI mobs are normal mobs.
+			}
 			if (md->master_id && (s_bl = map_id2bl(md->master_id)) == NULL)
 				s_bl = &md->bl; //Fallback on the mob itself, otherwise consider this a "from master" scenario.
 			break;

+ 1 - 1
src/map/clif.c

@@ -3449,7 +3449,7 @@ int clif_arrow_create_list(struct map_session_data *sd)
 	nullpo_retr(0, sd);
 
 	fd = sd->fd;
-        WFIFOHEAD(fd, MAX_SKILL_ARROW_DB*2+4);
+	WFIFOHEAD(fd, MAX_SKILL_ARROW_DB*2+4);
 	WFIFOW(fd,0) = 0x1ad;
 
 	for (i = 0, c = 0; i < MAX_SKILL_ARROW_DB; i++) {

+ 3 - 1
src/map/npc.c

@@ -2313,12 +2313,14 @@ int npc_parse_mob2 (struct mob_list *mob, int cached)
 
 		if (strlen(mob->eventname) >= 4) {
 			memcpy(md->npc_event, mob->eventname, NAME_LENGTH-1);
-		} else if (strlen(mob->eventname) == 1) { //Portable monster big/small implementation. [Skotlex]
+		} else if (strlen(mob->eventname) <= 2) { //Portable monster big/small implementation. [Skotlex]
 			int size = atoi(mob->eventname);
 			if (size & 2)
 				md->special_state.size=1;
 			else if (size & 4)
 				md->special_state.size=2;
+			if (size & 8)
+				md->special_state.ai=1;
 		}
 
 		md->bl.type = BL_MOB;

+ 1 - 1
src/map/skill.c

@@ -5118,7 +5118,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 				}
 				if(su->group->unit_id == UNT_ANKLESNARE && su->group->val2){
 					struct block_list *target=map_id2bl(su->group->val2);
-					if(target && (target->type == BL_PC || target->type == BL_MOB))
+					if(target)
 						status_change_end(target,SC_ANKLE,-1);
 				}
 				skill_delunit(su);