完善统计系统

This commit is contained in:
milimoe 2024-09-21 03:18:20 +08:00
parent e1d58144a3
commit fbe5477568
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E
3 changed files with 37 additions and 5 deletions

View File

@ -1,5 +1,4 @@
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Interface.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Core.Api.Utility
@ -678,8 +677,8 @@ namespace Milimoe.FunGame.Core.Api.Utility
// 统计
_stats[character].LiveRound += 1;
_stats[character].LiveTime = Calculation.Round2Digits(_stats[character].LiveTime + timeToReduce);
_stats[character].DamagePerRound = Calculation.Round2Digits(_stats[character].TotalDamage / TotalRound);
_stats[character].DamagePerTurn = Calculation.Round2Digits(_stats[character].TotalDamage / _stats[character].LiveRound);
_stats[character].DamagePerRound = Calculation.Round2Digits(_stats[character].TotalDamage / _stats[character].LiveRound);
_stats[character].DamagePerTurn = Calculation.Round2Digits(_stats[character].TotalDamage / _stats[character].ActionTurn);
_stats[character].DamagePerSecond = Calculation.Round2Digits(_stats[character].TotalDamage / _stats[character].LiveTime);
// 回血回蓝
@ -1098,18 +1097,30 @@ namespace Milimoe.FunGame.Core.Api.Utility
if (top == 1)
{
WriteLine("冠军:" + topCharacter);
_stats[_eliminated[i]].Wins += 1;
_stats[_eliminated[i]].Top3s += 1;
}
else if (top == 2)
{
WriteLine("亚军:" + topCharacter);
_stats[_eliminated[i]].Loses += 1;
_stats[_eliminated[i]].Top3s += 1;
}
else if (top == 3)
{
WriteLine("季军:" + topCharacter);
_stats[_eliminated[i]].Loses += 1;
_stats[_eliminated[i]].Top3s += 1;
}
else
{
WriteLine($"第 {top} 名:" + topCharacter);
_stats[_eliminated[i]].Loses += 1;
}
_stats[_eliminated[i]].Plays += 1;
if (_earnedMoney.TryGetValue(_eliminated[i], out int money))
{
_stats[Eliminated[i]].TotalEarnedMoney += money;
}
top++;
}

View File

@ -1007,6 +1007,21 @@ namespace Milimoe.FunGame.Core.Entity
return str;
}
/// <summary>
/// 获取角色实例的名字、昵称
/// </summary>
/// <returns></returns>
public string ToStringWithOutUser()
{
string str = GetName();
if (NickName != "")
{
if (str != "") str += ", ";
str += NickName;
}
return str;
}
/// <summary>
/// 获取角色实例的名字、昵称以及所属玩家,包含等级
/// </summary>

View File

@ -14,6 +14,10 @@
public double AvgPhysicalDamage { get; set; } = 0;
public double AvgMagicDamage { get; set; } = 0;
public double AvgRealDamage { get; set; } = 0;
public double AvgTakenDamage { get; set; } = 0;
public double AvgTakenPhysicalDamage { get; set; } = 0;
public double AvgTakenMagicDamage { get; set; } = 0;
public double AvgTakenRealDamage { get; set; } = 0;
public int LiveRound { get; set; } = 0;
public int AvgLiveRound { get; set; } = 0;
public int ActionTurn { get; set; } = 0;
@ -23,14 +27,16 @@
public double DamagePerRound { get; set; } = 0;
public double DamagePerTurn { get; set; } = 0;
public double DamagePerSecond { get; set; } = 0;
public double TotalEarnedMoney { get; set; } = 0;
public double AvgEarnedMoney { get; set; } = 0;
public int TotalEarnedMoney { get; set; } = 0;
public int AvgEarnedMoney { get; set; } = 0;
public int Kills { get; set; } = 0;
public int Deaths { get; set; } = 0;
public int Assists { get; set; } = 0;
public int Plays { get; set; } = 0;
public int Wins { get; set; } = 0;
public int Top3s { get; set; } = 0;
public int Loses { get; set; } = 0;
public double Winrates { get; set; } = 0;
public double Top3rates { get; set; } = 0;
}
}