diff --git a/Library/Main.cs b/Library/Main.cs index b76acc5..e1fd24a 100644 --- a/Library/Main.cs +++ b/Library/Main.cs @@ -22,8 +22,8 @@ im.Load(); FunGameService.InitFunGame(); FunGameSimulation.InitFunGameSimulation(); -List strings = await Milimoe.FunGame.Testing.Tests.FunGameSimulation.StartGame(true, false); -strings.ForEach(Console.WriteLine); +await Milimoe.FunGame.Testing.Tests.FunGameSimulation.StartGame(true, false); +//strings.ForEach(Console.WriteLine); //_ = new Milimoe.FunGame.Testing.Tests.ActivityExample(); diff --git a/Library/Tests/FunGame.cs b/Library/Tests/FunGame.cs index c617167..f366bd0 100644 --- a/Library/Tests/FunGame.cs +++ b/Library/Tests/FunGame.cs @@ -99,7 +99,9 @@ namespace Milimoe.FunGame.Testing.Tests if (int.TryParse(input, out int id) && characters.FirstOrDefault(c => c.Id == id) is Character c) { player = c; - Console.WriteLine($"选择了 [ {player} ]!"); + Console.WriteLine($"选择了 [ {player} ]!\r\n{player.GetInfo()}"); + Console.WriteLine($"按任意键继续. . ."); + Console.ReadKey(); break; } } @@ -179,7 +181,18 @@ namespace Milimoe.FunGame.Testing.Tests int maxRound = 999; // 随机回合奖励 - Dictionary> roundRewards = FunGameService.GenerateRoundRewards(maxRound); + Dictionary effects = []; + foreach (EffectID id in FunGameConstant.RoundRewards.Keys) + { + long effectID = (long)id; + bool isActive = false; + if (effectID > (long)EffectID.Active_Start) + { + isActive = true; + } + effects.Add(effectID, isActive); + } + actionQueue.InitRoundRewards(maxRound, 1, effects, id => FunGameConstant.RoundRewards[(EffectID)id]); int i = 1; while (i < maxRound) @@ -212,67 +225,11 @@ namespace Milimoe.FunGame.Testing.Tests // 处理回合 if (characterToAct != null) { - // 获取回合奖励 - List skillRewards = []; - if (roundRewards.TryGetValue(i, out List? effectList) && effectList != null) - { - skillRewards = [.. effectList]; - } - WriteLine($"=== Round {i++} ==="); WriteLine("现在是 [ " + characterToAct + " ] 的回合!"); - // 实际的回合奖励 - List realSkillRewards = []; - if (skillRewards.Count > 0) - { - foreach (Skill skill in skillRewards) - { - Dictionary effectArgs = []; - if (FunGameConstant.RoundRewards.TryGetValue((EffectID)skill.Id, out Dictionary? dict) && dict != null) - { - effectArgs = new(dict); - } - Dictionary args = new() - { - { "skill", skill }, - { "values", effectArgs } - }; - skill.GamingQueue = actionQueue; - skill.Effects.Add(Factory.OpenFactory.GetInstance(skill.Id, "", args)); - skill.Character = characterToAct; - skill.Level = 1; - actionQueue.LastRound.RoundRewards.Add(skill); - WriteLine($"[ {characterToAct} ] 获得了回合奖励!{skill.Description}".Trim()); - if (skill.IsActive) - { - actionQueue.LastRound.Targets.Add(characterToAct); - skill.OnSkillCasted(actionQueue, characterToAct, [characterToAct]); - } - else - { - characterToAct.Skills.Add(skill); - realSkillRewards.Add(skill); - } - } - } - bool isGameEnd = await actionQueue.ProcessTurnAsync(characterToAct); - if (realSkillRewards.Count > 0) - { - foreach (Skill skill in realSkillRewards) - { - foreach (Effect e in skill.Effects) - { - e.OnEffectLost(characterToAct); - characterToAct.Effects.Remove(e); - } - characterToAct.Skills.Remove(skill); - skill.Character = null; - } - } - if (isGameEnd) { result.Add(Msg); @@ -756,7 +713,7 @@ namespace Milimoe.FunGame.Testing.Tests Msg += str + "\r\n"; if (PrintOut) Console.WriteLine(str); } - + public static void DropItems(ActionQueue queue, int mQuality, int wQuality, int aQuality, int sQuality, int acQuality) { foreach (Character character in queue.Queue)