Prechádzať zdrojové kódy

- Fixed mobs targetting themselves after using a support skill.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5427 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 19 rokov pred
rodič
commit
a9ad111c03
2 zmenil súbory, kde vykonal 6 pridanie a 3 odobranie
  1. 1 0
      Changelog-Trunk.txt
  2. 5 3
      src/map/mob.c

+ 1 - 0
Changelog-Trunk.txt

@@ -5,6 +5,7 @@ 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/02
+	* Fixed mobs targetting themselves after using a support skill. [Skotlex]
 	* Gospel no longer blocks item usage of whoever is in the area of effect,
 	  only the caster of Gospel can't use healing items now. [Skotlex]
 	* Added the long/near attack_def_rate card effects to battle_calc_magic

+ 5 - 3
src/map/mob.c

@@ -3898,8 +3898,7 @@ int mobskill_event(struct mob_data *md, struct block_list *src, unsigned int tic
 	int target_id, res = 0;
 
 	target_id = md->target_id;
-	if (!target_id || (battle_config.mob_changetarget_byskill &&
-		battle_check_target(&md->bl, src, BCT_ENEMY) > 0))
+	if (!target_id || battle_config.mob_changetarget_byskill)
 		md->target_id = src->id;
 			
 	if (flag == -1)
@@ -3911,9 +3910,12 @@ int mobskill_event(struct mob_data *md, struct block_list *src, unsigned int tic
 	else if (flag&BF_LONG)
 		res = mobskill_use(md, tick, MSC_LONGRANGEATTACKED);
 	
-	if (target_id && !res)
+	if (!res)
 	//Restore previous target only if skill condition failed to trigger. [Skotlex]
 		md->target_id = target_id;
+	//Otherwise check if the target is an enemy, and unlock if needed.
+	else if (battle_check_target(&md->bl, src, BCT_ENEMY) <= 0)
+		md->target_id = target_id;
 	
 	return res;
 }