Пример #1
0
        public static HealthProfile GetHealthProfile()
        {
            var o = new HealthProfile();

            o.Height    = PhysicalCharacteristics.GetMilHeight(Npc.NpcProfile.BiologicalSex, Npc.NpcProfile.Rank.Branch);
            o.Weight    = PhysicalCharacteristics.GetMilWeight(o.Height, Npc.NpcProfile.Birthdate, Npc.NpcProfile.BiologicalSex, Npc.NpcProfile.Rank.Branch);
            o.BloodType = PhysicalCharacteristics.GetBloodType();

            var mealPreference = string.Empty;

            if (PercentOfRandom.Does(95)) //x% have a meal preference
            {
                mealPreference = ($"config/meal_preferences.txt").GetRandomFromFile();
            }
            o.PreferredMeal = mealPreference;

            if (PercentOfRandom.Does(98)) //x% have a medical condition
            {
                var raw = File.ReadAllText("config/medical_conditions_and_medications.json");
                var r   = JsonConvert.DeserializeObject <IEnumerable <HealthProfileRecord> >(raw).RandomElement();

                var c = new MedicalCondition {
                    Name = r.Condition
                };
                foreach (var med in r.Medications)
                {
                    c.Prescriptions.Add(new Prescription {
                        Name = med
                    });
                }
                o.MedicalConditions.Add(c);
            }

            return(o);
        }
 public void Mil_Weight_Is_Not_Null()
 {
     Assert.IsNotNull(PhysicalCharacteristics.GetMilWeight(70, new DateTime(2000, 4, 1)));
 }