Don't heal dead avatars with healing boxes

This commit is contained in:
Melledy
2023-10-15 05:26:33 -07:00
parent 19f44a84fe
commit 4c06121497
3 changed files with 9 additions and 3 deletions

View File

@@ -381,7 +381,7 @@ public class Player {
// Only heal if player isnt already in anchor range
if (isInRange && isInRange != this.inAnchorRange) {
this.getCurrentLineup().heal(10000);
this.getCurrentLineup().heal(10000, true);
}
this.inAnchorRange = isInRange;
}

View File

@@ -93,7 +93,7 @@ public class PlayerLineup {
}
}
public void heal(int heal) {
public void heal(int heal, boolean allowRevive) {
// Flag to set if at least one avatar in the team has been healed
boolean hasHealed = false;
@@ -102,6 +102,12 @@ public class PlayerLineup {
GameAvatar avatar = this.getOwner().getAvatarById(avatarId);
if (avatar == null) continue;
// Dont heal dead avatars if we are not allowed to revive
if (avatar.getCurrentHp() <= 0 && !allowRevive) {
continue;
}
// Heal avatar
if (avatar.getCurrentHp() < 10000) {
avatar.setCurrentHp(Math.min(avatar.getCurrentHp() + heal, 10000));
avatar.save();

View File

@@ -53,7 +53,7 @@ public class EntityProp implements GameEntity {
if (excel.isRecoverMp()) {
scene.getPlayer().getCurrentLineup().addMp(2);
} else if (excel.isRecoverHp()) {
scene.getPlayer().getCurrentLineup().heal(2500);
scene.getPlayer().getCurrentLineup().heal(2500, false);
}
}