mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 04:04:17 +01:00
IsAiAiBattle function
This commit is contained in:
parent
d0fe75b06a
commit
fec8f14fff
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
bool32 AI_RandLessThan(u8 val);
|
bool32 AI_RandLessThan(u8 val);
|
||||||
void RecordLastUsedMoveByTarget(void);
|
void RecordLastUsedMoveByTarget(void);
|
||||||
|
bool32 IsAiVsAiBattle(void);
|
||||||
bool32 BattlerHasAi(u32 battlerId);
|
bool32 BattlerHasAi(u32 battlerId);
|
||||||
bool32 IsAiBattlerAware(u32 battlerId);
|
bool32 IsAiBattlerAware(u32 battlerId);
|
||||||
void ClearBattlerMoveHistory(u8 battlerId);
|
void ClearBattlerMoveHistory(u8 battlerId);
|
||||||
|
@ -1001,6 +1001,9 @@ static bool8 ShouldUseItem(void)
|
|||||||
u8 validMons = 0;
|
u8 validMons = 0;
|
||||||
bool8 shouldUse = FALSE;
|
bool8 shouldUse = FALSE;
|
||||||
|
|
||||||
|
if (IsAiVsAiBattle())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
// If teaming up with player and Pokemon is on the right, or Pokemon is currently held by Sky Drop
|
// If teaming up with player and Pokemon is on the right, or Pokemon is currently held by Sky Drop
|
||||||
if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT)
|
if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT)
|
||||||
|| gStatuses3[gActiveBattler] & STATUS3_SKY_DROPPED)
|
|| gStatuses3[gActiveBattler] & STATUS3_SKY_DROPPED)
|
||||||
|
@ -441,19 +441,24 @@ void RecordLastUsedMoveByTarget(void)
|
|||||||
RecordKnownMove(gBattlerTarget, gLastMoves[gBattlerTarget]);
|
RecordKnownMove(gBattlerTarget, gLastMoves[gBattlerTarget]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool32 IsAiVsAiBattle(void)
|
||||||
|
{
|
||||||
|
return (B_FLAG_AI_VS_AI_BATTLE && FlagGet(B_FLAG_AI_VS_AI_BATTLE));
|
||||||
|
}
|
||||||
|
|
||||||
bool32 BattlerHasAi(u32 battlerId)
|
bool32 BattlerHasAi(u32 battlerId)
|
||||||
{
|
{
|
||||||
switch (GetBattlerPosition(battlerId))
|
switch (GetBattlerPosition(battlerId))
|
||||||
{
|
{
|
||||||
case B_POSITION_PLAYER_LEFT:
|
case B_POSITION_PLAYER_LEFT:
|
||||||
if (FlagGet(B_FLAG_AI_VS_AI_BATTLE))
|
if (IsAiVsAiBattle())
|
||||||
return TRUE;
|
return TRUE;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
case B_POSITION_OPPONENT_LEFT:
|
case B_POSITION_OPPONENT_LEFT:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case B_POSITION_PLAYER_RIGHT:
|
case B_POSITION_PLAYER_RIGHT:
|
||||||
if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) || FlagGet(B_FLAG_AI_VS_AI_BATTLE))
|
if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) || IsAiVsAiBattle())
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#include "battle_z_move.h"
|
#include "battle_z_move.h"
|
||||||
#include "bg.h"
|
#include "bg.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "event_data.h"
|
|
||||||
#include "item_use.h"
|
#include "item_use.h"
|
||||||
#include "link.h"
|
#include "link.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
@ -1317,7 +1316,7 @@ static void PlayerPartnerHandleDrawTrainerPic(void)
|
|||||||
xPos = 90;
|
xPos = 90;
|
||||||
yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80;
|
yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80;
|
||||||
}
|
}
|
||||||
else if (FlagGet(B_FLAG_AI_VS_AI_BATTLE))
|
else if (IsAiVsAiBattle())
|
||||||
{
|
{
|
||||||
trainerPicId = gTrainers[gPartnerTrainerId].trainerPic;
|
trainerPicId = gTrainers[gPartnerTrainerId].trainerPic;
|
||||||
xPos = 60;
|
xPos = 60;
|
||||||
@ -1830,7 +1829,7 @@ static void PlayerPartnerHandleIntroTrainerBallThrow(void)
|
|||||||
u8 spriteId = gPartnerSpriteId;
|
u8 spriteId = gPartnerSpriteId;
|
||||||
LoadCompressedPalette(gTrainerBackPicPaletteTable[spriteId].data, 0x100 + paletteNum * 16, 32);
|
LoadCompressedPalette(gTrainerBackPicPaletteTable[spriteId].data, 0x100 + paletteNum * 16, 32);
|
||||||
}
|
}
|
||||||
else if (FlagGet(B_FLAG_AI_VS_AI_BATTLE))
|
else if (IsAiVsAiBattle())
|
||||||
{
|
{
|
||||||
u8 spriteId = gTrainers[gPartnerTrainerId].trainerPic;
|
u8 spriteId = gTrainers[gPartnerTrainerId].trainerPic;
|
||||||
LoadCompressedPalette(gTrainerFrontPicPaletteTable[spriteId].data, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP);
|
LoadCompressedPalette(gTrainerFrontPicPaletteTable[spriteId].data, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP);
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "battle.h"
|
#include "battle.h"
|
||||||
#include "battle_ai_main.h"
|
#include "battle_ai_main.h"
|
||||||
|
#include "battle_ai_util.h"
|
||||||
#include "battle_anim.h"
|
#include "battle_anim.h"
|
||||||
#include "battle_controllers.h"
|
#include "battle_controllers.h"
|
||||||
#include "battle_message.h"
|
#include "battle_message.h"
|
||||||
#include "battle_setup.h"
|
#include "battle_setup.h"
|
||||||
#include "cable_club.h"
|
#include "cable_club.h"
|
||||||
#include "event_data.h"
|
|
||||||
#include "link.h"
|
#include "link.h"
|
||||||
#include "link_rfu.h"
|
#include "link_rfu.h"
|
||||||
#include "party_menu.h"
|
#include "party_menu.h"
|
||||||
@ -171,7 +171,7 @@ static void InitSinglePlayerBtlControllers(void)
|
|||||||
gBattlerControllerFuncs[0] = SetControllerToSafari;
|
gBattlerControllerFuncs[0] = SetControllerToSafari;
|
||||||
else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL)
|
else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL)
|
||||||
gBattlerControllerFuncs[0] = SetControllerToWally;
|
gBattlerControllerFuncs[0] = SetControllerToWally;
|
||||||
else if (FlagGet(B_FLAG_AI_VS_AI_BATTLE))
|
else if (IsAiVsAiBattle())
|
||||||
gBattlerControllerFuncs[0] = SetControllerToPlayerPartner;
|
gBattlerControllerFuncs[0] = SetControllerToPlayerPartner;
|
||||||
else
|
else
|
||||||
gBattlerControllerFuncs[0] = SetControllerToPlayer;
|
gBattlerControllerFuncs[0] = SetControllerToPlayer;
|
||||||
@ -224,7 +224,7 @@ static void InitSinglePlayerBtlControllers(void)
|
|||||||
{
|
{
|
||||||
gBattleMainFunc = BeginBattleIntro;
|
gBattleMainFunc = BeginBattleIntro;
|
||||||
|
|
||||||
if (FlagGet(B_FLAG_AI_VS_AI_BATTLE))
|
if (IsAiVsAiBattle())
|
||||||
gBattlerControllerFuncs[0] = SetControllerToPlayerPartner;
|
gBattlerControllerFuncs[0] = SetControllerToPlayerPartner;
|
||||||
else
|
else
|
||||||
gBattlerControllerFuncs[0] = SetControllerToPlayer;
|
gBattlerControllerFuncs[0] = SetControllerToPlayer;
|
||||||
@ -233,7 +233,7 @@ static void InitSinglePlayerBtlControllers(void)
|
|||||||
gBattlerControllerFuncs[1] = SetControllerToOpponent;
|
gBattlerControllerFuncs[1] = SetControllerToOpponent;
|
||||||
gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT;
|
gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT;
|
||||||
|
|
||||||
if (FlagGet(B_FLAG_AI_VS_AI_BATTLE))
|
if (IsAiVsAiBattle())
|
||||||
gBattlerControllerFuncs[2] = SetControllerToPlayerPartner;
|
gBattlerControllerFuncs[2] = SetControllerToPlayerPartner;
|
||||||
else
|
else
|
||||||
gBattlerControllerFuncs[2] = SetControllerToPlayer;
|
gBattlerControllerFuncs[2] = SetControllerToPlayer;
|
||||||
|
Loading…
Reference in New Issue
Block a user