添加新角色;修复一些BUG

This commit is contained in:
milimoe 2026-01-09 01:05:07 +08:00
parent 765b42155e
commit 449ce578d2
Signed by: milimoe
GPG Key ID: 9554D37E4B8991D0
4 changed files with 56 additions and 62 deletions

View File

@ -44,7 +44,7 @@ namespace Milimoe.FunGame.Testing.Desktop.GameMapTesting
{
List<string> result = [];
Msg = "";
List<Character> allCharactersInGame = [.. FunGameConstant.Characters];
List<Character> allCharactersInGame = [.. FunGameConstant.Characters.OrderBy(o => Random.Shared.Next()).Take(10)];
await Controller.WriteLine("--- 游戏开始 ---");
TeamGamingQueue? tgq = null;
MixGamingQueue? mgq = null;
@ -55,9 +55,9 @@ namespace Milimoe.FunGame.Testing.Desktop.GameMapTesting
// 升级和赋能
List<Character> characters = [];
for (int index = 0; index < FunGameConstant.Characters.Count; index++)
for (int index = 0; index < allCharactersInGame.Count; index++)
{
Character c = FunGameConstant.Characters[index];
Character c = allCharactersInGame[index];
c.Level = clevel;
c.NormalAttack.Level = mlevel;
FunGameService.AddCharacterSkills(c, 1, slevel, slevel);
@ -245,6 +245,7 @@ namespace Milimoe.FunGame.Testing.Desktop.GameMapTesting
_gamingQueue.SelectItemEvent += GamingQueue_SelectItem;
_gamingQueue.QueueUpdatedEvent += GamingQueue_QueueUpdated;
_gamingQueue.TurnEndEvent += GamingQueue_TurnEnd;
_gamingQueue.CharacterInquiryEvent += GamingQueue_CharacterInquiryEvent;
// 总游戏时长
double totalTime = 0;
@ -439,7 +440,7 @@ namespace Milimoe.FunGame.Testing.Desktop.GameMapTesting
stats.MVPs++;
mvpBuilder.AppendLine($"{(tgq != null ? "[ " + tgq.GetTeamFromEliminated(mvp)?.Name + " ] " : "")}[ {mvp.ToStringWithLevel()} ]");
mvpBuilder.AppendLine($"技术得分:{stats.Rating:0.0#} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(_gamingQueue.MaxRespawnTimes != 0 ? " / " + stats.Deaths : "")}");
mvpBuilder.AppendLine($"存活时长:{stats.LiveTime:0.##} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}");
mvpBuilder.AppendLine($"存活时长:{stats.LiveTime:0.##} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn} / 总计决策数:{stats.TurnDecisions} / 总计决策点:{stats.UseDecisionPoints}");
mvpBuilder.AppendLine($"控制时长:{stats.ControlTime:0.##} / 总计治疗:{stats.TotalHeal:0.##} / 护盾抵消:{stats.TotalShield:0.##}");
mvpBuilder.AppendLine($"总计伤害:{stats.TotalDamage:0.##} / 总计物理伤害:{stats.TotalPhysicalDamage:0.##} / 总计魔法伤害:{stats.TotalMagicDamage:0.##}");
mvpBuilder.AppendLine($"总承受伤害:{stats.TotalTakenDamage:0.##} / 总承受物理伤害:{stats.TotalTakenPhysicalDamage:0.##} / 总承受魔法伤害:{stats.TotalTakenMagicDamage:0.##}");
@ -471,7 +472,7 @@ namespace Milimoe.FunGame.Testing.Desktop.GameMapTesting
CharacterStatistics stats = _gamingQueue.CharacterStatistics[character];
builder.AppendLine($"{(isWeb ? count + ". " : "")}[ {character.ToStringWithLevel()}{(tgq != null ? "" + tgq.GetTeamFromEliminated(character)?.Name + "" : "")} ]");
builder.AppendLine($"技术得分:{stats.Rating:0.0#} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(_gamingQueue.MaxRespawnTimes != 0 ? " / " + stats.Deaths : "")}");
builder.AppendLine($"存活时长:{stats.LiveTime:0.##} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}");
builder.AppendLine($"存活时长:{stats.LiveTime:0.##} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn} / 总计决策数:{stats.TurnDecisions} / 总计决策点:{stats.UseDecisionPoints}");
builder.AppendLine($"控制时长:{stats.ControlTime:0.##} / 总计治疗:{stats.TotalHeal:0.##} / 护盾抵消:{stats.TotalShield:0.##}");
builder.AppendLine($"总计伤害:{stats.TotalDamage:0.##} / 总计物理伤害:{stats.TotalPhysicalDamage:0.##} / 总计魔法伤害:{stats.TotalMagicDamage:0.##}");
builder.AppendLine($"总承受伤害:{stats.TotalTakenDamage:0.##} / 总承受物理伤害:{stats.TotalTakenPhysicalDamage:0.##} / 总承受魔法伤害:{stats.TotalTakenMagicDamage:0.##}");
@ -708,6 +709,11 @@ namespace Milimoe.FunGame.Testing.Desktop.GameMapTesting
return CharacterActionType.None; // 非玩家角色由AI处理或默认None
}
private Dictionary<string, object> GamingQueue_CharacterInquiryEvent(GamingQueue character, Character actor, DecisionPoints dp, string topic, Dictionary<string, object> args)
{
return [];
}
private static DecisionPoints GetDP(GamingQueue queue)
{
if (queue.CustomData.TryGetValue("player", out object? value) && value is Character player)
@ -866,6 +872,8 @@ namespace Milimoe.FunGame.Testing.Desktop.GameMapTesting
totalStats.Top3s += stats.Top3s;
totalStats.Loses += stats.Loses;
totalStats.MVPs += stats.MVPs;
totalStats.UseDecisionPoints += stats.UseDecisionPoints;
totalStats.TurnDecisions += stats.TurnDecisions;
if (totalStats.Plays != 0)
{
totalStats.AvgDamage = Calculation.Round2Digits(totalStats.TotalDamage / totalStats.Plays);
@ -885,6 +893,8 @@ namespace Milimoe.FunGame.Testing.Desktop.GameMapTesting
totalStats.AvgEarnedMoney = totalStats.TotalEarnedMoney / totalStats.Plays;
totalStats.Winrate = Calculation.Round4Digits(Convert.ToDouble(totalStats.Wins) / Convert.ToDouble(totalStats.Plays));
totalStats.Top3rate = Calculation.Round4Digits(Convert.ToDouble(totalStats.Top3s) / Convert.ToDouble(totalStats.Plays));
totalStats.AvgUseDecisionPoints = totalStats.UseDecisionPoints / totalStats.Plays;
totalStats.AvgTurnDecisions = totalStats.TurnDecisions / totalStats.Plays;
}
if (totalStats.LiveRound != 0) totalStats.DamagePerRound = Calculation.Round2Digits(totalStats.TotalDamage / totalStats.LiveRound);
if (totalStats.ActionTurn != 0) totalStats.DamagePerTurn = Calculation.Round2Digits(totalStats.TotalDamage / totalStats.ActionTurn);

View File

@ -398,31 +398,6 @@ namespace Milimoe.FunGame.Testing.Desktop.GameMapTesting
}
}
/// <summary>
/// 判断滚动条是否在最底部
/// </summary>
private bool IsScrollViewerAtBottom()
{
// 检查 DebugLogScrollViewer
if (DebugLogScrollViewer != null)
{
// 使用一个小容差值来处理浮点数精度问题
const double tolerance = 0.1;
double verticalOffset = DebugLogScrollViewer.VerticalOffset;
double scrollableHeight = DebugLogScrollViewer.ScrollableHeight;
// 如果可滚动高度很小或为0说明内容不足一屏视为在底部
if (scrollableHeight <= 0)
return true;
// 检查是否已经滚动到底部(容差范围内)
return Math.Abs(verticalOffset - scrollableHeight) <= tolerance;
}
// 如果没有找到滚动条,默认返回 true 以保持原有行为
return true;
}
private void CurrentRoundChanged()
{
QueueTitle.Text = $"行动顺序表{(CurrentRound > 0 ? $" - {CurrentRound} " : "")}";
@ -934,6 +909,7 @@ namespace Milimoe.FunGame.Testing.Desktop.GameMapTesting
StatsTextBlock2.Text = $"存活时长:{stats.LiveTime:0.##} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn} / 控制时长:{stats.ControlTime:0.##} / 总计治疗:{stats.TotalHeal:0.##} / 护盾抵消:{stats.TotalShield:0.##}";
StatsTextBlock3.Text = $"总计伤害:{stats.TotalDamage:0.##} / 总计物理伤害:{stats.TotalPhysicalDamage:0.##} / 总计魔法伤害:{stats.TotalMagicDamage:0.##} / 总计真实伤害:{stats.TotalTrueDamage:0.##}";
StatsTextBlock4.Text = $"总承受伤害:{stats.TotalTakenDamage:0.##} / 总承受物理伤害:{stats.TotalTakenPhysicalDamage:0.##} / 总承受魔法伤害:{stats.TotalTakenMagicDamage:0.##} / 总承受真实伤害:{stats.TotalTakenTrueDamage:0.##}";
StatsTextBlock4.Text = $"总计决策数:{stats.TurnDecisions} / 使用决策点:{stats.UseDecisionPoints} / 当前决策点:{DP.CurrentDecisionPoints} / {DP.MaxDecisionPoints}";
}
}
else
@ -943,6 +919,7 @@ namespace Milimoe.FunGame.Testing.Desktop.GameMapTesting
StatsTextBlock2.Text = "存活时长:- / 存活回合数:- / 行动回合数:- / 控制时长:- / 总计治疗:- / 护盾抵消:-";
StatsTextBlock3.Text = "总计伤害:- / 总计物理伤害:- / 总计魔法伤害:- / 总计真实伤害:-";
StatsTextBlock4.Text = "总承受伤害:- / 总承受物理伤害:- / 总承受魔法伤害:- / 总承受真实伤害:-";
StatsTextBlock4.Text = "总计决策数:- / 使用决策点:-";
}
}

