blob: a8c24026ac6a6de53fbfc0eded24f705b6227307 (
plain)
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
|
"""
Functions to bootstrap the emulator state
"""
from tests.setup_vba import (
vba,
autoplayer,
)
def bootstrap():
"""
Every test needs to be run against a certain minimum context. That context
is constructed by this function.
"""
cry = vba.crystal(config=None)
runner = autoplayer.SpeedRunner(cry=cry)
# skip=False means run the skip_intro function instead of just skipping to
# a saved state.
runner.skip_intro(skip=True)
state = cry.vba.state
# clean everything up again
cry.vba.shutdown()
return state
def bootstrap_trainer_battle():
"""
Start a trainer battle.
"""
# setup
cry = vba.crystal(config=None)
runner = autoplayer.SpeedRunner(cry=cry)
runner.skip_intro(skip=True)
runner.handle_mom(skip=True)
runner.walk_into_new_bark_town(skip=True)
runner.handle_elm("totodile", skip=True)
# levelgrind a pokemon
# TODO: make new_bark_level_grind able to figure out how to construct its
# initial state if none is provided.
runner.new_bark_level_grind(17, skip=True)
cry.givepoke(64, 31, "kAdAbRa")
cry.givepoke(224, 60, "OcTiLlErY")
cry.givepoke(126, 87, "magmar")
cry.start_trainer_battle()
return runner.cry.vba.state
|