Пример #1
0
 /// <summary>
 ///
 /// </summary>
 protected override void Init()
 {
     yardlines = new YardLine[99];
     for (int i = 0; i < 99; ++i)
     {
         yardlines[i] = new YardLine(i);
         Debug.WriteLine(String.Format("{0} - {1}", i, yardlines[i]));
     }
 }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns>int</returns>
        public override int Execute()
        {
            int  roll     = Dice.Roll("d2");
            bool ballLost = false;

            if (roll == 1)//team loses ball!
            {
                ballLost = true;
            }
            YardLine      yl     = cc.CurrentYardLine;
            StringBuilder report = new StringBuilder(String.Format("FUMBLE!!!! {0} loses the ball at the {1} yardline after ", this.originalBallcarrier.Name, yl));

            if (playLength > 0)
            {
                report.Append(String.Format("a gain of {0} yards!", playLength));
            }
            else if (playLength < 0)
            {
                report.Append(String.Format("a loss of {0} yards!", playLength));
            }
            else
            {
                report.Append("being stopped at the line of scrimmage!");
            }

            if (ballLost)
            {
                report.Append(String.Format("The ball is recovered by the {0}! Turnover!", this.defense));
                cc.ChangePossession();
                cc.ToggleDirection();
                cc.MoveBallDefensiveReturn(this);
                cc.SetFirstDown();
            }
            else
            {
                report.Append(String.Format("The ball is recovered by {0}! The {1} manage to hold on to the ball!", this.defense, this.defense.Mascot));
            }
            this.playReport = report.ToString();
            return(playLength);
        }