From ef4128360d2c5c5798e4ece52fbf3d0f290d07bd Mon Sep 17 00:00:00 2001 From: skyleo Date: Thu, 10 Oct 2019 00:11:28 +0200 Subject: Fix Homunculus skill requirements being put on owner as well This fixes not being able to use Homunculus skills when having 90% overweight. This also fixes not being able to use Homunculus skills when the owner has low HP or SP, even though the Homunculus has enough HP or SP to use the skill. --- src/map/unit.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/map') diff --git a/src/map/unit.c b/src/map/unit.c index 45cb7dffd..9cbef3091 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1410,13 +1410,6 @@ static int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill } } - 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 -- cgit v1.2.3-70-g09d2 From 6209e88b2e14f67f9b3fd47084382c7b071ed4ed Mon Sep 17 00:00:00 2001 From: skyleo Date: Thu, 10 Oct 2019 00:41:18 +0200 Subject: Fix Homunculus skill failure message not displaying required item --- src/map/skill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/map') diff --git a/src/map/skill.c b/src/map/skill.c index ad27ef0e3..b5f84679e 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -3789,7 +3789,7 @@ static int skill_check_condition_mercenary(struct block_list *bl, int skill_id, if (itemid[i] < 1) continue; // No item index[i] = pc->search_inventory(sd, itemid[i]); if (index[i] == INDEX_NOT_FOUND || sd->status.inventory[index[i]].amount < amount[i]) { - clif->skill_fail(sd, skill_id, USESKILL_FAIL_NEED_ITEM, amount[i], itemid[i] << 16); + clif->skill_fail(sd, skill_id, USESKILL_FAIL_NEED_ITEM, amount[i], itemid[i]); return 0; } } -- cgit v1.2.3-70-g09d2 From b2e1879cc22faeda1511108e912d915c90d30b6e Mon Sep 17 00:00:00 2001 From: skyleo Date: Thu, 10 Oct 2019 03:13:14 +0200 Subject: Fix Chaotic Blessings never healing the enemy It has a chance to roll for enemy and heal the enemy, While calculating the chance was correct, it was getting the enemy with battle->check_target. But unit->stop_attack has been called before in unit->skilluse_id2, making battle->check_target return NULL at that point, since it has no attack target anymore. So it defaulted to heal the Homunculus itself, instead of the enemy. --- src/map/skill.c | 16 ++++++++++++---- src/map/unit.c | 6 ++++++ 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'src/map') diff --git a/src/map/skill.c b/src/map/skill.c index b5f84679e..fc5fc013e 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -8758,12 +8758,20 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list * int r = rnd()%100; int target = (skill_lv-1)%5; int hp; - if(rget_master(src); - else //Enemy - bl = map->id2bl(battle->get_target(src)); + } else if ((per[target][1] - per[target][0]) < per[target][0] + && bl == battle->get_master(src)) { + /** + * Skill rolled for enemy, but there's nothing the Homunculus is attacking. + * So bl has been set to its master in unit->skilluse_id2. + * If it's more likely that it will heal itself, + * we let it heal itself. + */ + bl = src; + } if (!bl) bl = src; hp = skill->calc_heal(src, bl, skill_id, 1+rnd()%skill_lv, true); diff --git a/src/map/unit.c b/src/map/unit.c index 9cbef3091..1e9433eaf 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1328,6 +1328,12 @@ static int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill if (src->type==BL_HOM) switch(skill_id) { //Homun-auto-target skills. + case HVAN_CHAOTIC: + target_id = ud->target; // Choose attack target for now + target = map->id2bl(target_id); + if (target != NULL) + break; + FALLTHROUGH // Attacking nothing, choose master as default target instead case HLIF_HEAL: case HLIF_AVOID: case HAMI_DEFENCE: -- cgit v1.2.3-70-g09d2