From 312749dd3109e607779bb1a15f3669ea2b0979dc Mon Sep 17 00:00:00 2001 From: psf <77138753+pkmnsnfrn@users.noreply.github.com> Date: Tue, 6 Aug 2024 22:44:03 -0700 Subject: [PATCH 1/4] Changed type1 and type2 to be consistent (#2021) * Changed type1 and type2 in gBattleMons to match gSpeciesInfo * Changed monType1 and monType2 to monTypes to match gSpeciesInfo --- include/battle.h | 6 +-- include/battle_controllers.h | 3 +- include/pokemon.h | 3 +- src/battle_ai_script_commands.c | 10 ++--- src/battle_ai_switch_items.c | 4 +- src/battle_controller_player.c | 2 +- src/battle_gfx_sfx_util.c | 2 +- src/battle_main.c | 12 +++--- src/battle_script_commands.c | 68 ++++++++++++++++----------------- src/pokemon.c | 4 +- 10 files changed, 56 insertions(+), 58 deletions(-) diff --git a/include/battle.h b/include/battle.h index 6c4d780186..eb25b96550 100644 --- a/include/battle.h +++ b/include/battle.h @@ -465,11 +465,11 @@ STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLER #define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0)) -#define IS_BATTLER_OF_TYPE(battlerId, type)((gBattleMons[battlerId].type1 == type || gBattleMons[battlerId].type2 == type)) +#define IS_BATTLER_OF_TYPE(battlerId, type)((gBattleMons[battlerId].types[0] == type || gBattleMons[battlerId].types[1] == type)) #define SET_BATTLER_TYPE(battlerId, type) \ { \ - gBattleMons[battlerId].type1 = type; \ - gBattleMons[battlerId].type2 = type; \ + gBattleMons[battlerId].types[0] = type; \ + gBattleMons[battlerId].types[1] = type; \ } #define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8 diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 064c080f61..0024e006b6 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -124,8 +124,7 @@ struct ChooseMoveStruct u8 currentPp[MAX_MON_MOVES]; u8 maxPp[MAX_MON_MOVES]; u16 species; - u8 monType1; - u8 monType2; + u8 monTypes[2]; }; enum diff --git a/include/pokemon.h b/include/pokemon.h index 6d08f48746..771d947f0a 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -276,8 +276,7 @@ struct BattlePokemon /*0x17*/ u32 abilityNum:1; /*0x18*/ s8 statStages[NUM_BATTLE_STATS]; /*0x20*/ u8 ability; - /*0x21*/ u8 type1; - /*0x22*/ u8 type2; + /*0x21*/ u8 types[2]; /*0x23*/ u8 unknown; /*0x24*/ u8 pp[MAX_MON_MOVES]; /*0x28*/ u16 hp; diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 4cb4c51654..716c456794 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -1119,16 +1119,16 @@ static void Cmd_get_type(void) switch (typeVar) { case AI_TYPE1_USER: // AI user primary type - AI_THINKING_STRUCT->funcResult = gBattleMons[sBattler_AI].type1; + AI_THINKING_STRUCT->funcResult = gBattleMons[sBattler_AI].types[0]; break; case AI_TYPE1_TARGET: // target primary type - AI_THINKING_STRUCT->funcResult = gBattleMons[gBattlerTarget].type1; + AI_THINKING_STRUCT->funcResult = gBattleMons[gBattlerTarget].types[0]; break; case AI_TYPE2_USER: // AI user secondary type - AI_THINKING_STRUCT->funcResult = gBattleMons[sBattler_AI].type2; + AI_THINKING_STRUCT->funcResult = gBattleMons[sBattler_AI].types[1]; break; case AI_TYPE2_TARGET: // target secondary type - AI_THINKING_STRUCT->funcResult = gBattleMons[gBattlerTarget].type2; + AI_THINKING_STRUCT->funcResult = gBattleMons[gBattlerTarget].types[1]; break; case AI_TYPE_MOVE: // type of move being pointed to AI_THINKING_STRUCT->funcResult = gBattleMoves[AI_THINKING_STRUCT->moveConsidered].type; @@ -1527,7 +1527,7 @@ static void Cmd_if_type_effectiveness(void) // TypeCalc does not assign to gMoveResultFlags, Cmd_typecalc does // This makes the check for gMoveResultFlags below always fail - // This is how you get the "dual non-immunity" glitch, where AI + // This is how you get the "dual non-immunity" glitch, where AI // will use ineffective moves on immune pokémon if the second type // has a non-neutral, non-immune effectiveness #ifdef BUGFIX diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 5ef15b627a..eeb28f8f0f 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -706,8 +706,8 @@ u8 GetMostSuitableMonToSwitchInto(void) u8 type1 = gSpeciesInfo[species].types[0]; u8 type2 = gSpeciesInfo[species].types[1]; u8 typeDmg = TYPE_MUL_NORMAL; - ModulateByTypeEffectiveness(gBattleMons[opposingBattler].type1, type1, type2, &typeDmg); - ModulateByTypeEffectiveness(gBattleMons[opposingBattler].type2, type1, type2, &typeDmg); + ModulateByTypeEffectiveness(gBattleMons[opposingBattler].types[0], type1, type2, &typeDmg); + ModulateByTypeEffectiveness(gBattleMons[opposingBattler].types[1], type1, type2, &typeDmg); /* Possible bug: this comparison gives the type that takes the most damage, when a "good" AI would want to select the type that takes the least damage. Unknown if this diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 8e09d126c9..e447858fc8 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -485,7 +485,7 @@ static void HandleInputChooseMove(void) PlaySE(SE_SELECT); if (moveInfo->moves[gMoveSelectionCursor[gActiveBattler]] == MOVE_CURSE) { - if (moveInfo->monType1 != TYPE_GHOST && moveInfo->monType2 != TYPE_GHOST) + if (moveInfo->monTypes[0] != TYPE_GHOST && moveInfo->monTypes[1] != TYPE_GHOST) moveTarget = MOVE_TARGET_USER; else moveTarget = MOVE_TARGET_SELECTED; diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index a17ebcb5ab..ed8cf572ea 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -264,7 +264,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void) if (moveInfo->moves[chosenMoveId] == MOVE_CURSE) { - if (moveInfo->monType1 != TYPE_GHOST && moveInfo->monType2 != TYPE_GHOST) + if (moveInfo->monTypes[0] != TYPE_GHOST && moveInfo->monTypes[1] != TYPE_GHOST) moveTarget = MOVE_TARGET_USER; else moveTarget = MOVE_TARGET_SELECTED; diff --git a/src/battle_main.c b/src/battle_main.c index c19089deb0..9039655c4d 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3343,8 +3343,8 @@ void FaintClearSetData(void) gBattleResources->flags->flags[gActiveBattler] = 0; - gBattleMons[gActiveBattler].type1 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; - gBattleMons[gActiveBattler].type2 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; + gBattleMons[gActiveBattler].types[0] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; + gBattleMons[gActiveBattler].types[1] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; ClearBattlerMoveHistory(gActiveBattler); ClearBattlerAbilityHistory(gActiveBattler); @@ -3411,8 +3411,8 @@ static void BattleIntroDrawTrainersOrMonsSprites(void) for (i = 0; i < sizeof(struct BattlePokemon); i++) ptr[i] = gBattleBufferB[gActiveBattler][4 + i]; - gBattleMons[gActiveBattler].type1 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; - gBattleMons[gActiveBattler].type2 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; + gBattleMons[gActiveBattler].types[0] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; + gBattleMons[gActiveBattler].types[1] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum); hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)]; *hpOnSwitchout = gBattleMons[gActiveBattler].hp; @@ -4173,8 +4173,8 @@ static void HandleTurnActionSelectionState(void) struct ChooseMoveStruct moveInfo; moveInfo.species = gBattleMons[gActiveBattler].species; - moveInfo.monType1 = gBattleMons[gActiveBattler].type1; - moveInfo.monType2 = gBattleMons[gActiveBattler].type2; + moveInfo.monTypes[0] = gBattleMons[gActiveBattler].types[0]; + moveInfo.monTypes[1] = gBattleMons[gActiveBattler].types[1]; for (i = 0; i < MAX_MON_MOVES; i++) { diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 49279bdb9c..6f43c6af70 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1395,11 +1395,11 @@ static void Cmd_typecalc(void) else if (TYPE_EFFECT_ATK_TYPE(i) == moveType) { // check type1 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type1) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0]) ModulateDmgByType(TYPE_EFFECT_MULTIPLIER(i)); // check type2 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type2 && - gBattleMons[gBattlerTarget].type1 != gBattleMons[gBattlerTarget].type2) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] && + gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1]) ModulateDmgByType(TYPE_EFFECT_MULTIPLIER(i)); } i += 3; @@ -1454,14 +1454,14 @@ static void CheckWonderGuardAndLevitate(void) if (TYPE_EFFECT_ATK_TYPE(i) == moveType) { // check no effect - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type1 + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0] && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT) { gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE; gProtectStructs[gBattlerAttacker].targetNotAffected = 1; } - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type2 && - gBattleMons[gBattlerTarget].type1 != gBattleMons[gBattlerTarget].type2 && + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] && + gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT) { gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE; @@ -1469,18 +1469,18 @@ static void CheckWonderGuardAndLevitate(void) } // check super effective - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type1 && TYPE_EFFECT_MULTIPLIER(i) == 20) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0] && TYPE_EFFECT_MULTIPLIER(i) == 20) flags |= 1; - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type2 - && gBattleMons[gBattlerTarget].type1 != gBattleMons[gBattlerTarget].type2 + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] + && gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE) flags |= 1; // check not very effective - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type1 && TYPE_EFFECT_MULTIPLIER(i) == 5) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0] && TYPE_EFFECT_MULTIPLIER(i) == 5) flags |= 2; - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type2 - && gBattleMons[gBattlerTarget].type1 != gBattleMons[gBattlerTarget].type2 + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] + && gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NOT_EFFECTIVE) flags |= 2; } @@ -1570,11 +1570,11 @@ u8 TypeCalc(u16 move, u8 attacker, u8 defender) else if (TYPE_EFFECT_ATK_TYPE(i) == moveType) { // check type1 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[defender].type1) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[defender].types[0]) ModulateDmgByType2(TYPE_EFFECT_MULTIPLIER(i), move, &flags); // check type2 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[defender].type2 && - gBattleMons[defender].type1 != gBattleMons[defender].type2) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[defender].types[1] && + gBattleMons[defender].types[0] != gBattleMons[defender].types[1]) ModulateDmgByType2(TYPE_EFFECT_MULTIPLIER(i), move, &flags); } i += 3; @@ -3971,7 +3971,7 @@ static void Cmd_jumpiftype2(void) { u8 battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]); - if (gBattlescriptCurrInstr[2] == gBattleMons[battlerId].type1 || gBattlescriptCurrInstr[2] == gBattleMons[battlerId].type2) + if (gBattlescriptCurrInstr[2] == gBattleMons[battlerId].types[0] || gBattlescriptCurrInstr[2] == gBattleMons[battlerId].types[1]) gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); else gBattlescriptCurrInstr += 7; @@ -4520,7 +4520,7 @@ static void Cmd_typecalc2(void) if (TYPE_EFFECT_ATK_TYPE(i) == moveType) { // check type1 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type1) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0]) { if (TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT) { @@ -4537,22 +4537,22 @@ static void Cmd_typecalc2(void) } } // check type2 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type2) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1]) { - if (gBattleMons[gBattlerTarget].type1 != gBattleMons[gBattlerTarget].type2 + if (gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT) { gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE; break; } - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type2 - && gBattleMons[gBattlerTarget].type1 != gBattleMons[gBattlerTarget].type2 + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] + && gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NOT_EFFECTIVE) { flags |= MOVE_RESULT_NOT_VERY_EFFECTIVE; } - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type2 - && gBattleMons[gBattlerTarget].type1 != gBattleMons[gBattlerTarget].type2 + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] + && gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE) { flags |= MOVE_RESULT_SUPER_EFFECTIVE; @@ -4623,8 +4623,8 @@ static void Cmd_switchindataupdate(void) for (i = 0; i < sizeof(struct BattlePokemon); i++) monData[i] = gBattleBufferB[gActiveBattler][4 + i]; - gBattleMons[gActiveBattler].type1 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; - gBattleMons[gActiveBattler].type2 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; + gBattleMons[gActiveBattler].types[0] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; + gBattleMons[gActiveBattler].types[1] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum); // check knocked off item @@ -7354,8 +7354,8 @@ static void Cmd_tryconversiontypechange(void) else moveType = TYPE_NORMAL; } - if (moveType != gBattleMons[gBattlerAttacker].type1 - && moveType != gBattleMons[gBattlerAttacker].type2) + if (moveType != gBattleMons[gBattlerAttacker].types[0] + && moveType != gBattleMons[gBattlerAttacker].types[1]) { break; } @@ -7381,7 +7381,7 @@ static void Cmd_tryconversiontypechange(void) moveType = TYPE_NORMAL; } } - while (moveType == gBattleMons[gBattlerAttacker].type1 || moveType == gBattleMons[gBattlerAttacker].type2); + while (moveType == gBattleMons[gBattlerAttacker].types[0] || moveType == gBattleMons[gBattlerAttacker].types[1]); SET_BATTLER_TYPE(gBattlerAttacker, moveType); PREPARE_TYPE_BUFFER(gBattleTextBuff1, moveType); @@ -7548,12 +7548,12 @@ static void Cmd_weatherdamage(void) { if (gBattleWeather & B_WEATHER_SANDSTORM) { - if (gBattleMons[gBattlerAttacker].type1 != TYPE_ROCK - && gBattleMons[gBattlerAttacker].type1 != TYPE_STEEL - && gBattleMons[gBattlerAttacker].type1 != TYPE_GROUND - && gBattleMons[gBattlerAttacker].type2 != TYPE_ROCK - && gBattleMons[gBattlerAttacker].type2 != TYPE_STEEL - && gBattleMons[gBattlerAttacker].type2 != TYPE_GROUND + if (gBattleMons[gBattlerAttacker].types[0] != TYPE_ROCK + && gBattleMons[gBattlerAttacker].types[0] != TYPE_STEEL + && gBattleMons[gBattlerAttacker].types[0] != TYPE_GROUND + && gBattleMons[gBattlerAttacker].types[1] != TYPE_ROCK + && gBattleMons[gBattlerAttacker].types[1] != TYPE_STEEL + && gBattleMons[gBattlerAttacker].types[1] != TYPE_GROUND && gBattleMons[gBattlerAttacker].ability != ABILITY_SAND_VEIL && !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERGROUND) && !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER)) diff --git a/src/pokemon.c b/src/pokemon.c index ef8e7e9e05..077b856793 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -4670,8 +4670,8 @@ void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex) gBattleMons[battlerId].isEgg = GetMonData(&gPlayerParty[partyIndex], MON_DATA_IS_EGG, NULL); gBattleMons[battlerId].abilityNum = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ABILITY_NUM, NULL); gBattleMons[battlerId].otId = GetMonData(&gPlayerParty[partyIndex], MON_DATA_OT_ID, NULL); - gBattleMons[battlerId].type1 = gSpeciesInfo[gBattleMons[battlerId].species].types[0]; - gBattleMons[battlerId].type2 = gSpeciesInfo[gBattleMons[battlerId].species].types[1]; + gBattleMons[battlerId].types[0] = gSpeciesInfo[gBattleMons[battlerId].species].types[0]; + gBattleMons[battlerId].types[1] = gSpeciesInfo[gBattleMons[battlerId].species].types[1]; gBattleMons[battlerId].ability = GetAbilityBySpecies(gBattleMons[battlerId].species, gBattleMons[battlerId].abilityNum); GetMonData(&gPlayerParty[partyIndex], MON_DATA_NICKNAME, nickname); StringCopy_Nickname(gBattleMons[battlerId].nickname, nickname); From 5635f9403639c83d7895e1ffe5ec3bc1789f1bf1 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Wed, 7 Aug 2024 11:35:45 -0700 Subject: [PATCH 2/4] More changes from typeX to types[X] --- include/battle.h | 25 +- include/battle_controllers.h | 8 +- include/pokemon.h | 24 +- src/battle_ai_switch_items.c | 40 +- src/battle_ai_util.c | 16 +- src/battle_controller_player.c | 12 +- src/battle_debug.c | 6 +- src/battle_gfx_sfx_util.c | 18 +- src/battle_main.c | 62 +--- src/battle_script_commands.c | 488 ++----------------------- src/battle_util.c | 20 +- src/battle_z_move.c | 2 +- src/pokemon.c | 40 +- test/battle/move_effect/reflect_type.c | 20 +- test/battle/terrain/electric.c | 2 +- test/battle/terrain/grassy.c | 2 +- test/battle/terrain/misty.c | 2 +- test/battle/terrain/psychic.c | 2 +- 18 files changed, 107 insertions(+), 682 deletions(-) diff --git a/include/battle.h b/include/battle.h index 25b5e8db4f..090ae5c347 100644 --- a/include/battle.h +++ b/include/battle.h @@ -834,29 +834,16 @@ STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLER #define SET_BATTLER_TYPE(battlerId, type) \ { \ - gBattleMons[battlerId].type1 = type; \ - gBattleMons[battlerId].type2 = type; \ - gBattleMons[battlerId].type3 = TYPE_MYSTERY; \ + gBattleMons[battlerId].types[0] = type; \ + gBattleMons[battlerId].types[1] = type; \ + gBattleMons[battlerId].types[2] = TYPE_MYSTERY; \ } -<<<<<<< HEAD #define RESTORE_BATTLER_TYPE(battlerId) \ { \ - gBattleMons[battlerId].type1 = gSpeciesInfo[gBattleMons[battlerId].species].types[0]; \ - gBattleMons[battlerId].type2 = gSpeciesInfo[gBattleMons[battlerId].species].types[1]; \ - gBattleMons[battlerId].type3 = TYPE_MYSTERY; \ -======= -#define IS_TYPE_PHYSICAL(moveType)(moveType < TYPE_MYSTERY) -#define IS_TYPE_SPECIAL(moveType)(moveType > TYPE_MYSTERY) - -#define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0)) - -#define IS_BATTLER_OF_TYPE(battlerId, type)((gBattleMons[battlerId].types[0] == type || gBattleMons[battlerId].types[1] == type)) -#define SET_BATTLER_TYPE(battlerId, type) \ -{ \ - gBattleMons[battlerId].types[0] = type; \ - gBattleMons[battlerId].types[1] = type; \ ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc + gBattleMons[battlerId].types[0] = gSpeciesInfo[gBattleMons[battlerId].species].types[0]; \ + gBattleMons[battlerId].types[1] = gSpeciesInfo[gBattleMons[battlerId].species].types[1]; \ + gBattleMons[battlerId].types[2] = TYPE_MYSTERY; \ } #define IS_BATTLER_PROTECTED(battlerId)(gProtectStructs[battlerId].protected \ diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 7a08aa4b2d..71a7691448 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -125,14 +125,8 @@ struct ChooseMoveStruct u8 currentPp[MAX_MON_MOVES]; u8 maxPp[MAX_MON_MOVES]; u16 species; -<<<<<<< HEAD - u8 monType1; - u8 monType2; - u8 monType3; + u8 monTypes[3]; struct ZMoveData zmove; -======= - u8 monTypes[2]; ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc }; enum diff --git a/include/pokemon.h b/include/pokemon.h index 9b0c6fa618..d1484fe2ce 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -322,11 +322,8 @@ struct BattlePokemon /*0x17*/ u32 spDefenseIV:5; /*0x17*/ u32 abilityNum:2; /*0x18*/ s8 statStages[NUM_BATTLE_STATS]; -<<<<<<< HEAD /*0x20*/ u16 ability; - /*0x22*/ u8 type1; - /*0x23*/ u8 type2; - /*0x24*/ u8 type3; + /*0x22*/ u8 types[3]; /*0x25*/ u8 pp[MAX_MON_MOVES]; /*0x29*/ u16 hp; /*0x2B*/ u8 level; @@ -343,25 +340,6 @@ struct BattlePokemon /*0x55*/ u32 otId; /*0x59*/ u8 metLevel; /*0x5A*/ bool8 isShiny; -======= - /*0x20*/ u8 ability; - /*0x21*/ u8 types[2]; - /*0x23*/ u8 unknown; - /*0x24*/ u8 pp[MAX_MON_MOVES]; - /*0x28*/ u16 hp; - /*0x2A*/ u8 level; - /*0x2B*/ u8 friendship; - /*0x2C*/ u16 maxHP; - /*0x2E*/ u16 item; - /*0x30*/ u8 nickname[POKEMON_NAME_LENGTH + 1]; - /*0x3B*/ u8 ppBonuses; - /*0x3C*/ u8 otName[PLAYER_NAME_LENGTH + 1]; - /*0x44*/ u32 experience; - /*0x48*/ u32 personality; - /*0x4C*/ u32 status1; - /*0x50*/ u32 status2; - /*0x54*/ u32 otId; ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc }; struct Evolution diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index e561ac76fb..29642df9ff 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -89,10 +89,10 @@ static bool32 HasBadOdds(u32 battler, bool32 emitResult) opposingBattler = GetBattlerAtPosition(opposingPosition); // Gets types of player (opposingBattler) and computer (battler) - atkType1 = gBattleMons[opposingBattler].type1; - atkType2 = gBattleMons[opposingBattler].type2; - defType1 = gBattleMons[battler].type1; - defType2 = gBattleMons[battler].type2; + atkType1 = gBattleMons[opposingBattler].types[0]; + atkType2 = gBattleMons[opposingBattler].types[1]; + defType1 = gBattleMons[battler].types[0]; + defType2 = gBattleMons[battler].types[1]; // Check AI moves for damage dealt for (i = 0; i < MAX_MON_MOVES; i++) @@ -1233,19 +1233,11 @@ static u32 GetBestMonTypeMatchup(struct Pokemon *party, int firstId, int lastId, { if (!(gBitTable[i] & invalidMons) && !(gBitTable[i] & bits)) { -<<<<<<< HEAD u16 species = GetMonData(&party[i], MON_DATA_SPECIES); uq4_12_t typeEffectiveness = UQ_4_12(1.0); -======= - u8 type1 = gSpeciesInfo[species].types[0]; - u8 type2 = gSpeciesInfo[species].types[1]; - u8 typeDmg = TYPE_MUL_NORMAL; - ModulateByTypeEffectiveness(gBattleMons[opposingBattler].types[0], type1, type2, &typeDmg); - ModulateByTypeEffectiveness(gBattleMons[opposingBattler].types[1], type1, type2, &typeDmg); ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc - u8 atkType1 = gBattleMons[opposingBattler].type1; - u8 atkType2 = gBattleMons[opposingBattler].type2; + u8 atkType1 = gBattleMons[opposingBattler].types[0]; + u8 atkType2 = gBattleMons[opposingBattler].types[1]; u8 defType1 = gSpeciesInfo[species].types[0]; u8 defType2 = gSpeciesInfo[species].types[1]; @@ -1345,7 +1337,7 @@ static bool32 IsMonGrounded(u16 heldItemEffect, u32 ability, u8 type1, u8 type2) // Gets hazard damage static u32 GetSwitchinHazardsDamage(u32 battler, struct BattlePokemon *battleMon) { - u8 defType1 = battleMon->type1, defType2 = battleMon->type2, tSpikesLayers; + u8 defType1 = battleMon->types[0], defType2 = battleMon->types[1], tSpikesLayers; u16 heldItemEffect = ItemId_GetHoldEffect(battleMon->item); u32 maxHP = battleMon->maxHP, ability = battleMon->ability, status = battleMon->status1; u32 spikesDamage = 0, tSpikesDamage = 0, hazardDamage = 0; @@ -1412,7 +1404,7 @@ static s32 GetSwitchinWeatherImpact(void) if (holdEffect != HOLD_EFFECT_SAFETY_GOGGLES && ability != ABILITY_MAGIC_GUARD && ability != ABILITY_OVERCOAT) { if ((gBattleWeather & B_WEATHER_HAIL) - && (AI_DATA->switchinCandidate.battleMon.type1 != TYPE_ICE || AI_DATA->switchinCandidate.battleMon.type2 != TYPE_ICE) + && (AI_DATA->switchinCandidate.battleMon.types[0] != TYPE_ICE || AI_DATA->switchinCandidate.battleMon.types[1] != TYPE_ICE) && ability != ABILITY_SNOW_CLOAK && ability != ABILITY_ICE_BODY) { weatherImpact = maxHP / 16; @@ -1420,9 +1412,9 @@ static s32 GetSwitchinWeatherImpact(void) weatherImpact = 1; } else if ((gBattleWeather & B_WEATHER_SANDSTORM) - && (AI_DATA->switchinCandidate.battleMon.type1 != TYPE_GROUND && AI_DATA->switchinCandidate.battleMon.type2 != TYPE_GROUND - && AI_DATA->switchinCandidate.battleMon.type1 != TYPE_ROCK && AI_DATA->switchinCandidate.battleMon.type2 != TYPE_ROCK - && AI_DATA->switchinCandidate.battleMon.type1 != TYPE_STEEL && AI_DATA->switchinCandidate.battleMon.type2 != TYPE_STEEL + && (AI_DATA->switchinCandidate.battleMon.types[0] != TYPE_GROUND && AI_DATA->switchinCandidate.battleMon.types[1] != TYPE_GROUND + && AI_DATA->switchinCandidate.battleMon.types[0] != TYPE_ROCK && AI_DATA->switchinCandidate.battleMon.types[1] != TYPE_ROCK + && AI_DATA->switchinCandidate.battleMon.types[0] != TYPE_STEEL && AI_DATA->switchinCandidate.battleMon.types[1] != TYPE_STEEL && ability != ABILITY_SAND_VEIL && ability != ABILITY_SAND_RUSH && ability != ABILITY_SAND_FORCE)) { weatherImpact = maxHP / 16; @@ -1473,7 +1465,7 @@ static u32 GetSwitchinRecurringHealing(void) // Items if (ability != ABILITY_KLUTZ) { - if (holdEffect == HOLD_EFFECT_BLACK_SLUDGE && (AI_DATA->switchinCandidate.battleMon.type1 == TYPE_POISON || AI_DATA->switchinCandidate.battleMon.type2 == TYPE_POISON)) + if (holdEffect == HOLD_EFFECT_BLACK_SLUDGE && (AI_DATA->switchinCandidate.battleMon.types[0] == TYPE_POISON || AI_DATA->switchinCandidate.battleMon.types[1] == TYPE_POISON)) { recurringHealing = maxHP / 16; if (recurringHealing == 0) @@ -1507,7 +1499,7 @@ static u32 GetSwitchinRecurringDamage(void) // Items if (ability != ABILITY_MAGIC_GUARD && ability != ABILITY_KLUTZ) { - if (holdEffect == HOLD_EFFECT_BLACK_SLUDGE && AI_DATA->switchinCandidate.battleMon.type1 != TYPE_POISON && AI_DATA->switchinCandidate.battleMon.type2 != TYPE_POISON) + if (holdEffect == HOLD_EFFECT_BLACK_SLUDGE && AI_DATA->switchinCandidate.battleMon.types[0] != TYPE_POISON && AI_DATA->switchinCandidate.battleMon.types[1] != TYPE_POISON) { passiveDamage = maxHP / 8; if (passiveDamage == 0) @@ -1532,7 +1524,7 @@ static u32 GetSwitchinRecurringDamage(void) // Gets one turn of status damage static u32 GetSwitchinStatusDamage(u32 battler) { - u8 defType1 = AI_DATA->switchinCandidate.battleMon.type1, defType2 = AI_DATA->switchinCandidate.battleMon.type2; + u8 defType1 = AI_DATA->switchinCandidate.battleMon.types[0], defType2 = AI_DATA->switchinCandidate.battleMon.types[1]; u8 tSpikesLayers = gSideTimers[GetBattlerSide(battler)].toxicSpikesAmount; u16 heldItemEffect = ItemId_GetHoldEffect(AI_DATA->switchinCandidate.battleMon.item); u32 status = AI_DATA->switchinCandidate.battleMon.status1, ability = AI_DATA->switchinCandidate.battleMon.ability, maxHP = AI_DATA->switchinCandidate.battleMon.maxHP; @@ -1714,7 +1706,7 @@ static u16 GetSwitchinTypeMatchup(u32 opposingBattler, struct BattlePokemon batt // Check type matchup u16 typeEffectiveness = UQ_4_12(1.0); u8 atkType1 = gSpeciesInfo[gBattleMons[opposingBattler].species].types[0], atkType2 = gSpeciesInfo[gBattleMons[opposingBattler].species].types[1], - defType1 = battleMon.type1, defType2 = battleMon.type2; + defType1 = battleMon.types[0], defType2 = battleMon.types[1]; // Multiply type effectiveness by a factor depending on type matchup typeEffectiveness = uq4_12_multiply(typeEffectiveness, (GetTypeModifier(atkType1, defType1))); @@ -2010,7 +2002,7 @@ static u32 GetBestMonIntegrated(struct Pokemon *party, int firstId, int lastId, if (aceMonId != PARTY_SIZE && (gMovesInfo[gLastUsedMove].effect == EFFECT_HIT_ESCAPE || gMovesInfo[gLastUsedMove].effect == EFFECT_PARTING_SHOT || gMovesInfo[gLastUsedMove].effect == EFFECT_BATON_PASS)) return aceMonId; - + return PARTY_SIZE; } diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 5505bbed18..f138252fa8 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -165,8 +165,8 @@ void SaveBattlerData(u32 battlerId) AI_THINKING_STRUCT->saved[battlerId].moves[i] = gBattleMons[battlerId].moves[i]; } // Save and restore types even for AI controlled battlers in case it gets changed during move evaluation process. - AI_THINKING_STRUCT->saved[battlerId].types[0] = gBattleMons[battlerId].type1; - AI_THINKING_STRUCT->saved[battlerId].types[1] = gBattleMons[battlerId].type2; + AI_THINKING_STRUCT->saved[battlerId].types[0] = gBattleMons[battlerId].types[0]; + AI_THINKING_STRUCT->saved[battlerId].types[1] = gBattleMons[battlerId].types[1]; } static bool32 ShouldFailForIllusion(u32 illusionSpecies, u32 battlerId) @@ -218,11 +218,11 @@ void SetBattlerData(u32 battlerId) if (illusionSpecies != SPECIES_NONE && ShouldFailForIllusion(illusionSpecies, battlerId)) { // If the battler's type has not been changed, AI assumes the types of the illusion mon. - if (gBattleMons[battlerId].type1 == gSpeciesInfo[species].types[0] - && gBattleMons[battlerId].type2 == gSpeciesInfo[species].types[1]) + if (gBattleMons[battlerId].types[0] == gSpeciesInfo[species].types[0] + && gBattleMons[battlerId].types[1] == gSpeciesInfo[species].types[1]) { - gBattleMons[battlerId].type1 = gSpeciesInfo[illusionSpecies].types[0]; - gBattleMons[battlerId].type2 = gSpeciesInfo[illusionSpecies].types[1]; + gBattleMons[battlerId].types[0] = gSpeciesInfo[illusionSpecies].types[0]; + gBattleMons[battlerId].types[1] = gSpeciesInfo[illusionSpecies].types[1]; } species = illusionSpecies; } @@ -262,8 +262,8 @@ void RestoreBattlerData(u32 battlerId) for (i = 0; i < 4; i++) gBattleMons[battlerId].moves[i] = AI_THINKING_STRUCT->saved[battlerId].moves[i]; } - gBattleMons[battlerId].type1 = AI_THINKING_STRUCT->saved[battlerId].types[0]; - gBattleMons[battlerId].type2 = AI_THINKING_STRUCT->saved[battlerId].types[1]; + gBattleMons[battlerId].types[0] = AI_THINKING_STRUCT->saved[battlerId].types[0]; + gBattleMons[battlerId].types[1] = AI_THINKING_STRUCT->saved[battlerId].types[1]; } u32 GetHealthPercentage(u32 battlerId) diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 5c37a4661b..5fac761cf7 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -606,19 +606,9 @@ static void HandleInputShowEntireFieldTargets(u32 battler) if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); -<<<<<<< HEAD HideAllTargets(); if (gBattleStruct->gimmick.playerSelect) BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | RET_GIMMICK | (gMultiUsePlayerCursor << 8)); -======= - if (moveInfo->moves[gMoveSelectionCursor[gActiveBattler]] == MOVE_CURSE) - { - if (moveInfo->monTypes[0] != TYPE_GHOST && moveInfo->monTypes[1] != TYPE_GHOST) - moveTarget = MOVE_TARGET_USER; - else - moveTarget = MOVE_TARGET_SELECTED; - } ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc else BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | (gMultiUsePlayerCursor << 8)); HideGimmickTriggerSprite(); @@ -1743,7 +1733,7 @@ static void MoveSelectionDisplayMoveType(u32 battler) if (speciesId == SPECIES_OGERPON_WELLSPRING_MASK || speciesId == SPECIES_OGERPON_WELLSPRING_MASK_TERA || speciesId == SPECIES_OGERPON_HEARTHFLAME_MASK || speciesId == SPECIES_OGERPON_HEARTHFLAME_MASK_TERA || speciesId == SPECIES_OGERPON_CORNERSTONE_MASK || speciesId == SPECIES_OGERPON_CORNERSTONE_MASK_TERA) - type = gBattleMons[battler].type2; + type = gBattleMons[battler].types[1]; } // Max Guard is a Normal-type move else if (gMovesInfo[moveInfo->moves[gMoveSelectionCursor[battler]]].category == DAMAGE_CATEGORY_STATUS diff --git a/src/battle_debug.c b/src/battle_debug.c index 4aefb2b1ff..b088aa73ba 100644 --- a/src/battle_debug.c +++ b/src/battle_debug.c @@ -1670,7 +1670,7 @@ static void PrintSecondaryEntries(struct BattleDebugMenu *data) case LIST_ITEM_TYPES: for (i = 0; i < 3; i++) { - u8 *types = &gBattleMons[data->battlerId].type1; + u8 *types = &gBattleMons[data->battlerId].types[0]; PadString(gTypesInfo[types[i]].name, text); printer.currentY = printer.y = (i * yMultiplier) + sSecondaryListTemplate.upText_Y; @@ -2070,9 +2070,9 @@ static void SetUpModifyArrows(struct BattleDebugMenu *data) data->modifyArrows.minValue = 0; data->modifyArrows.maxValue = NUMBER_OF_MON_TYPES - 1; data->modifyArrows.maxDigits = 2; - data->modifyArrows.modifiedValPtr = (u8 *)((&gBattleMons[data->battlerId].type1) + data->currentSecondaryListItemId); + data->modifyArrows.modifiedValPtr = (u8 *)((&gBattleMons[data->battlerId].types[0]) + data->currentSecondaryListItemId); data->modifyArrows.typeOfVal = VAL_U8; - data->modifyArrows.currValue = *(u8 *)((&gBattleMons[data->battlerId].type1) + data->currentSecondaryListItemId); + data->modifyArrows.currValue = *(u8 *)((&gBattleMons[data->battlerId].types[0]) + data->currentSecondaryListItemId); break; case LIST_ITEM_STATS: data->modifyArrows.minValue = 0; diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index 5f36549faf..cb3349ee32 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -262,21 +262,7 @@ u16 ChooseMoveAndTargetInBattlePalace(u32 battler) } } -<<<<<<< HEAD moveTarget = GetBattlerMoveTargetType(battler, moveInfo->moves[chosenMoveId]); -======= - if (moveInfo->moves[chosenMoveId] == MOVE_CURSE) - { - if (moveInfo->monTypes[0] != TYPE_GHOST && moveInfo->monTypes[1] != TYPE_GHOST) - moveTarget = MOVE_TARGET_USER; - else - moveTarget = MOVE_TARGET_SELECTED; - } - else - { - moveTarget = gBattleMoves[moveInfo->moves[chosenMoveId]].target; - } ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc if (moveTarget & MOVE_TARGET_USER) chosenMoveId |= (battler << 8); @@ -1128,7 +1114,7 @@ void LoadAndCreateEnemyShadowSprites(void) u32 i; LoadCompressedSpriteSheet(&gSpriteSheet_EnemyShadow); - + // initialize shadow sprite ids for (i = 0; i < gBattlersCount; i++) { @@ -1137,7 +1123,7 @@ void LoadAndCreateEnemyShadowSprites(void) battler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); CreateEnemyShadowSprite(battler); - + if (IsDoubleBattle()) { battler = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); diff --git a/src/battle_main.c b/src/battle_main.c index b42a624861..6bbcc0e3bc 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3368,14 +3368,9 @@ const u8* FaintClearSetData(u32 battler) gBattleResources->flags->flags[battler] = 0; -<<<<<<< HEAD - gBattleMons[battler].type1 = gSpeciesInfo[gBattleMons[battler].species].types[0]; - gBattleMons[battler].type2 = gSpeciesInfo[gBattleMons[battler].species].types[1]; - gBattleMons[battler].type3 = TYPE_MYSTERY; -======= - gBattleMons[gActiveBattler].types[0] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; - gBattleMons[gActiveBattler].types[1] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc + gBattleMons[battler].types[0] = gSpeciesInfo[gBattleMons[battler].species].types[0]; + gBattleMons[battler].types[1] = gSpeciesInfo[gBattleMons[battler].species].types[1]; + gBattleMons[battler].types[2] = TYPE_MYSTERY; Ai_UpdateFaintData(battler); TryBattleFormChange(battler, FORM_CHANGE_FAINT); @@ -3453,29 +3448,12 @@ static void DoBattleIntro(void) case 2: // Start graphical intro slide. if (!gBattleControllerExecFlags) { -<<<<<<< HEAD battler = GetBattlerAtPosition(0); BtlController_EmitIntroSlide(battler, BUFFER_A, gBattleTerrain); MarkBattlerForControllerExec(battler); gBattleCommunication[0] = 0; gBattleCommunication[1] = 0; (*state)++; -======= - u16 *hpOnSwitchout; - - ptr = (u8 *)&gBattleMons[gActiveBattler]; - for (i = 0; i < sizeof(struct BattlePokemon); i++) - ptr[i] = gBattleBufferB[gActiveBattler][4 + i]; - - gBattleMons[gActiveBattler].types[0] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; - gBattleMons[gActiveBattler].types[1] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; - gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum); - hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)]; - *hpOnSwitchout = gBattleMons[gActiveBattler].hp; - for (i = 0; i < NUM_BATTLE_STATS; i++) - gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE; - gBattleMons[gActiveBattler].status2 = 0; ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc } break; case 3: // Wait for intro slide. @@ -3492,9 +3470,9 @@ static void DoBattleIntro(void) else { memcpy(&gBattleMons[battler], &gBattleResources->bufferB[battler][4], sizeof(struct BattlePokemon)); - gBattleMons[battler].type1 = gSpeciesInfo[gBattleMons[battler].species].types[0]; - gBattleMons[battler].type2 = gSpeciesInfo[gBattleMons[battler].species].types[1]; - gBattleMons[battler].type3 = TYPE_MYSTERY; + gBattleMons[battler].types[0] = gSpeciesInfo[gBattleMons[battler].species].types[0]; + gBattleMons[battler].types[1] = gSpeciesInfo[gBattleMons[battler].species].types[1]; + gBattleMons[battler].types[2] = TYPE_MYSTERY; gBattleMons[battler].ability = GetAbilityBySpecies(gBattleMons[battler].species, gBattleMons[battler].abilityNum); gBattleStruct->hpOnSwitchout[GetBattlerSide(battler)] = gBattleMons[battler].hp; gBattleMons[battler].status2 = 0; @@ -4283,17 +4261,11 @@ static void HandleTurnActionSelectionState(void) { struct ChooseMoveStruct moveInfo; -<<<<<<< HEAD moveInfo.zmove = gBattleStruct->zmove; moveInfo.species = gBattleMons[battler].species; - moveInfo.monType1 = gBattleMons[battler].type1; - moveInfo.monType2 = gBattleMons[battler].type2; - moveInfo.monType3 = gBattleMons[battler].type3; -======= - moveInfo.species = gBattleMons[gActiveBattler].species; - moveInfo.monTypes[0] = gBattleMons[gActiveBattler].types[0]; - moveInfo.monTypes[1] = gBattleMons[gActiveBattler].types[1]; ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc + moveInfo.monTypes[0] = gBattleMons[battler].types[0]; + moveInfo.monTypes[1] = gBattleMons[battler].types[1]; + moveInfo.monTypes[2] = gBattleMons[battler].types[2]; for (i = 0; i < MAX_MON_MOVES; i++) { @@ -5856,26 +5828,26 @@ void SetTypeBeforeUsingMove(u32 move, u32 battlerAtk) { if (GetActiveGimmick(battlerAtk) == GIMMICK_TERA && GetBattlerTeraType(battlerAtk) != TYPE_STELLAR) gBattleStruct->dynamicMoveType = GetBattlerTeraType(battlerAtk); - else if (gBattleMons[battlerAtk].type1 != TYPE_MYSTERY) - gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type1 | F_DYNAMIC_TYPE_SET; - else if (gBattleMons[battlerAtk].type2 != TYPE_MYSTERY) - gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type2 | F_DYNAMIC_TYPE_SET; - else if (gBattleMons[battlerAtk].type3 != TYPE_MYSTERY) - gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type3 | F_DYNAMIC_TYPE_SET; + else if (gBattleMons[battlerAtk].types[0] != TYPE_MYSTERY) + gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].types[0] | F_DYNAMIC_TYPE_SET; + else if (gBattleMons[battlerAtk].types[1] != TYPE_MYSTERY) + gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].types[1] | F_DYNAMIC_TYPE_SET; + else if (gBattleMons[battlerAtk].types[2] != TYPE_MYSTERY) + gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].types[2] | F_DYNAMIC_TYPE_SET; } else if (gMovesInfo[move].effect == EFFECT_RAGING_BULL && (gBattleMons[battlerAtk].species == SPECIES_TAUROS_PALDEAN_COMBAT_BREED || gBattleMons[battlerAtk].species == SPECIES_TAUROS_PALDEAN_BLAZE_BREED || gBattleMons[battlerAtk].species == SPECIES_TAUROS_PALDEAN_AQUA_BREED)) { - gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type2 | F_DYNAMIC_TYPE_SET; + gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].types[1] | F_DYNAMIC_TYPE_SET; } else if (gMovesInfo[move].effect == EFFECT_IVY_CUDGEL && (gBattleMons[battlerAtk].species == SPECIES_OGERPON_WELLSPRING_MASK || gBattleMons[battlerAtk].species == SPECIES_OGERPON_WELLSPRING_MASK_TERA || gBattleMons[battlerAtk].species == SPECIES_OGERPON_HEARTHFLAME_MASK || gBattleMons[battlerAtk].species == SPECIES_OGERPON_HEARTHFLAME_MASK_TERA || gBattleMons[battlerAtk].species == SPECIES_OGERPON_CORNERSTONE_MASK || gBattleMons[battlerAtk].species == SPECIES_OGERPON_CORNERSTONE_MASK_TERA )) { - gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type2 | F_DYNAMIC_TYPE_SET; + gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].types[1] | F_DYNAMIC_TYPE_SET; } else if (gMovesInfo[move].effect == EFFECT_NATURAL_GIFT) { diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index a619369671..9d10c87cf7 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1160,8 +1160,8 @@ bool32 ProteanTryChangeType(u32 battler, u32 ability, u32 move, u32 moveType) { if ((ability == ABILITY_PROTEAN || ability == ABILITY_LIBERO) && !gDisableStructs[gBattlerAttacker].usedProteanLibero - && (gBattleMons[battler].type1 != moveType || gBattleMons[battler].type2 != moveType - || (gBattleMons[battler].type3 != moveType && gBattleMons[battler].type3 != TYPE_MYSTERY)) + && (gBattleMons[battler].types[0] != moveType || gBattleMons[battler].types[1] != moveType + || (gBattleMons[battler].types[2] != moveType && gBattleMons[battler].types[2] != TYPE_MYSTERY)) && move != MOVE_STRUGGLE && GetActiveGimmick(battler) != GIMMICK_TERA) { @@ -2000,7 +2000,6 @@ static void Cmd_adjustdamage(void) } if (GetBattlerAbility(gBattlerTarget) == ABILITY_ICE_FACE && IS_MOVE_PHYSICAL(gCurrentMove) && gBattleMons[gBattlerTarget].species == SPECIES_EISCUE) { -<<<<<<< HEAD // Damage deals typeless 0 HP. gMoveResultFlags &= ~(MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE); gBattleMoveDamage = 0; @@ -2008,312 +2007,12 @@ static void Cmd_adjustdamage(void) gBattleResources->flags->flags[gBattlerTarget] |= RESOURCE_FLAG_ICE_FACE; // Form change will be done after attack animation in Cmd_resultmessage. goto END; -======= - gLastUsedAbility = gBattleMons[gBattlerTarget].ability; - gMoveResultFlags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE); - gLastLandedMoves[gBattlerTarget] = 0; - gLastHitByType[gBattlerTarget] = 0; - gBattleCommunication[MISS_TYPE] = B_MSG_GROUND_MISS; - RecordAbilityBattle(gBattlerTarget, gLastUsedAbility); - } - else - { - while (TYPE_EFFECT_ATK_TYPE(i) != TYPE_ENDTABLE) - { - if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT) - { - if (gBattleMons[gBattlerTarget].status2 & STATUS2_FORESIGHT) - break; - i += 3; - continue; - } - else if (TYPE_EFFECT_ATK_TYPE(i) == moveType) - { - // check type1 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0]) - ModulateDmgByType(TYPE_EFFECT_MULTIPLIER(i)); - // check type2 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] && - gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1]) - ModulateDmgByType(TYPE_EFFECT_MULTIPLIER(i)); - } - i += 3; - } ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc } if (gBattleMons[gBattlerTarget].hp > gBattleMoveDamage) goto END; -<<<<<<< HEAD holdEffect = GetBattlerHoldEffect(gBattlerTarget, TRUE); param = GetBattlerHoldEffectParam(gBattlerTarget); -======= - if (gBattleMons[gBattlerTarget].ability == ABILITY_WONDER_GUARD && AttacksThisTurn(gBattlerAttacker, gCurrentMove) == 2 - && (!(gMoveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE) || ((gMoveResultFlags & (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE)) == (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE))) - && gBattleMoves[gCurrentMove].power) - { - gLastUsedAbility = ABILITY_WONDER_GUARD; - gMoveResultFlags |= MOVE_RESULT_MISSED; - gLastLandedMoves[gBattlerTarget] = 0; - gLastHitByType[gBattlerTarget] = 0; - gBattleCommunication[MISS_TYPE] = B_MSG_AVOIDED_DMG; - RecordAbilityBattle(gBattlerTarget, gLastUsedAbility); - } - if (gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE) - gProtectStructs[gBattlerAttacker].targetNotAffected = 1; - - gBattlescriptCurrInstr++; -} - -static void CheckWonderGuardAndLevitate(void) -{ - u8 flags = 0; - s32 i = 0; - u8 moveType; - - if (gCurrentMove == MOVE_STRUGGLE || !gBattleMoves[gCurrentMove].power) - return; - - GET_MOVE_TYPE(gCurrentMove, moveType); - - if (gBattleMons[gBattlerTarget].ability == ABILITY_LEVITATE && moveType == TYPE_GROUND) - { - gLastUsedAbility = ABILITY_LEVITATE; - gBattleCommunication[MISS_TYPE] = B_MSG_GROUND_MISS; - RecordAbilityBattle(gBattlerTarget, ABILITY_LEVITATE); - return; - } - - while (TYPE_EFFECT_ATK_TYPE(i) != TYPE_ENDTABLE) - { - if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT) - { - if (gBattleMons[gBattlerTarget].status2 & STATUS2_FORESIGHT) - break; - i += 3; - continue; - } - if (TYPE_EFFECT_ATK_TYPE(i) == moveType) - { - // check no effect - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0] - && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT) - { - gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE; - gProtectStructs[gBattlerAttacker].targetNotAffected = 1; - } - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] && - gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] && - TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT) - { - gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE; - gProtectStructs[gBattlerAttacker].targetNotAffected = 1; - } - - // check super effective - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0] && TYPE_EFFECT_MULTIPLIER(i) == 20) - flags |= 1; - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] - && gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] - && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE) - flags |= 1; - - // check not very effective - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0] && TYPE_EFFECT_MULTIPLIER(i) == 5) - flags |= 2; - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] - && gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] - && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NOT_EFFECTIVE) - flags |= 2; - } - i += 3; - } - - if (gBattleMons[gBattlerTarget].ability == ABILITY_WONDER_GUARD && AttacksThisTurn(gBattlerAttacker, gCurrentMove) == 2) - { - if (((flags & 2) || !(flags & 1)) && gBattleMoves[gCurrentMove].power) - { - gLastUsedAbility = ABILITY_WONDER_GUARD; - gBattleCommunication[MISS_TYPE] = B_MSG_AVOIDED_DMG; - RecordAbilityBattle(gBattlerTarget, ABILITY_WONDER_GUARD); - } - } -} - -// Same as ModulateDmgByType except different arguments -static void ModulateDmgByType2(u8 multiplier, u16 move, u8 *flags) -{ - gBattleMoveDamage = gBattleMoveDamage * multiplier / 10; - if (gBattleMoveDamage == 0 && multiplier != 0) - gBattleMoveDamage = 1; - - switch (multiplier) - { - case TYPE_MUL_NO_EFFECT: - *flags |= MOVE_RESULT_DOESNT_AFFECT_FOE; - *flags &= ~MOVE_RESULT_NOT_VERY_EFFECTIVE; - *flags &= ~MOVE_RESULT_SUPER_EFFECTIVE; - break; - case TYPE_MUL_NOT_EFFECTIVE: - if (gBattleMoves[move].power && !(*flags & MOVE_RESULT_NO_EFFECT)) - { - if (*flags & MOVE_RESULT_SUPER_EFFECTIVE) - *flags &= ~MOVE_RESULT_SUPER_EFFECTIVE; - else - *flags |= MOVE_RESULT_NOT_VERY_EFFECTIVE; - } - break; - case TYPE_MUL_SUPER_EFFECTIVE: - if (gBattleMoves[move].power && !(*flags & MOVE_RESULT_NO_EFFECT)) - { - if (*flags & MOVE_RESULT_NOT_VERY_EFFECTIVE) - *flags &= ~MOVE_RESULT_NOT_VERY_EFFECTIVE; - else - *flags |= MOVE_RESULT_SUPER_EFFECTIVE; - } - break; - } -} - -u8 TypeCalc(u16 move, u8 attacker, u8 defender) -{ - s32 i = 0; - u8 flags = 0; - u8 moveType; - - if (move == MOVE_STRUGGLE) - return 0; - - moveType = gBattleMoves[move].type; - - // check stab - if (IS_BATTLER_OF_TYPE(attacker, moveType)) - { - gBattleMoveDamage = gBattleMoveDamage * 15; - gBattleMoveDamage = gBattleMoveDamage / 10; - } - - if (gBattleMons[defender].ability == ABILITY_LEVITATE && moveType == TYPE_GROUND) - { - flags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE); - } - else - { - while (TYPE_EFFECT_ATK_TYPE(i) != TYPE_ENDTABLE) - { - if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT) - { - if (gBattleMons[defender].status2 & STATUS2_FORESIGHT) - break; - i += 3; - continue; - } - - else if (TYPE_EFFECT_ATK_TYPE(i) == moveType) - { - // check type1 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[defender].types[0]) - ModulateDmgByType2(TYPE_EFFECT_MULTIPLIER(i), move, &flags); - // check type2 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[defender].types[1] && - gBattleMons[defender].types[0] != gBattleMons[defender].types[1]) - ModulateDmgByType2(TYPE_EFFECT_MULTIPLIER(i), move, &flags); - } - i += 3; - } - } - - if (gBattleMons[defender].ability == ABILITY_WONDER_GUARD && !(flags & MOVE_RESULT_MISSED) - && AttacksThisTurn(attacker, move) == 2 - && (!(flags & MOVE_RESULT_SUPER_EFFECTIVE) || ((flags & (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE)) == (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE))) - && gBattleMoves[move].power) - { - flags |= MOVE_RESULT_MISSED; - } - return flags; -} - -u8 AI_TypeCalc(u16 move, u16 targetSpecies, u8 targetAbility) -{ - s32 i = 0; - u8 flags = 0; - u8 type1 = gSpeciesInfo[targetSpecies].types[0], type2 = gSpeciesInfo[targetSpecies].types[1]; - u8 moveType; - - if (move == MOVE_STRUGGLE) - return 0; - - moveType = gBattleMoves[move].type; - - if (targetAbility == ABILITY_LEVITATE && moveType == TYPE_GROUND) - { - flags = MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE; - } - else - { - while (TYPE_EFFECT_ATK_TYPE(i) != TYPE_ENDTABLE) - { - if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT) - { - i += 3; - continue; - } - if (TYPE_EFFECT_ATK_TYPE(i) == moveType) - { - // check type1 - if (TYPE_EFFECT_DEF_TYPE(i) == type1) - ModulateDmgByType2(TYPE_EFFECT_MULTIPLIER(i), move, &flags); - // check type2 - if (TYPE_EFFECT_DEF_TYPE(i) == type2 && type1 != type2) - ModulateDmgByType2(TYPE_EFFECT_MULTIPLIER(i), move, &flags); - } - i += 3; - } - } - if (targetAbility == ABILITY_WONDER_GUARD - && (!(flags & MOVE_RESULT_SUPER_EFFECTIVE) || ((flags & (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE)) == (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE))) - && gBattleMoves[move].power) - flags |= MOVE_RESULT_DOESNT_AFFECT_FOE; - return flags; -} - -// Multiplies the damage by a random factor between 85% to 100% inclusive -static inline void ApplyRandomDmgMultiplier(void) -{ - u16 rand = Random(); - u16 randPercent = 100 - (rand % 16); - - if (gBattleMoveDamage != 0) - { - gBattleMoveDamage *= randPercent; - gBattleMoveDamage /= 100; - if (gBattleMoveDamage == 0) - gBattleMoveDamage = 1; - } -} - -static void UNUSED Unused_ApplyRandomDmgMultiplier(void) -{ - ApplyRandomDmgMultiplier(); -} - -static void Cmd_adjustnormaldamage(void) -{ - u8 holdEffect, param; - - ApplyRandomDmgMultiplier(); - - if (gBattleMons[gBattlerTarget].item == ITEM_ENIGMA_BERRY) - { - holdEffect = gEnigmaBerries[gBattlerTarget].holdEffect; - param = gEnigmaBerries[gBattlerTarget].holdEffectParam; - } - else - { - holdEffect = ItemId_GetHoldEffect(gBattleMons[gBattlerTarget].item); - param = ItemId_GetHoldEffectParam(gBattleMons[gBattlerTarget].item); - } ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc gPotentialItemEffectBattler = gBattlerTarget; @@ -5367,18 +5066,11 @@ static void Cmd_setroost(void) { CMD_ARGS(); -<<<<<<< HEAD gBattleResources->flags->flags[gBattlerAttacker] |= RESOURCE_FLAG_ROOST; - gBattleStruct->roostTypes[gBattlerAttacker][0] = gBattleMons[gBattlerAttacker].type1; - gBattleStruct->roostTypes[gBattlerAttacker][1] = gBattleMons[gBattlerAttacker].type2; + gBattleStruct->roostTypes[gBattlerAttacker][0] = gBattleMons[gBattlerAttacker].types[0]; + gBattleStruct->roostTypes[gBattlerAttacker][1] = gBattleMons[gBattlerAttacker].types[1]; gBattlescriptCurrInstr = cmd->nextInstr; -======= - if (gBattlescriptCurrInstr[2] == gBattleMons[battlerId].types[0] || gBattlescriptCurrInstr[2] == gBattleMons[battlerId].types[1]) - gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); - else - gBattlescriptCurrInstr += 7; ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc } static void Cmd_jumpifabilitypresent(void) @@ -6741,71 +6433,9 @@ static void Cmd_sethealblock(void) } else { -<<<<<<< HEAD gStatuses3[gBattlerTarget] |= STATUS3_HEAL_BLOCK; gDisableStructs[gBattlerTarget].healBlockTimer = 5; gBattlescriptCurrInstr = cmd->nextInstr; -======= - while (TYPE_EFFECT_ATK_TYPE(i) != TYPE_ENDTABLE) - { - if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT) - { - if (gBattleMons[gBattlerTarget].status2 & STATUS2_FORESIGHT) - { - break; - } - else - { - i += 3; - continue; - } - } - - if (TYPE_EFFECT_ATK_TYPE(i) == moveType) - { - // check type1 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0]) - { - if (TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT) - { - gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE; - break; - } - if (TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NOT_EFFECTIVE) - { - flags |= MOVE_RESULT_NOT_VERY_EFFECTIVE; - } - if (TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE) - { - flags |= MOVE_RESULT_SUPER_EFFECTIVE; - } - } - // check type2 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1]) - { - if (gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] - && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT) - { - gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE; - break; - } - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] - && gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] - && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NOT_EFFECTIVE) - { - flags |= MOVE_RESULT_NOT_VERY_EFFECTIVE; - } - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] - && gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] - && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE) - { - flags |= MOVE_RESULT_SUPER_EFFECTIVE; - } - } - } - i += 3; - } ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc } } @@ -6855,18 +6485,8 @@ static void Cmd_switchindataupdate(void) for (i = 0; i < sizeof(struct BattlePokemon); i++) monData[i] = gBattleResources->bufferB[battler][4 + i]; -<<<<<<< HEAD // Edge case: the sent out pokemon has 0 HP. This should never happen. if (!IsBattlerAlive(battler)) -======= - gBattleMons[gActiveBattler].types[0] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; - gBattleMons[gActiveBattler].types[1] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; - gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum); - - // check knocked off item - i = GetBattlerSide(gActiveBattler); - if (gWishFutureKnock.knockedOffMons[i] & gBitTable[gBattlerPartyIndexes[gActiveBattler]]) ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc { // If it's a test, mark it as invalid. if (gTestRunnerEnabled) @@ -6894,9 +6514,9 @@ static void Cmd_switchindataupdate(void) } } - gBattleMons[battler].type1 = gSpeciesInfo[gBattleMons[battler].species].types[0]; - gBattleMons[battler].type2 = gSpeciesInfo[gBattleMons[battler].species].types[1]; - gBattleMons[battler].type3 = TYPE_MYSTERY; + gBattleMons[battler].types[0] = gSpeciesInfo[gBattleMons[battler].species].types[0]; + gBattleMons[battler].types[1] = gSpeciesInfo[gBattleMons[battler].species].types[1]; + gBattleMons[battler].types[2] = TYPE_MYSTERY; gBattleMons[battler].ability = GetAbilityBySpecies(gBattleMons[battler].species, gBattleMons[battler].abilityNum); #if TESTING if (gTestRunnerEnabled) @@ -10532,7 +10152,7 @@ static void Cmd_various(void) } else { - gBattleMons[battler].type3 = gMovesInfo[gCurrentMove].argument; + gBattleMons[battler].types[2] = gMovesInfo[gCurrentMove].argument; PREPARE_TYPE_BUFFER(gBattleTextBuff1, gMovesInfo[gCurrentMove].argument); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -12577,12 +12197,7 @@ static void Cmd_tryconversiontypechange(void) break; } } -<<<<<<< HEAD if (IS_BATTLER_OF_TYPE(gBattlerAttacker, moveType)) -======= - if (moveType != gBattleMons[gBattlerAttacker].types[0] - && moveType != gBattleMons[gBattlerAttacker].types[1]) ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc { gBattlescriptCurrInstr = cmd->failInstr; } @@ -12615,17 +12230,13 @@ static void Cmd_tryconversiontypechange(void) else moveType = TYPE_NORMAL; } - if (moveType != gBattleMons[gBattlerAttacker].type1 - && moveType != gBattleMons[gBattlerAttacker].type2 - && moveType != gBattleMons[gBattlerAttacker].type3) + if (moveType != gBattleMons[gBattlerAttacker].types[0] + && moveType != gBattleMons[gBattlerAttacker].types[1] + && moveType != gBattleMons[gBattlerAttacker].types[2]) { break; } } -<<<<<<< HEAD -======= - while (moveType == gBattleMons[gBattlerAttacker].types[0] || moveType == gBattleMons[gBattlerAttacker].types[1]); ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc if (moveChecked == validMoves) { @@ -12647,7 +12258,7 @@ static void Cmd_tryconversiontypechange(void) moveType = TYPE_NORMAL; } } - while (moveType == gBattleMons[gBattlerAttacker].type1 || moveType == gBattleMons[gBattlerAttacker].type2 || moveType == gBattleMons[gBattlerAttacker].type3); + while (moveType == gBattleMons[gBattlerAttacker].types[0] || moveType == gBattleMons[gBattlerAttacker].types[1] || moveType == gBattleMons[gBattlerAttacker].types[2]); SET_BATTLER_TYPE(gBattlerAttacker, moveType); PREPARE_TYPE_BUFFER(gBattleTextBuff1, moveType); @@ -12815,57 +12426,6 @@ static void Cmd_unused_95(void) static void Cmd_unused_96(void) { -<<<<<<< HEAD -======= - if (WEATHER_HAS_EFFECT) - { - if (gBattleWeather & B_WEATHER_SANDSTORM) - { - if (gBattleMons[gBattlerAttacker].types[0] != TYPE_ROCK - && gBattleMons[gBattlerAttacker].types[0] != TYPE_STEEL - && gBattleMons[gBattlerAttacker].types[0] != TYPE_GROUND - && gBattleMons[gBattlerAttacker].types[1] != TYPE_ROCK - && gBattleMons[gBattlerAttacker].types[1] != TYPE_STEEL - && gBattleMons[gBattlerAttacker].types[1] != TYPE_GROUND - && gBattleMons[gBattlerAttacker].ability != ABILITY_SAND_VEIL - && !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERGROUND) - && !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER)) - { - gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16; - if (gBattleMoveDamage == 0) - gBattleMoveDamage = 1; - } - else - { - gBattleMoveDamage = 0; - } - } - if (gBattleWeather & B_WEATHER_HAIL) - { - if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE) - && !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERGROUND) - && !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER)) - { - gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16; - if (gBattleMoveDamage == 0) - gBattleMoveDamage = 1; - } - else - { - gBattleMoveDamage = 0; - } - } - } - else - { - gBattleMoveDamage = 0; - } - - if (gAbsentBattlerFlags & gBitTable[gBattlerAttacker]) - gBattleMoveDamage = 0; - - gBattlescriptCurrInstr++; ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc } static void Cmd_tryinfatuating(void) @@ -16963,30 +16523,30 @@ void BS_TryReflectType(void) } else if (targetType1 == TYPE_MYSTERY && targetType2 == TYPE_MYSTERY && targetType3 != TYPE_MYSTERY) { - gBattleMons[gBattlerAttacker].type1 = TYPE_NORMAL; - gBattleMons[gBattlerAttacker].type2 = TYPE_NORMAL; - gBattleMons[gBattlerAttacker].type3 = targetType3; + gBattleMons[gBattlerAttacker].types[0] = TYPE_NORMAL; + gBattleMons[gBattlerAttacker].types[1] = TYPE_NORMAL; + gBattleMons[gBattlerAttacker].types[2] = targetType3; gBattlescriptCurrInstr = cmd->nextInstr; } else if (targetType1 == TYPE_MYSTERY && targetType2 != TYPE_MYSTERY) { - gBattleMons[gBattlerAttacker].type1 = targetType2; - gBattleMons[gBattlerAttacker].type2 = targetType2; - gBattleMons[gBattlerAttacker].type3 = targetType3; + gBattleMons[gBattlerAttacker].types[0] = targetType2; + gBattleMons[gBattlerAttacker].types[1] = targetType2; + gBattleMons[gBattlerAttacker].types[2] = targetType3; gBattlescriptCurrInstr = cmd->nextInstr; } else if (targetType1 != TYPE_MYSTERY && targetType2 == TYPE_MYSTERY) { - gBattleMons[gBattlerAttacker].type1 = targetType1; - gBattleMons[gBattlerAttacker].type2 = targetType1; - gBattleMons[gBattlerAttacker].type3 = targetType3; + gBattleMons[gBattlerAttacker].types[0] = targetType1; + gBattleMons[gBattlerAttacker].types[1] = targetType1; + gBattleMons[gBattlerAttacker].types[2] = targetType3; gBattlescriptCurrInstr = cmd->nextInstr; } else { - gBattleMons[gBattlerAttacker].type1 = targetType1; - gBattleMons[gBattlerAttacker].type2 = targetType2; - gBattleMons[gBattlerAttacker].type3 = targetType3; + gBattleMons[gBattlerAttacker].types[0] = targetType1; + gBattleMons[gBattlerAttacker].types[1] = targetType2; + gBattleMons[gBattlerAttacker].types[2] = targetType3; gBattlescriptCurrInstr = cmd->nextInstr; } } diff --git a/src/battle_util.c b/src/battle_util.c index 5520314280..821f785810 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -10598,8 +10598,8 @@ s32 GetStealthHazardDamageByTypesAndHP(u8 hazardType, u8 type1, u8 type2, u32 ma s32 GetStealthHazardDamage(u8 hazardType, u32 battler) { - u8 type1 = gBattleMons[battler].type1; - u8 type2 = gBattleMons[battler].type2; + u8 type1 = gBattleMons[battler].types[0]; + u8 type2 = gBattleMons[battler].types[1]; u32 maxHp = gBattleMons[battler].maxHP; return GetStealthHazardDamageByTypesAndHP(hazardType, type1, type2, maxHp); @@ -11496,9 +11496,9 @@ void CopyMonLevelAndBaseStatsToBattleMon(u32 battler, struct Pokemon *mon) void CopyMonAbilityAndTypesToBattleMon(u32 battler, struct Pokemon *mon) { gBattleMons[battler].ability = GetMonAbility(mon); - gBattleMons[battler].type1 = gSpeciesInfo[gBattleMons[battler].species].types[0]; - gBattleMons[battler].type2 = gSpeciesInfo[gBattleMons[battler].species].types[1]; - gBattleMons[battler].type3 = TYPE_MYSTERY; + gBattleMons[battler].types[0] = gSpeciesInfo[gBattleMons[battler].species].types[0]; + gBattleMons[battler].types[1] = gSpeciesInfo[gBattleMons[battler].species].types[1]; + gBattleMons[battler].types[2] = TYPE_MYSTERY; } void RecalcBattlerStats(u32 battler, struct Pokemon *mon) @@ -11703,9 +11703,9 @@ u8 GetBattlerType(u32 battler, u8 typeIndex, bool32 ignoreTera) { u32 teraType = GetBattlerTeraType(battler); u16 types[3] = {0}; - types[0] = gBattleMons[battler].type1; - types[1] = gBattleMons[battler].type2; - types[2] = gBattleMons[battler].type3; + types[0] = gBattleMons[battler].types[0]; + types[1] = gBattleMons[battler].types[1]; + types[2] = gBattleMons[battler].types[2]; // Handle Terastallization if (GetActiveGimmick(battler) == GIMMICK_TERA && teraType != TYPE_STELLAR && !ignoreTera) @@ -11734,8 +11734,8 @@ void RemoveBattlerType(u32 battler, u8 type) return; for (i = 0; i < 3; i++) { - if (*(u8 *)(&gBattleMons[battler].type1 + i) == type) - *(u8 *)(&gBattleMons[battler].type1 + i) = TYPE_MYSTERY; + if (*(u8 *)(&gBattleMons[battler].types[0] + i) == type) + *(u8 *)(&gBattleMons[battler].types[0] + i) = TYPE_MYSTERY; } } diff --git a/src/battle_z_move.c b/src/battle_z_move.c index c000c35808..89514336a7 100644 --- a/src/battle_z_move.c +++ b/src/battle_z_move.c @@ -284,7 +284,7 @@ bool32 MoveSelectionDisplayZMove(u16 zmove, u32 battler) if (zEffect == Z_EFFECT_CURSE) { - if (moveInfo->monType1 == TYPE_GHOST || moveInfo->monType2 == TYPE_GHOST || moveInfo->monType3 == TYPE_GHOST) + if (moveInfo->monTypes[0] == TYPE_GHOST || moveInfo->monTypes[1] == TYPE_GHOST || moveInfo->monTypes[2] == TYPE_GHOST) zEffect = Z_EFFECT_RECOVER_HP; else zEffect = Z_EFFECT_ATK_UP_1; diff --git a/src/pokemon.c b/src/pokemon.c index c354a7fe47..66fb83332f 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -3659,7 +3659,6 @@ void PokemonToBattleMon(struct Pokemon *src, struct BattlePokemon *dst) dst->pp[i] = GetMonData(src, MON_DATA_PP1 + i, NULL); } -<<<<<<< HEAD dst->species = GetMonData(src, MON_DATA_SPECIES, NULL); dst->item = GetMonData(src, MON_DATA_HELD_ITEM, NULL); dst->ppBonuses = GetMonData(src, MON_DATA_PP_BONUSES, NULL); @@ -3683,47 +3682,14 @@ void PokemonToBattleMon(struct Pokemon *src, struct BattlePokemon *dst) dst->spDefense = GetMonData(src, MON_DATA_SPDEF, NULL); dst->abilityNum = GetMonData(src, MON_DATA_ABILITY_NUM, NULL); dst->otId = GetMonData(src, MON_DATA_OT_ID, NULL); - dst->type1 = gSpeciesInfo[dst->species].types[0]; - dst->type2 = gSpeciesInfo[dst->species].types[1]; - dst->type3 = TYPE_MYSTERY; + dst->types[0] = gSpeciesInfo[dst->species].types[0]; + dst->types[1] = gSpeciesInfo[dst->species].types[1]; + dst->types[2] = TYPE_MYSTERY; dst->isShiny = IsMonShiny(src); dst->ability = GetAbilityBySpecies(dst->species, dst->abilityNum); GetMonData(src, MON_DATA_NICKNAME, nickname); StringCopy_Nickname(dst->nickname, nickname); GetMonData(src, MON_DATA_OT_NAME, dst->otName); -======= - gBattleMons[battlerId].ppBonuses = GetMonData(&gPlayerParty[partyIndex], MON_DATA_PP_BONUSES, NULL); - gBattleMons[battlerId].friendship = GetMonData(&gPlayerParty[partyIndex], MON_DATA_FRIENDSHIP, NULL); - gBattleMons[battlerId].experience = GetMonData(&gPlayerParty[partyIndex], MON_DATA_EXP, NULL); - gBattleMons[battlerId].hpIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_HP_IV, NULL); - gBattleMons[battlerId].attackIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ATK_IV, NULL); - gBattleMons[battlerId].defenseIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_DEF_IV, NULL); - gBattleMons[battlerId].speedIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPEED_IV, NULL); - gBattleMons[battlerId].spAttackIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPATK_IV, NULL); - gBattleMons[battlerId].spDefenseIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPDEF_IV, NULL); - gBattleMons[battlerId].personality = GetMonData(&gPlayerParty[partyIndex], MON_DATA_PERSONALITY, NULL); - gBattleMons[battlerId].status1 = GetMonData(&gPlayerParty[partyIndex], MON_DATA_STATUS, NULL); - gBattleMons[battlerId].level = GetMonData(&gPlayerParty[partyIndex], MON_DATA_LEVEL, NULL); - gBattleMons[battlerId].hp = GetMonData(&gPlayerParty[partyIndex], MON_DATA_HP, NULL); - gBattleMons[battlerId].maxHP = GetMonData(&gPlayerParty[partyIndex], MON_DATA_MAX_HP, NULL); - gBattleMons[battlerId].attack = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ATK, NULL); - gBattleMons[battlerId].defense = GetMonData(&gPlayerParty[partyIndex], MON_DATA_DEF, NULL); - gBattleMons[battlerId].speed = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPEED, NULL); - gBattleMons[battlerId].spAttack = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPATK, NULL); - gBattleMons[battlerId].spDefense = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPDEF, NULL); - gBattleMons[battlerId].isEgg = GetMonData(&gPlayerParty[partyIndex], MON_DATA_IS_EGG, NULL); - gBattleMons[battlerId].abilityNum = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ABILITY_NUM, NULL); - gBattleMons[battlerId].otId = GetMonData(&gPlayerParty[partyIndex], MON_DATA_OT_ID, NULL); - gBattleMons[battlerId].types[0] = gSpeciesInfo[gBattleMons[battlerId].species].types[0]; - gBattleMons[battlerId].types[1] = gSpeciesInfo[gBattleMons[battlerId].species].types[1]; - gBattleMons[battlerId].ability = GetAbilityBySpecies(gBattleMons[battlerId].species, gBattleMons[battlerId].abilityNum); - GetMonData(&gPlayerParty[partyIndex], MON_DATA_NICKNAME, nickname); - StringCopy_Nickname(gBattleMons[battlerId].nickname, nickname); - GetMonData(&gPlayerParty[partyIndex], MON_DATA_OT_NAME, gBattleMons[battlerId].otName); - - hpSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(battlerId)]; - *hpSwitchout = gBattleMons[battlerId].hp; ->>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc for (i = 0; i < NUM_BATTLE_STATS; i++) dst->statStages[i] = DEFAULT_STAT_STAGE; diff --git a/test/battle/move_effect/reflect_type.c b/test/battle/move_effect/reflect_type.c index b75ffc0b0d..32ed9520c8 100644 --- a/test/battle/move_effect/reflect_type.c +++ b/test/battle/move_effect/reflect_type.c @@ -123,9 +123,9 @@ SINGLE_BATTLE_TEST("Reflect Type copies a target's dual types") ANIMATION(ANIM_TYPE_MOVE, MOVE_REFLECT_TYPE, player); MESSAGE("Arcanine's type changed to match the Foe Poliwrath's!"); } THEN { - EXPECT_EQ(player->type1, TYPE_WATER); - EXPECT_EQ(player->type2, TYPE_FIGHTING); - EXPECT_EQ(player->type3, TYPE_MYSTERY); + EXPECT_EQ(player->types[0], TYPE_WATER); + EXPECT_EQ(player->types[1], TYPE_FIGHTING); + EXPECT_EQ(player->types[2], TYPE_MYSTERY); } } @@ -145,13 +145,13 @@ SINGLE_BATTLE_TEST("Reflect Type copies a target's pure type") ANIMATION(ANIM_TYPE_MOVE, MOVE_REFLECT_TYPE, player); MESSAGE("Arcanine's type changed to match the Foe Sudowoodo's!"); } THEN { - EXPECT_EQ(player->type1, TYPE_ROCK); - EXPECT_EQ(player->type2, TYPE_ROCK); - EXPECT_EQ(player->type3, TYPE_MYSTERY); + EXPECT_EQ(player->types[0], TYPE_ROCK); + EXPECT_EQ(player->types[1], TYPE_ROCK); + EXPECT_EQ(player->types[2], TYPE_MYSTERY); } } -SINGLE_BATTLE_TEST("Reflect Type defaults to Normal type for the user's type1 and type2 if the target only has a 3rd type") +SINGLE_BATTLE_TEST("Reflect Type defaults to Normal type for the user's types[0] and types[1] if the target only has a 3rd type") { ASSUME(gSpeciesInfo[SPECIES_WOBBUFFET].types[0] == TYPE_PSYCHIC); ASSUME(gSpeciesInfo[SPECIES_WOBBUFFET].types[1] == TYPE_PSYCHIC); @@ -179,8 +179,8 @@ SINGLE_BATTLE_TEST("Reflect Type defaults to Normal type for the user's type1 an ANIMATION(ANIM_TYPE_MOVE, MOVE_REFLECT_TYPE, player); MESSAGE("Wobbuffet's type changed to match the Foe Arcanine's!"); } THEN { - EXPECT_EQ(player->type1, TYPE_NORMAL); - EXPECT_EQ(player->type2, TYPE_NORMAL); - EXPECT_EQ(player->type3, TYPE_GRASS); + EXPECT_EQ(player->types[0], TYPE_NORMAL); + EXPECT_EQ(player->types[1], TYPE_NORMAL); + EXPECT_EQ(player->types[2], TYPE_GRASS); } } diff --git a/test/battle/terrain/electric.c b/test/battle/terrain/electric.c index 2227afdcd9..c39bfbbb71 100644 --- a/test/battle/terrain/electric.c +++ b/test/battle/terrain/electric.c @@ -34,7 +34,7 @@ SINGLE_BATTLE_TEST("Electric Terrain activates Electric Seed and Mimicry") ABILITY_POPUP(opponent); MESSAGE("Foe Stunfisk's type changed to Electric!"); } THEN { - EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_ELECTRIC); + EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].types[0], TYPE_ELECTRIC); } } diff --git a/test/battle/terrain/grassy.c b/test/battle/terrain/grassy.c index 862c9052fd..5840f0310c 100644 --- a/test/battle/terrain/grassy.c +++ b/test/battle/terrain/grassy.c @@ -30,7 +30,7 @@ SINGLE_BATTLE_TEST("Grassy Terrain activates Grassy Seed and Mimicry") ABILITY_POPUP(opponent); MESSAGE("Foe Stunfisk's type changed to Grass!"); } THEN { - EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_GRASS); + EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].types[0], TYPE_GRASS); } } diff --git a/test/battle/terrain/misty.c b/test/battle/terrain/misty.c index cd89b2d9ab..fbf04fcba9 100644 --- a/test/battle/terrain/misty.c +++ b/test/battle/terrain/misty.c @@ -34,7 +34,7 @@ SINGLE_BATTLE_TEST("Misty Terrain activates Misty Seed and Mimicry") ABILITY_POPUP(opponent); MESSAGE("Foe Stunfisk's type changed to Fairy!"); } THEN { - EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_FAIRY); + EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].types[0], TYPE_FAIRY); } } diff --git a/test/battle/terrain/psychic.c b/test/battle/terrain/psychic.c index 0c13122fa6..44a89598d2 100644 --- a/test/battle/terrain/psychic.c +++ b/test/battle/terrain/psychic.c @@ -33,7 +33,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain activates Psychic Seed and Mimicry") ABILITY_POPUP(opponent); MESSAGE("Foe Stunfisk's type changed to Psychic!"); } THEN { - EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_PSYCHIC); + EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].types[0], TYPE_PSYCHIC); } } From 5fbe5a331c0f8ccc0dcce631f6fe8bc6ce94dc76 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Wed, 7 Aug 2024 13:33:35 -0700 Subject: [PATCH 3/4] Updated spacing per https://github.com/rh-hideout/pokeemerald-expansion/pull/5114\#discussion_r1707607637 --- include/battle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/battle.h b/include/battle.h index 090ae5c347..a1007385b7 100644 --- a/include/battle.h +++ b/include/battle.h @@ -839,8 +839,8 @@ STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLER gBattleMons[battlerId].types[2] = TYPE_MYSTERY; \ } -#define RESTORE_BATTLER_TYPE(battlerId) \ -{ \ +#define RESTORE_BATTLER_TYPE(battlerId) \ +{ \ gBattleMons[battlerId].types[0] = gSpeciesInfo[gBattleMons[battlerId].species].types[0]; \ gBattleMons[battlerId].types[1] = gSpeciesInfo[gBattleMons[battlerId].species].types[1]; \ gBattleMons[battlerId].types[2] = TYPE_MYSTERY; \ From b8dab587abddb6b635fbf89153016fdcf4b33600 Mon Sep 17 00:00:00 2001 From: psf <77138753+pkmnsnfrn@users.noreply.github.com> Date: Wed, 7 Aug 2024 14:32:36 -0700 Subject: [PATCH 4/4] Update include/battle.h Co-authored-by: Bassoonian --- include/battle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/battle.h b/include/battle.h index a1007385b7..fdc9575b24 100644 --- a/include/battle.h +++ b/include/battle.h @@ -832,8 +832,8 @@ STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLER #define IS_BATTLER_OF_BASE_TYPE(battlerId, type)((GetBattlerType(battlerId, 0, TRUE) == type || GetBattlerType(battlerId, 1, TRUE) == type || (GetBattlerType(battlerId, 2, TRUE) != TYPE_MYSTERY && GetBattlerType(battlerId, 2, TRUE) == type))) #define IS_BATTLER_TYPELESS(battlerId)(GetBattlerType(battlerId, 0, FALSE) == TYPE_MYSTERY && GetBattlerType(battlerId, 1, FALSE) == TYPE_MYSTERY && GetBattlerType(battlerId, 2, FALSE) == TYPE_MYSTERY) -#define SET_BATTLER_TYPE(battlerId, type) \ -{ \ +#define SET_BATTLER_TYPE(battlerId, type) \ +{ \ gBattleMons[battlerId].types[0] = type; \ gBattleMons[battlerId].types[1] = type; \ gBattleMons[battlerId].types[2] = TYPE_MYSTERY; \