Skip to content

Commit

Permalink
Min HP / MP needs to check against post-AP-reset value
Browse files Browse the repository at this point in the history
  • Loading branch information
Noir committed Jun 19, 2024
1 parent bcc7bed commit 94a08d8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/client/processor/stat/AssignAPProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -552,14 +552,14 @@ public static boolean APResetAction(Client c, int APFrom, int APTo) {
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.");
c.sendPacket(PacketCreator.enableActions());
return false;
}

int curHp = player.getHp();
int hplose = -takeHp(player.getJob());
player.assignHP(hplose, -1);
if (!YamlConfig.config.server.USE_FIXED_RATIO_HPMP_UPDATE) {
player.updateHp(Math.max(1, curHp + hplose));
Expand All @@ -581,14 +581,14 @@ public static boolean APResetAction(Client c, int APFrom, int APTo) {
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.");
c.sendPacket(PacketCreator.enableActions());
return false;
}

int curMp = player.getMp();
int mplose = -takeMp(player.getJob());
player.assignMP(mplose, -1);
if (!YamlConfig.config.server.USE_FIXED_RATIO_HPMP_UPDATE) {
player.updateMp(Math.max(0, curMp + mplose));
Expand Down

0 comments on commit 94a08d8

Please sign in to comment.