MAX_STRAWBERRY = 3
STRAWBERRY_COUNTER = 0
def plant(crop, reg=SCREEN):
plot =
if not reg.exists(plot):
result = False
else:
click(plot)
wait(Pattern(
).similar(0.80), 10)
click(crop)
click(plot)
wait(
, 10)
click(
)
result = True
return result
def harvest(crop, reg=SCREEN):
if not reg.exists(crop):
result = False
else:
position = reg.find(crop)
hover(position)
if position.nearby().exists(Pattern(
).similar(0.50)):
click(position)
sleep(3)
gather(position.nearby(), Pattern(
).similar(0.60))
gather(position.nearby(), Pattern(
).similar(0.60))
result = True
else:
result = False
return result
def gather(reg, item):
m = reg.exists(item)
if m != None:
hover(m.getTarget())
def growStrawberry(event):
global STRAWBERRY_COUNTER
print('growStrawberry start')
reg = SCREEN if event == None else event.region
if exists(
) and harvest(
, reg):
STRAWBERRY_COUNTER = STRAWBERRY_COUNTER - 1
if STRAWBERRY_COUNTER < 0:
STRAWBERRY_COUNTER = 0
if STRAWBERRY_COUNTER < MAX_STRAWBERRY and plant(
):
STRAWBERRY_COUNTER = STRAWBERRY_COUNTER + 1
print(STRAWBERRY_COUNTER)
print('growStrawberry end')
onChange(growStrawberry)
observe(600)