public bool IsSameSpeciesAs(Species?species) { if (species is null) { return(false); } return(string.Equals(this.Name.ToLower(), species.Name.ToLower())); }
public static Tier[] GenerateEmotionBias(Species?species) { Tier[] emotionBias = new Tier[EMOTION_COUNT]; for (int i = 0; i < URGE_COUNT; ++i) { emotionBias[i] = (Tier)Random.Next(TIER_COUNT); } if (species == Species.Gamma) { emotionBias[(int)Emotion.Joy] = Tier.Ultra; emotionBias[(int)Emotion.Trust] = Tier.Ultra; } return(emotionBias); }
public static Tier[] GenerateUrgeBias(Species?species) { Tier[] urgeBias = new Tier[URGE_COUNT]; for (int i = 0; i < URGE_COUNT; ++i) { urgeBias[i] = (Tier)Random.Next(TIER_COUNT); } if (species == Species.Gamma) { urgeBias[(int)Urge.Reproduce] = Tier.Ultra; urgeBias[(int)Urge.Heal] = Tier.None; } return(urgeBias); }
/// <summary> /// Gets which category the selected species is part of. Used when species is picked first. /// </summary> /// <returns></returns> private Categorys?GetCategoryFromSelectedSpecies() { Species?selectedSpecies = GetSelectedSpecies(); if (selectedSpecies != null) { foreach (KeyValuePair <Categorys, Species[]> kv_pair in speciesMapping) { foreach (Species s in kv_pair.Value) { if (s == (Species)selectedSpecies) { return(kv_pair.Key); } } } } return(null); }
/// <summary> /// Hides all controls but the controls relevant to <paramref name="species"/> /// </summary> private void ChangeSpeciesView(Species?species) { Species_wingColor_input.BackColor = Color.LightGray; foreach (KeyValuePair <Species, Control[]> kv_pair in speciesControlsMapping) { foreach (Control c in kv_pair.Value) { if (species == null) { c.Hide(); } else if (species == kv_pair.Key) //If this control is part of the species we want to display: show the control { c.Show(); } else //else: hide the control { c.Hide(); } } } }
/// <summary> /// Method responsible for checking if all user-inputs are correctly filled /// </summary> /// <param name="errorMsg">The message displayed in case of error</param> /// <returns>Returns if the tests passed or not</returns> private bool AssertAll(ref string errorMsg) { Categorys?selectedCategory = GetSelectedCategory(); Species? selectedSpecies = GetSelectedSpecies(); if (selectedCategory != null && selectedSpecies != null) { if (!AssertManager.AssertEmpty(Animal_name_input.Text, "Name", ref errorMsg)) //make sure the name is not empty { return(false); } if (!AssertManager.AssertParse(Animal_age_input.Text, "Age", ref errorMsg)) //make sure the age is not empty and a number { return(false); } if (!AssertManager.AssertDropdown(Animal_gender_input.SelectedIndex, "Gender", ref errorMsg)) //make sure the gender is selected { return(false); } switch (selectedCategory) { case Categorys.Insect: { if (!AssertManager.AssertParse(Category_noLegs_input.Text, "No. legs", ref errorMsg)) //make sure the #legs is not empty and a number { return(false); } } break; case Categorys.Mamal: { if (!AssertManager.AssertParse(Category_noteeth_input.Text, "No. teeth", ref errorMsg)) //make sure the #teeth is not empty and a number { return(false); } switch (selectedSpecies) { case Species.Dog: { if (!AssertManager.AssertEmpty(Species_breed_input.Text, "Breed", ref errorMsg)) //make sure the breed is not empty { return(false); } } break; case Species.Monkey: { if (!AssertManager.AssertParse(Species_tailLength_input.Text, "Tail length", ref errorMsg)) //make sure the tail length is not empty and a number { return(false); } } break; } } break; } return(true); } else { errorMsg = "No species and/or category selected!"; return(false); } }
public ClinicalBreakpointFilterSpecification(Species?species) : base(i => !species.HasValue || i.Species == species) { }
public bool IsSameSpeciesAs(Species?species) { return(species is not null && string.Equals(this.Name.ToLower(), species.Name.ToLower())); }
// 能力者騙りをする際に,偽の占い(or霊能)結果を作成する. public void SetFakeResult() { Agent fakeGiftTarget = null; Species?fakeResult = null; if (fakeRole == Role.SEER) { // 偽占い(or霊能)の候補.以下,偽占い候補 List <Agent> fakeGiftTargetCandidateList = new List <Agent>(); List <Agent> aliveAgentList = LatestDayGameInfo.AliveAgentList; aliveAgentList.Remove(Me); foreach (Agent agent in aliveAgentList) { // まだ偽占いしてないプレイヤー,かつ対抗CO者じゃないプレイヤーは偽占い候補 Role?comingoutRole = agi.ComingoutMap.ContainsKey(agent) ? agi.ComingoutMap[agent] : null; if (!IsJudgedAgent(agent) && fakeRole != comingoutRole) { fakeGiftTargetCandidateList.Add(agent); } } if (fakeGiftTargetCandidateList.Count > 0) { Random rand = new Random(); fakeGiftTarget = fakeGiftTargetCandidateList[rand.Next(fakeGiftTargetCandidateList.Count)]; } else { aliveAgentList.RemoveAll(a => fakeGiftTargetCandidateList.Contains(a)); Random rand = new Random(); fakeGiftTarget = aliveAgentList[rand.Next(aliveAgentList.Count)]; } // 30%で黒判定,70%で白判定 if (new Random().NextDouble() < 0.3) { fakeResult = Species.WEREWOLF; } else { fakeResult = Species.HUMAN; } } else if (fakeRole == Role.MEDIUM) { fakeGiftTarget = LatestDayGameInfo.ExecutedAgent; //30%で黒判定,70%で白判定 if (new Random().NextDouble() < 0.3) { fakeResult = Species.WEREWOLF; } else { fakeResult = Species.HUMAN; } } else { return; } if (fakeGiftTarget != null) { MyFakeJudgeList.Add(new Judge(Day, Me, fakeGiftTarget, (Species)fakeResult)); } }