public int CalculateHabEffect(Hex habitat, Critter critter) { float climate = habitat.GetClimateVal(); float temp = habitat.GetTempVal(); float critterClimateFocus = critter.GetClimateFocus(); float critterClimatePref = critter.GetClimatePref(); float critterClimateRange = critter.GetClimateRange(); float critterTempFocus = critter.GetTempFocus(); float critterTempPref = critter.GetTempPref(); float critterTempRange = critter.GetTempRange(); Hex.BiomeType biome = habitat.GetBiomeType(); Hex.Geography geo = habitat.GetGeography(); int score = 0; //Calculates for all boon fields to create a positive score for a good habitat fit. foreach(BiomeAdaptition item in BiomeBoons){ if((Hex.BiomeType)(item) == biome){ score++; } } foreach(statSliderChange item in ClimateBoons){ score += CheckStatSliderVal(item, critterClimatePref, critterClimateRange, critterClimateFocus, climate, 1); if (item == statSliderChange.FOCUS) { critterClimateFocus++; } else if (item == statSliderChange.PREF) { critterClimatePref++; } else if (item == statSliderChange.RANGE) { critterClimateRange++; } } foreach(GeoAdaptation item in GeoBoons){ if((Hex.Geography)(item) == geo){ score++; } } foreach(statSliderChange item in TempBoons){ score += CheckStatSliderVal(item, critterTempPref, critterTempRange, critterTempFocus, temp, 1); if (item == statSliderChange.FOCUS) { critterTempFocus++; } else if (item == statSliderChange.PREF) { critterTempPref++; } else if (item == statSliderChange.RANGE) { critterTempRange++; } } //Calculates for all bane fields to create a negative score for a bad habitat fit. foreach(BiomeAdaptition item in BiomeBanes){ if((Hex.BiomeType)(item) == biome){ score--; } } foreach(statSliderChange item in ClimateBanes){ score += CheckStatSliderVal(item, critterClimatePref, critterClimateRange, critterClimateFocus, climate, -1); if (item == statSliderChange.FOCUS) { critterClimateFocus--; } else if (item == statSliderChange.PREF) { critterClimatePref--; } else if (item == statSliderChange.RANGE) { critterClimateRange--; } } foreach(GeoAdaptation item in GeoBanes){ if((Hex.Geography)(item) == geo){ score--; } } foreach(statSliderChange item in TempBanes){ score += CheckStatSliderVal(item, critterTempPref, critterTempRange, critterTempFocus, temp, -1); if (item == statSliderChange.FOCUS) { critterTempFocus--; } else if (item == statSliderChange.PREF) { critterTempPref--; } else if (item == statSliderChange.RANGE) { critterTempRange--; } } return score; }
public void CloneStats(Critter critter) { offense = critter.GetOffense(); defense = critter.GetDefense(); baseSpeed = critter.GetBaseSpeed(); sense = critter.GetSense(); sneak = critter.GetSneak(); size = critter.GetSize(); breedRate = critter.GetBreedRate(); metabolism = critter.GetMetabolism(); biomePref = critter.GetBiomePrefs(); climateFocus = critter.GetClimateFocus(); climatePref = critter.GetClimatePref(); climateRange = critter.GetClimateRange(); geoPref = critter.GetGeoPrefs(); tempFocus = critter.GetTempFocus(); tempPref = critter.GetTempPref(); tempRange = critter.GetTempRange(); evoMod = critter.GetEvoMod(); migrateMod = critter.GetMigrateMod(); }