View File

@ -45,26 +45,27 @@ queue.LoadGameMap(new FastAutoMap());
// Console.WriteLine(i.ToString(true, false));
//}
foreach (Skill s in FunGameConstant.Skills)
{
s.GamingQueue = queue;
s.Level = 6;
Console.WriteLine(s.GetInfo());
}
foreach (Skill m in FunGameConstant.Magics)
{
m.GamingQueue = queue;
m.Level = 8;
Console.WriteLine(m.GetInfo());
}
//foreach (Character c in FunGameConstant.Characters)
//foreach (Skill s in FunGameConstant.Skills)
//{
// Character character = c.Copy();
// character.Level = 1;
// character.Recovery();
// FunGameService.AddCharacterSkills(character, 1, 6, 6);
// Console.WriteLine(character.GetInfo());
// s.GamingQueue = queue;
// s.Level = 6;
// Console.WriteLine(s.GetInfo());
//}
//foreach (Skill m in FunGameConstant.Magics)
//{
// m.GamingQueue = queue;
// m.Level = 8;
// Console.WriteLine(m.GetInfo());
//}
foreach (Character c in FunGameConstant.Characters)
{
Character character = c.Copy();
character.Level = 60;
character.NormalAttack.Level = 8;
character.Recovery();
FunGameService.AddCharacterSkills(character, 1, 6, 6);
Console.WriteLine(character.GetInfo());
}
//foreach (Skill s in FunGameConstant.Skills)
//{
// s.Level = 6;
@ -96,18 +97,20 @@ Console.ReadKey();
while (true)
{
await FunGameSimulation.StartSimulationGame(true, false, true, false, useStore: false, hasMap: true);
ConsoleKeyInfo key = Console.ReadKey();
if (key.Key == ConsoleKey.Escape)
{
break;
}
await FunGameSimulation.StartSimulationGame(true, false, false, false, hasMap: true);
key = Console.ReadKey();
if (key.Key == ConsoleKey.Escape)
{
break;
}
await FunGameSimulation.StartSimulationGame(true, false, true, false, useStore: false, hasMap: false);
//ConsoleKeyInfo key = Console.ReadKey();
//if (key.Key == ConsoleKey.Escape)
//{
// break;
//}
await Task.Delay(100);
await FunGameSimulation.StartSimulationGame(true, false, false, false, hasMap: false);
//key = Console.ReadKey();
//if (key.Key == ConsoleKey.Escape)
//{
// break;
//}
await Task.Delay(100);
}
//strings.ForEach(Console.WriteLine);

