Exemplo n.º 1
0
        /// <summary>
        /// This will create relationship objects linking two Occupations together and add a reference to both
        /// </summary>
        /// <param name="firstParty">The first Person in the relationship. If the terms for each party is different, this will be the left term
        /// Example: Mother-Daughter relationship. firstParty will be the mother.</param>
        /// <param name="secondParty">The second person in the relationship and the one associated with the term on the right</param>
        /// <param name="firstPartyRole">Name of the relationship from the first party's perspective, i,e mother. Use the enum.</param>
        /// <param name="secondPartyRole">Name of the relationship from the second party's perspective, i,e daughter. Use the enum</param>
        /// <param name="started">Date relationship started. Is used to diffentiate relationships that have started and stopped and started again (i.e. on and off friends)
        /// </param>
        /// <param name="ended">Date relationship ended</param>
        /// <returns>The new links (2)</returns>
        public List <PersonalRelationship> CreateRelationshipBetweenTwoPersons(Person firstParty, Person secondParty, PersonalRelationshipTypeName firstPartyRole,
                                                                               PersonalRelationshipTypeName secondPartyRole, GameTime.GameTime started, GameTime.GameTime ended = null)
        {
            string description        = PersonalRelationshipDetails.Instance.GetRelationshipDescription(firstPartyRole.ToString());
            string reverseDescription = PersonalRelationshipDetails.Instance.GetRelationshipDescription(secondPartyRole.ToString());
            var    type = PersonalRelationshipDetails.Instance.GetRelationshipTypeName(firstPartyRole.ToString());

            var newRelationship1 = new PersonalRelationship(secondParty, type, Guid.NewGuid(), description)
            {
                Name    = firstPartyRole + "-" + secondPartyRole,
                Started = started,
                Ended   = ended
            };

            firstParty.AddRelationship(newRelationship1);

            var newRelationship2 = new PersonalRelationship(firstParty, type, Guid.NewGuid(), reverseDescription)
            {
                Name    = firstPartyRole + "-" + secondPartyRole,
                Started = started,
                Ended   = ended
            };

            secondParty.AddRelationship(newRelationship2);

            return(new List <PersonalRelationship> {
                newRelationship1, newRelationship2
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a relationship. Relationships should not be removed - they end.
        /// To do so, get a relationship with FindRelationship and modify it.
        /// </summary>
        /// <param name="newPersonalRelationship"></param>
        internal void AddRelationship(PersonalRelationship newPersonalRelationship)
        {
            if (_relationships == null)
            {
                _relationships = new List <PersonalRelationship>();
            }


            _relationships.Add(newPersonalRelationship);
        }
        /// <inheritdoc />
        public override MemoryItem GetAccurateCopy()
        {
            var copy = new PersonalRelationship(RelatedPerson, Type, ReferenceId)
            {
                ItemType    = ItemType,
                Description = Description,
                Started     = Started,
                Ended       = Ended,
                Name        = Name
            };

            return(copy);
        }
        /// <inheritdoc />
        public override MemoryItem GetInaccurateCopy()
        {
            GameTime.GameTime        started = Started;
            GameTime.GameTime        ended   = Ended;
            PersonalRelationshipType type    = Type;

            //TODO : Randomize name

            int falsificationCase = RandomValueGenerator.GenerateIntWithMaxValue(4);

            switch (falsificationCase)
            {
            case 1:
                int variance = RandomValueGenerator.GenerateRealWithinValues(-10, 10);
                started?.SetYear(started.GetYear() + variance);
                break;

            case 2:
                int deathVariance = RandomValueGenerator.GenerateRealWithinValues(-10, 10);
                ended?.SetYear(ended.GetYear() + deathVariance);
                break;

            case 3:
                type = (PersonalRelationshipType)RandomValueGenerator.GenerateIntWithMaxValue(Enum.GetNames(typeof(PersonalRelationshipType)).Length);
                break;

            case 4:
                type     = (PersonalRelationshipType)RandomValueGenerator.GenerateIntWithMaxValue(Enum.GetNames(typeof(PersonalRelationshipType)).Length);
                variance = RandomValueGenerator.GenerateRealWithinValues(-10, 10);
                started?.SetYear(started.GetYear() + variance);
                break;
            }

            var copy = new PersonalRelationship(RelatedPerson, type, ReferenceId)
            {
                ItemType    = ItemType,
                Description = Description,
                Started     = started,
                Ended       = ended,
                Name        = Name
            };

            return(copy);
        }
Exemplo n.º 5
0
 internal bool RemoveRelationship(PersonalRelationship relationship)
 {
     return(_relationships.Remove(relationship));
 }