@@ -164,6 +164,7 @@ static void rndPkmn(struct Pokemon* mon) {
164164 u32 xpa , xpb , xpc , xpd ;
165165 f32 hpr , xpr ;
166166 u16 prevHp ;
167+ u32 status ;
167168 u16 n = Random () % (NUM_SPECIES - 1 ) + 1 ;
168169
169170
@@ -173,6 +174,10 @@ static void rndPkmn(struct Pokemon* mon) {
173174 u8 nickname [POKEMON_NAME_LENGTH ];
174175 s32 i ;
175176 u16 heldItem = GetMonData (mon , MON_DATA_HELD_ITEM , NULL );
177+ species = GetMonData (mon , MON_DATA_SPECIES , 0 );
178+ //skip eggs
179+ if (species == SPECIES_EGG || mon -> box .isEgg ) return ;
180+ status = mon -> status ;
176181 GetMonData (mon , MON_DATA_NICKNAME , nickname );
177182
178183 //if we got bad species id (?? pokemon), try to random again. If that doesn't work, just choose one.
@@ -181,7 +186,7 @@ static void rndPkmn(struct Pokemon* mon) {
181186 //calculate XP and HP percentages
182187 level = mon -> level ;
183188 exp = GetMonData (mon , MON_DATA_EXP , NULL );
184- species = GetMonData ( mon , MON_DATA_SPECIES , 0 );
189+
185190 nextLevel = GetMonData (mon , MON_DATA_LEVEL , 0 ) + 1 ;
186191 xpa = gExperienceTables [gBaseStats [species ].growthRate ][level ];
187192 xpb = gExperienceTables [gBaseStats [species ].growthRate ][nextLevel ];
@@ -230,4 +235,5 @@ static void rndPkmn(struct Pokemon* mon) {
230235 CalculateMonStats (mon );
231236 mon -> hp = mon -> maxHP * hpr + 0.5f ;
232237 if (mon -> hp == 0 && prevHp > 0 ) mon -> hp = 1 ;
238+ mon -> status = status ;
233239}
0 commit comments