private static void ResolveMyName(ref PawnGenerationRequest request, Pawn child, Pawn otherParent)
 {
     if (request.FixedLastName != null)
     {
         return;
     }
     if (ChildRelationUtility.DefinitelyHasNotBirthName(child))
     {
         return;
     }
     if (ChildRelationUtility.ChildWantsNameOfAnyParent(child))
     {
         if (otherParent == null)
         {
             float num = 0.9f;
             if (Rand.Value < num)
             {
                 request.SetFixedLastName(((NameTriple)child.Name).Last);
             }
         }
         else
         {
             string last  = ((NameTriple)child.Name).Last;
             string last2 = ((NameTriple)otherParent.Name).Last;
             if (last != last2)
             {
                 request.SetFixedLastName(last);
             }
         }
     }
 }
예제 #2
0
 public override void CreateRelation(Pawn generated, Pawn other, ref PawnGenerationRequest request)
 {
     if (generated.gender == Gender.Male)
     {
         other.SetFather(generated);
         ResolveMyName(ref request, other, other.GetMother());
         ResolveMySkinColor(ref request, other, other.GetMother());
         if (other.GetMother() != null)
         {
             if (other.GetMother().story.traits.HasTrait(TraitDefOf.Gay))
             {
                 generated.relations.AddDirectRelation(PawnRelationDefOf.ExLover, other.GetMother());
             }
             else if (Rand.Value < 0.85f && !LovePartnerRelationUtility.HasAnyLovePartner(other.GetMother()))
             {
                 generated.relations.AddDirectRelation(PawnRelationDefOf.Spouse, other.GetMother());
                 if (request.FixedLastName == null && Rand.Value < 0.8f)
                 {
                     request.SetFixedLastName(((NameTriple)other.GetMother().Name).Last);
                 }
             }
             else
             {
                 LovePartnerRelationUtility.GiveRandomExLoverOrExSpouseRelation(generated, other.GetMother());
             }
         }
     }
     else if (generated.gender == Gender.Female)
     {
         other.SetMother(generated);
         ResolveMyName(ref request, other, other.GetFather());
         ResolveMySkinColor(ref request, other, other.GetFather());
         if (other.GetFather() != null)
         {
             if (other.GetFather().story.traits.HasTrait(TraitDefOf.Gay))
             {
                 generated.relations.AddDirectRelation(PawnRelationDefOf.ExLover, other.GetFather());
             }
             else if (Rand.Value < 0.85f && !LovePartnerRelationUtility.HasAnyLovePartner(other.GetFather()))
             {
                 generated.relations.AddDirectRelation(PawnRelationDefOf.Spouse, other.GetFather());
                 if (request.FixedLastName == null && Rand.Value < 0.8f)
                 {
                     request.SetFixedLastName(((NameTriple)other.GetFather().Name).Last);
                 }
             }
             else
             {
                 LovePartnerRelationUtility.GiveRandomExLoverOrExSpouseRelation(generated, other.GetFather());
             }
         }
     }
 }
 private static void ResolveMyName(ref PawnGenerationRequest request, Pawn generated)
 {
     if (request.FixedLastName == null && ChildRelationUtility.ChildWantsNameOfAnyParent(generated))
     {
         if (Rand.Value < 0.5)
         {
             request.SetFixedLastName(((NameTriple)generated.GetFather().Name).Last);
         }
         else
         {
             request.SetFixedLastName(((NameTriple)generated.GetMother().Name).Last);
         }
     }
 }
 private static void ResolveMyName(ref PawnGenerationRequest request, Pawn generated)
 {
     if (request.FixedLastName == null && Rand.Value < 0.800000011920929)
     {
         request.SetFixedLastName(((NameTriple)generated.GetSpouse().Name).Last);
     }
 }
예제 #5
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);
            }
        }
 private static void ResolveMyName(ref PawnGenerationRequest request, Pawn generated)
 {
     if (request.FixedLastName != null)
     {
         return;
     }
     if (Rand.Value < 0.8f)
     {
         request.SetFixedLastName(((NameTriple)generated.GetSpouse().Name).Last);
     }
 }
예제 #7
0
 private static void ResolveMyName(ref PawnGenerationRequest request, Pawn generatedChild)
 {
     if (request.FixedLastName == null)
     {
         if (ChildRelationUtility.ChildWantsNameOfAnyParent(generatedChild))
         {
             bool flag = Rand.Value < 0.5f || generatedChild.GetMother() == null;
             if (generatedChild.GetFather() == null)
             {
                 flag = false;
             }
             if (flag)
             {
                 request.SetFixedLastName(((NameTriple)generatedChild.GetFather().Name).Last);
             }
             else
             {
                 request.SetFixedLastName(((NameTriple)generatedChild.GetMother().Name).Last);
             }
         }
     }
 }