From fff808c7ea89535a54bd6cc7ea1250ca9df243ea Mon Sep 17 00:00:00 2001 From: hanqin Date: Tue, 28 Apr 2026 17:39:19 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AA=81=E7=A0=B4=E6=88=90=E5=8A=9F=E4=BB=A5?= =?UTF-8?q?=E5=90=8E=E5=BA=94=E8=AF=A5=E6=9B=B4=E6=96=B0=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=9A=84=E5=BD=93=E5=89=8D=E7=94=9F=E5=91=BD=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Game/CharacterAttributeCalculateService.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Build_God_Api/Build_God_Api/Services/Game/CharacterAttributeCalculateService.cs b/Build_God_Api/Build_God_Api/Services/Game/CharacterAttributeCalculateService.cs index 89c90db..08e54e2 100644 --- a/Build_God_Api/Build_God_Api/Services/Game/CharacterAttributeCalculateService.cs +++ b/Build_God_Api/Build_God_Api/Services/Game/CharacterAttributeCalculateService.cs @@ -182,14 +182,8 @@ namespace Build_God_Api.Services.Game public async Task RecalculateMaxHPAsync(Character character) { - var profession = await _context.Queryable().FirstAsync(x => x.Id == character.ProfessionId); - var newMaxHP = CalculateMaxHP(character, profession); - - if (newMaxHP > 0) - { - decimal hpPercentage = character.CurrentHP / newMaxHP; - character.CurrentHP = hpPercentage * newMaxHP; - } + var attributes = await CalculateAttributesAsync(character); + character.CurrentHP = attributes.MaxHP; await _context.Updateable(character).ExecuteCommandAsync(); }