Beispiel #1
0
 protected void GetBits()
 {
     if (this.RelationshipHandler is null)
     {
         this.RelationshipHandler = GlobalConstants.GameManager?.RelationshipHandler;
     }
 }
 public ModifyRelationshipPointsAction()
 {
     if (GlobalConstants.GameManager is null == false)
     {
         this.RelationshipHandler = GlobalConstants.GameManager.RelationshipHandler;
     }
 }
Beispiel #3
0
 public Family(
     int decayRef,
     int decayCounterRef,
     bool doesDecayRef,
     int priorityRef,
     int happinessThresholdRef,
     int valueRef,
     int maxValueRef,
     ISpriteState fulfillingSprite,
     IEntityRelationshipHandler relationshipHandler = null,
     int averageForDayRef  = 0,
     int averageForWeekRef = 0)
     : base(
         decayRef,
         decayCounterRef,
         doesDecayRef,
         priorityRef,
         happinessThresholdRef,
         valueRef,
         maxValueRef,
         new[] { "modifyrelationshippointsaction" },
         fulfillingSprite,
         averageForDayRef,
         averageForWeekRef)
 {
     this.RelationshipHandler = relationshipHandler ?? GlobalConstants.GameManager?.RelationshipHandler;
     this.FulfillingSprite    = fulfillingSprite;
 }
Beispiel #4
0
 public Purpose(
     int decayRef,
     int decayCounterRef,
     bool doesDecayRef,
     int priorityRef,
     int happinessThresholdRef,
     int valueRef,
     int maxValueRef,
     ISpriteState fulfillingSprite,
     IEntityRelationshipHandler relationshipHandler = null,
     IQuestProvider questProvider = null,
     int averageForDayRef         = 0,
     int averageForWeekRef        = 0)
     : base(
         decayRef,
         decayCounterRef,
         doesDecayRef,
         priorityRef,
         happinessThresholdRef,
         valueRef,
         maxValueRef,
         new string[0],
         fulfillingSprite,
         averageForDayRef,
         averageForWeekRef)
 {
     this.RelationshipHandler = relationshipHandler ?? GlobalConstants.GameManager?.RelationshipHandler;
     this.QuestProvider       = questProvider ?? GlobalConstants.GameManager?.QuestProvider;
 }
Beispiel #5
0
        public TopicData(
            ITopicCondition[] conditions,
            string ID,
            string[] nextTopics,
            string words,
            IEnumerable <string> tags,
            int priority,
            IEnumerable <IJoyAction> cachedActions,
            Speaker speaker,
            RNG roller  = null,
            string link = "",
            IConversationEngine conversationEngine         = null,
            IEntityRelationshipHandler relationshipHandler = null)
        {
            this.Roller = roller ?? new RNG();

            this.Initialise(
                conditions,
                ID,
                nextTopics,
                words,
                priority,
                cachedActions,
                speaker,
                link,
                conversationEngine,
                relationshipHandler);
        }
Beispiel #6
0
        public void Initialise(
            ITopicCondition[] conditions,
            string ID,
            string[] nextTopics,
            string words,
            int priority,
            IEnumerable <IJoyAction> cachedActions,
            Speaker speaker,
            string link = "",
            IConversationEngine conversationEngine         = null,
            IEntityRelationshipHandler relationshipHandler = null)
        {
            this.Conditions = conditions;
            this.ID         = ID;
            this.NextTopics = nextTopics;
            this.Words      = words;
            this.Priority   = priority;

            List <IJoyAction> actions = cachedActions is null ? new List <IJoyAction>() : cachedActions.ToList();

            actions.AddRange(this.GetStandardActions());

            this.CachedActions = actions.ToArray();

            this.ConversationEngine  = conversationEngine ?? GlobalConstants.GameManager?.ConversationEngine;
            this.RelationshipHandler = relationshipHandler ?? GlobalConstants.GameManager?.RelationshipHandler;

            this.Speaker = speaker;
            this.Link    = link;
        }
Beispiel #7
0
        public void SetUp()
        {
            ActionLog actionLog = new ActionLog();

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

            this.RelationshipHandler = new EntityRelationshipHandler();

            ICultureHandler cultureHandler = Mock.Of <ICultureHandler>(
                handler => handler.Cultures == new ICulture[]
            {
                Mock.Of <ICulture>(culture => culture.RomanceTypes ==
                                   new string[]
                {
                    "heteroromantic",
                    "homoromantic",
                    "panromantic",
                    "aromantic"
                })
            });

            GlobalConstants.GameManager = Mock.Of <IGameManager>(
                manager => manager.RelationshipHandler == this.RelationshipHandler &&
                manager.CultureHandler == cultureHandler);

            this.target = new EntityRomanceHandler();

            this.heteroromantic = this.target.Get("heteroromantic");
            this.homoromantic   = this.target.Get("homoromantic");
            this.biromantic     = this.target.Get("panromantic");
            this.aromantic      = this.target.Get("aromantic");
        }
Beispiel #8
0
        public void SetUp()
        {
            ActionLog actionLog = new ActionLog();

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

            this.target = new EntitySexualityHandler();
            this.RelationshipHandler = new EntityRelationshipHandler();
        }
