Browse Source

突破成功以后应该更新角色的当前生命值

master
hanqin 2 weeks ago
parent
commit
fff808c7ea
  1. 10
      Build_God_Api/Build_God_Api/Services/Game/CharacterAttributeCalculateService.cs

10
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<Profession>().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();
}

Loading…
Cancel
Save