using OECS;
namespace Game.Blackjack;
///
/// Deals initial two cards to player and dealer when entering the dealing phase.
/// Advances to player turn after dealing.
///
public class DealSystem : ISystem
{
public void Run(World world)
{
var state = world.ReadSingleton();
if (state.Phase != GamePhase.Dealing)
return;
ref var mutableState = ref world.GetSingleton();
// Deal two cards to player, then two to dealer.
HitCommand.DrawCard(world);
HitCommand.DrawCard(world);
HitCommand.DrawCard(world);
HitCommand.DrawCard(world);
mutableState.Phase = GamePhase.PlayerTurn;
world.MarkModified(World.SingletonEntity);
}
}
internal static class PlayerHandTag { public static readonly PlayerHand Instance = new(); }
internal static class DealerHandTag { public static readonly DealerHand Instance = new(); }