Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        private static int CheckWarnings(bool dirty, int defense, int warnings, int numTimes, bool checkDq)
        {
            int times = 0;

            for (int i = 0; i < numTimes; i++)
            {
                WarningResult res = FighterRound.CheckWarning(dirty, warnings, FightingStyle.Clinch, defense);
                if (checkDq && res.IsDisqualified)
                {
                    times++;
                }
                if (!checkDq && res.IsWarned)
                {
                    times++;
                }
            }
            return(times);
        }
Ejemplo n.º 4
0
        public double DqPercentTest(int warnings)
        {
            double ret = FighterRound.DqPercent(warnings);

            return(ret);
        }