From 040bdade213a9d246caea6addd76eeb80287d943 Mon Sep 17 00:00:00 2001 From: milimoe Date: Mon, 23 Jun 2025 23:24:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=9A=84=E6=88=98=E6=8A=80=E9=AD=94?= =?UTF-8?q?=E6=B3=95=E8=B7=AF=E7=BA=BF=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Main.cs | 25 +++++++++-------- Library/Tests/CharacterTest.cs | 24 ++++++++++++++-- Library/Tests/FunGame.cs | 50 ++++++++++++++-------------------- 3 files changed, 55 insertions(+), 44 deletions(-) diff --git a/Library/Main.cs b/Library/Main.cs index 00da98b..180d937 100644 --- a/Library/Main.cs +++ b/Library/Main.cs @@ -25,7 +25,9 @@ im.Load(); FunGameService.InitFunGame(); FunGameSimulation.InitFunGameSimulation(); -//new CharacterTest(); +FunGameController controller = new(new Logger(new LoggerFactory())); + +await CharacterTest.CharacterTest1(); //foreach (Character c in FunGameConstant.Characters) //{ // Character character = c.Copy(); @@ -61,15 +63,15 @@ FunGameSimulation.InitFunGameSimulation(); // m.Level = 8; // Console.WriteLine(m.GetInfo()); //} -Character character = new Oshima.FunGame.OshimaModules.Characters.CustomCharacter(0, ""); -character.SetLevel(60); -foreach (Item i in FunGameConstant.Equipment) -{ - character.Equip(i); - if (i.ItemType == ItemType.GiftBox && i.Name != "毕业礼包") continue; - Console.WriteLine(i.ToString()); -} -Console.WriteLine(character.GetInfo()); +//Character character = new Oshima.FunGame.OshimaModules.Characters.CustomCharacter(0, ""); +//character.SetLevel(60); +//foreach (Item i in FunGameConstant.Equipment) +//{ +// character.Equip(i); +// if (i.ItemType == ItemType.GiftBox && i.Name != "毕业礼包") continue; +// Console.WriteLine(i.ToString()); +//} +//Console.WriteLine(character.GetInfo()); //foreach (Item i in FunGameConstant.Equipment) //{ // StringBuilder builder = new(); @@ -105,6 +107,7 @@ Console.ReadKey(); //Console.ReadKey(); //await FunGameTesting.StartGame(true, false); +//Console.ReadKey(); while (true) { @@ -126,8 +129,6 @@ while (true) //Console.WriteLine(testc.InitialSTR + $" ({testc.STRGrowth}/Lv)"); //Console.WriteLine(testc.InitialAGI + $" ({testc.AGIGrowth}/Lv)"); //Console.WriteLine(testc.InitialINT + $" ({testc.INTGrowth}/Lv)"); - -FunGameController controller = new(new Logger(new LoggerFactory())); //Console.WriteLine(controller.GetWinrateRank()); //Console.WriteLine(controller.GetWinrateRank(true)); //Console.WriteLine(controller.GetRatingRank()); diff --git a/Library/Tests/CharacterTest.cs b/Library/Tests/CharacterTest.cs index 7c0002e..6b9ee81 100644 --- a/Library/Tests/CharacterTest.cs +++ b/Library/Tests/CharacterTest.cs @@ -10,7 +10,7 @@ namespace Milimoe.FunGame.Testing.Tests { internal class CharacterTest { - public CharacterTest() + public static async Task CharacterTest1() { GamingQueue queue = new(Console.WriteLine); Character character = new CustomCharacter(0, ""); @@ -19,12 +19,30 @@ namespace Milimoe.FunGame.Testing.Tests Item item = FunGameConstant.Equipment.Where(i => i.Id == 12515).First(); character.Equip(item); Console.WriteLine(character.GetInfo()); + Character teammate = new MagicalGirl(); + Console.ReadKey(); + teammate.SetLevel(60); + Skill skill = new 毁灭之势(teammate); + teammate.Skills.Add(skill); + skill.GamingQueue = queue; + skill.Character = teammate; + skill.Level++; + skill = new 绝对领域(teammate); + teammate.Skills.Add(skill); + skill.GamingQueue = queue; + skill.Character = teammate; + skill.Level += 6; + skill.OnSkillCasted(queue, teammate, [character]); Character enemy = new CustomCharacter(1, "敌人"); Console.ReadKey(); enemy.SetLevel(60); - Skill skill = new 虚弱领域(enemy); + skill = new 混沌烙印(enemy); + skill.GamingQueue = queue; skill.Level += 8; - skill.OnSkillCasted(queue, enemy, [character]); + skill.OnSkillCasted(queue, enemy, [teammate]); + queue.CharacterStatistics[teammate] = new CharacterStatistics(); + queue.AddCharacter(teammate, 10); + await queue.TimeLapse(); character.UnEquip(EquipSlotType.Armor); Console.WriteLine(character.GetInfo()); Console.ReadKey(); diff --git a/Library/Tests/FunGame.cs b/Library/Tests/FunGame.cs index e5aba08..649be2d 100644 --- a/Library/Tests/FunGame.cs +++ b/Library/Tests/FunGame.cs @@ -12,25 +12,6 @@ namespace Milimoe.FunGame.Testing.Tests { public class FunGameTesting { - public FunGameTesting() - { - InitCharacter(); - Task.Run(async () => - { - bool printout = true; - List strs = await StartGame(printout); - if (printout == false) - { - foreach (string str in strs) - { - Console.WriteLine(str); - } - } - - Console.ReadKey(); - }); - } - public static Dictionary CharacterStatistics { get; } = []; public static PluginConfig StatsConfig { get; } = new(nameof(FunGameSimulation), nameof(CharacterStatistics)); public static bool IsRuning { get; set; } = false; @@ -135,11 +116,11 @@ namespace Milimoe.FunGame.Testing.Tests // 开始空投 Msg = ""; - int qMagicCardPack = 0; - int qWeapon = 0; - int qArmor = 0; - int qShoes = 0; - int qAccessory = 0; + int qMagicCardPack = 5; + int qWeapon = 5; + int qArmor = 5; + int qShoes = 5; + int qAccessory = 4; WriteLine($"社区送温暖了,现在随机发放空投!!"); DropItems(gamingQueue, qMagicCardPack, qWeapon, qArmor, qShoes, qAccessory); WriteLine(""); @@ -323,6 +304,7 @@ namespace Milimoe.FunGame.Testing.Tests 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.##}"); + if (stats.TotalTrueDamage > 0 || stats.TotalTakenTrueDamage > 0) mvpBuilder.AppendLine($"总计真实伤害:{stats.TotalTrueDamage:0.##} / 总承受真实伤害:{stats.TotalTakenTrueDamage:0.##}"); mvpBuilder.Append($"每秒伤害:{stats.DamagePerSecond:0.##} / 每回合伤害:{stats.DamagePerTurn:0.##}"); } @@ -357,6 +339,7 @@ namespace Milimoe.FunGame.Testing.Tests 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.##}"); + if (stats.TotalTrueDamage > 0 || stats.TotalTakenTrueDamage > 0) builder.AppendLine($"总计真实伤害:{stats.TotalTrueDamage:0.##} / 总承受真实伤害:{stats.TotalTakenTrueDamage:0.##}"); builder.Append($"每秒伤害:{stats.DamagePerSecond:0.##} / 每回合伤害:{stats.DamagePerTurn:0.##}"); if (count++ <= top) { @@ -725,12 +708,13 @@ namespace Milimoe.FunGame.Testing.Tests public static void DropItems(GamingQueue queue, int mQuality, int wQuality, int aQuality, int sQuality, int acQuality) { - foreach (Character character in queue.Queue) + Item[] weapons = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == wQuality)]; + Item[] armors = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == aQuality)]; + Item[] shoes = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && (int)i.QualityType == sQuality)]; + Item[] accessorys = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && (int)i.QualityType == acQuality)]; + Item[] consumables = [.. FunGameConstant.AllItems.Where(i => i.ItemType == ItemType.Consumable && i.IsInGameItem)]; + foreach (Character character in queue.AllCharacters) { - Item[] weapons = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == wQuality)]; - Item[] armors = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == aQuality)]; - Item[] shoes = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && (int)i.QualityType == sQuality)]; - Item[] accessorys = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && (int)i.QualityType == acQuality)]; Item? a = null, b = null, c = null, d = null; if (weapons.Length > 0) { @@ -769,6 +753,14 @@ namespace Milimoe.FunGame.Testing.Tests realItem.SetGamingQueue(queue); queue.Equip(character, realItem); } + if (consumables.Length > 0 && character.Items.Count < 5) + { + for (int i = 0; i < 2; i++) + { + Item consumable = consumables[Random.Shared.Next(consumables.Length)].Copy(); + character.Items.Add(consumable); + } + } } }