From 4c8fb3f0128a58815b6fea8de3f7fcdcee249635 Mon Sep 17 00:00:00 2001 From: Kaioru Date: Sun, 29 Sep 2024 03:48:04 +0800 Subject: [PATCH] Fix hp/mp overflowing calculated maxhp/maxmp --- .../Objects/Users/FieldUser.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/common/Edelstein.Common.Gameplay.Game/Objects/Users/FieldUser.cs b/src/common/Edelstein.Common.Gameplay.Game/Objects/Users/FieldUser.cs index f48d04ffc..c8763e155 100644 --- a/src/common/Edelstein.Common.Gameplay.Game/Objects/Users/FieldUser.cs +++ b/src/common/Edelstein.Common.Gameplay.Game/Objects/Users/FieldUser.cs @@ -122,6 +122,11 @@ public async Task Modify(Action action) await UpdateStats(); if (modify.IsRequireUpdateAvatar) await UpdateAvatar(); + + if (Character.HP > Stats.MaxHP) + await modify.Stats(s => s.HP = Stats.MaxHP); + if (Character.MP > Stats.MaxMP) + await modify.Stats(s => s.MP = Stats.MaxMP); } finally {