diff options
author | Haru <haru@dotalux.com> | 2019-10-19 16:28:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-19 16:28:11 +0200 |
commit | 088547f831aa0cfe007b744c5b967d67e59e9858 (patch) | |
tree | a5921c7b0747f32c6544b13b27eef979b88f43e5 /src | |
parent | 1f6eebe5421534c0d2a29e793ae8ce0328913c7c (diff) | |
parent | b2e1879cc22faeda1511108e912d915c90d30b6e (diff) | |
download | hercules-088547f831aa0cfe007b744c5b967d67e59e9858.tar.gz hercules-088547f831aa0cfe007b744c5b967d67e59e9858.tar.bz2 hercules-088547f831aa0cfe007b744c5b967d67e59e9858.tar.xz hercules-088547f831aa0cfe007b744c5b967d67e59e9858.zip |
Merge pull request #2556 from skyleo/homunculus_fixes
Homunculus skill fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/map/skill.c | 18 | ||||
-rw-r--r-- | src/map/unit.c | 13 |
2 files changed, 19 insertions, 12 deletions
diff --git a/src/map/skill.c b/src/map/skill.c index dae075927..e44389d3c 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; } } @@ -8754,12 +8754,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(r<per[target][0]) //Self + if (r < per[target][0]) { //Self bl = src; - else if(r<per[target][1]) //Master + } else if (r < per[target][1]) { //Master bl = battle->get_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 45cb7dffd..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: @@ -1410,13 +1416,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 |