diff options
author | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-05-21 05:27:22 +0200 |
---|---|---|
committer | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-06-01 02:10:08 +0200 |
commit | 752b2db9829c1a3182c139bea0527e8486093b3d (patch) | |
tree | 66a8ee26d9a9dd1fce8a265b378963be06553e8c /src | |
parent | 48582f7e139ead473ee32477d48bfbab8093304c (diff) | |
download | hercules-752b2db9829c1a3182c139bea0527e8486093b3d.tar.gz hercules-752b2db9829c1a3182c139bea0527e8486093b3d.tar.bz2 hercules-752b2db9829c1a3182c139bea0527e8486093b3d.tar.xz hercules-752b2db9829c1a3182c139bea0527e8486093b3d.zip |
Fix Requirements->MaxHPTrigger code in skill_check_condition_mercenary()
Diffstat (limited to 'src')
-rw-r--r-- | src/map/skill.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/map/skill.c b/src/map/skill.c index 86e8b73c2..e9c658730 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -3996,7 +3996,7 @@ static int skill_check_condition_mercenary(struct block_list *bl, int skill_id, { struct status_data *st; struct map_session_data *sd = NULL; - int hp, sp, hp_rate, sp_rate, state, mhp; + int hp, sp, hp_rate, sp_rate, state; int idx; int itemid[MAX_SKILL_ITEM_REQUIRE], amount[MAX_SKILL_ITEM_REQUIRE]; @@ -4023,8 +4023,7 @@ static int skill_check_condition_mercenary(struct block_list *bl, int skill_id, hp_rate = skill->dbs->db[idx].hp_rate[lv-1]; sp_rate = skill->dbs->db[idx].sp_rate[lv-1]; state = skill->dbs->db[idx].state[lv - 1]; - if( (mhp = skill->dbs->db[idx].mhp[lv-1]) > 0 ) - hp += (st->max_hp * mhp) / 100; + if( hp_rate > 0 ) hp += (st->hp * hp_rate) / 100; else @@ -4057,6 +4056,13 @@ static int skill_check_condition_mercenary(struct block_list *bl, int skill_id, clif->skill_fail(sd, skill_id, USESKILL_FAIL_SP_INSUFFICIENT, 0, 0); return 0; } + + int mhp = skill->get_mhp(skill_id, lv); + + if (mhp > 0 && get_percentage(st->hp, st->max_hp) > mhp) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_HP_INSUFFICIENT, 0, 0); + return 0; + } } if( !type ) |