2024-03-22 22:14:05 +01:00
|
|
|
import random
|
|
|
|
|
|
|
|
|
2024-03-07 18:01:12 +01:00
|
|
|
class Dirt:
|
2024-03-22 22:14:05 +01:00
|
|
|
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()
|
2024-03-07 18:01:12 +01:00
|
|
|
# add a couple new properties
|
|
|
|
|
2024-03-22 22:14:05 +01:00
|
|
|
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
|
2024-04-14 23:19:06 +02:00
|
|
|
elif i == 5:
|
2024-03-22 22:14:05 +01:00
|
|
|
self.obstacle = True
|
2024-03-07 18:01:12 +01:00
|
|
|
|
2024-03-22 22:14:05 +01:00
|
|
|
# add init, getters,setters
|