// TODO: prefer "places" for this and not male/female public string RegionName(IClimate climate, CoreEnums.Word nameType) { // I could put this on one line but I think it'd be less clear string name = Generator.GetName(nameType) + ClimateSwitch(climate); if (Random.Next(0, 4) == 0) name = AffixDemonstrative(name); return name; }
public static List<IFeatures> GetClimateFeatures(IClimate climate) { switch (climate.GetType().Name.ToLower()) { case "alpine": return AlpineFeatures(); case "chaparral": return ChaparralFeatures(); case "deciduousforest": return DeciduousForestFeatures(); case "desert": return DesertFeatures(); case "grassland": return GrasslandFeatures(); case "rainforest": return RainforestFeatures(); case "savanna": return SavannaFeatures(); case "steppe": return SteppeFeatures(); case "taiga": return TaigaFeatures(); case "tundra": default: return TundraFeatures(); } }
// TODO: prefer "places" for this and not male/female public string RegionNameWithAdjective(IClimate climate, CoreEnums.Word nameType) { GeneralWordGen general = new GeneralWordGen(); string name = Generator.GetName(nameType); if (Random.Next(0, 5) == 0) name = name + " the " + GetAdjective().CapitalizeFirstLetter(); name = name + ClimateSwitch(climate); return name; }
public static IFeatures PopulateHighlands(int id, IClimate climate) { // now we need to exlude features. For example, if the climate is a Savanna then we shouldn't have forests int featureId = 0; switch (climate.GetType().Name.ToLower()) { case "grassland": featureId = (id < 3) ? _Random.Next(3, 10) : id; break; case "chaparral": featureId = (id < 3) ? _Random.Next(3, 10) : id; break; case "desert": featureId = (id < 3) ? _Random.Next(3, 10) : id; break; case "savanna": featureId = (id < 3) ? _Random.Next(3, 10) : id; break; case "steppe": featureId = (id < 3) ? _Random.Next(3, 10) : id; break; case "tundra": featureId = (id < 3) ? _Random.Next(3, 10) : id; break; } switch (id) { case 0: return new Forest(); case 1: return new Forest(); case 2: return new Forest(); // skip these if climate is of type... case 3: return new Caves(); case 4: return new Faults(); case 5: return new Ridges(); case 6: return new Ridges(); case 7: return new Talus(); case 8: return new Rivers(); case 9: default: return new Shrubland(); } }
public static ITopography Get(int id, CoreEnums.RegionSize size, IClimate climate) { switch (id) { case 0: return new Highlands(size, climate); case 1: return new Hills(size, climate); case 2: return new Mountains(size, climate); case 3: return new Lowlands(size, climate); case 4: return new Plains(size, climate); case 5: default: return new Valleys(size, climate); } }
private string ClimateSwitch(IClimate climate) { switch(climate.GetType().Name.ToLower()) { case "alpine": return Forests(); case "chaparral": return FlatLands(); case "deciduousforest": return Forests(); case "desert": return Deserts(); case "grassland": return FlatLands(); case "rainforest": return Forests(); case "savanna": return Savannas(); case "steppe": return Steppes(); case "taiga": return Arctic(); case "tundra": default: return Arctic(); } }
public static IFeatures PopulateValley(int id, IClimate climate) { switch (id) { case 0: return new Caves(); case 1: return new Caves(); case 2: return new Forest(); case 3: return new Forest(); case 4: return new Forest(); case 5: return new Rivers(); case 6: return new Rivers(); case 7: return new Ridges(); case 8: return new Shrubland(); case 9: default: return new Fumaroles(); } }
public static IFeatures PopulateMountain(int id, IClimate climate) { switch (id) { case 0: return new Caves(); case 1: return new Caves(); case 2: return new Forest(); case 3: return new Forest(); case 4: return new Ridges(); case 5: return new Ridges(); case 6: return new Rivers(); case 7: return new Karst(); case 8: return new Fumaroles(); case 9: default: return new Talus(); } }
public static IFeatures PopulatePlains(int id, IClimate climate) { // if forests exist don't allow dunes and vice versa switch (id) { case 0: return new Forest(); case 1: return new Forest(); case 2: return new Faults(); case 3: return new Rivers(); case 4: return new Shrubland(); case 5: return new Shrubland(); case 6: return new Bog(); case 7: return new Bog(); case 8: return new Dunes(); case 9: default: return new Dunes(); } }
public static IFeatures PopulateLowlands(int id, IClimate climate) { switch (id) { case 0: return new Forest(); case 1: return new Forest(); case 2: return new Faults(); case 3: return new Rivers(); case 4: return new Bog(); case 5: return new Fumaroles(); case 6: return new Craters(); case 7: return new Shrubland(); case 8: return new Dunes(); case 9: default: return new Dunes(); } }
/// <summary> /// Populates the available features for this topography type. /// </summary> /// <param name="climate">Accepts a climate type</param> /// <returns>Returns a List of Features contained within this topography</returns> private List<IFeatures> PopulateFinalFeatures(IClimate climate) { List<IFeatures> availableClimateFeatures = FeaturesFactory.GetClimateFeatures(climate); List<IFeatures> features = new List<IFeatures>(); bool excludeFeatures = false; for (int n = 0; n < 10; n++) { IFeatures feature = FeaturesFactory.PopulateLowlands(_Random.Next(0, availableClimateFeatures.Count - 1), climate); feature.Id = n; feature.Name = "NAME"; // tie the name generator to this feature.Description = "DESCRIPTION"; AvailableFeatures.Add(feature); // if a dune or forest feature has not been excluded yet we need to continually check if (!excludeFeatures) { if (feature.GetType().Name == "Dunes") { availableClimateFeatures.RemoveAll(c => c.GetType().Name == "Forest"); excludeFeatures = true; continue; } if (feature.GetType().Name == "Forest") { availableClimateFeatures.RemoveAll(c => c.GetType().Name == "Dunes"); excludeFeatures = true; continue; } } } return features; }
/// <summary> /// Primary constructor for generating a topography with appropriate settings /// </summary> /// <param name="size">Accepts the size of the region the topography belongs to</param> public Plains(CoreEnums.RegionSize size, IClimate climate) { AvailableFeatures = PopulateAvailableFeatures(); Features = PopulateFinalFeatures(climate); CorrespondingTopography = PopulateCorrespondingTopography(); }
/// <summary> /// Generate a name for the region /// </summary> /// <param name="climate"></param> /// <returns></returns> private string GetName(IClimate climate) { switch (Random.Next(0, 3)) { case 0: return ((Random.Next(0, 5) == 0) ? Names.RegionNameWithAdjective(climate, CoreEnums.Word.HumanPlace) : Names.RegionName(climate, CoreEnums.Word.HumanPlace)); case 1: return ((Random.Next(0, 5) == 0) ? Names.RegionNameWithAdjective(climate, CoreEnums.Word.ElfPlace) : Names.RegionName(climate, CoreEnums.Word.ElfPlace)); case 2: default: return ((Random.Next(0, 5) == 0) ? Names.RegionNameWithAdjective(climate, CoreEnums.Word.DwarfPlace) : Names.RegionName(climate, CoreEnums.Word.DwarfPlace)); } }
/// <summary> /// Populates the available features for this topography type. /// </summary> /// <param name="climate">Accepts a climate type</param> /// <returns>Returns a List of Features contained within this topography</returns> private List<IFeatures> PopulateFinalFeatures(IClimate climate) { List<IFeatures> availableClimateFeatures = FeaturesFactory.GetClimateFeatures(climate); List<IFeatures> features = new List<IFeatures>(); for (int n = 0; n < 10; n++) { IFeatures feature = availableClimateFeatures.ElementAt(_Random.Next(0, availableClimateFeatures.Count - 1)); feature.Id = n; feature.Name = "NAME"; // tie the name generator to this feature.Description = "DESCRIPTION"; features.Add(feature); } return features; }