diff --git a/include/battle.h b/include/battle.h index 1aa26a9470..fdc9575b24 100644 --- a/include/battle.h +++ b/include/battle.h @@ -832,18 +832,18 @@ 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) \ -{ \ - gBattleMons[battlerId].type1 = type; \ - gBattleMons[battlerId].type2 = type; \ - gBattleMons[battlerId].type3 = TYPE_MYSTERY; \ +#define SET_BATTLER_TYPE(battlerId, type) \ +{ \ + gBattleMons[battlerId].types[0] = type; \ + gBattleMons[battlerId].types[1] = type; \ + gBattleMons[battlerId].types[2] = TYPE_MYSTERY; \ } -#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 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; \ } #define IS_BATTLER_PROTECTED(battlerId)(gProtectStructs[battlerId].protected \ diff --git a/include/battle_controllers.h b/include/battle_controllers.h index a670113bc7..71a7691448 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -125,9 +125,7 @@ struct ChooseMoveStruct u8 currentPp[MAX_MON_MOVES]; u8 maxPp[MAX_MON_MOVES]; u16 species; - u8 monType1; - u8 monType2; - u8 monType3; + u8 monTypes[3]; struct ZMoveData zmove; }; diff --git a/include/pokemon.h b/include/pokemon.h index b299ab7d61..d1484fe2ce 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -323,9 +323,7 @@ struct BattlePokemon /*0x17*/ u32 abilityNum:2; /*0x18*/ s8 statStages[NUM_BATTLE_STATS]; /*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; diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index d23c0c1e32..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++) @@ -1236,8 +1236,8 @@ static u32 GetBestMonTypeMatchup(struct Pokemon *party, int firstId, int lastId, u16 species = GetMonData(&party[i], MON_DATA_SPECIES); uq4_12_t typeEffectiveness = UQ_4_12(1.0); - 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]; @@ -1337,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; @@ -1404,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; @@ -1412,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; @@ -1465,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) @@ -1499,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) @@ -1524,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; @@ -1706,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))); @@ -2002,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 6dcea9eb98..5fac761cf7 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -1733,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 728db40af2..cb3349ee32 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -1114,7 +1114,7 @@ void LoadAndCreateEnemyShadowSprites(void) u32 i; LoadCompressedSpriteSheet(&gSpriteSheet_EnemyShadow); - + // initialize shadow sprite ids for (i = 0; i < gBattlersCount; i++) { @@ -1123,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 9df19b9566..6bbcc0e3bc 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3368,9 +3368,9 @@ const u8* FaintClearSetData(u32 battler) gBattleResources->flags->flags[battler] = 0; - 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; Ai_UpdateFaintData(battler); TryBattleFormChange(battler, FORM_CHANGE_FAINT); @@ -3470,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; @@ -4263,9 +4263,9 @@ static void HandleTurnActionSelectionState(void) 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.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++) { @@ -5828,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 f25cef9cf5..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) { @@ -5067,8 +5067,8 @@ static void Cmd_setroost(void) CMD_ARGS(); 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; } @@ -6514,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) @@ -10152,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; } @@ -12230,9 +12230,9 @@ 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; } @@ -12258,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); @@ -16523,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 2b731ef13c..66fb83332f 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -3682,9 +3682,9 @@ 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); 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); } }