mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-13 13:54:37 +01:00
Fix avatars having 0 hp after retreating from a battle
This commit is contained in:
@@ -186,6 +186,8 @@ public class BattleService extends BaseGameService {
|
|||||||
// Get battle object and setup variables
|
// Get battle object and setup variables
|
||||||
Battle battle = player.getBattle();
|
Battle battle = player.getBattle();
|
||||||
int minimumHp = 0;
|
int minimumHp = 0;
|
||||||
|
|
||||||
|
boolean updateStatus = true;
|
||||||
boolean teleportToAnchor = false;
|
boolean teleportToAnchor = false;
|
||||||
|
|
||||||
// Handle result
|
// Handle result
|
||||||
@@ -203,12 +205,15 @@ public class BattleService extends BaseGameService {
|
|||||||
}
|
}
|
||||||
case BATTLE_END_QUIT -> {
|
case BATTLE_END_QUIT -> {
|
||||||
teleportToAnchor = true;
|
teleportToAnchor = true;
|
||||||
|
updateStatus = false;
|
||||||
}
|
}
|
||||||
default -> {
|
default -> {
|
||||||
|
updateStatus = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if avatar hp/sp should be updated after a battle
|
||||||
|
if (updateStatus) {
|
||||||
// Set health/energy for player avatars
|
// Set health/energy for player avatars
|
||||||
for (var battleAvatar : battleAvatars) {
|
for (var battleAvatar : battleAvatars) {
|
||||||
GameAvatar avatar = player.getAvatarById(battleAvatar.getId());
|
GameAvatar avatar = player.getAvatarById(battleAvatar.getId());
|
||||||
@@ -225,6 +230,7 @@ public class BattleService extends BaseGameService {
|
|||||||
|
|
||||||
// Sync with player
|
// Sync with player
|
||||||
player.sendPacket(new PacketSyncLineupNotify(battle.getLineup()));
|
player.sendPacket(new PacketSyncLineupNotify(battle.getLineup()));
|
||||||
|
}
|
||||||
|
|
||||||
// Teleport to anchor if player has lost/retreated. On official servers, the player party is teleported to the nearest anchor.
|
// Teleport to anchor if player has lost/retreated. On official servers, the player party is teleported to the nearest anchor.
|
||||||
if (teleportToAnchor) {
|
if (teleportToAnchor) {
|
||||||
|
|||||||
Reference in New Issue
Block a user