/// <summary> /// /// </summary> /// <returns>int</returns> public override int Execute() { string ballcarrierRun = principalBallcarrier.PlayerSkills.Run; int roll = Dice.Roll("d12"); //check for natural 12 if (roll != 12) { //apply any bonuses and/or penalties roll += defense.TeamDefense.RunPenalty; roll += offense.TeamOffense.OffensiveLineBonus; if (roll < 0) { roll = 1; } else if (roll >= 12) { roll = 11; } } CarryPlayResult res = this.defense.TeamDefense.RunDefense(roll); bool isTd = false; bool isFumble = false; switch (res) { case CarryPlayResult.Loss: string rollString = String.Format("d{0}", defense.TeamDefense.MaxRunLoss); playLength = -(Dice.Roll(rollString)); //check for fumble isFumble = CheckFumble(principalBallcarrier); break; case CarryPlayResult.NoGain: playLength = 0; isFumble = CheckFumble(principalBallcarrier); break; case CarryPlayResult.NormalGain: playLength = Dice.Roll(ballcarrierRun); break; case CarryPlayResult.Bonus: playLength = Dice.Roll(ballcarrierRun) + this.defense.TeamDefense.BonusRunPenalty; break; case CarryPlayResult.AutoTD: playLength = cc.GetAutoTDDistance(); isTd = true; break; } playLength = cc.MoveBallRun(this, isFumble); //playLength = cc.MoveBall(PlayType.Run, null, principalBallcarrier, playLength, false, isFumble); runStats.AddRun(playLength, isTd, isFumble); ((CarryStatSheet)this.principalBallcarrier.Stats[StatTypes.Run]).AddRun(playLength, isTd, isFumble); return(playLength); }
/// <summary> /// /// </summary> /// <returns></returns> public override int Execute() { int pass = Dice.Roll("d100"); bool isTd = false; int qbRating = thrower.PlayerSkills.Pass + this.defense.TeamDefense.PassRushRating; //check for auto td or interception if (pass == 1) { //auto td playLength = cc.GetAutoTDDistance(); if (playLength == 0) { Console.WriteLine(); } playLength = cc.MoveBallPass(this, false, false, false); if (playLength == 0) { Console.WriteLine(); } isTd = true; gamePassStats.CompletePass(thrower, principalBallcarrier, playLength, true); gameReceiverStats.AddRun(playLength, isTd, false); ((PassPlayStatSheet)this.thrower.Stats[StatTypes.Pass]).CompletePass(thrower, principalBallcarrier, playLength, true); ((CarryStatSheet)this.principalBallcarrier.Stats[StatTypes.Receive]).AddRun(playLength, isTd, false); } else if (pass == 100) { //auto interception //go to interception module OnInterceptionOccurred(cc, thrower); } else if (pass <= qbRating)//thrower pass rating here { playLength = Dice.Roll(principalBallcarrier.PlayerSkills.Receive); if (playLength == 0) { Console.WriteLine(); } playLength = cc.MoveBallPass(this, false, false, false); if (playLength == 0) { Console.WriteLine(); } gamePassStats.CompletePass(thrower, principalBallcarrier, playLength, false); gameReceiverStats.AddRun(playLength, false, false); ((PassPlayStatSheet)this.thrower.Stats[StatTypes.Pass]).CompletePass(thrower, principalBallcarrier, playLength, false); ((CarryStatSheet)this.principalBallcarrier.Stats[StatTypes.Receive]).AddRun(playLength, false, false); } else { //incomplete pass PassPlayResult res = this.defense.TeamDefense.PassDefense(Dice.Roll("d12")); gamePassStats.IncompletePass(thrower, res); ((PassPlayStatSheet)this.thrower.Stats[StatTypes.Pass]).IncompletePass(thrower, res); switch (res) { case PassPlayResult.Sack: string rollString = String.Format("d{0}", defense.TeamDefense.MaxSackLoss); bool isFumble = CheckFumble(thrower); playLength = -(Dice.Roll(rollString)); playLength = cc.MoveBallRun(this, isFumble); gameRunStats.AddRun(playLength, false, isFumble); ((CarryStatSheet)this.thrower.Stats[StatTypes.Run]).AddRun(playLength, false, isFumble); break; case PassPlayResult.Incomplete: playLength = 0; cc.MoveBallPass(this, false, false, false); break; case PassPlayResult.Interception: OnInterceptionOccurred(cc, thrower); break; } } return(playLength); }
/// <summary> /// /// </summary> /// <returns>int</returns> public override int Execute() { string ballcarrierRun = this.principalBallcarrier.PlayerSkills.KickReturn; int roll = Dice.Roll("d12"); //team run bonus here //check for natural 12 if (roll != 12) { //apply any bonuses and/or penalties roll += defense.TeamDefense.RunPenalty; roll += offense.TeamOffense.OffensiveLineBonus; if (roll < 0) { roll = 1; } else if (roll >= 12) { roll = 11; } } CarryPlayResult res = this.defense.TeamDefense.KickoffReturnDefense(roll); bool isTd = false; bool isFumble = false; switch (res) { case CarryPlayResult.Loss: string rollString = String.Format("d{0}", defense.TeamDefense.MaxRunLoss); playLength = -(Dice.Roll(rollString)); //check for fumble isFumble = CheckFumble(this.principalBallcarrier); break; case CarryPlayResult.NoGain: playLength = 0; isFumble = CheckFumble(this.principalBallcarrier); break; case CarryPlayResult.NormalGain: playLength = Dice.Roll(ballcarrierRun); break; case CarryPlayResult.Bonus: playLength = Dice.Roll(ballcarrierRun) + this.defense.TeamDefense.BonusRunPenalty; break; case CarryPlayResult.AutoTD: playLength = cc.GetAutoTDDistance(); isTd = true; break; } playLength = cc.MoveBallKickoffReturn(this, isFumble); returnStats.AddRun(playLength, isTd, isFumble); ((CarryStatSheet)this.principalBallcarrier.Stats[StatTypes.Return]).AddRun(playLength, isTd, isFumble); playReport = String.Format("{0} takes the ball to the {1} for a return of {2} yards!", principalBallcarrier.Name, this.cc.CurrentYardLine, playLength); return(playLength); }