From c120372c4266e3705b3bed3966d06169d3f0a4b9 Mon Sep 17 00:00:00 2001 From: skotlex Date: Thu, 2 Mar 2006 15:40:33 +0000 Subject: - Fixed mobs targetting themselves after using a support skill. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5427 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/mob.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/map') diff --git a/src/map/mob.c b/src/map/mob.c index c2f9680ca..d164275fd 100644 --- a/src/map/mob.c +++ b/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; } -- cgit v1.2.3-70-g09d2