def process(color): if self.biome is Biome.barren_ice_caps: return randomize_color( blend_colors(color, Biome.barren_ice_caps.color)) return randomize_color(color)
def process(color): r_color = randomize_color(color) if self.biome is Biome.volcanic_molten_river: b_color = Biome.volcanic_molten_river.color_satellite return randomize_color(blend_colors(b_color, r_color)) return randomize_color(r_color)
def color_satellite(self): hex_grid = self.grid map_type = self.grid.params.get('map_type') if map_type is MapType.terran or map_type is MapType.oceanic: # if self.has_feature(HexFeature.lake): # return 0, 20, 170 # if self.is_land: # colors = [h.biome.color for h in self.bubble(distance=2) if h.is_land] # colors.append(self.biome.color) # # colors is an array of 3-tuple colors # mul = 1 / len(colors) # avg_r = round(sum([mul * c[0] for c in colors])) # avg_g = round(sum([mul * c[1] for c in colors])) # avg_b = round(sum([mul * c[2] for c in colors])) # return avg_r, avg_g, avg_b if self.has_feature(HexFeature.glacier): return randomize_color(Biome.arctic.color_satellite) if self.is_land: return randomize_color(lighten(self.biome.color_satellite, 0.9)) # water for level, color in TERRAN_OCEAN_SATELLITE: if self.altitude < self.grid.sealevel + level: return random.choice(color) return random.choice(TERRAN_OCEAN_SATELLITE[-1][1]) elif map_type is MapType.glacial: for level, color in GLACIAL_SATELLITE: if self.altitude < self.grid.sealevel + level: return randomize_color(color) return randomize_color(GLACIAL_SATELLITE[-1][1]) elif map_type is MapType.volcanic: if self.biome is Biome.volcanic_liquid: return random.choice(VOLCANIC_LIQUID) else: def process(color): r_color = randomize_color(color) if self.biome is Biome.volcanic_molten_river: b_color = Biome.volcanic_molten_river.color_satellite return randomize_color(blend_colors(b_color, r_color)) return randomize_color(r_color) for level, color in VOLCANIC_SATELLITE: if self.altitude < self.grid.sealevel + level: return process(color) return process(VOLCANIC_SATELLITE[-1][1]) else: if self.is_water: for level, color in TERRAN_OCEAN_SATELLITE: if self.altitude < self.grid.sealevel + level: return random.choice(color) return random.choice(TERRAN_OCEAN_SATELLITE[-1][1]) # land if self.grid.params.get('pressure') < 0.003: color_list = BARREN_SATELLITE elif self.biome is Biome.barren_wet: color_list = BARREN_WET else: color_list = DUSTY_BARREN_SATELLITE def process(color): if self.biome is Biome.barren_ice_caps: return randomize_color( blend_colors(color, Biome.barren_ice_caps.color)) return randomize_color(color) for level, color in color_list: if self.altitude < self.grid.sealevel + level: return process(color) return process(color)
def process(color): if self.biome is Biome.barren_ice_caps: return randomize_color(blend_colors(color, Biome.barren_ice_caps.color)) return randomize_color(color)
def process(color): r_color = randomize_color(color) if self.biome is Biome.volcanic_molten_river: b_color = Biome.volcanic_molten_river.color_satellite return randomize_color(blend_colors(b_color, r_color)) return randomize_color(r_color)
def color_satellite(self): hex_grid = self.grid map_type = self.grid.params.get('map_type') if map_type is MapType.terran or map_type is MapType.oceanic: # if self.has_feature(HexFeature.lake): # return 0, 20, 170 # if self.is_land: # colors = [h.biome.color for h in self.bubble(distance=2) if h.is_land] # colors.append(self.biome.color) # # colors is an array of 3-tuple colors # mul = 1 / len(colors) # avg_r = round(sum([mul * c[0] for c in colors])) # avg_g = round(sum([mul * c[1] for c in colors])) # avg_b = round(sum([mul * c[2] for c in colors])) # return avg_r, avg_g, avg_b if self.has_feature(HexFeature.glacier): return randomize_color(Biome.arctic.color_satellite) if self.is_land: return randomize_color(lighten(self.biome.color_satellite, 0.9)) # water for level, color in TERRAN_OCEAN_SATELLITE: if self.altitude < self.grid.sealevel + level: return random.choice(color) return random.choice(TERRAN_OCEAN_SATELLITE[-1][1]) elif map_type is MapType.glacial: for level, color in GLACIAL_SATELLITE: if self.altitude < self.grid.sealevel + level: return randomize_color(color) return randomize_color(GLACIAL_SATELLITE[-1][1]) elif map_type is MapType.volcanic: if self.biome is Biome.volcanic_liquid: return random.choice(VOLCANIC_LIQUID) else: def process(color): r_color = randomize_color(color) if self.biome is Biome.volcanic_molten_river: b_color = Biome.volcanic_molten_river.color_satellite return randomize_color(blend_colors(b_color, r_color)) return randomize_color(r_color) for level, color in VOLCANIC_SATELLITE: if self.altitude < self.grid.sealevel + level: return process(color) return process(VOLCANIC_SATELLITE[-1][1]) else: if self.is_water: for level, color in TERRAN_OCEAN_SATELLITE: if self.altitude < self.grid.sealevel + level: return random.choice(color) return random.choice(TERRAN_OCEAN_SATELLITE[-1][1]) # land if self.grid.params.get('pressure') < 0.003: color_list = BARREN_SATELLITE elif self.biome is Biome.barren_wet: color_list = BARREN_WET else: color_list = DUSTY_BARREN_SATELLITE def process(color): if self.biome is Biome.barren_ice_caps: return randomize_color(blend_colors(color, Biome.barren_ice_caps.color)) return randomize_color(color) for level, color in color_list: if self.altitude < self.grid.sealevel + level: return process(color) return process(color)