public static float ScoreMotiveTuning(MotiveTuning tuning, MotiveKey key) { float num = 0f; CASAgeGenderFlags speciesSpecificity = tuning.SpeciesSpecificity; if (speciesSpecificity != CASAgeGenderFlags.None) { CASAgeGenderFlags species = key.mAgeSpecies & CASAgeGenderFlags.SpeciesMask; if (species == CASAgeGenderFlags.None) { species = CASAgeGenderFlags.Human; } if (species != speciesSpecificity) { return(float.MinValue); } num += Sim.kMotiveTuningScoreForSpecies; } CASAgeGenderFlags ageSpecificity = tuning.AgeSpecificity; if (ageSpecificity != CASAgeGenderFlags.AgeMask) { if ((key.mAgeSpecies & ageSpecificity) == CASAgeGenderFlags.None) { return(float.MinValue); } num += Sim.kMotiveTuningScoreForAge; } if (tuning.TraitSpecificity != null) { OccultTypes occult = OccultTypes.None; bool flag = true; foreach (TraitNames names in tuning.TraitSpecificity) { occult = OccultTypeHelper.OccultFromTrait(names); if (occult != key.mOccult) { flag = false; break; } } if (flag) { num += Sim.kMotiveTuningScoreForTrait * tuning.TraitSpecificity.Count; } else { return(float.MinValue); } } if (tuning.WorldRestrictionType == WorldRestrictionType.Allow) { if (!tuning.WorldRestrictionWorldTypes.Contains(GameUtils.GetCurrentWorldType()) && !tuning.WorldRestrictionWorldNames.Contains(GameUtils.GetCurrentWorld())) { return(float.MinValue); } num += Sim.kMotiveTuningScoreForWorld; } if (tuning.WorldRestrictionType != WorldRestrictionType.Disallow) { return(num); } if (tuning.WorldRestrictionWorldTypes.Contains(GameUtils.GetCurrentWorldType()) || tuning.WorldRestrictionWorldNames.Contains(GameUtils.GetCurrentWorld())) { return(float.MinValue); } return(num + Sim.kMotiveTuningScoreForWorld); }