2021-03-30 11:24:50 +02:00
|
|
|
#!/usr/bin/python3
|
|
|
|
import os
|
|
|
|
|
|
|
|
from app.base_field import BaseField
|
|
|
|
from config import *
|
|
|
|
|
|
|
|
|
2021-04-27 21:40:59 +02:00
|
|
|
class Field(BaseField):
|
2021-03-30 11:24:50 +02:00
|
|
|
def __init__(self, img_path: str):
|
|
|
|
super().__init__(img_path)
|
2021-04-27 21:40:59 +02:00
|
|
|
self._value = 0
|
2021-03-30 11:24:50 +02:00
|
|
|
|
2021-04-27 21:40:59 +02:00
|
|
|
def get_value(self) -> int:
|
|
|
|
return self._value
|
2021-03-30 11:24:50 +02:00
|
|
|
|
2021-04-27 21:40:59 +02:00
|
|
|
|
|
|
|
class Soil(Field):
|
|
|
|
def __init__(self, img_path: str):
|
|
|
|
super().__init__(img_path)
|
|
|
|
|
|
|
|
|
|
|
|
class Crops(Field):
|
2021-03-30 11:24:50 +02:00
|
|
|
price = 0
|
|
|
|
|
|
|
|
def __init__(self, img_path: str):
|
|
|
|
super().__init__(img_path)
|
|
|
|
self.weight = 1.0
|
2021-04-27 21:40:59 +02:00
|
|
|
self._value = VALUE_OF_CROPS
|
2021-03-30 11:24:50 +02:00
|
|
|
|
|
|
|
|
2021-04-27 21:40:59 +02:00
|
|
|
class Plant(Field):
|
2021-03-30 11:24:50 +02:00
|
|
|
def __init__(self, img_path: str):
|
|
|
|
super().__init__(img_path)
|
|
|
|
self.is_hydrated = False
|
2021-04-27 21:40:59 +02:00
|
|
|
self._value = VALUE_OF_PLANT
|
2021-03-30 11:24:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Clay(Soil):
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__(os.path.join(RESOURCE_DIR, f"{CLAY}.{PNG}"))
|
|
|
|
self.is_fertilized = False
|
2021-04-27 21:40:59 +02:00
|
|
|
self._value = VALUE_OF_CLAY
|
2021-03-30 11:24:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Sand(Soil):
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__(os.path.join(RESOURCE_DIR, f"{SAND}.{PNG}"))
|
|
|
|
self.is_sowed = False
|
|
|
|
self.is_hydrated = False
|
2021-04-27 21:40:59 +02:00
|
|
|
self._value = VALUE_OF_SAND
|
2021-03-30 11:24:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Grass(Plant):
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__(os.path.join(RESOURCE_DIR, f"{GRASS}.{PNG}"))
|
|
|
|
|
|
|
|
|
|
|
|
class Sunflower(Crops):
|
|
|
|
price = 7.90
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__(os.path.join(RESOURCE_DIR, f"{SUNFLOWER}.{PNG}"))
|
|
|
|
|
|
|
|
|
|
|
|
class Corn(Crops):
|
|
|
|
price = 9.15
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__(os.path.join(RESOURCE_DIR, f"{CORN}.{PNG}"))
|
|
|
|
|
|
|
|
|
|
|
|
CROPS = (Sunflower.__name__, Corn.__name__)
|
|
|
|
PLANTS = (Grass.__name__,)
|
|
|
|
SOILS = (Clay.__name__, Sand.__name__)
|