Example #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fgAttempt">FieldGoal</param>
 public FieldGoalAttempedEventArgs(FieldGoal fgAttempt)
 {
     this.kicker    = fgAttempt.PrincipalBallcarrier;
     this.fgResult  = fgAttempt.FieldGoalResult;
     this.distance  = fgAttempt.PlayLength;
     this.report    = fgAttempt.PlayReport;
     this.isXp      = fgAttempt.IsExtraPoint;
     this.isBlocked = fgAttempt.IsBlocked;
 }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        private void ExecuteExtraPointAttempt()
        {
            Player            kicker          = this.teamInPossession.TeamOffense.GetPlayerAtPosition("K");
            int               indexOfKicker   = this.teamInPossession.GetIndexOfPlayer(kicker);
            KickPlayStatSheet kickerGameStats = (KickPlayStatSheet)game.GameStats[this.teamInPossession, indexOfKicker][StatTypes.Kicking];
            FieldGoal         fieldGoal       = new FieldGoal(kicker, 20, true, kickerGameStats);

            fieldGoal.Execute();
            FieldGoalResult fgResult = fieldGoal.FieldGoalResult;

            if (fgResult == FieldGoalResult.Good)
            {
                this.field.Scoreboard.AddScore(fieldGoal);
            }
            OnFieldGoalAttempted(fieldGoal);
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns>int</returns>
        public override int Execute()
        {
            StringBuilder report = new StringBuilder();
            int           ret    = -1;
            int           roll   = Dice.Roll("d100");

            int kick = principalBallcarrier.PlayerSkills.Kick - CalculateDistancePenalty();

            if (roll <= kick)
            {
                fieldGoalResult = FieldGoalResult.Good;

                ret = distance;
            }
            else
            {
                fieldGoalResult = FieldGoalResult.NotGood;
            }

            gameStats.AddKickAttempt(distance, fieldGoalResult, isExtraPoint);
            ((KickPlayStatSheet)principalBallcarrier.Stats[StatTypes.Kicking]).AddKickAttempt(distance, fieldGoalResult, isExtraPoint);

            if (isExtraPoint)
            {
                report.Append(String.Format("Extra Point attempt by {0} ", principalBallcarrier.Name));
            }
            else
            {
                report.Append(String.Format("Field goal attempt by {0} ", principalBallcarrier.Name));
            }
            if (fieldGoalResult == FieldGoalResult.Good)
            {
                report.Append("is good!");
            }
            else
            {
                report.Append("is no good!");
            }

            playReport = report.ToString();
            playLength = distance;
            return(distance);
        }
Example #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="distance">int</param>
 /// <param name="fgResult">FieldGoalResult</param>
 /// <param name="xp">bool</param>
 public void AddKickAttempt(int distance, FieldGoalResult fgResult, bool xp)
 {
     if (xp)
     {
         xpAttempted++;
         if (fgResult == FieldGoalResult.Good)
         {
             xpMade++;
         }
         xpPercentage = CalculatePercentage(xpAttempted, xpMade);
     }
     else
     {
         CheckLongPlay(distance);
         fgAttempted++;
         if (fgResult == FieldGoalResult.Good)
         {
             fgMade++;
         }
         fgPercentage = CalculatePercentage(fgAttempted, fgMade);
     }
 }