zmiana fertilizing
This commit is contained in:
Dominik Małyszka 2020-04-07 17:22:29 +00:00
parent b0154dc37e
commit 8feee67563

View File

@ -1,34 +1,35 @@
from plant import Plant from plant import Plant
from datetime import datetime from datetime import datetime
class Carrot(Plant): class Carrot(Plant):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self._wasFertilized = False #roslina nie byla nawozona przy tworzeniu self._wasFertilized = False #roslina nie byla nawozona przy tworzeniu
self._starttime = datetime.now() self._starttime = datetime.now()
def collect(self): #zwraca czy zbierać rośline
if self.have_soil(): def collect(self):
self.__growing() if self.have_soil():
if self._collect < 90: self.__growing()
return 'False' if self._collect < 90:
elif 90 <= self._collect <= 105: return 'False'
return 'True' elif 90 <= self._collect <= 105:
elif self._collect > 105: return 'True'
return 'Delete' elif self._collect > 105:
return 'Delete'
def fertillizing(self):
if 30 <= self._collect <= 50: #zwraca czy nawozić
self._wasFertilized = True def fertillizing(self):
return True if 30 <= self._collect <= 50:
else: return True
return False else:
return False
#każde iles czasu zwieksza wzrost rosliny, wywolywana w momencie sprawdzania czy roslina jest gotowa do zbiorow
def __growing(self): #każde iles czasu zwieksza wzrost rosliny, wywolywana w momencie sprawdzania czy roslina jest gotowa do zbiorow
checktime = datetime.now() def __growing(self):
delta = checktime - self._starttime checktime = datetime.now()
a = delta // 60 delta = checktime - self._starttime
self._collect += a a = delta // 60
self._starttime = checktime self._collect += a
self._starttime = checktime