mirror of
https://github.com/milimoe/FunGame-Testing.git
synced 2025-04-21 19:59:34 +08:00
更新行动顺序表的异步支持
This commit is contained in:
parent
492b96aefb
commit
6f66c47902
@ -4,7 +4,7 @@ using Oshima.FunGame.OshimaModules;
|
|||||||
using Oshima.FunGame.OshimaServers.Service;
|
using Oshima.FunGame.OshimaServers.Service;
|
||||||
using Oshima.FunGame.WebAPI.Controllers;
|
using Oshima.FunGame.WebAPI.Controllers;
|
||||||
|
|
||||||
_ = new Milimoe.FunGame.Testing.Solutions.Novels();
|
//_ = new Milimoe.FunGame.Testing.Solutions.Novels();
|
||||||
|
|
||||||
//_ = new Milimoe.FunGame.Testing.Tests.CheckDLL();
|
//_ = new Milimoe.FunGame.Testing.Tests.CheckDLL();
|
||||||
|
|
||||||
@ -24,8 +24,8 @@ FunGameSimulation.InitFunGameSimulation();
|
|||||||
|
|
||||||
//_ = new Milimoe.FunGame.Testing.Tests.ActivityExample();
|
//_ = new Milimoe.FunGame.Testing.Tests.ActivityExample();
|
||||||
|
|
||||||
//List<string> strings = FunGameSimulation.StartSimulationGame(true, false, true);
|
List<string> strings = await FunGameSimulation.StartSimulationGame(true, false, true);
|
||||||
//strings.ForEach(Console.WriteLine);
|
strings.ForEach(Console.WriteLine);
|
||||||
|
|
||||||
//Character testc = new CustomCharacter(1, "1");
|
//Character testc = new CustomCharacter(1, "1");
|
||||||
//Console.WriteLine(testc.GetInfo());
|
//Console.WriteLine(testc.GetInfo());
|
||||||
|
@ -11,9 +11,10 @@ namespace Milimoe.FunGame.Testing.Tests
|
|||||||
public FunGameSimulation()
|
public FunGameSimulation()
|
||||||
{
|
{
|
||||||
InitCharacter();
|
InitCharacter();
|
||||||
|
Task.Run(async () =>
|
||||||
|
{
|
||||||
bool printout = true;
|
bool printout = true;
|
||||||
List<string> strs = StartGame(printout);
|
List<string> strs = await StartGame(printout);
|
||||||
if (printout == false)
|
if (printout == false)
|
||||||
{
|
{
|
||||||
foreach (string str in strs)
|
foreach (string str in strs)
|
||||||
@ -23,6 +24,7 @@ namespace Milimoe.FunGame.Testing.Tests
|
|||||||
}
|
}
|
||||||
|
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Character> Characters { get; } = [];
|
public static List<Character> Characters { get; } = [];
|
||||||
@ -34,7 +36,7 @@ namespace Milimoe.FunGame.Testing.Tests
|
|||||||
public static bool PrintOut { get; set; } = false;
|
public static bool PrintOut { get; set; } = false;
|
||||||
public static string Msg { get; set; } = "";
|
public static string Msg { get; set; } = "";
|
||||||
|
|
||||||
public static List<string> StartGame(bool printout, bool isWeb = false)
|
public static async Task<List<string>> StartGame(bool printout, bool isWeb = false)
|
||||||
{
|
{
|
||||||
PrintOut = printout;
|
PrintOut = printout;
|
||||||
IsWeb = isWeb;
|
IsWeb = isWeb;
|
||||||
@ -57,7 +59,7 @@ namespace Milimoe.FunGame.Testing.Tests
|
|||||||
// M = 5, W = 0, P1 = 0, P3 = 2
|
// M = 5, W = 0, P1 = 0, P3 = 2
|
||||||
// M = 5, W = 1, P1 = 0, P3 = 0
|
// M = 5, W = 1, P1 = 0, P3 = 0
|
||||||
|
|
||||||
List<Character> list = new(Characters);
|
List<Character> list = [.. Characters];
|
||||||
|
|
||||||
if (list.Count > 11)
|
if (list.Count > 11)
|
||||||
{
|
{
|
||||||
@ -327,9 +329,9 @@ namespace Milimoe.FunGame.Testing.Tests
|
|||||||
foreach (Character c in characters.Where(c => c != winner && c.HP > 0))
|
foreach (Character c in characters.Where(c => c != winner && c.HP > 0))
|
||||||
{
|
{
|
||||||
WriteLine("[ " + winner + " ] 对 [ " + c + " ] 造成了 99999999999 点真实伤害。");
|
WriteLine("[ " + winner + " ] 对 [ " + c + " ] 造成了 99999999999 点真实伤害。");
|
||||||
actionQueue.DeathCalculation(winner, c);
|
await actionQueue.DeathCalculationAsync(winner, c);
|
||||||
}
|
}
|
||||||
actionQueue.EndGameInfo(winner);
|
await actionQueue.EndGameInfo(winner);
|
||||||
result.Add(Msg);
|
result.Add(Msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -343,7 +345,7 @@ namespace Milimoe.FunGame.Testing.Tests
|
|||||||
WriteLine($"=== Round {i++} ===");
|
WriteLine($"=== Round {i++} ===");
|
||||||
WriteLine("现在是 [ " + characterToAct + " ] 的回合!");
|
WriteLine("现在是 [ " + characterToAct + " ] 的回合!");
|
||||||
|
|
||||||
bool isGameEnd = actionQueue.ProcessTurn(characterToAct);
|
bool isGameEnd = await actionQueue.ProcessTurnAsync(characterToAct);
|
||||||
if (isGameEnd)
|
if (isGameEnd)
|
||||||
{
|
{
|
||||||
result.Add(Msg);
|
result.Add(Msg);
|
||||||
@ -355,7 +357,7 @@ namespace Milimoe.FunGame.Testing.Tests
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 模拟时间流逝
|
// 模拟时间流逝
|
||||||
double timeLapse = actionQueue.TimeLapse();
|
double timeLapse = await actionQueue.TimeLapse();
|
||||||
totalTime += timeLapse;
|
totalTime += timeLapse;
|
||||||
下一次空投 -= timeLapse;
|
下一次空投 -= timeLapse;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user