Ejemplo n.º 1
0
        /// <summary />
        public static int TotalBonuses(this NFLPlayer player)
        {
            int bonuses = 0;

            foreach (Game game in player.GameLog)
            {
                Passing p = game.Passing;
                if (p != null)
                {
                    bonuses += CountBonuses(p.YDS, 300, 100);
                }

                Rushing r = game.Rushing;
                if (r != null)
                {
                    bonuses += CountBonuses(r.YDS, 100, 50);
                }

                Receiving c = game.Receiving;
                if (c != null)
                {
                    bonuses += CountBonuses(c.YDS, 100, 50);
                }

                Kicking k = game.Kicking;
                if (k != null)
                {
                    // unable to determine bonuses for kicking yet
                }

                Defense dst = game.Defense;
                if (dst != null)
                {
                    // unable to determine bonuses for defense yet
                }
            }

            return(bonuses);
        }
Ejemplo n.º 2
0
        /// <summary />
        public static int GetFanastyPoints(this Game game)
        {
            int points = 0;

            Passing p = game.Passing;

            if (p != null)
            {
                points += p.YDS;
                points += 50 * CountBonuses(p.YDS, 300, 100);
                points -= p.INT * 50;

                // estimate 10 yards per passing TD on average
                points += p.TD * 10;
            }

            Rushing r = game.Rushing;

            if (r != null)
            {
                points += r.YDS;
                points += 50 * CountBonuses(r.YDS, 100, 50);

                // estimate 3 yards per rushing TD on average
                points += r.TD * 3;
            }

            Receiving c = game.Receiving;

            if (c != null)
            {
                points += c.YDS;
                points += 50 * CountBonuses(c.YDS, 100, 50);

                // estimate 10 yards per receiving TD on average
                points += c.TD * 10;
            }

            Fumbles f = game.Fumbles;

            if (f != null)
            {
                points -= f.FUM * 25;
            }

            Kicking k = game.Kicking;

            if (k != null)
            {
                // calculate the points for all field goals awarding
                // points per yard of a field goal and subtracting the
                // points of a missed fieldgoal.

                // In 2016, the average kick was from 37.7 yards away; the average
                // successful kick was from 36.2 yards out - while the average miss was from 46.2 yards away.

                points += k.FGM * 38;
                points -= (k.FGA - k.FGM) * 46;

                // calculate 20 points for each extra point made and
                // subtract 20 points for each point missed
                points += k.XPM * 33;
                points -= (k.XPA - k.XPM) * 33;
            }

            Defense defense = game.Defense;

            if (defense != null)
            {
                //calculate points for interceptions
                points += defense.INT * 50;
                points += defense.YDS_INT;
                if (defense.TD_INT > 0)
                {
                    // if we have a touchdown, one point per yard avaraged
                    points += (defense.YDS_INT / defense.TD_INT) * defense.TD_INT;
                }

                // calculate points for fumble recoveries
                points += defense.FUM * 25;
                if (defense.TD_FUM > 0)
                {
                    // if we have a touchdown, one point per yard averaged
                    points += (defense.YDS_FUM / defense.TD_FUM) * defense.TD_FUM;
                }

                // calculate points for sacks
                points += defense.SACK * 10;
            }

            return(points);
        }