public IQuestArea Load(IGame game, ScenarioCode scenarioCode)
        {
            var quests = GetCards <IQuestCard>(questCards).Where(x => x.ScenarioCode == scenarioCode).ToList();

            var questDeck      = new Deck <IQuestCard>(quests);
            var encounterDecks = new List <IDeck <IEncounterCard> >();

            IEnumerable <EncounterSet> encounterSets = Enumerable.Empty <EncounterSet>();

            foreach (var quest in quests)
            {
                if (!quest.EncounterSets.SequenceEqual(encounterSets))
                {
                    var encounters    = GetCards(encounterCards.Where(x => quest.EncounterSets.Contains(x.EncounterSet)));
                    var encounterDeck = new Deck <IEncounterCard>(encounters);
                    encounterDeck.Shuffle();

                    encounterDecks.Add(encounterDeck);
                }

                encounterSets = quest.EncounterSets;
            }

            return(new QuestArea(game, questDeck, encounterDecks));
        }
        public IQuestArea Load(IGame game, ScenarioCode scenarioCode)
        {
            var quests = GetCards<IQuestCard>(questCards).Where(x => x.ScenarioCode == scenarioCode).ToList();

            var questDeck = new Deck<IQuestCard>(quests);
            var encounterDecks = new List<IDeck<IEncounterCard>>();

            IEnumerable<EncounterSet> encounterSets = Enumerable.Empty<EncounterSet>();

            foreach (var quest in quests)
            {
                if (!quest.EncounterSets.SequenceEqual(encounterSets))
                {
                    var encounters = GetCards(encounterCards.Where(x => quest.EncounterSets.Contains(x.EncounterSet)));
                    var encounterDeck = new Deck<IEncounterCard>(encounters);
                    encounterDeck.Shuffle();

                    encounterDecks.Add(encounterDeck);
                }

                encounterSets = quest.EncounterSets;
            }

            return new QuestArea(game, questDeck, encounterDecks);
        }
        protected QuestCardBase(string title, CardSet cardSet, uint cardNumber, ScenarioCode scenarioCode, IEnumerable<EncounterSet> encounterSets, byte sequence, byte questPoints, byte victoryPoints)
            : base(CardType.Quest, title, cardSet, cardNumber)
        {
            if (encounterSets == null)
                throw new ArgumentNullException("encounterSets");

            this.ScenarioCode = scenarioCode;
            this.EncounterSets = encounterSets;
            this.Sequence = sequence;
            this.QuestPoints = questPoints;
            this.VictoryPoints = victoryPoints;
        }
        protected QuestCardBase(string title, CardSet cardSet, uint cardNumber, ScenarioCode scenarioCode, IEnumerable <EncounterSet> encounterSets, byte sequence, byte questPoints, byte victoryPoints)
            : base(CardType.Quest, title, cardSet, cardNumber)
        {
            if (encounterSets == null)
            {
                throw new ArgumentNullException("encounterSets");
            }

            this.ScenarioCode  = scenarioCode;
            this.EncounterSets = encounterSets;
            this.Sequence      = sequence;
            this.QuestPoints   = questPoints;
            this.VictoryPoints = victoryPoints;
        }
Beispiel #5
0
        public void Setup(IEnumerable <IPlayer> players, ScenarioCode scenarioCode)
        {
            if (players == null)
            {
                throw new ArgumentNullException("players");
            }
            if (players.Count() == 0)
            {
                throw new ArgumentException("list of players cannot be empty");
            }
            if (players.Any(x => x == null))
            {
                throw new ArgumentNullException("list of players cannot contain nulls");
            }

            this.players.Clear();

            foreach (var player in players)
            {
                this.players.Add(player);
            }

            var questLoader = new QuestLoader();

            this.QuestArea = questLoader.Load(this, scenarioCode);

            var gameSetup = new GameSetup(this);

            gameSetup.Run();

            CurrentRound = 0;
            CurrentPhase = null;

            foreach (var callback in gameSetupCallbacks)
            {
                callback();
            }

            Run();
        }
 protected ScenarioBase(string title, ScenarioCode scenarioCode, CardSet cardSet)
 {
     this.Title = title;
     this.ScenarioCode = scenarioCode;
 }
 protected ScenarioBase(string title, ScenarioCode scenarioCode, CardSet cardSet)
 {
     this.Title        = title;
     this.ScenarioCode = scenarioCode;
 }