2021-05-10 12:56:08 +02:00
|
|
|
import random
|
2021-05-21 20:14:00 +02:00
|
|
|
from typing import List
|
2021-05-10 12:56:08 +02:00
|
|
|
|
2021-06-19 00:09:14 +02:00
|
|
|
from survival.game.tile import Tile
|
2021-05-10 12:56:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
class BiomePreset:
|
2021-05-21 20:14:00 +02:00
|
|
|
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
|