Ejemplo n.º 1
0
        public Int32 PredictTDr(NFLPlayer plyr, string season, int week)
        {
            //  Predict the number of FGs this player will kick
            int tDr = 0;

            //  starters only
            if (plyr.IsStarter() && (plyr.PlayerCat == RosterLib.Constants.K_RUNNINGBACK_CAT) && plyr.IsRusher())
            {
                if (plyr.CurrTeam.Ratings.Equals("CCCCCC"))
                {
                    plyr.CurrTeam.SetRecord(season);
                }

                //  who are the opponents
                NflTeam opponent = plyr.CurrTeam.OpponentFor(season, week);
                if (opponent != null)
                {
                    if (opponent.Ratings.Equals("CCCCCC"))
                    {
                        opponent.SetRecord(season);                                // Incase not initialised
                    }
                    //  not on a bye
                    tDr = 1;
                    int diff = ConvertRating(plyr.CurrTeam.RoRating()) - ConvertRating(opponent.RdRating());
                    if (diff > 1)
                    {
                        tDr += 1;
                    }
                    if (diff > 3)
                    {
                        tDr += 1;
                    }
                    if (diff < -1)
                    {
                        tDr -= 1;
                    }
                }

                //  What is the Game
                NFLGame game = plyr.CurrTeam.GameFor(season, week);
                if (game != null)
                {
                    if (game.IsHome(plyr.CurrTeam.TeamCode))
                    {
                        tDr += 1;
                    }
                    if (game.IsBadWeather())
                    {
                        tDr -= 1;
                    }
                }
            }
            return(tDr);
        }