public Round(Data.Round dataRound) { this.RoundNumber = dataRound.RoundNumber; this.Fighter1Score = dataRound.Fighter1Score; this.Fighter2Score = dataRound.Fighter2Score; this.ResultType = (FightResultType)dataRound.ResultType; if (this.ResultType != FightResultType.Decision) { this.Fighter1Win = (bool)dataRound.Fight.Fighter1Win; } this.Fighter1Round = new Model.FighterRound(dataRound.First, this); this.Fighter2Round = new Model.FighterRound(dataRound.Second, this); this.JudgeRounds = dataRound.JudgeRounds.Select(j => new Model.JudgeRound(j)).ToList(); }
public Round(string externalBetId, Guid gameId, Guid playerId, Brand brand) : this() { Data = new Data.Round { Id = Guid.NewGuid(), Status = RoundStatus.New, ExternalRoundId = externalBetId, PlayerId = playerId, GameId = gameId, BrandId = brand.Id, BrandCode = brand.Code, Brand = brand, CreatedOn = DateTimeOffset.UtcNow.ToBrandOffset(brand.TimezoneId), GameActions = new List <GameAction>() }; }
public static RoundDamage CalculateDamageForDataRound(Data.Round round, FighterStats fStats, FighterStats oStats, List <CutBase> cuts, bool isFirst) { Data.FighterRound round1 = (isFirst) ? round.First : round.Second; Data.FighterRound round2 = (isFirst) ? round.Second : round.First; FighterStats adjusted1 = FighterStats.FatigueStats(fStats, round1.Endurance_Start); FighterStats adjusted2 = FighterStats.FatigueStats(oStats, round2.Endurance_Start); FighterRoundPlan fp1 = new FighterRoundPlan(round1.Tactic); FighterRoundPlan fp2 = new FighterRoundPlan(round2.Tactic); if (cuts != null) { adjusted1.AdjustCutStats(cuts); } RoundDamage ret = RoundDamage.CalculateRoundDamage(adjusted1, fp1, adjusted2, fp2, fp1.TargetArea); return(ret); }
public static bool RoundMatchesExpectations(Data.Round round, FighterStats f1Stats, FighterStats f2Stats, bool skipCuts, double threshold = 0) { List <CutBase> cuts1 = skipCuts ? new List <CutBase>() : round.First.GetCutsForDataRound(); List <CutBase> cuts2 = skipCuts ? new List <CutBase>() : round.Second.GetCutsForDataRound(); RoundDamage rd = CalculateDamageForDataRound(round, f1Stats, f2Stats, cuts1, true); if (!IsDamageEqual(round.First, rd, threshold)) { return(false); } RoundDamage rd2 = CalculateDamageForDataRound(round, f2Stats, f1Stats, cuts2, false); if (!IsDamageEqual(round.Second, rd2, threshold)) { return(false); } return(true); }
public Data.Round CreateToDatabase(int fightId) { WeebulEntities entities = DataHelpers.Entities; Data.Round r = entities.Rounds.Create(); r.FightId = fightId; r.Fighter1Score = this.Fighter1Score; r.Fighter2Score = this.Fighter2Score; r.ResultType = (int)this.ResultType; r.RoundNumber = this.RoundNumber; r = entities.Rounds.Add(r); entities.SaveChanges(); this.Fighter1Round.CreateInDatabase(r.RoundId, true); this.Fighter2Round.CreateInDatabase(r.RoundId, false); if (JudgeRounds != null && JudgeRounds.Count > 0) { foreach (JudgeRound jr in this.JudgeRounds) { jr.CreateInDatabase(r.RoundId); } } return(r); }
public Round(Data.Round data) : this() { Data = data; }