|
@@ -1,4 +1,5 @@
|
1
|
1
|
#include <pokeagb/pokeagb.h>
|
|
2
|
+#include <agb_debug.h>
|
2
|
3
|
|
3
|
4
|
void battle_intro_launch(u8 environment) {
|
4
|
5
|
TaskCallback introTask;
|
|
@@ -19,13 +20,14 @@ u8 battle_trainer_build_party(struct Pokemon *party, u16 tid) {
|
19
|
20
|
if(tid == 0x400)
|
20
|
21
|
return 0;
|
21
|
22
|
//ignore some type of battles like old man or trainer tower where the party is determined otherwise
|
|
23
|
+ dprintf("battle_type_flags: %x, tid: %d\n", battle_type_flags, tid);
|
22
|
24
|
if ((battle_type_flags & 0x80908) == 8) {
|
23
|
25
|
party_opponent_purge();
|
24
|
26
|
for(u8 i = 0; i < trainer_data[tid].party_size; ++i) {
|
25
|
27
|
u32 personalityValue;
|
26
|
28
|
if(trainer_data[tid].is_double)
|
27
|
29
|
personalityValue = 0x80;
|
28
|
|
- else if (trainer_data[tid].gender)
|
|
30
|
+ else if (trainer_data[tid].gender & 0x80)
|
29
|
31
|
personalityValue = 0x78;
|
30
|
32
|
else
|
31
|
33
|
personalityValue = 0x88;
|
|
@@ -41,8 +43,11 @@ u8 battle_trainer_build_party(struct Pokemon *party, u16 tid) {
|
41
|
43
|
{
|
42
|
44
|
//nothing
|
43
|
45
|
const struct TrainerPokemonBase *pokeData = (const struct TrainerPokemonBase*)(trainer_data[tid].party);
|
44
|
|
- for(u8 j = 0; pokemon_names[pokeData[i].species][j] != 0xFF; ++j)
|
|
46
|
+ dprintf("making pokemon with species: %d, struct: 0x%x\n", pokeData[i].species, pokeData);
|
|
47
|
+ for(u8 j = 0; pokemon_names[pokeData[i].species][j] != 0xFF; ++j) {
|
45
|
48
|
nameHash += pokemon_names[pokeData[i].species][j];
|
|
49
|
+ }
|
|
50
|
+
|
46
|
51
|
personalityValue += nameHash << 8;
|
47
|
52
|
u8 iv = pokeData[i].iv * 31 / 255;
|
48
|
53
|
|
|
@@ -53,6 +58,7 @@ u8 battle_trainer_build_party(struct Pokemon *party, u16 tid) {
|
53
|
58
|
case TRAINER_PARTY_MOVESET:
|
54
|
59
|
{
|
55
|
60
|
const struct TrainerPokemonMoves *pokeData = (const struct TrainerPokemonMoves*)(trainer_data[tid].party);
|
|
61
|
+ dprintf("making pokemon with species: %d\n", pokeData[i].base.species);
|
56
|
62
|
//custom moveset
|
57
|
63
|
for(u8 j = 0; pokemon_names[pokeData[i].base.species][j] != 0xFF; ++j)
|
58
|
64
|
nameHash += pokemon_names[pokeData[i].base.species][j];
|
|
@@ -68,7 +74,9 @@ u8 battle_trainer_build_party(struct Pokemon *party, u16 tid) {
|
68
|
74
|
case TRAINER_PARTY_HELD_ITEM:
|
69
|
75
|
{
|
70
|
76
|
//custom item
|
|
77
|
+
|
71
|
78
|
const struct TrainerPokemonBase *pokeData = (const struct TrainerPokemonBase*)(trainer_data[tid].party);
|
|
79
|
+ dprintf("making pokemon with species: %d\n", pokeData[i].species);
|
72
|
80
|
for(u8 j = 0; pokemon_names[pokeData[i].species][j] != 0xFF; ++j)
|
73
|
81
|
nameHash += pokemon_names[pokeData[i].species][j];
|
74
|
82
|
personalityValue += nameHash << 8;
|
|
@@ -81,7 +89,8 @@ u8 battle_trainer_build_party(struct Pokemon *party, u16 tid) {
|
81
|
89
|
case TRAINER_PARTY_HELD_ITEM | TRAINER_PARTY_MOVESET:
|
82
|
90
|
{
|
83
|
91
|
//custom all the things
|
84
|
|
- const struct TrainerPokemonMoves *pokeData = (const struct TrainerPokemonMoves*)(trainer_data[tid].party);
|
|
92
|
+ const struct TrainerPokemonMoves *pokeData = (const struct TrainerPokemonMoves*)(trainer_data[tid].party);
|
|
93
|
+ dprintf("making pokemon with species: %d\n", pokeData[i].base.species);
|
85
|
94
|
for(u8 j = 0; pokemon_names[pokeData[i].base.species][j] != 0xFF; ++j)
|
86
|
95
|
nameHash += pokemon_names[pokeData[i].base.species][j];
|
87
|
96
|
personalityValue += nameHash << 8;
|