|
@@ -36,9 +36,13 @@
|
36
|
36
|
#include <pokemon.h>
|
37
|
37
|
#include <pkmn_types.h>
|
38
|
38
|
|
39
|
|
-#define EVO_NULL {0,0,0, {false, 0}}
|
|
39
|
+#define EVO_NULL \
|
|
40
|
+ { \
|
|
41
|
+ 0, 0, 0, { false, 0 } \
|
|
42
|
+ }
|
40
|
43
|
#define MAX_EVOLUTIONS 5
|
41
|
|
-#define EVO_NO_EVO (struct evo_result){false,false,0}
|
|
44
|
+#define EVO_NO_EVO \
|
|
45
|
+ (struct evo_result) { false, false, 0 }
|
42
|
46
|
|
43
|
47
|
#define HAPPY_BOUND 219
|
44
|
48
|
#define BEAUTY_BOUND 170
|
|
@@ -68,7 +72,7 @@
|
68
|
72
|
#define EVO_LEVEL_VAR 21
|
69
|
73
|
#define EVO_LEVEL_MOVE 22
|
70
|
74
|
#define EVO_LEVEL_POKEMON 23
|
71
|
|
-#define EVO_LEVEL_TYPE 24
|
|
75
|
+#define EVO_LEVEL_TYPE 24
|
72
|
76
|
#define EVO_LEVEL_MOVE_TYPE 25
|
73
|
77
|
#define EVO_MEGA_ONE 26
|
74
|
78
|
#define EVO_MEGA_TWO 27
|
|
@@ -89,8 +93,8 @@ struct evo_information
|
89
|
93
|
u16 evolve_to;
|
90
|
94
|
struct
|
91
|
95
|
{
|
92
|
|
- u16 gender: 2;
|
93
|
|
- u16 versatile: 14;
|
|
96
|
+ u16 gender : 2;
|
|
97
|
+ u16 versatile : 14;
|
94
|
98
|
} argument_2;
|
95
|
99
|
};
|
96
|
100
|
|
|
@@ -102,9 +106,9 @@ struct evo_result
|
102
|
106
|
};
|
103
|
107
|
|
104
|
108
|
struct evo_information evolutions[][MAX_EVOLUTIONS] = {
|
105
|
|
- {EVO_NULL,EVO_NULL,EVO_NULL,EVO_NULL,EVO_NULL}, //Nothing
|
106
|
|
- {{EVO_LEVEL_MOVE_TYPE,7,20,{GENDER_DC, TYPE_GRASS}},EVO_NULL,EVO_NULL,EVO_NULL,EVO_NULL}, //BISASAM
|
107
|
|
- {{EVO_LEVEL_UP,32,3,{GENDER_DC, 0}},EVO_NULL,EVO_NULL,EVO_NULL,EVO_NULL},//BISAKNOSP
|
|
109
|
+ {EVO_NULL, EVO_NULL, EVO_NULL, EVO_NULL, EVO_NULL}, //Nothing
|
|
110
|
+ {{EVO_LEVEL_MOVE_TYPE, 7, 20, {GENDER_DC, TYPE_GRASS}}, EVO_NULL, EVO_NULL, EVO_NULL, EVO_NULL}, //BISASAM
|
|
111
|
+ {{EVO_LEVEL_UP, 32, 3, {GENDER_DC, 0}}, EVO_NULL, EVO_NULL, EVO_NULL, EVO_NULL}, //BISAKNOSP
|
108
|
112
|
};
|
109
|
113
|
|
110
|
114
|
struct evo_call_arguments
|
|
@@ -113,7 +117,7 @@ struct evo_call_arguments
|
113
|
117
|
u16 level;
|
114
|
118
|
enum evo_source source;
|
115
|
119
|
u16 stoneId;
|
116
|
|
- struct pokemon* poke;
|
|
120
|
+ struct pokemon *poke;
|
117
|
121
|
struct evo_information evolution;
|
118
|
122
|
};
|
119
|
123
|
|
|
@@ -124,18 +128,18 @@ struct evo_result evolve_by_level(struct evo_call_arguments arguments)
|
124
|
128
|
u8 gender = pokemon_get_gender(arguments.poke);
|
125
|
129
|
u8 gender_arg = arguments.evolution.argument_2.gender;
|
126
|
130
|
dprintf("A pokemon with gender value %d\n", gender);
|
127
|
|
- if(gender_arg == 1)
|
|
131
|
+ if (gender_arg == 1)
|
128
|
132
|
{
|
129
|
|
- if(gender)
|
|
133
|
+ if (gender)
|
130
|
134
|
return EVO_NO_EVO;
|
131
|
135
|
}
|
132
|
|
- if(gender_arg == 2)
|
|
136
|
+ if (gender_arg == 2)
|
133
|
137
|
{
|
134
|
|
- if(!gender)
|
|
138
|
+ if (!gender)
|
135
|
139
|
return EVO_NO_EVO;
|
136
|
140
|
}
|
137
|
|
-
|
138
|
|
- if(arguments.evolution.argument <= arguments.level && arguments.source == LEVEL_UP)
|
|
141
|
+
|
|
142
|
+ if (arguments.evolution.argument <= arguments.level && arguments.source == LEVEL_UP)
|
139
|
143
|
{
|
140
|
144
|
return (struct evo_result){true, false, arguments.evolution.evolve_to};
|
141
|
145
|
}
|
|
@@ -147,31 +151,31 @@ struct evo_result evolve_by_level(struct evo_call_arguments arguments)
|
147
|
151
|
|
148
|
152
|
struct evo_result evolve_by_trade_group(struct evo_call_arguments arguments)
|
149
|
153
|
{
|
150
|
|
- if(arguments.source != TRADE)
|
|
154
|
+ if (arguments.source != TRADE)
|
151
|
155
|
{
|
152
|
156
|
return EVO_NO_EVO;
|
153
|
157
|
}
|
154
|
|
- if(arguments.evolution.method == EVO_TRADE_ITEM)
|
|
158
|
+ if (arguments.evolution.method == EVO_TRADE_ITEM)
|
155
|
159
|
{
|
156
|
|
- if(arguments.item != arguments.evolution.argument)
|
|
160
|
+ if (arguments.item != arguments.evolution.argument)
|
157
|
161
|
return (struct evo_result){false, false, 0};
|
158
|
162
|
else
|
159
|
|
- return (struct evo_result){true,true, arguments.evolution.evolve_to};
|
|
163
|
+ return (struct evo_result){true, true, arguments.evolution.evolve_to};
|
160
|
164
|
}
|
161
|
|
- else if(arguments.evolution.method == EVO_TRADE)
|
|
165
|
+ else if (arguments.evolution.method == EVO_TRADE)
|
162
|
166
|
{
|
163
|
167
|
return (struct evo_result){true, false, arguments.evolution.evolve_to};
|
164
|
168
|
}
|
165
|
169
|
else
|
166
|
170
|
{
|
167
|
171
|
dprintf("An invalid trade group method was reached in \"evolve_by_trade_group\"\nmethod: %d", arguments.evolution.method);
|
168
|
|
- return (struct evo_result){false,false,0};
|
|
172
|
+ return (struct evo_result){false, false, 0};
|
169
|
173
|
}
|
170
|
174
|
}
|
171
|
175
|
|
172
|
176
|
struct evo_result evolve_random(struct evo_call_arguments arguments)
|
173
|
|
-{
|
174
|
|
- if(arguments.source != LEVEL_UP)
|
|
177
|
+{
|
|
178
|
+ if (arguments.source != LEVEL_UP)
|
175
|
179
|
{
|
176
|
180
|
return EVO_NO_EVO;
|
177
|
181
|
}
|
|
@@ -179,16 +183,16 @@ struct evo_result evolve_random(struct evo_call_arguments arguments)
|
179
|
183
|
pid = pid & 0xFFFF;
|
180
|
184
|
u8 mod = __aeabi_uidivmod(pid, 10);
|
181
|
185
|
dprintf("A pokemon tries to evolve at random: pid: %d, low: %d, mod: %d\n", pid, pid, mod);
|
182
|
|
- if(mod >= 5)
|
|
186
|
+ if (mod >= 5)
|
183
|
187
|
{
|
184
|
|
- if(arguments.evolution.method == EVO_PERSO_HIGH)
|
|
188
|
+ if (arguments.evolution.method == EVO_PERSO_HIGH)
|
185
|
189
|
return (struct evo_result){true, false, arguments.evolution.evolve_to};
|
186
|
190
|
else
|
187
|
191
|
return EVO_NO_EVO;
|
188
|
192
|
}
|
189
|
193
|
else
|
190
|
194
|
{
|
191
|
|
- if(arguments.evolution.method == EVO_PERSO_LOW)
|
|
195
|
+ if (arguments.evolution.method == EVO_PERSO_LOW)
|
192
|
196
|
return (struct evo_result){true, false, arguments.evolution.evolve_to};
|
193
|
197
|
else
|
194
|
198
|
return EVO_NO_EVO;
|
|
@@ -199,29 +203,29 @@ struct evo_result evolve_by_stone(struct evo_call_arguments arguments)
|
199
|
203
|
{
|
200
|
204
|
u8 gender = pokemon_get_gender(arguments.poke);
|
201
|
205
|
u8 gender_arg = arguments.evolution.argument_2.gender;
|
202
|
|
-
|
203
|
|
- if(gender_arg == 1)
|
|
206
|
+
|
|
207
|
+ if (gender_arg == 1)
|
204
|
208
|
{
|
205
|
|
- if(gender)
|
|
209
|
+ if (gender)
|
206
|
210
|
return EVO_NO_EVO;
|
207
|
211
|
}
|
208
|
|
- if(gender_arg == 2)
|
|
212
|
+ if (gender_arg == 2)
|
209
|
213
|
{
|
210
|
|
- if(!gender)
|
|
214
|
+ if (!gender)
|
211
|
215
|
return EVO_NO_EVO;
|
212
|
216
|
}
|
213
|
217
|
|
214
|
|
- if(arguments.source != STONE_EVOLUTION && arguments.source != STONE_REQUEST)
|
|
218
|
+ if (arguments.source != STONE_EVOLUTION && arguments.source != STONE_REQUEST)
|
215
|
219
|
{
|
216
|
|
- return (struct evo_result){false,false, 0};
|
|
220
|
+ return (struct evo_result){false, false, 0};
|
217
|
221
|
}
|
218
|
|
- if(arguments.stoneId == arguments.evolution.argument)
|
|
222
|
+ if (arguments.stoneId == arguments.evolution.argument)
|
219
|
223
|
{
|
220
|
224
|
return (struct evo_result){true, false, arguments.evolution.evolve_to};
|
221
|
225
|
}
|
222
|
226
|
else
|
223
|
227
|
{
|
224
|
|
- return (struct evo_result){false,false,0};
|
|
228
|
+ return (struct evo_result){false, false, 0};
|
225
|
229
|
}
|
226
|
230
|
}
|
227
|
231
|
|
|
@@ -230,17 +234,17 @@ struct evo_result evolve_by_pokemon(struct evo_call_arguments arguments)
|
230
|
234
|
u8 has_required_pokemon = false;
|
231
|
235
|
u16 species_required = arguments.evolution.argument_2.versatile;
|
232
|
236
|
dprintf("Required: %d\n", species_required);
|
233
|
|
- for(int i = 0; i < 6; ++i)
|
|
237
|
+ for (int i = 0; i < 6; ++i)
|
234
|
238
|
{
|
235
|
239
|
u16 current_species = pokemon_get_attribute(&(pokemon_party_player[i]), ATTR_SPECIES, NULL);
|
236
|
240
|
dprintf("Found pkmn: %d\n", current_species);
|
237
|
|
- if(current_species == species_required)
|
|
241
|
+ if (current_species == species_required)
|
238
|
242
|
{
|
239
|
243
|
has_required_pokemon = true;
|
240
|
244
|
break;
|
241
|
245
|
}
|
242
|
246
|
}
|
243
|
|
- if(!has_required_pokemon)
|
|
247
|
+ if (!has_required_pokemon)
|
244
|
248
|
return EVO_NO_EVO;
|
245
|
249
|
return evolve_by_level(arguments);
|
246
|
250
|
}
|
|
@@ -249,27 +253,26 @@ struct evo_result evolve_by_atk_def(struct evo_call_arguments arguments)
|
249
|
253
|
{
|
250
|
254
|
u32 atk = pokemon_get_attribute(arguments.poke, ATTR_ATTACK, NULL);
|
251
|
255
|
|
252
|
|
-
|
253
|
256
|
u32 def = pokemon_get_attribute(arguments.poke, ATTR_DEFENCE, NULL);
|
254
|
257
|
dprintf("A pokemon wants to evolve by atk and def.\n");
|
255
|
258
|
dprintf("Level required: %d, pkmn level: %d, pkmn atk: %d, pkmn def: %d\n", arguments.evolution.argument, arguments.level, atk, def);
|
256
|
|
- if(arguments.evolution.method == EVO_ATK)
|
|
259
|
+ if (arguments.evolution.method == EVO_ATK)
|
257
|
260
|
{
|
258
|
|
- if(atk > def)
|
|
261
|
+ if (atk > def)
|
259
|
262
|
return evolve_by_level(arguments);
|
260
|
263
|
else
|
261
|
264
|
return EVO_NO_EVO;
|
262
|
265
|
}
|
263
|
|
- if(arguments.evolution.method == EVO_DEF)
|
|
266
|
+ if (arguments.evolution.method == EVO_DEF)
|
264
|
267
|
{
|
265
|
|
- if(def > atk)
|
|
268
|
+ if (def > atk)
|
266
|
269
|
return evolve_by_level(arguments);
|
267
|
270
|
else
|
268
|
271
|
return EVO_NO_EVO;
|
269
|
272
|
}
|
270
|
|
- if(arguments.evolution.method == EVO_ADEQU)
|
|
273
|
+ if (arguments.evolution.method == EVO_ADEQU)
|
271
|
274
|
{
|
272
|
|
- if(atk == def)
|
|
275
|
+ if (atk == def)
|
273
|
276
|
return evolve_by_level(arguments);
|
274
|
277
|
else
|
275
|
278
|
return EVO_NO_EVO;
|
|
@@ -283,21 +286,21 @@ struct evo_result evolve_by_type(struct evo_call_arguments arguments)
|
283
|
286
|
u8 has_required_pokemon = false;
|
284
|
287
|
u16 type_required = arguments.evolution.argument_2.versatile;
|
285
|
288
|
dprintf("Required: %d\n", type_required);
|
286
|
|
- for(int i = 0; i < 6; ++i)
|
|
289
|
+ for (int i = 0; i < 6; ++i)
|
287
|
290
|
{
|
288
|
291
|
u16 current_species = pokemon_get_attribute(&(pokemon_party_player[i]), ATTR_SPECIES, NULL);
|
289
|
|
- if(current_species == 0)
|
|
292
|
+ if (current_species == 0)
|
290
|
293
|
continue;
|
291
|
294
|
u8 type_one = pokemon_stats[current_species].type_one;
|
292
|
295
|
u8 type_two = pokemon_stats[current_species].type_two;
|
293
|
296
|
dprintf("Found type: %d/%d\n", type_one, type_two);
|
294
|
|
- if(type_one == type_required || type_two == type_required)
|
|
297
|
+ if (type_one == type_required || type_two == type_required)
|
295
|
298
|
{
|
296
|
299
|
has_required_pokemon = true;
|
297
|
300
|
break;
|
298
|
301
|
}
|
299
|
302
|
}
|
300
|
|
- if(!has_required_pokemon)
|
|
303
|
+ if (!has_required_pokemon)
|
301
|
304
|
return EVO_NO_EVO;
|
302
|
305
|
return evolve_by_level(arguments);
|
303
|
306
|
}
|
|
@@ -307,13 +310,13 @@ struct evo_result evolve_by_happiness(struct evo_call_arguments arguments)
|
307
|
310
|
u32 happiness = pokemon_get_attribute(arguments.poke, ATTR_HAPPINESS, NULL);
|
308
|
311
|
dprintf("A pokemon wants to evolve by happiness.\n");
|
309
|
312
|
dprintf("Happiness value: %d; needed: %d\n", happiness, HAPPY_BOUND);
|
310
|
|
- if((happiness > HAPPY_BOUND) && (arguments.source == LEVEL_UP))
|
|
313
|
+ if ((happiness > HAPPY_BOUND) && (arguments.source == LEVEL_UP))
|
311
|
314
|
{
|
312
|
|
- return (struct evo_result){true,false,arguments.evolution.evolve_to};
|
|
315
|
+ return (struct evo_result){true, false, arguments.evolution.evolve_to};
|
313
|
316
|
}
|
314
|
317
|
else
|
315
|
318
|
{
|
316
|
|
- return (struct evo_result){false,false,0};
|
|
319
|
+ return (struct evo_result){false, false, 0};
|
317
|
320
|
}
|
318
|
321
|
}
|
319
|
322
|
|
|
@@ -321,7 +324,7 @@ struct evo_result evolve_by_special_place(struct evo_call_arguments arguments)
|
321
|
324
|
{
|
322
|
325
|
u16 value = var_get(EVO_VAR);
|
323
|
326
|
dprintf("A pokemon tried to evolve using the var evo method: value: %d needed: %d\n", value, arguments.evolution.argument_2.versatile);
|
324
|
|
- if(arguments.evolution.argument_2.versatile != value)
|
|
327
|
+ if (arguments.evolution.argument_2.versatile != value)
|
325
|
328
|
{
|
326
|
329
|
return EVO_NO_EVO;
|
327
|
330
|
}
|
|
@@ -332,22 +335,22 @@ struct evo_result evolve_by_beauty(struct evo_call_arguments arguments)
|
332
|
335
|
{
|
333
|
336
|
u32 beauty = pokemon_get_attribute(arguments.poke, ATTR_BEAUTY, NULL);
|
334
|
337
|
dprintf("A pokemon tires to evolve by beauty: value: %d; required: %d.\n", beauty, BEAUTY_BOUND);
|
335
|
|
- if(beauty > BEAUTY_BOUND && arguments.source == LEVEL_UP)
|
|
338
|
+ if (beauty > BEAUTY_BOUND && arguments.source == LEVEL_UP)
|
336
|
339
|
return evolve_by_level(arguments);
|
337
|
340
|
return EVO_NO_EVO;
|
338
|
341
|
}
|
339
|
342
|
|
340
|
343
|
struct evo_result evolve_by_worn_item(struct evo_call_arguments arguments)
|
341
|
344
|
{
|
342
|
|
-
|
|
345
|
+
|
343
|
346
|
struct evo_result level_result = evolve_by_level(arguments);
|
344
|
|
- if(!level_result.can_evolve)
|
|
347
|
+ if (!level_result.can_evolve)
|
345
|
348
|
return EVO_NO_EVO;
|
346
|
349
|
u16 item_to_wear = arguments.evolution.argument_2.versatile;
|
347
|
350
|
dprintf("A pokemon tried to evolve by item. pkmn_item: %d; argument item: %d", arguments.item, item_to_wear);
|
348
|
|
- if(arguments.item != item_to_wear)
|
|
351
|
+ if (arguments.item != item_to_wear)
|
349
|
352
|
return EVO_NO_EVO;
|
350
|
|
-
|
|
353
|
+
|
351
|
354
|
return (struct evo_result){true, false, arguments.evolution.evolve_to};
|
352
|
355
|
}
|
353
|
356
|
|
|
@@ -371,7 +374,7 @@ struct evo_result evolve_by_move(struct evo_call_arguments arguments)
|
371
|
374
|
u16 move_four = pokemon_get_attribute(arguments.poke, ATTR_ATTACK_4, NULL);
|
372
|
375
|
u16 move_needed = arguments.evolution.argument_2.versatile;
|
373
|
376
|
dprintf("A pokemon tried to evolve using evolve_by_move: needed: %d, one: %d, two: %d, three: %d, four: %d\n", move_needed, move_one, move_two, move_three, move_four);
|
374
|
|
- if((move_one == move_needed) || (move_two == move_needed) || (move_three == move_needed) || (move_four == move_needed))
|
|
377
|
+ if ((move_one == move_needed) || (move_two == move_needed) || (move_three == move_needed) || (move_four == move_needed))
|
375
|
378
|
return evolve_by_level(arguments);
|
376
|
379
|
else
|
377
|
380
|
return EVO_NO_EVO;
|
|
@@ -381,20 +384,20 @@ struct evo_result evolve_by_move_type(struct evo_call_arguments arguments)
|
381
|
384
|
{
|
382
|
385
|
u16 needed_type = arguments.evolution.argument_2.versatile;
|
383
|
386
|
u8 knows_required_move = false;
|
384
|
|
- for(int i = ATTR_ATTACK_1; i <= ATTR_ATTACK_4; ++i)
|
|
387
|
+ for (int i = ATTR_ATTACK_1; i <= ATTR_ATTACK_4; ++i)
|
385
|
388
|
{
|
386
|
389
|
u16 current_move = pokemon_get_attribute(arguments.poke, i, NULL);
|
387
|
|
- if(current_move == 0)
|
|
390
|
+ if (current_move == 0)
|
388
|
391
|
continue;
|
389
|
392
|
u8 current_type = move_table[current_move].type;
|
390
|
393
|
dprintf("found move type: %d on move %d\n", current_type, current_move);
|
391
|
|
- if(current_type == needed_type)
|
|
394
|
+ if (current_type == needed_type)
|
392
|
395
|
{
|
393
|
396
|
knows_required_move = true;
|
394
|
397
|
break;
|
395
|
398
|
}
|
396
|
399
|
}
|
397
|
|
- if(knows_required_move)
|
|
400
|
+ if (knows_required_move)
|
398
|
401
|
return evolve_by_level(arguments);
|
399
|
402
|
else
|
400
|
403
|
return EVO_NO_EVO;
|
|
@@ -413,67 +416,67 @@ struct evo_result evolve_invalid_method(struct evo_call_arguments arguments)
|
413
|
416
|
}
|
414
|
417
|
|
415
|
418
|
static evolution_callback evolution_methods[] =
|
416
|
|
-{
|
417
|
|
- evolve_invalid_method, //Method 0 INVALID
|
418
|
|
- evolve_by_happiness, //Method 1
|
419
|
|
- evolve_invalid_method, //TODO: Happiness DAY Method 2
|
420
|
|
- evolve_invalid_method, //TODO: Happiness NIGHT Method 3
|
421
|
|
- evolve_by_level, //Method 4
|
422
|
|
- evolve_by_trade_group, //Method 5
|
423
|
|
- evolve_by_trade_group, //Method 6
|
424
|
|
- evolve_by_stone, //Method 7
|
425
|
|
- evolve_by_atk_def, //Method 8
|
426
|
|
- evolve_by_atk_def, //Method 9
|
427
|
|
- evolve_by_atk_def, //Method 10
|
428
|
|
- evolve_random, //Method 11
|
429
|
|
- evolve_random, //Method 12
|
430
|
|
- evolve_by_level, //Shedninja SPAWN Method 13
|
431
|
|
- evolve_no_method, //Shedninja SPAWNED //Method 14
|
432
|
|
- evolve_by_beauty, //Method 15
|
433
|
|
- evolve_by_worn_item, //Method 16
|
434
|
|
- evolve_by_worn_item_day, //TODO implement day Method 17
|
435
|
|
- evolve_by_worn_item_night, //TODO implement night Method 18
|
436
|
|
- evolve_invalid_method, //TODO implement level night Method 19
|
437
|
|
- evolve_invalid_method, //TODO implement level day Method 20
|
438
|
|
- evolve_by_special_place, //Method 21
|
439
|
|
- evolve_by_move, //Method 22
|
440
|
|
- evolve_by_pokemon, //Method 23
|
441
|
|
- evolve_by_type, //Method 24
|
442
|
|
- evolve_by_move_type, //Method 25
|
443
|
|
- evolve_no_method, //Method 26
|
444
|
|
- evolve_no_method, //Method 26
|
445
|
|
- evolve_no_method, //Method 26
|
446
|
|
- evolve_no_method, //Method 26
|
|
419
|
+ {
|
|
420
|
+ evolve_invalid_method, //Method 0 INVALID
|
|
421
|
+ evolve_by_happiness, //Method 1
|
|
422
|
+ evolve_invalid_method, //TODO: Happiness DAY Method 2
|
|
423
|
+ evolve_invalid_method, //TODO: Happiness NIGHT Method 3
|
|
424
|
+ evolve_by_level, //Method 4
|
|
425
|
+ evolve_by_trade_group, //Method 5
|
|
426
|
+ evolve_by_trade_group, //Method 6
|
|
427
|
+ evolve_by_stone, //Method 7
|
|
428
|
+ evolve_by_atk_def, //Method 8
|
|
429
|
+ evolve_by_atk_def, //Method 9
|
|
430
|
+ evolve_by_atk_def, //Method 10
|
|
431
|
+ evolve_random, //Method 11
|
|
432
|
+ evolve_random, //Method 12
|
|
433
|
+ evolve_by_level, //Shedninja SPAWN Method 13
|
|
434
|
+ evolve_no_method, //Shedninja SPAWNED //Method 14
|
|
435
|
+ evolve_by_beauty, //Method 15
|
|
436
|
+ evolve_by_worn_item, //Method 16
|
|
437
|
+ evolve_by_worn_item_day, //TODO implement day Method 17
|
|
438
|
+ evolve_by_worn_item_night, //TODO implement night Method 18
|
|
439
|
+ evolve_invalid_method, //TODO implement level night Method 19
|
|
440
|
+ evolve_invalid_method, //TODO implement level day Method 20
|
|
441
|
+ evolve_by_special_place, //Method 21
|
|
442
|
+ evolve_by_move, //Method 22
|
|
443
|
+ evolve_by_pokemon, //Method 23
|
|
444
|
+ evolve_by_type, //Method 24
|
|
445
|
+ evolve_by_move_type, //Method 25
|
|
446
|
+ evolve_no_method, //Method 26
|
|
447
|
+ evolve_no_method, //Method 26
|
|
448
|
+ evolve_no_method, //Method 26
|
|
449
|
+ evolve_no_method, //Method 26
|
447
|
450
|
};
|
448
|
451
|
|
449
|
|
-u16 evolution_try_evolve(struct pokemon* pokemon, enum evo_source source, u16 stoneId)
|
|
452
|
+u16 evolution_try_evolve(struct pokemon *pokemon, enum evo_source source, u16 stoneId)
|
450
|
453
|
{
|
451
|
454
|
u16 held_item = pokemon_get_attribute(pokemon, ATTR_HELD_ITEM, NULL);
|
452
|
455
|
u16 species = pokemon_get_attribute(pokemon, ATTR_SPECIES, NULL);
|
453
|
456
|
u16 level = pokemon_get_attribute(pokemon, ATTR_LEVEL, NULL);
|
454
|
457
|
dprintf("Species %d tried to evolve.\n", species);
|
455
|
458
|
dprintf("Cause: %d\n", source);
|
456
|
|
- if(species > 2)
|
|
459
|
+ if (species > 2)
|
457
|
460
|
{
|
458
|
461
|
dprintf("Currently no evolution possible due to short table!\n");
|
459
|
462
|
return 0;
|
460
|
463
|
}
|
461
|
|
- struct evo_information* current_evolution_structure = evolutions[species];
|
|
464
|
+ struct evo_information *current_evolution_structure = evolutions[species];
|
462
|
465
|
struct evo_result result;
|
463
|
|
- for(int i = 0; i < MAX_EVOLUTIONS; ++i)
|
|
466
|
+ for (int i = 0; i < MAX_EVOLUTIONS; ++i)
|
464
|
467
|
{
|
465
|
|
- if(current_evolution_structure[i].method != 0)
|
|
468
|
+ if (current_evolution_structure[i].method != 0)
|
466
|
469
|
{
|
467
|
470
|
dprintf("found valid evolution with method %d for species %d\n", current_evolution_structure[i].method, species);
|
468
|
471
|
struct evo_call_arguments args = {held_item, level, source, stoneId, pokemon, current_evolution_structure[i]};
|
469
|
472
|
result = evolution_methods[current_evolution_structure[i].method](args);
|
470
|
|
- if(result.can_evolve)
|
|
473
|
+ if (result.can_evolve)
|
471
|
474
|
break;
|
472
|
475
|
}
|
473
|
476
|
}
|
474
|
|
- if(result.can_evolve)
|
|
477
|
+ if (result.can_evolve)
|
475
|
478
|
{
|
476
|
|
- if(result.consume_item)
|
|
479
|
+ if (result.consume_item)
|
477
|
480
|
{
|
478
|
481
|
u16 zero = 0;
|
479
|
482
|
pokemon_set_attribute(pokemon, ATTR_HELD_ITEM, &zero);
|