private static void AddTargetAsKnownCardId(IHsGameState gameState, IGame game, Match match, int count = 1)
        {
            var target = match.Groups["target"].Value.Trim();

            if (!target.StartsWith("[") || !EntityRegex.IsMatch(target))
            {
                return;
            }
            var cardIdMatch = CardIdRegex.Match(target);

            if (!cardIdMatch.Success)
            {
                return;
            }
            var targetCardId = cardIdMatch.Groups["cardId"].Value.Trim();

            for (var i = 0; i < count; i++)
            {
                var id = GetMaxEntityId(gameState, game) + i + 1;
                if (!gameState.KnownCardIds.ContainsKey(id))
                {
                    gameState.KnownCardIds.Add(id, targetCardId);
                }
            }
        }
Пример #2
0
        private static string GetTargetCardId(Match match)
        {
            var target = match.Groups["target"].Value.Trim();

            if (!target.StartsWith("[") || !EntityRegex.IsMatch(target))
            {
                return(null);
            }
            var cardIdMatch = CardIdRegex.Match(target);

            return(!cardIdMatch.Success ? null : cardIdMatch.Groups["cardId"].Value.Trim());
        }