Ejemplo n.º 1
0
        private string getChildbirth(CivPopKerbal crew)
        {
            string res = "-";

            if (crew.GetExpectingBirthAt() > -1)
            {
                res = formatter.format(crew.GetExpectingBirthAt() - currentDate);
            }
            return(res);
        }
Ejemplo n.º 2
0
 public void turnPregnantSomeFemales(
     Vessel v,
     double now,
     IEnumerable <CivPopCouple> couples,
     bool breedingAllowed)
 {
     if (v == null)
     {
         SimpleLogger.fetch.Info("turnPregnantSomeFemales, v is null");
     }
     if (breedingAllowed)
     {
         foreach (CivPopCouple couple in couples)
         {
             CivPopKerbal female = couple.GetFemale();
             if (female.getAge(now) == CivilianKerbalAge.YOUNG_ADULT ||
                 female.getAge(now) == CivilianKerbalAge.ADULT)
             {
                 if (female.GetExpectingBirthAt() < 0)
                 {
                     if ((rng.Next() % 100) <= CHANCE_OF_PREGNANCY + getTheaterBonus(v))
                     {
                         female.SetExpectingBirthAt(now + PREGNANCY_DURATION_IN_DAYS * TimeUnit.DAY);
                     }
                 }
             }
         }
     }
 }
        public void make_female_give_birth_after_pregnancy_duration_no_room_in_vessel()
        {
            vessel.SetCapacity(1);
            CivPopKerbal kerbal = builder.build(0);

            kerbal.SetVesselId(vessel.GetId());
            kerbal.SetExpectingBirthAt(2);
            repo.Add(kerbal);

            service.Update(0, repo);
            service.Update(TimeUnit.DAY, repo);

            Assert.AreEqual(-1, kerbal.GetExpectingBirthAt());
            Assert.AreEqual(1, repo.GetLivingRosterForVessel(vessel.GetId()).Count());
        }
Ejemplo n.º 4
0
 public void turnPregnantSomeFemales(
     double now,
     IEnumerable <CivPopCouple> couples,
     bool breedingAllowed)
 {
     if (breedingAllowed)
     {
         foreach (CivPopCouple couple in couples)
         {
             CivPopKerbal female = couple.GetFemale();
             if (female.getAge(now) == CivilianKerbalAge.YOUNG_ADULT ||
                 female.getAge(now) == CivilianKerbalAge.ADULT)
             {
                 if (female.GetExpectingBirthAt() < 0)
                 {
                     if (rng.Next() % CHANCE_OF_PREGNANCY == 0)
                     {
                         female.SetExpectingBirthAt(now + PREGNANCY_DURATION_IN_DAYS * TimeUnit.DAY);
                     }
                 }
             }
         }
     }
 }