Exemple #1
0
        private void HideEntity(LogLine line)
        {
            Match match = PowerTaskList.HideEntityRegex.Match(line.Log);

            if (LogRegex.EntityRegex.IsMatch(match.Groups["entity"].Value))
            {
                Match  matchEntity = LogRegex.EntityRegex.Match(match.Groups["entity"].Value);
                HSCard card        = Game.GetCard(int.Parse(matchEntity.Groups["player"].Value), int.Parse(matchEntity.Groups["id"].Value));
                Match  matchPeek   = PowerTaskList.TagChangeRegex.Match(PeekLine(PowerReader).Log);
                if (HsConstants.StringToTag(match.Groups["tag"].Value).Equals(GameTag.ZONE))
                {
                    Zone oldzone = card.Zone;
                    card.AddTag(match.Groups["tag"].Value, match.Groups["value"].Value);
                    MoveCard(card, oldzone);
                }
                else
                {
                    throw new IndexOutOfRangeException();
                }
            }
            else
            {
                throw new IndexOutOfRangeException();
            }
        }
Exemple #2
0
        //Create Things
        public void AddTag(string tag, string value)
        {
            GameTag gt = HsConstants.StringToTag(tag);
            int     i  = HsConstants.TagToInt(gt, value);

            if (Tags.ContainsKey(gt))
            {
                IO.LogDebug("Changed GE Tag: " + tag + " to " + i, IO.DebugFile.Hs, false);
                Tags[gt] = i;
            }
            else
            {
                IO.LogDebug("Added GE Tag: " + tag + " to " + i, IO.DebugFile.Hs, false);
                Tags.Add(gt, i);
            }

            //TRIGGERS TAGS GAME

            if (gt.Equals(GameTag.STEP) && i == (int)Step.BEGIN_MULLIGAN)
            {
                foreach (var item in GetUserHand())
                {
                    IO.LogDebug("Mulligan " + item, IO.DebugFile.Hs);
                }
            }
        }
Exemple #3
0
        //Tags
        public void AddTag(string tag, string value)
        {
            GameTag gt = HsConstants.StringToTag(tag);
            int     i  = HsConstants.TagToInt(gt, value);

            if (Tags.ContainsKey(gt))
            {
                IO.LogDebug("Changed " + Id + " " + CardDB?.Name + " Tag: " + tag + " to " + i, IO.DebugFile.Hs, false);
                Tags[gt] = i;
            }
            else
            {
                IO.LogDebug("Added " + Id + " " + CardDB?.Name + " Tag: " + tag + " to " + i, IO.DebugFile.Hs, false);
                Tags.Add(gt, i);
            }
        }
Exemple #4
0
        private void TagChange(LogLine line)
        {
            Match match = PowerTaskList.TagChangeRegex.Match(line.Log);

            if (match.Groups["entity"].Value.Equals("GameEntity"))
            {
                Game.AddTag(match.Groups["tag"].Value, match.Groups["value"].Value);
                if (HsConstants.StringToTag(match.Groups["tag"].Value).Equals(GameTag.STATE) && match.Groups["value"].Value.Equals("COMPLETE"))
                {
                    THS.Windows.THS.GameCore.EndGame();
                }
            }
            else if (match.Groups["entity"].Value.Equals(Game.User.PlayerName))
            {
                Game.User.AddTag(match.Groups["tag"].Value, match.Groups["value"].Value);
            }
            else if (match.Groups["entity"].Value.Equals(Game.Opponent.PlayerName))
            {
                Game.Opponent.AddTag(match.Groups["tag"].Value, match.Groups["value"].Value);
            }
            else if (LogRegex.EntityRegex.IsMatch(match.Groups["entity"].Value))
            {
                Match  matchEntity = LogRegex.EntityRegex.Match(match.Groups["entity"].Value);
                HSCard card        = Game.GetCard(int.Parse(matchEntity.Groups["player"].Value), int.Parse(matchEntity.Groups["id"].Value));
                if (HsConstants.StringToTag(match.Groups["tag"].Value).Equals(GameTag.ZONE))
                {
                    //Cambiar la zona de la carta en las variables
                    Zone oldzone = card.Zone;
                    card.AddTag(match.Groups["tag"].Value, match.Groups["value"].Value);
                    MoveCard(card, oldzone);
                }
                else
                {
                    card.AddTag(match.Groups["tag"].Value, match.Groups["value"].Value);
                }
            }
            else
            {
                throw new IndexOutOfRangeException();
            }
        }
Exemple #5
0
        private void UpdatingEntity(LogLine line)
        {
            Match match       = PowerTaskList.UpdatingEntityRegex.Match(line.Log);
            Match matchEntity = LogRegex.EntityRegex.Match(match.Groups["entity"].Value);

            if (!Game.PlayersOrdered)
            {
                if (matchEntity.Groups["player"].Value.Equals("2"))
                {
                    HSPlayer tmp = Game.User;
                    Game.User           = Game.Opponent;
                    Game.Opponent       = tmp;
                    Game.User.Enemy     = false;
                    Game.Opponent.Enemy = true;
                }
                Game.PlayersOrdered = true;
            }
            HSCard card = Game.GetCard(int.Parse(matchEntity.Groups["player"].Value), int.Parse(matchEntity.Groups["id"].Value));

            if (card.CardDB == null)
            {
                card.CardDB = Cards.All[match.Groups["cardId"].Value];
            }
            while (PowerTaskList.TagRegex.IsMatch(PeekLine(PowerReader).Log))
            {
                var a = GetLine(PowerReader).Log;
                match = PowerTaskList.TagRegex.Match(a);
                if (HsConstants.StringToTag(match.Groups["tag"].Value).Equals(GameTag.ZONE))
                {
                    Zone oldzone = card.Zone;
                    card.AddTag(match.Groups["tag"].Value, match.Groups["value"].Value);
                    MoveCard(card, oldzone);
                }
                else
                {
                    card.AddTag(match.Groups["tag"].Value, match.Groups["value"].Value);
                }
            }
            IO.LogDebug("Updated card " + card, IO.DebugFile.Hs, false);
        }