Fixes heal item recovery effects (#4750)

* Fixes #4748.
* Recovery item effects should be multiplicatively stacked.
Thanks to @Singe-Horizontal!
This commit is contained in:
Aleos
2020-04-05 15:22:36 -04:00
committed by GitHub
parent 75d51485bf
commit a67f5c5d6a

View File

@@ -8946,28 +8946,27 @@ int pc_itemheal(struct map_session_data *sd, int itemid, int hp, int sp)
bonus = 100 + (sd->battle_status.vit << 1) + pc_checkskill(sd, SM_RECOVERY) * 10 + pc_checkskill(sd, AM_LEARNINGPOTION) * 5;
// A potion produced by an Alchemist in the Fame Top 10 gets +50% effect [DracoRPG]
if (potion_flag == 2) {
bonus += 50;
bonus += bonus * 50 / 100;
if (sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_ROGUE)
bonus += 100; // Receive an additional +100% effect from ranked potions to HP only
bonus += bonus; // Receive an additional +100% effect from ranked potions to HP only
}
//All item bonuses.
bonus += sd->bonus.itemhealrate2;
//Item Group bonuses
bonus += pc_get_itemgroup_bonus(sd, itemid);
bonus += bonus * pc_get_itemgroup_bonus(sd, itemid) / 100;
//Individual item bonuses.
for(const auto &it : sd->itemhealrate) {
if (it.id == itemid) {
bonus += it.val;
bonus += bonus * it.val / 100;
break;
}
}
// Recovery Potion
if (sd->sc.data[SC_INCHEALRATE])
bonus += sd->sc.data[SC_INCHEALRATE]->val1;
bonus += bonus * sd->sc.data[SC_INCHEALRATE]->val1 / 100;
// 2014 Halloween Event : Pumpkin Bonus
if (sd->sc.data[SC_MTF_PUMPKIN] && itemid == ITEMID_PUMPKIN)
bonus += sd->sc.data[SC_MTF_PUMPKIN]->val1;
bonus += bonus * sd->sc.data[SC_MTF_PUMPKIN]->val1 / 100;
tmp = hp * bonus / 100; // Overflow check
if (bonus != 100 && tmp > hp)
@@ -8977,7 +8976,7 @@ int pc_itemheal(struct map_session_data *sd, int itemid, int hp, int sp)
bonus = 100 + (sd->battle_status.int_ << 1) + pc_checkskill(sd, MG_SRECOVERY) * 10 + pc_checkskill(sd, AM_LEARNINGPOTION) * 5;
// A potion produced by an Alchemist in the Fame Top 10 gets +50% effect [DracoRPG]
if (potion_flag == 2)
bonus += 50;
bonus += bonus * 50 / 100;
tmp = sp * bonus / 100; // Overflow check
if (bonus != 100 && tmp > sp)