public virtual ITopic[] Interact(IEntity instigator, IEntity listener) { this.GetBits(); IJoyAction fulfillNeed = this.CachedActions.First(action => action.Name.Equals("fulfillneedaction", StringComparison.OrdinalIgnoreCase)); IJoyAction influence = this.CachedActions.First(action => action.Name.Equals("modifyrelationshippointsaction", StringComparison.OrdinalIgnoreCase)); fulfillNeed.Execute( new IJoyObject[] { instigator, listener }, new[] { "friendship" }, new Dictionary <string, object> { { "need", "friendship" }, { "value", instigator.Statistics[EntityStatistic.PERSONALITY].Value }, { "counter", 0 }, { "doAll", true } }); string[] tags = this.RelationshipHandler is null ? new string[0] : this.RelationshipHandler.Get( new[] { instigator.Guid, listener.Guid }) .SelectMany(relationship => relationship.Tags).ToArray(); influence.Execute( new IJoyObject[] { instigator, listener }, tags, new Dictionary <string, object> { { "value", instigator.Statistics[EntityStatistic.PERSONALITY].Value } }); influence.Execute( new IJoyObject[] { listener, instigator }, tags, new Dictionary <string, object> { { "value", listener.Statistics[EntityStatistic.PERSONALITY].Value } }); bool?isFamily = this.RelationshipHandler?.IsFamily(instigator.Guid, listener.Guid); if (isFamily is null == false && isFamily == true) { fulfillNeed.Execute( new IJoyObject[] { instigator, listener }, new string[] { "family" }, new Dictionary <string, object> { { "need", "family" }, { "value", instigator.Statistics[EntityStatistic.PERSONALITY].Value }, { "counter", 0 }, { "doAll", true } }); } return(this.FetchNextTopics()); }
public override ITopic[] Interact(IEntity instigator, IEntity listener) { if (this.Happening == false) { return(base.Interact(instigator, listener)); } base.Interact(instigator, listener); IJoyAction fulfillNeed = instigator.FetchAction("fulfillneedaction"); int listenerSatisfaction = ( instigator.Statistics[EntityStatistic.INTELLECT].Value + instigator.Statistics[EntityStatistic.ENDURANCE].Value + instigator.Statistics[EntityStatistic.PERSONALITY].Value) / 3; int instigatorSatisfaction = ( listener.Statistics[EntityStatistic.INTELLECT].Value + listener.Statistics[EntityStatistic.ENDURANCE].Value + listener.Statistics[EntityStatistic.PERSONALITY].Value) / 3; fulfillNeed.Execute( new IJoyObject[] { instigator }, new[] { "sex", "need" }, new Dictionary <string, object> { { "need", "sex" }, { "value", instigatorSatisfaction }, { "counter", 10 } }); fulfillNeed.Execute( new IJoyObject[] { listener }, new[] { "sex", "need" }, new Dictionary <string, object> { { "need", "sex" }, { "value", listenerSatisfaction }, { "counter", 10 } }); return(this.FetchNextTopics()); }
public override ITopic[] Interact(IEntity instigator, IEntity listener) { IJoyAction influence = this.CachedActions.First(action => action.Name.Equals("modifyrelationshippointsaction", StringComparison.OrdinalIgnoreCase)); influence.Execute( new IJoyObject[] { listener, instigator }, new[] { "friendship" }, new Dictionary <string, object> { { "value", -instigator.Statistics[EntityStatistic.PERSONALITY].Value } }); return(this.FetchNextTopics()); }
private void CreateWorld() { //Make a new overworld generator OverworldGenerator overworldGen = new OverworldGenerator(this.m_WorldInfoHandler); //Generate the basic overworld this.m_World = new WorldInstance( overworldGen.GenerateWorldSpace(WORLD_SIZE, "plains"), new string[] { "overworld", "exterior" }, "Everse", GlobalConstants.GameManager.EntityHandler, GlobalConstants.GameManager.Roller); //Set the date and time for 1/1/1555, 12:00pm this.m_World.SetDateTime(new JoyDateTime(1555, 1, 1, 12)); //Do the spawn point SpawnPointPlacer spawnPlacer = new SpawnPointPlacer(GlobalConstants.GameManager.Roller); Vector2Int spawnPoint = spawnPlacer.PlaceSpawnPoint(this.m_World); while ((spawnPoint.x == -1 && spawnPoint.y == -1)) { spawnPoint = spawnPlacer.PlaceSpawnPoint(this.m_World); } this.m_World.SpawnPoint = spawnPoint; //Set up the player //m_Player.Move(m_World.SpawnPoint); //m_World.AddEntity(m_Player); //Begin the first floor of the Naga Pits WorldInfo worldInfo = this.m_WorldInfoHandler.GetRandom("interior"); DungeonGenerator dungeonGenerator = new DungeonGenerator(); WorldInstance dungeon = dungeonGenerator.GenerateDungeon( worldInfo, WORLD_SIZE, 3, GlobalConstants.GameManager, GlobalConstants.GameManager.Roller); Vector2Int transitionPoint = spawnPlacer.PlaceTransitionPoint(this.m_World); this.m_World.AddArea(transitionPoint, dungeon); this.Done = true; this.m_ActiveWorld = dungeon; this.m_Player.Move(dungeon.SpawnPoint); dungeon.AddEntity(this.m_Player); GlobalConstants.GameManager.EntityHandler.Add(this.m_Player); IItemInstance lightSource = GlobalConstants.GameManager.ItemFactory.CreateRandomItemOfType( new string[] { "light source" }, true); IItemInstance bag = GlobalConstants.GameManager.ItemFactory.CreateRandomItemOfType( new[] { "container" }, true); IJoyAction addItemAction = this.m_Player.FetchAction("additemaction"); addItemAction.Execute( new IJoyObject[] { this.m_Player, lightSource }, new[] { "pickup" }, new Dictionary <string, object> { { "newOwner", true } }); addItemAction.Execute( new IJoyObject[] { this.m_Player, bag }, new[] { "pickup" }, new Dictionary <string, object> { { "newOwner", true } }); for (int i = 0; i < 4; i++) { IItemInstance newItem = GlobalConstants.GameManager.ItemFactory.CreateRandomWeightedItem( true, false); addItemAction.Execute( new IJoyObject[] { this.m_Player, newItem }, new[] { "pickup" }, new Dictionary <string, object> { { "newOwner", true } }); } this.m_World.Tick(); GlobalConstants.GameManager.WorldHandler.Add(this.m_World); WorldSerialiser worldSerialiser = new WorldSerialiser(GlobalConstants.GameManager.ObjectIconHandler); worldSerialiser.Serialise(this.m_World); this.Done = true; }
public override ITopic[] Interact(IEntity instigator, IEntity listener) { this.Happening = false; IJoyObject[] participants = { instigator, listener }; List <IRelationship> relationships = this.RelationshipHandler.Get( participants.Select(o => o.Guid), new[] { "sexual" }, false) .ToList(); if (relationships.IsNullOrEmpty() && listener.Sexuality.Compatible(listener, instigator) && instigator.Sexuality.Compatible(instigator, listener)) { relationships.Add(this.RelationshipHandler.CreateRelationship( participants.Select(o => o.Guid), new[] { "sexual" })); } if (listener.Sexuality.WillMateWith(listener, instigator, relationships) == false || instigator.Sexuality.WillMateWith(instigator, listener, relationships) == false) { return(base.Interact(instigator, listener)); } IJoyAction fulfillNeed = instigator.FetchAction("fulfillneedaction"); int listenerSatisfaction = ( instigator.Statistics[EntityStatistic.INTELLECT].Value + instigator.Statistics[EntityStatistic.ENDURANCE].Value + instigator.Statistics[EntityStatistic.PERSONALITY].Value) / 3; int instigatorSatisfaction = ( listener.Statistics[EntityStatistic.INTELLECT].Value + listener.Statistics[EntityStatistic.ENDURANCE].Value + listener.Statistics[EntityStatistic.PERSONALITY].Value) / 3; fulfillNeed.Execute( new IJoyObject[] { instigator, listener }, new[] { "sex", "need" }, new Dictionary <string, object> { { "need", "sex" }, { "value", instigatorSatisfaction }, { "counter", 10 }, { "overwrite", true } }); fulfillNeed.Execute( new IJoyObject[] { listener, instigator }, new[] { "sex", "need" }, new Dictionary <string, object> { { "need", "sex" }, { "value", listenerSatisfaction }, { "counter", 10 }, { "overwrite", true } }); base.Interact(instigator, listener); this.Happening = true; return(this.FetchNextTopics()); }