This repository was archived by the owner on Mar 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.py
More file actions
46 lines (42 loc) · 1.46 KB
/
Copy pathmain.py
File metadata and controls
46 lines (42 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# main method
from init import *
from anti import *
import time
def main():
while screenshot():
time.sleep(random.uniform(0.5, 0.7))
sh = screenshot()
# check if battle is ready start
if check(sh, 'res/start.png', 0.9) == 1:
pos = location(sh, 'res/start.png', 0.9)
# random tap
k = random.randrange(0, 2)
for i in range(k):
random_tap(sh)
time.sleep(random.uniform(0.1, 0.2))
# tap the "attack" button
tap_start(pos[0][0], pos[0][1])
# if at the card-selecting interface
if check(sh, 'res/quick.png', 0.9) == 1 \
or check(sh, 'res/arts.png', 0.9) \
or check(sh, 'res/buster.png', 0.9):
# random tap
j = random.randrange(0, 2)
for i in range(j):
random_tap(sh)
time.sleep(random.uniform(0.1, 0.2))
# select cards
cards = init_main(sh)
# tap selected cards
time.sleep(random.uniform(0.1, 0.4))
tap_card(cards[0][0], cards[0][1])
time.sleep(random.uniform(0.1, 0.4))
tap_card(cards[1][0], cards[1][1])
time.sleep(random.uniform(0.1, 0.4))
tap_card(cards[2][0], cards[2][1])
# wait
time.sleep(1.5)
# check if the battle ends
if check(sh, 'res/end.png', 0.9) == 1:
break
main()