Пример #1
0
 protected AbstractAction(
     IQuestTracker questTracker = null,
     IRumourMill rumourMill     = null)
 {
     this.QuestTracker = questTracker ?? GlobalConstants.GameManager?.QuestTracker;
     this.RumourMill   = rumourMill ?? GlobalConstants.GameManager?.RumourMill;
 }
Пример #2
0
        public void SetUp()
        {
            ActionLog actionLog = new ActionLog();

            GlobalConstants.ActionLog = actionLog;
            this.scriptingEngine      = new ScriptingEngine();

            this.ItemHandler = new LiveItemHandler(new RNG());
            IGameManager gameManager = Mock.Of <IGameManager>(
                manager => manager.ItemHandler == this.ItemHandler);

            GlobalConstants.GameManager = gameManager;

            this.target = new QuestTracker(this.ItemHandler);
        }
Пример #3
0
        public void SetUp()
        {
            ActionLog actionLog = new ActionLog();

            GlobalConstants.ActionLog = actionLog;
            this.scriptingEngine      = new ScriptingEngine();

            IItemInstance item = Mock.Of <IItemInstance>();

            this.overworld = Mock.Of <IWorldInstance>(
                w => w.Name == "overworld" &&
                w.GetWorlds(It.IsAny <IWorldInstance>()) == new List <IWorldInstance>
            {
                Mock.Of <IWorldInstance>(
                    instance => instance.Guid == Guid.NewGuid())
            } &&
                w.GetRandomSentientWorldWide() == Mock.Of <IEntity>(
                    entity => entity.Guid == Guid.NewGuid() &&
                    entity.MyWorld == this.world &&
                    entity.Contents == new List <IItemInstance> {
                item
            }));

            this.world = Mock.Of <IWorldInstance>(
                w => w.GetOverworld() == this.overworld &&
                w.Name == "TEST" &&
                w.Guid == Guid.NewGuid());

            this.left = Mock.Of <IEntity>(
                entity => entity.Guid == Guid.NewGuid() &&
                entity.PlayerControlled == true &&
                entity.MyWorld == this.world &&
                entity.HasDataKey(It.IsAny <string>()) == false);

            this.right = Mock.Of <IEntity>(
                entity => entity.Guid == Guid.NewGuid() &&
                entity.MyWorld == this.world &&
                entity.Contents == new List <IItemInstance> {
                item
            });

            IRelationship friendship = Mock.Of <IRelationship>(
                relationship => relationship.GetRelationshipValue(It.IsAny <Guid>(), It.IsAny <Guid>()) == 0);

            IEntityRelationshipHandler relationshipHandler = Mock.Of <IEntityRelationshipHandler>(
                handler => handler.Get(It.IsAny <IJoyObject[]>(), It.IsAny <string[]>(), It.IsAny <bool>())
                == new[] { friendship });
            ILiveItemHandler itemHandler = Mock.Of <ILiveItemHandler>(
                handler => handler.GetQuestRewards(It.IsAny <Guid>()) == new List <IItemInstance> {
                item
            });
            IItemFactory itemFactory = Mock.Of <IItemFactory>(
                factory => factory.CreateRandomItemOfType(
                    It.IsAny <string[]>(),
                    It.IsAny <bool>()) == item &&
                factory.CreateSpecificType(
                    It.IsAny <string>(),
                    It.IsAny <string[]>(),
                    It.IsAny <bool>()) == item &&
                factory.CreateRandomWeightedItem(
                    It.IsAny <bool>(),
                    It.IsAny <bool>()) == item);

            this.gameManager = Mock.Of <IGameManager>(
                manager => manager.ItemFactory == itemFactory &&
                manager.Player == this.left &&
                manager.ItemHandler == itemHandler &&
                manager.GUIDManager == new GUIDManager());

            GlobalConstants.GameManager = this.gameManager;

            this.target = new QuestProvider(
                relationshipHandler,
                itemHandler,
                itemFactory,
                new RNG());
            this.questTracker = new QuestTracker();
        }