51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
|
|
using OECS;
|
||
|
|
|
||
|
|
namespace Game.CardWars;
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Factory for creating a fully configured game world and system group.
|
||
|
|
/// </summary>
|
||
|
|
public static class GameFactory
|
||
|
|
{
|
||
|
|
public static string DefaultCardData =>
|
||
|
|
"name,ranks,effect\n" +
|
||
|
|
"战士,3;4;4;5,战士\n" +
|
||
|
|
"弓手,3;4;4;5,弓手\n" +
|
||
|
|
"佣兵,4;5;5;6,佣兵\n" +
|
||
|
|
"商人,0;1,商人\n" +
|
||
|
|
"舞姬,0;1,舞姬\n" +
|
||
|
|
"圣骑士,2;3,圣骑士\n" +
|
||
|
|
"飞马,2;3,飞马\n" +
|
||
|
|
"诅咒师,1;2,诅咒师\n" +
|
||
|
|
"魔导士,0;1,魔导士\n" +
|
||
|
|
"公主,4,公主\n" +
|
||
|
|
"决斗家,4,决斗家\n" +
|
||
|
|
"修女,3,修女\n" +
|
||
|
|
"斥候,2,斥候\n" +
|
||
|
|
"女巫,-1,女巫\n" +
|
||
|
|
"盗贼,-1,盗贼\n";
|
||
|
|
|
||
|
|
public static (World World, SystemGroup Group) Create(int playerCount, uint seed = 42)
|
||
|
|
{
|
||
|
|
var world = new World();
|
||
|
|
var group = new SystemGroup(world);
|
||
|
|
|
||
|
|
world.Commands.Enqueue(new NewGameCommand
|
||
|
|
{
|
||
|
|
PlayerCount = playerCount,
|
||
|
|
Seed = seed,
|
||
|
|
CardDataCsv = DefaultCardData
|
||
|
|
});
|
||
|
|
|
||
|
|
group.Add(new GameSetupSystem(playerCount, DefaultCardData));
|
||
|
|
group.Add(new PlayPhaseSystem());
|
||
|
|
group.Add(new FlipPhaseSystem());
|
||
|
|
group.Add(new ScoringSystem());
|
||
|
|
group.Add(new CleanupSystem());
|
||
|
|
|
||
|
|
// Run setup.
|
||
|
|
group.RunLogical();
|
||
|
|
|
||
|
|
return (world, group);
|
||
|
|
}
|
||
|
|
}
|