|
@@ -32,6 +32,9 @@
|
32
|
32
|
#include <agb_debug.h>
|
33
|
33
|
#include <math.h>
|
34
|
34
|
#include <config.h>
|
|
35
|
+#include <moves.h>
|
|
36
|
+#include <pokemon.h>
|
|
37
|
+#include <pkmn_types.h>
|
35
|
38
|
|
36
|
39
|
#define EVO_NULL {0,0,0, {false, 0}}
|
37
|
40
|
#define MAX_EVOLUTIONS 5
|
|
@@ -40,6 +43,10 @@
|
40
|
43
|
#define HAPPY_BOUND 219
|
41
|
44
|
#define BEAUTY_BOUND 170
|
42
|
45
|
|
|
46
|
+#define GENDER_DC 0
|
|
47
|
+#define GENDER_MALE 1
|
|
48
|
+#define GENDER_FEMALE 2
|
|
49
|
+
|
43
|
50
|
#define EVO_HAPPINESS 1
|
44
|
51
|
#define EVO_LEVEL_UP 4
|
45
|
52
|
#define EVO_TRADE 5
|
|
@@ -60,6 +67,12 @@
|
60
|
67
|
#define EVO_LEVEL_DAY 20
|
61
|
68
|
#define EVO_LEVEL_VAR 21
|
62
|
69
|
#define EVO_LEVEL_MOVE 22
|
|
70
|
+#define EVO_LEVEL_POKEMON 23
|
|
71
|
+#define EVO_LEVEL_TYPE 24
|
|
72
|
+#define EVO_LEVEL_MOVE_TYPE 25
|
|
73
|
+#define EVO_MEGA_ONE 26
|
|
74
|
+#define EVO_MEGA_TWO 27
|
|
75
|
+#define EVO_PROTO 28
|
63
|
76
|
|
64
|
77
|
enum evo_source
|
65
|
78
|
{
|
|
@@ -90,8 +103,8 @@ struct evo_result
|
90
|
103
|
|
91
|
104
|
struct evo_information evolutions[][MAX_EVOLUTIONS] = {
|
92
|
105
|
{EVO_NULL,EVO_NULL,EVO_NULL,EVO_NULL,EVO_NULL}, //Nothing
|
93
|
|
- {{EVO_LEVEL_MOVE,7,2,{0, 336}},EVO_NULL,EVO_NULL,EVO_NULL,EVO_NULL}, //BISASAM
|
94
|
|
- {{EVO_LEVEL_UP,32,3,{0, 0}},EVO_NULL,EVO_NULL,EVO_NULL,EVO_NULL},//BISAKNOSP
|
|
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
|
95
|
108
|
};
|
96
|
109
|
|
97
|
110
|
struct evo_call_arguments
|
|
@@ -212,6 +225,26 @@ struct evo_result evolve_by_stone(struct evo_call_arguments arguments)
|
212
|
225
|
}
|
213
|
226
|
}
|
214
|
227
|
|
|
228
|
+struct evo_result evolve_by_pokemon(struct evo_call_arguments arguments)
|
|
229
|
+{
|
|
230
|
+ u8 has_required_pokemon = false;
|
|
231
|
+ u16 species_required = arguments.evolution.argument_2.versatile;
|
|
232
|
+ dprintf("Required: %d\n", species_required);
|
|
233
|
+ for(int i = 0; i < 6; ++i)
|
|
234
|
+ {
|
|
235
|
+ u16 current_species = pokemon_get_attribute(&(pokemon_party_player[i]), ATTR_SPECIES, NULL);
|
|
236
|
+ dprintf("Found pkmn: %d\n", current_species);
|
|
237
|
+ if(current_species == species_required)
|
|
238
|
+ {
|
|
239
|
+ has_required_pokemon = true;
|
|
240
|
+ break;
|
|
241
|
+ }
|
|
242
|
+ }
|
|
243
|
+ if(!has_required_pokemon)
|
|
244
|
+ return EVO_NO_EVO;
|
|
245
|
+ return evolve_by_level(arguments);
|
|
246
|
+}
|
|
247
|
+
|
215
|
248
|
struct evo_result evolve_by_atk_def(struct evo_call_arguments arguments)
|
216
|
249
|
{
|
217
|
250
|
u32 atk = pokemon_get_attribute(arguments.poke, ATTR_ATTACK, NULL);
|
|
@@ -245,6 +278,30 @@ struct evo_result evolve_by_atk_def(struct evo_call_arguments arguments)
|
245
|
278
|
return EVO_NO_EVO;
|
246
|
279
|
}
|
247
|
280
|
|
|
281
|
+struct evo_result evolve_by_type(struct evo_call_arguments arguments)
|
|
282
|
+{
|
|
283
|
+ u8 has_required_pokemon = false;
|
|
284
|
+ u16 type_required = arguments.evolution.argument_2.versatile;
|
|
285
|
+ dprintf("Required: %d\n", type_required);
|
|
286
|
+ for(int i = 0; i < 6; ++i)
|
|
287
|
+ {
|
|
288
|
+ u16 current_species = pokemon_get_attribute(&(pokemon_party_player[i]), ATTR_SPECIES, NULL);
|
|
289
|
+ if(current_species == 0)
|
|
290
|
+ continue;
|
|
291
|
+ u8 type_one = pokemon_stats[current_species].type_one;
|
|
292
|
+ u8 type_two = pokemon_stats[current_species].type_two;
|
|
293
|
+ dprintf("Found type: %d/%d\n", type_one, type_two);
|
|
294
|
+ if(type_one == type_required || type_two == type_required)
|
|
295
|
+ {
|
|
296
|
+ has_required_pokemon = true;
|
|
297
|
+ break;
|
|
298
|
+ }
|
|
299
|
+ }
|
|
300
|
+ if(!has_required_pokemon)
|
|
301
|
+ return EVO_NO_EVO;
|
|
302
|
+ return evolve_by_level(arguments);
|
|
303
|
+}
|
|
304
|
+
|
248
|
305
|
struct evo_result evolve_by_happiness(struct evo_call_arguments arguments)
|
249
|
306
|
{
|
250
|
307
|
u32 happiness = pokemon_get_attribute(arguments.poke, ATTR_HAPPINESS, NULL);
|
|
@@ -320,6 +377,29 @@ struct evo_result evolve_by_move(struct evo_call_arguments arguments)
|
320
|
377
|
return EVO_NO_EVO;
|
321
|
378
|
}
|
322
|
379
|
|
|
380
|
+struct evo_result evolve_by_move_type(struct evo_call_arguments arguments)
|
|
381
|
+{
|
|
382
|
+ u16 needed_type = arguments.evolution.argument_2.versatile;
|
|
383
|
+ u8 knows_required_move = false;
|
|
384
|
+ for(int i = ATTR_ATTACK_1; i <= ATTR_ATTACK_4; ++i)
|
|
385
|
+ {
|
|
386
|
+ u16 current_move = pokemon_get_attribute(arguments.poke, i, NULL);
|
|
387
|
+ if(current_move == 0)
|
|
388
|
+ continue;
|
|
389
|
+ u8 current_type = move_table[current_move].type;
|
|
390
|
+ dprintf("found move type: %d on move %d\n", current_type, current_move);
|
|
391
|
+ if(current_type == needed_type)
|
|
392
|
+ {
|
|
393
|
+ knows_required_move = true;
|
|
394
|
+ break;
|
|
395
|
+ }
|
|
396
|
+ }
|
|
397
|
+ if(knows_required_move)
|
|
398
|
+ return evolve_by_level(arguments);
|
|
399
|
+ else
|
|
400
|
+ return EVO_NO_EVO;
|
|
401
|
+}
|
|
402
|
+
|
323
|
403
|
struct evo_result evolve_no_method(struct evo_call_arguments arguments)
|
324
|
404
|
{
|
325
|
405
|
//For shedninja
|
|
@@ -356,7 +436,14 @@ static evolution_callback evolution_methods[] =
|
356
|
436
|
evolve_invalid_method, //TODO implement level night Method 19
|
357
|
437
|
evolve_invalid_method, //TODO implement level day Method 20
|
358
|
438
|
evolve_by_special_place, //Method 21
|
359
|
|
- evolve_by_move //Method 22
|
|
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
|
360
|
447
|
};
|
361
|
448
|
|
362
|
449
|
u16 evolution_try_evolve(struct pokemon* pokemon, enum evo_source source, u16 stoneId)
|