AI-Project/survival/game/biomes/biome_preset.py

24 lines
706 B
Python
Raw Normal View History

2021-05-10 12:56:08 +02:00
import random
from typing import List
2021-05-10 12:56:08 +02:00
from survival.game.tile import Tile
2021-05-10 12:56:08 +02:00
class BiomePreset:
def __init__(self, name, min_height: float, min_moisture: float, min_heat: float, tiles: List[Tile]):
2021-05-10 12:56:08 +02:00
self.name = name
self.min_height = min_height
self.min_moisture = min_moisture
self.min_heat = min_heat
self.tiles = tiles
def get_new_tile(self):
tile = random.choice(self.tiles)
return Tile(origin=tile.origin, cost=tile.cost, biome=self)
def get_tile_sprite(self):
pass
def match_conditions(self, height, moisture, heat):
return height >= self.min_height and moisture >= self.min_moisture and heat >= self.min_heat