diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 11cf51770f..6306ca687c 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -150,6 +150,7 @@ #define B_KINGS_SHIELD_LOWER_ATK GEN_7 // In Gen7+, it lowers Atk by 1 stage instead of 2 of oponents that hit it. #define B_SPEED_BUFFING_RAPID_SPIN GEN_8 // In Gen8, Rapid Spin raises the user's Speed by 1 stage. #define B_RECOIL_IF_MISS_DMG GEN_7 // In Gen5+, Jump Kick and High Jump Kick will always do half of the user's max HP when missing. +#define B_UPDATED_CONVERSION GEN_7 // In Gen6+, Conversion changes the user's type to match their first move's. Before, it would choose a move at random. // Move accuracy settings #define B_TOXIC_NEVER_MISS GEN_7 // In Gen6+, if Toxic is used by a Poison-type Pokémon, it will never miss. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index a078122b2d..e67eb917b2 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10560,12 +10560,34 @@ static void Cmd_forcerandomswitch(void) } } -static void Cmd_tryconversiontypechange(void) // randomly changes user's type to one of its moves' type +static void Cmd_tryconversiontypechange(void) { u8 validMoves = 0; u8 moveChecked; u8 moveType; +#if B_UPDATED_CONVERSION >= GEN_6 + // changes user's type to its first move's type + for (moveChecked = 0; moveChecked < MAX_MON_MOVES; moveChecked++) + { + if (gBattleMons[gBattlerAttacker].moves[moveChecked] != MOVE_NONE) + { + moveType = gBattleMoves[gBattleMons[gBattlerAttacker].moves[moveChecked]].type; + break; + } + } + if (IS_BATTLER_OF_TYPE(gBattlerAttacker, moveType)) + { + gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); + } + else + { + SET_BATTLER_TYPE(gBattlerAttacker, moveType); + PREPARE_TYPE_BUFFER(gBattleTextBuff1, moveType); + gBattlescriptCurrInstr += 5; + } +#else + // randomly changes user's type to one of its moves' type while (validMoves < MAX_MON_MOVES) { if (gBattleMons[gBattlerAttacker].moves[validMoves] == 0) @@ -10621,6 +10643,7 @@ static void Cmd_tryconversiontypechange(void) // randomly changes user's type to gBattlescriptCurrInstr += 5; } +#endif } static void Cmd_givepaydaymoney(void)