public void TestRushingUnitIsAce() { var sut = new RushUnit(); sut.Load("SF"); Assert.IsNotNull(sut.AceBack); Utility.Announce(string.Format("Ace Back is {0}", sut.AceBack.PlayerName)); }
public void TestRushingUnitIsRBBC() { var sut = new RushUnit(); sut.Load("PS"); Assert.IsNull(sut.AceBack); Utility.Announce(string.Format("Back 1 is {0}", sut.R1.PlayerName)); Utility.Announce(string.Format("Back 2 is {0}", sut.R2.PlayerName)); }
private static void DoRushingUnit( PlayerGameProjectionMessage input, string teamCode, bool isHome ) { var ru = new RushUnit(); ru.Load( teamCode ); if (ru.IsAceBack) { // R1 var percentageOfAction = 0.7M; if (ru.R2 == null) percentageOfAction = 0.9M; var projYDr = (int)(percentageOfAction * ((isHome) ? input.Prediction.HomeYDr : input.Prediction.AwayYDr)); // Injury penalty projYDr = AllowForInjuryRisk(ru.AceBack, projYDr); var projTDrAce = R1TdsFrom((isHome) ? input.Prediction.HomeTDr : input.Prediction.AwayTDr); var isVulture = AllowForVulturing(ru.AceBack.PlayerCode, ref projTDrAce, ru); AddPlayerGameMetric(input, ru.AceBack.PlayerCode, projYDr, projTDrAce); // R2 optional if (ru.R2 != null) { projYDr = (int)(.2 * ((isHome) ? input.Prediction.HomeYDr : input.Prediction.AwayYDr)); projYDr = AllowForInjuryRisk(ru.AceBack, projYDr); var projTDr = R2TdsFrom((isHome) ? input.Prediction.HomeTDr : input.Prediction.AwayTDr); if (isVulture) projTDr = AllowForR2BeingTheVulture(projTDr, ru.R2.PlayerCode, ru); AddPlayerGameMetric(input, ru.R2.PlayerCode, projYDr, projTDr); } } else { // Comittee const decimal percentageOfAction = 0.5M; foreach (var runner in ru.Starters) { var projYDr = (int)(percentageOfAction * ((isHome) ? input.Prediction.HomeYDr : input.Prediction.AwayYDr)); projYDr = AllowForInjuryRisk(runner, projYDr); var projTDr = 0M; var tds = 0; if ( isHome ) { tds = R1TdsFrom( input.Prediction.HomeTDr ); projTDr = decimal.Divide( ( decimal ) tds, 2M ); } else { tds = R1TdsFrom( input.Prediction.AwayTDr ); projTDr = decimal.Divide( ( decimal ) tds, 2M ); } AddPlayerGameMetric( input, runner.PlayerCode, projYDr, projTDr); } } }