mirror of
https://github.com/pret/pokediamond.git
synced 2026-04-24 23:17:08 -05:00
IVs
This commit is contained in:
parent
7893c319d4
commit
b9643d2bf2
|
|
@ -217,11 +217,11 @@ void BoxPokemon_InitWithParams(BoxPokemon *boxMon, int species, int level, int i
|
|||
}
|
||||
BoxPokemon_SetData(boxMon, MON_DATA_PERSONALITY, &personality);
|
||||
|
||||
if (otIDType == 2) {
|
||||
if (otIDType == OT_ID_RANDOM_NO_SHINY) {
|
||||
do {
|
||||
otID = (LCRandom() | (LCRandom() << 16));
|
||||
} while (SHINY_CHECK(otID, personality));
|
||||
} else if (otIDType != 1) {
|
||||
} else if (otIDType != OT_ID_PRESET) {
|
||||
otID = 0;
|
||||
}
|
||||
BoxPokemon_SetData(boxMon, MON_DATA_OT_ID, &otID);
|
||||
|
|
@ -241,7 +241,7 @@ void BoxPokemon_InitWithParams(BoxPokemon *boxMon, int species, int level, int i
|
|||
var1 = ITEM_POKE_BALL;
|
||||
BoxPokemon_SetData(boxMon, MON_DATA_POKEBALL, &var1);
|
||||
|
||||
if (ivs < 0x20) {
|
||||
if (ivs < INIT_IVS_RANDOM) {
|
||||
BoxPokemon_SetData(boxMon, MON_DATA_HP_IV, &ivs);
|
||||
BoxPokemon_SetData(boxMon, MON_DATA_ATK_IV, &ivs);
|
||||
BoxPokemon_SetData(boxMon, MON_DATA_DEF_IV, &ivs);
|
||||
|
|
@ -250,18 +250,23 @@ void BoxPokemon_InitWithParams(BoxPokemon *boxMon, int species, int level, int i
|
|||
BoxPokemon_SetData(boxMon, MON_DATA_SPDEF_IV, &ivs);
|
||||
} else {
|
||||
var1 = LCRandom();
|
||||
var2 = var1 & 0x1F;
|
||||
var2 = (var1 & (0x1f << 0)) >> 0;
|
||||
BoxPokemon_SetData(boxMon, MON_DATA_HP_IV, &var2);
|
||||
var2 = (var1 & 0x3E0) >> 5;
|
||||
|
||||
var2 = (var1 & (0x1f << 5)) >> 5;
|
||||
BoxPokemon_SetData(boxMon, MON_DATA_ATK_IV, &var2);
|
||||
var2 = (var1 & 0x7C00) >> 10;
|
||||
|
||||
var2 = (var1 & (0x1f << 10)) >> 10;
|
||||
BoxPokemon_SetData(boxMon, MON_DATA_DEF_IV, &var2);
|
||||
|
||||
var1 = LCRandom();
|
||||
var2 = var1 & 0x1F;
|
||||
var2 = (var1 & (0x1f << 0)) >> 0;
|
||||
BoxPokemon_SetData(boxMon, MON_DATA_SPEED_IV, &var2);
|
||||
var2 = (var1 & 0x3E0) >> 5;
|
||||
|
||||
var2 = (var1 & (0x1f << 5)) >> 5;
|
||||
BoxPokemon_SetData(boxMon, MON_DATA_SPATK_IV, &var2);
|
||||
var2 = (var1 & 0x7C00) >> 10;
|
||||
|
||||
var2 = (var1 & (0x1f << 10)) >> 10;
|
||||
BoxPokemon_SetData(boxMon, MON_DATA_SPDEF_IV, &var2);
|
||||
}
|
||||
|
||||
|
|
@ -288,7 +293,7 @@ void Pokemon_InitWithNature(Pokemon *mon, u16 species, u8 level, u8 ivs, u8 natu
|
|||
do {
|
||||
personality = (LCRandom() | (LCRandom() << 16));
|
||||
} while (nature != Personality_GetNature(personality));
|
||||
Pokemon_InitWithParams(mon, species, level, ivs, TRUE, personality, 0, 0);
|
||||
Pokemon_InitWithParams(mon, species, level, ivs, TRUE, personality, OT_ID_PLAYER_ID, 0);
|
||||
}
|
||||
|
||||
void Pokemon_InitWithGenderNatureLetter(Pokemon *mon, u16 species, u8 level, u8 ivs, u8 gender, u8 nature, u8 letter) {
|
||||
|
|
@ -303,7 +308,7 @@ void Pokemon_InitWithGenderNatureLetter(Pokemon *mon, u16 species, u8 level, u8
|
|||
} else {
|
||||
personality = Personality_CreateFromGenderAndNature(species, gender, nature);
|
||||
}
|
||||
Pokemon_InitWithParams(mon, species, level, ivs, TRUE, personality, 0, 0);
|
||||
Pokemon_InitWithParams(mon, species, level, ivs, TRUE, personality, OT_ID_PLAYER_ID, 0);
|
||||
}
|
||||
|
||||
u32 Personality_CreateFromGenderAndNature(u16 species, u8 gender, u8 nature) {
|
||||
|
|
@ -327,7 +332,7 @@ u32 Personality_CreateFromGenderAndNature(u16 species, u8 gender, u8 nature) {
|
|||
}
|
||||
|
||||
void Pokemon_InitAndCalcStats(Pokemon *mon, u16 species, u8 level, u32 combinedIVs, u32 personality) {
|
||||
Pokemon_InitWithParams(mon, species, level, 0, TRUE, personality, 0, 0);
|
||||
Pokemon_InitWithParams(mon, species, level, 0, TRUE, personality, OT_ID_PLAYER_ID, 0);
|
||||
Pokemon_SetData(mon, MON_DATA_COMBINED_IVS, &combinedIVs);
|
||||
Pokemon_CalcLevelAndStats(mon);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4013,7 +4013,7 @@ static void Script_SetMonSeenFlagBySpecies(FieldSystem *fieldSystem, u16 species
|
|||
Pokedex *pokedex = Save_Pokedex_Get(fieldSystem->saveData);
|
||||
Pokemon *mon = Pokemon_New(HEAP_ID_32);
|
||||
Pokemon_Init(mon);
|
||||
Pokemon_InitWithParams(mon, species, 50, 32, FALSE, 0, OT_ID_PLAYER_ID, 0);
|
||||
Pokemon_InitWithParams(mon, species, 50, INIT_IVS_RANDOM, FALSE, 0, OT_ID_PLAYER_ID, 0);
|
||||
Pokedex_SetMonSeenFlag(pokedex, mon);
|
||||
Heap_Free(mon);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ BOOL GiveMon(enum HeapID heapID, struct SaveData *save, u16 species, u8 level, u
|
|||
struct Party *party = SaveArray_Party_Get(save);
|
||||
struct Pokemon *mon = Pokemon_New(heapID);
|
||||
Pokemon_Init(mon);
|
||||
Pokemon_InitWithParams(mon, species, level, 32, 0, 0, OT_ID_PLAYER_ID, 0);
|
||||
Pokemon_InitWithParams(mon, species, level, INIT_IVS_RANDOM, 0, 0, OT_ID_PLAYER_ID, 0);
|
||||
sub_0206A014(mon, data, ITEM_POKE_BALL, mapSec, encounterType, heapID);
|
||||
ptr = item;
|
||||
Pokemon_SetData(mon, MON_DATA_HELD_ITEM, &ptr);
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ void CreateNPCTrainerParty(BattleSetup *setup, s32 party_id, enum HeapID heapID)
|
|||
// Difficulty is a number between 0 and 250 which directly corresponds
|
||||
// to the (uniform) IV spread of the generated Pokemon.
|
||||
iv = (u8)((monSpecies[i].difficulty * 31) / 255);
|
||||
Pokemon_InitWithParams(pokemon, monSpecies[i].species, monSpecies[i].level, iv, 1, (s32)personality, 2, 0);
|
||||
Pokemon_InitWithParams(pokemon, monSpecies[i].species, monSpecies[i].level, iv, 1, (s32)personality, OT_ID_RANDOM_NO_SHINY, 0);
|
||||
|
||||
// If you were treating the trainer type as a bitfield, you'd put the
|
||||
// checks for held item and moves here. You'd also treat the trpoke
|
||||
|
|
@ -321,7 +321,7 @@ void CreateNPCTrainerParty(BattleSetup *setup, s32 party_id, enum HeapID heapID)
|
|||
personality = (seed << 8);
|
||||
personality += pid_gender;
|
||||
iv = (u8)((monSpeciesMoves[i].difficulty * 31) / 255);
|
||||
Pokemon_InitWithParams(pokemon, monSpeciesMoves[i].species, monSpeciesMoves[i].level, iv, 1, (s32)personality, 2, 0);
|
||||
Pokemon_InitWithParams(pokemon, monSpeciesMoves[i].species, monSpeciesMoves[i].level, iv, 1, (s32)personality, OT_ID_RANDOM_NO_SHINY, 0);
|
||||
for (j = 0; j < 4; j++) {
|
||||
Pokemon_SetMoveInSlot(pokemon, monSpeciesMoves[i].moves[j], (u8)j);
|
||||
}
|
||||
|
|
@ -340,7 +340,7 @@ void CreateNPCTrainerParty(BattleSetup *setup, s32 party_id, enum HeapID heapID)
|
|||
personality = (seed << 8);
|
||||
personality += pid_gender;
|
||||
iv = (u8)((monSpeciesItem[i].difficulty * 31) / 255);
|
||||
Pokemon_InitWithParams(pokemon, monSpeciesItem[i].species, monSpeciesItem[i].level, iv, 1, (s32)personality, 2, 0);
|
||||
Pokemon_InitWithParams(pokemon, monSpeciesItem[i].species, monSpeciesItem[i].level, iv, 1, (s32)personality, OT_ID_RANDOM_NO_SHINY, 0);
|
||||
Pokemon_SetData(pokemon, MON_DATA_HELD_ITEM, &monSpeciesItem[i].item);
|
||||
Party_AddMon(setup->party[party_id], pokemon);
|
||||
}
|
||||
|
|
@ -357,7 +357,7 @@ void CreateNPCTrainerParty(BattleSetup *setup, s32 party_id, enum HeapID heapID)
|
|||
personality = (seed << 8);
|
||||
personality += pid_gender;
|
||||
iv = (u8)((monSpeciesItemMoves[i].difficulty * 31) / 255);
|
||||
Pokemon_InitWithParams(pokemon, monSpeciesItemMoves[i].species, monSpeciesItemMoves[i].level, iv, 1, (s32)personality, 2, 0);
|
||||
Pokemon_InitWithParams(pokemon, monSpeciesItemMoves[i].species, monSpeciesItemMoves[i].level, iv, 1, (s32)personality, OT_ID_RANDOM_NO_SHINY, 0);
|
||||
Pokemon_SetData(pokemon, MON_DATA_HELD_ITEM, &monSpeciesItemMoves[i].item);
|
||||
for (j = 0; j < 4; j++) {
|
||||
Pokemon_SetMoveInSlot(pokemon, monSpeciesItemMoves[i].moves[j], (u8)j);
|
||||
|
|
|
|||
|
|
@ -315,6 +315,7 @@
|
|||
#define OT_ID_PLAYER_ID 0
|
||||
#define OT_ID_PRESET 1
|
||||
#define OT_ID_RANDOM_NO_SHINY 2
|
||||
#define INIT_IVS_RANDOM (MAX_IVS_SINGLE_STAT + 1)
|
||||
|
||||
#define GENDER_RATIO_MALE_ONLY 0
|
||||
#define GENDER_RATIO_FEMALE_12_5 31
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user