27 lines
763 B
Python
27 lines
763 B
Python
import random
|
|
|
|
|
|
class Dirt:
|
|
def __init__(self, water_level, nutrients_level):
|
|
self.water_level = water_level
|
|
self.nutrients_level = nutrients_level
|
|
self.pest = False
|
|
self.weed = False
|
|
self.obstacle = False
|
|
self.pests_and_weeds()
|
|
# add a couple new properties
|
|
|
|
def pests_and_weeds(self):
|
|
i = random.randint(1, 20) # 5% szans na szkodniki, 10% na chwasty, 5 na obydwa 15 na kamien
|
|
if i == 1:
|
|
self.pest = True
|
|
elif i == 2 or i == 3:
|
|
self.weed = True
|
|
elif i == 4:
|
|
self.weed = True
|
|
self.pest = True
|
|
elif i == 5 or i == 6 or i == 7:
|
|
self.obstacle = True
|
|
|
|
# add init, getters,setters
|