private CardEntity[] GetPlayerResourceCard(Resource type)
 {
     return(_context.GetEntities(CardMatcher.InBox)
            .Where(c => c.owner.Entity == _player &&
                   c.hasResourceCard &&
                   c.resourceCard.Type == type
                   ).ToArray());
 }
Exemplo n.º 2
0
    protected override void Execute(List <GameEntity> entities)
    {
        foreach (var e in entities)
        {
            var movingCards = _eventContext.GetEntities(GameEventMatcher.EventMoveDeckCard)
                              .Select(ev => ev.eventMoveDeckCard.CardEntity);
            var cards = _cardContext.GetEntities(CardMatcher.DeckCard)
                        .Except(movingCards)
                        .ToArray()
                        .Shuffle();

            if (cards.Length > 0)
            {
                var drawCards = cards.Take(Math.Min(cards.Length, _setting.StartTurnDrawCount));
                foreach (var c in drawCards)
                {
                    EventMoveDeckCard.MoveCardToPlayer(c, e);
                }
            }
        }
    }
Exemplo n.º 3
0
    protected override void Execute(List <GameEntity> entities)
    {
        var players     = _gameContext.GetEntities(GameMatcher.Player);
        var movingCards = _eventContext.GetEntities(GameEventMatcher.EventMoveDeckCard)
                          .Select(e => e.eventMoveDeckCard.CardEntity);
        var cards = _cardContext.GetEntities(CardMatcher.DeckCard)
                    .Except(movingCards)
                    .ToArray()
                    .Shuffle();

        Assert.IsTrue(players.Count() * _setting.StartCardCount <= cards.Length);

        var i = 0;

        foreach (var p in players)
        {
            _setting.StartCardCount.Loop(() =>
            {
                EventMoveDeckCard.MoveCardToPlayer(cards[i], p);
                i++;
            });
        }
    }
Exemplo n.º 4
0
 public static CardEntity[] GetShareResourceCards(this CardContext context)
 {
     return(context.GetEntities(CardMatcher.ResourceCard)
            .Where(c => !c.hasOwner)
            .ToArray());
 }
Exemplo n.º 5
0
 public static CardEntity[] GetResourceCards(this CardContext context)
 {
     return(context.GetEntities(CardMatcher.ResourceCard));
 }
Exemplo n.º 6
0
 public static CardEntity[] GetBoxCards(this CardContext context)
 {
     return(context.GetEntities(CardMatcher.InBox));
 }
Exemplo n.º 7
0
 public static CardEntity[] GetDeckCards(this CardContext context)
 {
     return(context.GetEntities(CardMatcher.DeckCard));
 }
Exemplo n.º 8
0
 public static CardEntity[] GetPlayerSkills(this CardContext context, GameEntity playerEntity)
 {
     return(context.GetEntities(CardMatcher.SkillCard)
            .Where(e => e.owner.Entity == playerEntity)
            .ToArray());
 }