Пример #1
0
        private void SaveFightPlan()
        {
            if (string.IsNullOrWhiteSpace(FightPlanName))
            {
                MessageBox.Show("Please Enter a Name");
                return;
            }
            var fightPlan = Shared.Entities.FightPlans.FirstOrDefault(s => s.PlanName == FightPlanName.Trim());

            if (fightPlan != null)
            {
                Telerik.Windows.Controls.RadWindow.Confirm("Are you sure you want to overwrite?", (s, ea) =>
                {
                    fightPlan.PlanData = FightPlanText;
                    Shared.Entities.SaveChanges();
                });
            }
            else
            {
                FightPlan fp = Shared.Entities.FightPlans.Create();
                fp.PlanName = FightPlanName;
                fp.PlanData = FightPlanText;

                Shared.Entities.FightPlans.Add(fp);
                Shared.Entities.SaveChanges();
                Helpers.Shared.Entities.FightPlans.Load();
                RaisePropertyChanged(FightPlansPropertyName);
                this.SelectedFightPlan = fp;
            }
        }
Пример #2
0
        public void FightAllTest()
        {
            List <int> fpList = new List <int>()
            {
                8, 9, 14, 15, 16
            };
            var listOne = new List <PivotFighter>();

            var listTwo = new List <PivotFighter>();

            int fighter1Id = 5;
            int fighter2Id = 5;

            FightOptions options = new FightOptions()
            {
                JudgeLuck  = 0.05,
                LuckAmount = 0.05
            };

            Data.Fighter f1      = DataHelpers.Entities.Fighters.First(f => f.FighterId == fighter1Id);
            FighterStats f1Stats = new FighterStats(f1);

            Data.Fighter f2        = DataHelpers.Entities.Fighters.First(f => f.FighterId == fighter2Id);
            FighterStats f2Stats   = new FighterStats(f2);
            Fighter      f1Fighter = new Fighter()
            {
                Stats = f1Stats
            };
            Fighter f2Fighter = new Fighter()
            {
                Stats = f2Stats
            };

            foreach (int i in fpList)
            {
                Data.FightPlan  dfp = DataHelpers.Entities.FightPlans.First(fp => fp.PlanId == i);
                Model.FightPlan mFp = new FightPlan()
                {
                    FightPlanText = dfp.PlanData
                };
                string name = String.Format("{0}, {1}", f1.Name, dfp.PlanName);
                listOne.Add(new PivotFighter(f1Stats, mFp, name, TrainingStat.None));


                name = String.Format("{0}, {1}", f2.Name, dfp.PlanName);
                listTwo.Add(new PivotFighter(f2Stats, mFp, name, TrainingStat.None));
            }

            PivotFightSimulator simmer = new PivotFightSimulator(listOne, listTwo, 100, options);

            Stopwatch sw = new Stopwatch();

            sw.Start();
            simmer.FightAll();

            Debug.Print("Done in " + sw.ElapsedMilliseconds);

            simmer.PrintAll();
        }
Пример #3
0
        public void FightRoundTest()
        {
            for (int i = 1; i <= 50; i++)
            {
                Fighter f = new Fighter()
                {
                    Stats = FighterRoundStatsTests.GetFighterStats()
                };
                f.Stats.Weight = 135;
                FighterFight fFight = new FighterFight(f, new FightPlan()
                {
                    Default = new FighterRoundPlan(4, 8, 8)
                });

                Fighter f2 = new Fighter()
                {
                    Stats = FighterRoundStatsTests.GetFighterStats()
                };
                FighterFight fFight2 = new FighterFight(f2, new FightPlan()
                {
                    Default = new FighterRoundPlan(4, 8, 8)
                });


                FightPlan defPlan = new FightPlan()
                {
                    Default = new FighterRoundPlan(5, 9, 6)
                };
                FightOptions options = new FightOptions()
                {
                    WeightClass = WeightClass.Light
                };
                FightTracker tracker = new FightTracker(f, f2, defPlan, defPlan, options);
                tracker.PlayFight();
            }
        }
Пример #4
0
 public void TestAgainstWeblSim(Fighter fighter1, Fighter fighter2, FightPlan fightPlan1, FightPlan fightPlan2)
 {
 }