-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
185 lines (164 loc) · 3.57 KB
/
main.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
import time
import pyautogui as pg
from fast import fast
from model import Pair
from sequence import *
from pony_up import *
from util import logcall
pg.FAILSAFE = True
# Banned from Equestria (Daily) v1.5
# WINDOW_TITLE = 'Banned from Equestria (Daily)'
WINDOW_TITLE = 'BFEQ'
# Misc
@logcall
def reload():
"""Reload the page and click through the introduction"""
# pos_reload.click()
pg.hotkey("ctrl", "pagedown")
fast(5.9, "intro") # A bit brutal, could use more refinements (using `sleep`)
# Scenario
meet_luna = [
Become(PonyKind.HORN),
BringBalloon(),
LearnSpell(),
Vinyl(),
Trixie(),
Become(PonyKind.WING),
PinkiePie(),
Fluttershy(),
Derpy(),
Goto(luna_viewpoint),
]
meet_luna_alt = [
LearnSpell(),
BreakBoulder(),
GetMoney(2),
BringBalloon(),
BuyMuffin(),
EatMuffin(),
HelpSpike(),
Zecora(),
Twilight(),
PinkiePie(),
Fluttershy(),
Vinyl(),
Goto(luna_viewpoint),
]
# Get money and use it
apple_road = [
LearnSpell(),
BreakBoulder(),
GetMoney(2),
BuyMuffin(),
EatMuffin(),
HelpSpike(),
]
# Get twilight's book and give it back
twibook = [
BringBalloon(),
LearnSpell(),
Become(PonyKind.HORN),
DanceWithScarecrow(),
GetTransformationBook(),
Trixie(),
Goto(tree_house),
]
# Get Trixie twice
trixie_twice = [
LearnSpell(),
BreakBoulder(),
GetMoney(1),
BringBalloon(),
BuyMuffin(),
EatMuffin(),
DanceWithScarecrow(),
Trixie(),
DanceWithScarecrow(),
TrixieAgain(),
]
more_bullshit = [
# time 0
BringBalloon(),
BringWineBottle(), ##
LearnSpell(),
Become(PonyKind.HORN),
Vinyl(), # time 1
VinylRemixingTime(), ##
FluttershySoManyWonders(), ##
GetTransformationBook(),
DanceWithScarecrow(), # time 2
BringTransformationBook(), ##
PinkiePie(), # time 3
DanceWithScarecrow(), # time 4
PinkiePieGoodbyeEquestria(), ##
BreakBoulder(),
CutieMarkCrusaders(), ##
Chrysalis(), # early end
]
main_six = [
Become(PonyKind.WING),
RainbowDash(), # get Rainbow Dash
Fluttershy(),
BringBalloon(),
LearnSpell(),
BreakBoulder(),
GetMoney(3),
HelpSpike(),
Applejack(),
Twilight(),
RarityService(),
PinkiePie(),
Rarity(),
]
main_six_with_more_bullshit = [
BringBalloon(),
BringWineBottle(), ##
LearnSpell(),
BreakBoulder(),
CutieMarkCrusaders(), ##
GetMoney(3),
HelpSpike(),
RainbowDash(),
Twilight(),
Become(PonyKind.HORN),
PinkiePie(),
GetTransformationBook(),
Fluttershy(),
PinkiePieGoodbyeEquestria(), ##
BringTransformationBook(), ##
RarityService(),
Applejack(),
Rarity(),
###
# VinylRemixingTime and FluttershySoManyWonders cannot be obtained
# simultaneously to the main six ending
]
def plan_and_run(*args):
# planning
st = State(home, PonyKind.EARTH, 0, 0, dict(), set())
for sequence in args:
sequence.simulate(st)
# running
sleep(0.5)
place_window(window_title=WINDOW_TITLE)
# reload()
beginning = time.time()
st = State(home, PonyKind.EARTH, 0, 0, dict(), set())
for sequence in args:
assert "end" not in st.status
sequence.run(st)
end = time.time()
print(f"time: {end - beginning}")
###
try:
# breakpoint()
plan_and_run(*main_six_with_more_bullshit)
except (KeyboardInterrupt, pg.FailSafeException):
print("interrupted")
except Exception:
raise
# import traceback, pdb
# traceback.print_exc()
# pdb.post_mortem()
# finally:
# breakpoint()