private string getMedicineResult(double[] bodye) { double[] ef, efm, e; double s, sm; List <Prescript> result = new List <Prescript>(); BodyCondition body = new BodyCondition(); body.bodyM = bodye; ef = body.bodyconditionE(); s = body.scoreBodyCondition(ef); foreach (Prescript x in Database.prescriptDB) { e = x.prescriptE(); efm = body.eatmedicineE(e); sm = body.scoreBodyCondition(efm); if (sm < s) { x.extra = true; x.extrascore = sm; result.Add(x); } } result.Sort(); String tmp = ""; foreach (Prescript x in result) { tmp += string.Format("[ÆÀ·Ö]{0,-10:F} [·½¼Á]" + x.name + "\r\n", ((s - x.extrascore) / s * 100)); } return(tmp); }
private void AssembleCharacter() { C_CharacterSprites = new CharacterSprites(C_Slug); C_WeekRoutine = new WeekRoutine(C_MondayRoutine, C_TuesdayRoutine, C_WednesdayRoutine, C_ThursdayRoutine, C_FridayRoutine, C_SaturdayRoutine, C_SundayRoutine); C_Property = new Property(C_Wealth, C_Incomes, C_Expenses, C_CharacterInventory); C_PhysicalTemporal = new PhysicalTemporal(C_CurrentPosition, C_CurrentTime); C_PhysicalCondition = new PhysicalCondition(C_PhysicalTemporal, C_Property, C_WeekRoutine); C_SocialCondition = new SocialCondition(C_RelationshipList, C_ReputationList); C_Skills = new Skills(); C_PastLifeEvent = new PastLifetimeEvent(C_LifeThoughts, C_LifeNeeds, C_LifeMotivation, C_LifeEvent); C_PastYearEvent = new PastYearEvent(C_YearThoughts, C_YearNeeds, C_YearMotivation, C_YearEvent); C_PastMonthEvent = new PastMonthEvent(C_MonthThoughts, C_MonthNeeds, C_MonthMotivation, C_MonthEvent); C_PastWeekEvent = new PastWeekEvent(C_WeekThoughts, C_WeekNeeds, C_WeekMotivation, C_WeekEvent); C_PastDayEvent = new PastDayEvent(C_DayThoughts, C_DayNeeds, C_DayMotivation, C_DayEvent); C_Memory = new Memory(C_PastDayEvent, C_PastWeekEvent, C_PastMonthEvent, C_PastYearEvent, C_PastLifeEvent); C_CurrentEmotion = new CurrentEmotion(C_CurrentRage, C_CurrentLoathing, C_CurrentGrief, C_CurrentAmazement, C_CurrentTerror, C_CurrentAdmiration, C_CurrentEcstasy, C_CurrentVigilance); C_Concept = new Concept(); C_Prototype = new Prototype(); C_Knowledge = new Knowledge(); C_Morality = new Morality(); C_Cognition = new Cognition(C_Concept, C_Prototype, C_Knowledge, C_Morality); C_FivePersonality = new FundamentalPersonalityCharacteristics(C_Conscientious, C_Agreeableness, C_Neuroticism, C_Openness, C_Extraversion); C_Personality = new Personality(C_FivePersonality); C_Mind = new Mind(C_Personality, C_Cognition, C_CurrentEmotion, C_Memory, C_MentalHealth, C_Skills); C_BodyNeeds = new BodyNeeds(C_FoodNeeds, C_WaterNeeds, C_SleepNeeds, C_WarmthNeeds, C_ShelterNeeds, C_AirNeeds); C_BodyCondition = new BodyCondition(C_DeathOrAlive, C_ConsciousState, C_MaxEnergy, C_CurrentEnergy, C_BodyNeeds); C_Bodyparts = new BodyParts(C_Sight, C_Hearing, C_Smelling, C_LeftLeg, C_RightLeg, C_LeftArm, C_RightArm); C_BasicBodyStats = new BasicBodyStats(C_Race, C_Age, C_Height, C_Sex, C_Bodytype); C_Body = new Body(C_BasicBodyStats, C_Bodyparts, C_BodyCondition); C_CharacterName = new CharacterName(C_FirstName, C_LastName, C_Nametype, C_Nickname); C_Character = new Character(C_CharacterName, C_CharacterNumber, C_Body, C_Mind, C_SocialCondition, C_PhysicalCondition, C_CharacterSprites); }
public BodyConditions(ConfigNode node) { foreach (string allowed in node.GetValues("BodyAllowed")) { BodyCondition bodyCondition = ParseCondition(allowed); if (bodyCondition != null) { bodiesAllowed.Add(bodyCondition); } } foreach (string notAllowed in node.GetValues("BodyNotAllowed")) { BodyCondition bodyCondition = ParseCondition(notAllowed); if (bodyCondition != null) { bodiesNotAllowed.Add(bodyCondition); } } HasConditions = bodiesAllowed.Count > 0 || bodiesNotAllowed.Count > 0; }
public Body(BasicBodyStats basicbodystats, BodyParts bodylimbs, BodyCondition bodycondition) { BasicBodyStats = basicbodystats; Bodylimbs = bodylimbs; BodyCondition = bodycondition; }
static void Main(string[] args) { List <Medicine> ms = new List <Medicine>(); List <Prescript> ps = new List <Prescript>(); //Medicine m = new Medicine(); //Prescript p = new Prescript(); //m.name = "test"; //m.mild = 0.0; //m.merdian[1] = 1.0; //m.merdian[3] = 1.0; //p.name = "testtoo"; //p.add(m, 1.0, 0.0); //DBParser.addMedicine(ms, m); //DBParser.addPrescript(ps, p); //DBParser.removeMedicine(1); //DBParser.removePrescript(1); ms = DBParser.medicineDB(); ps = DBParser.prescriptDB(ms); bodym = new double[][] { //new double[] {100.00,80.38,53.67,41.03,22.52,17.64,12.48,6.94,3.96,2.63,1.79,1.18}, new double[] { 100.00, 37.06, 43.74, 17.35, 9.22, 5.96, 3.98, 2.03, 1.66, 1.64, 2.04, 1.18 }, new double[] { 100.00, 93.06, 55.16, 17.98, 9.59, 6.28, 2.20, 1.54, 1.25, 0.79, 0.43, 1.18 }, new double[] { 100.00, 41.10, 40.97, 17.23, 7.18, 5.27, 2.68, 2.82, 1.29, 1.58, 1.00, 1.18 }, new double[] { 100.00, 50.06, 50.85, 33.10, 14.91, 13.26, 12.50, 8.35, 4.48, 2.54, 2.33, 1.18 }, new double[] { 100.00, 41.14, 28.95, 41.27, 20.56, 11.40, 15.90, 9.59, 6.59, 3.33, 3.95, 1.18 } }; int testid = 3; double[] ef, efm, e; double s, sm; List <Prescript> result = new List <Prescript>(); BodyCondition body = new BodyCondition(); body.bodyM = bodym[testid]; ef = body.bodyconditionE(); s = body.scoreBodyCondition(ef); foreach (Prescript x in ps) { e = x.prescriptE(); efm = body.eatmedicineE(e); sm = body.scoreBodyCondition(efm); if (sm < s) { x.extra = true; x.extrascore = sm; result.Add(x); } } result.Sort(); foreach (Prescript x in result) { Debug.WriteLine(string.Format(x.name + " [E]{0:F}", ((s - x.extrascore) / s * 100))); } }
private void JsonToCharacter(int i) { List <DayRoutine> sundayroutines = new List <DayRoutine> (); List <DayRoutine> saturdayroutines = new List <DayRoutine> (); List <DayRoutine> fridayroutines = new List <DayRoutine> (); List <DayRoutine> thursdayroutines = new List <DayRoutine> (); List <DayRoutine> wednesdayroutines = new List <DayRoutine> (); List <DayRoutine> tuesdayroutines = new List <DayRoutine> (); List <DayRoutine> mondayroutines = new List <DayRoutine> (); WeekRoutine weekroutine = new WeekRoutine(mondayroutines, tuesdayroutines, wednesdayroutines, thursdayroutines, fridayroutines, saturdayroutines, sundayroutines); CharacterInventory inventory = new CharacterInventory(); List <RegularExpense> regularexpenses = new List <RegularExpense> (); List <RegularIncome> regularincomes = new List <RegularIncome> (); int wealth = (int)CurrentJsonData[i]["wealth"]; Property property = new Property(wealth, regularincomes, regularexpenses, inventory); int currentposition = (int)CurrentJsonData[i]["currenttime"]; int currenttime = (int)CurrentJsonData[i]["currentposition"]; PhysicalTemporal physicaltemporal = new PhysicalTemporal(currentposition, currenttime); List <Relationship> relationshiplist = new List <Relationship> (); List <Reputation> reputationlist = new List <Reputation> (); List <MentalDisorder> mentalhealth = new List <MentalDisorder> (); Skills skills = new Skills(); List <Event> pastlifeevents = new List <Event> (); List <Motivation> pastlifemotivations = new List <Motivation> (); List <Need> pastlifeneeds = new List <Need> (); List <Thought> pastlifethoughts = new List <Thought> (); List <Event> pastyearevents = new List <Event> (); List <Motivation> pastyearmotivations = new List <Motivation> (); List <Need> pastyearneeds = new List <Need> (); List <Thought> pastyearthoughts = new List <Thought> (); List <Event> pastmonthevents = new List <Event> (); List <Motivation> pastmonthmotivations = new List <Motivation> (); List <Need> pastmonthneeds = new List <Need> (); List <Thought> pastmonththoughts = new List <Thought> (); List <Event> pastweekevents = new List <Event> (); List <Motivation> pastweekmotivations = new List <Motivation> (); List <Need> pastweekneeds = new List <Need> (); List <Thought> pastweekthoughts = new List <Thought> (); List <Event> pastdayevents = new List <Event> (); List <Motivation> pastdaymotivations = new List <Motivation> (); List <Need> pastdayneeds = new List <Need> (); List <Thought> pastdaythoughts = new List <Thought> (); PastLifetimeEvent pastlife = new PastLifetimeEvent(pastlifethoughts, pastlifeneeds, pastlifemotivations, pastlifeevents); PastYearEvent pastyear = new PastYearEvent(pastyearthoughts, pastyearneeds, pastyearmotivations, pastyearevents); PastMonthEvent pastmonth = new PastMonthEvent(pastmonththoughts, pastmonthneeds, pastmonthmotivations, pastmonthevents); PastWeekEvent pastweek = new PastWeekEvent(pastweekthoughts, pastweekneeds, pastweekmotivations, pastweekevents); PastDayEvent pastday = new PastDayEvent(pastdaythoughts, pastdayneeds, pastdaymotivations, pastdayevents); Memory memory = new Memory(pastday, pastweek, pastmonth, pastyear, pastlife); int currentvigilance = (int)CurrentJsonData[i]["currentvigilance"]; int currentecstasy = (int)CurrentJsonData[i]["currentecstasy"]; int currentadmiration = (int)CurrentJsonData[i]["currentadmiration"]; int currentterror = (int)CurrentJsonData[i]["currentterror"]; int currentamazement = (int)CurrentJsonData[i]["currentamazement"]; int currentgrief = (int)CurrentJsonData[i]["currentgrief"]; int currentloathing = (int)CurrentJsonData[i]["currentloathing"]; int currentrage = (int)CurrentJsonData[i]["currentrage"]; CurrentEmotion emotion = new CurrentEmotion(currentrage, currentloathing, currentgrief, currentamazement, currentterror, currentadmiration, currentecstasy, currentvigilance); Cognition cognition = new Cognition(); int extraversion = (int)CurrentJsonData[i]["extraversion"]; int openness = (int)CurrentJsonData[i]["openness"]; int neuroticism = (int)CurrentJsonData[i]["neuroticism"]; int agreeableness = (int)CurrentJsonData[i]["agreeableness"]; int conscientiousness = (int)CurrentJsonData[i]["conscientiousness"]; FundamentalPersonalityCharacteristics characteristics = new FundamentalPersonalityCharacteristics(conscientiousness, agreeableness, neuroticism, openness, extraversion); Personality personality = new Personality(characteristics); int air = (int)CurrentJsonData[i]["air"]; int shelter = (int)CurrentJsonData[i]["shelter"]; int warmth = (int)CurrentJsonData[i]["warmth"]; int sleep = (int)CurrentJsonData[i]["sleep"]; int water = (int)CurrentJsonData[i]["water"]; int food = (int)CurrentJsonData[i]["food"]; BodyNeeds needs = new BodyNeeds(food, water, sleep, warmth, shelter, air); int currentenergy = (int)CurrentJsonData[i]["currentenergy"]; int maxenergy = (int)CurrentJsonData[i]["maxenergy"]; int consciousstate = (int)CurrentJsonData[i]["consciousstate"]; bool deadoralive = (bool)CurrentJsonData[i]["deadoralive"]; BodyCondition bodycondition = new BodyCondition(deadoralive, consciousstate, maxenergy, currentenergy, needs); bool rightarm = (bool)CurrentJsonData[i]["rightarm"]; bool leftarm = (bool)CurrentJsonData[i]["leftarm"]; bool rightleg = (bool)CurrentJsonData[i]["rightleg"]; bool leftleg = (bool)CurrentJsonData[i]["leftleg"]; bool smell = (bool)CurrentJsonData[i]["smell"]; bool hearing = (bool)CurrentJsonData[i]["hearing"]; bool sight = (bool)CurrentJsonData[i]["sight"]; BodyParts bodyparts = new BodyParts(sight, hearing, smell, leftleg, rightleg, leftarm, rightarm); int bodytype = (int)CurrentJsonData[i]["bodytype"]; int sex = (int)CurrentJsonData[i]["sex"]; int height = (int)CurrentJsonData[i]["height"]; int age = (int)CurrentJsonData[i]["age"]; int race = (int)CurrentJsonData[i]["race"]; BasicBodyStats bodystats = new BasicBodyStats(race, age, height, sex, bodytype); string firstname = (string)CurrentJsonData[i]["firstname"].ToString(); string lastname = (string)CurrentJsonData[i]["lastname"].ToString(); int nametype = (int)CurrentJsonData[i]["nametype"]; string commonnickname = (string)CurrentJsonData[i]["commonnickname"].ToString(); string slug = (string)CurrentJsonData[i]["slug"].ToString(); int id = (int)CurrentJsonData[i]["id"]; CharacterName charactername = new CharacterName(firstname, lastname, nametype, commonnickname); Body body = new Body(bodystats, bodyparts, bodycondition); Mind mind = new Mind(personality, cognition, emotion, memory, mentalhealth, skills); SocialCondition social = new SocialCondition(relationshiplist, reputationlist); PhysicalCondition physical = new PhysicalCondition(physicaltemporal, property, weekroutine); CharacterSprites sprites = new CharacterSprites(slug); Character CurrentCharacter = new Character(charactername, id, body, mind, social, physical, sprites); CharacterList.Add(CurrentCharacter); }