private void DoPassingUnit(PlayerGameProjectionMessage input, string teamCode, bool isHome)
        {
            var unit = new PassUnit();

            unit.Load(teamCode);

            // give it to the QB
            var projYDp = (int)(((isHome) ? input.Prediction.HomeYDp : input.Prediction.AwayYDp));
            var projTDp = (int)(((isHome) ? input.Prediction.HomeTDp : input.Prediction.AwayTDp));

            AddPassinglayerGameMetric(input, unit.Q1.PlayerCode, projYDp, projTDp);
            // Receivers
            var projYDc = (int)(.4 * ((isHome) ? input.Prediction.HomeYDp : input.Prediction.AwayYDp));
            var projTDc = W1TdsFrom((isHome) ? input.Prediction.HomeTDp : input.Prediction.AwayTDp);

            projYDc = AllowForInjuryRisk(unit.W1, projYDc);
            AddCatchingPlayerGameMetric(input, unit.W1.PlayerCode, projYDc, projTDc);
            projYDc = (int)(.25 * ((isHome) ? input.Prediction.HomeYDp : input.Prediction.AwayYDp));
            projTDc = W2TdsFrom((isHome) ? input.Prediction.HomeTDp : input.Prediction.AwayTDp);
            projYDc = AllowForInjuryRisk(unit.W2, projYDc);
            AddCatchingPlayerGameMetric(input, unit.W2.PlayerCode, projYDc, projTDc);
            if (unit.W3 != null)
            {
                projYDc = (int)(.1 * ((isHome) ? input.Prediction.HomeYDp : input.Prediction.AwayYDp));
                projTDc = 0;
                projYDc = AllowForInjuryRisk(unit.W3, projYDc);
                AddCatchingPlayerGameMetric(input, unit.W3.PlayerCode, projYDc, projTDc);
            }
            projYDc = (int)(.25 * ((isHome) ? input.Prediction.HomeYDp : input.Prediction.AwayYDp));
            projTDc = TETdsFrom((isHome) ? input.Prediction.HomeTDp : input.Prediction.AwayTDp);
            projYDc = AllowForInjuryRisk(unit.TE, projYDc);
            AddCatchingPlayerGameMetric(input, unit.TE.PlayerCode, projYDc, projTDc);
        }
        private void DoPassingUnit(
            PlayerGameProjectionMessage input,
            string teamCode,
            bool isHome)
        {
            PassUnit unit;
            RushUnit rushUnit;

            if (isHome)
            {
                unit     = input.Game.HomeNflTeam.PassUnit;
                rushUnit = input.Game.HomeNflTeam.RunUnit;
            }
            else
            {
                unit     = input.Game.AwayNflTeam.PassUnit;
                rushUnit = input.Game.AwayNflTeam.RunUnit;
            }

            if (unit == null)
            {
                unit = new PassUnit();
            }
            if (!unit.IsLoaded())
            {
                unit.Load(teamCode);
            }
            if (rushUnit == null)
            {
                rushUnit = new RushUnit();
            }
            if (!rushUnit.IsLoaded())
            {
                rushUnit.Load(teamCode);
            }

            // give it to the QB
            if (unit.Q1 != null)
            {
                var projYDp = isHome  ? input.Prediction.HomeYDp : input.Prediction.AwayYDp;
                var projTDp = isHome  ? input.Prediction.HomeTDp : input.Prediction.AwayTDp;
                AddPassinglayerGameMetric(
                    input,
                    unit.Q1.PlayerCode,
                    projYDp,
                    projTDp);
            }
            // Receivers  W1 35%, W2 25%, W3 10%, TE 20% (todo 3D 5%)
            int projYDc, projTDc;

            if (unit.W1 != null)
            {
                projYDc = ( int )(.35 * (isHome  ? input.Prediction.HomeYDp : input.Prediction.AwayYDp));
                projTDc = W1TdsFrom(
                    isHome  ? input.Prediction.HomeTDp : input.Prediction.AwayTDp);
                projYDc = AllowForInjuryRisk(
                    unit.W1,
                    projYDc);
                AddCatchingPlayerGameMetric(
                    input,
                    unit.W1.PlayerCode,
                    projYDc,
                    projTDc);
            }
            if (unit.W2 != null)
            {
                projYDc = ( int )(.25 * (isHome  ? input.Prediction.HomeYDp : input.Prediction.AwayYDp));
                projTDc = W2TdsFrom(isHome  ? input.Prediction.HomeTDp : input.Prediction.AwayTDp);
                projYDc = AllowForInjuryRisk(
                    unit.W2,
                    projYDc);
                AddCatchingPlayerGameMetric(
                    input,
                    unit.W2.PlayerCode,
                    projYDc,
                    projTDc);
            }
            if (unit.W3 != null)
            {
                projYDc = ( int )(.15 * (isHome  ? input.Prediction.HomeYDp : input.Prediction.AwayYDp));
                projTDc = W3TdsFrom(isHome ? input.Prediction.HomeTDp : input.Prediction.AwayTDp);

                projYDc = AllowForInjuryRisk(
                    unit.W3,
                    projYDc);
                AddCatchingPlayerGameMetric(
                    input,
                    unit.W3.PlayerCode,
                    projYDc,
                    projTDc);
            }
            if (unit.TE != null)
            {
                projYDc = ( int )(.20 * (isHome  ? input.Prediction.HomeYDp : input.Prediction.AwayYDp));
                projTDc = TETdsFrom(isHome  ? input.Prediction.HomeTDp : input.Prediction.AwayTDp);
                projYDc = AllowForInjuryRisk(unit.TE, projYDc);
                AddCatchingPlayerGameMetric(input, unit.TE.PlayerCode, projYDc, projTDc);
            }
        }