View File

@ -308,7 +308,7 @@ namespace Milimoe.FunGame.Testing.Tests
stats.MVPs++;
mvpBuilder.AppendLine($"[ {mvp.ToStringWithLevel()} ]");
mvpBuilder.AppendLine($"技术得分:{stats.Rating:0.0#} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(gamingQueue.MaxRespawnTimes != 0 ? " / " + stats.Deaths : "")}");
mvpBuilder.AppendLine($"存活时长:{stats.LiveTime:0.##} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}");
mvpBuilder.AppendLine($"存活时长:{stats.LiveTime:0.##} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn} / 总计决策数:{stats.TurnDecisions} / 总计决策点:{stats.UseDecisionPoints}");
mvpBuilder.AppendLine($"控制时长:{stats.ControlTime:0.##} / 总计治疗:{stats.TotalHeal:0.##} / 护盾抵消:{stats.TotalShield:0.##}");
mvpBuilder.AppendLine($"总计伤害:{stats.TotalDamage:0.##} / 总计物理伤害:{stats.TotalPhysicalDamage:0.##} / 总计魔法伤害:{stats.TotalMagicDamage:0.##}");
mvpBuilder.AppendLine($"总承受伤害:{stats.TotalTakenDamage:0.##} / 总承受物理伤害:{stats.TotalTakenPhysicalDamage:0.##} / 总承受魔法伤害:{stats.TotalTakenMagicDamage:0.##}");
@ -343,7 +343,7 @@ namespace Milimoe.FunGame.Testing.Tests
CharacterStatistics stats = gamingQueue.CharacterStatistics[character];
builder.AppendLine($"{(isWeb ? count + ". " : "")}[ {character.ToStringWithLevel()} ]");
builder.AppendLine($"技术得分:{stats.Rating:0.0#} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(gamingQueue.MaxRespawnTimes != 0 ? " / " + stats.Deaths : "")}");
builder.AppendLine($"存活时长:{stats.LiveTime:0.##} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}");
builder.AppendLine($"存活时长:{stats.LiveTime:0.##} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn} / 总计决策数:{stats.TurnDecisions} / 总计决策点:{stats.UseDecisionPoints}");
builder.AppendLine($"控制时长:{stats.ControlTime:0.##} / 总计治疗:{stats.TotalHeal:0.##} / 护盾抵消:{stats.TotalShield:0.##}");
builder.AppendLine($"总计伤害:{stats.TotalDamage:0.##} / 总计物理伤害:{stats.TotalPhysicalDamage:0.##} / 总计魔法伤害:{stats.TotalMagicDamage:0.##}");
builder.AppendLine($"总承受伤害:{stats.TotalTakenDamage:0.##} / 总承受物理伤害:{stats.TotalTakenPhysicalDamage:0.##} / 总承受魔法伤害:{stats.TotalTakenMagicDamage:0.##}");
@ -821,6 +821,8 @@ namespace Milimoe.FunGame.Testing.Tests
totalStats.Top3s += stats.Top3s;
totalStats.Loses += stats.Loses;
totalStats.MVPs += stats.MVPs;
totalStats.UseDecisionPoints += stats.UseDecisionPoints;
totalStats.TurnDecisions += stats.TurnDecisions;
if (totalStats.Plays != 0)
{
totalStats.AvgDamage = Calculation.Round2Digits(totalStats.TotalDamage / totalStats.Plays);
@ -840,6 +842,8 @@ namespace Milimoe.FunGame.Testing.Tests
totalStats.AvgEarnedMoney = totalStats.TotalEarnedMoney / totalStats.Plays;
totalStats.Winrate = Calculation.Round4Digits(Convert.ToDouble(totalStats.Wins) / Convert.ToDouble(totalStats.Plays));
totalStats.Top3rate = Calculation.Round4Digits(Convert.ToDouble(totalStats.Top3s) / Convert.ToDouble(totalStats.Plays));
totalStats.AvgUseDecisionPoints = totalStats.UseDecisionPoints / totalStats.Plays;
totalStats.AvgTurnDecisions = totalStats.TurnDecisions / totalStats.Plays;
}
if (totalStats.LiveRound != 0) totalStats.DamagePerRound = Calculation.Round2Digits(totalStats.TotalDamage / totalStats.LiveRound);
if (totalStats.ActionTurn != 0) totalStats.DamagePerTurn = Calculation.Round2Digits(totalStats.TotalDamage / totalStats.ActionTurn);