public void Allocate(RushUnit ru, int nTDr, PlayerGameMetricsCollection pgms)
 {
     if (ru.Starters.Count > 0)
     {
         var pgm = pgms.GetPgmFor(ru.R1.PlayerCode);
         pgm.PlayerId = ru.R1.PlayerCode;                  // incase its a new one
         pgm.ProjTDr += R1TdsFrom(nTDr);
         pgms.Update(pgm);
         var pgm2 = pgms.GetPgmFor(ru.R2.PlayerCode);
         pgm2.PlayerId = ru.R2.PlayerCode;                  // incase its a new one
         pgm2.ProjTDr += R2TdsFrom(nTDr);
         pgms.Update(pgm2);
     }
 }
        public void Allocate(
            RushUnit ru,
            int nTDr,
            PlayerGameMetricsCollection pgms)
        {
            if (nTDr == 0)
            {
                return;
            }

            foreach (var starter in ru.Starters)
            {
                int tdsLostToLeakage = nTDr % 2;
                nTDr -= tdsLostToLeakage;
                if (nTDr == 0)
                {
                    break;
                }
                var pgm = pgms.GetPgmFor(
                    starter.PlayerCode);
                pgm.ProjTDr += nTDr / ru.Starters.Count;                  // 50-50
                pgms.Update(
                    pgm);
            }
        }
        public void Allocate(RushUnit ru, int nTDr, PlayerGameMetricsCollection pgms)
        {
            var pgm = pgms.GetPgmFor(ru.R1.PlayerCode);

            pgm.PlayerId = ru.R1.PlayerCode;
            pgm.ProjTDr += nTDr;
            pgms.Update(pgm);
        }
        public void Allocate(RushUnit ru, int nYDr, PlayerGameMetricsCollection pgms)
        {
            //  aces get 90%
            var projYDr = ( int )(0.9M * nYDr);
            var pgm     = pgms.GetPgmFor(ru.R1.PlayerCode);

            pgm.ProjYDr += ( int )(projYDr * ru.R1.HealthFactor());
            pgms.Update(pgm);
        }
示例#5
0
 public void Allocate(RushUnit ru, int nTDr, PlayerGameMetricsCollection pgms)
 {
     foreach (var starter in ru.Starters)
     {
         var pgm = pgms.GetPgmFor(starter.PlayerCode);
         pgm.ProjTDr += nTDr / ru.Starters.Count;
         pgms.Update(pgm);
     }
 }
        private void DoRushingUnit(
            PlayerGameProjectionMessage input,
            string teamCode,
            bool isHome)
        {
            RushUnit ru;

            if (isHome)
            {
                ru = input.Game.HomeNflTeam.RunUnit;
            }
            else
            {
                ru = input.Game.AwayNflTeam.RunUnit;
            }

            if (ru == null)
            {
                ru = new RushUnit();
            }

            if (!ru.IsLoaded())
            {
                ru.Load(teamCode);
            }

            var pgms = new PlayerGameMetricsCollection(
                input.Game);
            var projTDr = isHome  ? input.Prediction.HomeTDr : input.Prediction.AwayTDr;

            projTDr = AllowForVultures(
                ru,
                projTDr,
                pgms);
            AllocateTDr(
                ru,
                projTDr,
                pgms);
            input.Game.PlayerGameMetrics = pgms.Pgms;

            var projYDr = isHome  ? input.Prediction.HomeYDr : input.Prediction.AwayYDr;

            AllocateYDr(
                ru,
                projYDr,
                pgms);

            if (ru.ThirdDownBack != null)
            {
                var projYDc = ( int )(.05 * (isHome  ? input.Prediction.HomeYDp : input.Prediction.AwayYDp));
                var pgm     = pgms.GetPgmFor(
                    ru.ThirdDownBack.PlayerCode);
                pgm.ProjYDc += projYDc;
                pgms.Update(pgm);
            }
        }
示例#7
0
        private int AllowForVultures(RushUnit ru, int projTDr, PlayerGameMetricsCollection pgms)
        {
            var nTDr = projTDr;

            if (ru.GoalLineBack != null)
            {
                var pgm         = pgms.GetPgmFor(ru.GoalLineBack.PlayerCode);
                var vulturedTDs = VulturedTdsFrom(nTDr);
                pgm.ProjTDr += vulturedTDs;
                pgms.Update(pgm);
                nTDr -= vulturedTDs;
            }
            return(nTDr);
        }
示例#8
0
        public void Allocate(RushUnit ru, int nYDr, PlayerGameMetricsCollection pgms)
        {
            if (ru.Runners.Count == 0)
            {
                return;
            }
            if (ru.Starters.Count > 0)
            {
                //  70% 20%
                var projYDr = ( int )(0.7M * nYDr);
                var pgm     = pgms.GetPgmFor(ru.R1.PlayerCode);
                pgm.ProjYDr += ( int )(projYDr * ru.R1.HealthFactor());
                pgms.Update(pgm);
            }

            if (ru.R2 != null)
            {
                var projYDr2 = ( int )(0.2M * nYDr);
                var pgm2     = pgms.GetPgmFor(ru.R2.PlayerCode);
                pgm2.ProjYDr += projYDr2;
                pgms.Update(pgm2);
            }
        }
        public void Allocate(RushUnit ru, int nYDr, PlayerGameMetricsCollection pgms)
        {
            var nStarters = 0;

            //  45% 45%
            foreach (var starter in ru.Starters)
            {
                var projYDr = ( int )(0.45M * nYDr);
                var pgm     = pgms.GetPgmFor(starter.PlayerCode);
                pgm.ProjYDr += ( int )(projYDr * starter.HealthFactor());
                pgms.Update(pgm);
                nStarters++;
                if (nStarters > 2)
                {
                    break;
                }
            }
        }