public FightOutcome(int timeOfStoppage, MethodOfResult method, Main.Fighter winner, int[,] scorecards, Fighter[] fighters) { this.TimeOfStoppage = timeOfStoppage; //use double.PositiveInfinity for no KO this.Method = method; this.Scorecards = scorecards; this.Fighters = fighters; this.Winner = winner; }
private FightOutcome DetermineFightResult() { Fighter winner = null; FightOutcome outcome; MethodOfResult method = MethodOfResult.UD; if (TimeOfStoppage != -1) { winner = F1.Health <= 0 ? Boxer2() : Boxer1(); outcome = new FightOutcome(TimeOfStoppage, MethodOfResult.KO, winner, Scorecards, Fight); } else { int[] cardsWon = { 0, 0 }; for (int card = 0; card < Scorecards.GetLength(0); ++card) { if (Scorecards[card, 0] > Scorecards[card, 1]) { ++cardsWon[0]; } else if (Scorecards[card, 0] < Scorecards[card, 1]) { ++cardsWon[1]; } } if (cardsWon[0] > cardsWon[1]) { winner = Boxer1(); } else if (cardsWon[0] < cardsWon[1]) { winner = Boxer2(); } if (Math.Abs(cardsWon[0] - cardsWon[1]) < 3) { method = MethodOfResult.MD; } outcome = new FightOutcome(-1, method, winner, Scorecards, Fight); } return(outcome); }
public FightOutcome(int timeOfStoppage, MethodOfResult method, Main.Fighter winner, int[,] scorecards, Fight fight) : this(timeOfStoppage, method, winner, scorecards, fight.Fighers) { }