diff --git a/include/battle.h b/include/battle.h index f20e250196..4cf4a3a169 100644 --- a/include/battle.h +++ b/include/battle.h @@ -549,8 +549,9 @@ struct BattleStruct typeArg = gBattleMoves[move].type; \ } -#define IS_MOVE_PHYSICAL(move)(gBattleMoves[move].split == SPLIT_PHYSICAL) -#define IS_MOVE_SPECIAL(move)(gBattleMoves[move].split == SPLIT_SPECIAL) +#define IS_MOVE_PHYSICAL(move)(GetBattleMoveSplit(move) == SPLIT_PHYSICAL) +#define IS_MOVE_SPECIAL(move)(GetBattleMoveSplit(move) == SPLIT_SPECIAL) +#define IS_MOVE_STATUS(move)(gBattleMoves[move].split == SPLIT_STATUS) #define BATTLER_MAX_HP(battlerId)(gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP) #define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0)) diff --git a/include/battle_util.h b/include/battle_util.h index bbd33e2914..ab98796c1b 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -128,5 +128,6 @@ struct Pokemon *GetIllusionMonPtr(u32 battlerId); void ClearIllusionMon(u32 battlerId); bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId); bool8 ShouldGetStatBadgeBoost(u16 flagId, u8 battlerId); +u8 GetBattleMoveSplit(u32 moveId); #endif // GUARD_BATTLE_UTIL_H diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index f3b5ba13ce..de629a46c1 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -82,6 +82,7 @@ // Move data settings #define B_UPDATED_MOVE_DATA GEN_7 // Updates move data in gBattleMoves, including Power, Accuracy, PP, stat changes, targets, chances of secondary effects, etc. +#define B_PHYSICAL_SPECIAL_SPLIT GEN_6 // In Gen3, the move's type determines if it will do physical or special damage. The split icon in the summary will reflect this. #define B_FELL_STINGER_STAT_RAISE GEN_6 // In Gen7+, it raises Atk by 3 stages instead of 2 if it causes the target to faint. #define B_KINGS_SHIELD_LOWER_ATK GEN_6 // 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. @@ -110,14 +111,16 @@ #define B_HP_BERRIES GEN_6 // In Gen4+, berries which restore hp activate immediately after hp drops to half. In gen3, the effect occurs at the end of the turn. #define B_BERRIES_INSTANT GEN_6 // In Gen4+, most berries activate on battle start/switch-in if applicable. In gen3, they only activate either at the move end or turn end. -// Flag settings. Replace the 0s with defined flags to be able to toggle the following features using those flags. -#define B_FLAG_INVERSE_BATTLE 0 // If the flag is set, the battle's type effectiveness are inversed. For example, fire is super effective against water. -#define B_FLAG_FORCE_DOUBLE_WILD 0 // If the flag is set, all land and surfing wild battles will be double battles. +// Flag settings. +// To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag for toggling the feature. +#define B_FLAG_INVERSE_BATTLE 0 // If this flag is set, the battle's type effectiveness are inversed. For example, fire is super effective against water. +#define B_FLAG_FORCE_DOUBLE_WILD 0 // If this flag is set, all land and surfing wild battles will be double battles. // Interface settings #define B_ABILITY_POP_UP TRUE // In Gen5+, the Pokémon abilities are displayed in a pop-up, when they activate in battle. #define B_FAST_INTRO TRUE // If set to TRUE, battle intro texts print at the same time as animation of a Pokémon, as opposing to waiting for the animation to end. #define B_SHOW_TARGETS TRUE // If set to TRUE, all available targets, for moves hitting 2 or 3 Pokémon, will be shown before selecting a move. +#define B_SHOW_SPLIT_ICON TRUE // If set to TRUE, it will show an icon in the summary showing the move's category split. // Other #define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. @@ -126,20 +129,20 @@ #define B_POWDER_GRASS GEN_6 // In Gen6+, Grass type Pokémon are immune to powder and spore moves. // Animation Settings -#define B_NEW_SWORD_PARTICLE TRUE // update swords dance particle -#define B_NEW_LEECH_SEED_PARTICLE TRUE //update leech seed's animation particle -#define B_NEW_HORN_ATTACK_PARTICLE TRUE //update horn attack's horn -#define B_NEW_LEAF_PARTICLE TRUE // update leaf particle -#define B_NEW_EMBER_PARTICLES TRUE //updates ember fire particle -#define B_NEW_MEAN_LOOK_PARTICLE TRUE //update mean look eye -#define B_NEW_TEETH_PARTICLE TRUE //update bite/crunch teeth particle -#define B_NEW_HANDS_FEET_PARTICLE TRUE //update chop/kick/punch particles -#define B_NEW_SPIKES_PARTICLE TRUE //update spikes particle -#define B_NEW_FLY_BUBBLE_PARTICLE TRUE //update fly 'bubble' particle -#define B_NEW_CURSE_NAIL_PARTICLE TRUE //updates curse nail -#define B_NEW_BATON_PASS_BALL_PARTICLE TRUE //update baton pass pokeball sprite -#define B_NEW_MORNING_SUN_STAR_PARTICLE TRUE //updates morning sun star particles -#define B_NEW_IMPACT_PALETTE TRUE //updates the basic 'hit' particle -#define B_NEW_SURF_PARTICLE_PALETTE TRUE //updates the surf wave palette +#define B_NEW_SWORD_PARTICLE TRUE // If set to TRUE, it updates Swords Dance's particle. +#define B_NEW_LEECH_SEED_PARTICLE TRUE // If set to TRUE, it updates Leech Seed's animation particle. +#define B_NEW_HORN_ATTACK_PARTICLE TRUE // If set to TRUE, it updates Horn Attack's horn particle. +#define B_NEW_LEAF_PARTICLE TRUE // If set to TRUE, it updates leaf particle. +#define B_NEW_EMBER_PARTICLES TRUE // If set to TRUE, it updates Ember's fire particle. +#define B_NEW_MEAN_LOOK_PARTICLE TRUE // If set to TRUE, it updates Mean Look's eye particle. +#define B_NEW_TEETH_PARTICLE TRUE // If set to TRUE, it updates Bite/Crunch teeth particle. +#define B_NEW_HANDS_FEET_PARTICLE TRUE // If set to TRUE, it updates chop/kick/punch particles. +#define B_NEW_SPIKES_PARTICLE TRUE // If set to TRUE, it updates Spikes particle. +#define B_NEW_FLY_BUBBLE_PARTICLE TRUE // If set to TRUE, it updates Fly's 'bubble' particle. +#define B_NEW_CURSE_NAIL_PARTICLE TRUE // If set to TRUE, it updates Curse's nail. +#define B_NEW_BATON_PASS_BALL_PARTICLE TRUE // If set to TRUE, it updates Baton Pass' Poké Ball sprite. +#define B_NEW_MORNING_SUN_STAR_PARTICLE TRUE // If set to TRUE, it updates Morning Sun's star particles. +#define B_NEW_IMPACT_PALETTE TRUE // If set to TRUE, it updates the basic 'hit' palette. +#define B_NEW_SURF_PARTICLE_PALETTE TRUE // If set to TRUE, it updates Surf's wave palette. #endif // GUARD_CONSTANTS_BATTLE_CONFIG_H diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index d9230d6d06..39246c732e 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -2607,7 +2607,7 @@ static bool32 HasMoveWithSplit(u32 battler, u32 split) for (i = 0; i < MAX_MON_MOVES; i++) { - if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && gBattleMoves[moves[i]].split == split) + if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && GetBattleMoveSplit(moves[i]) == split) return TRUE; } @@ -2643,7 +2643,7 @@ static bool32 MovesWithSplitUnusable(u32 attacker, u32 target, u32 split) { if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF - && gBattleMoves[moves[i]].split == split + && GetBattleMoveSplit(moves[i]) == split && !(unusable & gBitTable[i])) { SetTypeBeforeUsingMove(moves[i], attacker); @@ -2801,13 +2801,13 @@ static void Cmd_get_curr_dmg_hp_percent(void) static void Cmd_get_move_split_from_result(void) { - AI_THINKING_STRUCT->funcResult = gBattleMoves[AI_THINKING_STRUCT->funcResult].split; + AI_THINKING_STRUCT->funcResult = GetBattleMoveSplit(AI_THINKING_STRUCT->funcResult); gAIScriptPtr += 1; } static void Cmd_get_considered_move_split(void) { - AI_THINKING_STRUCT->funcResult = gBattleMoves[AI_THINKING_STRUCT->moveConsidered].split; + AI_THINKING_STRUCT->funcResult = GetBattleMoveSplit(AI_THINKING_STRUCT->moveConsidered); gAIScriptPtr += 1; } diff --git a/src/battle_main.c b/src/battle_main.c index 93819aed2a..accd7605be 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4287,8 +4287,7 @@ s8 GetMovePriority(u32 battlerId, u16 move) { priority++; } - else if (GetBattlerAbility(battlerId) == ABILITY_PRANKSTER - && gBattleMoves[move].split == SPLIT_STATUS) + else if (GetBattlerAbility(battlerId) == ABILITY_PRANKSTER && IS_MOVE_STATUS(move)) { priority++; } diff --git a/src/battle_util.c b/src/battle_util.c index be45dcf7cc..f047cc882b 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4247,7 +4247,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && TARGET_TURN_DAMAGED && IsBattlerAlive(battler) - && gBattleMoves[gCurrentMove].split == SPLIT_PHYSICAL + && IS_MOVE_PHYSICAL(gCurrentMove) && (gBattleMons[battler].statStages[STAT_SPEED] != 12 || gBattleMons[battler].statStages[STAT_DEF] != 0)) { BattleScriptPushCursor(); @@ -7695,3 +7695,13 @@ bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId) else return FALSE; } + +u8 GetBattleMoveSplit(u32 moveId) +{ + if (IS_MOVE_STATUS(moveId) || B_PHYSICAL_SPECIAL_SPLIT >= GEN_4) + return gBattleMoves[moveId].split; + else if (gBattleMoves[moveId].type < TYPE_MYSTERY) + return SPLIT_PHYSICAL; + else + return SPLIT_SPECIAL; +} diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 797f42f6e2..93b20fef80 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -46,6 +46,7 @@ #include "constants/region_map_sections.h" #include "constants/rgb.h" #include "constants/songs.h" +#include "constants/battle_config.h" // Screen titles (upper left) #define PSS_LABEL_WINDOW_POKEMON_INFO_TITLE 0 @@ -3708,7 +3709,8 @@ static void PrintMoveDetails(u16 move) { if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES) { - ShowSplitIcon(gBattleMoves[move].split); + if (B_SHOW_SPLIT_ICON == TRUE) + ShowSplitIcon(GetBattleMoveSplit(move)); PrintMovePowerAndAccuracy(move); PrintTextOnWindow(windowId, gMoveDescriptionPointers[move - 1], 6, 1, 0, 0); }