-
Notifications
You must be signed in to change notification settings - Fork 0
/
经典十六炮.py
132 lines (118 loc) · 3.26 KB
/
经典十六炮.py
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import pvz
import pvz.logger as logger
from pvz.threads import running_in_thread
pvz.EnableLogger(True)
while not pvz.FindPvZ():
print("等待找到游戏")
pvz.Sleep(100)
pvz.BackgroundRunning(True)
# pvz.GotoEndless()
print(f"当前场景: {pvz.GameUI()}")
pvz.QuickPass()
pvz.StartAutoCollectThread()
@running_in_thread
def PaoThread():
wave = 0
while wave < 20:
wave += 1
logger.info(f"本波次为: {wave}")
try:
pvz.Prejudge(-130,wave)
except Exception as e:
logger.warning(e)
pvz.UpdatePaoList()
pvz.Pao((2,9))
pvz.Pao((5,9))
wait_countdown_cs = 550
if wave in [1,4,7,10,13,16]:
# pvz.Delay(110)
pvz.Pao((2,9))
pvz.Pao((5,9))
# wait_countdown_cs -= 110
if wave in [9,19,20]:
LastPao(wave)
pvz.Delay(wait_countdown_cs)
countdown = pvz.WaveCountdown()
logger.info(f"距离下一波刷新还有{countdown}cs")
if countdown > 300 and wave not in [9,19,20]:
YanChiChuLi()
def LastPao(wave):
global giga_waves
has_giga = giga_waves[wave-1]
if has_giga or wave == 20:
pao_count = 3
else:
pao_count = 1
y = 8.5
if wave == 20:
y = 9
pvz.Delay(200)
for _ in range(pao_count):
pvz.Delay(400)
pvz.UpdatePaoList()
pvz.Pao((2,y))
pvz.Pao((5,y))
@running_in_thread
def FangShuaGuaiYanChi():
last_wave = -1
delay_time = 0
while True:
pvz.Delay(50)
wave = pvz.CurrentWave()
if wave != last_wave:
last_wave = wave
delay_time = 0
continue
if wave in [9,19] or wave < 1:
continue
if wave == 20:
break
delay_time += 50
if delay_time >= 700:
YanChiChuLi()
delay_time -= 600
chuli_count = 0
def YanChiChuLi():
# cards = ["樱桃炸弹", "窝瓜", "毁灭菇"]
global chuli_count
if chuli_count == 0:
pvz.Card("樱桃炸弹", (2,9))
pvz.Card("樱桃炸弹", (2,8)) #try
elif chuli_count == 1:
pvz.Card("窝瓜", (5,9))
pvz.Card("窝瓜", (5,8)) #try
elif chuli_count == 2:
pvz.Card("睡莲", (3,9))
pvz.Card("毁灭菇", (3,9))
pvz.Card("咖啡豆", (3,9))
pvz.Card("睡莲", (4,9)) #try
pvz.Card("毁灭菇", (4,9))
pvz.Card("咖啡豆", (4,9))
chuli_count += 1
if chuli_count >= 3:
chuli_count = 0
@running_in_thread
def PaoXiaoShanHu():
pvz.Prejudge(-125, 20)
pvz.Pao((4,7))
@running_in_thread
def BingShaXiaoTou():
pvz.Prejudge(150, 10)
pvz.Card("寒冰菇", (1,7))
pvz.Card("咖啡豆", (1,7))
pvz.Prejudge(150, 20)
pvz.Card("寒冰菇", (1,7))
pvz.Card("咖啡豆", (1,7))
n_pos = (3,9)
while True:
pvz.Sleep(600)
# 选卡并开始
pvz.SelectCards(["毁灭菇", "咖啡豆", "小喷菇", "阳光菇", "寒冰菇", "窝瓜", "樱桃", "三叶草", "南瓜头", "睡莲"])
giga_waves = pvz.utils.get_zombie_spawning_appear_waves(32)
pvz.StartAutoCollectThread()
# FangShuaGuaiYanChi()
PaoThread()
BingShaXiaoTou()
PaoXiaoShanHu()
while pvz.GameUI() != 2:
pvz.Sleep(100)