From df24cb3220fcbb8c43d258656de10a92f53018a0 Mon Sep 17 00:00:00 2001 From: Haru Date: Sun, 24 May 2015 02:05:58 +0200 Subject: Corrected distance check on homunculus skills - Distance check on offensive skills was being done against the homunculus' master instead of the actual target, because of a variable accidentally overwritten in 8faef4ff. - Please don't reuse variables for unrelated things. You don't have to pay extra if you use one more variable, I promise. - Special thanks to MordekaiserGod. Signed-off-by: Haru --- src/map/unit.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/map') diff --git a/src/map/unit.c b/src/map/unit.c index b44d58d9a..6a30c7e79 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1354,18 +1354,21 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui } } - if (sd || src->type == BL_HOM){ - if (!sd && (target = battle->get_master(src))) - sd = map->id2sd(target->id); - if (sd){ - /* temporarily disabled, awaiting for kenpachi to detail this so we can make it work properly */ + if (src->type == BL_HOM) { + // In case of homunuculus, set the sd to the homunculus' master, as needed below + struct block_list *master = battle->get_master(src); + if (master) + sd = map->id2sd(master->id); + } + + if (sd) { + /* temporarily disabled, awaiting for kenpachi to detail this so we can make it work properly */ #if 0 - if (sd->skillitem != skill_id && !skill->check_condition_castbegin(sd, skill_id, skill_lv)) + if (sd->skillitem != skill_id && !skill->check_condition_castbegin(sd, skill_id, skill_lv)) #else - if (!skill->check_condition_castbegin(sd, skill_id, skill_lv)) + if (!skill->check_condition_castbegin(sd, skill_id, skill_lv)) #endif - return 0; - } + return 0; } if( src->type == BL_MOB ) -- cgit v1.2.3-60-g2f50