示例#3
0
 public List<string> LoadPassUnit()
 {
     #if DEBUG
      Utility.Announce( "NFLTeam.LoadPasshUnit" );
     #endif
      if (PassUnit == null) PassUnit = new PassUnit();
      return PassUnit.Load(TeamCode);
 }
        private void DoPassingUnit( PlayerGameProjectionMessage input, string teamCode, bool isHome )
        {
            var unit = new PassUnit();
             unit.Load( teamCode );

             // give it to the QB
             if ( unit.Q1 != null )
             {
            var projYDp = ( isHome ) ? input.Prediction.HomeYDp : input.Prediction.AwayYDp;
            var projTDp = ( isHome ) ? input.Prediction.HomeTDp : input.Prediction.AwayTDp;
            AddPassinglayerGameMetric( input, unit.Q1.PlayerCode, projYDp, projTDp );
             }
             // Receivers
             int projYDc, projTDc;
             if (unit.W1 != null)
             {
            projYDc = (int)(.4 * ((isHome) ? input.Prediction.HomeYDp : input.Prediction.AwayYDp));
            projTDc = W1TdsFrom((isHome) ? input.Prediction.HomeTDp : input.Prediction.AwayTDp);
            projYDc = AllowForInjuryRisk(unit.W1, projYDc);
            AddCatchingPlayerGameMetric(input, unit.W1.PlayerCode, projYDc, projTDc);
             }
             if (unit.W2 != null)
             {
            projYDc = (int)(.25 * ((isHome) ? input.Prediction.HomeYDp : input.Prediction.AwayYDp));
            projTDc = W2TdsFrom((isHome) ? input.Prediction.HomeTDp : input.Prediction.AwayTDp);
            projYDc = AllowForInjuryRisk(unit.W2, projYDc);
            AddCatchingPlayerGameMetric(input, unit.W2.PlayerCode, projYDc, projTDc);
             }
             if (unit.W3 != null)
             {
            projYDc = (int)(.1 * ((isHome) ? input.Prediction.HomeYDp : input.Prediction.AwayYDp));
            projTDc = 0;
            projYDc = AllowForInjuryRisk( unit.W3, projYDc );
            AddCatchingPlayerGameMetric(input, unit.W3.PlayerCode, projYDc, projTDc);
             }
             if (unit.TE != null)
             {
            projYDc = (int)(.25 * ((isHome) ? input.Prediction.HomeYDp : input.Prediction.AwayYDp));
            projTDc = TETdsFrom((isHome) ? input.Prediction.HomeTDp : input.Prediction.AwayTDp);
            projYDc = AllowForInjuryRisk(unit.TE, projYDc);
            AddCatchingPlayerGameMetric(input, unit.TE.PlayerCode, projYDc, projTDc);
             }
        }