Ejemplo n.º 1
0
        public static void ResolveNameForSpouseOnGeneration(ref PawnGenerationRequest request, Pawn generated)
        {
            if (request.FixedLastName != null)
            {
                return;
            }
            MarriageNameChange marriageNameChange = Roll_NameChangeOnMarriage();

            if (marriageNameChange == MarriageNameChange.NoChange)
            {
                return;
            }
            Pawn spouse = generated.GetSpouse();

            DetermineManAndWomanSpouses(generated, spouse, out var man, out var woman);
            NameTriple nameTriple  = man.Name as NameTriple;
            NameTriple nameTriple2 = woman.Name as NameTriple;

            if (generated == woman && marriageNameChange == MarriageNameChange.WomansName)
            {
                man.Name = new NameTriple(nameTriple.First, nameTriple.Nick, nameTriple.Last);
                if (man.story != null)
                {
                    man.story.birthLastName = GetRandomBirthName(man);
                }
                request.SetFixedLastName(nameTriple.Last);
            }
            else if (generated == man && marriageNameChange == MarriageNameChange.WomansName)
            {
                request.SetFixedLastName(nameTriple2.Last);
                request.SetFixedBirthName(GetRandomBirthName(man));
            }
            else if (generated == woman && marriageNameChange == MarriageNameChange.MansName)
            {
                request.SetFixedLastName(nameTriple.Last);
                request.SetFixedBirthName(GetRandomBirthName(woman));
            }
            else if (generated == man && marriageNameChange == MarriageNameChange.MansName)
            {
                woman.Name = new NameTriple(nameTriple2.First, nameTriple2.Nick, nameTriple2.Last);
                if (woman.story != null)
                {
                    woman.story.birthLastName = GetRandomBirthName(man);
                }
                request.SetFixedLastName(nameTriple2.Last);
            }
        }