mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-14 06:14:45 +01:00
Don't heal dead avatars with healing boxes
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user