Example #1
0
        public void HandleTag(Game game, GameAction action, Tag tag)
        {
            if (string.Equals(tag.Name, "TURN"))
                HandleTurnTag(game, action, tag);

            if (string.Equals(tag.Name, "ZONE") &&
                string.Equals(tag.Value, "HAND") &&
                string.Equals(action.SubType, "TRIGGER"))
                HandleTurnDrawTag(game, action, tag);
        }
Example #2
0
        public void HandleTurnTag(Game game, GameAction action, Tag tag)
        {
            var turn = new Turn();
            turn.TurnIndex = int.Parse(tag.Value);
            if (game.Draw != null)
            {
                turn.Draw = game.Draw;
                game.Draw = null;
            }

            game.Turns.Add(turn);
        }
Example #3
0
 public Act Convert(Tag tag)
 {
     var act = new PlayMinionCardAct(tag.Entity.Card);
     act.Card.Name = tag.Entity.Name;
     return act;
 }
Example #4
0
 public void HandleTurnDrawTag(Game game, GameAction action, Tag tag)
 {
     game.Draw = tag.Entity.Card;
 }
Example #5
0
 private Tag ParseTag(string tagString)
 {
     var tag = new Tag();
     var tagRegex = new Regex(@"Entity=(\[name=(?<entityname>[\w\s\dа-яА-Я_-]+)\sid=(?<entityid>\d+)\szone=(?<entityzone>\w+)\szonePos=(?<entityzonepos>\d)\scardId=(?<entitycardid>[\w\d_]+)\splayer=(?<entityplayer>\d)\]|\[id=(?<entityid>\d+)\scardId=\stype=INVALID\szone=(?<entityzone>\w*)\szonePos=(?<entityzonepos>\d+)\splayer=(?<entityplayer>\d)\]|(?<entity>.*)) tag=(?<tag>[\w_]*) value=(?<value>[^\r]*)");
     var match = tagRegex.Match(tagString);
     tag.Entity = new Entity();
     tag.IsConsistent = true;
     int entityId;
     if (!string.IsNullOrEmpty(match.Groups["entityid"].Value) &&
         int.TryParse(match.Groups["entityid"].Value, out entityId))
     {
         tag.Entity.Id = entityId;
         if (string.IsNullOrEmpty(match.Groups["entityname"].Value))
         {
             tag.Entity.Id = entityId;
             tag.Entity.Zone = match.Groups["entityzone"].Value;
             tag.Entity.ZonePos = int.Parse(match.Groups["entityzonepos"].Value);
             tag.Entity.Player = int.Parse(match.Groups["entityplayer"].Value);
         }
         else
         {
             tag.Entity.Name = match.Groups["entityname"].Value;
             tag.Entity.CardId = match.Groups["entitycardid"].Value;
             tag.Entity.Zone = match.Groups["entityzone"].Value;
             tag.Entity.ZonePos = int.Parse(match.Groups["entityzonepos"].Value);
             tag.Entity.Player = int.Parse(match.Groups["entityplayer"].Value);
         }
     }
     else
     {
         tag.Entity.Name = match.Groups["entity"].Value;
     }
     tag.Name = match.Groups["tag"].Value;
     tag.Value = match.Groups["value"].Value;
     return tag;
 }