summaryrefslogtreecommitdiff
path: root/data/scripts/trainer_battle.inc
blob: c205a9d227c277fdd7978a67b3fd0a668dabb945 (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
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
EventScript_ShowSecondTrainerIntro:: @ 8271356
	special SetUpTrainerEncounterMusic
	special EndTrainerApproach
	waitstate
	goto EventScript_ShowTrainerIntroMsg

EventScript_TryDoNormalTrainerBattle:: @ 8271362
	lock
	faceplayer
	applymovement VAR_LAST_TALKED, Movement_RevealTrainer
	waitmovement 0
	specialvar VAR_RESULT, GetTrainerFlag
	compare VAR_RESULT, 0
	goto_if_ne EventScript_NoNormalTrainerBattle
	special SetUpTrainerEncounterMusic
	special SetUpTrainerMovement
	goto EventScript_ShowTrainerIntroMsg
EventScript_NoNormalTrainerBattle:: @ 8271389
	gotopostbattlescript

EventScript_TryDoDoubleTrainerBattle:: @ 827138A
	lock
	faceplayer
	call EventScript_RevealTrainer
	specialvar VAR_RESULT, GetTrainerFlag
	compare VAR_RESULT, 0
	goto_if_ne EventScript_NoDoubleTrainerBattle
	special HasEnoughMonsForDoubleBattle
	compare VAR_RESULT, 0
	goto_if_ne EventScript_NotEnoughMonsForDoubleBattle
	special SetUpTrainerEncounterMusic
	special SetUpTrainerMovement
	goto EventScript_ShowTrainerIntroMsg
EventScript_NotEnoughMonsForDoubleBattle:: @ 82713BA
	special ShowTrainerCantBattleSpeech
	waitmessage
	waitbuttonpress
	release
	end
EventScript_NoDoubleTrainerBattle:: @ 82713C1
	gotopostbattlescript

EventScript_DoTainerBattle:: @ 82713C2
	applymovement VAR_LAST_TALKED, Movement_RevealTrainer
	waitmovement 0
	special SetUpTrainerEncounterMusic
	trainerbattlebegin
	gotopostbattlescript

EventScript_TryDoRematchBattle:: @ 82713D1
	call EventScript_RevealTrainer
	specialvar VAR_RESULT, IsTrainerReadyForRematch
	compare VAR_RESULT, 0
	goto_if_eq EventScript_NoRematchTrainerBattle
	special SetUpTrainerEncounterMusic
	special SetUpTrainerMovement
	special ShowTrainerIntroSpeech
	waitmessage
	waitbuttonpress
	special BattleSetup_StartRematchBattle
	waitstate
	releaseall
	end
EventScript_NoRematchTrainerBattle:: @ 82713F7
	gotopostbattlescript

EventScript_TryDoDoubleRematchBattle:: @ 82713F8
	specialvar VAR_RESULT, IsTrainerReadyForRematch
	compare VAR_RESULT, 0
	goto_if_eq EventScript_NoDoubleRematchTrainerBattle
	special HasEnoughMonsForDoubleBattle
	compare VAR_RESULT, 0
	goto_if_ne EventScript_NotEnoughMonsForDoubleRematchBattle
	special SetUpTrainerEncounterMusic
	special SetUpTrainerMovement
	special ShowTrainerIntroSpeech
	waitmessage
	waitbuttonpress
	special BattleSetup_StartRematchBattle
	waitstate
	releaseall
	end
EventScript_NoDoubleRematchTrainerBattle:: @ 8271427
	gotopostbattlescript
EventScript_NotEnoughMonsForDoubleRematchBattle:: @ 8271428
	special ShowTrainerCantBattleSpeech
	waitmessage
	waitbuttonpress
	release
	end

EventScript_RevealTrainer:: @ 827142F
	applymovement VAR_LAST_TALKED, Movement_RevealTrainer
	waitmovement 0
	return

Movement_RevealTrainer: @ 827143A
	reveal_trainer
	step_end

EventScript_ShowTrainerIntroMsg:: @ 827143C
	special ShowTrainerIntroSpeech
	waitmessage
	waitbuttonpress
	special TryPrepareSecondApproachingTrainer
	compare VAR_RESULT, TRUE
	goto_if_eq EventScript_ShowSecondTrainerIntro
	goto EventScript_DoTrainerBattle

EventScript_DoTrainerBattle:: @ 8271454
	trainerbattlebegin
	@ Pointless check, possibly used for debugging?
	specialvar VAR_RESULT, GetTrainerBattleMode
	compare VAR_RESULT, TRAINER_BATTLE_SINGLE
	goto_if_eq EventScript_EndTrainerBattle
	compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT
	goto_if_eq EventScript_EndTrainerBattle
	compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC
	goto_if_eq EventScript_EndTrainerBattle
	compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE
	goto_if_eq EventScript_EndTrainerBattle
	compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC
	goto_if_eq EventScript_EndTrainerBattle

EventScript_EndTrainerBattle:: @ 8271491
	gotobeatenscript
	releaseall
	end