summaryrefslogtreecommitdiff
path: root/src/egg_hatch.c
diff options
context:
space:
mode:
authorJaceCearK1 <JaceCearK1@users.noreply.github.com>2017-07-01 21:04:18 +0200
committerGitHub <noreply@github.com>2017-07-01 21:04:18 +0200
commit0dd804a99e5455a0eac8ff6ed87d9de16c7380b7 (patch)
tree7b3567978b63ee6548a7b945e075ea8ba37bef51 /src/egg_hatch.c
parentf1344efd2aff92292f58f7323bd9297a38fe9b02 (diff)
parent8d82578d3a101b06f9d2ced31738021007c4e533 (diff)
Merge pull request #1 from pret/master
Update fork to match main fork.
Diffstat (limited to 'src/egg_hatch.c')
-rw-r--r--src/egg_hatch.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/egg_hatch.c b/src/egg_hatch.c
new file mode 100644
index 000000000..32fbe1547
--- /dev/null
+++ b/src/egg_hatch.c
@@ -0,0 +1,52 @@
+#include "global.h"
+#include "pokemon.h"
+
+void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp) {
+ u16 species;
+ u32 personality, pokerus;
+ u8 i, friendship, language, gameMet, markings;
+ u16 moves[4];
+ u32 ivs[6];
+
+
+ species = GetMonData(egg, MON_DATA_SPECIES);
+
+ for (i = 0; i < 4; i++)
+ {
+ moves[i] = GetMonData(egg, MON_DATA_MOVE1 + i);
+ }
+
+ personality = GetMonData(egg, MON_DATA_PERSONALITY);
+
+ for (i = 0; i < 6; i++)
+ {
+ ivs[i] = GetMonData(egg, MON_DATA_HP_IV + i);
+ }
+
+ gameMet = GetMonData(egg, MON_DATA_MET_GAME);
+ markings = GetMonData(egg, MON_DATA_MARKINGS);
+ pokerus = GetMonData(egg, MON_DATA_POKERUS);
+
+ CreateMon(temp, species, 5, 32, TRUE, personality, 0, 0);
+
+ for (i = 0; i < 4; i++)
+ {
+ SetMonData(temp, MON_DATA_MOVE1 + i, (const u8 *) &moves[i]);
+ }
+
+ for (i = 0; i < 6; i++)
+ {
+ SetMonData(temp, MON_DATA_HP_IV + i, (const u8 *) &ivs[i]);
+ }
+
+ language = GAME_LANGUAGE;
+ SetMonData(temp, MON_DATA_LANGUAGE, &language);
+ SetMonData(temp, MON_DATA_MET_GAME, &gameMet);
+ SetMonData(temp, MON_DATA_MARKINGS, &markings);
+
+ friendship = 120;
+ SetMonData(temp, MON_DATA_FRIENDSHIP, &friendship);
+ SetMonData(temp, MON_DATA_POKERUS, (const u8 *) &pokerus);
+
+ *egg = *temp;
+}