public override bool Execute(Arguments arguments) { if (arguments.Count != 1 && arguments.Count != 5) { return(false); } var count = int.Parse(arguments["count"]); MediaLibrary.LoadSets(); MagicSet starterSet; MagicSet boosterSet1; MagicSet boosterSet2; MagicSet boosterSet3; if (arguments.Count == 1) { starterSet = MediaLibrary.RandomSet(); boosterSet1 = MediaLibrary.RandomSet(); boosterSet2 = MediaLibrary.RandomSet(); boosterSet3 = MediaLibrary.RandomSet(); } else { starterSet = MediaLibrary.GetSet(arguments["s"]); boosterSet1 = MediaLibrary.GetSet(arguments["b1"]); boosterSet2 = MediaLibrary.GetSet(arguments["b2"]); boosterSet3 = MediaLibrary.GetSet(arguments["b3"]); } Console.WriteLine("Starter: {0}\nBooster1: {1}\nBooster2: {2}\nBooster3: {3}\n", starterSet.Name, boosterSet1.Name, boosterSet2.Name, boosterSet3.Name); for (var i = 0; i < count; i++) { var starter = starterSet.GenerateTournamentPack(); var booster1 = boosterSet1.GenerateBoosterPack(); var booster2 = boosterSet2.GenerateBoosterPack(); var booster3 = boosterSet3.GenerateBoosterPack(); var library = new List <CardInfo>(); library.AddRange(starter); library.AddRange(booster1); library.AddRange(booster2); library.AddRange(booster3); var ratings = CardRatings.Merge(CardRatings.Merge(boosterSet2.Ratings, boosterSet3.Ratings), CardRatings.Merge(starterSet.Ratings, boosterSet1.Ratings)); var deck = DeckBuilder.BuildDeck(library, ratings); deck.LimitedCode = MagicSet.GetLimitedCode(starterSet.Name, new[] { boosterSet1.Name, boosterSet2.Name, boosterSet3.Name }); File.WriteAllBytes(Guid.NewGuid() + ".dec", DeckFile.Write(deck)); } return(true); }
private CardRatings LoadCardRatings() { CardRatings merged = null; foreach (var setName in _p.BoosterPacks) { var ratings = MediaLibrary.GetSet(setName).Ratings; if (merged == null) { merged = ratings; } else { merged = CardRatings.Merge(merged, ratings); } } if (_p.TournamentPack == null) { return(merged); } return(CardRatings.Merge(merged, MediaLibrary.GetSet(_p.TournamentPack).Ratings)); }