diff options
Diffstat (limited to 'include/pokemon.h')
-rw-r--r-- | include/pokemon.h | 385 |
1 files changed, 385 insertions, 0 deletions
diff --git a/include/pokemon.h b/include/pokemon.h new file mode 100644 index 000000000..b1ccf2704 --- /dev/null +++ b/include/pokemon.h @@ -0,0 +1,385 @@ +#ifndef GUARD_POKEMON_H +#define GUARD_POKEMON_H + +#define MON_DATA_PERSONALITY 0 +#define MON_DATA_OT_ID 1 +#define MON_DATA_NICKNAME 2 +#define MON_DATA_LANGUAGE 3 +#define MON_DATA_SANITY_BIT1 4 +#define MON_DATA_SANITY_BIT2 5 +#define MON_DATA_SANITY_BIT3 6 +#define MON_DATA_OT_NAME 7 +#define MON_DATA_MARKINGS 8 +#define MON_DATA_CHECKSUM 9 +#define MON_DATA_10 10 +#define MON_DATA_SPECIES 11 +#define MON_DATA_HELD_ITEM 12 +#define MON_DATA_MOVE1 13 +#define MON_DATA_MOVE2 14 +#define MON_DATA_MOVE3 15 +#define MON_DATA_MOVE4 16 +#define MON_DATA_PP1 17 +#define MON_DATA_PP2 18 +#define MON_DATA_PP3 19 +#define MON_DATA_PP4 20 +#define MON_DATA_PP_BONUSES 21 +#define MON_DATA_COOL 22 +#define MON_DATA_BEAUTY 23 +#define MON_DATA_CUTE 24 +#define MON_DATA_EXP 25 +#define MON_DATA_HP_EV 26 +#define MON_DATA_ATK_EV 27 +#define MON_DATA_DEF_EV 28 +#define MON_DATA_SPD_EV 29 +#define MON_DATA_SPATK_EV 30 +#define MON_DATA_SPDEF_EV 31 +#define MON_DATA_FRIENDSHIP 32 +#define MON_DATA_SMART 33 +#define MON_DATA_POKERUS 34 +#define MON_DATA_MET_LOCATION 35 +#define MON_DATA_MET_LEVEL 36 +#define MON_DATA_MET_GAME 37 +#define MON_DATA_POKEBALL 38 +#define MON_DATA_HP_IV 39 +#define MON_DATA_ATK_IV 40 +#define MON_DATA_DEF_IV 41 +#define MON_DATA_SPD_IV 42 +#define MON_DATA_SPATK_IV 43 +#define MON_DATA_SPDEF_IV 44 +#define MON_DATA_IS_EGG 45 +#define MON_DATA_ALT_ABILITY 46 +#define MON_DATA_TOUGH 47 +#define MON_DATA_SHEEN 48 +#define MON_DATA_OT_GENDER 49 +#define MON_DATA_COOL_RIBBON 50 +#define MON_DATA_BEAUTY_RIBBON 51 +#define MON_DATA_CUTE_RIBBON 52 +#define MON_DATA_SMART_RIBBON 53 +#define MON_DATA_TOUGH_RIBBON 54 +#define MON_DATA_STATUS 55 +#define MON_DATA_LEVEL 56 +#define MON_DATA_HP 57 +#define MON_DATA_MAX_HP 58 +#define MON_DATA_ATK 59 +#define MON_DATA_DEF 60 +#define MON_DATA_SPD 61 +#define MON_DATA_SPATK 62 +#define MON_DATA_SPDEF 63 +#define MON_DATA_64 64 +#define MON_DATA_SPECIES2 65 +#define MON_DATA_IVS 66 +#define MON_DATA_CHAMPION_RIBBON 67 +#define MON_DATA_WINNING_RIBBON 68 +#define MON_DATA_VICTORY_RIBBON 69 +#define MON_DATA_ARTIST_RIBBON 70 +#define MON_DATA_EFFORT_RIBBON 71 +#define MON_DATA_GIFT_RIBBON_1 72 +#define MON_DATA_GIFT_RIBBON_2 73 +#define MON_DATA_GIFT_RIBBON_3 74 +#define MON_DATA_GIFT_RIBBON_4 75 +#define MON_DATA_GIFT_RIBBON_5 76 +#define MON_DATA_GIFT_RIBBON_6 77 +#define MON_DATA_GIFT_RIBBON_7 78 +#define MON_DATA_FATEFUL_ENCOUNTER 79 +#define MON_DATA_KNOWN_MOVES 80 +#define MON_DATA_RIBBON_COUNT 81 +#define MON_DATA_RIBBONS 82 +#define MON_DATA_83 83 +#define MON_DATA_ATK2 84 +#define MON_DATA_DEF2 85 +#define MON_DATA_SPD2 86 +#define MON_DATA_SPATK2 87 +#define MON_DATA_SPDEF2 88 + +#define MON_MALE 0x00 +#define MON_FEMALE 0xFE +#define MON_GENDERLESS 0xFF + +struct PokemonSubstruct0 +{ + u16 species; + u16 heldItem; + u32 experience; + u8 ppBonuses; + u8 friendship; +}; + +struct PokemonSubstruct1 +{ + u16 moves[4]; + u8 pp[4]; +}; + +struct PokemonSubstruct2 +{ + u8 hpEV; + u8 attackEV; + u8 defenseEV; + u8 speedEV; + u8 spAttackEV; + u8 spDefenseEV; + u8 cool; + u8 beauty; + u8 cute; + u8 smart; + u8 tough; + u8 sheen; +}; + +struct PokemonSubstruct3 +{ + u8 pokerus; + u8 metLocation; + + u16 metLevel:7; + u16 metGame:4; + u16 pokeball:4; + u16 otGender:1; + + u32 hpIV:5; + u32 attackIV:5; + u32 defenseIV:5; + u32 speedIV:5; + u32 spAttackIV:5; + u32 spDefenseIV:5; + u32 isEgg:1; + u32 altAbility:1; + + u32 coolRibbon:3; + u32 beautyRibbon:3; + u32 cuteRibbon:3; + u32 smartRibbon:3; + u32 toughRibbon:3; + u32 championRibbon:1; + u32 winningRibbon:1; + u32 victoryRibbon:1; + u32 artistRibbon:1; + u32 effortRibbon:1; + u32 giftRibbon1:1; + u32 giftRibbon2:1; + u32 giftRibbon3:1; + u32 giftRibbon4:1; + u32 giftRibbon5:1; + u32 giftRibbon6:1; + u32 giftRibbon7:1; + u32 fatefulEncounter:5; // unused in Ruby/Sapphire, but the high bit must be set for Mew/Deoxys to obey in FR/LG/Emerald +}; + +union PokemonSubstruct +{ + struct PokemonSubstruct0 type0; + struct PokemonSubstruct1 type1; + struct PokemonSubstruct2 type2; + struct PokemonSubstruct3 type3; + u16 raw[6]; +}; + +struct BoxPokemon +{ + u32 personality; + u32 otId; + u8 nickname[10]; + u8 language; + u8 isBadEgg:1; + u8 sanity2:1; + u8 sanity3:1; + u8 unused:5; + u8 otName[7]; + u8 markings; + u16 checksum; + u16 unknown; + + union + { + u32 raw[12]; + union PokemonSubstruct substructs[4]; + } secure; +}; + +struct Pokemon +{ + struct BoxPokemon box; + u32 status; + u8 level; + u8 pokerus; + u16 hp; + u16 maxHP; + u16 attack; + u16 defense; + u16 speed; + u16 spAttack; + u16 spDefense; +}; + +struct UnknownPokemonStruct +{ + u16 species; + u16 heldItem; + u16 moves[4]; + u8 level; + u8 ppBonuses; + u8 hpEV; + u8 attackEV; + u8 defenseEV; + u8 speedEV; + u8 spAttackEV; + u8 spDefenseEV; + u32 otId; + u32 hpIV:5; + u32 attackIV:5; + u32 defenseIV:5; + u32 speedIV:5; + u32 spAttackIV:5; + u32 spDefenseIV:5; + u32 gap:1; + u32 altAbility:1; + u32 personality; + u8 nickname[11]; + u8 friendship; +}; + +struct BattlePokemon +{ + u16 species; + u16 attack; + u16 defense; + u16 speed; + u16 spAttack; + u16 spDefense; + u16 moves[4]; + u32 hpIV:5; + u32 attackIV:5; + u32 defenseIV:5; + u32 speedIV:5; + u32 spAttackIV:5; + u32 spDefenseIV:5; + u8 hpStage; // not used + u8 attackStage; + u8 defenseStage; + u8 speedStage; + u8 spAttackStage; + u8 spDefenseStage; + u8 accuracyStage; + u8 evasionStage; + u8 ability; + u8 type1, type2; + u8 unknown; + u8 pp[4]; + u16 hp; + u8 level; + u8 friendship; + u16 maxHP; + u16 item; + u8 nickname[11]; + u8 unknown2; + u8 otName[8]; + u32 unknown3; + u32 personality; + u32 status1; + u32 status2; + u32 otId; +}; + +struct BaseStats +{ + u8 baseHP; + u8 baseAttack; + u8 baseDefense; + u8 baseSpeed; + u8 baseSpAttack; + u8 baseSpDefense; + + u8 type1, type2; + + u8 catchRate; + + u8 expYield; + + u16 evYield_HP:2; + u16 evYield_Attack:2; + u16 evYield_Defense:2; + u16 evYield_Speed:2; + u16 evYield_SpAttack:2; + u16 evYield_SpDefense:2; + + u16 item1, item2; + + u8 genderRatio; + + u8 eggCycles; + + u8 friendship; + + u8 growthRate; + + u8 eggGroup1, eggGroup2; + + u8 ability1, ability2; + + u8 safariZoneFleeRate; + + u8 bodyColor; +}; + +struct BattleMove +{ + u8 effect; + u8 power; + u8 type; + u8 accuracy; + u8 pp; + u8 secondaryEffectChance; + u8 target; + u8 priority; + u32 flags; +}; + +void ZeroBoxMonData(struct BoxPokemon *boxMon); +void ZeroMonData(struct Pokemon *mon); +void ZeroPlayerPartyMons(void); +void ZeroEnemyPartyMons(void); +void CreateMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId); +void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId); +void CreateMonWithNature(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 nature); +void CreateMonWithGenderNatureLetter(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 gender, u8 nature, u8 unownLetter); +void CreateMaleMon(struct Pokemon *mon, u16 species, u8 level); +void CreateMonWithIVsPersonality(struct Pokemon *mon, u16 species, u8 level, u32 ivs, u32 personality); +void CreateMonWithIVsOTID(struct Pokemon *mon, u16 species, u8 level, u8 *ivs, u32 otId); +void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 evSpread); +void sub_803ADE8(struct Pokemon *mon, struct UnknownPokemonStruct *src); +void sub_803AF78(struct Pokemon *mon, struct UnknownPokemonStruct *dest); +u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon); +void CalculateMonStats(struct Pokemon *mon); +void sub_803B4B4(struct Pokemon *src, struct Pokemon *dest); +u8 GetLevelFromMonExp(struct Pokemon *mon); +u8 GetLevelFromBoxMonExp(struct BoxPokemon *boxMon); +u16 GiveMoveToMon(struct Pokemon *mon, u16 move); +u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); +u16 GiveMoveToBattleMon(struct BattlePokemon *mon, u16 move); +void SetMonMoveSlot(struct Pokemon *mon, u16 move, u8 slot); +void SetBattleMonMoveSlot(struct BattlePokemon *mon, u16 move, u8 slot); +void GiveMonInitialMoveset(struct Pokemon *mon); +void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon); +u16 sub_803B7C8(struct Pokemon *mon, u8 a2); +void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, u16 move); +void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); + +u8 GetMonGender(struct Pokemon *mon); +u8 GetBoxMonGender(struct BoxPokemon *boxMon); +u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality); +void GetMonSpriteTemplate_803C56C(u16 species, u8 a2); +void GetMonSpriteTemplate_803C5A0(u16 species, u8 a2); +void EncryptBoxMon(struct BoxPokemon *boxMon); +void DecryptBoxMon(struct BoxPokemon *boxMon); +union PokemonSubstruct *GetSubstruct(struct BoxPokemon *boxMon, u32 personality, u8 substructType); +u32 GetMonData(struct Pokemon *mon, s32 field, u8 *data); +u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data); +void SetMonData(struct Pokemon *mon, s32 field, u8 *data); +void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const u8 *data); + +u8 GetNature(struct Pokemon *mon); +u8 GetNatureFromPersonality(u32 personality); + +u16 nature_stat_mod(u8 nature, u16 n, u8 statIndex); + +#endif // GUARD_POKEMON_H |