Beispiel #9
0
        protected void GetBits()
        {
            if (this.ConversationEngine is null)
            {
                this.ConversationEngine = GlobalConstants.GameManager?.ConversationEngine;
            }

            if (this.RelationshipHandler is null)
            {
                this.RelationshipHandler = GlobalConstants.GameManager?.RelationshipHandler;
            }
        }
Beispiel #10
0
        public QuestProvider(
            IEntityRelationshipHandler entityRelationshipHandler,
            ILiveItemHandler itemHandler,
            IItemFactory itemFactory,
            RNG roller)
        {
            this.BagOfGoldHelper           = new BagOfGoldHelper(itemHandler, itemFactory);
            this.Roller                    = roller;
            this.EntityRelationshipHandler = entityRelationshipHandler;

            this.Actions = GlobalConstants.ScriptingEngine.FetchAndInitialiseChildren <IQuestAction>().ToList();
        }
Beispiel #11
0
        public void SetUp()
        {
            GlobalConstants.ActionLog = new ActionLog();
            this.scriptingEngine      = new ScriptingEngine();

            ILiveEntityHandler entityHandler = new LiveEntityHandler();
            IGameManager       gameManager   = Mock.Of <IGameManager>(
                manager => manager.EntityHandler == entityHandler);

            GlobalConstants.GameManager = gameManager;

            this.target = new EntityRelationshipHandler();
        }
Beispiel #12
0
        public ConversationEngine(
            IEntityRelationshipHandler relationshipHandler,
            Guid guid)
        {
            this.ValueExtractor      = new JSONValueExtractor();
            this.RelationshipHandler = relationshipHandler;

            this.m_Topics = this.LoadTopics();

            this.m_CurrentTopics = new List <ITopic>();

            this.Guid = guid;
        }
Beispiel #13
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();
        }
        public void SetUp()
        {
            GlobalConstants.ActionLog = new ActionLog();

            this.prefab = GD.Load <Node2D>(GlobalConstants.GODOT_ASSETS_FOLDER + "Scenes/JoyObject.tscn");

            this.scriptingEngine = new ScriptingEngine();

            ILiveEntityHandler entityHandler = Mock.Of <ILiveEntityHandler>();

            IRelationship friendship = Mock.Of <IRelationship>();

            IEntityRelationshipHandler relationshipHandler = Mock.Of <IEntityRelationshipHandler>(
                handler => handler.Get(It.IsAny <IJoyObject[]>(), It.IsAny <string[]>(), It.IsAny <bool>())
                == new IRelationship[] { friendship });

            IEntity questObject = Mock.Of <IEntity>(
                entity => entity.JoyName == "NAME1" &&
                entity.MyWorld == Mock.Of <IWorldInstance>(
                    w => w.GetRandomSentient() == Mock.Of <IEntity>(
                        e => e.JoyName == "NAME2")));

            this.world = Mock.Of <IWorldInstance>(
                w => w.GetRandomSentientWorldWide() == questObject &&
                w.GetRandomSentient() == questObject &&
                w.GetWorlds(It.IsAny <IWorldInstance>()) == new List <IWorldInstance>
            {
                Mock.Of <IWorldInstance>(mock => mock.Name == "TEST2")
            } &&
                w.GetOverworld() == Mock.Of <IWorldInstance>(
                    mock => mock.Name == "EVERSE" &&
                    mock.GetRandomSentient() == questObject &&
                    mock.GetRandomSentientWorldWide() == questObject) &&
                w.Name == "TEST");

            INeed friendshipMock = Mock.Of <INeed>(
                need => need.Fulfill(It.IsAny <int>()) == 1 &&
                need.Name == "friendship");
            IDictionary <string, INeed> needs = new Dictionary <string, INeed>();

            needs.Add("friendship", friendshipMock);

            IRollableValue <int> mockPersonality = Mock.Of <IEntityStatistic>(
                value => value.Value == 4 &&
                value.Name == "personality");
            IDictionary <string, IEntityStatistic> stats = new Dictionary <string, IEntityStatistic>();

            stats.Add(
                "personality",
                new EntityStatistic(
                    "personality",
                    4,
                    GlobalConstants.DEFAULT_SUCCESS_THRESHOLD));

            this.instigator = Mock.Of <IEntity>(
                entity => entity.PlayerControlled == true &&
                entity.MyWorld == this.world &&
                entity.Needs == needs &&
                entity.Statistics == stats &&
                entity.Sentient == true &&
                entity.Guid == Guid.NewGuid());

            this.listener = Mock.Of <IEntity>(entity => entity.MyWorld == this.world &&
                                              entity.Needs == needs &&
                                              entity.Statistics == stats &&
                                              entity.Sentient == true &&
                                              entity.Guid == Guid.NewGuid());

            GlobalConstants.GameManager = Mock.Of <IGameManager>(
                manager => manager.Player == this.instigator &&
                manager.ConversationEngine == new ConversationEngine(relationshipHandler, Guid.NewGuid()) &&
                manager.RelationshipHandler == relationshipHandler &&
                manager.RumourMill == new ConcreteRumourMill(new RNG()));

            this.target = GlobalConstants.GameManager.ConversationEngine;

            friendship.AddParticipant(this.listener.Guid);
            friendship.AddParticipant(this.instigator.Guid);
        }