|
|
|
@ -29,7 +29,19 @@ namespace Build_God_Api.Services.Game |
|
|
|
private decimal CalculateMaxHP(Character character, Profession? profession) |
|
|
|
{ |
|
|
|
decimal healthRate = profession?.HealthRate ?? 1m; |
|
|
|
return 100 + character.LevelId * character.CurrentExp * 5 * healthRate; |
|
|
|
return 5 * character.LevelId * character.LevelId * (decimal)Math.Log((double)(character.CurrentExp + 1000)) * healthRate; |
|
|
|
} |
|
|
|
|
|
|
|
private decimal CalculateAttack(Character character, Profession? profession) |
|
|
|
{ |
|
|
|
decimal attackRate = profession?.AttackRate ?? 1m; |
|
|
|
return 1 * character.LevelId * character.LevelId * (decimal)Math.Log((double)(character.CurrentExp + 1000)) * attackRate; |
|
|
|
} |
|
|
|
|
|
|
|
private decimal CalculateDefend(Character character, Profession? profession) |
|
|
|
{ |
|
|
|
decimal defendRate = profession?.DefendRate ?? 1m; |
|
|
|
return 0.5m * character.LevelId * character.LevelId * (decimal)Math.Log((double)(character.CurrentExp + 1000)) * defendRate; |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<CharacterAttributes> CalculateAttributesAsync(Character character) |
|
|
|
@ -45,9 +57,9 @@ namespace Build_God_Api.Services.Game |
|
|
|
decimal criticalRate = profession?.CriticalRate ?? 1m; |
|
|
|
|
|
|
|
decimal maxHP = CalculateMaxHP(character, profession); |
|
|
|
decimal attack = 10 + character.LevelId * character.CurrentExp * 2 * attackRate; |
|
|
|
decimal defend = character.LevelId * defendRate * 0.5m; |
|
|
|
decimal critRate = criticalRate * 0.1m; |
|
|
|
decimal attack = CalculateAttack(character, profession); |
|
|
|
decimal defend = CalculateDefend(character, profession); |
|
|
|
decimal critRate = 0; |
|
|
|
|
|
|
|
return new CharacterAttributes |
|
|
|
{ |
|
|
|
|