Option to use Gen 3 Physical/Special split.

This commit is contained in:
Eduardo Quezada 2020-10-15 00:16:50 -03:00
parent 00fade28c0
commit 0d39b29691
7 changed files with 24 additions and 10 deletions

View File

@ -549,8 +549,9 @@ struct BattleStruct
typeArg = gBattleMoves[move].type; \ typeArg = gBattleMoves[move].type; \
} }
#define IS_MOVE_PHYSICAL(move)(gBattleMoves[move].split == SPLIT_PHYSICAL) #define IS_MOVE_PHYSICAL(move)(GetBattleMoveSplit(move) == SPLIT_PHYSICAL)
#define IS_MOVE_SPECIAL(move)(gBattleMoves[move].split == SPLIT_SPECIAL) #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 BATTLER_MAX_HP(battlerId)(gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP)
#define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0)) #define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0))

View File

@ -127,5 +127,6 @@ bool32 CanBattlerGetOrLoseItem(u8 battlerId, u16 itemId);
struct Pokemon *GetIllusionMonPtr(u32 battlerId); struct Pokemon *GetIllusionMonPtr(u32 battlerId);
void ClearIllusionMon(u32 battlerId); void ClearIllusionMon(u32 battlerId);
bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId); bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId);
u8 GetBattleMoveSplit(u32 moveId);
#endif // GUARD_BATTLE_UTIL_H #endif // GUARD_BATTLE_UTIL_H

View File

@ -72,6 +72,7 @@
#define B_PSYWAVE_DMG GEN_6 // Psywave's damage formula. See Cmd_psywavedamageeffect. #define B_PSYWAVE_DMG GEN_6 // Psywave's damage formula. See Cmd_psywavedamageeffect.
// Move settings // Move settings
#define B_PHYSICAL_SPECIAL_SPLIT GEN_3 // In Gen3, the move's type determines if it will do physical or special damage.
#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_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_SOUND_SUBSTITUTE GEN_6 // In Gen6+, sound moves bypass Substitute. #define B_SOUND_SUBSTITUTE GEN_6 // In Gen6+, sound moves bypass Substitute.
#define B_TOXIC_NEVER_MISS GEN_6 // In Gen6+, if Toxic is used by a Poison type, it will never miss. #define B_TOXIC_NEVER_MISS GEN_6 // In Gen6+, if Toxic is used by a Poison type, it will never miss.

View File

@ -3,6 +3,7 @@
#include "battle.h" #include "battle.h"
#include "battle_anim.h" #include "battle_anim.h"
#include "battle_ai_script_commands.h" #include "battle_ai_script_commands.h"
#include "battle_config.h"
#include "battle_factory.h" #include "battle_factory.h"
#include "battle_setup.h" #include "battle_setup.h"
#include "data.h" #include "data.h"
@ -2607,7 +2608,7 @@ static bool32 HasMoveWithSplit(u32 battler, u32 split)
for (i = 0; i < MAX_MON_MOVES; i++) 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; return TRUE;
} }
@ -2643,7 +2644,7 @@ static bool32 MovesWithSplitUnusable(u32 attacker, u32 target, u32 split)
{ {
if (moves[i] != MOVE_NONE if (moves[i] != MOVE_NONE
&& moves[i] != 0xFFFF && moves[i] != 0xFFFF
&& gBattleMoves[moves[i]].split == split && GetBattleMoveSplit(moves[i]) == split
&& !(unusable & gBitTable[i])) && !(unusable & gBitTable[i]))
{ {
SetTypeBeforeUsingMove(moves[i], attacker); SetTypeBeforeUsingMove(moves[i], attacker);
@ -2801,19 +2802,19 @@ static void Cmd_get_curr_dmg_hp_percent(void)
static void Cmd_get_move_split_from_result(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; gAIScriptPtr += 1;
} }
static void Cmd_get_considered_move_split(void) 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; gAIScriptPtr += 1;
} }
static void Cmd_get_considered_move_target(void) static void Cmd_get_considered_move_target(void)
{ {
AI_THINKING_STRUCT->funcResult = gBattleMoves[AI_THINKING_STRUCT->moveConsidered].target; AI_THINKING_STRUCT->funcResult = GetBattleMoveSplit(AI_THINKING_STRUCT->moveConsidered);
gAIScriptPtr += 1; gAIScriptPtr += 1;
} }

View File

@ -4288,7 +4288,7 @@ s8 GetMovePriority(u32 battlerId, u16 move)
priority++; priority++;
} }
else if (GetBattlerAbility(battlerId) == ABILITY_PRANKSTER else if (GetBattlerAbility(battlerId) == ABILITY_PRANKSTER
&& gBattleMoves[move].split == SPLIT_STATUS) && GetBattleMoveSplit(move) == SPLIT_STATUS)
{ {
priority++; priority++;
} }

View File

@ -4247,7 +4247,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& TARGET_TURN_DAMAGED && TARGET_TURN_DAMAGED
&& IsBattlerAlive(battler) && IsBattlerAlive(battler)
&& gBattleMoves[gCurrentMove].split == SPLIT_PHYSICAL && GetBattleMoveSplit(gCurrentMove) == SPLIT_PHYSICAL
&& (gBattleMons[battler].statStages[STAT_SPEED] != 12 || gBattleMons[battler].statStages[STAT_DEF] != 0)) && (gBattleMons[battler].statStages[STAT_SPEED] != 12 || gBattleMons[battler].statStages[STAT_DEF] != 0))
{ {
BattleScriptPushCursor(); BattleScriptPushCursor();
@ -7665,3 +7665,13 @@ bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId)
return FALSE; 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;
}

View File

@ -3708,7 +3708,7 @@ static void PrintMoveDetails(u16 move)
{ {
if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES) if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES)
{ {
ShowSplitIcon(gBattleMoves[move].split); ShowSplitIcon(GetBattleMoveSplit(move));
PrintMovePowerAndAccuracy(move); PrintMovePowerAndAccuracy(move);
PrintTextOnWindow(windowId, gMoveDescriptionPointers[move - 1], 6, 1, 0, 0); PrintTextOnWindow(windowId, gMoveDescriptionPointers[move - 1], 6, 1, 0, 0);
} }