Min HP / MP needs to check against post-AP-reset value

This commit is contained in:
Noir
2024-06-18 21:42:52 -04:00
parent bcc7bedbc9
commit 94a08d86a0

View File

@@ -552,14 +552,14 @@ public class AssignAPProcessor {
return false; return false;
} }
if (player.getMaxHp() < getMinHp(player.getJob(), player.getLevel())) { int hplose = -takeHp(player.getJob());
if (player.getMaxHp() + hplose < getMinHp(player.getJob(), player.getLevel())) {
player.message("You don't have the minimum HP pool required to swap."); player.message("You don't have the minimum HP pool required to swap.");
c.sendPacket(PacketCreator.enableActions()); c.sendPacket(PacketCreator.enableActions());
return false; return false;
} }
int curHp = player.getHp(); int curHp = player.getHp();
int hplose = -takeHp(player.getJob());
player.assignHP(hplose, -1); player.assignHP(hplose, -1);
if (!YamlConfig.config.server.USE_FIXED_RATIO_HPMP_UPDATE) { if (!YamlConfig.config.server.USE_FIXED_RATIO_HPMP_UPDATE) {
player.updateHp(Math.max(1, curHp + hplose)); player.updateHp(Math.max(1, curHp + hplose));
@@ -581,14 +581,14 @@ public class AssignAPProcessor {
return false; return false;
} }
if (player.getMaxMp() < getMinMp(player.getJob(), player.getLevel())) { int mplose = -takeMp(player.getJob());
if (player.getMaxMp() + mplose < getMinMp(player.getJob(), player.getLevel())) {
player.message("You don't have the minimum MP pool required to swap."); player.message("You don't have the minimum MP pool required to swap.");
c.sendPacket(PacketCreator.enableActions()); c.sendPacket(PacketCreator.enableActions());
return false; return false;
} }
int curMp = player.getMp(); int curMp = player.getMp();
int mplose = -takeMp(player.getJob());
player.assignMP(mplose, -1); player.assignMP(mplose, -1);
if (!YamlConfig.config.server.USE_FIXED_RATIO_HPMP_UPDATE) { if (!YamlConfig.config.server.USE_FIXED_RATIO_HPMP_UPDATE) {
player.updateMp(Math.max(0, curMp + mplose)); player.updateMp(Math.max(0, curMp + mplose));