示例#1
0
        public static Round ParseWeblRound(string roundText, out string f1Name, out string f2Name)
        {
            string[] lines = roundText.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
            Match    match = Regex.Match(roundText, RegexConstants.Round, RegexOptions.Multiline);
            int      round = int.Parse(match.Groups["round"].Value);
            Round    ret   = new Round()
            {
                RoundNumber = round
            };
            FighterRound r1 = new FighterRound(ret);
            FighterRound r2 = new FighterRound(ret);

            ret.Fighter1Round = r1;
            ret.Fighter2Round = r2;

            string text = RegexHelpers.RemoveMatchAndLine(match, roundText);

            GetEnduranceAndTactics(r1, ref text, out f1Name);
            GetEnduranceAndTactics(r2, ref text, out f2Name);
            if (f1Name == f2Name)
            {
                throw new Exception("Fighters need different names because I'm lazy");
            }
            r1.Tactics.Style = GetFightingStyle(text, f1Name);
            r2.Tactics.Style = GetFightingStyle(text, f2Name);
            r1.Cuts          = GetCutList(f1Name, text);
            r2.Cuts          = GetCutList(f2Name, text);
            ParseDamage(ret, text);

            GetRoundEndResult(ret, f1Name, f2Name, text);
            return(ret);
        }
示例#2
0
        private static void GetEnduranceAndTactics(FighterRound r1, ref string text, out string fighterName)
        {
            Match match = Regex.Match(text, RegexConstants.EnduranceStart, RegexOptions.Multiline);

            r1.StartEndurance = match.GroupAsDouble("endurance");
            fighterName       = match.Groups["fighter"].Value;
            match             = Regex.Match(text, RegexConstants.Tactics, RegexOptions.Multiline);
            r1.Tactics        = GetTactics(match);

            text = RegexHelpers.RemoveMatchAndLine(match, text);
            r1.Tactics.TargetArea = GetTargetArea(text);
        }
示例#3
0
        public static CutList GetCutList(string fighterName, string text)
        {
            string exp = RegexHelpers.GetEnduranceDescriptorRegex(fighterName);


            Match   match = Regex.Match(text, exp, RegexOptions.Multiline);
            CutList ret   = new CutList();
            string  temp  = text.Substring(match.Index);

            temp = temp.GetFirstLine();

            string[] splitted = temp.Split(new string[] { ". " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 1; i < splitted.Length; i++)
            {
                string cutString = splitted[i];
                Cut    c         = Cut.Parse(cutString);
                ret.Add(c);
            }
            return(ret);
        }