From 2a7514729698da22d9c3f1b42c486be0487fe85c Mon Sep 17 00:00:00 2001 From: milimoe Date: Wed, 30 Oct 2024 20:31:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=A7=E8=A1=8C=E4=BB=A3=E7=A0=81=E6=B8=85?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EntityCreator/CharacterCreator.cs | 30 +++--- .../Solutions/EntityCreator/EntityEditor.cs | 1 - .../Solutions/EntityCreator/SkillCreator.cs | 2 +- FunGame.Testing.sln | 36 +++++++ Library/Items/Accessory/攻击之爪.cs | 2 +- Library/Main.cs | 98 ++++++++++++++++++- Library/Skills/NiuNan/智慧与力量.cs | 1 - Library/Solutions/ColorfulConsole.cs | 2 - Library/Solutions/DataSet.cs | 3 - Library/Solutions/DataTable.cs | 6 +- Library/Solutions/MyPlugin.cs | 8 +- Library/Solutions/TestModule.cs | 2 +- Library/Solutions/TestPlugin.cs | 3 +- Library/Tests/FunGame.cs | 3 +- 14 files changed, 158 insertions(+), 39 deletions(-) diff --git a/Desktop/Solutions/EntityCreator/CharacterCreator.cs b/Desktop/Solutions/EntityCreator/CharacterCreator.cs index 64d144b..cd6377f 100644 --- a/Desktop/Solutions/EntityCreator/CharacterCreator.cs +++ b/Desktop/Solutions/EntityCreator/CharacterCreator.cs @@ -59,7 +59,7 @@ namespace Milimoe.FunGame.Testing.Desktop.Solutions MessageBox.Show("姓不能为空。"); return; } - + if (TextCode.Text.Trim() != "") { name = TextCode.Text.Trim(); @@ -69,42 +69,42 @@ namespace Milimoe.FunGame.Testing.Desktop.Solutions MessageBox.Show("角色存档标识不能为空。"); return; } - + if (TextFirstName.Text.Trim() != "") { c.FirstName = TextFirstName.Text.Trim(); } - + if (TextNickName.Text.Trim() != "") { c.NickName = TextNickName.Text.Trim(); } - + if (TextATK.Text.Trim() != "" && double.TryParse(TextATK.Text.Trim(), out double atk)) { c.InitialATK = atk; } - + if (TextHP.Text.Trim() != "" && double.TryParse(TextHP.Text.Trim(), out double hp)) { c.InitialHP = hp; } - + if (TextMP.Text.Trim() != "" && double.TryParse(TextMP.Text.Trim(), out double mp)) { c.InitialMP = mp; } - + if (TextHR.Text.Trim() != "" && double.TryParse(TextHR.Text.Trim(), out double hr)) { c.InitialHR = hr; } - + if (TextMR.Text.Trim() != "" && double.TryParse(TextMR.Text.Trim(), out double mr)) { c.InitialMR = mr; } - + if (ComboPA.Text.Trim() != "") { string pa = ComboPA.Text.Trim(); @@ -126,32 +126,32 @@ namespace Milimoe.FunGame.Testing.Desktop.Solutions { c.InitialSTR = str; } - + if (TextGrowthSTR.Text.Trim() != "" && double.TryParse(TextGrowthSTR.Text.Trim(), out double strg)) { c.STRGrowth = strg; } - + if (TextAGI.Text.Trim() != "" && double.TryParse(TextAGI.Text.Trim(), out double agi)) { c.InitialAGI = agi; } - + if (TextGrowthAGI.Text.Trim() != "" && double.TryParse(TextGrowthAGI.Text.Trim(), out double agig)) { c.AGIGrowth = agig; } - + if (TextINT.Text.Trim() != "" && double.TryParse(TextINT.Text.Trim(), out double @int)) { c.InitialINT = @int; } - + if (TextGrowthINT.Text.Trim() != "" && double.TryParse(TextGrowthINT.Text.Trim(), out double intg)) { c.INTGrowth = intg; } - + if (TextSPD.Text.Trim() != "" && double.TryParse(TextSPD.Text.Trim(), out double spd)) { c.InitialSPD = spd; diff --git a/Desktop/Solutions/EntityCreator/EntityEditor.cs b/Desktop/Solutions/EntityCreator/EntityEditor.cs index 8713a28..139fa5a 100644 --- a/Desktop/Solutions/EntityCreator/EntityEditor.cs +++ b/Desktop/Solutions/EntityCreator/EntityEditor.cs @@ -1,6 +1,5 @@ using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; -using Milimoe.FunGame.Core.Library.Common.Addon; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Desktop.Solutions diff --git a/Desktop/Solutions/EntityCreator/SkillCreator.cs b/Desktop/Solutions/EntityCreator/SkillCreator.cs index 2b14f9c..9fe3648 100644 --- a/Desktop/Solutions/EntityCreator/SkillCreator.cs +++ b/Desktop/Solutions/EntityCreator/SkillCreator.cs @@ -67,7 +67,7 @@ namespace Milimoe.FunGame.Testing.Desktop.Solutions MessageBox.Show("技能存档标识不能为空。"); return; } - + if (EditSkill != null) { MessageBox.Show("保存成功!"); diff --git a/FunGame.Testing.sln b/FunGame.Testing.sln index db69ed8..00a78ff 100644 --- a/FunGame.Testing.sln +++ b/FunGame.Testing.sln @@ -5,7 +5,10 @@ VisualStudioVersion = 17.5.33516.290 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Testing", "Library\FunGame.Testing.csproj", "{6F6B4A21-8F39-4B0D-84E8-98AE3E93F06F}" ProjectSection(ProjectDependencies) = postProject + {63333F35-4433-4710-9D83-048B553ADD5F} = {63333F35-4433-4710-9D83-048B553ADD5F} {94B564CD-7A1E-4B3C-AF78-23EBCD5D627E} = {94B564CD-7A1E-4B3C-AF78-23EBCD5D627E} + {D74DF3A2-52E7-4C18-8854-81114558D4B2} = {D74DF3A2-52E7-4C18-8854-81114558D4B2} + {EFB418D0-EB57-4D71-AF74-205A5A3138E8} = {EFB418D0-EB57-4D71-AF74-205A5A3138E8} EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Testing.Desktop", "Desktop\FunGame.Testing.Desktop.csproj", "{05FA61CB-22AA-4834-8C45-1161C42DF2C7}" @@ -16,8 +19,29 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Core", "..\FunGame.Core\FunGame.Core.csproj", "{94B564CD-7A1E-4B3C-AF78-23EBCD5D627E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OshimaModules", "..\OshimaGameModule\OshimaModules\OshimaModules.csproj", "{35136317-2FBC-41C1-A3A0-C56B198FA440}" + ProjectSection(ProjectDependencies) = postProject + {94B564CD-7A1E-4B3C-AF78-23EBCD5D627E} = {94B564CD-7A1E-4B3C-AF78-23EBCD5D627E} + EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OshimaCore", "..\OshimaGameModule\OshimaCore\OshimaCore.csproj", "{A0EDE123-21D0-4886-8960-0802677FBC04}" + ProjectSection(ProjectDependencies) = postProject + {94B564CD-7A1E-4B3C-AF78-23EBCD5D627E} = {94B564CD-7A1E-4B3C-AF78-23EBCD5D627E} + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Implement", "..\FunGame.Server\FunGame.Implement\FunGame.Implement.csproj", "{EFB418D0-EB57-4D71-AF74-205A5A3138E8}" + ProjectSection(ProjectDependencies) = postProject + {94B564CD-7A1E-4B3C-AF78-23EBCD5D627E} = {94B564CD-7A1E-4B3C-AF78-23EBCD5D627E} + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Server", "..\FunGame.Server\FunGame.Server\FunGame.Server.csproj", "{63333F35-4433-4710-9D83-048B553ADD5F}" + ProjectSection(ProjectDependencies) = postProject + {94B564CD-7A1E-4B3C-AF78-23EBCD5D627E} = {94B564CD-7A1E-4B3C-AF78-23EBCD5D627E} + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.WebAPI", "..\FunGame.Server\FunGame.WebAPI\FunGame.WebAPI.csproj", "{D74DF3A2-52E7-4C18-8854-81114558D4B2}" + ProjectSection(ProjectDependencies) = postProject + {94B564CD-7A1E-4B3C-AF78-23EBCD5D627E} = {94B564CD-7A1E-4B3C-AF78-23EBCD5D627E} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -45,6 +69,18 @@ Global {A0EDE123-21D0-4886-8960-0802677FBC04}.Debug|Any CPU.Build.0 = Debug|Any CPU {A0EDE123-21D0-4886-8960-0802677FBC04}.Release|Any CPU.ActiveCfg = Release|Any CPU {A0EDE123-21D0-4886-8960-0802677FBC04}.Release|Any CPU.Build.0 = Release|Any CPU + {EFB418D0-EB57-4D71-AF74-205A5A3138E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EFB418D0-EB57-4D71-AF74-205A5A3138E8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EFB418D0-EB57-4D71-AF74-205A5A3138E8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EFB418D0-EB57-4D71-AF74-205A5A3138E8}.Release|Any CPU.Build.0 = Release|Any CPU + {63333F35-4433-4710-9D83-048B553ADD5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {63333F35-4433-4710-9D83-048B553ADD5F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {63333F35-4433-4710-9D83-048B553ADD5F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {63333F35-4433-4710-9D83-048B553ADD5F}.Release|Any CPU.Build.0 = Release|Any CPU + {D74DF3A2-52E7-4C18-8854-81114558D4B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D74DF3A2-52E7-4C18-8854-81114558D4B2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D74DF3A2-52E7-4C18-8854-81114558D4B2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D74DF3A2-52E7-4C18-8854-81114558D4B2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Library/Items/Accessory/攻击之爪.cs b/Library/Items/Accessory/攻击之爪.cs index 1e1fe0f..94ad56d 100644 --- a/Library/Items/Accessory/攻击之爪.cs +++ b/Library/Items/Accessory/攻击之爪.cs @@ -1,7 +1,7 @@ using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; -using Milimoe.FunGame.Testing.Skills; using Milimoe.FunGame.Testing.Effects.ItemEffects; +using Milimoe.FunGame.Testing.Skills; namespace Milimoe.FunGame.Testing.Items { diff --git a/Library/Main.cs b/Library/Main.cs index ec8cdf8..94ac83e 100644 --- a/Library/Main.cs +++ b/Library/Main.cs @@ -1,3 +1,6 @@ +using System.Diagnostics; +using System.Text; +using Milimoe.FunGame.Core.Entity; using Oshima.Core.Utils; using Oshima.FunGame.OshimaModules; @@ -9,4 +12,97 @@ ItemModule im = new(); im.Load(); FunGameSimulation.InitCharacter(); -FunGameSimulation.StartGame(true, true); + +Stopwatch stopwatch = new Stopwatch(); +stopwatch.Start(); + +for (int i = 0; i < 300; i++) +{ + FunGameSimulation.StartGame(false, false, false); + FunGameSimulation.StartGame(false, false, true); +} + +stopwatch.Stop(); +Console.WriteLine($"ִʱ䣺{stopwatch.Elapsed.Seconds} "); + +IEnumerable cs = FunGameSimulation.CharacterStatistics.OrderByDescending(d => d.Value.Rating).ThenByDescending(d => d.Value.Winrates).Select(d => d.Key); +Console.WriteLine("=== ģʽа ==="); +foreach (Character c in cs) +{ + CharacterStatistics stats = FunGameSimulation.CharacterStatistics[c]; + StringBuilder builder = new(); + + builder.AppendLine(c.ToString()); + builder.AppendLine($"Σ{stats.Plays}"); + builder.AppendLine($"ʤʣ{stats.Winrates * 100:0.##}%"); + builder.AppendLine($"÷֣{stats.Rating:0.0#}"); + + Console.WriteLine(builder.ToString()); +} + +IEnumerable cs2 = FunGameSimulation.TeamCharacterStatistics.OrderByDescending(d => d.Value.Rating).ThenByDescending(d => d.Value.Winrates).Select(d => d.Key); +Console.WriteLine("=== Ŷģʽа ==="); +foreach (Character c in cs2) +{ + CharacterStatistics stats = FunGameSimulation.TeamCharacterStatistics[c]; + StringBuilder builder = new(); + + builder.AppendLine(c.ToString()); + builder.AppendLine($"Σ{stats.Plays}"); + builder.AppendLine($"ʤʣ{stats.Winrates * 100:0.##}%"); + builder.AppendLine($"÷֣{stats.Rating:0.0#}"); + + Console.WriteLine(builder.ToString()); +} + +string input = Console.ReadLine() ?? ""; +while (true) +{ + if (input == "quit") break; + + if (input.StartsWith("sj")) + { + input = input.Replace("sj", "").Trim(); + if (int.TryParse(input, out int id)) + { + Character character = FunGameSimulation.Characters[Convert.ToInt32(id) - 1]; + if (FunGameSimulation.TeamCharacterStatistics.TryGetValue(character, out CharacterStatistics? stats) && stats != null) + { + StringBuilder builder = new(); + + builder.AppendLine(character.ToString()); + builder.AppendLine($"ܼ˺{stats.TotalDamage:0.##} / {stats.AvgDamage:0.##}"); + builder.AppendLine($"ܼ˺{stats.TotalPhysicalDamage:0.##} / {stats.AvgPhysicalDamage:0.##}"); + builder.AppendLine($"ܼħ˺{stats.TotalMagicDamage:0.##} / {stats.AvgMagicDamage:0.##}"); + builder.AppendLine($"ܼʵ˺{stats.TotalRealDamage:0.##} / {stats.AvgRealDamage:0.##}"); + builder.AppendLine($"ܼƳ˺{stats.TotalTakenDamage:0.##} / {stats.AvgTakenDamage:0.##}"); + builder.AppendLine($"ܼƳ˺{stats.TotalTakenPhysicalDamage:0.##} / {stats.AvgTakenPhysicalDamage:0.##}"); + builder.AppendLine($"ܼƳħ˺{stats.TotalTakenMagicDamage:0.##} / {stats.AvgTakenMagicDamage:0.##}"); + builder.AppendLine($"ܼƳʵ˺{stats.TotalTakenRealDamage:0.##} / {stats.AvgTakenRealDamage:0.##}"); + builder.AppendLine($"ܼƴغ{stats.LiveRound} / {stats.AvgLiveRound}"); + builder.AppendLine($"ܼжغ{stats.ActionTurn} / {stats.AvgActionTurn}"); + builder.AppendLine($"ܼƴʱ{stats.LiveTime:0.##} / {stats.AvgLiveTime:0.##}"); + builder.AppendLine($"ܼ׬ȡǮ{stats.TotalEarnedMoney} / {stats.AvgEarnedMoney}"); + builder.AppendLine($"ÿغ˺{stats.DamagePerRound:0.##}"); + builder.AppendLine($"ÿжغ˺{stats.DamagePerTurn:0.##}"); + builder.AppendLine($"ÿ˺{stats.DamagePerSecond:0.##}"); + builder.AppendLine($"ܼƻɱ{stats.Kills}" + (stats.Plays != 0 ? $" / {(double)stats.Kills / stats.Plays:0.##}" : "")); + builder.AppendLine($"ܼ{stats.Deaths}" + (stats.Plays != 0 ? $" / {(double)stats.Deaths / stats.Plays:0.##}" : "")); + builder.AppendLine($"ܼ{stats.Assists}" + (stats.Plays != 0 ? $" / {(double)stats.Assists / stats.Plays:0.##}" : "")); + builder.AppendLine($"ܼɱ{stats.FirstKills}" + (stats.Plays != 0 ? $" / ɱʣ{(double)stats.FirstKills / stats.Plays * 100:0.##}%" : "")); + builder.AppendLine($"ܼ{stats.FirstDeaths}" + (stats.Plays != 0 ? $" / ʣ{(double)stats.FirstDeaths / stats.Plays * 100:0.##}%" : "")); + builder.AppendLine($"ܼƲ{stats.Plays}"); + builder.AppendLine($"ܼƹھ{stats.Wins}"); + builder.AppendLine($"ܼǰ{stats.Top3s}"); + builder.AppendLine($"ܼưܳ{stats.Loses}"); + builder.AppendLine($"ʤʣ{stats.Winrates * 100:0.##}%"); + builder.AppendLine($"ǰʣ{stats.Top3rates * 100:0.##}%"); + builder.AppendLine($"÷֣{stats.Rating:0.0#}"); + builder.AppendLine($"ϴ{stats.LastRank} / Σ{stats.AvgRank}"); + + Console.WriteLine(builder.ToString()); + } + } + } + input = Console.ReadLine() ?? ""; +} diff --git a/Library/Skills/NiuNan/智慧与力量.cs b/Library/Skills/NiuNan/智慧与力量.cs index e4c3fdd..62a54f7 100644 --- a/Library/Skills/NiuNan/智慧与力量.cs +++ b/Library/Skills/NiuNan/智慧与力量.cs @@ -1,5 +1,4 @@ using Milimoe.FunGame.Core.Entity; -using Milimoe.FunGame.Core.Interface.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills diff --git a/Library/Solutions/ColorfulConsole.cs b/Library/Solutions/ColorfulConsole.cs index ed05004..2fc0db1 100644 --- a/Library/Solutions/ColorfulConsole.cs +++ b/Library/Solutions/ColorfulConsole.cs @@ -1,5 +1,3 @@ -using System; - namespace Milimoe.FunGame.Testing.Solutions { class ColorfulConsole diff --git a/Library/Solutions/DataSet.cs b/Library/Solutions/DataSet.cs index 7ebacf5..5f7beda 100644 --- a/Library/Solutions/DataSet.cs +++ b/Library/Solutions/DataSet.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; using System.Data; using System.Text.Json; using System.Text.Json.Serialization; -using System.Text.RegularExpressions; namespace DataSetJsonConverter { diff --git a/Library/Solutions/DataTable.cs b/Library/Solutions/DataTable.cs index c186479..289a38b 100644 --- a/Library/Solutions/DataTable.cs +++ b/Library/Solutions/DataTable.cs @@ -1,8 +1,4 @@ -using System.Data; -using System.Text.Json; -using Milimoe.FunGame.Core.Model; - -namespace Milimoe.FunGame.Testing.Solutions +namespace Milimoe.FunGame.Testing.Solutions { public class DataTableSolution { diff --git a/Library/Solutions/MyPlugin.cs b/Library/Solutions/MyPlugin.cs index 8697a14..a7f53e9 100644 --- a/Library/Solutions/MyPlugin.cs +++ b/Library/Solutions/MyPlugin.cs @@ -1,7 +1,7 @@ using Milimoe.FunGame.Core.Api.Transmittal; using Milimoe.FunGame.Core.Interface; -using Milimoe.FunGame.Core.Library.Common.Event; using Milimoe.FunGame.Core.Library.Common.Addon; +using Milimoe.FunGame.Core.Library.Common.Event; namespace FunGame.Testing.Solutions { @@ -17,7 +17,7 @@ namespace FunGame.Testing.Solutions public MyPlugin() { - + } public void AfterLoginEvent(object sender, LoginEventArgs e) @@ -62,7 +62,7 @@ namespace FunGame.Testing.Solutions public void BeforeIntoRoomEvent(object sender, RoomEventArgs e) { - + } public void AfterIntoRoomEvent(object sender, RoomEventArgs e) @@ -84,7 +84,7 @@ namespace FunGame.Testing.Solutions public void FailedIntoRoomEvent(object sender, RoomEventArgs e) { - + } } } diff --git a/Library/Solutions/TestModule.cs b/Library/Solutions/TestModule.cs index db91a51..988f77b 100644 --- a/Library/Solutions/TestModule.cs +++ b/Library/Solutions/TestModule.cs @@ -1,9 +1,9 @@ using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Common.Addon; +using Milimoe.FunGame.Testing.Effects.OpenEffects; using Milimoe.FunGame.Testing.Items; using Milimoe.FunGame.Testing.Skills; -using Milimoe.FunGame.Testing.Effects.OpenEffects; namespace Addons { diff --git a/Library/Solutions/TestPlugin.cs b/Library/Solutions/TestPlugin.cs index e006bcb..4df359c 100644 --- a/Library/Solutions/TestPlugin.cs +++ b/Library/Solutions/TestPlugin.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Interface; using Milimoe.FunGame.Core.Library.Common.Addon; diff --git a/Library/Tests/FunGame.cs b/Library/Tests/FunGame.cs index 39b3fb3..04da0e4 100644 --- a/Library/Tests/FunGame.cs +++ b/Library/Tests/FunGame.cs @@ -2,10 +2,9 @@ using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Model; -using Milimoe.FunGame.Testing.Skills; using Milimoe.FunGame.Testing.Items; +using Milimoe.FunGame.Testing.Skills; using MilimoeFunGame.Testing.Characters; -using Milimoe.FunGame.Core.Interface.Entity; namespace Milimoe.FunGame.Testing.Tests {