From 752b2db9829c1a3182c139bea0527e8486093b3d Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Thu, 21 May 2020 05:27:22 +0200 Subject: Fix Requirements->MaxHPTrigger code in skill_check_condition_mercenary() --- src/map/skill.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') 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 ) -- cgit v1.2.3-70-g09d2