2017-03-05 08:35:03 +01:00
|
|
|
#ifndef GUARD_BATTLE_H
|
|
|
|
#define GUARD_BATTLE_H
|
|
|
|
|
2017-10-06 17:06:45 +02:00
|
|
|
// should they be included here or included individually by every file?
|
2018-02-08 00:35:13 +01:00
|
|
|
#include "constants/battle.h"
|
2018-02-26 15:56:59 +01:00
|
|
|
#include "battle_main.h"
|
2018-06-30 15:35:54 +02:00
|
|
|
#include "battle_message.h"
|
2017-10-06 17:06:45 +02:00
|
|
|
#include "battle_util.h"
|
|
|
|
#include "battle_script_commands.h"
|
2017-10-10 21:45:07 +02:00
|
|
|
#include "battle_ai_switch_items.h"
|
2017-11-04 16:11:13 +01:00
|
|
|
#include "battle_gfx_sfx_util.h"
|
2017-11-12 16:39:21 +01:00
|
|
|
#include "battle_util2.h"
|
2017-12-17 20:10:57 +01:00
|
|
|
#include "battle_bg.h"
|
2018-07-13 23:00:56 +02:00
|
|
|
#include "battle_debug.h"
|
2017-10-06 17:06:45 +02:00
|
|
|
|
2018-02-06 02:46:59 +01:00
|
|
|
#define GET_BATTLER_POSITION(battler) (gBattlerPositions[battler])
|
|
|
|
#define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE)
|
|
|
|
#define GET_BATTLER_SIDE2(battler) (GET_BATTLER_POSITION(battler) & BIT_SIDE)
|
2018-01-16 22:12:38 +01:00
|
|
|
|
2018-02-06 23:09:39 +01:00
|
|
|
// Battle Actions
|
|
|
|
// These determine what each battler will do in a turn
|
|
|
|
#define B_ACTION_USE_MOVE 0
|
|
|
|
#define B_ACTION_USE_ITEM 1
|
|
|
|
#define B_ACTION_SWITCH 2
|
|
|
|
#define B_ACTION_RUN 3
|
|
|
|
#define B_ACTION_SAFARI_WATCH_CAREFULLY 4
|
|
|
|
#define B_ACTION_SAFARI_BALL 5
|
|
|
|
#define B_ACTION_SAFARI_POKEBLOCK 6
|
|
|
|
#define B_ACTION_SAFARI_GO_NEAR 7
|
|
|
|
#define B_ACTION_SAFARI_RUN 8
|
|
|
|
// The exact purposes of these are unclear
|
2018-06-20 23:07:51 +02:00
|
|
|
#define B_ACTION_WALLY_THROW 9
|
2018-02-06 23:09:39 +01:00
|
|
|
#define B_ACTION_EXEC_SCRIPT 10 // when executing an action
|
|
|
|
#define B_ACTION_CANCEL_PARTNER 12 // when choosing an action
|
|
|
|
#define B_ACTION_FINISHED 12 // when executing an action
|
|
|
|
#define B_ACTION_NOTHING_FAINTED 13 // when choosing an action
|
2018-07-13 23:00:56 +02:00
|
|
|
#define B_ACTION_DEBUG 20
|
2018-02-06 23:09:39 +01:00
|
|
|
#define B_ACTION_NONE 0xFF
|
2017-10-04 19:25:14 +02:00
|
|
|
|
2017-09-04 21:43:13 +02:00
|
|
|
#define MAX_TRAINER_ITEMS 4
|
|
|
|
#define MAX_MON_MOVES 4
|
|
|
|
|
2017-09-27 23:43:45 +02:00
|
|
|
#define BATTLE_TERRAIN_GRASS 0
|
|
|
|
#define BATTLE_TERRAIN_LONG_GRASS 1
|
|
|
|
#define BATTLE_TERRAIN_SAND 2
|
|
|
|
#define BATTLE_TERRAIN_UNDERWATER 3
|
|
|
|
#define BATTLE_TERRAIN_WATER 4
|
|
|
|
#define BATTLE_TERRAIN_POND 5
|
2017-11-28 23:02:09 +01:00
|
|
|
#define BATTLE_TERRAIN_MOUNTAIN 6
|
2017-09-27 23:43:45 +02:00
|
|
|
#define BATTLE_TERRAIN_CAVE 7
|
2017-11-28 23:02:09 +01:00
|
|
|
#define BATTLE_TERRAIN_BUILDING 8
|
2017-10-27 18:52:21 +02:00
|
|
|
#define BATTLE_TERRAIN_PLAIN 9
|
2017-09-27 23:43:45 +02:00
|
|
|
|
2017-09-17 14:10:32 +02:00
|
|
|
// array entries for battle communication
|
2017-10-01 01:12:42 +02:00
|
|
|
#define MULTIUSE_STATE 0x0
|
|
|
|
#define CURSOR_POSITION 0x1
|
|
|
|
#define TASK_ID 0x1 // task Id and cursor position share the same field
|
|
|
|
#define SPRITES_INIT_STATE1 0x1 // shares the Id as well
|
|
|
|
#define SPRITES_INIT_STATE2 0x2
|
|
|
|
#define MOVE_EFFECT_BYTE 0x3
|
2017-10-04 19:25:14 +02:00
|
|
|
#define ACTIONS_CONFIRMED_COUNT 0x4
|
2017-10-01 01:12:42 +02:00
|
|
|
#define MULTISTRING_CHOOSER 0x5
|
|
|
|
#define MSG_DISPLAY 0x7
|
2017-10-02 23:32:39 +02:00
|
|
|
#define BATTLE_COMMUNICATION_ENTRIES_COUNT 0x8
|
2017-09-17 14:10:32 +02:00
|
|
|
|
2018-02-26 13:24:46 +01:00
|
|
|
#define MOVE_TARGET_SELECTED 0x0
|
|
|
|
#define MOVE_TARGET_DEPENDS 0x1
|
|
|
|
#define MOVE_TARGET_USER_OR_SELECTED 0x2
|
|
|
|
#define MOVE_TARGET_RANDOM 0x4
|
|
|
|
#define MOVE_TARGET_BOTH 0x8
|
|
|
|
#define MOVE_TARGET_USER 0x10
|
|
|
|
#define MOVE_TARGET_FOES_AND_ALLY 0x20
|
|
|
|
#define MOVE_TARGET_OPPONENTS_FIELD 0x40
|
2017-09-04 21:43:13 +02:00
|
|
|
|
2018-02-07 23:21:51 +01:00
|
|
|
#define BATTLE_BUFFER_LINK_SIZE 0x1000
|
|
|
|
|
2017-09-25 00:09:13 +02:00
|
|
|
struct TrainerMonNoItemDefaultMoves
|
|
|
|
{
|
2017-10-01 18:54:01 +02:00
|
|
|
u16 iv;
|
2017-09-25 00:09:13 +02:00
|
|
|
u8 lvl;
|
2017-10-01 18:54:01 +02:00
|
|
|
u16 species;
|
2017-09-25 00:09:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct TrainerMonItemDefaultMoves
|
|
|
|
{
|
2017-10-01 18:54:01 +02:00
|
|
|
u16 iv;
|
2017-09-25 00:09:13 +02:00
|
|
|
u8 lvl;
|
2017-10-01 18:54:01 +02:00
|
|
|
u16 species;
|
2017-09-25 00:09:13 +02:00
|
|
|
u16 heldItem;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TrainerMonNoItemCustomMoves
|
|
|
|
{
|
2017-10-01 18:54:01 +02:00
|
|
|
u16 iv;
|
2017-09-25 00:09:13 +02:00
|
|
|
u8 lvl;
|
2017-10-01 18:54:01 +02:00
|
|
|
u16 species;
|
2017-09-25 00:09:13 +02:00
|
|
|
u16 moves[4];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TrainerMonItemCustomMoves
|
|
|
|
{
|
2017-10-01 18:54:01 +02:00
|
|
|
u16 iv;
|
2017-09-25 00:09:13 +02:00
|
|
|
u8 lvl;
|
2017-10-01 18:54:01 +02:00
|
|
|
u16 species;
|
2017-09-25 00:09:13 +02:00
|
|
|
u16 heldItem;
|
|
|
|
u16 moves[4];
|
|
|
|
};
|
|
|
|
|
|
|
|
union TrainerMonPtr
|
|
|
|
{
|
2018-07-21 05:08:38 +02:00
|
|
|
const struct TrainerMonNoItemDefaultMoves *NoItemDefaultMoves;
|
|
|
|
const struct TrainerMonNoItemCustomMoves *NoItemCustomMoves;
|
|
|
|
const struct TrainerMonItemDefaultMoves *ItemDefaultMoves;
|
|
|
|
const struct TrainerMonItemCustomMoves *ItemCustomMoves;
|
2017-09-25 00:09:13 +02:00
|
|
|
};
|
|
|
|
|
2017-09-05 09:41:48 +02:00
|
|
|
struct Trainer
|
|
|
|
{
|
|
|
|
/*0x00*/ u8 partyFlags;
|
|
|
|
/*0x01*/ u8 trainerClass;
|
2017-09-11 11:35:41 +02:00
|
|
|
/*0x02*/ u8 encounterMusic_gender; // last bit is gender
|
2017-09-05 09:41:48 +02:00
|
|
|
/*0x03*/ u8 trainerPic;
|
|
|
|
/*0x04*/ u8 trainerName[12];
|
|
|
|
/*0x10*/ u16 items[4];
|
|
|
|
/*0x18*/ bool8 doubleBattle;
|
|
|
|
/*0x1C*/ u32 aiFlags;
|
|
|
|
/*0x20*/ u8 partySize;
|
2017-09-25 00:09:13 +02:00
|
|
|
/*0x24*/ union TrainerMonPtr party;
|
2017-09-05 09:41:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct Trainer gTrainers[];
|
2017-09-04 21:43:13 +02:00
|
|
|
|
2017-09-11 11:35:41 +02:00
|
|
|
#define TRAINER_ENCOUNTER_MUSIC(trainer)((gTrainers[trainer].encounterMusic_gender & 0x7F))
|
|
|
|
|
2017-09-04 21:43:13 +02:00
|
|
|
struct UnknownFlags
|
|
|
|
{
|
|
|
|
u32 flags[4];
|
|
|
|
};
|
|
|
|
|
2018-07-19 21:18:20 +02:00
|
|
|
#define RESOURCE_FLAG_FLASH_FIRE 0x1
|
|
|
|
#define RESOURCE_FLAG_ROOST 0x2
|
2017-09-04 21:43:13 +02:00
|
|
|
|
|
|
|
struct DisableStruct
|
|
|
|
{
|
2017-10-22 01:04:02 +02:00
|
|
|
/*0x00*/ u32 transformedMonPersonality;
|
2017-09-04 21:43:13 +02:00
|
|
|
/*0x04*/ u16 disabledMove;
|
|
|
|
/*0x06*/ u16 encoredMove;
|
|
|
|
/*0x08*/ u8 protectUses;
|
|
|
|
/*0x09*/ u8 stockpileCounter;
|
|
|
|
/*0x0A*/ u8 substituteHP;
|
2018-06-20 23:07:51 +02:00
|
|
|
/*0x0B*/ u8 disableTimer1:4;
|
|
|
|
/*0x0B*/ u8 disableTimer2:4;
|
2017-09-04 21:43:13 +02:00
|
|
|
/*0x0C*/ u8 encoredMovePos;
|
|
|
|
/*0x0D*/ u8 unkD;
|
2018-06-20 23:07:51 +02:00
|
|
|
/*0x0E*/ u8 encoreTimer1:4;
|
|
|
|
/*0x0E*/ u8 encoreTimer2:4;
|
|
|
|
/*0x0F*/ u8 perishSongTimer1:4;
|
|
|
|
/*0x0F*/ u8 perishSongTimer2:4;
|
2017-09-04 21:43:13 +02:00
|
|
|
/*0x10*/ u8 furyCutterCounter;
|
2018-06-20 23:07:51 +02:00
|
|
|
/*0x11*/ u8 rolloutCounter1:4;
|
|
|
|
/*0x11*/ u8 rolloutCounter2:4;
|
|
|
|
/*0x12*/ u8 chargeTimer1:4;
|
|
|
|
/*0x12*/ u8 chargeTimer2:4;
|
2017-09-04 21:43:13 +02:00
|
|
|
/*0x13*/ u8 tauntTimer1:4;
|
|
|
|
/*0x13*/ u8 tauntTimer2:4;
|
2018-02-06 23:09:39 +01:00
|
|
|
/*0x14*/ u8 battlerPreventingEscape;
|
|
|
|
/*0x15*/ u8 battlerWithSureHit;
|
2017-09-04 21:43:13 +02:00
|
|
|
/*0x16*/ u8 isFirstTurn;
|
|
|
|
/*0x17*/ u8 unk17;
|
2018-06-20 23:07:51 +02:00
|
|
|
/*0x18*/ u8 truantCounter:1;
|
|
|
|
/*0x18*/ u8 truantUnknownBit:1;
|
|
|
|
/*0x18*/ u8 unk18_a_2:2;
|
|
|
|
/*0x18*/ u8 unk18_b:4;
|
2017-09-04 21:43:13 +02:00
|
|
|
/*0x19*/ u8 rechargeCounter;
|
2018-07-14 16:41:14 +02:00
|
|
|
/*0x1A*/ u8 autonomizeCount;
|
|
|
|
/*0x1B*/ u8 slowStartTimer;
|
2018-07-18 22:07:48 +02:00
|
|
|
u8 embargoTimer;
|
|
|
|
u8 magnetRiseTimer;
|
|
|
|
u8 telekinesisTimer;
|
|
|
|
u8 healBlockTimer;
|
2018-07-23 21:36:05 +02:00
|
|
|
u8 laserFocusTimer;
|
2018-09-22 10:45:43 +02:00
|
|
|
u8 usedMoves:4;
|
2018-09-22 12:20:33 +02:00
|
|
|
u8 wrapTurns;
|
2017-09-04 21:43:13 +02:00
|
|
|
};
|
|
|
|
|
2017-09-17 14:10:32 +02:00
|
|
|
struct ProtectStruct
|
|
|
|
{
|
|
|
|
/* field_0 */
|
|
|
|
u32 protected:1;
|
|
|
|
u32 endured:1;
|
2018-07-07 19:57:09 +02:00
|
|
|
u32 noValidMoves:1;
|
2017-09-17 14:10:32 +02:00
|
|
|
u32 helpingHand:1;
|
|
|
|
u32 bounceMove:1;
|
|
|
|
u32 stealMove:1;
|
|
|
|
u32 flag0Unknown:1;
|
|
|
|
u32 prlzImmobility:1;
|
|
|
|
/* field_1 */
|
|
|
|
u32 confusionSelfDmg:1;
|
2017-10-06 17:06:45 +02:00
|
|
|
u32 targetNotAffected:1;
|
2017-09-17 14:10:32 +02:00
|
|
|
u32 chargingTurn:1;
|
|
|
|
u32 fleeFlag:2; // for RunAway and Smoke Ball
|
|
|
|
u32 usedImprisionedMove:1;
|
|
|
|
u32 loveImmobility:1;
|
|
|
|
u32 usedDisabledMove:1;
|
|
|
|
/* field_2 */
|
|
|
|
u32 usedTauntedMove:1; // 0x1
|
|
|
|
u32 flag2Unknown:1; // 0x2
|
|
|
|
u32 flinchImmobility:1; // 0x4
|
|
|
|
u32 notFirstStrike:1; // 0x8
|
2018-06-20 23:07:51 +02:00
|
|
|
u32 flag_x10:1; // 0x10
|
|
|
|
u32 flag_x20:1; // 0x20
|
|
|
|
u32 flag_x40:1; // 0x40
|
|
|
|
u32 flag_x80:1; // 0x80
|
2018-07-28 10:41:20 +02:00
|
|
|
u32 usesBouncedMove:1;
|
2018-08-02 21:27:28 +02:00
|
|
|
u32 usedHealBlockedMove:1;
|
|
|
|
u32 usedGravityPreventedMove:1;
|
2017-09-17 14:10:32 +02:00
|
|
|
|
|
|
|
/* field_4 */ u32 physicalDmg;
|
|
|
|
/* field_8 */ u32 specialDmg;
|
2018-02-07 22:53:40 +01:00
|
|
|
/* field_C */ u8 physicalBattlerId;
|
|
|
|
/* field_D */ u8 specialBattlerId;
|
2017-09-17 14:10:32 +02:00
|
|
|
/* field_E */ u16 fieldE;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SpecialStatus
|
|
|
|
{
|
2018-06-20 23:07:51 +02:00
|
|
|
u8 statLowered:1; // 0x1
|
|
|
|
u8 lightningRodRedirected:1; // 0x2
|
2018-07-16 20:47:30 +02:00
|
|
|
u8 restoredBattlerSprite: 1; // 0x4
|
|
|
|
u8 intimidatedMon:1; // 0x8
|
2018-06-20 23:07:51 +02:00
|
|
|
u8 traced:1; // 0x10
|
|
|
|
u8 flag20:1;
|
|
|
|
u8 flag40:1;
|
|
|
|
u8 focusBanded:1;
|
2018-07-14 22:56:03 +02:00
|
|
|
u8 focusSashed:1;
|
2018-07-21 15:11:13 +02:00
|
|
|
u8 sturdied:1;
|
2018-07-22 19:34:13 +02:00
|
|
|
u8 stormDrainRedirected:1;
|
2018-07-22 22:21:47 +02:00
|
|
|
u8 switchInAbilityDone:1;
|
2018-02-07 22:53:40 +01:00
|
|
|
s32 dmg;
|
|
|
|
s32 physicalDmg;
|
|
|
|
s32 specialDmg;
|
|
|
|
u8 physicalBattlerId;
|
|
|
|
u8 specialBattlerId;
|
2017-09-17 14:10:32 +02:00
|
|
|
u8 field12;
|
|
|
|
u8 field13;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SideTimer
|
|
|
|
{
|
|
|
|
/*0x00*/ u8 reflectTimer;
|
2018-02-07 22:53:40 +01:00
|
|
|
/*0x01*/ u8 reflectBattlerId;
|
2017-09-17 14:10:32 +02:00
|
|
|
/*0x02*/ u8 lightscreenTimer;
|
2018-02-07 22:53:40 +01:00
|
|
|
/*0x03*/ u8 lightscreenBattlerId;
|
2017-09-17 14:10:32 +02:00
|
|
|
/*0x04*/ u8 mistTimer;
|
2018-02-07 22:53:40 +01:00
|
|
|
/*0x05*/ u8 mistBattlerId;
|
2017-09-17 14:10:32 +02:00
|
|
|
/*0x06*/ u8 safeguardTimer;
|
2018-02-07 22:53:40 +01:00
|
|
|
/*0x07*/ u8 safeguardBattlerId;
|
2017-09-17 14:10:32 +02:00
|
|
|
/*0x08*/ u8 followmeTimer;
|
|
|
|
/*0x09*/ u8 followmeTarget;
|
|
|
|
/*0x0A*/ u8 spikesAmount;
|
2018-07-21 12:10:08 +02:00
|
|
|
u8 toxicSpikesAmount;
|
2018-07-24 21:47:00 +02:00
|
|
|
u8 stealthRockAmount;
|
2018-07-24 22:09:55 +02:00
|
|
|
u8 stickyWebAmount;
|
2018-07-21 12:10:08 +02:00
|
|
|
u8 auroraVeilTimer;
|
|
|
|
u8 auroraVeilBattlerId;
|
|
|
|
u8 tailwindTimer;
|
|
|
|
u8 tailwindBattlerId;
|
2018-07-21 12:56:07 +02:00
|
|
|
u8 luckyChantTimer;
|
|
|
|
u8 luckyChantBattlerId;
|
2017-09-17 14:10:32 +02:00
|
|
|
};
|
|
|
|
|
2018-07-14 13:17:10 +02:00
|
|
|
struct FieldTimer
|
|
|
|
{
|
|
|
|
u8 mudSportTimer;
|
|
|
|
u8 waterSportTimer;
|
|
|
|
u8 wonderRoomTimer;
|
|
|
|
u8 magicRoomTimer;
|
|
|
|
u8 trickRoomTimer;
|
|
|
|
u8 grassyTerrainTimer;
|
|
|
|
u8 mistyTerrainTimer;
|
|
|
|
u8 electricTerrainTimer;
|
|
|
|
u8 psychicTerrainTimer;
|
2018-07-14 16:41:14 +02:00
|
|
|
u8 echoVoiceCounter;
|
2018-07-21 16:34:43 +02:00
|
|
|
u8 gravityTimer;
|
2018-07-14 13:17:10 +02:00
|
|
|
};
|
|
|
|
|
2017-09-17 14:10:32 +02:00
|
|
|
struct WishFutureKnock
|
|
|
|
{
|
2018-02-06 02:46:59 +01:00
|
|
|
u8 futureSightCounter[MAX_BATTLERS_COUNT];
|
|
|
|
u8 futureSightAttacker[MAX_BATTLERS_COUNT];
|
|
|
|
s32 futureSightDmg[MAX_BATTLERS_COUNT];
|
|
|
|
u16 futureSightMove[MAX_BATTLERS_COUNT];
|
|
|
|
u8 wishCounter[MAX_BATTLERS_COUNT];
|
2018-02-07 22:53:40 +01:00
|
|
|
u8 wishMonId[MAX_BATTLERS_COUNT];
|
2017-09-17 14:10:32 +02:00
|
|
|
u8 weatherDuration;
|
2017-09-20 22:54:26 +02:00
|
|
|
u8 knockedOffPokes[2];
|
2017-09-17 14:10:32 +02:00
|
|
|
};
|
|
|
|
|
2018-07-15 18:07:01 +02:00
|
|
|
struct AI_SavedBattleMon
|
|
|
|
{
|
|
|
|
u8 ability;
|
|
|
|
u16 moves[4];
|
|
|
|
u16 heldItem;
|
|
|
|
u16 species;
|
|
|
|
};
|
|
|
|
|
2017-09-04 21:43:13 +02:00
|
|
|
struct AI_ThinkingStruct
|
|
|
|
{
|
|
|
|
u8 aiState;
|
|
|
|
u8 movesetIndex;
|
|
|
|
u16 moveConsidered;
|
|
|
|
s8 score[4];
|
|
|
|
u32 funcResult;
|
|
|
|
u32 aiFlags;
|
|
|
|
u8 aiAction;
|
|
|
|
u8 aiLogicId;
|
|
|
|
u8 filler12[6];
|
2017-09-05 09:41:48 +02:00
|
|
|
u8 simulatedRNG[4];
|
2018-07-15 18:07:01 +02:00
|
|
|
struct AI_SavedBattleMon saved[4];
|
2017-09-04 21:43:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct UsedMoves
|
|
|
|
{
|
2018-02-06 02:46:59 +01:00
|
|
|
u16 moves[MAX_BATTLERS_COUNT];
|
|
|
|
u16 unknown[MAX_BATTLERS_COUNT];
|
2017-09-04 21:43:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct BattleHistory
|
|
|
|
{
|
2018-02-06 02:46:59 +01:00
|
|
|
struct UsedMoves usedMoves[MAX_BATTLERS_COUNT];
|
|
|
|
u8 abilities[MAX_BATTLERS_COUNT];
|
|
|
|
u8 itemEffects[MAX_BATTLERS_COUNT];
|
|
|
|
u16 trainerItems[MAX_BATTLERS_COUNT];
|
2017-09-05 09:41:48 +02:00
|
|
|
u8 itemsNo;
|
2017-09-04 21:43:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct BattleScriptsStack
|
|
|
|
{
|
2017-09-17 14:10:32 +02:00
|
|
|
const u8 *ptr[8];
|
2017-09-04 21:43:13 +02:00
|
|
|
u8 size;
|
|
|
|
};
|
|
|
|
|
2017-09-17 17:14:32 +02:00
|
|
|
struct BattleCallbacksStack
|
|
|
|
{
|
|
|
|
void (*function[8])(void);
|
|
|
|
u8 size;
|
|
|
|
};
|
|
|
|
|
2017-09-22 21:33:49 +02:00
|
|
|
struct StatsArray
|
|
|
|
{
|
|
|
|
u16 hp;
|
|
|
|
u16 atk;
|
|
|
|
u16 def;
|
|
|
|
u16 spd;
|
|
|
|
u16 spAtk;
|
|
|
|
u16 spDef;
|
|
|
|
};
|
|
|
|
|
2017-09-04 21:43:13 +02:00
|
|
|
struct BattleResources
|
|
|
|
{
|
2017-09-12 00:01:12 +02:00
|
|
|
struct SecretBaseRecord* secretBase;
|
2017-09-04 21:43:13 +02:00
|
|
|
struct UnknownFlags *flags;
|
|
|
|
struct BattleScriptsStack* battleScriptsStack;
|
2017-09-17 17:14:32 +02:00
|
|
|
struct BattleCallbacksStack* battleCallbackStack;
|
2017-09-22 21:33:49 +02:00
|
|
|
struct StatsArray* statsBeforeLvlUp;
|
2017-09-04 21:43:13 +02:00
|
|
|
struct AI_ThinkingStruct *ai;
|
|
|
|
struct BattleHistory *battleHistory;
|
|
|
|
struct BattleScriptsStack *AI_ScriptsStack;
|
|
|
|
};
|
|
|
|
|
2017-09-05 09:41:48 +02:00
|
|
|
struct BattleResults
|
|
|
|
{
|
|
|
|
u8 playerFaintCounter; // 0x0
|
|
|
|
u8 opponentFaintCounter; // 0x1
|
2017-09-25 00:09:13 +02:00
|
|
|
u8 playerSwitchesCounter; // 0x2
|
2017-09-05 09:41:48 +02:00
|
|
|
u8 unk3; // 0x3
|
|
|
|
u8 unk4; // 0x4
|
2017-10-13 17:09:36 +02:00
|
|
|
u8 unk5_0:1; // 0x5
|
|
|
|
u8 usedMasterBall:1; // 0x5
|
|
|
|
u8 caughtMonBall:4; // 0x5
|
2018-06-28 21:06:32 +02:00
|
|
|
u8 shinyWildMon:1; // 0x5
|
2017-10-13 17:09:36 +02:00
|
|
|
u8 unk5_7:1; // 0x5
|
2017-10-06 00:12:01 +02:00
|
|
|
u16 playerMon1Species; // 0x6
|
2018-06-28 21:06:32 +02:00
|
|
|
u8 playerMon1Name[POKEMON_NAME_LENGTH + 1]; // 0x8
|
2017-09-05 09:41:48 +02:00
|
|
|
u8 battleTurnCounter; // 0x13
|
2018-06-28 21:06:32 +02:00
|
|
|
u8 playerMon2Name[POKEMON_NAME_LENGTH + 1]; // 0x14
|
|
|
|
u8 pokeblockThrows; // 0x1F
|
2017-09-05 09:41:48 +02:00
|
|
|
u16 lastOpponentSpecies; // 0x20
|
2017-10-06 00:12:01 +02:00
|
|
|
u16 lastUsedMovePlayer; // 0x22
|
|
|
|
u16 lastUsedMoveOpponent; // 0x24
|
|
|
|
u16 playerMon2Species; // 0x26
|
2017-09-28 15:34:21 +02:00
|
|
|
u16 caughtMonSpecies; // 0x28
|
2018-06-28 21:06:32 +02:00
|
|
|
u8 caughtMonNick[POKEMON_NAME_LENGTH + 1]; // 0x2A
|
|
|
|
u8 filler35[1]; // 0x35
|
2017-10-13 17:09:36 +02:00
|
|
|
u8 catchAttempts[11]; // 0x36
|
2017-09-05 09:41:48 +02:00
|
|
|
};
|
|
|
|
|
2018-02-27 20:40:09 +01:00
|
|
|
struct BattleTv_Side
|
2018-02-27 18:13:28 +01:00
|
|
|
{
|
|
|
|
u32 spikesMonId:3;
|
|
|
|
u32 reflectMonId:3;
|
|
|
|
u32 lightScreenMonId:3;
|
|
|
|
u32 safeguardMonId:3;
|
|
|
|
u32 mistMonId:3;
|
|
|
|
u32 futureSightMonId:3;
|
|
|
|
u32 doomDesireMonId:3;
|
|
|
|
u32 perishSongMonId:3;
|
|
|
|
u32 wishMonId:3;
|
|
|
|
u32 grudgeMonId:3;
|
2018-02-27 20:40:09 +01:00
|
|
|
u32 usedMoveSlot:2;
|
2018-02-27 18:13:28 +01:00
|
|
|
u32 spikesMoveSlot:2;
|
|
|
|
u32 reflectMoveSlot:2;
|
|
|
|
u32 lightScreenMoveSlot:2;
|
|
|
|
u32 safeguardMoveSlot:2;
|
|
|
|
u32 mistMoveSlot:2;
|
|
|
|
u32 futureSightMoveSlot:2;
|
|
|
|
u32 doomDesireMoveSlot:2;
|
|
|
|
u32 perishSongMoveSlot:2;
|
|
|
|
u32 wishMoveSlot:2;
|
|
|
|
u32 grudgeMoveSlot:2;
|
|
|
|
u32 destinyBondMonId:3;
|
|
|
|
u32 destinyBondMoveSlot:2;
|
2018-02-27 20:40:09 +01:00
|
|
|
u32 faintCause:4;
|
|
|
|
u32 faintCauseMonId:3;
|
2018-02-27 18:13:28 +01:00
|
|
|
u32 explosion:1;
|
|
|
|
u32 explosionMoveSlot:2;
|
|
|
|
u32 explosionMonId:3;
|
|
|
|
u32 perishSong:1;
|
|
|
|
};
|
|
|
|
|
2018-02-27 20:40:09 +01:00
|
|
|
struct BattleTv_Position
|
2018-02-27 18:13:28 +01:00
|
|
|
{
|
|
|
|
u32 curseMonId:3;
|
|
|
|
u32 leechSeedMonId:3;
|
|
|
|
u32 nightmareMonId:3;
|
|
|
|
u32 wrapMonId:3;
|
|
|
|
u32 attractMonId:3;
|
|
|
|
u32 confusionMonId:3;
|
|
|
|
u32 curseMoveSlot:2;
|
|
|
|
u32 leechSeedMoveSlot:2;
|
|
|
|
u32 nightmareMoveSlot:2;
|
|
|
|
u32 wrapMoveSlot:2;
|
|
|
|
u32 attractMoveSlot:2;
|
|
|
|
u32 confusionMoveSlot:2;
|
|
|
|
u32 waterSportMoveSlot:2;
|
|
|
|
u32 waterSportMonId:3;
|
|
|
|
u32 mudSportMonId:3;
|
|
|
|
u32 mudSportMoveSlot:2;
|
|
|
|
u32 ingrainMonId:3;
|
|
|
|
u32 ingrainMoveSlot:2;
|
2018-02-27 20:40:09 +01:00
|
|
|
u32 attackedByMonId:3;
|
|
|
|
u32 attackedByMoveSlot:2;
|
2018-02-27 18:13:28 +01:00
|
|
|
};
|
|
|
|
|
2018-02-27 20:40:09 +01:00
|
|
|
struct BattleTv_Mon
|
2018-02-27 18:13:28 +01:00
|
|
|
{
|
|
|
|
u32 psnMonId:3;
|
|
|
|
u32 badPsnMonId:3;
|
|
|
|
u32 brnMonId:3;
|
|
|
|
u32 prlzMonId:3;
|
|
|
|
u32 slpMonId:3;
|
|
|
|
u32 frzMonId:3;
|
|
|
|
u32 psnMoveSlot:2;
|
|
|
|
u32 badPsnMoveSlot:2;
|
|
|
|
u32 brnMoveSlot:2;
|
|
|
|
u32 prlzMoveSlot:2;
|
|
|
|
u32 slpMoveSlot:2;
|
|
|
|
u32 frzMoveSlot:2;
|
|
|
|
};
|
|
|
|
|
2018-02-27 20:40:09 +01:00
|
|
|
struct BattleTv
|
2018-02-27 18:13:28 +01:00
|
|
|
{
|
2018-07-01 11:15:42 +02:00
|
|
|
struct BattleTv_Mon mon[2][PARTY_SIZE]; // [side][partyId]
|
2018-02-27 20:40:09 +01:00
|
|
|
struct BattleTv_Position pos[2][2]; // [side][flank]
|
|
|
|
struct BattleTv_Side side[2]; // [side]
|
2018-02-27 18:13:28 +01:00
|
|
|
};
|
|
|
|
|
2018-02-27 20:40:09 +01:00
|
|
|
struct BattleTvMovePoints
|
2018-02-27 18:13:28 +01:00
|
|
|
{
|
2018-02-27 20:40:09 +01:00
|
|
|
s16 points[2][PARTY_SIZE * 4];
|
2018-02-27 18:13:28 +01:00
|
|
|
};
|
|
|
|
|
2018-09-20 17:33:27 +02:00
|
|
|
struct MegaEvolutionData
|
|
|
|
{
|
|
|
|
u8 toEvolve; // As flags using gBitTable.
|
|
|
|
u8 evolvedPartyIds[2]; // As flags using gBitTable;
|
|
|
|
bool8 alreadyEvolved[4]; // Array id is used for mon position.
|
|
|
|
u16 evolvedSpecies[MAX_BATTLERS_COUNT];
|
|
|
|
u16 playerEvolvedSpecies;
|
|
|
|
u8 battlerId;
|
|
|
|
bool8 playerSelect;
|
|
|
|
u8 triggerSpriteId;
|
|
|
|
u8 indicatorSpriteIds[MAX_BATTLERS_COUNT];
|
|
|
|
};
|
|
|
|
|
2017-09-05 09:41:48 +02:00
|
|
|
struct BattleStruct
|
|
|
|
{
|
2017-09-17 14:10:32 +02:00
|
|
|
u8 turnEffectsTracker;
|
2018-02-07 22:53:40 +01:00
|
|
|
u8 turnEffectsBattlerId;
|
2017-09-17 14:10:32 +02:00
|
|
|
u8 filler2;
|
2018-02-07 22:53:40 +01:00
|
|
|
u8 turnCountersTracker;
|
2017-09-17 14:10:32 +02:00
|
|
|
u8 wrappedMove[8]; // ask gamefreak why they declared it that way
|
2017-09-05 09:41:48 +02:00
|
|
|
u8 moveTarget[4];
|
2018-02-07 22:53:40 +01:00
|
|
|
u8 expGetterMonId;
|
2017-09-05 09:41:48 +02:00
|
|
|
u8 field_11;
|
|
|
|
u8 wildVictorySong;
|
|
|
|
u8 dynamicMoveType;
|
|
|
|
u8 wrappedBy[4];
|
2017-09-27 23:43:45 +02:00
|
|
|
u16 assistPossibleMoves[5 * 4]; // 5 mons, each of them knowing 4 moves
|
2017-09-11 14:42:13 +02:00
|
|
|
u8 field_40;
|
|
|
|
u8 field_41;
|
|
|
|
u8 field_42;
|
|
|
|
u8 field_43;
|
|
|
|
u8 field_44;
|
|
|
|
u8 field_45;
|
|
|
|
u8 field_46;
|
|
|
|
u8 field_47;
|
2018-02-07 22:53:40 +01:00
|
|
|
u8 focusPunchBattlerId;
|
2018-07-07 19:57:09 +02:00
|
|
|
u8 battlerPreventingSwitchout;
|
2017-09-17 17:14:32 +02:00
|
|
|
u8 moneyMultiplier;
|
2017-12-02 23:31:58 +01:00
|
|
|
u8 savedTurnActionNumber;
|
2017-10-02 23:32:39 +02:00
|
|
|
u8 switchInAbilitiesCounter;
|
2017-12-02 14:08:55 +01:00
|
|
|
u8 faintedActionsState;
|
2018-02-07 22:53:40 +01:00
|
|
|
u8 faintedActionsBattlerId;
|
2017-09-11 14:42:13 +02:00
|
|
|
u8 field_4F;
|
2017-09-22 21:33:49 +02:00
|
|
|
u16 expValue;
|
2017-09-11 14:42:13 +02:00
|
|
|
u8 field_52;
|
2017-09-22 21:33:49 +02:00
|
|
|
u8 sentInPokes;
|
2018-02-06 02:46:59 +01:00
|
|
|
bool8 selectionScriptFinished[MAX_BATTLERS_COUNT];
|
2017-09-24 00:29:52 +02:00
|
|
|
u8 field_58[4];
|
2018-02-06 02:46:59 +01:00
|
|
|
u8 monToSwitchIntoId[MAX_BATTLERS_COUNT];
|
2017-09-24 00:29:52 +02:00
|
|
|
u8 field_60[4][3];
|
2017-10-06 00:12:01 +02:00
|
|
|
u8 runTries;
|
2017-09-28 15:34:21 +02:00
|
|
|
u8 caughtMonNick[11];
|
2017-09-11 14:42:13 +02:00
|
|
|
u8 field_78;
|
2018-07-01 11:15:42 +02:00
|
|
|
u8 safariGoNearCounter;
|
|
|
|
u8 safariPkblThrowCounter;
|
|
|
|
u8 safariEscapeFactor;
|
|
|
|
u8 safariCatchFactor;
|
2017-09-08 18:19:20 +02:00
|
|
|
u8 field_7D;
|
|
|
|
u8 field_7E;
|
|
|
|
u8 formToChangeInto;
|
2018-02-06 02:46:59 +01:00
|
|
|
u8 chosenMovePositions[MAX_BATTLERS_COUNT];
|
|
|
|
u8 stateIdAfterSelScript[MAX_BATTLERS_COUNT];
|
2017-09-08 18:19:20 +02:00
|
|
|
u8 field_88;
|
|
|
|
u8 field_89;
|
|
|
|
u8 field_8A;
|
|
|
|
u8 field_8B;
|
|
|
|
u8 field_8C;
|
|
|
|
u8 field_8D;
|
2017-10-07 15:15:47 +02:00
|
|
|
u8 stringMoveType;
|
2018-02-07 22:53:40 +01:00
|
|
|
u8 expGetterBattlerId;
|
2017-09-08 18:19:20 +02:00
|
|
|
u8 field_90;
|
|
|
|
u8 field_91;
|
|
|
|
u8 field_92;
|
|
|
|
u8 field_93;
|
2017-10-24 21:45:41 +02:00
|
|
|
u8 wallyBattleState;
|
|
|
|
u8 wallyMovesState;
|
|
|
|
u8 wallyWaitFrames;
|
|
|
|
u8 wallyMoveFrames;
|
2017-09-23 20:13:45 +02:00
|
|
|
u8 mirrorMoves[8]; // ask gamefreak why they declared it that way
|
2017-09-08 18:19:20 +02:00
|
|
|
u8 field_A0;
|
|
|
|
u8 field_A1;
|
|
|
|
u8 field_A2;
|
|
|
|
u8 field_A3;
|
|
|
|
u8 field_A4;
|
|
|
|
u8 field_A5;
|
|
|
|
u8 field_A6;
|
|
|
|
u8 field_A7;
|
2017-10-01 01:12:42 +02:00
|
|
|
u16 hpOnSwitchout[2];
|
|
|
|
u32 savedBattleTypeFlags;
|
2018-07-07 19:57:09 +02:00
|
|
|
u8 abilityPreventingSwitchout;
|
2017-09-08 18:19:20 +02:00
|
|
|
u8 hpScale;
|
|
|
|
u8 synchronizeMoveEffect;
|
2018-02-27 20:40:09 +01:00
|
|
|
bool8 anyMonHasTransformed;
|
2017-10-01 01:12:42 +02:00
|
|
|
void (*savedCallback)(void);
|
2018-02-06 02:46:59 +01:00
|
|
|
u16 usedHeldItems[MAX_BATTLERS_COUNT];
|
2017-10-26 23:12:48 +02:00
|
|
|
u8 chosenItem[4]; // why is this an u8?
|
2017-10-11 12:49:42 +02:00
|
|
|
u8 AI_itemType[2];
|
|
|
|
u8 AI_itemFlags[2];
|
2018-02-06 02:46:59 +01:00
|
|
|
u16 choicedMove[MAX_BATTLERS_COUNT];
|
|
|
|
u16 changedItems[MAX_BATTLERS_COUNT];
|
2018-07-01 11:15:42 +02:00
|
|
|
u8 intimidateBattler;
|
2017-10-02 23:32:39 +02:00
|
|
|
u8 switchInItemsCounter;
|
2017-09-17 15:19:15 +02:00
|
|
|
u8 field_DA;
|
2018-07-21 12:10:08 +02:00
|
|
|
u8 turnEffectsSide;
|
2017-09-17 14:10:32 +02:00
|
|
|
u8 fillerDC[0xDF-0xDC];
|
2017-09-17 15:19:15 +02:00
|
|
|
u8 field_DF;
|
2017-09-23 20:13:45 +02:00
|
|
|
u8 mirrorMoveArrays[32];
|
2018-02-06 02:46:59 +01:00
|
|
|
u16 castformPalette[MAX_BATTLERS_COUNT][16];
|
2017-10-01 01:12:42 +02:00
|
|
|
u8 field_180;
|
|
|
|
u8 field_181;
|
|
|
|
u8 field_182;
|
|
|
|
u8 field_183;
|
|
|
|
struct BattleEnigmaBerry battleEnigmaBerry;
|
2017-12-02 14:08:55 +01:00
|
|
|
u8 wishPerishSongState;
|
2018-02-07 22:53:40 +01:00
|
|
|
u8 wishPerishSongBattlerId;
|
2017-10-02 23:32:39 +02:00
|
|
|
bool8 overworldWeatherDone;
|
2017-09-17 14:10:32 +02:00
|
|
|
u8 atkCancellerTracker;
|
2018-02-27 20:40:09 +01:00
|
|
|
struct BattleTvMovePoints tvMovePoints;
|
|
|
|
struct BattleTv tv;
|
2018-02-27 18:13:28 +01:00
|
|
|
u8 notSureWhatFieldLol[0x28];
|
2018-02-06 02:46:59 +01:00
|
|
|
u8 AI_monToSwitchIntoId[MAX_BATTLERS_COUNT];
|
2017-09-22 21:33:49 +02:00
|
|
|
u8 field_298[8];
|
|
|
|
u8 field_2A0;
|
|
|
|
u8 field_2A1;
|
2017-09-26 22:39:59 +02:00
|
|
|
u8 field_2A2;
|
2018-07-13 23:00:56 +02:00
|
|
|
u8 debugBattler;
|
2018-07-14 22:56:03 +02:00
|
|
|
u8 magnitudeBasePower;
|
|
|
|
u8 presentBasePower;
|
2018-07-19 21:18:20 +02:00
|
|
|
u8 roostTypes[MAX_BATTLERS_COUNT][3];
|
2018-07-24 22:09:55 +02:00
|
|
|
u8 savedBattlerTarget;
|
2018-07-28 18:41:57 +02:00
|
|
|
bool8 ateBoost[MAX_BATTLERS_COUNT];
|
2018-07-29 11:32:40 +02:00
|
|
|
u32 debugAIFlags;
|
|
|
|
bool8 notfirstTimeAIFlags;
|
2018-09-20 17:33:27 +02:00
|
|
|
struct MegaEvolutionData mega;
|
2017-09-05 09:41:48 +02:00
|
|
|
};
|
|
|
|
|
2017-09-20 00:28:00 +02:00
|
|
|
#define GET_MOVE_TYPE(move, typeArg) \
|
2017-09-19 21:01:12 +02:00
|
|
|
{ \
|
|
|
|
if (gBattleStruct->dynamicMoveType) \
|
2017-09-20 00:28:00 +02:00
|
|
|
typeArg = gBattleStruct->dynamicMoveType & 0x3F; \
|
2017-09-19 21:01:12 +02:00
|
|
|
else \
|
2017-09-20 00:28:00 +02:00
|
|
|
typeArg = gBattleMoves[move].type; \
|
2017-09-19 21:01:12 +02:00
|
|
|
}
|
|
|
|
|
2018-07-16 21:04:56 +02:00
|
|
|
#define IS_MOVE_PHYSICAL(move)(gBattleMoves[move].split == SPLIT_PHYSICAL)
|
|
|
|
#define IS_MOVE_SPECIAL(move)(gBattleMoves[move].split == SPLIT_SPECIAL)
|
2018-02-08 11:17:41 +01:00
|
|
|
|
2018-07-14 22:56:03 +02:00
|
|
|
#define BATTLER_MAX_HP(battlerId)(gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP)
|
2018-03-01 00:59:52 +01:00
|
|
|
#define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0))
|
|
|
|
|
|
|
|
#define IS_BATTLER_OF_TYPE(battlerId, type)((gBattleMons[battlerId].type1 == type || gBattleMons[battlerId].type2 == type))
|
|
|
|
#define SET_BATTLER_TYPE(battlerId, type) \
|
|
|
|
{ \
|
|
|
|
gBattleMons[battlerId].type1 = type; \
|
|
|
|
gBattleMons[battlerId].type2 = type; \
|
|
|
|
}
|
|
|
|
|
2017-09-22 21:33:49 +02:00
|
|
|
#define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8
|
2018-07-29 15:51:08 +02:00
|
|
|
#define GET_STAT_BUFF_VALUE2(n)((n & 0xF0))
|
2017-09-26 22:39:59 +02:00
|
|
|
#define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40
|
2017-09-22 21:33:49 +02:00
|
|
|
#define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit
|
|
|
|
|
2018-07-29 15:51:08 +02:00
|
|
|
#define SET_STAT_BUFF_VALUE(n)((((n) << 4) & 0xF0))
|
2017-09-20 22:54:26 +02:00
|
|
|
|
2017-11-26 11:55:17 +01:00
|
|
|
#define SET_STATCHANGER(statId, stage, goesDown)(gBattleScripting.statChanger = (statId) + (stage << 4) + (goesDown << 7))
|
|
|
|
|
2017-09-05 09:41:48 +02:00
|
|
|
struct BattleScripting
|
|
|
|
{
|
2017-09-26 22:39:59 +02:00
|
|
|
s32 painSplitHp;
|
|
|
|
s32 bideDmg;
|
|
|
|
u8 multihitString[6];
|
2018-08-03 18:01:14 +02:00
|
|
|
bool8 expOnCatch;
|
2017-11-26 00:33:40 +01:00
|
|
|
u8 twoTurnsMoveStringId;
|
2017-09-17 14:10:32 +02:00
|
|
|
u8 animArg1;
|
|
|
|
u8 animArg2;
|
2017-11-26 13:26:58 +01:00
|
|
|
u16 tripleKickPower;
|
2017-09-17 14:10:32 +02:00
|
|
|
u8 atk49_state;
|
2018-02-06 23:09:39 +01:00
|
|
|
u8 battlerWithAbility;
|
2017-12-02 23:31:58 +01:00
|
|
|
u8 multihitMoveEffect;
|
2018-02-06 02:46:59 +01:00
|
|
|
u8 battler;
|
2017-09-20 00:28:00 +02:00
|
|
|
u8 animTurn;
|
|
|
|
u8 animTargetsHit;
|
2017-09-17 17:14:32 +02:00
|
|
|
u8 statChanger;
|
2018-07-29 15:33:16 +02:00
|
|
|
bool8 statAnimPlayed;
|
2017-09-22 21:33:49 +02:00
|
|
|
u8 atk23_state;
|
2017-10-02 23:32:39 +02:00
|
|
|
u8 battleStyle;
|
2017-09-26 22:39:59 +02:00
|
|
|
u8 atk6C_state;
|
2017-09-25 00:09:13 +02:00
|
|
|
u8 learnMoveState;
|
2017-09-28 15:34:21 +02:00
|
|
|
u8 field_20;
|
2017-10-09 18:18:40 +02:00
|
|
|
u8 reshowMainState;
|
|
|
|
u8 reshowHelperState;
|
2017-10-01 01:12:42 +02:00
|
|
|
u8 field_23;
|
2018-06-17 16:48:58 +02:00
|
|
|
u8 windowsType; // 0 - normal, 1 - battle arena
|
2017-10-01 01:12:42 +02:00
|
|
|
u8 multiplayerId;
|
2018-08-03 18:01:14 +02:00
|
|
|
bool8 monCaught;
|
2018-09-22 10:45:43 +02:00
|
|
|
s32 savedDmg;
|
2017-09-05 09:41:48 +02:00
|
|
|
};
|
|
|
|
|
2017-09-19 21:01:12 +02:00
|
|
|
// rom_80A5C6C
|
2018-02-07 23:21:51 +01:00
|
|
|
u8 GetBattlerSide(u8 battler);
|
2018-07-16 20:47:30 +02:00
|
|
|
u8 GetBattlerPosition(u8 battler);
|
|
|
|
u8 GetBattlerAtPosition(u8 battler);
|
2017-09-19 21:01:12 +02:00
|
|
|
|
2017-10-01 18:54:01 +02:00
|
|
|
struct BattleSpriteInfo
|
|
|
|
{
|
2018-06-20 23:07:51 +02:00
|
|
|
u16 invisible:1; // 0x1
|
|
|
|
u16 lowHpSong:1; // 0x2
|
|
|
|
u16 behindSubstitute:1; // 0x4
|
|
|
|
u16 flag_x8:1; // 0x8
|
|
|
|
u16 hpNumbersNoBars:1; // 0x10
|
2017-10-01 18:54:01 +02:00
|
|
|
u16 transformSpecies;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct BattleAnimationInfo
|
|
|
|
{
|
2017-11-04 16:11:13 +01:00
|
|
|
u16 animArg; // to fill up later
|
2017-10-18 21:42:00 +02:00
|
|
|
u8 field_2;
|
|
|
|
u8 field_3;
|
|
|
|
u8 field_4;
|
|
|
|
u8 field_5;
|
|
|
|
u8 field_6;
|
|
|
|
u8 field_7;
|
2017-10-22 18:43:15 +02:00
|
|
|
u8 ballThrowCaseId;
|
2018-06-20 23:07:51 +02:00
|
|
|
u8 field_9_x1:1;
|
|
|
|
u8 field_9_x2:1;
|
|
|
|
u8 field_9_x1C:3;
|
|
|
|
u8 field_9_x20:1;
|
|
|
|
u8 field_9_x40:1;
|
|
|
|
u8 field_9_x80:1;
|
2017-11-02 18:19:49 +01:00
|
|
|
u8 field_A;
|
|
|
|
u8 field_B;
|
|
|
|
u8 field_C;
|
|
|
|
u8 field_D;
|
|
|
|
u8 field_E;
|
|
|
|
u8 field_F;
|
2017-10-01 18:54:01 +02:00
|
|
|
};
|
|
|
|
|
2017-10-02 23:32:39 +02:00
|
|
|
struct BattleHealthboxInfo
|
|
|
|
{
|
2018-06-28 21:06:32 +02:00
|
|
|
u8 partyStatusSummaryShown:1;
|
2018-06-20 23:07:51 +02:00
|
|
|
u8 healthboxIsBouncing:1;
|
|
|
|
u8 battlerIsBouncing:1;
|
|
|
|
u8 ballAnimActive:1; // 0x8
|
|
|
|
u8 statusAnimActive:1; // x10
|
|
|
|
u8 animFromTableActive:1; // x20
|
2018-06-28 21:06:32 +02:00
|
|
|
u8 specialAnimActive:1; // x40
|
2018-06-20 23:07:51 +02:00
|
|
|
u8 flag_x80:1;
|
|
|
|
u8 field_1_x1:1;
|
|
|
|
u8 field_1_x1E:4;
|
|
|
|
u8 field_1_x20:1;
|
|
|
|
u8 field_1_x40:1;
|
|
|
|
u8 field_1_x80:1;
|
|
|
|
u8 healthboxBounceSpriteId;
|
|
|
|
u8 battlerBounceSpriteId;
|
2017-10-22 18:43:15 +02:00
|
|
|
u8 animationState;
|
2017-10-02 23:32:39 +02:00
|
|
|
u8 field_5;
|
|
|
|
u8 field_6;
|
2017-11-04 16:11:13 +01:00
|
|
|
u8 shadowSpriteId;
|
2017-10-02 23:32:39 +02:00
|
|
|
u8 field_8;
|
|
|
|
u8 field_9;
|
|
|
|
u8 field_A;
|
|
|
|
u8 field_B;
|
|
|
|
};
|
|
|
|
|
2017-10-16 18:12:27 +02:00
|
|
|
struct BattleBarInfo
|
|
|
|
{
|
|
|
|
u8 healthboxSpriteId;
|
2017-10-19 15:28:41 +02:00
|
|
|
s32 maxValue;
|
2018-06-19 00:43:15 +02:00
|
|
|
s32 oldValue;
|
2017-10-22 18:43:15 +02:00
|
|
|
s32 receivedValue;
|
2018-06-19 00:43:15 +02:00
|
|
|
s32 currValue;
|
2017-10-16 18:12:27 +02:00
|
|
|
};
|
|
|
|
|
2017-10-01 18:54:01 +02:00
|
|
|
struct BattleSpriteData
|
|
|
|
{
|
2018-02-06 23:09:39 +01:00
|
|
|
struct BattleSpriteInfo *battlerData;
|
2017-10-02 23:32:39 +02:00
|
|
|
struct BattleHealthboxInfo *healthBoxesData;
|
2017-10-01 18:54:01 +02:00
|
|
|
struct BattleAnimationInfo *animationData;
|
2017-10-16 18:12:27 +02:00
|
|
|
struct BattleBarInfo *battleBars;
|
2017-10-01 18:54:01 +02:00
|
|
|
};
|
|
|
|
|
2017-09-11 18:27:54 +02:00
|
|
|
#include "sprite.h"
|
|
|
|
|
2017-10-01 01:12:42 +02:00
|
|
|
struct MonSpritesGfx
|
2017-09-11 11:35:41 +02:00
|
|
|
{
|
|
|
|
void* firstDecompressed; // ptr to the decompressed sprite of the first pokemon
|
|
|
|
void* sprites[4];
|
2017-09-11 18:27:54 +02:00
|
|
|
struct SpriteTemplate templates[4];
|
2017-11-04 16:11:13 +01:00
|
|
|
struct SpriteFrameImage field_74[4][4];
|
|
|
|
u8 field_F4[0x80];
|
|
|
|
u8 *barFontGfx;
|
|
|
|
void *field_178;
|
|
|
|
void *field_17C;
|
2017-09-11 11:35:41 +02:00
|
|
|
};
|
|
|
|
|
2018-06-30 15:35:54 +02:00
|
|
|
// All battle variables are declared in battle_main.c
|
|
|
|
extern u8 gDisplayedStringBattle[300];
|
|
|
|
extern u8 gBattleTextBuff1[TEXT_BUFF_ARRAY_COUNT];
|
|
|
|
extern u8 gBattleTextBuff2[TEXT_BUFF_ARRAY_COUNT];
|
|
|
|
extern u8 gBattleTextBuff3[TEXT_BUFF_ARRAY_COUNT];
|
2017-10-13 17:09:36 +02:00
|
|
|
extern u32 gBattleTypeFlags;
|
2018-02-07 23:21:51 +01:00
|
|
|
extern u8 gBattleTerrain;
|
|
|
|
extern u32 gUnknown_02022FF4;
|
|
|
|
extern u8 *gUnknown_0202305C;
|
|
|
|
extern u8 *gUnknown_02023060;
|
|
|
|
extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200];
|
|
|
|
extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200];
|
|
|
|
extern u8 gActiveBattler;
|
|
|
|
extern u32 gBattleControllerExecFlags;
|
|
|
|
extern u8 gBattlersCount;
|
|
|
|
extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT];
|
|
|
|
extern u8 gBattlerPositions[MAX_BATTLERS_COUNT];
|
|
|
|
extern u8 gActionsByTurnOrder[MAX_BATTLERS_COUNT];
|
2018-06-28 21:06:32 +02:00
|
|
|
extern u8 gBattlerByTurnOrder[MAX_BATTLERS_COUNT];
|
2018-02-07 23:21:51 +01:00
|
|
|
extern u8 gCurrentTurnActionNumber;
|
|
|
|
extern u8 gCurrentActionFuncId;
|
|
|
|
extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT];
|
|
|
|
extern u8 gBattlerSpriteIds[MAX_BATTLERS_COUNT];
|
|
|
|
extern u8 gCurrMovePos;
|
2018-02-08 11:17:41 +01:00
|
|
|
extern u8 gChosenMovePos;
|
2018-02-07 23:21:51 +01:00
|
|
|
extern u16 gCurrentMove;
|
|
|
|
extern u16 gChosenMove;
|
2018-09-22 18:41:00 +02:00
|
|
|
extern u16 gCalledMove;
|
2018-02-07 23:21:51 +01:00
|
|
|
extern s32 gBattleMoveDamage;
|
|
|
|
extern s32 gHpDealt;
|
|
|
|
extern s32 gTakenDmg[MAX_BATTLERS_COUNT];
|
|
|
|
extern u16 gLastUsedItem;
|
|
|
|
extern u8 gLastUsedAbility;
|
|
|
|
extern u8 gBattlerAttacker;
|
|
|
|
extern u8 gBattlerTarget;
|
2018-02-08 11:17:41 +01:00
|
|
|
extern u8 gBattlerFainted;
|
|
|
|
extern u8 gEffectBattler;
|
2018-02-08 12:13:29 +01:00
|
|
|
extern u8 gPotentialItemEffectBattler;
|
2018-02-07 23:21:51 +01:00
|
|
|
extern u8 gAbsentBattlerFlags;
|
2018-07-14 22:56:03 +02:00
|
|
|
extern u8 gIsCriticalHit;
|
2018-02-07 23:21:51 +01:00
|
|
|
extern u8 gMultiHitCounter;
|
|
|
|
extern const u8 *gBattlescriptCurrInstr;
|
|
|
|
extern u32 gUnusedBattleMainVar;
|
|
|
|
extern u8 gChosenActionByBattler[MAX_BATTLERS_COUNT];
|
|
|
|
extern const u8 *gSelectionBattleScripts[MAX_BATTLERS_COUNT];
|
|
|
|
extern const u8 *gPalaceSelectionBattleScripts[MAX_BATTLERS_COUNT];
|
|
|
|
extern u16 gLastPrintedMoves[MAX_BATTLERS_COUNT];
|
|
|
|
extern u16 gLastMoves[MAX_BATTLERS_COUNT];
|
|
|
|
extern u16 gLastLandedMoves[MAX_BATTLERS_COUNT];
|
|
|
|
extern u16 gLastHitByType[MAX_BATTLERS_COUNT];
|
|
|
|
extern u16 gLastResultingMoves[MAX_BATTLERS_COUNT];
|
|
|
|
extern u16 gLockedMoves[MAX_BATTLERS_COUNT];
|
2018-09-22 18:37:03 +02:00
|
|
|
extern u16 gLastUsedMove;
|
2018-02-07 23:21:51 +01:00
|
|
|
extern u8 gLastHitBy[MAX_BATTLERS_COUNT];
|
|
|
|
extern u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT];
|
2018-07-21 15:11:13 +02:00
|
|
|
extern u16 gMoveResultFlags;
|
2018-02-07 23:21:51 +01:00
|
|
|
extern u32 gHitMarker;
|
|
|
|
extern u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT];
|
|
|
|
extern u8 gUnknown_0202428C;
|
2018-07-24 20:13:02 +02:00
|
|
|
extern u32 gSideStatuses[2];
|
2018-02-07 23:21:51 +01:00
|
|
|
extern struct SideTimer gSideTimers[2];
|
|
|
|
extern u32 gStatuses3[MAX_BATTLERS_COUNT];
|
|
|
|
extern struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT];
|
|
|
|
extern u16 gPauseCounterBattle;
|
|
|
|
extern u16 gPaydayMoney;
|
|
|
|
extern u16 gRandomTurnNumber;
|
|
|
|
extern u8 gBattleCommunication[BATTLE_COMMUNICATION_ENTRIES_COUNT];
|
|
|
|
extern u8 gBattleOutcome;
|
|
|
|
extern struct ProtectStruct gProtectStructs[MAX_BATTLERS_COUNT];
|
|
|
|
extern struct SpecialStatus gSpecialStatuses[MAX_BATTLERS_COUNT];
|
|
|
|
extern u16 gBattleWeather;
|
|
|
|
extern struct WishFutureKnock gWishFutureKnock;
|
2018-02-08 11:17:41 +01:00
|
|
|
extern u16 gIntroSlideFlags;
|
2018-02-07 23:21:51 +01:00
|
|
|
extern u8 gSentPokesToOpponent[2];
|
|
|
|
extern u16 gExpShareExp;
|
|
|
|
extern struct BattleEnigmaBerry gEnigmaBerries[MAX_BATTLERS_COUNT];
|
|
|
|
extern struct BattleScripting gBattleScripting;
|
|
|
|
extern struct BattleStruct *gBattleStruct;
|
|
|
|
extern u8 *gLinkBattleSendBuffer;
|
|
|
|
extern u8 *gLinkBattleRecvBuffer;
|
|
|
|
extern struct BattleResources *gBattleResources;
|
|
|
|
extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT];
|
|
|
|
extern u8 gMoveSelectionCursor[MAX_BATTLERS_COUNT];
|
2018-02-08 11:17:41 +01:00
|
|
|
extern u8 gBattlerStatusSummaryTaskId[MAX_BATTLERS_COUNT];
|
2018-02-07 23:21:51 +01:00
|
|
|
extern u8 gBattlerInMenuId;
|
|
|
|
extern bool8 gDoingBattleAnim;
|
|
|
|
extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT];
|
|
|
|
extern u8 gPlayerDpadHoldFrames;
|
|
|
|
extern struct BattleSpriteData *gBattleSpritesDataPtr;
|
|
|
|
extern struct MonSpritesGfx *gMonSpritesGfxPtr;
|
2018-02-08 00:00:25 +01:00
|
|
|
extern struct BattleHealthboxInfo *gUnknown_020244D8;
|
|
|
|
extern struct BattleHealthboxInfo *gUnknown_020244DC;
|
2018-02-07 23:21:51 +01:00
|
|
|
extern u16 gBattleMovePower;
|
|
|
|
extern u16 gMoveToLearn;
|
|
|
|
extern u8 gBattleMonForms[MAX_BATTLERS_COUNT];
|
2018-07-14 13:17:10 +02:00
|
|
|
extern u32 gFieldStatuses;
|
|
|
|
extern struct FieldTimer gFieldTimers;
|
2018-02-07 23:21:51 +01:00
|
|
|
|
|
|
|
extern void (*gPreBattleCallback1)(void);
|
|
|
|
extern void (*gBattleMainFunc)(void);
|
|
|
|
extern struct BattleResults gBattleResults;
|
|
|
|
extern u8 gLeveledUpInBattle;
|
|
|
|
extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void);
|
|
|
|
extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT];
|
|
|
|
extern u8 gMultiUsePlayerCursor;
|
|
|
|
extern u8 gNumberOfMovesToChoose;
|
|
|
|
extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT];
|
2017-09-11 11:35:41 +02:00
|
|
|
|
|
|
|
#endif // GUARD_BATTLE_H
|