Merge branch 'master' into battle_engine_v2

This commit is contained in:
DizzyEggg 2019-05-07 10:23:14 +02:00
commit 5bc63ab550
4 changed files with 11 additions and 10 deletions

View file

@ -14,7 +14,7 @@
#define MON_DATA_OT_NAME 7
#define MON_DATA_MARKINGS 8
#define MON_DATA_CHECKSUM 9
#define MON_DATA_10 10
#define MON_DATA_ENCRYPT_SEPARATOR 10
#define MON_DATA_SPECIES 11
#define MON_DATA_HELD_ITEM 12
#define MON_DATA_MOVE1 13

View file

@ -1406,8 +1406,8 @@ s32 CalcCritChanceStage(u8 battlerAtk, u8 battlerDef, u32 move, bool32 recordAbi
+ (abilityAtk == ABILITY_SUPER_LUCK);
}
if (critChance > 4)
critChance = 4;
if (critChance >= ARRAY_COUNT(sCriticalHitChance))
critChance = ARRAY_COUNT(sCriticalHitChance) - 1;
return critChance;
}

View file

@ -556,7 +556,7 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon)
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_NICKNAME, (gSpeciesNames[gEvolutionTable[preEvoSpecies][1].targetSpecies]));
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_HELD_ITEM, (&data));
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MARKINGS, (&data));
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_10, (&data));
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_ENCRYPT_SEPARATOR, (&data));
for (i = MON_DATA_COOL_RIBBON; i < MON_DATA_COOL_RIBBON + 5; i++)
SetMonData(&gPlayerParty[gPlayerPartyCount], i, (&data));

View file

@ -3357,7 +3357,8 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
struct PokemonSubstruct2 *substruct2 = NULL;
struct PokemonSubstruct3 *substruct3 = NULL;
if (field > MON_DATA_10)
// Any field greater than MON_DATA_ENCRYPT_SEPARATOR is encrypted and must be treated as such
if (field > MON_DATA_ENCRYPT_SEPARATOR)
{
substruct0 = &(GetSubstruct(boxMon, boxMon->personality, 0)->type0);
substruct1 = &(GetSubstruct(boxMon, boxMon->personality, 1)->type1);
@ -3451,7 +3452,7 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
case MON_DATA_CHECKSUM:
retVal = boxMon->checksum;
break;
case MON_DATA_10:
case MON_DATA_ENCRYPT_SEPARATOR:
retVal = boxMon->unknown;
break;
case MON_DATA_SPECIES:
@ -3692,7 +3693,7 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
break;
}
if (field > MON_DATA_10)
if (field > MON_DATA_ENCRYPT_SEPARATOR)
EncryptBoxMon(boxMon);
return retVal;
@ -3755,7 +3756,7 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg)
struct PokemonSubstruct2 *substruct2 = NULL;
struct PokemonSubstruct3 *substruct3 = NULL;
if (field > MON_DATA_10)
if (field > MON_DATA_ENCRYPT_SEPARATOR)
{
substruct0 = &(GetSubstruct(boxMon, boxMon->personality, 0)->type0);
substruct1 = &(GetSubstruct(boxMon, boxMon->personality, 1)->type1);
@ -3814,7 +3815,7 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg)
case MON_DATA_CHECKSUM:
SET16(boxMon->checksum);
break;
case MON_DATA_10:
case MON_DATA_ENCRYPT_SEPARATOR:
SET16(boxMon->unknown);
break;
case MON_DATA_SPECIES:
@ -4010,7 +4011,7 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg)
break;
}
if (field > MON_DATA_10)
if (field > MON_DATA_ENCRYPT_SEPARATOR)
{
boxMon->checksum = CalculateBoxMonChecksum(boxMon);
EncryptBoxMon(boxMon);