|
@@ -3,8 +3,11 @@
|
3
|
3
|
#include <bpre.h>
|
4
|
4
|
#include <debug.h>
|
5
|
5
|
#include <battle_initiative.h>
|
|
6
|
+#include <abilities.h>
|
6
|
7
|
|
7
|
|
-void test_battle() {
|
|
8
|
+#define TEST_AMOUNT 10000
|
|
9
|
+
|
|
10
|
+void test_speed() {
|
8
|
11
|
print("Initiating Initiative Unit\nTest...\n");
|
9
|
12
|
u8 pass = true;
|
10
|
13
|
battle_participants[0].spd = 10;
|
|
@@ -58,10 +61,185 @@ void test_battle() {
|
58
|
61
|
pass = false;
|
59
|
62
|
print("\xFE\x2 fail\n\xFE\x0");
|
60
|
63
|
}
|
|
64
|
+
|
|
65
|
+ battle_participants[1].ability_id = ABILITY_STALL;
|
|
66
|
+ print("stall test (+tr): ");
|
|
67
|
+ result = get_first_to_strike(0, 1, 0);
|
|
68
|
+ if (result == ONE)
|
|
69
|
+ print("\xFE\x1 pass\n\xFE\x0");
|
|
70
|
+ else {
|
|
71
|
+ pass = false;
|
|
72
|
+ print("\xFE\x2 fail\n\xFE\x0");
|
|
73
|
+ }
|
|
74
|
+ custom_battle_elements.ptr->field_affecting.trick_room = 0;
|
|
75
|
+ print("stall test (-tr): ");
|
61
|
76
|
|
|
77
|
+ result = get_first_to_strike(0, 1, 0);
|
|
78
|
+ if (result == ONE)
|
|
79
|
+ print("\xFE\x1 pass\n\xFE\x0");
|
|
80
|
+ else {
|
|
81
|
+ pass = false;
|
|
82
|
+ print("\xFE\x2 fail\n\xFE\x0");
|
|
83
|
+ }
|
|
84
|
+
|
|
85
|
+ battle_participants[1].ability_id = 0;
|
|
86
|
+
|
|
87
|
+ print("\nPRESS A TO CONTINUE...");
|
62
|
88
|
wait_for_btn(1);
|
63
|
89
|
debug_clean();
|
64
|
|
-
|
|
90
|
+
|
|
91
|
+ print("speed value tests...\n");
|
|
92
|
+ battle_participants[0].spd = 75;
|
|
93
|
+ battle_participants[1].spd = 60;
|
|
94
|
+ printf("bank_one.spd: %d\n", battle_participants[0].spd);
|
|
95
|
+ printf("bank_two.spd: %d\n", battle_participants[1].spd);
|
|
96
|
+ u16 speed_one = get_speed(0);
|
|
97
|
+ u16 speed_two = get_speed(1);
|
|
98
|
+ printf("unaffected speed: %d", speed_one);
|
|
99
|
+ printf(": %d", speed_two);
|
|
100
|
+ if (speed_one == 75 && speed_two == 60) {
|
|
101
|
+ print(" \xFE\x1pass\xFE\x0\n");
|
|
102
|
+ } else {
|
|
103
|
+ print("\xFE\x02 fail\xFE\x0\n");
|
|
104
|
+ pass = false;
|
|
105
|
+ }
|
|
106
|
+ battle_participants[0].status.flags.paralysis = 1;
|
|
107
|
+ battle_participants[1].status.flags.paralysis = 1;
|
|
108
|
+ speed_one = get_speed(0);
|
|
109
|
+ speed_two = get_speed(1);
|
|
110
|
+ printf("para speed: %d", speed_one);
|
|
111
|
+ printf(": %d", speed_two);
|
|
112
|
+
|
|
113
|
+ if (speed_one == 18 && speed_two == 15) {
|
|
114
|
+ print(" \xFE\x1pass\xFE\x0\n");
|
|
115
|
+ } else {
|
|
116
|
+ print("\xFE\x02 fail\xFE\x0\n");
|
|
117
|
+ pass = false;
|
|
118
|
+ }
|
|
119
|
+ battle_participants[0].spd_buff = 12;
|
|
120
|
+ battle_participants[1].spd_buff = 12;
|
|
121
|
+ speed_one = get_speed(0);
|
|
122
|
+ speed_two = get_speed(1);
|
|
123
|
+
|
|
124
|
+ printf("para/speed+6: %d", speed_one);
|
|
125
|
+ printf(": %d", speed_two);
|
|
126
|
+
|
|
127
|
+ if (speed_one == 75 && speed_two == 60) {
|
|
128
|
+ print(" \xFE\x1pass\xFE\x0\n");
|
|
129
|
+ } else {
|
|
130
|
+ print("\xFE\x02 fail\xFE\x0\n");
|
|
131
|
+ pass = false;
|
|
132
|
+ }
|
|
133
|
+ battle_participants[0].status.flags.paralysis = 0;
|
|
134
|
+ battle_participants[1].status.flags.paralysis = 0;
|
|
135
|
+ speed_one = get_speed(0);
|
|
136
|
+ speed_two = get_speed(1);
|
|
137
|
+
|
|
138
|
+ printf("speed+6: %d", speed_one);
|
|
139
|
+ printf(": %d", speed_two);
|
|
140
|
+
|
|
141
|
+ if (speed_one == 300 && speed_two == 240) {
|
|
142
|
+ print(" \xFE\x1pass\xFE\x0\n");
|
|
143
|
+ } else {
|
|
144
|
+ print("\xFE\x02 fail\xFE\x0\n");
|
|
145
|
+ pass = false;
|
|
146
|
+ }
|
|
147
|
+
|
|
148
|
+ battle_participants[0].spd_buff = 3;
|
|
149
|
+ battle_participants[1].spd_buff = 3;
|
|
150
|
+ speed_one = get_speed(0);
|
|
151
|
+ speed_two = get_speed(1);
|
|
152
|
+
|
|
153
|
+ printf("speed-3: %d", speed_one);
|
|
154
|
+ printf(": %d", speed_two);
|
|
155
|
+
|
|
156
|
+ if (speed_one == 30 && speed_two == 24) {
|
|
157
|
+ print(" \xFE\x1pass\xFE\x0\n");
|
|
158
|
+ } else {
|
|
159
|
+ print("\xFE\x02 fail\xFE\x0\n");
|
|
160
|
+ pass = false;
|
|
161
|
+ }
|
|
162
|
+
|
|
163
|
+ battle_participants[0].spd_buff = 6;
|
|
164
|
+ battle_participants[1].spd_buff = 6;
|
|
165
|
+ print("activating chemtrails...\n");
|
|
166
|
+ battle_weather.flags.rain = 1;
|
|
167
|
+ battle_weather.flags.sun = 1;
|
|
168
|
+ battle_weather.flags.sandstorm = 1;
|
|
169
|
+ u8 weather_pass = true;
|
|
170
|
+ battle_participants[0].ability_id = ABILITY_CHLOROPHYLL;
|
|
171
|
+ speed_one = get_speed(0);
|
|
172
|
+ if (speed_one != 150)
|
|
173
|
+ weather_pass = false;
|
|
174
|
+ battle_participants[0].ability_id = ABILITY_SWIFT_SWIM;
|
|
175
|
+ speed_one = get_speed(0);
|
|
176
|
+ if (speed_one != 150)
|
|
177
|
+ weather_pass = false;
|
|
178
|
+ battle_participants[0].ability_id = ABILITY_SAND_RUSH;
|
|
179
|
+ battle_participants[1].ability_id = ABILITY_SAND_RUSH;
|
|
180
|
+ speed_one = get_speed(0);
|
|
181
|
+ if (speed_one != 150)
|
|
182
|
+ weather_pass = false;
|
|
183
|
+ print("weather test:");
|
|
184
|
+ print(weather_pass ? "\xFE\x1 pass\xFE\x0\n" : "\xFE\x2 fail\xFE\x0\n");
|
|
185
|
+ if (!weather_pass)
|
|
186
|
+ pass = false;
|
|
187
|
+
|
|
188
|
+ print("tailwind + weather: ");
|
|
189
|
+ custom_battle_elements.ptr->side_affecting[0].tailwind = 1;
|
|
190
|
+ custom_battle_elements.ptr->side_affecting[0].tailwind_bank = 0;
|
|
191
|
+ custom_battle_elements.ptr->side_affecting[1].tailwind = 1;
|
|
192
|
+ custom_battle_elements.ptr->side_affecting[1].tailwind_bank = 1;
|
|
193
|
+ speed_one = get_speed(0);
|
|
194
|
+ speed_two = get_speed(1);
|
|
195
|
+
|
|
196
|
+ if (speed_one == 300 && speed_two == 240) {
|
|
197
|
+ print(" \xFE\x1pass\xFE\x0\n");
|
|
198
|
+ } else {
|
|
199
|
+ print("\xFE\x02 fail\xFE\x0\n");
|
|
200
|
+ pass = false;
|
|
201
|
+ }
|
|
202
|
+ custom_battle_elements.ptr->side_affecting[0].tailwind = 0;
|
|
203
|
+ custom_battle_elements.ptr->side_affecting[0].tailwind_bank = 0;
|
|
204
|
+ custom_battle_elements.ptr->side_affecting[1].tailwind = 0;
|
|
205
|
+ custom_battle_elements.ptr->side_affecting[1].tailwind_bank = 0;
|
|
206
|
+ battle_weather.flags.rain = 0;
|
|
207
|
+ battle_weather.flags.sun = 0;
|
|
208
|
+ battle_weather.flags.sandstorm = 0;
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+ print("quick feet: ");
|
|
212
|
+ battle_participants[0].ability_id = ABILITY_QUICK_FEET;
|
|
213
|
+ battle_participants[1].ability_id = ABILITY_QUICK_FEET;
|
|
214
|
+ battle_participants[0].status.flags.paralysis = 1;
|
|
215
|
+ battle_participants[1].status.flags.poison = 1;
|
|
216
|
+
|
|
217
|
+ speed_one = get_speed(0);
|
|
218
|
+ speed_two = get_speed(1);
|
|
219
|
+ u8 quick_feet_pass = true;
|
|
220
|
+ if (speed_one == 112 && speed_two == 90) {
|
|
221
|
+ battle_participants[0].status.flags.sleep = 1;
|
|
222
|
+ battle_participants[1].status.flags.poison = 0;
|
|
223
|
+ battle_participants[0].status.flags.paralysis = 0;
|
|
224
|
+ speed_one = get_speed(0);
|
|
225
|
+ speed_two = get_speed(1);
|
|
226
|
+ if (!(speed_one == 75 && speed_two == 60)) {
|
|
227
|
+ quick_feet_pass = false;
|
|
228
|
+ }
|
|
229
|
+ } else
|
|
230
|
+ quick_feet_pass = false;
|
|
231
|
+
|
|
232
|
+ if (quick_feet_pass) {
|
|
233
|
+ print(" \xFE\x1pass\xFE\x0\n");
|
|
234
|
+ } else {
|
|
235
|
+ print("\xFE\x02 fail\xFE\x0\n");
|
|
236
|
+ pass = false;
|
|
237
|
+ }
|
|
238
|
+ battle_participants[0].status.flags.sleep = 0;
|
|
239
|
+ battle_participants[0].ability_id = 0;
|
|
240
|
+ battle_participants[1].ability_id = 0;
|
|
241
|
+ wait_for_btn(8);
|
|
242
|
+ debug_clean();
|
65
|
243
|
//stress
|
66
|
244
|
battle_participants[0].spd = 20;
|
67
|
245
|
battle_participants[1].spd = 20;
|
|
@@ -69,23 +247,32 @@ void test_battle() {
|
69
|
247
|
printf("bank_two.spd: %d\n", battle_participants[1].spd);
|
70
|
248
|
int count_one = 0;
|
71
|
249
|
int count_two = 0;
|
72
|
|
- for (int i = 0; i < 5000; ++i) {
|
|
250
|
+ for (int i = 0; i < TEST_AMOUNT; ++i) {
|
73
|
251
|
result = get_first_to_strike(0, 1, 0);
|
74
|
252
|
if (result == ONE)
|
75
|
253
|
count_one++;
|
76
|
254
|
else
|
77
|
255
|
count_two++;
|
78
|
256
|
}
|
|
257
|
+
|
79
|
258
|
printf("tie stress test...\ncount \xFE\x1%d\xFE\x0 / ", count_one);
|
80
|
259
|
printf(" \xFE\x2%d\xFE\x0\n", count_two);
|
|
260
|
+ int ratio_one = (count_one * 100) / TEST_AMOUNT;
|
|
261
|
+ int ratio_two = (count_two * 100) / TEST_AMOUNT;
|
|
262
|
+ printf("%d%% / ", ratio_one);
|
|
263
|
+ printf("%d%%\n", ratio_two);
|
|
264
|
+ print("\nPRESS A TO CONTINUE...");
|
|
265
|
+
|
81
|
266
|
wait_for_btn(1);
|
82
|
267
|
debug_clean();
|
83
|
|
- if(pass)
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+ if (pass)
|
84
|
271
|
set_debug_background(0x3E0);
|
85
|
272
|
else
|
86
|
|
- set_debug_background(0x31);
|
|
273
|
+ set_debug_background(0x1F);
|
87
|
274
|
print("test complete\n(entering deadlock)");
|
88
|
|
- while(true)
|
89
|
|
- {}
|
|
275
|
+ while (true) {
|
|
276
|
+ }
|
90
|
277
|
return;
|
91
|
278
|
}
|