Пример #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);
        }
Пример #2
0
        public static Dictionary <string, string> GetAttributes()
        {
            var needs = new List <string>();

            if (PercentOfRandom.Does(98)) //x% of people need supplies
            {
                for (var i = 0; i < AnimatorRandom.Rand.Next(1, 4); i++)
                {
                    needs.Add(($"config/supplies.txt").GetRandomFromFile());
                }
            }

            var dict = new Dictionary <string, string>();

            dict.Add("Supply_Needs", string.Join(",", needs.Distinct()));
            return(dict);
        }