2018-08-15 15:49:50 +02:00
# include "global.h"
2018-08-25 19:59:47 +02:00
# include "battle_dome.h"
2018-08-15 15:49:50 +02:00
# include "battle.h"
2019-12-18 08:32:52 +01:00
# include "battle_main.h"
2018-08-15 15:49:50 +02:00
# include "battle_setup.h"
2018-08-25 18:46:15 +02:00
# include "battle_tower.h"
2018-10-30 22:17:03 +01:00
# include "frontier_util.h"
2018-08-15 23:04:46 +02:00
# include "battle_message.h"
2018-08-15 15:49:50 +02:00
# include "event_data.h"
# include "overworld.h"
# include "util.h"
2019-09-09 03:07:54 +02:00
# include "malloc.h"
2018-08-15 23:04:46 +02:00
# include "string_util.h"
# include "random.h"
2018-08-18 00:54:18 +02:00
# include "task.h"
# include "main.h"
# include "gpu_regs.h"
# include "text.h"
# include "bg.h"
# include "window.h"
2019-02-08 18:08:25 +01:00
# include "strings.h"
2018-08-18 00:54:18 +02:00
# include "palette.h"
# include "decompress.h"
2018-12-24 00:02:29 +01:00
# include "party_menu.h"
2018-08-18 00:54:18 +02:00
# include "menu.h"
2018-08-18 19:52:25 +02:00
# include "sound.h"
2018-08-18 00:54:18 +02:00
# include "pokemon_icon.h"
2019-04-04 23:53:06 +02:00
# include "data.h"
2018-08-19 17:13:05 +02:00
# include "international_string_util.h"
2018-08-19 01:06:10 +02:00
# include "trainer_pokemon_sprites.h"
2018-08-21 23:36:59 +02:00
# include "scanline_effect.h"
2018-12-05 22:21:26 +01:00
# include "script_pokemon_util_80F87D8.h"
2018-10-21 09:24:57 +02:00
# include "graphics.h"
2019-11-29 03:09:35 +01:00
# include "constants/battle_dome.h"
2019-11-21 03:46:29 +01:00
# include "constants/frontier_util.h"
2018-08-15 15:49:50 +02:00
# include "constants/species.h"
2018-08-15 23:04:46 +02:00
# include "constants/moves.h"
2019-12-18 08:32:52 +01:00
# include "constants/pokemon.h"
2018-08-15 23:04:46 +02:00
# include "constants/trainers.h"
# include "constants/abilities.h"
2018-08-18 19:52:25 +02:00
# include "constants/songs.h"
2018-08-25 19:59:47 +02:00
# include "constants/battle_frontier.h"
2018-08-29 20:38:54 +02:00
# include "constants/rgb.h"
2018-08-18 19:52:25 +02:00
2018-08-25 19:59:47 +02:00
struct BattleDomeStruct
2018-08-18 00:54:18 +02:00
{
2018-08-25 19:59:47 +02:00
u8 arr [ DOME_TOURNAMENT_TRAINERS_COUNT ] ;
2018-08-18 18:23:40 +02:00
u8 unk_10 ;
2019-12-21 10:27:12 +01:00
u8 unk_11 [ 2 ] ;
2018-08-18 00:54:18 +02:00
} ;
2018-08-25 19:59:47 +02:00
struct UnkStruct_860DD10
{
u8 x ;
u8 y ;
u16 src ;
} ;
2019-12-18 08:32:52 +01:00
# define DOME_TRAINERS gSaveBlock2Ptr->frontier.domeTrainers
# define DOME_MONS gSaveBlock2Ptr->frontier.domeMonIds
2018-08-15 15:49:50 +02:00
// This file's functions.
2018-08-25 19:59:47 +02:00
static u8 GetDomeTrainerMonIvs ( u16 trainerId ) ;
2019-02-08 18:08:25 +01:00
static void SwapDomeTrainers ( int id1 , int id2 , u16 * statsArray ) ;
static void CalcDomeMonStats ( u16 species , int level , int ivs , u8 evBits , u8 nature , int * stats ) ;
static void CreateDomeOpponentMons ( u16 tournamentTrainerId ) ;
static int sub_818FCBC ( u16 tournamentTrainerId , bool8 arg1 ) ;
static int sub_818FDB8 ( u16 tournamentTrainerId , bool8 arg1 ) ;
static int GetTypeEffectivenessPoints ( int move , int species , int arg2 ) ;
2019-12-18 08:32:52 +01:00
static int SelectOpponentMonsFromParty ( int * arr , bool8 arg1 ) ;
2019-02-08 18:08:25 +01:00
static void Task_ShowOpponentInfo ( u8 taskId ) ;
2018-08-25 19:59:47 +02:00
static void sub_8190CD4 ( u8 taskId ) ;
static u8 sub_819221C ( u8 taskId ) ;
2019-12-21 10:27:12 +01:00
static void SetFacilityTrainerAndMonPtrs ( void ) ;
2019-02-08 18:08:25 +01:00
static int TrainerIdToTournamentId ( u16 trainerId ) ;
2018-08-25 19:59:47 +02:00
static u16 TrainerIdOfPlayerOpponent ( void ) ;
2019-02-08 18:08:25 +01:00
static void Task_ShowTourneyTree ( u8 taskId ) ;
2018-08-25 19:59:47 +02:00
static void sub_8194950 ( u8 taskId ) ;
2018-08-25 11:55:16 +02:00
static void CB2_BattleDome ( void ) ;
2018-08-25 18:46:15 +02:00
static void VblankCb0_BattleDome ( void ) ;
2018-08-21 23:36:59 +02:00
static void DisplayMatchInfoOnCard ( u8 flags , u8 matchNo ) ;
2018-08-19 20:21:37 +02:00
static void DisplayTrainerInfoOnCard ( u8 flags , u8 trainerTournamentId ) ;
2019-12-21 10:27:12 +01:00
static int BufferDomeWinString ( u8 , u8 * ) ;
2018-08-25 19:59:47 +02:00
static u8 GetDomeBrainTrainerPicId ( void ) ;
static u8 GetDomeBrainTrainerClass ( void ) ;
2019-02-08 18:08:25 +01:00
static void CopyDomeBrainTrainerName ( u8 * str ) ;
static void CopyDomeTrainerName ( u8 * str , u16 trainerId ) ;
2018-08-25 19:59:47 +02:00
static void HblankCb_BattleDome ( void ) ;
2018-08-25 18:46:15 +02:00
static void VblankCb1_BattleDome ( void ) ;
2019-02-08 18:08:25 +01:00
static u8 UpdateTourneyTreeCursor ( u8 taskId ) ;
2018-08-25 19:59:47 +02:00
static void DecideRoundWinners ( u8 roundId ) ;
static u8 sub_81953E8 ( u8 tournamentId , u8 ) ;
static void sub_81948EC ( u8 , u8 ) ;
2018-08-26 15:51:14 +02:00
static void sub_8190B40 ( struct Sprite * sprite ) ;
static void sub_8190C6C ( struct Sprite * sprite ) ;
2019-02-08 18:08:25 +01:00
static void InitDomeChallenge ( void ) ;
static void GetDomeData ( void ) ;
static void SetDomeData ( void ) ;
static void BufferDomeRoundText ( void ) ;
static void BufferDomeOpponentName ( void ) ;
static void InitDomeOpponentParty ( void ) ;
2018-08-26 15:51:14 +02:00
static void ShowDomeOpponentInfo ( void ) ;
2019-02-08 18:08:25 +01:00
static void ShowDomeTourneyTree ( void ) ;
static void ShowPreviousDomeResultsTourneyTree ( void ) ;
static void SetDomeOpponentId ( void ) ;
static void SetDomeOpponentGraphicsId ( void ) ;
static void ShowNonInteractiveDomeTourneyTree ( void ) ;
static void ResolveDomeRoundWinners ( void ) ;
2019-11-29 03:09:35 +01:00
static void SaveDomeChallenge ( void ) ;
static void IncrementDomeStreaks ( void ) ;
static void ResetSketchedMoves ( void ) ;
2019-02-08 18:08:25 +01:00
static void RestoreDomePlayerPartyHeldItems ( void ) ;
2019-12-18 08:32:52 +01:00
static void ReduceDomePlayerPartyToSelectedMons ( void ) ;
2019-02-08 18:08:25 +01:00
static void GetPlayerSeededBeforeOpponent ( void ) ;
static void BufferLastDomeWinnerName ( void ) ;
2019-12-18 08:32:52 +01:00
static void InitRandomTourneyTreeResults ( void ) ;
2018-08-26 15:51:14 +02:00
static void InitDomeTrainers ( void ) ;
2018-08-26 14:40:36 +02:00
2018-08-25 19:59:47 +02:00
// EWRAM variables.
2019-12-18 08:32:52 +01:00
EWRAM_DATA u32 gPlayerPartyLostHP = 0 ; // never read
static EWRAM_DATA u32 sPlayerPartyMaxHP = 0 ; // never read
2018-08-25 19:59:47 +02:00
static EWRAM_DATA struct BattleDomeStruct * sBattleDomeStruct = { 0 } ;
static EWRAM_DATA u8 * sTilemapBuffer = NULL ;
2019-12-21 10:27:12 +01:00
// Each move has an array of flags for different move qualities which contribute to a tourney trainers listed battle style (see sBattleStyleThresholds)
static const u8 sBattleStyleMoveQualities [ MOVES_COUNT ] [ NUM_MOVE_QUALITIES ] =
{
[ MOVE_NONE ] = { 0 } ,
[ MOVE_POUND ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_KARATE_CHOP ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_DOUBLE_SLAP ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_COMET_PUNCH ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_MEGA_PUNCH ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_PAY_DAY ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_FIRE_PUNCH ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_ICE_PUNCH ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_THUNDER_PUNCH ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SCRATCH ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_VICE_GRIP ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_GUILLOTINE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_RAZOR_WIND ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_SWORDS_DANCE ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_STAT_RAISE ] = 1 , [ MOVE_QUALITY_POPULAR ] = 1 } ,
[ MOVE_CUT ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_GUST ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_WING_ATTACK ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_WHIRLWIND ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_FLY ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_BIND ] = { [ MOVE_QUALITY_STATUS ] = 1 , [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SLAM ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_VINE_WHIP ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_STOMP ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_DOUBLE_KICK ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_MEGA_KICK ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_JUMP_KICK ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_ROLLING_KICK ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SAND_ATTACK ] = { [ MOVE_QUALITY_STAT_LOWER ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_HEADBUTT ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_HORN_ATTACK ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_FURY_ATTACK ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_HORN_DRILL ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_TACKLE ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_BODY_SLAM ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_WRAP ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_TAKE_DOWN ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_THRASH ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_DOUBLE_EDGE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_TAIL_WHIP ] = { [ MOVE_QUALITY_STAT_LOWER ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_POISON_STING ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_TWINEEDLE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_PIN_MISSILE ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_LEER ] = { [ MOVE_QUALITY_STAT_LOWER ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_BITE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_GROWL ] = { [ MOVE_QUALITY_STAT_LOWER ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_ROAR ] = { [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_SING ] = { [ MOVE_QUALITY_STATUS ] = 1 } ,
[ MOVE_SUPERSONIC ] = { [ MOVE_QUALITY_STATUS ] = 1 } ,
[ MOVE_SONIC_BOOM ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_DISABLE ] = { [ MOVE_QUALITY_STATUS ] = 1 } ,
[ MOVE_ACID ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_EMBER ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_FLAMETHROWER ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_POPULAR ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_MIST ] = { 0 } ,
[ MOVE_WATER_GUN ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_HYDRO_PUMP ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_SURF ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_POPULAR ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 } ,
[ MOVE_ICE_BEAM ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_POPULAR ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_BLIZZARD ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_PSYBEAM ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_BUBBLE_BEAM ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_AURORA_BEAM ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_HYPER_BEAM ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_POPULAR ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_PECK ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_DRILL_PECK ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_SUBMISSION ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_LOW_KICK ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_COUNTER ] = { [ MOVE_QUALITY_DEF ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LUCK ] = 1 } ,
[ MOVE_SEISMIC_TOSS ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_STRENGTH ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_ABSORB ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_MEGA_DRAIN ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_LEECH_SEED ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_STATUS ] = 1 } ,
[ MOVE_GROWTH ] = { [ MOVE_QUALITY_STAT_RAISE ] = 1 } ,
[ MOVE_RAZOR_LEAF ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_SOLAR_BEAM ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_POPULAR ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 } ,
[ MOVE_POISON_POWDER ] = { [ MOVE_QUALITY_STATUS ] = 1 } ,
[ MOVE_STUN_SPORE ] = { [ MOVE_QUALITY_STATUS ] = 1 } ,
[ MOVE_SLEEP_POWDER ] = { [ MOVE_QUALITY_STATUS ] = 1 } ,
[ MOVE_PETAL_DANCE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_STRING_SHOT ] = { [ MOVE_QUALITY_STAT_LOWER ] = 1 } ,
[ MOVE_DRAGON_RAGE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_FIRE_SPIN ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_THUNDER_SHOCK ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_THUNDERBOLT ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_POPULAR ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_THUNDER_WAVE ] = { [ MOVE_QUALITY_STATUS ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_THUNDER ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_ROCK_THROW ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_EARTHQUAKE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_POPULAR ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 } ,
[ MOVE_FISSURE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_LUCK ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_DIG ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_TOXIC ] = { [ MOVE_QUALITY_STATUS ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_CONFUSION ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_PSYCHIC ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_POPULAR ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_HYPNOSIS ] = { [ MOVE_QUALITY_COMBO ] = 1 } ,
[ MOVE_MEDITATE ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_STAT_RAISE ] = 1 } ,
[ MOVE_AGILITY ] = { [ MOVE_QUALITY_STAT_RAISE ] = 1 } ,
[ MOVE_QUICK_ATTACK ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_RAGE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_TELEPORT ] = { 0 } ,
[ MOVE_NIGHT_SHADE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_MIMIC ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_SCREECH ] = { [ MOVE_QUALITY_STAT_LOWER ] = 1 } ,
[ MOVE_DOUBLE_TEAM ] = { [ MOVE_QUALITY_STAT_RAISE ] = 1 , [ MOVE_QUALITY_DEF ] = 1 } ,
[ MOVE_RECOVER ] = { 0 } ,
[ MOVE_HARDEN ] = { [ MOVE_QUALITY_STAT_RAISE ] = 1 , [ MOVE_QUALITY_DEF ] = 1 } ,
[ MOVE_MINIMIZE ] = { [ MOVE_QUALITY_STAT_RAISE ] = 1 , [ MOVE_QUALITY_DEF ] = 1 } ,
[ MOVE_SMOKESCREEN ] = { [ MOVE_QUALITY_STAT_LOWER ] = 1 , [ MOVE_QUALITY_DEF ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_CONFUSE_RAY ] = { [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_WITHDRAW ] = { [ MOVE_QUALITY_STAT_RAISE ] = 1 , [ MOVE_QUALITY_DEF ] = 1 } ,
[ MOVE_DEFENSE_CURL ] = { [ MOVE_QUALITY_STAT_RAISE ] = 1 , [ MOVE_QUALITY_DEF ] = 1 } ,
[ MOVE_BARRIER ] = { [ MOVE_QUALITY_DEF ] = 1 } ,
[ MOVE_LIGHT_SCREEN ] = { [ MOVE_QUALITY_DEF ] = 1 } ,
[ MOVE_HAZE ] = { 0 } ,
[ MOVE_REFLECT ] = { [ MOVE_QUALITY_DEF ] = 1 } ,
[ MOVE_FOCUS_ENERGY ] = { [ MOVE_QUALITY_COMBO ] = 1 } ,
[ MOVE_BIDE ] = { [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_METRONOME ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_LUCK ] = 1 } ,
[ MOVE_MIRROR_MOVE ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_LUCK ] = 1 } ,
[ MOVE_SELF_DESTRUCT ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_EGG_BOMB ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 } ,
[ MOVE_LICK ] = { [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SMOG ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SLUDGE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_BONE_CLUB ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_FIRE_BLAST ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_WATERFALL ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_CLAMP ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SWIFT ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_SKULL_BASH ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 } ,
[ MOVE_SPIKE_CANNON ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_CONSTRICT ] = { [ MOVE_QUALITY_STATUS ] = 1 , [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_AMNESIA ] = { [ MOVE_QUALITY_STAT_RAISE ] = 1 , [ MOVE_QUALITY_DEF ] = 1 } ,
[ MOVE_KINESIS ] = { [ MOVE_QUALITY_STAT_LOWER ] = 1 } ,
[ MOVE_SOFT_BOILED ] = { [ MOVE_QUALITY_HEAL ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_HI_JUMP_KICK ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_GLARE ] = { [ MOVE_QUALITY_STAT_LOWER ] = 1 } ,
[ MOVE_DREAM_EATER ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_HEAL ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 } ,
[ MOVE_POISON_GAS ] = { [ MOVE_QUALITY_STATUS ] = 1 } ,
[ MOVE_BARRAGE ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_LEECH_LIFE ] = { [ MOVE_QUALITY_HEAL ] = 1 , [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_LOVELY_KISS ] = { [ MOVE_QUALITY_STATUS ] = 1 } ,
[ MOVE_SKY_ATTACK ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_TRANSFORM ] = { [ MOVE_QUALITY_RARE ] = 1 } ,
[ MOVE_BUBBLE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_DIZZY_PUNCH ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SPORE ] = { [ MOVE_QUALITY_STATUS ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_FLASH ] = { 0 } ,
[ MOVE_PSYWAVE ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_SPLASH ] = { [ MOVE_QUALITY_RARE ] = 1 } ,
[ MOVE_ACID_ARMOR ] = { [ MOVE_QUALITY_STAT_RAISE ] = 1 , [ MOVE_QUALITY_DEF ] = 1 } ,
[ MOVE_CRABHAMMER ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 } ,
[ MOVE_EXPLOSION ] = { [ MOVE_QUALITY_RISKY ] = 1 , [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_POPULAR ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_FURY_SWIPES ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_BONEMERANG ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_REST ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_HEAL ] = 1 } ,
[ MOVE_ROCK_SLIDE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_HYPER_FANG ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SHARPEN ] = { [ MOVE_QUALITY_STAT_RAISE ] = 1 , [ MOVE_QUALITY_DEF ] = 1 } ,
[ MOVE_CONVERSION ] = { [ MOVE_QUALITY_DEF ] = 1 } ,
[ MOVE_TRI_ATTACK ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SUPER_FANG ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_SLASH ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_SUBSTITUTE ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_DEF ] = 1 } ,
[ MOVE_STRUGGLE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } , // Odd that this is assigned qualities
[ MOVE_SKETCH ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_LUCK ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_TRIPLE_KICK ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_THIEF ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SPIDER_WEB ] = { [ MOVE_QUALITY_STAT_LOWER ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_MIND_READER ] = { [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_NIGHTMARE ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_STATUS ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_FLAME_WHEEL ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SNORE ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_CURSE ] = { [ MOVE_QUALITY_STATUS ] = 1 } ,
[ MOVE_FLAIL ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_CONVERSION_2 ] = { [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_AEROBLAST ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_COTTON_SPORE ] = { [ MOVE_QUALITY_STAT_LOWER ] = 1 } ,
[ MOVE_REVERSAL ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_SPITE ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_RISKY ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_POWDER_SNOW ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_PROTECT ] = { [ MOVE_QUALITY_DEF ] = 1 , [ MOVE_QUALITY_POPULAR ] = 1 } ,
[ MOVE_MACH_PUNCH ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_SCARY_FACE ] = { 0 } ,
[ MOVE_FAINT_ATTACK ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_SWEET_KISS ] = { 0 } ,
[ MOVE_BELLY_DRUM ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_STAT_RAISE ] = 1 } ,
[ MOVE_SLUDGE_BOMB ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_MUD_SLAP ] = { [ MOVE_QUALITY_STAT_LOWER ] = 1 , [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_OCTAZOOKA ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SPIKES ] = { [ MOVE_QUALITY_COMBO ] = 1 } ,
[ MOVE_ZAP_CANNON ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_LUCK ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_FORESIGHT ] = { [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_DESTINY_BOND ] = { [ MOVE_QUALITY_RISKY ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_PERISH_SONG ] = { [ MOVE_QUALITY_RISKY ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_ICY_WIND ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_DETECT ] = { [ MOVE_QUALITY_DEF ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_BONE_RUSH ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_LOCK_ON ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_OUTRAGE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SANDSTORM ] = { 0 } ,
[ MOVE_GIGA_DRAIN ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_ENDURE ] = { [ MOVE_QUALITY_DEF ] = 1 } ,
[ MOVE_CHARM ] = { [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_ROLLOUT ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_FALSE_SWIPE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_SWAGGER ] = { [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_MILK_DRINK ] = { [ MOVE_QUALITY_HEAL ] = 1 } ,
[ MOVE_SPARK ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_FURY_CUTTER ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_STEEL_WING ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_MEAN_LOOK ] = { [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_ATTRACT ] = { [ MOVE_QUALITY_STATUS ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_SLEEP_TALK ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_LUCK ] = 1 } ,
[ MOVE_HEAL_BELL ] = { [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_RETURN ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_PRESENT ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_LUCK ] = 1 } ,
[ MOVE_FRUSTRATION ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_SAFEGUARD ] = { [ MOVE_QUALITY_DEF ] = 1 } ,
[ MOVE_PAIN_SPLIT ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_SACRED_FIRE ] = { [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_MAGNITUDE ] = { [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_DYNAMIC_PUNCH ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_LUCK ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_MEGAHORN ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 } ,
[ MOVE_DRAGON_BREATH ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_BATON_PASS ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_RARE ] = 1 } ,
[ MOVE_ENCORE ] = { [ MOVE_QUALITY_STATUS ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_PURSUIT ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_RAPID_SPIN ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_SWEET_SCENT ] = { [ MOVE_QUALITY_STAT_LOWER ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_IRON_TAIL ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_METAL_CLAW ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_VITAL_THROW ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_MORNING_SUN ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_HEAL ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_SYNTHESIS ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_HEAL ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_MOONLIGHT ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_HEAL ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_HIDDEN_POWER ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_CROSS_CHOP ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_TWISTER ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_RAIN_DANCE ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_SUNNY_DAY ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_CRUNCH ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_MIRROR_COAT ] = { [ MOVE_QUALITY_DEF ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_PSYCH_UP ] = { [ MOVE_QUALITY_STAT_RAISE ] = 1 } ,
[ MOVE_EXTREME_SPEED ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_ANCIENT_POWER ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SHADOW_BALL ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_FUTURE_SIGHT ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_ROCK_SMASH ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_WHIRLPOOL ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_BEAT_UP ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_FAKE_OUT ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_UPROAR ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_STOCKPILE ] = { [ MOVE_QUALITY_COMBO ] = 1 } ,
[ MOVE_SPIT_UP ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 } ,
[ MOVE_SWALLOW ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_HEAL ] = 1 } ,
[ MOVE_HEAT_WAVE ] = { [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_HAIL ] = { 0 } ,
[ MOVE_TORMENT ] = { [ MOVE_QUALITY_STATUS ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_FLATTER ] = { [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_WILL_O_WISP ] = { [ MOVE_QUALITY_STATUS ] = 1 } ,
[ MOVE_MEMENTO ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_FACADE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_FOCUS_PUNCH ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 } ,
[ MOVE_SMELLING_SALT ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_FOLLOW_ME ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_NATURE_POWER ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_CHARGE ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_TAUNT ] = { [ MOVE_QUALITY_STATUS ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_HELPING_HAND ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_TRICK ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_ROLE_PLAY ] = { [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_WISH ] = { [ MOVE_QUALITY_HEAL ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_ASSIST ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LUCK ] = 1 } ,
[ MOVE_INGRAIN ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_HEAL ] = 1 , [ MOVE_QUALITY_DEF ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_SUPERPOWER ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_MAGIC_COAT ] = { [ MOVE_QUALITY_DEF ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LUCK ] = 1 } ,
[ MOVE_RECYCLE ] = { [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_REVENGE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LUCK ] = 1 } ,
[ MOVE_BRICK_BREAK ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_YAWN ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_STATUS ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_KNOCK_OFF ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_ENDEAVOR ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_ERUPTION ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_SKILL_SWAP ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_IMPRISON ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LUCK ] = 1 } ,
[ MOVE_REFRESH ] = { [ MOVE_QUALITY_HEAL ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_GRUDGE ] = { [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_SNATCH ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LUCK ] = 1 } ,
[ MOVE_SECRET_POWER ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_DIVE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_ARM_THRUST ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_CAMOUFLAGE ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_TAIL_GLOW ] = { [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_LUSTER_PURGE ] = { [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_MIST_BALL ] = { [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_FEATHER_DANCE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_TEETER_DANCE ] = { [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_BLAZE_KICK ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_MUD_SPORT ] = { [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_ICE_BALL ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_NEEDLE_ARM ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SLACK_OFF ] = { [ MOVE_QUALITY_HEAL ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_HYPER_VOICE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 } ,
[ MOVE_POISON_FANG ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_CRUSH_CLAW ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_BLAST_BURN ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_HYDRO_CANNON ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_METEOR_MASH ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_ASTONISH ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_WEATHER_BALL ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_AROMATHERAPY ] = { [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_FAKE_TEARS ] = { [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_AIR_CUTTER ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_OVERHEAT ] = { [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_ODOR_SLEUTH ] = { [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_ROCK_TOMB ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SILVER_WIND ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_METAL_SOUND ] = { 0 } ,
[ MOVE_GRASS_WHISTLE ] = { 0 } ,
[ MOVE_TICKLE ] = { [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_COSMIC_POWER ] = { 0 } ,
[ MOVE_WATER_SPOUT ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_SIGNAL_BEAM ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SHADOW_PUNCH ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_EXTRASENSORY ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SKY_UPPERCUT ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_SAND_TOMB ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_SHEER_COLD ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_LUCK ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_MUDDY_WATER ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_BULLET_SEED ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_AERIAL_ACE ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_ICICLE_SPEAR ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_IRON_DEFENSE ] = { [ MOVE_QUALITY_DEF ] = 1 } ,
[ MOVE_BLOCK ] = { [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_HOWL ] = { 0 } ,
[ MOVE_DRAGON_CLAW ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_FRENZY_PLANT ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_BULK_UP ] = { [ MOVE_QUALITY_COMBO ] = 1 } ,
[ MOVE_BOUNCE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_MUD_SHOT ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_POISON_TAIL ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_COVET ] = { [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_VOLT_TACKLE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 } ,
[ MOVE_MAGICAL_LEAF ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_WATER_SPORT ] = { [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_CALM_MIND ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_STAT_RAISE ] = 1 } ,
[ MOVE_LEAF_BLADE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 } ,
[ MOVE_DRAGON_DANCE ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_STAT_RAISE ] = 1 } ,
[ MOVE_ROCK_BLAST ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_SHOCK_WAVE ] = { [ MOVE_QUALITY_DMG ] = 1 } ,
[ MOVE_WATER_PULSE ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
[ MOVE_DOOM_DESIRE ] = { [ MOVE_QUALITY_RARE ] = 1 , [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 } ,
[ MOVE_PSYCHO_BOOST ] = { [ MOVE_QUALITY_DMG ] = 1 , [ MOVE_QUALITY_POWERFUL ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 , [ MOVE_QUALITY_LOW_PP ] = 1 , [ MOVE_QUALITY_EFFECT ] = 1 } ,
2018-08-19 22:26:07 +02:00
} ;
2019-12-21 10:27:12 +01:00
// This array is searched in-order to determine what battle style a tourney trainer uses.
// If the sum of the quality flags for the party's moves meets/exceeds all the point totals of an element, then they use that battle style
static const u8 sBattleStyleThresholds [ NUM_BATTLE_STYLES - 1 ] [ NUM_MOVE_QUALITIES ] =
{
[ DOME_BATTLE_STYLE_RISKY ] = { [ MOVE_QUALITY_RISKY ] = 1 } ,
[ DOME_BATTLE_STYLE_STALL ] = { [ MOVE_QUALITY_HEAL ] = 2 , [ MOVE_QUALITY_STATUS ] = 1 , [ MOVE_QUALITY_DEF ] = 2 } ,
[ DOME_BATTLE_STYLE_VARIED ] = { [ MOVE_QUALITY_COMBO ] = 1 , [ MOVE_QUALITY_STAT_RAISE ] = 1 , [ MOVE_QUALITY_STAT_LOWER ] = 1 , [ MOVE_QUALITY_HEAL ] = 1 , [ MOVE_QUALITY_STATUS ] = 1 , [ MOVE_QUALITY_DEF ] = 1 } ,
[ DOME_BATTLE_STYLE_COMBO_HIGH ] = { [ MOVE_QUALITY_COMBO ] = 3 } ,
[ DOME_BATTLE_STYLE_RARE_MOVES ] = { [ MOVE_QUALITY_RARE ] = 2 } ,
[ DOME_BATTLE_STYLE_RARE_MOVE ] = { [ MOVE_QUALITY_RARE ] = 1 } ,
[ DOME_BATTLE_STYLE_HP ] = { [ MOVE_QUALITY_HEAL ] = 3 } ,
[ DOME_BATTLE_STYLE_STORE_POWER ] = { [ MOVE_QUALITY_STAT_RAISE ] = 1 , [ MOVE_QUALITY_HEAL ] = 1 } ,
[ DOME_BATTLE_STYLE_ENFEEBLE_LOW ] = { [ MOVE_QUALITY_STAT_LOWER ] = 1 , [ MOVE_QUALITY_STATUS ] = 1 } ,
[ DOME_BATTLE_STYLE_LUCK ] = { [ MOVE_QUALITY_LUCK ] = 2 } ,
[ DOME_BATTLE_STYLE_10 ] = { [ MOVE_QUALITY_STAT_RAISE ] = 1 , [ MOVE_QUALITY_HEAL ] = 1 , [ MOVE_QUALITY_DEF ] = 1 , [ MOVE_QUALITY_POPULAR ] = 1 , [ MOVE_QUALITY_STRONG ] = 1 } ,
[ DOME_BATTLE_STYLE_LOW_PP ] = { [ MOVE_QUALITY_LOW_PP ] = 3 } ,
[ DOME_BATTLE_STYLE_STATUS_ATK ] = { [ MOVE_QUALITY_STAT_RAISE ] = 1 , [ MOVE_QUALITY_STATUS ] = 1 } ,
[ DOME_BATTLE_STYLE_ENDURE ] = { [ MOVE_QUALITY_HEAL ] = 2 , [ MOVE_QUALITY_DEF ] = 2 } ,
[ DOME_BATTLE_STYLE_STATUS ] = { [ MOVE_QUALITY_STATUS ] = 2 } ,
[ DOME_BATTLE_STYLE_STRAIGHTFORWARD ] = { [ MOVE_QUALITY_ACCURATE ] = 3 , [ MOVE_QUALITY_STRONG ] = 3 } ,
[ DOME_BATTLE_STYLE_AGGRESSIVE ] = { [ MOVE_QUALITY_STRONG ] = 4 } ,
[ DOME_BATTLE_STYLE_DEF ] = { [ MOVE_QUALITY_DEF ] = 3 } ,
[ DOME_BATTLE_STYLE_ENFEEBLE_HIGH ] = { [ MOVE_QUALITY_STAT_LOWER ] = 2 , [ MOVE_QUALITY_STATUS ] = 2 } , // BUG: This battle style is unobtainable; DOME_BATTLE_STYLE_ENFEEBLE_LOW will always succeed before it
[ DOME_BATTLE_STYLE_POPULAR_POWER ] = { [ MOVE_QUALITY_POWERFUL ] = 3 , [ MOVE_QUALITY_POPULAR ] = 3 } ,
[ DOME_BATTLE_STYLE_COMBO_LOW ] = { [ MOVE_QUALITY_COMBO ] = 2 } ,
[ DOME_BATTLE_STYLE_ACCURATE ] = { [ MOVE_QUALITY_HEAL ] = 1 , [ MOVE_QUALITY_ACCURATE ] = 3 } ,
[ DOME_BATTLE_STYLE_POWERFUL ] = { [ MOVE_QUALITY_POWERFUL ] = 4 } ,
[ DOME_BATTLE_STYLE_ATK_OVER_DEF ] = { [ MOVE_QUALITY_DMG ] = 7 } ,
[ DOME_BATTLE_STYLE_DEF_OVER_ATK ] = { [ MOVE_QUALITY_DEF ] = 4 } , // BUG: This battle style is unobtainable; DOME_BATTLE_STYLE_DEF will always succeed before it
[ DOME_BATTLE_STYLE_POPULAR_STRONG ] = { [ MOVE_QUALITY_POPULAR ] = 2 , [ MOVE_QUALITY_STRONG ] = 4 } ,
[ DOME_BATTLE_STYLE_EFFECTS ] = { [ MOVE_QUALITY_EFFECT ] = 4 } ,
[ DOME_BATTLE_STYLE_BALANCED ] = { 0 } , // If no other thresholds are met, this battle style is used
[ DOME_BATTLE_STYLE_UNUSED1 ] = { 0 } , // Here below is unreachable
[ DOME_BATTLE_STYLE_UNUSED2 ] = { 0 } ,
[ DOME_BATTLE_STYLE_UNUSED3 ] = { 0 } ,
//[DOME_BATTLE_STYLE_UNUSED4] = {0}, // Excluded here, presumably was meant to be a style just for Dome Ace Tucker
2018-08-26 14:40:36 +02:00
} ;
static const u8 sUnusedArray [ ] =
{
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
3 , 0 , 0 , 0 , 0 , 0 , 3 , 0 , 0 , 0 , 0 , 0 , 3 , 0 , 0 , 0 ,
0 , 0 , 3 , 0 , 0 , 0 , 0 , 0 , 3 , 2 , 0 , 0 , 0 , 0 , 0 , 2 ,
0 , 0 , 0 , 0 , 0 , 2 , 0 , 0 , 0 , 0 , 0 , 2 , 0 , 0 , 0 , 0 ,
0 , 2 , 253 , 0 , 0 , 0 , 0 , 0 , 253 , 0 , 0 , 0 , 0 , 0 , 253 , 0 ,
0 , 0 , 0 , 0 , 253 , 0 , 0 , 0 , 0 , 0 , 253 , 254 , 0 , 0 , 0 , 0 ,
0 , 254 , 0 , 0 , 0 , 0 , 0 , 254 , 0 , 0 , 0 , 0 , 0 , 254 , 0 , 0 ,
0 , 0 , 0 , 254 , 0 , 0 , 0 , 0 , 0 ,
} ;
2019-02-08 18:08:25 +01:00
static const u8 sTourneyTreeCursorMovementMap [ ] [ 5 ] [ 4 ] =
2018-08-26 14:40:36 +02:00
{
{ { 0x07 , 0x01 , 0x08 , 0x10 } , { 0x07 , 0x01 , 0x08 , 0x10 } , { 0x07 , 0x01 , 0x08 , 0x10 } , { 0x07 , 0x01 , 0x08 , 0x10 } , { 0x07 , 0x01 , 0x08 , 0x10 } } ,
{ { 0x00 , 0x02 , 0x09 , 0x10 } , { 0x00 , 0x02 , 0x09 , 0x10 } , { 0x00 , 0x02 , 0x09 , 0x10 } , { 0x00 , 0x02 , 0x09 , 0x10 } , { 0x00 , 0x02 , 0x09 , 0x10 } } ,
{ { 0x01 , 0x03 , 0x0a , 0x11 } , { 0x01 , 0x03 , 0x0a , 0x11 } , { 0x01 , 0x03 , 0x0a , 0x11 } , { 0x01 , 0x03 , 0x0a , 0x11 } , { 0x01 , 0x03 , 0x0a , 0x11 } } ,
{ { 0x02 , 0x04 , 0x0b , 0x11 } , { 0x02 , 0x04 , 0x0b , 0x11 } , { 0x02 , 0x04 , 0x0b , 0x11 } , { 0x02 , 0x04 , 0x0b , 0x11 } , { 0x02 , 0x04 , 0x0b , 0x11 } } ,
{ { 0x03 , 0x05 , 0x0c , 0x12 } , { 0x03 , 0x05 , 0x0c , 0x12 } , { 0x03 , 0x05 , 0x0c , 0x12 } , { 0x03 , 0x05 , 0x0c , 0x12 } , { 0x03 , 0x05 , 0x0c , 0x12 } } ,
{ { 0x04 , 0x06 , 0x0d , 0x12 } , { 0x04 , 0x06 , 0x0d , 0x12 } , { 0x04 , 0x06 , 0x0d , 0x12 } , { 0x04 , 0x06 , 0x0d , 0x12 } , { 0x04 , 0x06 , 0x0d , 0x12 } } ,
{ { 0x05 , 0x07 , 0x0e , 0x13 } , { 0x05 , 0x07 , 0x0e , 0x13 } , { 0x05 , 0x07 , 0x0e , 0x13 } , { 0x05 , 0x07 , 0x0e , 0x13 } , { 0x05 , 0x07 , 0x0e , 0x13 } } ,
{ { 0x06 , 0x00 , 0x0f , 0x13 } , { 0x06 , 0x00 , 0x0f , 0x13 } , { 0x06 , 0x00 , 0x0f , 0x13 } , { 0x06 , 0x00 , 0x0f , 0x13 } , { 0x06 , 0x00 , 0x0f , 0x13 } } ,
{ { 0x1f , 0x09 , 0x14 , 0x1f } , { 0x1f , 0x09 , 0x14 , 0x1f } , { 0x1f , 0x09 , 0x14 , 0x1f } , { 0x1f , 0x09 , 0x14 , 0x1f } , { 0x1f , 0x09 , 0x14 , 0x1f } } ,
{ { 0x08 , 0x0a , 0x14 , 0x01 } , { 0x08 , 0x0a , 0x14 , 0x01 } , { 0x08 , 0x0a , 0x14 , 0x01 } , { 0x08 , 0x0a , 0x14 , 0x01 } , { 0x08 , 0x0a , 0x14 , 0x01 } } ,
{ { 0x09 , 0x0b , 0x15 , 0x02 } , { 0x09 , 0x0b , 0x15 , 0x02 } , { 0x09 , 0x0b , 0x15 , 0x02 } , { 0x09 , 0x0b , 0x15 , 0x02 } , { 0x09 , 0x0b , 0x15 , 0x02 } } ,
{ { 0x0a , 0x0c , 0x15 , 0x03 } , { 0x0a , 0x0c , 0x15 , 0x03 } , { 0x0a , 0x0c , 0x15 , 0x03 } , { 0x0a , 0x0c , 0x15 , 0x03 } , { 0x0a , 0x0c , 0x15 , 0x03 } } ,
{ { 0x0b , 0x0d , 0x16 , 0x04 } , { 0x0b , 0x0d , 0x16 , 0x04 } , { 0x0b , 0x0d , 0x16 , 0x04 } , { 0x0b , 0x0d , 0x16 , 0x04 } , { 0x0b , 0x0d , 0x16 , 0x04 } } ,
{ { 0x0c , 0x0e , 0x16 , 0x05 } , { 0x0c , 0x0e , 0x16 , 0x05 } , { 0x0c , 0x0e , 0x16 , 0x05 } , { 0x0c , 0x0e , 0x16 , 0x05 } , { 0x0c , 0x0e , 0x16 , 0x05 } } ,
{ { 0x0d , 0x0f , 0x17 , 0x06 } , { 0x0d , 0x0f , 0x17 , 0x06 } , { 0x0d , 0x0f , 0x17 , 0x06 } , { 0x0d , 0x0f , 0x17 , 0x06 } , { 0x0d , 0x0f , 0x17 , 0x06 } } ,
{ { 0x0e , 0x1f , 0x17 , 0x07 } , { 0x0e , 0x1f , 0x17 , 0x07 } , { 0x0e , 0x1f , 0x17 , 0x07 } , { 0x0e , 0x1f , 0x17 , 0x07 } , { 0x0e , 0x1f , 0x17 , 0x07 } } ,
{ { 0x13 , 0x11 , 0x00 , 0x14 } , { 0x13 , 0x11 , 0x00 , 0x18 } , { 0x13 , 0x11 , 0x00 , 0x18 } , { 0x13 , 0x11 , 0x00 , 0x18 } , { 0x13 , 0x11 , 0x00 , 0x18 } } ,
{ { 0x10 , 0x12 , 0x02 , 0x15 } , { 0x10 , 0x12 , 0x02 , 0x18 } , { 0x10 , 0x12 , 0x02 , 0x18 } , { 0x10 , 0x12 , 0x02 , 0x18 } , { 0x10 , 0x12 , 0x02 , 0x18 } } ,
{ { 0x11 , 0x13 , 0x04 , 0x16 } , { 0x11 , 0x13 , 0x04 , 0x19 } , { 0x11 , 0x13 , 0x04 , 0x19 } , { 0x11 , 0x13 , 0x04 , 0x19 } , { 0x11 , 0x13 , 0x04 , 0x19 } } ,
{ { 0x12 , 0x10 , 0x06 , 0x17 } , { 0x12 , 0x10 , 0x06 , 0x19 } , { 0x12 , 0x10 , 0x06 , 0x19 } , { 0x12 , 0x10 , 0x06 , 0x19 } , { 0x12 , 0x10 , 0x06 , 0x19 } } ,
{ { 0x17 , 0x15 , 0x10 , 0x08 } , { 0x17 , 0x15 , 0x1a , 0x08 } , { 0x17 , 0x15 , 0x1a , 0x08 } , { 0x17 , 0x15 , 0x1a , 0x08 } , { 0x17 , 0x15 , 0x1a , 0x08 } } ,
{ { 0x14 , 0x16 , 0x11 , 0x0a } , { 0x14 , 0x16 , 0x1a , 0x0a } , { 0x14 , 0x16 , 0x1a , 0x0a } , { 0x14 , 0x16 , 0x1a , 0x0a } , { 0x14 , 0x16 , 0x1a , 0x0a } } ,
{ { 0x15 , 0x17 , 0x12 , 0x0c } , { 0x15 , 0x17 , 0x1b , 0x0c } , { 0x15 , 0x17 , 0x1b , 0x0c } , { 0x15 , 0x17 , 0x1b , 0x0c } , { 0x15 , 0x17 , 0x1b , 0x0c } } ,
{ { 0x16 , 0x14 , 0x13 , 0x0e } , { 0x16 , 0x14 , 0x1b , 0x0e } , { 0x16 , 0x14 , 0x1b , 0x0e } , { 0x16 , 0x14 , 0x1b , 0x0e } , { 0x16 , 0x14 , 0x1b , 0x0e } } ,
{ { 0xff , 0xff , 0xff , 0xff } , { 0x19 , 0x19 , 0x10 , 0x1a } , { 0x19 , 0x19 , 0x10 , 0x1c } , { 0x19 , 0x19 , 0x10 , 0x1c } , { 0x19 , 0x19 , 0x10 , 0x1c } } ,
{ { 0xff , 0xff , 0xff , 0xff } , { 0x18 , 0x18 , 0x12 , 0x1b } , { 0x18 , 0x18 , 0x12 , 0x1c } , { 0x18 , 0x18 , 0x12 , 0x1c } , { 0x18 , 0x18 , 0x12 , 0x1c } } ,
{ { 0xff , 0xff , 0xff , 0xff } , { 0x1b , 0x1b , 0x18 , 0x14 } , { 0x1b , 0x1b , 0x1d , 0x14 } , { 0x1b , 0x1b , 0x1d , 0x14 } , { 0x1b , 0x1b , 0x1d , 0x14 } } ,
{ { 0xff , 0xff , 0xff , 0xff } , { 0x1a , 0x1a , 0x19 , 0x16 } , { 0x1a , 0x1a , 0x1d , 0x16 } , { 0x1a , 0x1a , 0x1d , 0x16 } , { 0x1a , 0x1a , 0x1d , 0x16 } } ,
{ { 0xff , 0xff , 0xff , 0xff } , { 0xff , 0xff , 0xff , 0xff } , { 0xff , 0xff , 0x18 , 0x1d } , { 0xff , 0xff , 0x18 , 0x1e } , { 0xff , 0xff , 0x18 , 0x1e } } ,
{ { 0xff , 0xff , 0xff , 0xff } , { 0xff , 0xff , 0xff , 0xff } , { 0xff , 0xff , 0x1c , 0x1a } , { 0xff , 0xff , 0x1e , 0x1a } , { 0xff , 0xff , 0x1e , 0x1a } } ,
{ { 0xff , 0xff , 0xff , 0xff } , { 0xff , 0xff , 0xff , 0xff } , { 0xff , 0xff , 0xff , 0xff } , { 0xff , 0xff , 0x1c , 0x1d } , { 0xff , 0xff , 0x1c , 0x1d } } ,
{ { 0x0f , 0x08 , 0x08 , 0x00 } , { 0x0f , 0x08 , 0x08 , 0x00 } , { 0x0f , 0x08 , 0x08 , 0x00 } , { 0x0f , 0x08 , 0x08 , 0x00 } , { 0x0f , 0x08 , 0x08 , 0x00 } } ,
} ;
2019-12-21 10:27:12 +01:00
static const struct BgTemplate sTourneyTreeBgTemplates [ 4 ] =
2018-08-26 14:40:36 +02:00
{
{
. bg = 0 ,
. charBaseIndex = 0 ,
. mapBaseIndex = 28 ,
. screenSize = 0 ,
. paletteMode = 0 ,
. priority = 0 ,
. baseTile = 0
} ,
{
. bg = 1 ,
. charBaseIndex = 1 ,
. mapBaseIndex = 29 ,
. screenSize = 0 ,
. paletteMode = 0 ,
. priority = 1 ,
. baseTile = 0
} ,
{
. bg = 2 ,
. charBaseIndex = 2 ,
. mapBaseIndex = 30 ,
. screenSize = 0 ,
. paletteMode = 0 ,
. priority = 2 ,
. baseTile = 0
} ,
{
. bg = 3 ,
. charBaseIndex = 2 ,
. mapBaseIndex = 31 ,
. screenSize = 0 ,
. paletteMode = 0 ,
. priority = 2 ,
. baseTile = 0
} ,
} ;
2019-12-18 08:32:52 +01:00
static const struct BgTemplate sOpponentInfoBgTemplates [ 4 ] =
2018-08-26 14:40:36 +02:00
{
{
. bg = 0 ,
. charBaseIndex = 0 ,
. mapBaseIndex = 20 ,
. screenSize = 3 ,
. paletteMode = 0 ,
. priority = 0 ,
. baseTile = 0
} ,
{
. bg = 1 ,
. charBaseIndex = 1 ,
. mapBaseIndex = 24 ,
. screenSize = 3 ,
. paletteMode = 0 ,
. priority = 0 ,
. baseTile = 0
} ,
{
. bg = 2 ,
. charBaseIndex = 2 ,
. mapBaseIndex = 28 ,
. screenSize = 3 ,
. paletteMode = 0 ,
. priority = 1 ,
. baseTile = 0
} ,
{
. bg = 3 ,
. charBaseIndex = 2 ,
. mapBaseIndex = 7 ,
. screenSize = 0 ,
. paletteMode = 0 ,
. priority = 1 ,
. baseTile = 0
} ,
} ;
2019-12-21 10:27:12 +01:00
static const struct WindowTemplate sTourneyTreeWindowTemplates [ ] =
2018-08-26 14:40:36 +02:00
{
{
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 0 ,
. tilemapTop = 3 ,
. width = 8 ,
. height = 16 ,
. paletteNum = 15 ,
. baseBlock = 16 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 22 ,
. tilemapTop = 3 ,
. width = 8 ,
. height = 16 ,
. paletteNum = 15 ,
. baseBlock = 144 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 8 ,
. tilemapTop = 1 ,
. width = 14 ,
. height = 2 ,
. paletteNum = 15 ,
. baseBlock = 272 ,
} ,
DUMMY_WIN_TEMPLATE ,
} ;
2019-12-18 08:32:52 +01:00
static const struct WindowTemplate sOpponentInfoWindowTemplates [ ] =
2018-08-26 14:40:36 +02:00
{
{
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 2 ,
. tilemapTop = 2 ,
. width = 26 ,
. height = 2 ,
. paletteNum = 15 ,
. baseBlock = 1 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 16 ,
. tilemapTop = 5 ,
. width = 8 ,
. height = 2 ,
. paletteNum = 15 ,
. baseBlock = 53 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 19 ,
. tilemapTop = 7 ,
. width = 9 ,
. height = 3 ,
. paletteNum = 15 ,
. baseBlock = 69 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 16 ,
. tilemapTop = 10 ,
. width = 8 ,
. height = 2 ,
. paletteNum = 15 ,
. baseBlock = 96 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 2 ,
. tilemapTop = 12 ,
. width = 26 ,
. height = 7 ,
. paletteNum = 15 ,
. baseBlock = 112 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 5 ,
. tilemapTop = 2 ,
. width = 23 ,
. height = 2 ,
. paletteNum = 15 ,
. baseBlock = 294 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 2 ,
. tilemapTop = 5 ,
. width = 8 ,
. height = 2 ,
. paletteNum = 15 ,
. baseBlock = 340 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 20 ,
. tilemapTop = 5 ,
. width = 8 ,
. height = 2 ,
. paletteNum = 15 ,
. baseBlock = 356 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 2 ,
. tilemapTop = 16 ,
. width = 26 ,
. height = 2 ,
. paletteNum = 15 ,
. baseBlock = 372 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 1 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 2 ,
. tilemapTop = 2 ,
. width = 26 ,
. height = 2 ,
. paletteNum = 15 ,
. baseBlock = 1 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 1 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 16 ,
. tilemapTop = 5 ,
. width = 8 ,
. height = 2 ,
. paletteNum = 15 ,
. baseBlock = 53 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 1 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 19 ,
. tilemapTop = 7 ,
. width = 9 ,
. height = 3 ,
. paletteNum = 15 ,
. baseBlock = 69 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 1 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 16 ,
. tilemapTop = 10 ,
. width = 8 ,
. height = 2 ,
. paletteNum = 15 ,
. baseBlock = 96 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 1 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 2 ,
. tilemapTop = 12 ,
. width = 26 ,
. height = 7 ,
. paletteNum = 15 ,
. baseBlock = 112 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 1 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 5 ,
. tilemapTop = 2 ,
. width = 23 ,
. height = 2 ,
. paletteNum = 15 ,
. baseBlock = 294 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 1 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 2 ,
. tilemapTop = 5 ,
. width = 8 ,
. height = 2 ,
. paletteNum = 15 ,
. baseBlock = 340 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 1 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 20 ,
. tilemapTop = 5 ,
. width = 8 ,
. height = 2 ,
. paletteNum = 15 ,
. baseBlock = 356 ,
} ,
{
2018-10-27 00:53:07 +02:00
. bg = 1 ,
2018-08-26 14:40:36 +02:00
. tilemapLeft = 2 ,
. tilemapTop = 16 ,
. width = 26 ,
. height = 2 ,
. paletteNum = 15 ,
. baseBlock = 372 ,
} ,
2018-08-26 15:51:14 +02:00
// UB: No DUMMY_WIN_TEMPLATE at the array's end.
2018-08-26 14:40:36 +02:00
} ;
2019-02-08 18:08:25 +01:00
static const struct ScanlineEffectParams sTourneyTreeScanlineEffectParams =
2018-08-26 14:40:36 +02:00
{
. dmaDest = ( void * ) REG_ADDR_BG3CNT ,
2019-02-08 18:08:25 +01:00
. dmaControl = SCANLINE_EFFECT_DMACNT_16BIT ,
2018-08-26 14:40:36 +02:00
. initState = 1 ,
} ;
2019-02-08 18:08:25 +01:00
static const struct CompressedSpriteSheet sDomeOptionsSpriteSheet [ ] =
2018-08-26 14:40:36 +02:00
{
2018-08-26 15:51:14 +02:00
{ gBattleFrontierGfx_DomeOptions , 0x0600 , 0x0000 } ,
{ } ,
2018-08-26 14:40:36 +02:00
} ;
static const struct CompressedSpritePalette gUnknown_0860CF60 [ ] =
{
2018-08-26 15:51:14 +02:00
{ gUnknown_08D85444 , 0x0000 } ,
{ } ,
2018-08-26 14:40:36 +02:00
} ;
static const struct OamData gUnknown_0860CF70 =
{
. y = 0 ,
2019-12-04 21:25:13 +01:00
. affineMode = ST_OAM_AFFINE_OFF ,
. objMode = ST_OAM_OBJ_NORMAL ,
2018-08-26 14:40:36 +02:00
. mosaic = 0 ,
2019-12-04 21:25:13 +01:00
. bpp = ST_OAM_4BPP ,
2019-03-11 08:12:15 +01:00
. shape = SPRITE_SHAPE ( 16 x16 ) ,
2018-08-26 14:40:36 +02:00
. x = 0 ,
. matrixNum = 0 ,
2019-03-11 08:12:15 +01:00
. size = SPRITE_SIZE ( 16 x16 ) ,
2018-08-26 14:40:36 +02:00
. tileNum = 0 ,
. priority = 0 ,
. paletteNum = 0 ,
. affineParam = 0 ,
} ;
2018-08-26 15:51:14 +02:00
static const struct OamData gUnknown_0860CF78 =
2018-08-26 14:40:36 +02:00
{
. y = 0 ,
2019-12-04 21:25:13 +01:00
. affineMode = ST_OAM_AFFINE_OFF ,
. objMode = ST_OAM_OBJ_NORMAL ,
2018-08-26 14:40:36 +02:00
. mosaic = 0 ,
2019-12-04 21:25:13 +01:00
. bpp = ST_OAM_4BPP ,
2019-03-11 08:12:15 +01:00
. shape = SPRITE_SHAPE ( 32 x16 ) ,
2018-08-26 14:40:36 +02:00
. x = 0 ,
. matrixNum = 0 ,
2019-03-11 08:12:15 +01:00
. size = SPRITE_SIZE ( 32 x16 ) ,
2018-08-26 14:40:36 +02:00
. tileNum = 0 ,
. priority = 0 ,
. paletteNum = 1 ,
. affineParam = 0 ,
} ;
static const struct OamData gUnknown_0860CF80 =
{
. y = 0 ,
2019-12-04 21:25:13 +01:00
. affineMode = ST_OAM_AFFINE_OFF ,
. objMode = ST_OAM_OBJ_NORMAL ,
2018-08-26 14:40:36 +02:00
. mosaic = 0 ,
2019-12-04 21:25:13 +01:00
. bpp = ST_OAM_4BPP ,
2019-03-11 08:12:15 +01:00
. shape = SPRITE_SHAPE ( 16 x8 ) ,
2018-08-26 14:40:36 +02:00
. x = 0 ,
. matrixNum = 0 ,
2019-03-11 08:12:15 +01:00
. size = SPRITE_SIZE ( 16 x8 ) ,
2018-08-26 14:40:36 +02:00
. tileNum = 0 ,
. priority = 0 ,
. paletteNum = 2 ,
. affineParam = 0 ,
} ;
static const struct OamData gUnknown_0860CF88 =
{
. y = 0 ,
2019-12-04 21:25:13 +01:00
. affineMode = ST_OAM_AFFINE_OFF ,
. objMode = ST_OAM_OBJ_NORMAL ,
2018-08-26 14:40:36 +02:00
. mosaic = 0 ,
2019-12-04 21:25:13 +01:00
. bpp = ST_OAM_4BPP ,
2019-03-11 08:12:15 +01:00
. shape = SPRITE_SHAPE ( 8 x16 ) ,
2018-08-26 14:40:36 +02:00
. x = 0 ,
. matrixNum = 0 ,
2019-03-11 08:12:15 +01:00
. size = SPRITE_SIZE ( 8 x16 ) ,
2018-08-26 14:40:36 +02:00
. tileNum = 0 ,
. priority = 0 ,
. paletteNum = 2 ,
. affineParam = 0 ,
} ;
static const union AnimCmd gUnknown_0860CF90 [ ] =
{
ANIMCMD_FRAME ( 20 , 1 ) ,
ANIMCMD_END ,
} ;
static const union AnimCmd gUnknown_0860CF98 [ ] =
{
ANIMCMD_FRAME ( 24 , 1 ) ,
ANIMCMD_END ,
} ;
static const union AnimCmd * const gUnknown_0860CFA0 [ ] =
{
gUnknown_0860CF90 ,
gUnknown_0860CF98 ,
} ;
2018-08-26 16:45:08 +02:00
static const struct SpriteTemplate gUnknown_0860CFA8 =
{
. tileTag = 0x0000 ,
. paletteTag = 0xffff ,
. oam = & gUnknown_0860CF70 ,
. anims = gUnknown_0860CFA0 ,
. images = NULL ,
. affineAnims = gDummySpriteAffineAnimTable ,
. callback = SpriteCallbackDummy
} ;
2018-08-26 14:40:36 +02:00
static const union AnimCmd gUnknown_0860CFC0 [ ] =
{
2018-08-26 15:51:14 +02:00
ANIMCMD_FRAME ( 8 , 1 ) ,
2018-08-26 14:40:36 +02:00
ANIMCMD_END ,
} ;
static const union AnimCmd gUnknown_0860CFC8 [ ] =
{
ANIMCMD_FRAME ( 0 , 1 ) ,
ANIMCMD_END ,
} ;
static const union AnimCmd * const gUnknown_0860CFD0 [ ] =
{
gUnknown_0860CFC0 ,
gUnknown_0860CFC8 ,
} ;
2018-08-26 16:45:08 +02:00
static const struct SpriteTemplate gUnknown_0860CFD8 =
{
. tileTag = 0x0000 ,
. paletteTag = 0xffff ,
. oam = & gUnknown_0860CF78 ,
. anims = gUnknown_0860CFD0 ,
. images = NULL ,
. affineAnims = gDummySpriteAffineAnimTable ,
. callback = SpriteCallbackDummy
} ;
2018-08-26 14:40:36 +02:00
static const union AnimCmd gUnknown_0860CFF0 [ ] =
{
ANIMCMD_FRAME ( 40 , 1 ) ,
ANIMCMD_END ,
} ;
static const union AnimCmd gUnknown_0860CFF8 [ ] =
{
ANIMCMD_FRAME ( 32 , 1 ) ,
ANIMCMD_END ,
} ;
static const union AnimCmd * const gUnknown_0860D000 [ ] =
{
gUnknown_0860CFF0 ,
gUnknown_0860CFF8 ,
} ;
2018-08-26 16:45:08 +02:00
static const struct SpriteTemplate gUnknown_0860D008 =
{
. tileTag = 0x0000 ,
. paletteTag = 0xffff ,
. oam = & gUnknown_0860CF78 ,
. anims = gUnknown_0860D000 ,
. images = NULL ,
. affineAnims = gDummySpriteAffineAnimTable ,
. callback = SpriteCallbackDummy
} ;
2018-08-26 14:40:36 +02:00
static const union AnimCmd gUnknown_0860D020 [ ] =
{
ANIMCMD_FRAME ( 18 , 1 ) ,
ANIMCMD_END ,
} ;
static const union AnimCmd gUnknown_0860D028 [ ] =
{
2019-06-26 14:13:38 +02:00
ANIMCMD_FRAME ( 18 , 1 , . vFlip = TRUE ) ,
2018-08-26 14:40:36 +02:00
ANIMCMD_END ,
} ;
2018-08-26 15:51:14 +02:00
2018-08-26 14:40:36 +02:00
static const union AnimCmd gUnknown_0860D030 [ ] =
{
2019-06-26 14:13:38 +02:00
ANIMCMD_FRAME ( 16 , 1 , . hFlip = TRUE ) ,
2018-08-26 14:40:36 +02:00
ANIMCMD_END ,
} ;
static const union AnimCmd gUnknown_0860D038 [ ] =
{
ANIMCMD_FRAME ( 16 , 1 ) ,
ANIMCMD_END ,
} ;
static const union AnimCmd * const gUnknown_0860D040 [ ] =
{
gUnknown_0860D020 ,
gUnknown_0860D028 ,
} ;
static const union AnimCmd * const gUnknown_0860D048 [ ] =
{
gUnknown_0860D030 ,
gUnknown_0860D038 ,
} ;
2018-08-26 16:45:08 +02:00
static const struct SpriteTemplate gUnknown_0860D050 =
{
. tileTag = 0x0000 ,
. paletteTag = 0xffff ,
. oam = & gUnknown_0860CF88 ,
. anims = gUnknown_0860D048 ,
. images = NULL ,
. affineAnims = gDummySpriteAffineAnimTable ,
. callback = sub_8190B40
} ;
static const struct SpriteTemplate gUnknown_0860D068 =
{
. tileTag = 0x0000 ,
. paletteTag = 0xffff ,
. oam = & gUnknown_0860CF80 ,
. anims = gUnknown_0860D040 ,
. images = NULL ,
. affineAnims = gDummySpriteAffineAnimTable ,
. callback = sub_8190C6C
} ;
2018-08-26 14:40:36 +02:00
2019-12-21 10:27:12 +01:00
// Organized by seed starting position, i.e. seed 0 battles seed 8 first
static const u8 sTourneyTreeTrainerIds [ DOME_TOURNAMENT_TRAINERS_COUNT ] =
{
0 , 8 ,
12 , 4 ,
7 , 15 ,
11 , 3 ,
2 , 10 ,
14 , 6 ,
5 , 13 ,
9 , 1 } ;
2018-08-26 14:40:36 +02:00
2019-02-08 18:08:25 +01:00
static void ( * const sBattleDomeFunctions [ ] ) ( void ) =
2018-08-26 14:40:36 +02:00
{
2019-11-29 03:09:35 +01:00
[ BATTLE_DOME_FUNC_INIT ] = InitDomeChallenge ,
[ BATTLE_DOME_FUNC_GET_DATA ] = GetDomeData ,
[ BATTLE_DOME_FUNC_SET_DATA ] = SetDomeData ,
[ BATTLE_DOME_FUNC_GET_ROUND_TEXT ] = BufferDomeRoundText ,
[ BATTLE_DOME_FUNC_GET_OPPONENT_NAME ] = BufferDomeOpponentName ,
[ BATTLE_DOME_FUNC_INIT_OPPONENT_PARTY ] = InitDomeOpponentParty ,
[ BATTLE_DOME_FUNC_SHOW_OPPONENT_INFO ] = ShowDomeOpponentInfo ,
[ BATTLE_DOME_FUNC_SHOW_TOURNEY_TREE ] = ShowDomeTourneyTree ,
[ BATTLE_DOME_FUNC_SHOW_PREV_RESULTS_TREE ] = ShowPreviousDomeResultsTourneyTree ,
[ BATTLE_DOME_FUNC_SET_OPPONENT_ID ] = SetDomeOpponentId ,
[ BATTLE_DOME_FUNC_SET_OPPONENT_GFX ] = SetDomeOpponentGraphicsId ,
[ BATTLE_DOME_FUNC_SHOW_STATIC_TOURNEY_TREE ] = ShowNonInteractiveDomeTourneyTree ,
[ BATTLE_DOME_FUNC_RESOLVE_WINNERS ] = ResolveDomeRoundWinners ,
[ BATTLE_DOME_FUNC_SAVE ] = SaveDomeChallenge ,
[ BATTLE_DOME_FUNC_INCREMENT_STREAK ] = IncrementDomeStreaks ,
2019-12-21 10:27:12 +01:00
[ BATTLE_DOME_FUNC_SET_TRAINERS ] = SetFacilityTrainerAndMonPtrs ,
2019-11-29 03:09:35 +01:00
[ BATTLE_DOME_FUNC_RESET_SKETCH ] = ResetSketchedMoves ,
[ BATTLE_DOME_FUNC_RESTORE_HELD_ITEMS ] = RestoreDomePlayerPartyHeldItems ,
2019-12-18 08:32:52 +01:00
[ BATTLE_DOME_FUNC_REDUCE_PARTY ] = ReduceDomePlayerPartyToSelectedMons ,
2019-11-29 03:09:35 +01:00
[ BATTLE_DOME_FUNC_COMPARE_SEEDS ] = GetPlayerSeededBeforeOpponent ,
[ BATTLE_DOME_FUNC_GET_WINNER_NAME ] = BufferLastDomeWinnerName ,
2019-12-18 08:32:52 +01:00
[ BATTLE_DOME_FUNC_INIT_RESULTS_TREE ] = InitRandomTourneyTreeResults ,
2019-11-29 03:09:35 +01:00
[ BATTLE_DOME_FUNC_INIT_TRAINERS ] = InitDomeTrainers ,
2018-08-26 14:40:36 +02:00
} ;
2019-11-24 22:58:40 +01:00
static const u32 sWinStreakFlags [ ] [ 2 ] =
2018-08-26 14:40:36 +02:00
{
2019-11-24 22:58:40 +01:00
{ STREAK_DOME_SINGLES_50 , STREAK_DOME_SINGLES_OPEN } ,
{ STREAK_DOME_DOUBLES_50 , STREAK_DOME_DOUBLES_OPEN } ,
2018-08-26 14:40:36 +02:00
} ;
2019-11-24 22:58:40 +01:00
static const u32 sWinStreakMasks [ ] [ 2 ] =
2018-08-26 14:40:36 +02:00
{
2019-11-24 22:58:40 +01:00
{ ~ ( STREAK_DOME_SINGLES_50 ) , ~ ( STREAK_DOME_SINGLES_OPEN ) } ,
{ ~ ( STREAK_DOME_DOUBLES_50 ) , ~ ( STREAK_DOME_DOUBLES_OPEN ) } ,
2018-08-26 14:40:36 +02:00
} ;
2018-08-26 21:41:47 +02:00
static const u8 sIdToOpponentId [ DOME_TOURNAMENT_TRAINERS_COUNT ] [ DOME_ROUNDS_COUNT ] =
{
[ 0 ] = { 8 , 0 , 4 , 8 } ,
[ 1 ] = { 9 , 12 , 8 , 0 } ,
[ 2 ] = { 10 , 8 , 12 , 0 } ,
[ 3 ] = { 11 , 4 , 0 , 8 } ,
[ 4 ] = { 12 , 0 , 4 , 8 } ,
[ 5 ] = { 13 , 12 , 8 , 0 } ,
[ 6 ] = { 14 , 8 , 12 , 0 } ,
[ 7 ] = { 15 , 4 , 0 , 8 } ,
[ 8 ] = { 0 , 0 , 4 , 8 } ,
[ 9 ] = { 1 , 12 , 8 , 0 } ,
[ 10 ] = { 2 , 8 , 12 , 0 } ,
[ 11 ] = { 3 , 4 , 0 , 8 } ,
[ 12 ] = { 4 , 0 , 4 , 8 } ,
[ 13 ] = { 5 , 12 , 8 , 0 } ,
[ 14 ] = { 6 , 8 , 12 , 0 } ,
[ 15 ] = { 7 , 4 , 0 , 8 } ,
2018-08-26 14:40:36 +02:00
} ;
2019-12-21 10:27:12 +01:00
static const u8 gUnknown_0860D14C [ DOME_TOURNAMENT_TRAINERS_COUNT ] =
{
0 ,
8 ,
4 ,
12 ,
7 ,
15 ,
3 ,
11 ,
2 ,
10 ,
6 ,
14 ,
5 ,
13 ,
1 ,
9 } ;
2018-08-26 14:40:36 +02:00
2018-08-26 15:51:14 +02:00
static const u8 gUnknown_0860D15C [ ] [ 4 ] =
{
{ 0x00 , 0x08 , 0x0c , 0x0e } ,
{ 0x00 , 0x08 , 0x0c , 0x0e } ,
{ 0x01 , 0x08 , 0x0c , 0x0e } ,
{ 0x01 , 0x08 , 0x0c , 0x0e } ,
{ 0x02 , 0x09 , 0x0c , 0x0e } ,
{ 0x02 , 0x09 , 0x0c , 0x0e } ,
{ 0x03 , 0x09 , 0x0c , 0x0e } ,
{ 0x03 , 0x09 , 0x0c , 0x0e } ,
{ 0x04 , 0x0a , 0x0d , 0x0e } ,
{ 0x04 , 0x0a , 0x0d , 0x0e } ,
{ 0x05 , 0x0a , 0x0d , 0x0e } ,
{ 0x05 , 0x0a , 0x0d , 0x0e } ,
{ 0x06 , 0x0b , 0x0d , 0x0e } ,
{ 0x06 , 0x0b , 0x0d , 0x0e } ,
{ 0x07 , 0x0b , 0x0d , 0x0e } ,
{ 0x07 , 0x0b , 0x0d , 0x0e } ,
2018-08-26 14:40:36 +02:00
} ;
2019-12-18 08:32:52 +01:00
static const u8 gUnknown_0860D19C [ DOME_ROUNDS_COUNT ] =
{
[ DOME_ROUND1 ] = 23 ,
[ DOME_ROUND2 ] = 27 ,
[ DOME_SEMIFINAL ] = 29 ,
[ DOME_FINAL ] = 30
} ;
2018-08-26 14:40:36 +02:00
2019-12-21 10:27:12 +01:00
static const u8 gUnknown_0860D1A0 [ ] [ DOME_ROUNDS_COUNT ] =
2018-08-26 14:40:36 +02:00
{
2019-12-21 10:27:12 +01:00
{ 16 , 24 , 28 , 30 } ,
{ 17 , 24 , 28 , 30 } ,
{ 18 , 25 , 28 , 30 } ,
{ 19 , 25 , 28 , 30 } ,
{ 20 , 26 , 29 , 30 } ,
{ 21 , 26 , 29 , 30 } ,
{ 22 , 27 , 29 , 30 } ,
{ 23 , 27 , 29 , 30 } ,
2018-08-26 14:40:36 +02:00
} ;
2019-12-21 10:27:12 +01:00
static const u8 gUnknown_0860D1C0 [ DOME_TOURNAMENT_TRAINERS_COUNT ] = { 0 , 15 , 8 , 7 , 3 , 12 , 11 , 4 , 1 , 14 , 9 , 6 , 2 , 13 , 10 , 5 } ;
// Each tourney trainer has a text describing their potential, depending on their seed ranking for the current tourney
// Dome Ace Tucker has their own separate potential text
static const u8 * const sBattleDomePotentialTexts [ DOME_TOURNAMENT_TRAINERS_COUNT + 1 ] =
{
BattleDome_Text_Potential1 , // Highest potential
BattleDome_Text_Potential2 ,
BattleDome_Text_Potential3 ,
BattleDome_Text_Potential4 ,
BattleDome_Text_Potential5 ,
BattleDome_Text_Potential6 ,
BattleDome_Text_Potential7 ,
BattleDome_Text_Potential8 ,
BattleDome_Text_Potential9 ,
BattleDome_Text_Potential10 ,
BattleDome_Text_Potential11 ,
BattleDome_Text_Potential12 ,
BattleDome_Text_Potential13 ,
BattleDome_Text_Potential14 ,
BattleDome_Text_Potential15 ,
BattleDome_Text_Potential16 , // Lowest potential
BattleDome_Text_PotentialDomeAceTucker ,
2018-08-26 14:40:36 +02:00
} ;
2019-12-21 10:27:12 +01:00
static const u8 * const sBattleDomeOpponentStyleTexts [ NUM_BATTLE_STYLES ] =
{
[ DOME_BATTLE_STYLE_RISKY ] = BattleDome_Text_StyleRiskDisaster ,
[ DOME_BATTLE_STYLE_STALL ] = BattleDome_Text_StyleEndureLongBattles ,
[ DOME_BATTLE_STYLE_VARIED ] = BattleDome_Text_StyleVariesTactics ,
[ DOME_BATTLE_STYLE_COMBO_HIGH ] = BattleDome_Text_StyleToughWinningPattern ,
[ DOME_BATTLE_STYLE_RARE_MOVES ] = BattleDome_Text_StyleUsesVeryRareMove , // Seems like the text for these two was swapped
[ DOME_BATTLE_STYLE_RARE_MOVE ] = BattleDome_Text_StyleUsesStartlingMoves , //
[ DOME_BATTLE_STYLE_HP ] = BattleDome_Text_StyleConstantlyWatchesHP ,
[ DOME_BATTLE_STYLE_STORE_POWER ] = BattleDome_Text_StyleStoresAndLoosesPower ,
[ DOME_BATTLE_STYLE_ENFEEBLE_LOW ] = BattleDome_Text_StyleEnfeeblesFoes ,
[ DOME_BATTLE_STYLE_LUCK ] = BattleDome_Text_StylePrefersLuckTactics ,
[ DOME_BATTLE_STYLE_10 ] = BattleDome_Text_StyleRegalAtmosphere ,
[ DOME_BATTLE_STYLE_LOW_PP ] = BattleDome_Text_StylePowerfulLowPPMoves ,
[ DOME_BATTLE_STYLE_STATUS_ATK ] = BattleDome_Text_StyleEnfeebleThenAttack ,
[ DOME_BATTLE_STYLE_ENDURE ] = BattleDome_Text_StyleBattlesWhileEnduring ,
[ DOME_BATTLE_STYLE_STATUS ] = BattleDome_Text_StyleUpsetsFoesEmotionally ,
[ DOME_BATTLE_STYLE_STRAIGHTFORWARD ] = BattleDome_Text_StyleStrongAndStraightforward ,
[ DOME_BATTLE_STYLE_AGGRESSIVE ] = BattleDome_Text_StyleAggressivelyStrongMoves ,
[ DOME_BATTLE_STYLE_DEF ] = BattleDome_Text_StyleCleverlyDodgesAttacks ,
[ DOME_BATTLE_STYLE_ENFEEBLE_HIGH ] = BattleDome_Text_StyleUsesUpsettingMoves ,
[ DOME_BATTLE_STYLE_POPULAR_POWER ] = BattleDome_Text_StyleUsesPopularMoves ,
[ DOME_BATTLE_STYLE_COMBO_LOW ] = BattleDome_Text_StyleHasPowerfulComboMoves ,
[ DOME_BATTLE_STYLE_ACCURATE ] = BattleDome_Text_StyleUsesHighProbabilityMoves ,
[ DOME_BATTLE_STYLE_POWERFUL ] = BattleDome_Text_StyleAggressivelySpectacularMoves ,
[ DOME_BATTLE_STYLE_ATK_OVER_DEF ] = BattleDome_Text_StyleEmphasizesOffenseOverDefense ,
[ DOME_BATTLE_STYLE_DEF_OVER_ATK ] = BattleDome_Text_StyleEmphasizesDefenseOverOffense ,
[ DOME_BATTLE_STYLE_POPULAR_STRONG ] = BattleDome_Text_StyleAttacksQuicklyStrongMoves ,
[ DOME_BATTLE_STYLE_EFFECTS ] = BattleDome_Text_StyleUsesAddedEffectMoves ,
[ DOME_BATTLE_STYLE_BALANCED ] = BattleDome_Text_StyleUsesBalancedMixOfMoves ,
[ DOME_BATTLE_STYLE_UNUSED1 ] = BattleDome_Text_StyleSampleMessage1 ,
[ DOME_BATTLE_STYLE_UNUSED2 ] = BattleDome_Text_StyleSampleMessage2 ,
[ DOME_BATTLE_STYLE_UNUSED3 ] = BattleDome_Text_StyleSampleMessage3 ,
[ DOME_BATTLE_STYLE_UNUSED4 ] = BattleDome_Text_StyleSampleMessage4 ,
2018-08-26 14:40:36 +02:00
} ;
2019-02-08 18:08:25 +01:00
static const u8 * const sBattleDomeOpponentStatsTexts [ ] =
{
2019-12-21 10:27:12 +01:00
BattleDome_Text_EmphasizesHPAndAtk ,
BattleDome_Text_EmphasizesHPAndDef ,
BattleDome_Text_EmphasizesHPAndSpeed ,
BattleDome_Text_EmphasizesHPAndSpAtk ,
BattleDome_Text_EmphasizesHPAndSpDef ,
2019-02-08 18:08:25 +01:00
gBattleDomeOpponentStatsText6 ,
gBattleDomeOpponentStatsText7 ,
gBattleDomeOpponentStatsText8 ,
gBattleDomeOpponentStatsText9 ,
gBattleDomeOpponentStatsText10 ,
gBattleDomeOpponentStatsText11 ,
gBattleDomeOpponentStatsText12 ,
gBattleDomeOpponentStatsText13 ,
gBattleDomeOpponentStatsText14 ,
gBattleDomeOpponentStatsText15 ,
2019-12-21 10:27:12 +01:00
BattleDome_Text_EmphasizesHP ,
2019-02-08 18:08:25 +01:00
gBattleDomeOpponentStatsText17 ,
gBattleDomeOpponentStatsText18 ,
gBattleDomeOpponentStatsText19 ,
gBattleDomeOpponentStatsText20 ,
gBattleDomeOpponentStatsText21 ,
2019-12-21 10:27:12 +01:00
BattleDome_Text_NeglectsHPAndAtk ,
2019-02-08 18:08:25 +01:00
gBattleDomeOpponentStatsText23 ,
gBattleDomeOpponentStatsText24 ,
gBattleDomeOpponentStatsText25 ,
gBattleDomeOpponentStatsText26 ,
gBattleDomeOpponentStatsText27 ,
gBattleDomeOpponentStatsText28 ,
gBattleDomeOpponentStatsText29 ,
gBattleDomeOpponentStatsText30 ,
gBattleDomeOpponentStatsText31 ,
gBattleDomeOpponentStatsText32 ,
gBattleDomeOpponentStatsText33 ,
gBattleDomeOpponentStatsText34 ,
gBattleDomeOpponentStatsText35 ,
gBattleDomeOpponentStatsText36 ,
2019-12-21 10:27:12 +01:00
BattleDome_Text_NeglectsHP ,
2019-02-08 18:08:25 +01:00
gBattleDomeOpponentStatsText38 ,
gBattleDomeOpponentStatsText39 ,
gBattleDomeOpponentStatsText40 ,
gBattleDomeOpponentStatsText41 ,
gBattleDomeOpponentStatsText42 ,
2019-12-21 10:27:12 +01:00
BattleDome_Text_RaisesMonsWellBalanced ,
2018-08-26 14:40:36 +02:00
} ;
2018-08-26 15:51:14 +02:00
static const u8 sInfoTrainerMonX [ ] = { 0x68 , 0x88 , 0x68 } ;
static const u8 sInfoTrainerMonY [ ] = { 0x26 , 0x3e , 0x4e } ;
2019-12-18 08:32:52 +01:00
static const u8 sSpeciesNameTextYCoords [ ] = { 0 , 4 , 0 } ;
2018-08-26 14:40:36 +02:00
static const u8 gUnknown_0860D349 [ ] = { 0x00 , 0x05 , 0x09 , 0x0c , 0x0e , 0x00 , 0x00 } ;
2019-12-21 10:27:12 +01:00
static const u8 * const sBattleDomeMatchNumberTexts [ DOME_TOURNAMENT_MATCHES_COUNT ] =
2019-02-08 18:08:25 +01:00
{
gBattleDomeMatchNumberText1 ,
gBattleDomeMatchNumberText2 ,
gBattleDomeMatchNumberText3 ,
gBattleDomeMatchNumberText4 ,
gBattleDomeMatchNumberText5 ,
gBattleDomeMatchNumberText6 ,
gBattleDomeMatchNumberText7 ,
gBattleDomeMatchNumberText8 ,
gBattleDomeMatchNumberText9 ,
gBattleDomeMatchNumberText10 ,
gBattleDomeMatchNumberText11 ,
gBattleDomeMatchNumberText12 ,
gBattleDomeMatchNumberText13 ,
gBattleDomeMatchNumberText14 ,
gBattleDomeMatchNumberText15 ,
2018-08-26 14:40:36 +02:00
} ;
2019-02-08 18:08:25 +01:00
static const u8 * const sBattleDomeWinTexts [ ] =
2018-08-26 14:40:36 +02:00
{
2019-02-08 18:08:25 +01:00
gBattleDomeWinText1 ,
gBattleDomeWinText2 ,
gBattleDomeWinText3 ,
gBattleDomeWinText4 ,
gBattleDomeWinText5 ,
gBattleDomeWinText6 ,
gBattleDomeWinText7 ,
2018-08-26 14:40:36 +02:00
} ;
2018-08-26 15:51:14 +02:00
static const u8 sFirstTrainerMonX [ ] = { 0x60 , 0x60 , 0x60 } ;
static const u8 sFirstTrainerMonY [ ] = { 0x38 , 0x50 , 0x68 } ;
static const u8 sSecondTrainerMonX [ ] = { 0x90 , 0x90 , 0x90 } ;
static const u8 sSecondTrainerMonY [ ] = { 0x38 , 0x50 , 0x68 } ;
2018-08-26 14:40:36 +02:00
2019-12-21 10:27:12 +01:00
static const u8 gUnknown_0860D3B4 [ DOME_TOURNAMENT_TRAINERS_COUNT ] = { 0 , 8 , 12 , 4 , 7 , 15 , 11 , 3 , 2 , 10 , 14 , 6 , 5 , 13 , 9 , 1 } ;
2019-12-18 08:32:52 +01:00
static const u8 gUnknown_0860D3C4 [ DOME_TOURNAMENT_MATCHES_COUNT ] [ 3 ] =
{
{ 0 , 2 , DOME_ROUND1 } ,
{ 2 , 2 , DOME_ROUND1 } ,
{ 4 , 2 , DOME_ROUND1 } ,
{ 6 , 2 , DOME_ROUND1 } ,
{ 8 , 2 , DOME_ROUND1 } ,
{ 10 , 2 , DOME_ROUND1 } ,
{ 12 , 2 , DOME_ROUND1 } ,
{ 14 , 2 , DOME_ROUND1 } ,
{ 0 , 4 , DOME_ROUND2 } ,
{ 4 , 4 , DOME_ROUND2 } ,
{ 8 , 4 , DOME_ROUND2 } ,
{ 12 , 4 , DOME_ROUND2 } ,
{ 0 , 8 , DOME_SEMIFINAL } ,
{ 8 , 8 , DOME_SEMIFINAL } ,
{ 0 , 16 , DOME_FINAL } ,
2018-08-26 14:40:36 +02:00
} ;
2019-12-18 08:32:52 +01:00
static const u8 gUnknown_0860D3F1 [ DOME_TOURNAMENT_TRAINERS_COUNT ] [ 2 ] =
2018-08-26 14:40:36 +02:00
{
{ 0x00 , 0x00 } ,
{ 0x01 , 0x70 } ,
{ 0x01 , 0x00 } ,
{ 0x00 , 0x70 } ,
{ 0x00 , 0x30 } ,
{ 0x01 , 0x40 } ,
{ 0x01 , 0x30 } ,
{ 0x00 , 0x40 } ,
{ 0x00 , 0x10 } ,
{ 0x01 , 0x60 } ,
{ 0x01 , 0x10 } ,
{ 0x00 , 0x60 } ,
{ 0x00 , 0x20 } ,
{ 0x01 , 0x50 } ,
{ 0x01 , 0x20 } ,
{ 0x00 , 0x50 } ,
} ;
static const u8 gUnknown_0860D411 [ ] [ 2 ] =
{
{ 0x44 , 0x21 } ,
{ 0x44 , 0x31 } ,
{ 0x44 , 0x41 } ,
{ 0x44 , 0x51 } ,
{ 0x44 , 0x61 } ,
{ 0x44 , 0x71 } ,
{ 0x44 , 0x81 } ,
{ 0x44 , 0x91 } ,
{ 0xac , 0x21 } ,
{ 0xac , 0x31 } ,
{ 0xac , 0x41 } ,
{ 0xac , 0x51 } ,
{ 0xac , 0x61 } ,
{ 0xac , 0x71 } ,
{ 0xac , 0x81 } ,
{ 0xac , 0x91 } ,
{ 0x57 , 0x29 } ,
{ 0x57 , 0x49 } ,
{ 0x57 , 0x69 } ,
{ 0x57 , 0x89 } ,
{ 0x99 , 0x29 } ,
{ 0x99 , 0x49 } ,
{ 0x99 , 0x69 } ,
{ 0x99 , 0x89 } ,
{ 0x5f , 0x39 } ,
{ 0x5f , 0x79 } ,
{ 0x91 , 0x39 } ,
{ 0x91 , 0x79 } ,
{ 0x67 , 0x59 } ,
{ 0x89 , 0x59 } ,
{ 0x78 , 0x59 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d450 [ ] =
{
{ . src = 0x6021 , . y = 0x04 , . x = 0x09 } ,
{ . src = 0x6023 , . y = 0x04 , . x = 0x0a } ,
{ . src = 0x6047 , . y = 0x05 , . x = 0x0a } ,
{ . src = 0x6043 , . y = 0x05 , . x = 0x0b } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d460 [ ] =
{
{ . src = 0x6021 , . y = 0x04 , . x = 0x09 } ,
{ . src = 0x6023 , . y = 0x04 , . x = 0x0a } ,
{ . src = 0x6047 , . y = 0x05 , . x = 0x0a } ,
{ . src = 0x6023 , . y = 0x05 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x06 , . x = 0x0b } ,
{ . src = 0x6047 , . y = 0x07 , . x = 0x0b } ,
{ . src = 0x6043 , . y = 0x07 , . x = 0x0c } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d47c [ ] =
{
{ . src = 0x6021 , . y = 0x04 , . x = 0x09 } ,
{ . src = 0x6023 , . y = 0x04 , . x = 0x0a } ,
{ . src = 0x6047 , . y = 0x05 , . x = 0x0a } ,
{ . src = 0x6023 , . y = 0x05 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x06 , . x = 0x0b } ,
{ . src = 0x6047 , . y = 0x07 , . x = 0x0b } ,
{ . src = 0x6023 , . y = 0x07 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x08 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x09 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x0a , . x = 0x0c } ,
{ . src = 0x603b , . y = 0x0b , . x = 0x0c } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d4a8 [ ] =
{
{ . src = 0x6021 , . y = 0x04 , . x = 0x09 } ,
{ . src = 0x6023 , . y = 0x04 , . x = 0x0a } ,
{ . src = 0x6047 , . y = 0x05 , . x = 0x0a } ,
{ . src = 0x6023 , . y = 0x05 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x06 , . x = 0x0b } ,
{ . src = 0x6047 , . y = 0x07 , . x = 0x0b } ,
{ . src = 0x6023 , . y = 0x07 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x08 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x09 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x0a , . x = 0x0c } ,
{ . src = 0x603b , . y = 0x0b , . x = 0x0c } ,
{ . src = 0x602c , . y = 0x0b , . x = 0x0d } ,
{ . src = 0x602d , . y = 0x0b , . x = 0x0e } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d4dc [ ] =
{
{ . src = 0x6021 , . y = 0x06 , . x = 0x09 } ,
{ . src = 0x6021 , . y = 0x06 , . x = 0x0a } ,
{ . src = 0x6027 , . y = 0x05 , . x = 0x0a } ,
{ . src = 0x6043 , . y = 0x05 , . x = 0x0b } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d4ec [ ] =
{
{ . src = 0x6021 , . y = 0x06 , . x = 0x09 } ,
{ . src = 0x6021 , . y = 0x06 , . x = 0x0a } ,
{ . src = 0x6027 , . y = 0x05 , . x = 0x0a } ,
{ . src = 0x6023 , . y = 0x05 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x06 , . x = 0x0b } ,
{ . src = 0x6047 , . y = 0x07 , . x = 0x0b } ,
{ . src = 0x6043 , . y = 0x07 , . x = 0x0c } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d508 [ ] =
{
{ . src = 0x6021 , . y = 0x06 , . x = 0x09 } ,
{ . src = 0x6021 , . y = 0x06 , . x = 0x0a } ,
{ . src = 0x6027 , . y = 0x05 , . x = 0x0a } ,
{ . src = 0x6023 , . y = 0x05 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x06 , . x = 0x0b } ,
{ . src = 0x6047 , . y = 0x07 , . x = 0x0b } ,
{ . src = 0x6023 , . y = 0x07 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x08 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x09 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x0a , . x = 0x0c } ,
{ . src = 0x603b , . y = 0x0b , . x = 0x0c } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d534 [ ] =
{
{ . src = 0x6021 , . y = 0x06 , . x = 0x09 } ,
{ . src = 0x6021 , . y = 0x06 , . x = 0x0a } ,
{ . src = 0x6027 , . y = 0x05 , . x = 0x0a } ,
{ . src = 0x6023 , . y = 0x05 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x06 , . x = 0x0b } ,
{ . src = 0x6047 , . y = 0x07 , . x = 0x0b } ,
{ . src = 0x6023 , . y = 0x07 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x08 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x09 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x0a , . x = 0x0c } ,
{ . src = 0x603b , . y = 0x0b , . x = 0x0c } ,
{ . src = 0x602c , . y = 0x0b , . x = 0x0d } ,
{ . src = 0x602d , . y = 0x0b , . x = 0x0e } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d568 [ ] =
{
{ . src = 0x6021 , . y = 0x08 , . x = 0x09 } ,
{ . src = 0x6023 , . y = 0x08 , . x = 0x0a } ,
{ . src = 0x6047 , . y = 0x09 , . x = 0x0a } ,
{ . src = 0x6021 , . y = 0x09 , . x = 0x0b } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d578 [ ] =
{
{ . src = 0x6021 , . y = 0x08 , . x = 0x09 } ,
{ . src = 0x6023 , . y = 0x08 , . x = 0x0a } ,
{ . src = 0x6047 , . y = 0x09 , . x = 0x0a } ,
{ . src = 0x6021 , . y = 0x09 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x08 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x07 , . x = 0x0b } ,
{ . src = 0x6043 , . y = 0x07 , . x = 0x0c } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d594 [ ] =
{
{ . src = 0x6021 , . y = 0x08 , . x = 0x09 } ,
{ . src = 0x6023 , . y = 0x08 , . x = 0x0a } ,
{ . src = 0x6047 , . y = 0x09 , . x = 0x0a } ,
{ . src = 0x6021 , . y = 0x09 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x08 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x07 , . x = 0x0b } ,
{ . src = 0x6023 , . y = 0x07 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x08 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x09 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x0a , . x = 0x0c } ,
{ . src = 0x603b , . y = 0x0b , . x = 0x0c } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d5c0 [ ] =
{
{ . src = 0x6021 , . y = 0x08 , . x = 0x09 } ,
{ . src = 0x6023 , . y = 0x08 , . x = 0x0a } ,
{ . src = 0x6047 , . y = 0x09 , . x = 0x0a } ,
{ . src = 0x6021 , . y = 0x09 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x08 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x07 , . x = 0x0b } ,
{ . src = 0x6023 , . y = 0x07 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x08 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x09 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x0a , . x = 0x0c } ,
{ . src = 0x603b , . y = 0x0b , . x = 0x0c } ,
{ . src = 0x602c , . y = 0x0b , . x = 0x0d } ,
{ . src = 0x602d , . y = 0x0b , . x = 0x0e } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d5f4 [ ] =
{
{ . src = 0x6021 , . y = 0x0a , . x = 0x09 } ,
{ . src = 0x6021 , . y = 0x0a , . x = 0x0a } ,
{ . src = 0x6027 , . y = 0x09 , . x = 0x0a } ,
{ . src = 0x6021 , . y = 0x09 , . x = 0x0b } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d604 [ ] =
{
{ . src = 0x6021 , . y = 0x0a , . x = 0x09 } ,
{ . src = 0x6021 , . y = 0x0a , . x = 0x0a } ,
{ . src = 0x6027 , . y = 0x09 , . x = 0x0a } ,
{ . src = 0x6021 , . y = 0x09 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x08 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x07 , . x = 0x0b } ,
{ . src = 0x6043 , . y = 0x07 , . x = 0x0c } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d620 [ ] =
{
{ . src = 0x6021 , . y = 0x0a , . x = 0x09 } ,
{ . src = 0x6021 , . y = 0x0a , . x = 0x0a } ,
{ . src = 0x6027 , . y = 0x09 , . x = 0x0a } ,
{ . src = 0x6021 , . y = 0x09 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x08 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x07 , . x = 0x0b } ,
{ . src = 0x6023 , . y = 0x07 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x08 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x09 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x0a , . x = 0x0c } ,
{ . src = 0x603b , . y = 0x0b , . x = 0x0c } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d64c [ ] =
{
{ . src = 0x6021 , . y = 0x0a , . x = 0x09 } ,
{ . src = 0x6021 , . y = 0x0a , . x = 0x0a } ,
{ . src = 0x6027 , . y = 0x09 , . x = 0x0a } ,
{ . src = 0x6021 , . y = 0x09 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x08 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x07 , . x = 0x0b } ,
{ . src = 0x6023 , . y = 0x07 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x08 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x09 , . x = 0x0c } ,
{ . src = 0x6027 , . y = 0x0a , . x = 0x0c } ,
{ . src = 0x603b , . y = 0x0b , . x = 0x0c } ,
{ . src = 0x602c , . y = 0x0b , . x = 0x0d } ,
{ . src = 0x602d , . y = 0x0b , . x = 0x0e } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d680 [ ] =
{
{ . src = 0x6021 , . y = 0x0c , . x = 0x09 } ,
{ . src = 0x6023 , . y = 0x0c , . x = 0x0a } ,
{ . src = 0x6047 , . y = 0x0d , . x = 0x0a } ,
{ . src = 0x6043 , . y = 0x0d , . x = 0x0b } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d690 [ ] =
{
{ . src = 0x6021 , . y = 0x0c , . x = 0x09 } ,
{ . src = 0x6023 , . y = 0x0c , . x = 0x0a } ,
{ . src = 0x6047 , . y = 0x0d , . x = 0x0a } ,
{ . src = 0x6023 , . y = 0x0d , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x0e , . x = 0x0b } ,
{ . src = 0x6047 , . y = 0x0f , . x = 0x0b } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x0c } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d6ac [ ] =
{
{ . src = 0x6021 , . y = 0x0c , . x = 0x09 } ,
{ . src = 0x6023 , . y = 0x0c , . x = 0x0a } ,
{ . src = 0x6047 , . y = 0x0d , . x = 0x0a } ,
{ . src = 0x6023 , . y = 0x0d , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x0e , . x = 0x0b } ,
{ . src = 0x6047 , . y = 0x0f , . x = 0x0b } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x0c } ,
{ . src = 0x6033 , . y = 0x0e , . x = 0x0c } ,
{ . src = 0x6032 , . y = 0x0d , . x = 0x0c } ,
{ . src = 0x6031 , . y = 0x0c , . x = 0x0c } ,
{ . src = 0x6030 , . y = 0x0b , . x = 0x0c } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d6d8 [ ] =
{
{ . src = 0x6021 , . y = 0x0c , . x = 0x09 } ,
{ . src = 0x6023 , . y = 0x0c , . x = 0x0a } ,
{ . src = 0x6047 , . y = 0x0d , . x = 0x0a } ,
{ . src = 0x6023 , . y = 0x0d , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x0e , . x = 0x0b } ,
{ . src = 0x6047 , . y = 0x0f , . x = 0x0b } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x0c } ,
{ . src = 0x6033 , . y = 0x0e , . x = 0x0c } ,
{ . src = 0x6032 , . y = 0x0d , . x = 0x0c } ,
{ . src = 0x6031 , . y = 0x0c , . x = 0x0c } ,
{ . src = 0x6030 , . y = 0x0b , . x = 0x0c } ,
{ . src = 0x602c , . y = 0x0b , . x = 0x0d } ,
{ . src = 0x602d , . y = 0x0b , . x = 0x0e } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d70c [ ] =
{
{ . src = 0x6021 , . y = 0x0e , . x = 0x09 } ,
{ . src = 0x6021 , . y = 0x0e , . x = 0x0a } ,
{ . src = 0x6027 , . y = 0x0d , . x = 0x0a } ,
{ . src = 0x6043 , . y = 0x0d , . x = 0x0b } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d71c [ ] =
{
{ . src = 0x6021 , . y = 0x0e , . x = 0x09 } ,
{ . src = 0x6021 , . y = 0x0e , . x = 0x0a } ,
{ . src = 0x6027 , . y = 0x0d , . x = 0x0a } ,
{ . src = 0x6023 , . y = 0x0d , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x0e , . x = 0x0b } ,
{ . src = 0x6047 , . y = 0x0f , . x = 0x0b } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x0c } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d738 [ ] =
{
{ . src = 0x6021 , . y = 0x0e , . x = 0x09 } ,
{ . src = 0x6021 , . y = 0x0e , . x = 0x0a } ,
{ . src = 0x6027 , . y = 0x0d , . x = 0x0a } ,
{ . src = 0x6023 , . y = 0x0d , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x0e , . x = 0x0b } ,
{ . src = 0x6047 , . y = 0x0f , . x = 0x0b } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x0c } ,
{ . src = 0x6033 , . y = 0x0e , . x = 0x0c } ,
{ . src = 0x6032 , . y = 0x0d , . x = 0x0c } ,
{ . src = 0x6031 , . y = 0x0c , . x = 0x0c } ,
{ . src = 0x6030 , . y = 0x0b , . x = 0x0c } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d764 [ ] =
{
{ . src = 0x6021 , . y = 0x0e , . x = 0x09 } ,
{ . src = 0x6021 , . y = 0x0e , . x = 0x0a } ,
{ . src = 0x6027 , . y = 0x0d , . x = 0x0a } ,
{ . src = 0x6023 , . y = 0x0d , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x0e , . x = 0x0b } ,
{ . src = 0x6047 , . y = 0x0f , . x = 0x0b } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x0c } ,
{ . src = 0x6033 , . y = 0x0e , . x = 0x0c } ,
{ . src = 0x6032 , . y = 0x0d , . x = 0x0c } ,
{ . src = 0x6031 , . y = 0x0c , . x = 0x0c } ,
{ . src = 0x6030 , . y = 0x0b , . x = 0x0c } ,
{ . src = 0x602c , . y = 0x0b , . x = 0x0d } ,
{ . src = 0x602d , . y = 0x0b , . x = 0x0e } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d798 [ ] =
{
{ . src = 0x6021 , . y = 0x10 , . x = 0x09 } ,
{ . src = 0x6023 , . y = 0x10 , . x = 0x0a } ,
{ . src = 0x6047 , . y = 0x11 , . x = 0x0a } ,
{ . src = 0x6021 , . y = 0x11 , . x = 0x0b } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d7a8 [ ] =
{
{ . src = 0x6021 , . y = 0x10 , . x = 0x09 } ,
{ . src = 0x6023 , . y = 0x10 , . x = 0x0a } ,
{ . src = 0x6047 , . y = 0x11 , . x = 0x0a } ,
{ . src = 0x6021 , . y = 0x11 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x10 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x0f , . x = 0x0b } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x0c } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d7c4 [ ] =
{
{ . src = 0x6021 , . y = 0x10 , . x = 0x09 } ,
{ . src = 0x6023 , . y = 0x10 , . x = 0x0a } ,
{ . src = 0x6047 , . y = 0x11 , . x = 0x0a } ,
{ . src = 0x6021 , . y = 0x11 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x10 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x0f , . x = 0x0b } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x0c } ,
{ . src = 0x6033 , . y = 0x0e , . x = 0x0c } ,
{ . src = 0x6032 , . y = 0x0d , . x = 0x0c } ,
{ . src = 0x6031 , . y = 0x0c , . x = 0x0c } ,
{ . src = 0x6030 , . y = 0x0b , . x = 0x0c } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d7f0 [ ] =
{
{ . src = 0x6021 , . y = 0x10 , . x = 0x09 } ,
{ . src = 0x6023 , . y = 0x10 , . x = 0x0a } ,
{ . src = 0x6047 , . y = 0x11 , . x = 0x0a } ,
{ . src = 0x6021 , . y = 0x11 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x10 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x0f , . x = 0x0b } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x0c } ,
{ . src = 0x6033 , . y = 0x0e , . x = 0x0c } ,
{ . src = 0x6032 , . y = 0x0d , . x = 0x0c } ,
{ . src = 0x6031 , . y = 0x0c , . x = 0x0c } ,
{ . src = 0x6030 , . y = 0x0b , . x = 0x0c } ,
{ . src = 0x602c , . y = 0x0b , . x = 0x0d } ,
{ . src = 0x602d , . y = 0x0b , . x = 0x0e } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d824 [ ] =
{
{ . src = 0x602b , . y = 0x12 , . x = 0x09 } ,
{ . src = 0x602b , . y = 0x12 , . x = 0x0a } ,
{ . src = 0x6027 , . y = 0x11 , . x = 0x0a } ,
{ . src = 0x6021 , . y = 0x11 , . x = 0x0b } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d834 [ ] =
{
{ . src = 0x602b , . y = 0x12 , . x = 0x09 } ,
{ . src = 0x602b , . y = 0x12 , . x = 0x0a } ,
{ . src = 0x6027 , . y = 0x11 , . x = 0x0a } ,
{ . src = 0x6021 , . y = 0x11 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x10 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x0f , . x = 0x0b } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x0c } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d850 [ ] =
{
{ . src = 0x602b , . y = 0x12 , . x = 0x09 } ,
{ . src = 0x602b , . y = 0x12 , . x = 0x0a } ,
{ . src = 0x6027 , . y = 0x11 , . x = 0x0a } ,
{ . src = 0x6021 , . y = 0x11 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x10 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x0f , . x = 0x0b } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x0c } ,
{ . src = 0x6033 , . y = 0x0e , . x = 0x0c } ,
{ . src = 0x6032 , . y = 0x0d , . x = 0x0c } ,
{ . src = 0x6031 , . y = 0x0c , . x = 0x0c } ,
{ . src = 0x6030 , . y = 0x0b , . x = 0x0c } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d87c [ ] =
{
{ . src = 0x602b , . y = 0x12 , . x = 0x09 } ,
{ . src = 0x602b , . y = 0x12 , . x = 0x0a } ,
{ . src = 0x6027 , . y = 0x11 , . x = 0x0a } ,
{ . src = 0x6021 , . y = 0x11 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x10 , . x = 0x0b } ,
{ . src = 0x6027 , . y = 0x0f , . x = 0x0b } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x0c } ,
{ . src = 0x6033 , . y = 0x0e , . x = 0x0c } ,
{ . src = 0x6032 , . y = 0x0d , . x = 0x0c } ,
{ . src = 0x6031 , . y = 0x0c , . x = 0x0c } ,
{ . src = 0x6030 , . y = 0x0b , . x = 0x0c } ,
{ . src = 0x602c , . y = 0x0b , . x = 0x0d } ,
{ . src = 0x602d , . y = 0x0b , . x = 0x0e } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d8b0 [ ] =
{
{ . src = 0x6021 , . y = 0x04 , . x = 0x14 } ,
{ . src = 0x6025 , . y = 0x04 , . x = 0x13 } ,
{ . src = 0x6049 , . y = 0x05 , . x = 0x13 } ,
{ . src = 0x6045 , . y = 0x05 , . x = 0x12 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d8c0 [ ] =
{
{ . src = 0x6021 , . y = 0x04 , . x = 0x14 } ,
{ . src = 0x6025 , . y = 0x04 , . x = 0x13 } ,
{ . src = 0x6049 , . y = 0x05 , . x = 0x13 } ,
{ . src = 0x6025 , . y = 0x05 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x06 , . x = 0x12 } ,
{ . src = 0x6049 , . y = 0x07 , . x = 0x12 } ,
{ . src = 0x6045 , . y = 0x07 , . x = 0x11 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d8dc [ ] =
{
{ . src = 0x6021 , . y = 0x04 , . x = 0x14 } ,
{ . src = 0x6025 , . y = 0x04 , . x = 0x13 } ,
{ . src = 0x6049 , . y = 0x05 , . x = 0x13 } ,
{ . src = 0x6025 , . y = 0x05 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x06 , . x = 0x12 } ,
{ . src = 0x6049 , . y = 0x07 , . x = 0x12 } ,
{ . src = 0x6025 , . y = 0x07 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x08 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x09 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x0a , . x = 0x11 } ,
{ . src = 0x603c , . y = 0x0b , . x = 0x11 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d908 [ ] =
{
{ . src = 0x6021 , . y = 0x04 , . x = 0x14 } ,
{ . src = 0x6025 , . y = 0x04 , . x = 0x13 } ,
{ . src = 0x6049 , . y = 0x05 , . x = 0x13 } ,
{ . src = 0x6025 , . y = 0x05 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x06 , . x = 0x12 } ,
{ . src = 0x6049 , . y = 0x07 , . x = 0x12 } ,
{ . src = 0x6025 , . y = 0x07 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x08 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x09 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x0a , . x = 0x11 } ,
{ . src = 0x603c , . y = 0x0b , . x = 0x11 } ,
{ . src = 0x602f , . y = 0x0b , . x = 0x10 } ,
{ . src = 0x602e , . y = 0x0b , . x = 0x0f } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d93c [ ] =
{
{ . src = 0x6021 , . y = 0x06 , . x = 0x14 } ,
{ . src = 0x6021 , . y = 0x06 , . x = 0x13 } ,
{ . src = 0x6029 , . y = 0x05 , . x = 0x13 } ,
{ . src = 0x6045 , . y = 0x05 , . x = 0x12 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d94c [ ] =
{
{ . src = 0x6021 , . y = 0x06 , . x = 0x14 } ,
{ . src = 0x6021 , . y = 0x06 , . x = 0x13 } ,
{ . src = 0x6029 , . y = 0x05 , . x = 0x13 } ,
{ . src = 0x6025 , . y = 0x05 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x06 , . x = 0x12 } ,
{ . src = 0x6049 , . y = 0x07 , . x = 0x12 } ,
{ . src = 0x6045 , . y = 0x07 , . x = 0x11 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d968 [ ] =
{
{ . src = 0x6021 , . y = 0x06 , . x = 0x14 } ,
{ . src = 0x6021 , . y = 0x06 , . x = 0x13 } ,
{ . src = 0x6029 , . y = 0x05 , . x = 0x13 } ,
{ . src = 0x6025 , . y = 0x05 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x06 , . x = 0x12 } ,
{ . src = 0x6049 , . y = 0x07 , . x = 0x12 } ,
{ . src = 0x6025 , . y = 0x07 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x08 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x09 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x0a , . x = 0x11 } ,
{ . src = 0x603c , . y = 0x0b , . x = 0x11 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d994 [ ] =
{
{ . src = 0x6021 , . y = 0x06 , . x = 0x14 } ,
{ . src = 0x6021 , . y = 0x06 , . x = 0x13 } ,
{ . src = 0x6029 , . y = 0x05 , . x = 0x13 } ,
{ . src = 0x6025 , . y = 0x05 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x06 , . x = 0x12 } ,
{ . src = 0x6049 , . y = 0x07 , . x = 0x12 } ,
{ . src = 0x6025 , . y = 0x07 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x08 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x09 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x0a , . x = 0x11 } ,
{ . src = 0x603c , . y = 0x0b , . x = 0x11 } ,
{ . src = 0x602f , . y = 0x0b , . x = 0x10 } ,
{ . src = 0x602e , . y = 0x0b , . x = 0x0f } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d9c8 [ ] =
{
{ . src = 0x6021 , . y = 0x08 , . x = 0x14 } ,
{ . src = 0x6025 , . y = 0x08 , . x = 0x13 } ,
{ . src = 0x6049 , . y = 0x09 , . x = 0x13 } ,
{ . src = 0x6021 , . y = 0x09 , . x = 0x12 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d9d8 [ ] =
{
{ . src = 0x6021 , . y = 0x08 , . x = 0x14 } ,
{ . src = 0x6025 , . y = 0x08 , . x = 0x13 } ,
{ . src = 0x6049 , . y = 0x09 , . x = 0x13 } ,
{ . src = 0x6021 , . y = 0x09 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x08 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x07 , . x = 0x12 } ,
{ . src = 0x6045 , . y = 0x07 , . x = 0x11 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860d9f4 [ ] =
{
{ . src = 0x6021 , . y = 0x08 , . x = 0x14 } ,
{ . src = 0x6025 , . y = 0x08 , . x = 0x13 } ,
{ . src = 0x6049 , . y = 0x09 , . x = 0x13 } ,
{ . src = 0x6021 , . y = 0x09 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x08 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x07 , . x = 0x12 } ,
{ . src = 0x6025 , . y = 0x07 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x08 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x09 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x0a , . x = 0x11 } ,
{ . src = 0x603c , . y = 0x0b , . x = 0x11 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860da20 [ ] =
{
{ . src = 0x6021 , . y = 0x08 , . x = 0x14 } ,
{ . src = 0x6025 , . y = 0x08 , . x = 0x13 } ,
{ . src = 0x6049 , . y = 0x09 , . x = 0x13 } ,
{ . src = 0x6021 , . y = 0x09 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x08 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x07 , . x = 0x12 } ,
{ . src = 0x6025 , . y = 0x07 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x08 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x09 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x0a , . x = 0x11 } ,
{ . src = 0x603c , . y = 0x0b , . x = 0x11 } ,
{ . src = 0x602f , . y = 0x0b , . x = 0x10 } ,
{ . src = 0x602e , . y = 0x0b , . x = 0x0f } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860da54 [ ] =
{
{ . src = 0x6021 , . y = 0x0a , . x = 0x14 } ,
{ . src = 0x6021 , . y = 0x0a , . x = 0x13 } ,
{ . src = 0x6029 , . y = 0x09 , . x = 0x13 } ,
{ . src = 0x6021 , . y = 0x09 , . x = 0x12 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860da64 [ ] =
{
{ . src = 0x6021 , . y = 0x0a , . x = 0x14 } ,
{ . src = 0x6021 , . y = 0x0a , . x = 0x13 } ,
{ . src = 0x6029 , . y = 0x09 , . x = 0x13 } ,
{ . src = 0x6021 , . y = 0x09 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x08 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x07 , . x = 0x12 } ,
{ . src = 0x6045 , . y = 0x07 , . x = 0x11 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860da80 [ ] =
{
{ . src = 0x6021 , . y = 0x0a , . x = 0x14 } ,
{ . src = 0x6021 , . y = 0x0a , . x = 0x13 } ,
{ . src = 0x6029 , . y = 0x09 , . x = 0x13 } ,
{ . src = 0x6021 , . y = 0x09 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x08 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x07 , . x = 0x12 } ,
{ . src = 0x6025 , . y = 0x07 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x08 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x09 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x0a , . x = 0x11 } ,
{ . src = 0x603c , . y = 0x0b , . x = 0x11 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860daac [ ] =
{
{ . src = 0x6021 , . y = 0x0a , . x = 0x14 } ,
{ . src = 0x6021 , . y = 0x0a , . x = 0x13 } ,
{ . src = 0x6029 , . y = 0x09 , . x = 0x13 } ,
{ . src = 0x6021 , . y = 0x09 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x08 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x07 , . x = 0x12 } ,
{ . src = 0x6025 , . y = 0x07 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x08 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x09 , . x = 0x11 } ,
{ . src = 0x6029 , . y = 0x0a , . x = 0x11 } ,
{ . src = 0x603c , . y = 0x0b , . x = 0x11 } ,
{ . src = 0x602f , . y = 0x0b , . x = 0x10 } ,
{ . src = 0x602e , . y = 0x0b , . x = 0x0f } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860dae0 [ ] =
{
{ . src = 0x6021 , . y = 0x0c , . x = 0x14 } ,
{ . src = 0x6025 , . y = 0x0c , . x = 0x13 } ,
{ . src = 0x6049 , . y = 0x0d , . x = 0x13 } ,
{ . src = 0x6045 , . y = 0x0d , . x = 0x12 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860daf0 [ ] =
{
{ . src = 0x6021 , . y = 0x0c , . x = 0x14 } ,
{ . src = 0x6025 , . y = 0x0c , . x = 0x13 } ,
{ . src = 0x6049 , . y = 0x0d , . x = 0x13 } ,
{ . src = 0x6025 , . y = 0x0d , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x0e , . x = 0x12 } ,
{ . src = 0x6049 , . y = 0x0f , . x = 0x12 } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x11 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860db0c [ ] =
{
{ . src = 0x6021 , . y = 0x0c , . x = 0x14 } ,
{ . src = 0x6025 , . y = 0x0c , . x = 0x13 } ,
{ . src = 0x6049 , . y = 0x0d , . x = 0x13 } ,
{ . src = 0x6025 , . y = 0x0d , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x0e , . x = 0x12 } ,
{ . src = 0x6049 , . y = 0x0f , . x = 0x12 } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x11 } ,
{ . src = 0x6038 , . y = 0x0e , . x = 0x11 } ,
{ . src = 0x6037 , . y = 0x0d , . x = 0x11 } ,
{ . src = 0x6036 , . y = 0x0c , . x = 0x11 } ,
{ . src = 0x6035 , . y = 0x0b , . x = 0x11 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860db38 [ ] =
{
{ . src = 0x6021 , . y = 0x0c , . x = 0x14 } ,
{ . src = 0x6025 , . y = 0x0c , . x = 0x13 } ,
{ . src = 0x6049 , . y = 0x0d , . x = 0x13 } ,
{ . src = 0x6025 , . y = 0x0d , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x0e , . x = 0x12 } ,
{ . src = 0x6049 , . y = 0x0f , . x = 0x12 } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x11 } ,
{ . src = 0x6038 , . y = 0x0e , . x = 0x11 } ,
{ . src = 0x6037 , . y = 0x0d , . x = 0x11 } ,
{ . src = 0x6036 , . y = 0x0c , . x = 0x11 } ,
{ . src = 0x6035 , . y = 0x0b , . x = 0x11 } ,
{ . src = 0x602f , . y = 0x0b , . x = 0x10 } ,
{ . src = 0x602e , . y = 0x0b , . x = 0x0f } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860db6c [ ] =
{
{ . src = 0x6021 , . y = 0x0e , . x = 0x14 } ,
{ . src = 0x6021 , . y = 0x0e , . x = 0x13 } ,
{ . src = 0x6029 , . y = 0x0d , . x = 0x13 } ,
{ . src = 0x6045 , . y = 0x0d , . x = 0x12 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860db7c [ ] =
{
{ . src = 0x6021 , . y = 0x0e , . x = 0x14 } ,
{ . src = 0x6021 , . y = 0x0e , . x = 0x13 } ,
{ . src = 0x6029 , . y = 0x0d , . x = 0x13 } ,
{ . src = 0x6025 , . y = 0x0d , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x0e , . x = 0x12 } ,
{ . src = 0x6049 , . y = 0x0f , . x = 0x12 } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x11 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860db98 [ ] =
{
{ . src = 0x6021 , . y = 0x0e , . x = 0x14 } ,
{ . src = 0x6021 , . y = 0x0e , . x = 0x13 } ,
{ . src = 0x6029 , . y = 0x0d , . x = 0x13 } ,
{ . src = 0x6025 , . y = 0x0d , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x0e , . x = 0x12 } ,
{ . src = 0x6049 , . y = 0x0f , . x = 0x12 } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x11 } ,
{ . src = 0x6038 , . y = 0x0e , . x = 0x11 } ,
{ . src = 0x6037 , . y = 0x0d , . x = 0x11 } ,
{ . src = 0x6036 , . y = 0x0c , . x = 0x11 } ,
{ . src = 0x6035 , . y = 0x0b , . x = 0x11 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860dbc4 [ ] =
{
{ . src = 0x6021 , . y = 0x0e , . x = 0x14 } ,
{ . src = 0x6021 , . y = 0x0e , . x = 0x13 } ,
{ . src = 0x6029 , . y = 0x0d , . x = 0x13 } ,
{ . src = 0x6025 , . y = 0x0d , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x0e , . x = 0x12 } ,
{ . src = 0x6049 , . y = 0x0f , . x = 0x12 } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x11 } ,
{ . src = 0x6038 , . y = 0x0e , . x = 0x11 } ,
{ . src = 0x6037 , . y = 0x0d , . x = 0x11 } ,
{ . src = 0x6036 , . y = 0x0c , . x = 0x11 } ,
{ . src = 0x6035 , . y = 0x0b , . x = 0x11 } ,
{ . src = 0x602f , . y = 0x0b , . x = 0x10 } ,
{ . src = 0x602e , . y = 0x0b , . x = 0x0f } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860dbf8 [ ] =
{
{ . src = 0x6021 , . y = 0x10 , . x = 0x14 } ,
{ . src = 0x6025 , . y = 0x10 , . x = 0x13 } ,
{ . src = 0x6049 , . y = 0x11 , . x = 0x13 } ,
{ . src = 0x6021 , . y = 0x11 , . x = 0x12 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860dc08 [ ] =
{
{ . src = 0x6021 , . y = 0x10 , . x = 0x14 } ,
{ . src = 0x6025 , . y = 0x10 , . x = 0x13 } ,
{ . src = 0x6049 , . y = 0x11 , . x = 0x13 } ,
{ . src = 0x6021 , . y = 0x11 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x10 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x0f , . x = 0x12 } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x11 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860dc24 [ ] =
{
{ . src = 0x6021 , . y = 0x10 , . x = 0x14 } ,
{ . src = 0x6025 , . y = 0x10 , . x = 0x13 } ,
{ . src = 0x6049 , . y = 0x11 , . x = 0x13 } ,
{ . src = 0x6021 , . y = 0x11 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x10 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x0f , . x = 0x12 } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x11 } ,
{ . src = 0x6038 , . y = 0x0e , . x = 0x11 } ,
{ . src = 0x6037 , . y = 0x0d , . x = 0x11 } ,
{ . src = 0x6036 , . y = 0x0c , . x = 0x11 } ,
{ . src = 0x6035 , . y = 0x0b , . x = 0x11 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860dc50 [ ] =
{
{ . src = 0x6021 , . y = 0x10 , . x = 0x14 } ,
{ . src = 0x6025 , . y = 0x10 , . x = 0x13 } ,
{ . src = 0x6049 , . y = 0x11 , . x = 0x13 } ,
{ . src = 0x6021 , . y = 0x11 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x10 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x0f , . x = 0x12 } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x11 } ,
{ . src = 0x6038 , . y = 0x0e , . x = 0x11 } ,
{ . src = 0x6037 , . y = 0x0d , . x = 0x11 } ,
{ . src = 0x6036 , . y = 0x0c , . x = 0x11 } ,
{ . src = 0x6035 , . y = 0x0b , . x = 0x11 } ,
{ . src = 0x602f , . y = 0x0b , . x = 0x10 } ,
{ . src = 0x602e , . y = 0x0b , . x = 0x0f } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860dc84 [ ] =
{
{ . src = 0x602b , . y = 0x12 , . x = 0x14 } ,
{ . src = 0x602b , . y = 0x12 , . x = 0x13 } ,
{ . src = 0x6029 , . y = 0x11 , . x = 0x13 } ,
{ . src = 0x6021 , . y = 0x11 , . x = 0x12 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860dc94 [ ] =
{
{ . src = 0x602b , . y = 0x12 , . x = 0x14 } ,
{ . src = 0x602b , . y = 0x12 , . x = 0x13 } ,
{ . src = 0x6029 , . y = 0x11 , . x = 0x13 } ,
{ . src = 0x6021 , . y = 0x11 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x10 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x0f , . x = 0x12 } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x11 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860dcb0 [ ] =
{
{ . src = 0x602b , . y = 0x12 , . x = 0x14 } ,
{ . src = 0x602b , . y = 0x12 , . x = 0x13 } ,
{ . src = 0x6029 , . y = 0x11 , . x = 0x13 } ,
{ . src = 0x6021 , . y = 0x11 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x10 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x0f , . x = 0x12 } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x11 } ,
{ . src = 0x6038 , . y = 0x0e , . x = 0x11 } ,
{ . src = 0x6037 , . y = 0x0d , . x = 0x11 } ,
{ . src = 0x6036 , . y = 0x0c , . x = 0x11 } ,
{ . src = 0x6035 , . y = 0x0b , . x = 0x11 } ,
} ;
static const struct UnkStruct_860DD10 gUnknown_0860dcdc [ ] =
{
{ . src = 0x602b , . y = 0x12 , . x = 0x14 } ,
{ . src = 0x602b , . y = 0x12 , . x = 0x13 } ,
{ . src = 0x6029 , . y = 0x11 , . x = 0x13 } ,
{ . src = 0x6021 , . y = 0x11 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x10 , . x = 0x12 } ,
{ . src = 0x6029 , . y = 0x0f , . x = 0x12 } ,
{ . src = 0x6021 , . y = 0x0f , . x = 0x11 } ,
{ . src = 0x6038 , . y = 0x0e , . x = 0x11 } ,
{ . src = 0x6037 , . y = 0x0d , . x = 0x11 } ,
{ . src = 0x6036 , . y = 0x0c , . x = 0x11 } ,
{ . src = 0x6035 , . y = 0x0b , . x = 0x11 } ,
{ . src = 0x602f , . y = 0x0b , . x = 0x10 } ,
{ . src = 0x602e , . y = 0x0b , . x = 0x0f } ,
} ;
2019-12-21 10:27:12 +01:00
static const struct UnkStruct_860DD10 * const gUnknown_0860DD10 [ DOME_TOURNAMENT_TRAINERS_COUNT ] [ DOME_ROUNDS_COUNT ] =
2018-08-26 14:40:36 +02:00
{
{ gUnknown_0860d450 , gUnknown_0860d460 , gUnknown_0860d47c , gUnknown_0860d4a8 } ,
{ gUnknown_0860dc84 , gUnknown_0860dc94 , gUnknown_0860dcb0 , gUnknown_0860dcdc } ,
{ gUnknown_0860d8b0 , gUnknown_0860d8c0 , gUnknown_0860d8dc , gUnknown_0860d908 } ,
{ gUnknown_0860d824 , gUnknown_0860d834 , gUnknown_0860d850 , gUnknown_0860d87c } ,
{ gUnknown_0860d5f4 , gUnknown_0860d604 , gUnknown_0860d620 , gUnknown_0860d64c } ,
{ gUnknown_0860dae0 , gUnknown_0860daf0 , gUnknown_0860db0c , gUnknown_0860db38 } ,
{ gUnknown_0860da54 , gUnknown_0860da64 , gUnknown_0860da80 , gUnknown_0860daac } ,
{ gUnknown_0860d680 , gUnknown_0860d690 , gUnknown_0860d6ac , gUnknown_0860d6d8 } ,
{ gUnknown_0860d4dc , gUnknown_0860d4ec , gUnknown_0860d508 , gUnknown_0860d534 } ,
{ gUnknown_0860dbf8 , gUnknown_0860dc08 , gUnknown_0860dc24 , gUnknown_0860dc50 } ,
{ gUnknown_0860d93c , gUnknown_0860d94c , gUnknown_0860d968 , gUnknown_0860d994 } ,
{ gUnknown_0860d798 , gUnknown_0860d7a8 , gUnknown_0860d7c4 , gUnknown_0860d7f0 } ,
{ gUnknown_0860d568 , gUnknown_0860d578 , gUnknown_0860d594 , gUnknown_0860d5c0 } ,
{ gUnknown_0860db6c , gUnknown_0860db7c , gUnknown_0860db98 , gUnknown_0860dbc4 } ,
{ gUnknown_0860d9c8 , gUnknown_0860d9d8 , gUnknown_0860d9f4 , gUnknown_0860da20 } ,
{ gUnknown_0860d70c , gUnknown_0860d71c , gUnknown_0860d738 , gUnknown_0860d764 } ,
} ;
2019-12-21 10:27:12 +01:00
static const u8 gUnknown_0860DE10 [ DOME_TOURNAMENT_TRAINERS_COUNT ] [ DOME_ROUNDS_COUNT ] =
2018-08-26 14:40:36 +02:00
{
{ 0x04 , 0x07 , 0x0b , 0x0d } ,
{ 0x04 , 0x07 , 0x0b , 0x0d } ,
{ 0x04 , 0x07 , 0x0b , 0x0d } ,
{ 0x04 , 0x07 , 0x0b , 0x0d } ,
{ 0x04 , 0x07 , 0x0b , 0x0d } ,
{ 0x04 , 0x07 , 0x0b , 0x0d } ,
{ 0x04 , 0x07 , 0x0b , 0x0d } ,
{ 0x04 , 0x07 , 0x0b , 0x0d } ,
{ 0x04 , 0x07 , 0x0b , 0x0d } ,
{ 0x04 , 0x07 , 0x0b , 0x0d } ,
{ 0x04 , 0x07 , 0x0b , 0x0d } ,
{ 0x04 , 0x07 , 0x0b , 0x0d } ,
{ 0x04 , 0x07 , 0x0b , 0x0d } ,
{ 0x04 , 0x07 , 0x0b , 0x0d } ,
{ 0x04 , 0x07 , 0x0b , 0x0d } ,
{ 0x04 , 0x07 , 0x0b , 0x0d } ,
} ;
2018-08-15 15:49:50 +02:00
// code
2018-08-25 19:59:47 +02:00
void CallBattleDomeFunction ( void )
2018-08-15 15:49:50 +02:00
{
2019-02-08 18:08:25 +01:00
sBattleDomeFunctions [ gSpecialVar_0x8004 ] ( ) ;
2018-08-15 15:49:50 +02:00
}
2019-02-08 18:08:25 +01:00
static void InitDomeChallenge ( void )
2018-08-15 15:49:50 +02:00
{
2018-08-25 19:59:47 +02:00
u32 lvlMode = gSaveBlock2Ptr - > frontier . lvlMode ;
u32 battleMode = VarGet ( VAR_FRONTIER_BATTLE_MODE ) ;
2018-08-15 15:49:50 +02:00
2019-11-24 22:58:40 +01:00
gSaveBlock2Ptr - > frontier . challengeStatus = 0 ;
2018-10-21 00:06:42 +02:00
gSaveBlock2Ptr - > frontier . curChallengeBattleNum = 0 ;
2019-11-24 22:58:40 +01:00
gSaveBlock2Ptr - > frontier . challengePaused = FALSE ;
2018-08-15 15:49:50 +02:00
gSaveBlock2Ptr - > frontier . field_CA9_b = 0 ;
2019-11-24 22:58:40 +01:00
if ( ! ( gSaveBlock2Ptr - > frontier . winStreakActiveFlags & sWinStreakFlags [ battleMode ] [ lvlMode ] ) )
2018-10-27 17:39:05 +02:00
gSaveBlock2Ptr - > frontier . domeWinStreaks [ battleMode ] [ lvlMode ] = 0 ;
2018-08-15 15:49:50 +02:00
2018-12-27 23:30:47 +01:00
SetDynamicWarp ( 0 , gSaveBlock1Ptr - > location . mapGroup , gSaveBlock1Ptr - > location . mapNum , - 1 ) ;
2018-08-15 15:49:50 +02:00
gTrainerBattleOpponent_A = 0 ;
}
2019-02-08 18:08:25 +01:00
static void GetDomeData ( void )
2018-08-15 15:49:50 +02:00
{
2018-08-25 19:59:47 +02:00
u32 lvlMode = gSaveBlock2Ptr - > frontier . lvlMode ;
u32 battleMode = VarGet ( VAR_FRONTIER_BATTLE_MODE ) ;
2018-08-15 15:49:50 +02:00
switch ( gSpecialVar_0x8005 )
{
2019-11-29 04:46:39 +01:00
case DOME_DATA_WIN_STREAK :
2018-10-27 17:39:05 +02:00
gSpecialVar_Result = gSaveBlock2Ptr - > frontier . domeWinStreaks [ battleMode ] [ lvlMode ] ;
2018-08-15 15:49:50 +02:00
break ;
2019-11-29 04:46:39 +01:00
case DOME_DATA_WIN_STREAK_ACTIVE :
2019-11-24 22:58:40 +01:00
gSpecialVar_Result = ( ( gSaveBlock2Ptr - > frontier . winStreakActiveFlags & sWinStreakFlags [ battleMode ] [ lvlMode ] ) ! = 0 ) ;
2018-08-15 15:49:50 +02:00
break ;
2019-12-18 08:32:52 +01:00
case DOME_DATA_ATTEMPTED_SINGLES_50 :
gSpecialVar_Result = gSaveBlock2Ptr - > frontier . domeAttemptedSingles50 ;
2018-08-15 15:49:50 +02:00
break ;
2019-12-18 08:32:52 +01:00
case DOME_DATA_ATTEMPTED_SINGLES_OPEN :
gSpecialVar_Result = gSaveBlock2Ptr - > frontier . domeAttemptedSinglesOpen ;
2018-08-15 15:49:50 +02:00
break ;
2019-12-18 08:32:52 +01:00
case DOME_DATA_HAS_WON_SINGLES_50 :
gSpecialVar_Result = gSaveBlock2Ptr - > frontier . domeHasWonSingles50 ;
2018-08-15 15:49:50 +02:00
break ;
2019-12-18 08:32:52 +01:00
case DOME_DATA_HAS_WON_SINGLES_OPEN :
gSpecialVar_Result = gSaveBlock2Ptr - > frontier . domeHasWonSinglesOpen ;
2018-08-15 15:49:50 +02:00
break ;
2019-12-18 08:32:52 +01:00
case DOME_DATA_ATTEMPTED_CHALLENGE :
2018-08-25 19:59:47 +02:00
if ( VarGet ( VAR_FRONTIER_BATTLE_MODE ) = = FRONTIER_MODE_DOUBLES )
2018-08-15 15:49:50 +02:00
{
2019-12-18 08:32:52 +01:00
if ( lvlMode ! = FRONTIER_LVL_50 )
gSpecialVar_Result = gSaveBlock2Ptr - > frontier . domeAttemptedDoublesOpen ;
2018-08-15 15:49:50 +02:00
else
2019-12-18 08:32:52 +01:00
gSpecialVar_Result = gSaveBlock2Ptr - > frontier . domeAttemptedDoubles50 ;
2018-08-15 15:49:50 +02:00
}
else
{
2019-12-18 08:32:52 +01:00
if ( lvlMode ! = FRONTIER_LVL_50 )
gSpecialVar_Result = gSaveBlock2Ptr - > frontier . domeAttemptedSinglesOpen ;
2018-08-15 15:49:50 +02:00
else
2019-12-18 08:32:52 +01:00
gSpecialVar_Result = gSaveBlock2Ptr - > frontier . domeAttemptedSingles50 ;
2018-08-15 15:49:50 +02:00
}
break ;
2019-12-18 08:32:52 +01:00
case DOME_DATA_HAS_WON_CHALLENGE :
2018-08-25 19:59:47 +02:00
if ( VarGet ( VAR_FRONTIER_BATTLE_MODE ) = = FRONTIER_MODE_DOUBLES )
2018-08-15 15:49:50 +02:00
{
2019-12-18 08:32:52 +01:00
if ( lvlMode ! = FRONTIER_LVL_50 )
gSpecialVar_Result = gSaveBlock2Ptr - > frontier . domeHasWonDoublesOpen ;
2018-08-15 15:49:50 +02:00
else
2019-12-18 08:32:52 +01:00
gSpecialVar_Result = gSaveBlock2Ptr - > frontier . domeHasWonDoubles50 ;
2018-08-15 15:49:50 +02:00
}
else
{
2019-12-18 08:32:52 +01:00
if ( lvlMode ! = FRONTIER_LVL_50 )
gSpecialVar_Result = gSaveBlock2Ptr - > frontier . domeHasWonSinglesOpen ;
2018-08-15 15:49:50 +02:00
else
2019-12-18 08:32:52 +01:00
gSpecialVar_Result = gSaveBlock2Ptr - > frontier . domeHasWonSingles50 ;
2018-08-15 15:49:50 +02:00
}
break ;
2019-12-18 08:32:52 +01:00
case DOME_DATA_SELECTED_MONS :
2019-10-18 01:22:03 +02:00
ClearSelectedPartyOrder ( ) ;
2019-11-24 22:58:40 +01:00
gSelectedOrderFromParty [ 0 ] = gSaveBlock2Ptr - > frontier . selectedPartyMons [ 3 ] ;
gSelectedOrderFromParty [ 1 ] = gSaveBlock2Ptr - > frontier . selectedPartyMons [ 3 ] > > 8 ;
2018-08-15 15:49:50 +02:00
break ;
2019-12-18 08:32:52 +01:00
case DOME_DATA_LAST_TOURNEY_TYPE :
gSpecialVar_Result = ( gSaveBlock2Ptr - > frontier . domeLvlMode * 2 ) - 3 + gSaveBlock2Ptr - > frontier . domeBattleMode ;
2018-08-15 15:49:50 +02:00
break ;
}
}
2019-02-08 18:08:25 +01:00
static void SetDomeData ( void )
2018-08-15 15:49:50 +02:00
{
2018-08-25 19:59:47 +02:00
u32 lvlMode = gSaveBlock2Ptr - > frontier . lvlMode ;
u32 battleMode = VarGet ( VAR_FRONTIER_BATTLE_MODE ) ;
2018-08-15 15:49:50 +02:00
switch ( gSpecialVar_0x8005 )
{
2019-11-29 04:46:39 +01:00
case DOME_DATA_WIN_STREAK :
2018-10-27 17:39:05 +02:00
gSaveBlock2Ptr - > frontier . domeWinStreaks [ battleMode ] [ lvlMode ] = gSpecialVar_0x8006 ;
2018-08-15 15:49:50 +02:00
break ;
2019-11-29 04:46:39 +01:00
case DOME_DATA_WIN_STREAK_ACTIVE :
2018-08-15 15:49:50 +02:00
if ( gSpecialVar_0x8006 )
2019-11-24 22:58:40 +01:00
gSaveBlock2Ptr - > frontier . winStreakActiveFlags | = sWinStreakFlags [ battleMode ] [ lvlMode ] ;
2018-08-15 15:49:50 +02:00
else
2019-11-24 22:58:40 +01:00
gSaveBlock2Ptr - > frontier . winStreakActiveFlags & = sWinStreakMasks [ battleMode ] [ lvlMode ] ;
2018-08-15 15:49:50 +02:00
break ;
2019-12-18 08:32:52 +01:00
case DOME_DATA_ATTEMPTED_SINGLES_50 :
gSaveBlock2Ptr - > frontier . domeAttemptedSingles50 = gSpecialVar_0x8006 ;
2018-08-15 15:49:50 +02:00
break ;
2019-12-18 08:32:52 +01:00
case DOME_DATA_ATTEMPTED_SINGLES_OPEN :
gSaveBlock2Ptr - > frontier . domeAttemptedSinglesOpen = gSpecialVar_0x8006 ;
2018-08-15 15:49:50 +02:00
break ;
2019-12-18 08:32:52 +01:00
case DOME_DATA_HAS_WON_SINGLES_50 :
gSaveBlock2Ptr - > frontier . domeHasWonSingles50 = gSpecialVar_0x8006 ;
2018-08-15 15:49:50 +02:00
break ;
2019-12-18 08:32:52 +01:00
case DOME_DATA_HAS_WON_SINGLES_OPEN :
gSaveBlock2Ptr - > frontier . domeHasWonSinglesOpen = gSpecialVar_0x8006 ;
2018-08-15 15:49:50 +02:00
break ;
2019-12-18 08:32:52 +01:00
case DOME_DATA_ATTEMPTED_CHALLENGE :
2018-08-25 19:59:47 +02:00
if ( VarGet ( VAR_FRONTIER_BATTLE_MODE ) = = FRONTIER_MODE_DOUBLES )
2018-08-15 15:49:50 +02:00
{
2019-12-18 08:32:52 +01:00
if ( lvlMode ! = FRONTIER_LVL_50 )
gSaveBlock2Ptr - > frontier . domeAttemptedDoublesOpen = gSpecialVar_0x8006 ;
2018-08-15 15:49:50 +02:00
else
2019-12-18 08:32:52 +01:00
gSaveBlock2Ptr - > frontier . domeAttemptedDoubles50 = gSpecialVar_0x8006 ;
2018-08-15 15:49:50 +02:00
}
else
{
2019-12-18 08:32:52 +01:00
if ( lvlMode ! = FRONTIER_LVL_50 )
gSaveBlock2Ptr - > frontier . domeAttemptedSinglesOpen = gSpecialVar_0x8006 ;
2018-08-15 15:49:50 +02:00
else
2019-12-18 08:32:52 +01:00
gSaveBlock2Ptr - > frontier . domeAttemptedSingles50 = gSpecialVar_0x8006 ;
2018-08-15 15:49:50 +02:00
}
break ;
2019-12-18 08:32:52 +01:00
case DOME_DATA_HAS_WON_CHALLENGE :
2018-08-25 19:59:47 +02:00
if ( VarGet ( VAR_FRONTIER_BATTLE_MODE ) = = FRONTIER_MODE_DOUBLES )
2018-08-15 15:49:50 +02:00
{
2019-12-18 08:32:52 +01:00
if ( lvlMode ! = FRONTIER_LVL_50 )
gSaveBlock2Ptr - > frontier . domeHasWonDoublesOpen = gSpecialVar_0x8006 ;
2018-08-15 15:49:50 +02:00
else
2019-12-18 08:32:52 +01:00
gSaveBlock2Ptr - > frontier . domeHasWonDoubles50 = gSpecialVar_0x8006 ;
2018-08-15 15:49:50 +02:00
}
else
{
2019-12-18 08:32:52 +01:00
if ( lvlMode ! = FRONTIER_LVL_50 )
gSaveBlock2Ptr - > frontier . domeHasWonSinglesOpen = gSpecialVar_0x8006 ;
2018-08-15 15:49:50 +02:00
else
2019-12-18 08:32:52 +01:00
gSaveBlock2Ptr - > frontier . domeHasWonSingles50 = gSpecialVar_0x8006 ;
2018-08-15 15:49:50 +02:00
}
break ;
2019-12-18 08:32:52 +01:00
case DOME_DATA_SELECTED_MONS :
2019-11-24 22:58:40 +01:00
gSaveBlock2Ptr - > frontier . selectedPartyMons [ 3 ] = T1_READ_16 ( gSelectedOrderFromParty ) ;
2018-08-15 15:49:50 +02:00
break ;
}
}
2018-08-26 15:51:14 +02:00
static void InitDomeTrainers ( void )
2018-08-15 15:49:50 +02:00
{
2019-02-08 18:08:25 +01:00
int i , j , k ;
int monLevel ;
2019-11-29 03:09:35 +01:00
int species [ FRONTIER_PARTY_SIZE ] ;
2019-02-08 18:08:25 +01:00
int monTypesBits , monTypesCount ;
int trainerId ;
int monSetId ;
2019-12-21 10:27:12 +01:00
u16 * rankingScores ;
2019-02-08 18:08:25 +01:00
int * statValues ;
2018-08-18 18:23:40 +02:00
u8 ivs = 0 ;
species [ 0 ] = 0 ;
species [ 1 ] = 0 ;
species [ 2 ] = 0 ;
2019-12-21 10:27:12 +01:00
rankingScores = AllocZeroed ( sizeof ( u16 ) * DOME_TOURNAMENT_TRAINERS_COUNT ) ;
2019-12-18 08:32:52 +01:00
statValues = AllocZeroed ( sizeof ( int ) * NUM_STATS ) ;
2018-08-15 15:49:50 +02:00
2019-12-18 08:32:52 +01:00
gSaveBlock2Ptr - > frontier . domeLvlMode = gSaveBlock2Ptr - > frontier . lvlMode + 1 ;
gSaveBlock2Ptr - > frontier . domeBattleMode = VarGet ( VAR_FRONTIER_BATTLE_MODE ) + 1 ;
DOME_TRAINERS [ 0 ] . trainerId = TRAINER_PLAYER ;
DOME_TRAINERS [ 0 ] . isEliminated = FALSE ;
DOME_TRAINERS [ 0 ] . eliminatedAt = 0 ;
DOME_TRAINERS [ 0 ] . forfeited = FALSE ;
2018-08-15 15:49:50 +02:00
2019-12-21 10:27:12 +01:00
// Store the data used to display party information on the player's tourney page
2019-11-24 22:58:40 +01:00
for ( i = 0 ; i < FRONTIER_PARTY_SIZE ; i + + )
2018-08-15 15:49:50 +02:00
{
2019-12-18 08:32:52 +01:00
DOME_MONS [ 0 ] [ i ] = GetMonData ( & gPlayerParty [ gSaveBlock2Ptr - > frontier . selectedPartyMons [ i ] - 1 ] , MON_DATA_SPECIES , NULL ) ;
2018-12-25 18:50:15 +01:00
for ( j = 0 ; j < MAX_MON_MOVES ; j + + )
2019-12-21 10:27:12 +01:00
gSaveBlock2Ptr - > frontier . domePlayerPartyData [ i ] . moves [ j ] = GetMonData ( & gPlayerParty [ gSaveBlock2Ptr - > frontier . selectedPartyMons [ i ] - 1 ] , MON_DATA_MOVE1 + j , NULL ) ;
2019-11-24 22:58:40 +01:00
for ( j = 0 ; j < NUM_STATS ; j + + )
2019-12-21 10:27:12 +01:00
gSaveBlock2Ptr - > frontier . domePlayerPartyData [ i ] . evs [ j ] = GetMonData ( & gPlayerParty [ gSaveBlock2Ptr - > frontier . selectedPartyMons [ i ] - 1 ] , MON_DATA_HP_EV + j , NULL ) ;
2018-08-15 15:49:50 +02:00
2019-12-21 10:27:12 +01:00
gSaveBlock2Ptr - > frontier . domePlayerPartyData [ i ] . nature = GetNature ( & gPlayerParty [ gSaveBlock2Ptr - > frontier . selectedPartyMons [ i ] - 1 ] ) ;
2018-08-15 15:49:50 +02:00
}
2019-12-21 10:27:12 +01:00
// Populate the tourney roster with random frontier trainers (dependent on streak)
2018-08-18 18:23:40 +02:00
for ( i = 1 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
2018-08-15 15:49:50 +02:00
{
2019-12-21 10:27:12 +01:00
// First 5/16 trainers are easier than the rest
2018-08-18 18:23:40 +02:00
if ( i > 5 )
2018-08-15 15:49:50 +02:00
{
2018-08-18 18:23:40 +02:00
do
2018-08-15 15:49:50 +02:00
{
2019-12-21 00:52:29 +01:00
trainerId = GetRandomScaledFrontierTrainerId ( GetCurrentFacilityWinStreak ( ) , 0 ) ;
2018-08-18 18:23:40 +02:00
for ( j = 1 ; j < i ; j + + )
2018-08-15 15:49:50 +02:00
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ j ] . trainerId = = trainerId )
2018-08-15 15:49:50 +02:00
break ;
}
2018-08-18 18:23:40 +02:00
} while ( j ! = i ) ;
2019-12-18 08:32:52 +01:00
DOME_TRAINERS [ i ] . trainerId = trainerId ;
2018-08-15 15:49:50 +02:00
}
else
{
2018-08-18 18:23:40 +02:00
do
2018-08-15 15:49:50 +02:00
{
2019-12-21 00:52:29 +01:00
trainerId = GetRandomScaledFrontierTrainerId ( GetCurrentFacilityWinStreak ( ) + 1 , 0 ) ;
2018-08-18 18:23:40 +02:00
for ( j = 1 ; j < i ; j + + )
2018-08-15 15:49:50 +02:00
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ j ] . trainerId = = trainerId )
2018-08-15 15:49:50 +02:00
break ;
}
2018-08-18 18:23:40 +02:00
} while ( j ! = i ) ;
2019-12-18 08:32:52 +01:00
DOME_TRAINERS [ i ] . trainerId = trainerId ;
2018-08-15 15:49:50 +02:00
}
2019-11-29 03:09:35 +01:00
for ( j = 0 ; j < FRONTIER_PARTY_SIZE ; j + + )
2018-08-15 15:49:50 +02:00
{
2018-08-18 18:23:40 +02:00
// Make sure the mon is valid.
2018-08-15 15:49:50 +02:00
do
{
2018-11-11 16:44:27 +01:00
monSetId = RandomizeFacilityTrainerMonSet ( trainerId ) ;
2018-08-18 18:23:40 +02:00
for ( k = 0 ; k < j ; k + + )
2018-08-15 15:49:50 +02:00
{
2019-12-18 08:32:52 +01:00
int checkingMonSetId = DOME_MONS [ i ] [ k ] ;
2018-11-11 16:44:27 +01:00
if ( checkingMonSetId = = monSetId
| | species [ 0 ] = = gFacilityTrainerMons [ monSetId ] . species
| | species [ 1 ] = = gFacilityTrainerMons [ monSetId ] . species
| | gFacilityTrainerMons [ checkingMonSetId ] . itemTableId = = gFacilityTrainerMons [ monSetId ] . itemTableId )
2018-08-15 15:49:50 +02:00
break ;
}
2018-08-18 18:23:40 +02:00
} while ( k ! = j ) ;
2018-08-15 15:49:50 +02:00
2019-12-18 08:32:52 +01:00
DOME_MONS [ i ] [ j ] = monSetId ;
2018-11-11 16:44:27 +01:00
species [ j ] = gFacilityTrainerMons [ monSetId ] . species ;
2018-08-15 15:49:50 +02:00
}
2019-12-18 08:32:52 +01:00
DOME_TRAINERS [ i ] . isEliminated = FALSE ;
DOME_TRAINERS [ i ] . eliminatedAt = 0 ;
DOME_TRAINERS [ i ] . forfeited = FALSE ;
2018-08-15 15:49:50 +02:00
}
2019-12-21 10:27:12 +01:00
// rankingScores is used to determine the seed (ranking) of the trainers
// rankingScores[0] is for the player, rankingScores[1-15] are for the opponent trainers
// Calculate player's ranking score
2018-08-18 18:23:40 +02:00
monTypesBits = 0 ;
2019-12-21 10:27:12 +01:00
rankingScores [ 0 ] = 0 ;
2019-11-24 22:58:40 +01:00
for ( i = 0 ; i < FRONTIER_PARTY_SIZE ; i + + )
2018-08-15 15:49:50 +02:00
{
2019-12-21 10:27:12 +01:00
// trainerId var re-used here as index of selected mons
2019-11-24 22:58:40 +01:00
trainerId = gSaveBlock2Ptr - > frontier . selectedPartyMons [ i ] - 1 ;
2019-12-21 10:27:12 +01:00
rankingScores [ 0 ] + = GetMonData ( & gPlayerParty [ trainerId ] , MON_DATA_ATK , NULL ) ;
rankingScores [ 0 ] + = GetMonData ( & gPlayerParty [ trainerId ] , MON_DATA_DEF , NULL ) ;
rankingScores [ 0 ] + = GetMonData ( & gPlayerParty [ trainerId ] , MON_DATA_SPATK , NULL ) ;
rankingScores [ 0 ] + = GetMonData ( & gPlayerParty [ trainerId ] , MON_DATA_SPDEF , NULL ) ;
rankingScores [ 0 ] + = GetMonData ( & gPlayerParty [ trainerId ] , MON_DATA_SPEED , NULL ) ;
rankingScores [ 0 ] + = GetMonData ( & gPlayerParty [ trainerId ] , MON_DATA_MAX_HP , NULL ) ;
2018-08-18 18:23:40 +02:00
monTypesBits | = gBitTable [ gBaseStats [ GetMonData ( & gPlayerParty [ trainerId ] , MON_DATA_SPECIES , NULL ) ] . type1 ] ;
monTypesBits | = gBitTable [ gBaseStats [ GetMonData ( & gPlayerParty [ trainerId ] , MON_DATA_SPECIES , NULL ) ] . type2 ] ;
2018-08-15 15:49:50 +02:00
}
2019-12-21 10:27:12 +01:00
// Count the number of types in the players party, to factor into the ranking
2018-08-18 18:23:40 +02:00
for ( monTypesCount = 0 , j = 0 ; j < 32 ; j + + )
2018-08-15 15:49:50 +02:00
{
if ( monTypesBits & 1 )
monTypesCount + + ;
monTypesBits > > = 1 ;
}
2018-10-24 23:14:45 +02:00
monLevel = SetFacilityPtrsGetLevel ( ) ;
2019-12-21 10:27:12 +01:00
rankingScores [ 0 ] + = ( monTypesCount * monLevel ) / 20 ;
2018-08-15 15:49:50 +02:00
2019-12-21 10:27:12 +01:00
// Calculate rankingScores for the opponent trainers
2018-08-18 18:23:40 +02:00
for ( i = 1 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
2018-08-15 15:49:50 +02:00
{
2018-08-18 18:23:40 +02:00
monTypesBits = 0 ;
2019-12-21 10:27:12 +01:00
rankingScores [ i ] = 0 ;
2019-12-18 08:32:52 +01:00
ivs = GetDomeTrainerMonIvs ( DOME_TRAINERS [ i ] . trainerId ) ;
2019-11-29 03:09:35 +01:00
for ( j = 0 ; j < FRONTIER_PARTY_SIZE ; j + + )
2018-08-15 15:49:50 +02:00
{
2019-12-18 08:32:52 +01:00
CalcDomeMonStats ( gFacilityTrainerMons [ DOME_MONS [ i ] [ j ] ] . species ,
2018-08-18 18:23:40 +02:00
monLevel , ivs ,
2019-12-18 08:32:52 +01:00
gFacilityTrainerMons [ DOME_MONS [ i ] [ j ] ] . evSpread ,
gFacilityTrainerMons [ DOME_MONS [ i ] [ j ] ] . nature ,
2018-08-18 18:23:40 +02:00
statValues ) ;
2019-12-21 10:27:12 +01:00
rankingScores [ i ] + = statValues [ STAT_ATK ] ;
rankingScores [ i ] + = statValues [ STAT_DEF ] ;
rankingScores [ i ] + = statValues [ STAT_SPATK ] ;
rankingScores [ i ] + = statValues [ STAT_SPDEF ] ;
rankingScores [ i ] + = statValues [ STAT_SPEED ] ;
rankingScores [ i ] + = statValues [ STAT_HP ] ;
2019-12-18 08:32:52 +01:00
monTypesBits | = gBitTable [ gBaseStats [ gFacilityTrainerMons [ DOME_MONS [ i ] [ j ] ] . species ] . type1 ] ;
monTypesBits | = gBitTable [ gBaseStats [ gFacilityTrainerMons [ DOME_MONS [ i ] [ j ] ] . species ] . type2 ] ;
2018-08-18 18:23:40 +02:00
}
for ( monTypesCount = 0 , j = 0 ; j < 32 ; j + + )
{
if ( monTypesBits & 1 )
monTypesCount + + ;
monTypesBits > > = 1 ;
2018-08-15 15:49:50 +02:00
}
2019-12-21 10:27:12 +01:00
rankingScores [ i ] + = ( monTypesCount * monLevel ) / 20 ;
2018-08-15 15:49:50 +02:00
}
2019-12-21 10:27:12 +01:00
// Seed tourney trainers according to their ranking
2018-08-18 18:23:40 +02:00
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT - 1 ; i + + )
{
for ( j = i + 1 ; j < DOME_TOURNAMENT_TRAINERS_COUNT ; j + + )
{
2019-12-21 10:27:12 +01:00
if ( rankingScores [ i ] < rankingScores [ j ] )
2018-08-18 18:23:40 +02:00
{
2019-12-21 10:27:12 +01:00
SwapDomeTrainers ( i , j , rankingScores ) ;
2018-08-18 18:23:40 +02:00
}
else
{
2019-12-21 10:27:12 +01:00
if ( rankingScores [ i ] = = rankingScores [ j ] )
2018-08-18 18:23:40 +02:00
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ j ] . trainerId = = TRAINER_PLAYER )
2019-12-21 10:27:12 +01:00
SwapDomeTrainers ( i , j , rankingScores ) ;
2019-12-18 08:32:52 +01:00
else if ( DOME_TRAINERS [ i ] . trainerId > DOME_TRAINERS [ j ] . trainerId )
2019-12-21 10:27:12 +01:00
SwapDomeTrainers ( i , j , rankingScores ) ;
2018-08-18 18:23:40 +02:00
}
}
}
}
2019-12-21 10:27:12 +01:00
// Add Frontier Brain to the tourney if they should be fought at the end of it
2019-11-21 03:46:29 +01:00
if ( GetFrontierBrainStatus ( ) ! = FRONTIER_BRAIN_NOT_READY )
2018-08-18 18:23:40 +02:00
{
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ i ] . trainerId = = TRAINER_PLAYER )
2018-08-18 18:23:40 +02:00
break ;
}
2019-12-21 10:27:12 +01:00
// if i != 0, the below conditional is always TRUE
2018-08-18 18:23:40 +02:00
if ( gUnknown_0860D3F1 [ i ] [ 0 ] ! = 0 )
{
j = 0 ;
2019-12-18 08:32:52 +01:00
DOME_TRAINERS [ j ] . trainerId = TRAINER_FRONTIER_BRAIN ;
2018-08-18 18:23:40 +02:00
}
else
{
j = 1 ;
2019-12-18 08:32:52 +01:00
DOME_TRAINERS [ j ] . trainerId = TRAINER_FRONTIER_BRAIN ;
2018-08-18 18:23:40 +02:00
}
2019-11-29 03:09:35 +01:00
for ( i = 0 ; i < FRONTIER_PARTY_SIZE ; i + + )
2019-12-18 08:32:52 +01:00
DOME_MONS [ j ] [ i ] = GetFrontierBrainMonSpecies ( i ) ;
2018-08-18 18:23:40 +02:00
}
2019-12-21 10:27:12 +01:00
Free ( rankingScores ) ;
2018-08-18 18:23:40 +02:00
Free ( statValues ) ;
2018-08-15 15:49:50 +02:00
}
# define CALC_STAT(base, statIndex) \
{ \
u8 baseStat = gBaseStats [ species ] . base ; \
stats [ statIndex ] = ( ( ( 2 * baseStat + ivs + evs [ statIndex ] / 4 ) * level ) / 100 ) + 5 ; \
stats [ statIndex ] = ( u8 ) ModifyStatByNature ( nature , stats [ statIndex ] , statIndex ) ; \
}
2019-02-08 18:08:25 +01:00
static void CalcDomeMonStats ( u16 species , int level , int ivs , u8 evBits , u8 nature , int * stats )
2018-08-15 15:49:50 +02:00
{
2019-02-08 18:08:25 +01:00
int i , count ;
2018-08-15 15:49:50 +02:00
u8 bits ;
u16 resultingEvs ;
2019-02-08 18:08:25 +01:00
int evs [ NUM_STATS ] ;
2018-08-15 15:49:50 +02:00
count = 0 , bits = evBits ;
2018-11-18 20:00:36 +01:00
for ( i = 0 ; i < NUM_STATS ; bits > > = 1 , i + + )
2018-08-15 15:49:50 +02:00
{
if ( bits & 1 )
count + + ;
}
2018-08-29 20:38:54 +02:00
resultingEvs = MAX_TOTAL_EVS / count ;
2018-11-18 20:00:36 +01:00
for ( i = 0 ; i < NUM_STATS ; bits < < = 1 , i + + )
2018-08-15 15:49:50 +02:00
{
evs [ i ] = 0 ;
if ( evBits & bits )
evs [ i ] = resultingEvs ;
}
if ( species = = SPECIES_SHEDINJA )
{
stats [ STAT_HP ] = 1 ;
}
else
{
2019-02-08 18:08:25 +01:00
int n = 2 * gBaseStats [ species ] . baseHP ;
2018-08-15 15:49:50 +02:00
stats [ STAT_HP ] = ( ( ( n + ivs + evs [ STAT_HP ] / 4 ) * level ) / 100 ) + level + 10 ;
}
CALC_STAT ( baseAttack , STAT_ATK ) ;
CALC_STAT ( baseDefense , STAT_DEF ) ;
CALC_STAT ( baseSpeed , STAT_SPEED ) ;
CALC_STAT ( baseSpAttack , STAT_SPATK ) ;
CALC_STAT ( baseSpDefense , STAT_SPDEF ) ;
}
2019-02-08 18:08:25 +01:00
static void SwapDomeTrainers ( int id1 , int id2 , u16 * statsArray )
2018-08-15 15:49:50 +02:00
{
2019-02-08 18:08:25 +01:00
int i ;
2018-08-15 15:49:50 +02:00
u16 temp ;
2018-08-30 15:01:07 +02:00
SWAP ( statsArray [ id1 ] , statsArray [ id2 ] , temp ) ;
2019-12-18 08:32:52 +01:00
SWAP ( DOME_TRAINERS [ id1 ] . trainerId , DOME_TRAINERS [ id2 ] . trainerId , temp ) ;
2018-08-15 15:49:50 +02:00
2019-12-18 08:32:52 +01:00
for ( i = 0 ; i < FRONTIER_PARTY_SIZE ; i + + )
SWAP ( DOME_MONS [ id1 ] [ i ] , DOME_MONS [ id2 ] [ i ] , temp ) ;
2018-08-15 15:49:50 +02:00
}
2018-08-15 23:04:46 +02:00
2019-02-08 18:08:25 +01:00
static void BufferDomeRoundText ( void )
2018-08-15 23:04:46 +02:00
{
2018-10-21 00:06:42 +02:00
StringCopy ( gStringVar1 , gRoundsStringTable [ gSaveBlock2Ptr - > frontier . curChallengeBattleNum ] ) ;
2018-08-15 23:04:46 +02:00
}
2019-02-08 18:08:25 +01:00
static void BufferDomeOpponentName ( void )
2018-08-15 23:04:46 +02:00
{
2018-10-21 00:06:42 +02:00
StringCopy ( gStringVar1 , gRoundsStringTable [ gSaveBlock2Ptr - > frontier . curChallengeBattleNum ] ) ;
2018-08-25 11:55:16 +02:00
CopyDomeTrainerName ( gStringVar2 , gTrainerBattleOpponent_A ) ;
2018-08-15 23:04:46 +02:00
}
2019-02-08 18:08:25 +01:00
static void InitDomeOpponentParty ( void )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
gPlayerPartyLostHP = 0 ;
sPlayerPartyMaxHP = GetMonData ( & gPlayerParty [ 0 ] , MON_DATA_MAX_HP , NULL ) ;
sPlayerPartyMaxHP + = GetMonData ( & gPlayerParty [ 1 ] , MON_DATA_MAX_HP , NULL ) ;
2018-08-15 23:04:46 +02:00
CalculatePlayerPartyCount ( ) ;
2019-02-08 18:08:25 +01:00
CreateDomeOpponentMons ( TrainerIdToTournamentId ( gTrainerBattleOpponent_A ) ) ;
2018-08-15 23:04:46 +02:00
}
2019-02-08 18:08:25 +01:00
static void CreateDomeOpponentMon ( u8 monPartyId , u16 tournamentTrainerId , u8 tournamentMonId , u32 otId )
2018-08-15 23:04:46 +02:00
{
2019-02-08 18:08:25 +01:00
int i ;
2019-12-18 08:32:52 +01:00
u8 friendship = MAX_FRIENDSHIP ;
u8 fixedIv = GetDomeTrainerMonIvs ( tournamentTrainerId ) ; // BUG: Should be using DOME_TRAINERS[tournamentTrainerId].trainerId instead of tournamentTrainerId. As a result, all Pokemon have ivs of 3.
2018-10-24 23:14:45 +02:00
u8 level = SetFacilityPtrsGetLevel ( ) ;
2018-11-11 16:44:27 +01:00
CreateMonWithEVSpreadNatureOTID ( & gEnemyParty [ monPartyId ] ,
2019-12-18 08:32:52 +01:00
gFacilityTrainerMons [ DOME_MONS [ tournamentTrainerId ] [ tournamentMonId ] ] . species ,
2018-08-15 23:04:46 +02:00
level ,
2019-12-18 08:32:52 +01:00
gFacilityTrainerMons [ DOME_MONS [ tournamentTrainerId ] [ tournamentMonId ] ] . nature ,
2018-08-15 23:04:46 +02:00
fixedIv ,
2019-12-18 08:32:52 +01:00
gFacilityTrainerMons [ DOME_MONS [ tournamentTrainerId ] [ tournamentMonId ] ] . evSpread , otId ) ;
2018-08-15 23:04:46 +02:00
2019-12-18 08:32:52 +01:00
friendship = MAX_FRIENDSHIP ;
2018-12-25 18:50:15 +01:00
for ( i = 0 ; i < MAX_MON_MOVES ; i + + )
2018-08-15 23:04:46 +02:00
{
SetMonMoveSlot ( & gEnemyParty [ monPartyId ] ,
2019-12-18 08:32:52 +01:00
gFacilityTrainerMons [ DOME_MONS [ tournamentTrainerId ] [ tournamentMonId ] ] . moves [ i ] , i ) ;
if ( gFacilityTrainerMons [ DOME_MONS [ tournamentTrainerId ] [ tournamentMonId ] ] . moves [ i ] = = MOVE_FRUSTRATION )
friendship = 0 ;
2018-08-15 23:04:46 +02:00
}
2019-12-18 08:32:52 +01:00
SetMonData ( & gEnemyParty [ monPartyId ] , MON_DATA_FRIENDSHIP , & friendship ) ;
2018-08-15 23:04:46 +02:00
SetMonData ( & gEnemyParty [ monPartyId ] , MON_DATA_HELD_ITEM ,
2019-12-18 08:32:52 +01:00
& gBattleFrontierHeldItems [ gFacilityTrainerMons [ DOME_MONS [ tournamentTrainerId ] [ tournamentMonId ] ] . itemTableId ] ) ;
2018-08-15 23:04:46 +02:00
}
2019-02-08 18:08:25 +01:00
static void CreateDomeOpponentMons ( u16 tournamentTrainerId )
2018-08-15 23:04:46 +02:00
{
u8 monsCount = 0 ;
u32 otId = 0 ;
2019-12-18 08:32:52 +01:00
int i , selectedMonBits ;
2018-08-15 23:04:46 +02:00
ZeroEnemyPartyMons ( ) ;
2019-12-18 08:32:52 +01:00
selectedMonBits = GetDomeTrainerSelectedMons ( tournamentTrainerId ) ;
2018-08-15 23:04:46 +02:00
otId = Random32 ( ) ;
2019-12-18 08:32:52 +01:00
2018-08-15 23:04:46 +02:00
if ( Random ( ) % 10 > 5 )
{
2019-12-18 08:32:52 +01:00
// Create mon if it was selected, starting from front
for ( i = 0 ; i < FRONTIER_PARTY_SIZE ; i + + )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
if ( selectedMonBits & 1 )
2018-08-15 23:04:46 +02:00
{
2019-02-08 18:08:25 +01:00
CreateDomeOpponentMon ( monsCount , tournamentTrainerId , i , otId ) ;
2018-08-15 23:04:46 +02:00
monsCount + + ;
}
2019-12-18 08:32:52 +01:00
selectedMonBits > > = 1 ;
2018-08-15 23:04:46 +02:00
}
}
else
{
2019-12-18 08:32:52 +01:00
// Create mon if it was selected, starting from back
for ( i = FRONTIER_PARTY_SIZE - 1 ; i > = 0 ; i - - )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
if ( selectedMonBits & 4 )
2018-08-15 23:04:46 +02:00
{
2019-02-08 18:08:25 +01:00
CreateDomeOpponentMon ( monsCount , tournamentTrainerId , i , otId ) ;
2018-08-15 23:04:46 +02:00
monsCount + + ;
}
2019-12-18 08:32:52 +01:00
selectedMonBits < < = 1 ;
2018-08-15 23:04:46 +02:00
}
}
}
2019-12-18 08:32:52 +01:00
int GetDomeTrainerSelectedMons ( u16 tournamentTrainerId )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
int selectedMonBits ;
2018-08-15 23:04:46 +02:00
if ( Random ( ) & 1 )
{
2019-12-18 08:32:52 +01:00
selectedMonBits = sub_818FCBC ( tournamentTrainerId , FALSE ) ;
if ( selectedMonBits = = 0 )
selectedMonBits = sub_818FDB8 ( tournamentTrainerId , TRUE ) ;
2018-08-15 23:04:46 +02:00
}
else
{
2019-12-18 08:32:52 +01:00
selectedMonBits = sub_818FDB8 ( tournamentTrainerId , FALSE ) ;
if ( selectedMonBits = = 0 )
selectedMonBits = sub_818FCBC ( tournamentTrainerId , TRUE ) ;
2018-08-15 23:04:46 +02:00
}
2019-12-18 08:32:52 +01:00
return selectedMonBits ;
2018-08-15 23:04:46 +02:00
}
2019-12-18 08:32:52 +01:00
static int sub_818FCBC ( u16 tournamentTrainerId , bool8 allowRandom )
2018-08-15 23:04:46 +02:00
{
2019-02-08 18:08:25 +01:00
int i , moveId , playerMonId ;
2019-12-18 08:32:52 +01:00
int partyMovePoints [ FRONTIER_PARTY_SIZE ] ;
2018-08-15 23:04:46 +02:00
2019-11-29 03:09:35 +01:00
for ( i = 0 ; i < FRONTIER_PARTY_SIZE ; i + + )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
partyMovePoints [ i ] = 0 ;
2018-12-25 18:50:15 +01:00
for ( moveId = 0 ; moveId < MAX_MON_MOVES ; moveId + + )
2018-08-15 23:04:46 +02:00
{
2019-11-29 03:09:35 +01:00
for ( playerMonId = 0 ; playerMonId < FRONTIER_PARTY_SIZE ; playerMonId + + )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ tournamentTrainerId ] . trainerId = = TRAINER_FRONTIER_BRAIN )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
partyMovePoints [ i ] + = GetTypeEffectivenessPoints ( GetFrontierBrainMonMove ( i , moveId ) ,
GetMonData ( & gPlayerParty [ playerMonId ] , MON_DATA_SPECIES , NULL ) , MON_DATA_PERSONALITY ) ;
2018-08-15 23:04:46 +02:00
}
else
{
2019-12-18 08:32:52 +01:00
partyMovePoints [ i ] + = GetTypeEffectivenessPoints ( gFacilityTrainerMons [ DOME_MONS [ tournamentTrainerId ] [ i ] ] . moves [ moveId ] ,
GetMonData ( & gPlayerParty [ playerMonId ] , MON_DATA_SPECIES , NULL ) , MON_DATA_PERSONALITY ) ;
2018-08-15 23:04:46 +02:00
}
}
}
}
2019-12-18 08:32:52 +01:00
return SelectOpponentMonsFromParty ( partyMovePoints , allowRandom ) ;
2018-08-15 23:04:46 +02:00
}
2019-12-18 08:32:52 +01:00
static int sub_818FDB8 ( u16 tournamentTrainerId , bool8 allowRandom )
2018-08-15 23:04:46 +02:00
{
2019-02-08 18:08:25 +01:00
int i , moveId , playerMonId ;
2019-12-18 08:32:52 +01:00
int partyMovePoints [ FRONTIER_PARTY_SIZE ] ;
2018-08-15 23:04:46 +02:00
2019-11-29 03:09:35 +01:00
for ( i = 0 ; i < FRONTIER_PARTY_SIZE ; i + + )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
partyMovePoints [ i ] = 0 ;
2018-12-25 18:50:15 +01:00
for ( moveId = 0 ; moveId < MAX_MON_MOVES ; moveId + + )
2018-08-15 23:04:46 +02:00
{
2019-11-29 03:09:35 +01:00
for ( playerMonId = 0 ; playerMonId < FRONTIER_PARTY_SIZE ; playerMonId + + )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ tournamentTrainerId ] . trainerId = = TRAINER_FRONTIER_BRAIN )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
partyMovePoints [ i ] + = GetTypeEffectivenessPoints ( GetFrontierBrainMonMove ( i , moveId ) ,
GetMonData ( & gPlayerParty [ playerMonId ] , MON_DATA_SPECIES , NULL ) , MON_DATA_OT_ID ) ;
2018-08-15 23:04:46 +02:00
}
else
{
2019-12-18 08:32:52 +01:00
partyMovePoints [ i ] + = GetTypeEffectivenessPoints ( gFacilityTrainerMons [ DOME_MONS [ tournamentTrainerId ] [ i ] ] . moves [ moveId ] ,
GetMonData ( & gPlayerParty [ playerMonId ] , MON_DATA_SPECIES , NULL ) , MON_DATA_OT_ID ) ;
2018-08-15 23:04:46 +02:00
}
}
}
}
2019-12-18 08:32:52 +01:00
return SelectOpponentMonsFromParty ( partyMovePoints , allowRandom ) ;
2018-08-15 23:04:46 +02:00
}
2019-12-18 08:32:52 +01:00
static int SelectOpponentMonsFromParty ( int * partyMovePoints , bool8 allowRandom )
2018-08-15 23:04:46 +02:00
{
2019-02-08 18:08:25 +01:00
int i , j ;
2019-12-18 08:32:52 +01:00
int selectedMonBits = 0 ;
int partyPositions [ FRONTIER_PARTY_SIZE ] ;
2018-08-15 23:04:46 +02:00
2019-12-18 08:32:52 +01:00
for ( i = 0 ; i < FRONTIER_PARTY_SIZE ; i + + )
partyPositions [ i ] = i ;
2018-08-15 23:04:46 +02:00
2019-12-18 08:32:52 +01:00
// All party mons have equal move score totals, choose randomly
if ( partyMovePoints [ 0 ] = = partyMovePoints [ 1 ]
& & partyMovePoints [ 0 ] = = partyMovePoints [ 2 ] )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
if ( allowRandom )
2018-08-15 23:04:46 +02:00
{
i = 0 ;
2019-12-18 08:32:52 +01:00
while ( i ! = DOME_BATTLE_PARTY_SIZE )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
u32 rand = Random ( ) & FRONTIER_PARTY_SIZE ;
if ( rand ! = FRONTIER_PARTY_SIZE & & ! ( selectedMonBits & gBitTable [ rand ] ) )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
selectedMonBits | = gBitTable [ rand ] ;
2018-08-15 23:04:46 +02:00
i + + ;
}
}
}
}
else
{
2019-12-18 08:32:52 +01:00
for ( i = 0 ; i < DOME_BATTLE_PARTY_SIZE ; i + + )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
for ( j = i + 1 ; j < FRONTIER_PARTY_SIZE ; j + + )
2018-08-15 23:04:46 +02:00
{
2019-02-08 18:08:25 +01:00
int temp ;
2018-08-15 23:04:46 +02:00
2019-12-18 08:32:52 +01:00
if ( partyMovePoints [ i ] < partyMovePoints [ j ] )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
SWAP ( partyMovePoints [ i ] , partyMovePoints [ j ] , temp )
SWAP ( partyPositions [ i ] , partyPositions [ j ] , temp )
2018-08-15 23:04:46 +02:00
}
2019-12-18 08:32:52 +01:00
if ( partyMovePoints [ i ] = = partyMovePoints [ j ] & & ( Random ( ) & 1 ) )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
SWAP ( partyMovePoints [ i ] , partyMovePoints [ j ] , temp )
SWAP ( partyPositions [ i ] , partyPositions [ j ] , temp )
2018-08-15 23:04:46 +02:00
}
}
}
2019-12-18 08:32:52 +01:00
for ( i = 0 ; i < DOME_BATTLE_PARTY_SIZE ; i + + )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
selectedMonBits | = gBitTable [ partyPositions [ i ] ] ;
2018-08-15 23:04:46 +02:00
}
}
2019-12-18 08:32:52 +01:00
return selectedMonBits ;
2018-08-15 23:04:46 +02:00
}
2018-08-26 21:41:47 +02:00
# define TYPE_x0 0
# define TYPE_x0_25 5
# define TYPE_x0_50 10
# define TYPE_x1 20
# define TYPE_x2 40
# define TYPE_x4 80
2018-08-18 00:54:18 +02:00
// Functionally equivalent, while loop is impossible to match.
2019-12-18 08:32:52 +01:00
// arg2 is either 2, a personality, or an OTID
2018-08-18 00:54:18 +02:00
# ifdef NONMATCHING
2019-02-08 18:08:25 +01:00
static int GetTypeEffectivenessPoints ( int move , int targetSpecies , int arg2 )
2018-08-15 23:04:46 +02:00
{
2019-02-08 18:08:25 +01:00
int defType1 , defType2 , defAbility , moveType ;
int i = 0 ;
int typePower = TYPE_x1 ;
2018-08-15 23:04:46 +02:00
2018-12-05 15:31:01 +01:00
if ( move = = MOVE_NONE | | move = = 0xFFFF | | gBattleMoves [ move ] . power = = 0 )
2018-08-15 23:04:46 +02:00
return 0 ;
2018-08-26 21:41:47 +02:00
defType1 = gBaseStats [ targetSpecies ] . type1 ;
defType2 = gBaseStats [ targetSpecies ] . type2 ;
2019-05-14 15:42:55 +02:00
defAbility = gBaseStats [ targetSpecies ] . abilities [ 0 ] ;
2018-08-15 23:04:46 +02:00
moveType = gBattleMoves [ move ] . type ;
2018-08-26 21:41:47 +02:00
if ( defAbility = = ABILITY_LEVITATE & & moveType = = TYPE_GROUND )
2018-08-15 23:04:46 +02:00
{
if ( arg2 = = 1 )
typePower = 8 ;
}
else
{
2019-12-18 08:32:52 +01:00
while ( TYPE_EFFECT_ATK_TYPE ( i ) ! = TYPE_ENDTABLE )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
if ( TYPE_EFFECT_ATK_TYPE ( i ) = = TYPE_FORESIGHT )
2018-08-15 23:04:46 +02:00
{
i + = 3 ;
2019-12-18 08:32:52 +01:00
continue ;
2018-08-15 23:04:46 +02:00
}
2019-12-18 08:32:52 +01:00
else if ( TYPE_EFFECT_ATK_TYPE ( i ) = = moveType )
2018-08-15 23:04:46 +02:00
{
2019-12-18 08:32:52 +01:00
// BUG: * 2 is not necessary and makes the condition always false if the ability is wonder guard.
if ( TYPE_EFFECT_DEF_TYPE ( i ) = = defType1 & & ( defAbility ! = ABILITY_WONDER_GUARD | | TYPE_EFFECT_MULTIPLIER ( i ) = = TYPE_MUL_SUPER_EFFECTIVE * 2 ) )
typePower = ( typePower * TYPE_EFFECT_MULTIPLIER ( i ) ) / 10 ;
if ( TYPE_EFFECT_DEF_TYPE ( i ) = = defType2 & & defType1 ! = defType2 & & ( defAbility ! = ABILITY_WONDER_GUARD | | TYPE_EFFECT_MULTIPLIER ( i ) = = TYPE_MUL_SUPER_EFFECTIVE * 2 ) )
typePower = ( typePower * TYPE_EFFECT_MULTIPLIER ( i ) ) / 10 ;
2018-08-15 23:04:46 +02:00
}
2019-12-18 08:32:52 +01:00
i + = 3 ;
2018-08-15 23:04:46 +02:00
}
}
switch ( arg2 )
{
case 0 :
switch ( typePower )
{
2019-12-18 08:32:52 +01:00
case TYPE_x0_50 :
case TYPE_x0_25 :
case TYPE_x0 :
2018-08-15 23:04:46 +02:00
default :
typePower = 0 ;
break ;
2019-12-18 08:32:52 +01:00
case TYPE_x1 :
2018-08-15 23:04:46 +02:00
typePower = 2 ;
break ;
2019-12-18 08:32:52 +01:00
case TYPE_x2 :
2018-08-15 23:04:46 +02:00
typePower = 4 ;
break ;
2019-12-18 08:32:52 +01:00
case TYPE_x4 :
2018-08-15 23:04:46 +02:00
typePower = 8 ;
break ;
}
break ;
case 1 :
switch ( typePower )
{
default :
2019-12-18 08:32:52 +01:00
case TYPE_x1 :
2018-08-15 23:04:46 +02:00
typePower = 0 ;
break ;
2019-12-18 08:32:52 +01:00
case TYPE_x0_25 :
2018-08-15 23:04:46 +02:00
typePower = 4 ;
break ;
2019-12-18 08:32:52 +01:00
case TYPE_x0 :
2018-08-15 23:04:46 +02:00
typePower = 8 ;
break ;
2019-12-18 08:32:52 +01:00
case TYPE_x0_50 :
2018-08-15 23:04:46 +02:00
typePower = 2 ;
break ;
2019-12-18 08:32:52 +01:00
case TYPE_x2 :
2018-08-15 23:04:46 +02:00
typePower = - 2 ;
break ;
2019-12-18 08:32:52 +01:00
case TYPE_x4 :
2018-08-15 23:04:46 +02:00
typePower = - 4 ;
break ;
}
break ;
case 2 :
switch ( typePower )
{
2018-08-26 21:41:47 +02:00
case TYPE_x0 :
2018-08-15 23:04:46 +02:00
typePower = - 16 ;
break ;
2018-08-26 21:41:47 +02:00
case TYPE_x0_25 :
2018-08-15 23:04:46 +02:00
typePower = - 8 ;
break ;
2018-08-26 21:41:47 +02:00
case TYPE_x0_50 :
2018-08-15 23:04:46 +02:00
default :
typePower = 0 ;
break ;
2018-08-26 21:41:47 +02:00
case TYPE_x1 :
2018-08-15 23:04:46 +02:00
typePower = 4 ;
break ;
2018-08-26 21:41:47 +02:00
case TYPE_x2 :
2018-08-15 23:04:46 +02:00
typePower = 12 ;
break ;
2018-08-26 21:41:47 +02:00
case TYPE_x4 :
2018-08-15 23:04:46 +02:00
typePower = 20 ;
break ;
}
break ;
}
return typePower ;
2018-08-16 22:46:02 +02:00
}
2018-08-18 00:54:18 +02:00
# else
NAKED
2019-02-08 18:08:25 +01:00
static int GetTypeEffectivenessPoints ( int move , int species , int arg2 )
2018-08-18 00:54:18 +02:00
{
asm_unified ( " \n \
2018-12-05 15:31:01 +01:00
push { r4 - r7 , lr } \ n \
mov r7 , r10 \ n \
mov r6 , r9 \ n \
mov r5 , r8 \ n \
push { r5 - r7 } \ n \
sub sp , 0x8 \ n \
adds r3 , r0 , 0 \ n \
adds r4 , r1 , 0 \ n \
str r2 , [ sp ] \ n \
movs r6 , 0 \ n \
movs r2 , 0x14 \ n \
cmp r3 , 0 \ n \
beq _0818FFF0 \ n \
ldr r0 , = 0x0000ffff \ n \
cmp r3 , r0 \ n \
beq _0818FFF0 \ n \
ldr r0 , = gBattleMoves \ n \
lsls r1 , r3 , 1 \ n \
adds r1 , r3 \ n \
lsls r1 , 2 \ n \
adds r3 , r1 , r0 \ n \
ldrb r0 , [ r3 , 0x1 ] \ n \
cmp r0 , 0 \ n \
bne _0818FFFC \ n \
2018-08-18 00:54:18 +02:00
_0818FFF0 : \ n \
2018-12-05 15:31:01 +01:00
movs r0 , 0 \ n \
b _08190156 \ n \
. pool \ n \
2018-08-18 00:54:18 +02:00
_0818FFFC : \ n \
2018-12-05 15:31:01 +01:00
ldr r1 , = gBaseStats \ n \
lsls r0 , r4 , 3 \ n \
subs r0 , r4 \ n \
lsls r0 , 2 \ n \
adds r0 , r1 \ n \
ldrb r1 , [ r0 , 0x6 ] \ n \
mov r10 , r1 \ n \
ldrb r1 , [ r0 , 0x7 ] \ n \
mov r9 , r1 \ n \
ldrb r0 , [ r0 , 0x16 ] \ n \
mov r8 , r0 \ n \
ldrb r3 , [ r3 , 0x2 ] \ n \
str r3 , [ sp , 0x4 ] \ n \
cmp r0 , 0x1A \ n \
bne _0819002C \ n \
cmp r3 , 0x4 \ n \
bne _0819002C \ n \
ldr r0 , [ sp ] \ n \
cmp r0 , 0x1 \ n \
bne _081900AA \ n \
movs r2 , 0x8 \ n \
b _081900A4 \ n \
. pool \ n \
2018-08-18 00:54:18 +02:00
_0819002C : \ n \
2018-12-05 15:31:01 +01:00
ldr r0 , = gTypeEffectiveness \ n \
adds r1 , r6 , r0 \ n \
ldrb r0 , [ r1 ] \ n \
ldr r7 , = gTypeEffectiveness \ n \
cmp r0 , 0xFF \ n \
beq _081900A4 \ n \
adds r4 , r1 , 0 \ n \
2018-08-18 00:54:18 +02:00
_0819003A : \ n \
2018-12-05 15:31:01 +01:00
ldrb r0 , [ r4 ] \ n \
cmp r0 , 0xFE \ n \
beq _08190096 \ n \
ldrb r0 , [ r4 ] \ n \
ldr r1 , [ sp , 0x4 ] \ n \
cmp r0 , r1 \ n \
bne _08190096 \ n \
ldrb r0 , [ r4 , 0x1 ] \ n \
adds r5 , r6 , 0x1 \ n \
cmp r0 , r10 \ n \
bne _0819006C \ n \
adds r1 , r6 , 0x2 \ n \
mov r0 , r8 \ n \
cmp r0 , 0x19 \ n \
bne _0819005E \ n \
ldrb r0 , [ r4 , 0x2 ] \ n \
cmp r0 , 0x28 \ n \
bne _0819006C \ n \
2018-08-18 00:54:18 +02:00
_0819005E : \ n \
2018-12-05 15:31:01 +01:00
adds r0 , r1 , r7 \ n \
ldrb r0 , [ r0 ] \ n \
muls r0 , r2 \ n \
movs r1 , 0xA \ n \
bl __divsi3 \ n \
adds r2 , r0 , 0 \ n \
2018-08-18 00:54:18 +02:00
_0819006C : \ n \
2018-12-05 15:31:01 +01:00
adds r0 , r5 , r7 \ n \
ldrb r0 , [ r0 ] \ n \
cmp r0 , r9 \ n \
bne _08190096 \ n \
cmp r10 , r9 \ n \
beq _08190096 \ n \
adds r1 , r6 , 0x2 \ n \
mov r0 , r8 \ n \
cmp r0 , 0x19 \ n \
bne _08190088 \ n \
adds r0 , r1 , r7 \ n \
ldrb r0 , [ r0 ] \ n \
cmp r0 , 0x28 \ n \
bne _08190096 \ n \
2018-08-18 00:54:18 +02:00
_08190088 : \ n \
2018-12-05 15:31:01 +01:00
adds r0 , r1 , r7 \ n \
ldrb r0 , [ r0 ] \ n \
muls r0 , r2 \ n \
movs r1 , 0xA \ n \
bl __divsi3 \ n \
adds r2 , r0 , 0 \ n \
2018-08-18 00:54:18 +02:00
_08190096 : \ n \
2018-12-05 15:31:01 +01:00
adds r4 , 0x3 \ n \
adds r6 , 0x3 \ n \
ldr r1 , = gTypeEffectiveness \ n \
adds r0 , r6 , r1 \ n \
ldrb r0 , [ r0 ] \ n \
cmp r0 , 0xFF \ n \
bne _0819003A \ n \
2018-08-18 00:54:18 +02:00
_081900A4 : \ n \
2018-12-05 15:31:01 +01:00
ldr r0 , [ sp ] \ n \
cmp r0 , 0x1 \ n \
beq _081900E0 \ n \
2018-08-18 00:54:18 +02:00
_081900AA : \ n \
2018-12-05 15:31:01 +01:00
ldr r1 , [ sp ] \ n \
cmp r1 , 0x1 \ n \
bgt _081900BC \ n \
cmp r1 , 0 \ n \
beq _081900C4 \ n \
b _08190154 \ n \
. pool \ n \
2018-08-18 00:54:18 +02:00
_081900BC : \ n \
2018-12-05 15:31:01 +01:00
ldr r0 , [ sp ] \ n \
cmp r0 , 0x2 \ n \
beq _08190114 \ n \
b _08190154 \ n \
2018-08-18 00:54:18 +02:00
_081900C4 : \ n \
2018-12-05 15:31:01 +01:00
cmp r2 , 0xA \ n \
beq _08190146 \ n \
cmp r2 , 0xA \ n \
ble _08190146 \ n \
cmp r2 , 0x28 \ n \
beq _0819014A \ n \
cmp r2 , 0x28 \ n \
bgt _081900DA \ n \
cmp r2 , 0x14 \ n \
beq _08190104 \ n \
b _08190146 \ n \
2018-08-18 00:54:18 +02:00
_081900DA : \ n \
2018-12-05 15:31:01 +01:00
cmp r2 , 0x50 \ n \
bne _08190146 \ n \
b _08190100 \ n \
2018-08-18 00:54:18 +02:00
_081900E0 : \ n \
2018-12-05 15:31:01 +01:00
cmp r2 , 0xA \ n \
beq _08190104 \ n \
cmp r2 , 0xA \ n \
bgt _081900F2 \ n \
cmp r2 , 0 \ n \
beq _08190100 \ n \
cmp r2 , 0x5 \ n \
beq _0819014A \ n \
b _08190146 \ n \
2018-08-18 00:54:18 +02:00
_081900F2 : \ n \
2018-12-05 15:31:01 +01:00
cmp r2 , 0x28 \ n \
beq _08190108 \ n \
cmp r2 , 0x28 \ n \
ble _08190146 \ n \
cmp r2 , 0x50 \ n \
beq _0819010E \ n \
b _08190146 \ n \
2018-08-18 00:54:18 +02:00
_08190100 : \ n \
2018-12-05 15:31:01 +01:00
movs r2 , 0x8 \ n \
b _08190154 \ n \
2018-08-18 00:54:18 +02:00
_08190104 : \ n \
2018-12-05 15:31:01 +01:00
movs r2 , 0x2 \ n \
b _08190154 \ n \
2018-08-18 00:54:18 +02:00
_08190108 : \ n \
2018-12-05 15:31:01 +01:00
movs r2 , 0x2 \ n \
negs r2 , r2 \ n \
b _08190154 \ n \
2018-08-18 00:54:18 +02:00
_0819010E : \ n \
2018-12-05 15:31:01 +01:00
movs r2 , 0x4 \ n \
negs r2 , r2 \ n \
b _08190154 \ n \
2018-08-18 00:54:18 +02:00
_08190114 : \ n \
2018-12-05 15:31:01 +01:00
cmp r2 , 0xA \ n \
beq _08190146 \ n \
cmp r2 , 0xA \ n \
bgt _08190126 \ n \
cmp r2 , 0 \ n \
beq _0819013A \ n \
cmp r2 , 0x5 \ n \
beq _08190140 \ n \
b _08190146 \ n \
2018-08-18 00:54:18 +02:00
_08190126 : \ n \
2018-12-05 15:31:01 +01:00
cmp r2 , 0x28 \ n \
beq _0819014E \ n \
cmp r2 , 0x28 \ n \
bgt _08190134 \ n \
cmp r2 , 0x14 \ n \
beq _0819014A \ n \
b _08190146 \ n \
2018-08-18 00:54:18 +02:00
_08190134 : \ n \
2018-12-05 15:31:01 +01:00
cmp r2 , 0x50 \ n \
beq _08190152 \ n \
b _08190146 \ n \
2018-08-18 00:54:18 +02:00
_0819013A : \ n \
2018-12-05 15:31:01 +01:00
movs r2 , 0x10 \ n \
negs r2 , r2 \ n \
b _08190154 \ n \
2018-08-18 00:54:18 +02:00
_08190140 : \ n \
2018-12-05 15:31:01 +01:00
movs r2 , 0x8 \ n \
negs r2 , r2 \ n \
b _08190154 \ n \
2018-08-18 00:54:18 +02:00
_08190146 : \ n \
2018-12-05 15:31:01 +01:00
movs r2 , 0 \ n \
b _08190154 \ n \
2018-08-18 00:54:18 +02:00
_0819014A : \ n \
2018-12-05 15:31:01 +01:00
movs r2 , 0x4 \ n \
b _08190154 \ n \
2018-08-18 00:54:18 +02:00
_0819014E : \ n \
2018-12-05 15:31:01 +01:00
movs r2 , 0xC \ n \
b _08190154 \ n \
2018-08-18 00:54:18 +02:00
_08190152 : \ n \
2018-12-05 15:31:01 +01:00
movs r2 , 0x14 \ n \
2018-08-18 00:54:18 +02:00
_08190154 : \ n \
2018-12-05 15:31:01 +01:00
adds r0 , r2 , 0 \ n \
2018-08-18 00:54:18 +02:00
_08190156 : \ n \
2018-12-05 15:31:01 +01:00
add sp , 0x8 \ n \
pop { r3 - r5 } \ n \
mov r8 , r3 \ n \
mov r9 , r4 \ n \
mov r10 , r5 \ n \
pop { r4 - r7 } \ n \
pop { r1 } \ n \
bx r1 \ n \
2018-08-18 00:54:18 +02:00
" );
}
# endif // NONMATCHING
2019-12-21 00:52:29 +01:00
// Duplicate of GetFrontierTrainerFixedIvs
// NOTE: In CreateDomeOpponentMon a tournament trainer ID (0-15) is passed instead, resulting in all IVs of 3
2018-08-25 19:59:47 +02:00
static u8 GetDomeTrainerMonIvs ( u16 trainerId )
2018-08-18 00:54:18 +02:00
{
u8 fixedIv ;
2019-12-21 00:52:29 +01:00
if ( trainerId < = FRONTIER_TRAINER_JILL ) // 0 - 99
2018-08-18 00:54:18 +02:00
fixedIv = 3 ;
2019-12-21 00:52:29 +01:00
else if ( trainerId < = FRONTIER_TRAINER_CHLOE ) // 100 - 119
2018-08-18 00:54:18 +02:00
fixedIv = 6 ;
2019-12-21 00:52:29 +01:00
else if ( trainerId < = FRONTIER_TRAINER_SOFIA ) // 120 - 139
2018-08-18 00:54:18 +02:00
fixedIv = 9 ;
2019-12-21 00:52:29 +01:00
else if ( trainerId < = FRONTIER_TRAINER_JAZLYN ) // 140 - 159
2018-08-18 00:54:18 +02:00
fixedIv = 12 ;
2019-12-21 00:52:29 +01:00
else if ( trainerId < = FRONTIER_TRAINER_ALISON ) // 160 - 179
2018-08-18 00:54:18 +02:00
fixedIv = 15 ;
2019-12-21 00:52:29 +01:00
else if ( trainerId < = FRONTIER_TRAINER_LAMAR ) // 180 - 199
2018-08-18 00:54:18 +02:00
fixedIv = 18 ;
2019-12-21 00:52:29 +01:00
else if ( trainerId < = FRONTIER_TRAINER_TESS ) // 200 - 219
2018-08-18 00:54:18 +02:00
fixedIv = 21 ;
2019-12-21 00:52:29 +01:00
else // 220+ (- 299)
2018-08-18 00:54:18 +02:00
fixedIv = 31 ;
return fixedIv ;
}
2019-12-21 10:27:12 +01:00
// TODO: if 0xFF is returned, overflow in TrainerIdOfPlayerOpponent
2019-02-08 18:08:25 +01:00
static int TournamentIdOfOpponent ( int roundId , int trainerId )
2018-08-18 00:54:18 +02:00
{
2019-02-08 18:08:25 +01:00
int i , j , val ;
2018-08-18 00:54:18 +02:00
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ i ] . trainerId = = trainerId )
2018-08-18 00:54:18 +02:00
break ;
}
2018-08-18 19:52:25 +02:00
if ( roundId ! = DOME_ROUND1 )
2018-08-18 00:54:18 +02:00
{
2018-08-18 19:52:25 +02:00
if ( roundId = = DOME_FINAL )
2018-08-26 21:41:47 +02:00
val = sIdToOpponentId [ i ] [ roundId ] + 8 ;
2018-08-18 00:54:18 +02:00
else
2018-08-26 21:41:47 +02:00
val = sIdToOpponentId [ i ] [ roundId ] + 4 ;
2018-08-18 00:54:18 +02:00
2018-08-26 21:41:47 +02:00
for ( j = sIdToOpponentId [ i ] [ roundId ] ; j < val ; j + + )
2018-08-18 00:54:18 +02:00
{
2019-12-18 08:32:52 +01:00
if ( gUnknown_0860D14C [ j ] ! = i & & ! DOME_TRAINERS [ gUnknown_0860D14C [ j ] ] . isEliminated )
2018-08-18 00:54:18 +02:00
break ;
}
if ( j ! = val )
return gUnknown_0860D14C [ j ] ;
else
2018-12-05 15:31:01 +01:00
return 0xFF ;
2018-08-18 00:54:18 +02:00
}
else
{
2019-12-18 08:32:52 +01:00
if ( ! DOME_TRAINERS [ sIdToOpponentId [ i ] [ roundId ] ] . isEliminated )
2018-08-26 21:41:47 +02:00
return sIdToOpponentId [ i ] [ roundId ] ;
2018-08-18 00:54:18 +02:00
else
2018-12-05 15:31:01 +01:00
return 0xFF ;
2018-08-18 00:54:18 +02:00
}
}
2019-02-08 18:08:25 +01:00
static void SetDomeOpponentId ( void )
2018-08-18 00:54:18 +02:00
{
2018-08-18 19:52:25 +02:00
gTrainerBattleOpponent_A = TrainerIdOfPlayerOpponent ( ) ;
2018-08-18 00:54:18 +02:00
}
2018-08-25 19:59:47 +02:00
static u16 TrainerIdOfPlayerOpponent ( void )
2018-08-18 00:54:18 +02:00
{
2019-12-18 08:32:52 +01:00
return DOME_TRAINERS [ TournamentIdOfOpponent ( gSaveBlock2Ptr - > frontier . curChallengeBattleNum , TRAINER_PLAYER ) ] . trainerId ;
2018-08-18 00:54:18 +02:00
}
2019-02-08 18:08:25 +01:00
static void SetDomeOpponentGraphicsId ( void )
2018-08-18 00:54:18 +02:00
{
2018-10-21 00:06:42 +02:00
SetBattleFacilityTrainerGfxId ( gTrainerBattleOpponent_A , 0 ) ;
2018-08-18 00:54:18 +02:00
}
2019-11-29 03:09:35 +01:00
static void SaveDomeChallenge ( void )
2018-08-18 00:54:18 +02:00
{
2019-11-24 22:58:40 +01:00
gSaveBlock2Ptr - > frontier . challengeStatus = gSpecialVar_0x8005 ;
2018-08-18 00:54:18 +02:00
VarSet ( VAR_TEMP_0 , 0 ) ;
2019-11-24 22:58:40 +01:00
gSaveBlock2Ptr - > frontier . challengePaused = TRUE ;
SaveGameFrontier ( ) ;
2018-08-18 00:54:18 +02:00
}
2019-11-29 03:09:35 +01:00
static void IncrementDomeStreaks ( void )
2018-08-18 00:54:18 +02:00
{
2018-08-25 19:59:47 +02:00
u8 lvlMode = gSaveBlock2Ptr - > frontier . lvlMode ;
u8 battleMode = VarGet ( VAR_FRONTIER_BATTLE_MODE ) ;
2018-08-18 00:54:18 +02:00
2018-10-27 17:39:05 +02:00
if ( gSaveBlock2Ptr - > frontier . domeWinStreaks [ battleMode ] [ lvlMode ] < 999 )
gSaveBlock2Ptr - > frontier . domeWinStreaks [ battleMode ] [ lvlMode ] + + ;
if ( gSaveBlock2Ptr - > frontier . domeTotalChampionships [ battleMode ] [ lvlMode ] < 999 )
gSaveBlock2Ptr - > frontier . domeTotalChampionships [ battleMode ] [ lvlMode ] + + ;
2018-08-18 00:54:18 +02:00
2018-10-27 17:39:05 +02:00
if ( gSaveBlock2Ptr - > frontier . domeWinStreaks [ battleMode ] [ lvlMode ] > gSaveBlock2Ptr - > frontier . domeRecordWinStreaks [ battleMode ] [ lvlMode ] )
gSaveBlock2Ptr - > frontier . domeRecordWinStreaks [ battleMode ] [ lvlMode ] = gSaveBlock2Ptr - > frontier . domeWinStreaks [ battleMode ] [ lvlMode ] ;
2018-08-18 00:54:18 +02:00
}
2018-08-26 15:51:14 +02:00
static void ShowDomeOpponentInfo ( void )
2018-08-18 00:54:18 +02:00
{
2019-02-08 18:08:25 +01:00
u8 taskId = CreateTask ( Task_ShowOpponentInfo , 0 ) ;
2018-08-18 00:54:18 +02:00
gTasks [ taskId ] . data [ 0 ] = 0 ;
2018-08-18 19:52:25 +02:00
gTasks [ taskId ] . data [ 1 ] = TrainerIdToTournamentId ( TrainerIdOfPlayerOpponent ( ) ) ;
2018-08-18 00:54:18 +02:00
gTasks [ taskId ] . data [ 2 ] = 0 ;
gTasks [ taskId ] . data [ 3 ] = 0 ;
2018-08-25 11:55:16 +02:00
SetMainCallback2 ( CB2_BattleDome ) ;
2018-08-18 00:54:18 +02:00
}
2019-02-08 18:08:25 +01:00
static void Task_ShowOpponentInfo ( u8 taskId )
2018-08-18 00:54:18 +02:00
{
2019-02-08 18:08:25 +01:00
int i ;
int r5 = gTasks [ taskId ] . data [ 1 ] ;
int r9 = gTasks [ taskId ] . data [ 2 ] ;
int r7 = gTasks [ taskId ] . data [ 3 ] ;
2018-08-18 00:54:18 +02:00
switch ( gTasks [ taskId ] . data [ 0 ] )
{
case 0 :
SetHBlankCallback ( NULL ) ;
SetVBlankCallback ( NULL ) ;
EnableInterrupts ( INTR_FLAG_VBLANK ) ;
CpuFill32 ( 0 , ( void * ) VRAM , VRAM_SIZE ) ;
ResetBgsAndClearDma3BusyFlags ( 0 ) ;
2019-12-18 08:32:52 +01:00
InitBgsFromTemplates ( 0 , sOpponentInfoBgTemplates , ARRAY_COUNT ( sOpponentInfoBgTemplates ) ) ;
InitWindows ( sOpponentInfoWindowTemplates ) ;
2018-08-18 00:54:18 +02:00
DeactivateAllTextPrinters ( ) ;
gBattle_BG0_X = 0 ;
gBattle_BG0_Y = 0 ;
gBattle_BG1_X = 0 ;
gBattle_BG1_Y = 0 ;
gBattle_BG3_X = 0 ;
gBattle_BG3_Y = 0 ;
if ( r9 = = 2 )
gBattle_BG2_X = 0 , gBattle_BG2_Y = 0 ;
else
gBattle_BG2_X = 0 , gBattle_BG2_Y = 160 ;
gTasks [ taskId ] . data [ 0 ] + + ;
break ;
case 1 :
SetGpuReg ( REG_OFFSET_BLDCNT , 0 ) ;
SetGpuReg ( REG_OFFSET_BLDALPHA , 0 ) ;
SetGpuReg ( REG_OFFSET_BLDY , 0 ) ;
SetGpuReg ( REG_OFFSET_MOSAIC , 0 ) ;
SetGpuReg ( REG_OFFSET_WIN0H , 0 ) ;
SetGpuReg ( REG_OFFSET_WIN0V , 0 ) ;
SetGpuReg ( REG_OFFSET_WIN1H , 0 ) ;
SetGpuReg ( REG_OFFSET_WIN1V , 0 ) ;
SetGpuReg ( REG_OFFSET_WININ , 0 ) ;
2019-12-18 08:32:52 +01:00
SetGpuReg ( REG_OFFSET_WINOUT , WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR ) ;
2018-08-18 00:54:18 +02:00
ResetPaletteFade ( ) ;
ResetSpriteData ( ) ;
FreeAllSpritePalettes ( ) ;
gReservedSpritePaletteCount = 4 ;
gTasks [ taskId ] . data [ 0 ] + + ;
break ;
case 2 :
DecompressAndLoadBgGfxUsingHeap ( 2 , gUnknown_08D83D50 , 0x2000 , 0 , 0 ) ;
DecompressAndLoadBgGfxUsingHeap ( 2 , gUnknown_08D84970 , 0x2000 , 0 , 1 ) ;
DecompressAndLoadBgGfxUsingHeap ( 3 , gUnknown_08D84F00 , 0x800 , 0 , 1 ) ;
2019-02-08 18:08:25 +01:00
LoadCompressedSpriteSheet ( sDomeOptionsSpriteSheet ) ;
2018-08-18 00:54:18 +02:00
LoadCompressedPalette ( gUnknown_08D85358 , 0 , 0x200 ) ;
LoadCompressedPalette ( gUnknown_08D85444 , 0x100 , 0x200 ) ;
2019-11-07 01:18:11 +01:00
LoadCompressedPalette ( gBattleWindowTextPalette , 0xF0 , 0x20 ) ;
2018-08-18 00:54:18 +02:00
if ( r9 = = 2 )
LoadCompressedPalette ( gUnknown_08D854C8 , 0x50 , 0x20 ) ;
CpuFill32 ( 0 , gPlttBufferFaded , 0x400 ) ;
ShowBg ( 0 ) ;
ShowBg ( 1 ) ;
ShowBg ( 2 ) ;
ShowBg ( 3 ) ;
gTasks [ taskId ] . data [ 0 ] + + ;
break ;
case 3 :
2018-08-25 18:46:15 +02:00
SetVBlankCallback ( VblankCb0_BattleDome ) ;
2018-08-25 19:59:47 +02:00
sBattleDomeStruct = AllocZeroed ( sizeof ( * sBattleDomeStruct ) ) ;
2018-08-18 00:54:18 +02:00
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
2019-01-13 12:12:27 +01:00
sBattleDomeStruct - > arr [ i ] = 0xFF ;
2018-08-18 00:54:18 +02:00
LoadMonIconPalettes ( ) ;
i = CreateTask ( sub_8190CD4 , 0 ) ;
gTasks [ i ] . data [ 0 ] = 0 ;
gTasks [ i ] . data [ 2 ] = 0 ;
gTasks [ i ] . data [ 3 ] = r9 ;
gTasks [ i ] . data [ 4 ] = r7 ;
if ( r9 = = 2 )
{
2018-08-21 23:36:59 +02:00
DisplayMatchInfoOnCard ( 0 , r5 ) ;
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > unk_10 = 1 ;
2018-08-18 00:54:18 +02:00
}
else
{
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard ( 0 , r5 ) ;
2018-08-18 00:54:18 +02:00
}
SetGpuReg ( REG_OFFSET_DISPCNT , DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP ) ;
if ( r9 ! = 0 )
{
r7 = CreateSprite ( & gUnknown_0860D068 , 120 , 4 , 0 ) ;
StartSpriteAnim ( & gSprites [ r7 ] , 0 ) ;
gSprites [ r7 ] . data [ 0 ] = i ;
r7 = CreateSprite ( & gUnknown_0860D068 , 120 , 156 , 0 ) ;
StartSpriteAnim ( & gSprites [ r7 ] , 1 ) ;
gSprites [ r7 ] . data [ 0 ] = i ;
r7 = CreateSprite ( & gUnknown_0860D050 , 6 , 80 , 0 ) ;
StartSpriteAnim ( & gSprites [ r7 ] , 0 ) ;
gSprites [ r7 ] . data [ 0 ] = i ;
gSprites [ r7 ] . data [ 1 ] = 0 ;
if ( r9 = = 1 )
2018-09-10 17:25:58 +02:00
gSprites [ r7 ] . invisible = TRUE ;
2018-08-18 00:54:18 +02:00
r7 = CreateSprite ( & gUnknown_0860D050 , 234 , 80 , 0 ) ;
StartSpriteAnim ( & gSprites [ r7 ] , 1 ) ;
gSprites [ r7 ] . data [ 0 ] = i ;
gSprites [ r7 ] . data [ 1 ] = 1 ;
}
DestroyTask ( taskId ) ;
break ;
}
}
2018-08-20 22:56:05 +02:00
// Note: Card scrolling up means the current card goes down and another one appears from top.
// The same is true for scrolling left.
// That means that the sprite needs to move with the moving card in the opposite scrolling direction.
static void SpriteCb_TrainerIconCardScrollUp ( struct Sprite * sprite )
2018-08-18 00:54:18 +02:00
{
sprite - > pos1 . y + = 4 ;
if ( sprite - > data [ 0 ] ! = 0 )
{
if ( sprite - > pos1 . y > = - 32 )
2018-09-10 17:25:58 +02:00
sprite - > invisible = FALSE ;
2018-08-18 00:54:18 +02:00
if ( + + sprite - > data [ 1 ] = = 40 )
sprite - > callback = SpriteCallbackDummy ;
}
else
{
if ( sprite - > pos1 . y > = 192 )
{
2018-12-05 15:31:01 +01:00
sBattleDomeStruct - > arr [ sprite - > data [ 2 ] ] = 0xFF ;
2018-08-19 01:06:10 +02:00
FreeAndDestroyTrainerPicSprite ( sprite - > data [ 3 ] ) ;
2018-08-18 00:54:18 +02:00
}
}
}
2018-08-20 22:56:05 +02:00
static void SpriteCb_TrainerIconCardScrollDown ( struct Sprite * sprite )
2018-08-18 00:54:18 +02:00
{
sprite - > pos1 . y - = 4 ;
if ( sprite - > data [ 0 ] ! = 0 )
{
if ( sprite - > pos1 . y < = 192 )
2018-09-10 17:25:58 +02:00
sprite - > invisible = FALSE ;
2018-08-18 00:54:18 +02:00
if ( + + sprite - > data [ 1 ] = = 40 )
sprite - > callback = SpriteCallbackDummy ;
}
else
{
if ( sprite - > pos1 . y < = - 32 )
{
2018-12-05 15:31:01 +01:00
sBattleDomeStruct - > arr [ sprite - > data [ 2 ] ] = 0xFF ;
2018-08-19 01:06:10 +02:00
FreeAndDestroyTrainerPicSprite ( sprite - > data [ 3 ] ) ;
2018-08-18 00:54:18 +02:00
}
}
}
2018-08-20 22:56:05 +02:00
static void SpriteCb_TrainerIconCardScrollLeft ( struct Sprite * sprite )
2018-08-18 00:54:18 +02:00
{
sprite - > pos1 . x + = 4 ;
if ( sprite - > data [ 0 ] ! = 0 )
{
if ( sprite - > pos1 . x > = - 32 )
2018-09-10 17:25:58 +02:00
sprite - > invisible = FALSE ;
2018-08-18 00:54:18 +02:00
if ( + + sprite - > data [ 1 ] = = 64 )
sprite - > callback = SpriteCallbackDummy ;
}
else
{
if ( sprite - > pos1 . x > = 272 )
{
2018-12-05 15:31:01 +01:00
sBattleDomeStruct - > arr [ sprite - > data [ 2 ] ] = 0xFF ;
2018-08-19 01:06:10 +02:00
FreeAndDestroyTrainerPicSprite ( sprite - > data [ 3 ] ) ;
2018-08-18 00:54:18 +02:00
}
}
}
2018-08-20 22:56:05 +02:00
static void SpriteCb_TrainerIconCardScrollRight ( struct Sprite * sprite )
2018-08-18 00:54:18 +02:00
{
sprite - > pos1 . x - = 4 ;
if ( sprite - > data [ 0 ] ! = 0 )
{
if ( sprite - > pos1 . x < = 272 )
2018-09-10 17:25:58 +02:00
sprite - > invisible = FALSE ;
2018-08-18 00:54:18 +02:00
if ( + + sprite - > data [ 1 ] = = 64 )
sprite - > callback = SpriteCallbackDummy ;
}
else
{
if ( sprite - > pos1 . x < = - 32 )
{
2018-12-05 15:31:01 +01:00
sBattleDomeStruct - > arr [ sprite - > data [ 2 ] ] = 0xFF ;
2018-08-19 01:06:10 +02:00
FreeAndDestroyTrainerPicSprite ( sprite - > data [ 3 ] ) ;
2018-08-18 00:54:18 +02:00
}
}
}
2018-08-20 22:56:05 +02:00
# define sMonIconStill data[3]
static void SpriteCb_MonIcon ( struct Sprite * sprite )
2018-08-18 00:54:18 +02:00
{
2018-08-20 22:56:05 +02:00
if ( ! sprite - > sMonIconStill )
2018-08-18 00:54:18 +02:00
UpdateMonIconFrame ( sprite ) ;
}
2018-08-20 22:56:05 +02:00
static void SpriteCb_MonIconCardScrollUp ( struct Sprite * sprite )
2018-08-18 00:54:18 +02:00
{
2018-08-20 22:56:05 +02:00
if ( ! sprite - > sMonIconStill )
2018-08-18 00:54:18 +02:00
UpdateMonIconFrame ( sprite ) ;
sprite - > pos1 . y + = 4 ;
if ( sprite - > data [ 0 ] ! = 0 )
{
if ( sprite - > pos1 . y > = - 16 )
2018-09-10 17:25:58 +02:00
sprite - > invisible = FALSE ;
2018-08-18 00:54:18 +02:00
if ( + + sprite - > data [ 1 ] = = 40 )
2018-08-20 22:56:05 +02:00
sprite - > callback = SpriteCb_MonIcon ;
2018-08-18 00:54:18 +02:00
}
else
{
if ( sprite - > pos1 . y > = 176 )
{
2018-12-05 15:31:01 +01:00
sBattleDomeStruct - > arr [ sprite - > data [ 2 ] ] = 0xFF ;
2018-08-18 00:54:18 +02:00
sub_80D2EF8 ( sprite ) ;
}
}
}
2018-08-20 22:56:05 +02:00
static void SpriteCb_MonIconCardScrollDown ( struct Sprite * sprite )
2018-08-18 00:54:18 +02:00
{
2018-08-20 22:56:05 +02:00
if ( ! sprite - > sMonIconStill )
2018-08-18 00:54:18 +02:00
UpdateMonIconFrame ( sprite ) ;
sprite - > pos1 . y - = 4 ;
if ( sprite - > data [ 0 ] ! = 0 )
{
if ( sprite - > pos1 . y < = 176 )
2018-09-10 17:25:58 +02:00
sprite - > invisible = FALSE ;
2018-08-18 00:54:18 +02:00
if ( + + sprite - > data [ 1 ] = = 40 )
2018-08-20 22:56:05 +02:00
sprite - > callback = SpriteCb_MonIcon ;
2018-08-18 00:54:18 +02:00
}
else
{
if ( sprite - > pos1 . y < = - 16 )
{
2018-12-05 15:31:01 +01:00
sBattleDomeStruct - > arr [ sprite - > data [ 2 ] ] = 0xFF ;
2018-08-18 00:54:18 +02:00
sub_80D2EF8 ( sprite ) ;
}
}
}
2018-08-20 22:56:05 +02:00
static void SpriteCb_MonIconCardScrollLeft ( struct Sprite * sprite )
2018-08-18 00:54:18 +02:00
{
2018-08-20 22:56:05 +02:00
if ( ! sprite - > sMonIconStill )
2018-08-18 00:54:18 +02:00
UpdateMonIconFrame ( sprite ) ;
sprite - > pos1 . x + = 4 ;
if ( sprite - > data [ 0 ] ! = 0 )
{
if ( sprite - > pos1 . x > = - 16 )
2018-09-10 17:25:58 +02:00
sprite - > invisible = FALSE ;
2018-08-18 00:54:18 +02:00
if ( + + sprite - > data [ 1 ] = = 64 )
2018-08-20 22:56:05 +02:00
sprite - > callback = SpriteCb_MonIcon ;
2018-08-18 00:54:18 +02:00
}
else
{
if ( sprite - > pos1 . x > = 256 )
{
2018-12-05 15:31:01 +01:00
sBattleDomeStruct - > arr [ sprite - > data [ 2 ] ] = 0xFF ;
2018-08-18 00:54:18 +02:00
sub_80D2EF8 ( sprite ) ;
}
}
}
2018-08-20 22:56:05 +02:00
static void SpriteCb_MonIconCardScrollRight ( struct Sprite * sprite )
2018-08-18 00:54:18 +02:00
{
2018-08-20 22:56:05 +02:00
if ( ! sprite - > sMonIconStill )
2018-08-18 00:54:18 +02:00
UpdateMonIconFrame ( sprite ) ;
sprite - > pos1 . x - = 4 ;
if ( sprite - > data [ 0 ] ! = 0 )
{
if ( sprite - > pos1 . x < = 256 )
2018-09-10 17:25:58 +02:00
sprite - > invisible = FALSE ;
2018-08-18 00:54:18 +02:00
if ( + + sprite - > data [ 1 ] = = 64 )
2018-08-20 22:56:05 +02:00
sprite - > callback = SpriteCb_MonIcon ;
2018-08-18 00:54:18 +02:00
}
else
{
if ( sprite - > pos1 . x < = - 16 )
{
2018-12-05 15:31:01 +01:00
sBattleDomeStruct - > arr [ sprite - > data [ 2 ] ] = 0xFF ;
2018-08-18 00:54:18 +02:00
sub_80D2EF8 ( sprite ) ;
}
}
}
2018-08-26 15:51:14 +02:00
static void sub_8190B40 ( struct Sprite * sprite )
2018-08-18 00:54:18 +02:00
{
2019-02-08 18:08:25 +01:00
int taskId1 = sprite - > data [ 0 ] ;
int arrId = gTasks [ gTasks [ taskId1 ] . data [ 4 ] ] . data [ 1 ] ;
int tournmanetTrainerId = sTourneyTreeTrainerIds [ arrId ] ;
int roundId = gSaveBlock2Ptr - > frontier . curChallengeBattleNum ;
2018-08-18 00:54:18 +02:00
if ( gTasks [ taskId1 ] . data [ 3 ] = = 1 )
{
if ( sprite - > data [ 1 ] )
{
2019-12-18 08:32:52 +01:00
if ( ( DOME_TRAINERS [ tournmanetTrainerId ] . isEliminated
& & sBattleDomeStruct - > unk_10 - 1 < DOME_TRAINERS [ tournmanetTrainerId ] . eliminatedAt ) )
2018-08-18 00:54:18 +02:00
{
2018-09-10 17:25:58 +02:00
sprite - > invisible = FALSE ;
2018-08-18 00:54:18 +02:00
}
2019-12-18 08:32:52 +01:00
else if ( ! DOME_TRAINERS [ tournmanetTrainerId ] . isEliminated
2018-10-21 00:06:42 +02:00
& & sBattleDomeStruct - > unk_10 - 1 < roundId )
2018-08-18 00:54:18 +02:00
{
2018-09-10 17:25:58 +02:00
sprite - > invisible = FALSE ;
2018-08-18 00:54:18 +02:00
}
else
{
if ( gTasks [ taskId1 ] . data [ 0 ] = = 2 )
2018-09-10 17:25:58 +02:00
sprite - > invisible = TRUE ;
2018-08-18 00:54:18 +02:00
}
}
else
{
2018-08-25 19:59:47 +02:00
if ( sBattleDomeStruct - > unk_10 ! = 0 )
2018-08-18 00:54:18 +02:00
{
2018-09-10 17:25:58 +02:00
sprite - > invisible = FALSE ;
2018-08-18 00:54:18 +02:00
}
else
{
if ( gTasks [ taskId1 ] . data [ 0 ] = = 2 )
2018-09-10 17:25:58 +02:00
sprite - > invisible = TRUE ;
2018-08-18 00:54:18 +02:00
}
}
}
else
{
if ( sprite - > data [ 1 ] )
{
2018-08-25 19:59:47 +02:00
if ( sBattleDomeStruct - > unk_10 > 1 )
2018-08-18 00:54:18 +02:00
{
if ( gTasks [ taskId1 ] . data [ 0 ] = = 2 )
2018-09-10 17:25:58 +02:00
sprite - > invisible = TRUE ;
2018-08-18 00:54:18 +02:00
}
else
{
2018-09-10 17:25:58 +02:00
sprite - > invisible = FALSE ;
2018-08-18 00:54:18 +02:00
}
}
else
{
2018-08-25 19:59:47 +02:00
if ( sBattleDomeStruct - > unk_10 ! = 0 )
2018-08-18 00:54:18 +02:00
{
2018-09-10 17:25:58 +02:00
sprite - > invisible = FALSE ;
2018-08-18 00:54:18 +02:00
}
else
{
if ( gTasks [ taskId1 ] . data [ 0 ] = = 2 )
2018-09-10 17:25:58 +02:00
sprite - > invisible = TRUE ;
2018-08-18 00:54:18 +02:00
}
}
}
}
2018-08-26 15:51:14 +02:00
static void sub_8190C6C ( struct Sprite * sprite )
2018-08-18 00:54:18 +02:00
{
2019-02-08 18:08:25 +01:00
int taskId1 = sprite - > data [ 0 ] ;
2018-08-18 00:54:18 +02:00
if ( gTasks [ taskId1 ] . data [ 3 ] = = 1 )
{
2018-08-25 19:59:47 +02:00
if ( sBattleDomeStruct - > unk_10 ! = 0 )
2018-08-18 00:54:18 +02:00
{
if ( gTasks [ taskId1 ] . data [ 0 ] = = 2 )
2018-09-10 17:25:58 +02:00
sprite - > invisible = TRUE ;
2018-08-18 00:54:18 +02:00
}
else
{
2018-09-10 17:25:58 +02:00
sprite - > invisible = FALSE ;
2018-08-18 00:54:18 +02:00
}
}
else
{
2018-08-25 19:59:47 +02:00
if ( sBattleDomeStruct - > unk_10 ! = 1 )
2018-08-18 00:54:18 +02:00
{
if ( gTasks [ taskId1 ] . data [ 0 ] = = 2 )
2018-09-10 17:25:58 +02:00
sprite - > invisible = TRUE ;
2018-08-18 00:54:18 +02:00
}
else
{
2018-09-10 17:25:58 +02:00
sprite - > invisible = FALSE ;
2018-08-18 00:54:18 +02:00
}
}
}
2018-08-18 18:23:40 +02:00
2018-08-25 19:59:47 +02:00
static void sub_8190CD4 ( u8 taskId )
2018-08-18 18:23:40 +02:00
{
2019-02-08 18:08:25 +01:00
int i ;
int windowId = 0 ;
int r9 = gTasks [ taskId ] . data [ 3 ] ;
int taskId2 = gTasks [ taskId ] . data [ 4 ] ;
int trainerTournamentId = 0 ;
int matchNo = 0 ;
2018-08-18 18:23:40 +02:00
switch ( gTasks [ taskId ] . data [ 0 ] )
{
case 0 :
if ( ! gPaletteFade . active )
{
2018-08-29 20:38:54 +02:00
BeginNormalPaletteFade ( 0xFFFFFFFF , 0 , 0x10 , 0 , RGB_BLACK ) ;
2018-08-18 18:23:40 +02:00
gTasks [ taskId ] . data [ 0 ] = 1 ;
}
break ;
case 1 :
if ( ! gPaletteFade . active )
gTasks [ taskId ] . data [ 0 ] = 2 ;
break ;
case 2 :
i = sub_819221C ( taskId ) ;
switch ( i )
{
case 9 :
2018-08-29 20:38:54 +02:00
BeginNormalPaletteFade ( 0xFFFFFFFF , 0 , 0 , 0x10 , RGB_BLACK ) ;
2018-08-18 18:23:40 +02:00
gTasks [ taskId ] . data [ 0 ] = 8 ;
break ;
case 1 . . . 8 :
gTasks [ taskId ] . data [ 5 ] = i ;
if ( gTasks [ taskId ] . data [ 2 ] ! = 0 )
2018-08-20 22:56:05 +02:00
windowId = 9 ;
2018-08-18 18:23:40 +02:00
else
2018-08-20 22:56:05 +02:00
windowId = 0 ;
2018-08-18 18:23:40 +02:00
2018-08-20 22:56:05 +02:00
for ( i = windowId ; i < windowId + 9 ; i + + )
2018-08-18 18:23:40 +02:00
{
CopyWindowToVram ( i , 2 ) ;
2019-03-02 23:25:39 +01:00
FillWindowPixelBuffer ( i , PIXEL_FILL ( 0 ) ) ;
2018-08-18 18:23:40 +02:00
}
gTasks [ taskId ] . data [ 0 ] = 3 ;
break ;
case 0 :
break ;
}
break ;
case 3 :
i = gTasks [ taskId ] . data [ 5 ] ;
switch ( i )
{
case 1 :
case 5 :
if ( gTasks [ taskId ] . data [ 2 ] )
{
gBattle_BG0_X = 0 ;
gBattle_BG0_Y = 0 ;
gBattle_BG1_X = 0 ;
gBattle_BG1_Y = 160 ;
}
else
{
gBattle_BG0_X = 0 ;
gBattle_BG0_Y = 160 ;
gBattle_BG1_X = 0 ;
gBattle_BG1_Y = 0 ;
}
if ( i = = 1 )
{
2018-08-25 19:59:47 +02:00
if ( sBattleDomeStruct - > unk_10 = = 0 )
2018-08-18 18:23:40 +02:00
{
gBattle_BG2_X = 0 ;
gBattle_BG2_Y = 320 ;
2019-02-08 18:08:25 +01:00
trainerTournamentId = sTourneyTreeTrainerIds [ gTasks [ taskId2 ] . data [ 1 ] ] ;
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard ( gTasks [ taskId ] . data [ 2 ] | 0x10 , trainerTournamentId ) ;
2018-08-18 18:23:40 +02:00
}
else
{
gBattle_BG2_X = 256 ;
gBattle_BG2_Y = 0 ;
2019-02-08 18:08:25 +01:00
trainerTournamentId = sTourneyTreeTrainerIds [ gTasks [ taskId2 ] . data [ 1 ] ] ;
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard ( gTasks [ taskId ] . data [ 2 ] | 0x10 , trainerTournamentId ) ;
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > unk_10 = 0 ;
2018-08-18 18:23:40 +02:00
}
}
else
{
2018-08-25 19:59:47 +02:00
if ( sBattleDomeStruct - > unk_10 = = 0 )
2018-08-18 18:23:40 +02:00
{
2018-08-20 22:56:05 +02:00
matchNo = gTasks [ taskId2 ] . data [ 1 ] - 16 ;
2019-12-21 10:27:12 +01:00
BufferDomeWinString ( matchNo , sBattleDomeStruct - > unk_11 ) ;
2018-08-18 18:23:40 +02:00
gBattle_BG2_X = 0 ;
gBattle_BG2_Y = 320 ;
2018-08-25 19:59:47 +02:00
trainerTournamentId = sBattleDomeStruct - > unk_11 [ 0 ] ;
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard ( gTasks [ taskId ] . data [ 2 ] | 0x10 , trainerTournamentId ) ;
2018-08-18 18:23:40 +02:00
}
2018-08-25 19:59:47 +02:00
else if ( sBattleDomeStruct - > unk_10 = = 2 )
2018-08-18 18:23:40 +02:00
{
2018-08-20 22:56:05 +02:00
matchNo = gTasks [ taskId2 ] . data [ 1 ] - 16 ;
2019-12-21 10:27:12 +01:00
BufferDomeWinString ( matchNo , sBattleDomeStruct - > unk_11 ) ;
2018-08-18 18:23:40 +02:00
gBattle_BG2_X = 0 ;
gBattle_BG2_Y = 320 ;
2018-08-25 19:59:47 +02:00
trainerTournamentId = sBattleDomeStruct - > unk_11 [ 1 ] ;
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard ( gTasks [ taskId ] . data [ 2 ] | 0x10 , trainerTournamentId ) ;
2018-08-18 18:23:40 +02:00
}
else
{
gBattle_BG2_X = 256 ;
gBattle_BG2_Y = 160 ;
2018-08-20 22:56:05 +02:00
matchNo = gTasks [ taskId2 ] . data [ 1 ] - 16 ;
2018-08-21 23:36:59 +02:00
DisplayMatchInfoOnCard ( gTasks [ taskId ] . data [ 2 ] | 0x10 , matchNo ) ;
2018-08-18 18:23:40 +02:00
}
}
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT / 2 ; i + + )
{
if ( i < 2 )
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_TrainerIconCardScrollUp ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ^ 1 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 3 ] = sBattleDomeStruct - > arr [ i ] ;
2018-08-18 18:23:40 +02:00
}
}
else
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_MonIconCardScrollUp ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ^ 1 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
2018-08-18 18:23:40 +02:00
}
}
}
for ( i = DOME_TOURNAMENT_TRAINERS_COUNT / 2 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
{
if ( i < 10 )
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_TrainerIconCardScrollUp ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 3 ] = sBattleDomeStruct - > arr [ i ] ;
2018-08-18 18:23:40 +02:00
}
}
else
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_MonIconCardScrollUp ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
2018-08-18 18:23:40 +02:00
}
}
}
gTasks [ taskId ] . data [ 0 ] = 4 ;
gTasks [ taskId ] . data [ 5 ] = 0 ;
break ;
case 2 :
case 6 :
if ( gTasks [ taskId ] . data [ 2 ] )
{
gBattle_BG0_X = 0 ;
gBattle_BG0_Y = 0 ;
gBattle_BG1_X = 0 ;
gBattle_BG1_Y = - 160 ;
}
else
{
gBattle_BG0_X = 0 ;
gBattle_BG0_Y = - 160 ;
gBattle_BG1_X = 0 ;
gBattle_BG1_Y = 0 ;
}
if ( i = = 2 )
{
2018-08-25 19:59:47 +02:00
if ( sBattleDomeStruct - > unk_10 = = 0 )
2018-08-18 18:23:40 +02:00
{
gBattle_BG2_X = 0 ;
gBattle_BG2_Y = 160 ;
2019-02-08 18:08:25 +01:00
trainerTournamentId = sTourneyTreeTrainerIds [ gTasks [ taskId2 ] . data [ 1 ] ] ;
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard ( gTasks [ taskId ] . data [ 2 ] | 4 , trainerTournamentId ) ;
2018-08-18 18:23:40 +02:00
}
else
{
gBattle_BG2_X = 0 ;
gBattle_BG2_Y = 0 ;
2019-02-08 18:08:25 +01:00
trainerTournamentId = sTourneyTreeTrainerIds [ gTasks [ taskId2 ] . data [ 1 ] ] ;
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard ( gTasks [ taskId ] . data [ 2 ] | 4 , trainerTournamentId ) ;
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > unk_10 = 0 ;
2018-08-18 18:23:40 +02:00
}
}
else
{
2018-08-25 19:59:47 +02:00
if ( sBattleDomeStruct - > unk_10 = = 0 )
2018-08-18 18:23:40 +02:00
{
2018-08-20 22:56:05 +02:00
matchNo = gTasks [ taskId2 ] . data [ 1 ] - 16 ;
2019-12-21 10:27:12 +01:00
BufferDomeWinString ( matchNo , sBattleDomeStruct - > unk_11 ) ;
2018-08-18 18:23:40 +02:00
gBattle_BG2_X = 0 ;
gBattle_BG2_Y = 160 ;
2018-08-25 19:59:47 +02:00
trainerTournamentId = sBattleDomeStruct - > unk_11 [ 0 ] ;
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard ( gTasks [ taskId ] . data [ 2 ] | 4 , trainerTournamentId ) ;
2018-08-18 18:23:40 +02:00
}
2018-08-25 19:59:47 +02:00
else if ( sBattleDomeStruct - > unk_10 = = 2 )
2018-08-18 18:23:40 +02:00
{
2018-08-20 22:56:05 +02:00
matchNo = gTasks [ taskId2 ] . data [ 1 ] - 16 ;
2019-12-21 10:27:12 +01:00
BufferDomeWinString ( matchNo , sBattleDomeStruct - > unk_11 ) ;
2018-08-18 18:23:40 +02:00
gBattle_BG2_X = 0 ;
gBattle_BG2_Y = 160 ;
2018-08-25 19:59:47 +02:00
trainerTournamentId = sBattleDomeStruct - > unk_11 [ 1 ] ;
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard ( gTasks [ taskId ] . data [ 2 ] | 4 , trainerTournamentId ) ;
2018-08-18 18:23:40 +02:00
}
else
{
gBattle_BG2_X = 256 ;
gBattle_BG2_Y = 0 ;
2018-08-20 22:56:05 +02:00
matchNo = gTasks [ taskId2 ] . data [ 1 ] - 16 ;
2018-08-21 23:36:59 +02:00
DisplayMatchInfoOnCard ( gTasks [ taskId ] . data [ 2 ] | 4 , matchNo ) ;
2018-08-18 18:23:40 +02:00
}
}
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT / 2 ; i + + )
{
if ( i < 2 )
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_TrainerIconCardScrollDown ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ^ 1 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 3 ] = sBattleDomeStruct - > arr [ i ] ;
2018-08-18 18:23:40 +02:00
}
}
else
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_MonIconCardScrollDown ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ^ 1 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
2018-08-18 18:23:40 +02:00
}
}
}
for ( i = DOME_TOURNAMENT_TRAINERS_COUNT / 2 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
{
if ( i < 10 )
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_TrainerIconCardScrollDown ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 3 ] = sBattleDomeStruct - > arr [ i ] ;
2018-08-18 18:23:40 +02:00
}
}
else
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_MonIconCardScrollDown ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
2018-08-18 18:23:40 +02:00
}
}
}
gTasks [ taskId ] . data [ 0 ] = 5 ;
gTasks [ taskId ] . data [ 5 ] = 0 ;
break ;
case 3 :
if ( gTasks [ taskId ] . data [ 2 ] )
{
gBattle_BG0_X = 0 ;
gBattle_BG0_Y = 0 ;
gBattle_BG1_X = 256 ;
gBattle_BG1_Y = 0 ;
}
else
{
gBattle_BG0_X = 256 ;
gBattle_BG0_Y = 0 ;
gBattle_BG1_X = 0 ;
gBattle_BG1_Y = 0 ;
}
2018-08-25 19:59:47 +02:00
if ( sBattleDomeStruct - > unk_10 = = 0 )
2018-08-18 18:23:40 +02:00
{
gBattle_BG2_X = 256 ;
gBattle_BG2_Y = 160 ;
2019-02-08 18:08:25 +01:00
trainerTournamentId = sTourneyTreeTrainerIds [ gTasks [ taskId2 ] . data [ 1 ] ] ;
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard ( gTasks [ taskId ] . data [ 2 ] | 8 , trainerTournamentId ) ;
2018-08-18 18:23:40 +02:00
}
else
{
gBattle_BG2_X = 256 ;
gBattle_BG2_Y = 0 ;
2018-08-26 15:51:14 +02:00
matchNo = gUnknown_0860D15C [ gTasks [ taskId2 ] . data [ 1 ] ] [ sBattleDomeStruct - > unk_10 - 1 ] ;
2018-08-21 23:36:59 +02:00
DisplayMatchInfoOnCard ( gTasks [ taskId ] . data [ 2 ] | 8 , matchNo ) ;
2018-08-18 18:23:40 +02:00
}
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT / 2 ; i + + )
{
if ( i < 2 )
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_TrainerIconCardScrollLeft ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ^ 1 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 3 ] = sBattleDomeStruct - > arr [ i ] ;
2018-08-18 18:23:40 +02:00
}
}
else
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_MonIconCardScrollLeft ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ^ 1 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
2018-08-18 18:23:40 +02:00
}
}
}
for ( i = DOME_TOURNAMENT_TRAINERS_COUNT / 2 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
{
if ( i < 10 )
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_TrainerIconCardScrollLeft ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 3 ] = sBattleDomeStruct - > arr [ i ] ;
2018-08-18 18:23:40 +02:00
}
}
else
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_MonIconCardScrollLeft ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
2018-08-18 18:23:40 +02:00
}
}
}
gTasks [ taskId ] . data [ 0 ] = 6 ;
gTasks [ taskId ] . data [ 5 ] = 0 ;
break ;
case 7 :
if ( gTasks [ taskId ] . data [ 2 ] )
{
gBattle_BG0_X = 0 ;
gBattle_BG0_Y = 0 ;
gBattle_BG1_X = 256 ;
gBattle_BG1_Y = 0 ;
}
else
{
gBattle_BG0_X = 256 ;
gBattle_BG0_Y = 0 ;
gBattle_BG1_X = 0 ;
gBattle_BG1_Y = 0 ;
}
2018-08-25 19:59:47 +02:00
if ( sBattleDomeStruct - > unk_10 = = 0 )
2018-08-18 18:23:40 +02:00
{
gBattle_BG2_X = 256 ;
gBattle_BG2_Y = 160 ;
2018-08-25 19:59:47 +02:00
trainerTournamentId = sBattleDomeStruct - > unk_11 [ 0 ] ;
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard ( gTasks [ taskId ] . data [ 2 ] | 8 , trainerTournamentId ) ;
2018-08-18 18:23:40 +02:00
}
else
{
gBattle_BG2_X = 0 ;
gBattle_BG2_Y = 160 ;
2018-08-20 22:56:05 +02:00
matchNo = gTasks [ taskId2 ] . data [ 1 ] - 16 ;
2018-08-21 23:36:59 +02:00
DisplayMatchInfoOnCard ( gTasks [ taskId ] . data [ 2 ] | 8 , matchNo ) ;
2018-08-18 18:23:40 +02:00
}
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT / 2 ; i + + )
{
if ( i < 2 )
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_TrainerIconCardScrollLeft ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ^ 1 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 3 ] = sBattleDomeStruct - > arr [ i ] ;
2018-08-18 18:23:40 +02:00
}
}
else
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_MonIconCardScrollLeft ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ^ 1 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
2018-08-18 18:23:40 +02:00
}
}
}
for ( i = DOME_TOURNAMENT_TRAINERS_COUNT / 2 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
{
if ( i < 10 )
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_TrainerIconCardScrollLeft ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 3 ] = sBattleDomeStruct - > arr [ i ] ;
2018-08-18 18:23:40 +02:00
}
}
else
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_MonIconCardScrollLeft ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
2018-08-18 18:23:40 +02:00
}
}
}
gTasks [ taskId ] . data [ 0 ] = 6 ;
gTasks [ taskId ] . data [ 5 ] = 0 ;
break ;
case 4 :
if ( gTasks [ taskId ] . data [ 2 ] )
{
gBattle_BG0_X = 0 ;
gBattle_BG0_Y = 0 ;
gBattle_BG1_X = - 256 ;
gBattle_BG1_Y = 0 ;
}
else
{
gBattle_BG0_X = - 256 ;
gBattle_BG0_Y = 0 ;
gBattle_BG1_X = 0 ;
gBattle_BG1_Y = 0 ;
}
2018-08-25 19:59:47 +02:00
if ( sBattleDomeStruct - > unk_10 = = 1 )
2018-08-18 18:23:40 +02:00
{
gBattle_BG2_X = 0 ;
gBattle_BG2_Y = 160 ;
}
else
{
gBattle_BG2_X = 0 ;
gBattle_BG2_Y = 0 ;
}
2018-08-26 15:51:14 +02:00
matchNo = gUnknown_0860D15C [ gTasks [ taskId2 ] . data [ 1 ] ] [ sBattleDomeStruct - > unk_10 - 1 ] ;
2018-08-21 23:36:59 +02:00
DisplayMatchInfoOnCard ( gTasks [ taskId ] . data [ 2 ] | 2 , matchNo ) ;
2018-08-18 18:23:40 +02:00
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT / 2 ; i + + )
{
if ( i < 2 )
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_TrainerIconCardScrollRight ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ^ 1 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 3 ] = sBattleDomeStruct - > arr [ i ] ;
2018-08-18 18:23:40 +02:00
}
}
else
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_MonIconCardScrollRight ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ^ 1 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
2018-08-18 18:23:40 +02:00
}
}
}
for ( i = DOME_TOURNAMENT_TRAINERS_COUNT / 2 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
{
if ( i < 10 )
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_TrainerIconCardScrollRight ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 3 ] = sBattleDomeStruct - > arr [ i ] ;
2018-08-18 18:23:40 +02:00
}
}
else
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_MonIconCardScrollRight ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
2018-08-18 18:23:40 +02:00
}
}
}
gTasks [ taskId ] . data [ 0 ] = 7 ;
gTasks [ taskId ] . data [ 5 ] = 0 ;
break ;
case 8 :
if ( gTasks [ taskId ] . data [ 2 ] )
{
gBattle_BG0_X = 0 ;
gBattle_BG0_Y = 0 ;
gBattle_BG1_X = - 256 ;
gBattle_BG1_Y = 0 ;
}
else
{
gBattle_BG0_X = - 256 ;
gBattle_BG0_Y = 0 ;
gBattle_BG1_X = 0 ;
gBattle_BG1_Y = 0 ;
}
2018-08-25 19:59:47 +02:00
if ( sBattleDomeStruct - > unk_10 = = 2 )
2018-08-18 18:23:40 +02:00
{
gBattle_BG2_X = 256 ;
gBattle_BG2_Y = 160 ;
2018-08-25 19:59:47 +02:00
trainerTournamentId = sBattleDomeStruct - > unk_11 [ 1 ] ;
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard ( gTasks [ taskId ] . data [ 2 ] | 2 , trainerTournamentId ) ;
2018-08-18 18:23:40 +02:00
}
else
{
gBattle_BG2_X = 0 ;
gBattle_BG2_Y = 160 ;
2018-08-20 22:56:05 +02:00
matchNo = gTasks [ taskId2 ] . data [ 1 ] - 16 ;
2018-08-21 23:36:59 +02:00
DisplayMatchInfoOnCard ( gTasks [ taskId ] . data [ 2 ] | 2 , matchNo ) ;
2018-08-18 18:23:40 +02:00
}
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT / 2 ; i + + )
{
if ( i < 2 )
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_TrainerIconCardScrollRight ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ^ 1 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 3 ] = sBattleDomeStruct - > arr [ i ] ;
2018-08-18 18:23:40 +02:00
}
}
else
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_MonIconCardScrollRight ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ^ 1 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
2018-08-18 18:23:40 +02:00
}
}
}
for ( i = DOME_TOURNAMENT_TRAINERS_COUNT / 2 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
{
if ( i < 10 )
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_TrainerIconCardScrollRight ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 3 ] = sBattleDomeStruct - > arr [ i ] ;
2018-08-18 18:23:40 +02:00
}
}
else
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-18 18:23:40 +02:00
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ i ] ] . callback = SpriteCb_MonIconCardScrollRight ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 0 ] = gTasks [ taskId ] . data [ 2 ] ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 1 ] = 0 ;
gSprites [ sBattleDomeStruct - > arr [ i ] ] . data [ 2 ] = i ;
2018-08-18 18:23:40 +02:00
}
}
}
gTasks [ taskId ] . data [ 0 ] = 7 ;
gTasks [ taskId ] . data [ 5 ] = 0 ;
break ;
}
break ;
case 4 :
if ( + + gTasks [ taskId ] . data [ 5 ] ! = 41 )
{
gBattle_BG0_Y - = 4 ;
gBattle_BG1_Y - = 4 ;
gBattle_BG2_Y - = 4 ;
}
else
{
gTasks [ taskId ] . data [ 0 ] = 2 ;
}
break ;
case 5 :
if ( + + gTasks [ taskId ] . data [ 5 ] ! = 41 )
{
gBattle_BG0_Y + = 4 ;
gBattle_BG1_Y + = 4 ;
gBattle_BG2_Y + = 4 ;
}
else
{
gTasks [ taskId ] . data [ 0 ] = 2 ;
}
break ;
case 6 :
if ( + + gTasks [ taskId ] . data [ 5 ] ! = 65 )
{
gBattle_BG0_X - = 4 ;
gBattle_BG1_X - = 4 ;
gBattle_BG2_X - = 4 ;
}
else
{
gTasks [ taskId ] . data [ 0 ] = 2 ;
}
break ;
case 7 :
if ( + + gTasks [ taskId ] . data [ 5 ] ! = 65 )
{
gBattle_BG0_X + = 4 ;
gBattle_BG1_X + = 4 ;
gBattle_BG2_X + = 4 ;
}
else
{
gTasks [ taskId ] . data [ 0 ] = 2 ;
}
break ;
case 8 :
if ( ! gPaletteFade . active )
{
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT / 2 ; i + + )
{
if ( i < 2 )
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-25 19:59:47 +02:00
FreeAndDestroyTrainerPicSprite ( sBattleDomeStruct - > arr [ i ] ) ;
2018-08-18 18:23:40 +02:00
}
else
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-25 19:59:47 +02:00
sub_80D2EF8 ( & gSprites [ sBattleDomeStruct - > arr [ i ] ] ) ;
2018-08-18 18:23:40 +02:00
}
}
for ( i = DOME_TOURNAMENT_TRAINERS_COUNT / 2 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
{
if ( i < 10 )
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-25 19:59:47 +02:00
FreeAndDestroyTrainerPicSprite ( sBattleDomeStruct - > arr [ i ] ) ;
2018-08-18 18:23:40 +02:00
}
else
{
2018-12-05 15:31:01 +01:00
if ( sBattleDomeStruct - > arr [ i ] ! = 0xFF )
2018-08-25 19:59:47 +02:00
sub_80D2EF8 ( & gSprites [ sBattleDomeStruct - > arr [ i ] ] ) ;
2018-08-18 18:23:40 +02:00
}
}
FreeMonIconPalettes ( ) ;
2018-08-25 19:59:47 +02:00
FREE_AND_SET_NULL ( sBattleDomeStruct ) ;
2018-08-18 18:23:40 +02:00
FreeAllWindowBuffers ( ) ;
if ( r9 = = 0 )
{
SetMainCallback2 ( CB2_ReturnToFieldContinueScriptPlayMapMusic ) ;
}
else
{
2019-02-08 18:08:25 +01:00
i = CreateTask ( Task_ShowTourneyTree , 0 ) ;
2018-08-18 18:23:40 +02:00
gTasks [ i ] . data [ 0 ] = 0 ;
gTasks [ i ] . data [ 1 ] = 0 ;
gTasks [ i ] . data [ 2 ] = 3 ;
gTasks [ i ] . data [ 3 ] = gTasks [ taskId ] . data [ 4 ] ;
gTasks [ i ] . data [ 4 ] = gTasks [ taskId2 ] . data [ 6 ] ;
}
DestroyTask ( taskId ) ;
}
break ;
}
}
2018-08-18 19:52:25 +02:00
2018-08-25 19:59:47 +02:00
static u8 sub_819221C ( u8 taskId )
2018-08-18 19:52:25 +02:00
{
u8 retVal = 0 ;
2019-02-08 18:08:25 +01:00
int taskId2 = gTasks [ taskId ] . data [ 4 ] ;
int r5 = gTasks [ taskId2 ] . data [ 1 ] ;
u8 r10 = sTourneyTreeTrainerIds [ r5 ] ;
2018-10-21 00:06:42 +02:00
u16 roundId = gSaveBlock2Ptr - > frontier . curChallengeBattleNum ;
2018-08-18 19:52:25 +02:00
if ( gMain . newKeys & ( A_BUTTON | B_BUTTON ) )
retVal = 9 ;
2018-08-19 01:06:10 +02:00
if ( gTasks [ taskId ] . data [ 3 ] = = 0 )
return retVal ;
if ( gTasks [ taskId ] . data [ 3 ] = = 1 )
2018-08-18 19:52:25 +02:00
{
2018-08-25 19:59:47 +02:00
if ( gMain . newKeys & DPAD_UP & & sBattleDomeStruct - > unk_10 = = 0 )
2018-08-18 19:52:25 +02:00
{
2018-08-19 01:06:10 +02:00
if ( r5 = = 0 )
2019-12-21 10:27:12 +01:00
r5 = DOME_TOURNAMENT_TRAINERS_COUNT - 1 ;
2018-08-19 01:06:10 +02:00
else
r5 - - ;
retVal = 1 ;
2018-08-18 19:52:25 +02:00
}
2018-08-25 19:59:47 +02:00
else if ( gMain . newKeys & DPAD_DOWN & & sBattleDomeStruct - > unk_10 = = 0 )
2018-08-18 19:52:25 +02:00
{
2019-12-21 10:27:12 +01:00
if ( r5 = = DOME_TOURNAMENT_TRAINERS_COUNT - 1 )
2018-08-19 01:06:10 +02:00
r5 = 0 ;
else
r5 + + ;
retVal = 2 ;
}
2018-08-25 19:59:47 +02:00
else if ( gMain . newKeys & DPAD_LEFT & & sBattleDomeStruct - > unk_10 ! = 0 )
2018-08-19 01:06:10 +02:00
{
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > unk_10 - - ;
2018-08-19 01:06:10 +02:00
retVal = 3 ;
}
else if ( gMain . newKeys & DPAD_RIGHT )
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ r10 ] . isEliminated & & sBattleDomeStruct - > unk_10 - 1 < DOME_TRAINERS [ r10 ] . eliminatedAt )
2018-08-18 19:52:25 +02:00
{
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > unk_10 + + ;
2018-08-19 01:06:10 +02:00
retVal = 4 ;
2018-08-18 19:52:25 +02:00
}
2019-12-18 08:32:52 +01:00
if ( ! DOME_TRAINERS [ r10 ] . isEliminated & & sBattleDomeStruct - > unk_10 - 1 < roundId )
2018-08-18 19:52:25 +02:00
{
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > unk_10 + + ;
2018-08-19 01:06:10 +02:00
retVal = 4 ;
2018-08-18 19:52:25 +02:00
}
2018-08-19 01:06:10 +02:00
}
2018-08-18 19:52:25 +02:00
2018-08-19 01:06:10 +02:00
if ( retVal = = 9 )
{
2018-08-25 19:59:47 +02:00
if ( sBattleDomeStruct - > unk_10 ! = 0 )
gTasks [ taskId2 ] . data [ 1 ] = gUnknown_0860D1A0 [ r5 / 2 ] [ sBattleDomeStruct - > unk_10 - 1 ] ;
2018-08-19 01:06:10 +02:00
else
gTasks [ taskId2 ] . data [ 1 ] = r5 ;
}
}
else
{
2018-08-25 19:59:47 +02:00
if ( gMain . newKeys & DPAD_UP & & sBattleDomeStruct - > unk_10 = = 1 )
2018-08-19 01:06:10 +02:00
{
2019-12-21 10:27:12 +01:00
if ( r5 = = DOME_TOURNAMENT_TRAINERS_COUNT )
2018-08-19 01:06:10 +02:00
r5 = gUnknown_0860D19C [ roundId ] ;
else
r5 - - ;
retVal = 5 ;
}
2018-08-25 19:59:47 +02:00
else if ( gMain . newKeys & DPAD_DOWN & & sBattleDomeStruct - > unk_10 = = 1 )
2018-08-19 01:06:10 +02:00
{
if ( r5 = = gUnknown_0860D19C [ roundId ] )
2019-12-21 10:27:12 +01:00
r5 = DOME_TOURNAMENT_TRAINERS_COUNT ;
2018-08-19 01:06:10 +02:00
else
r5 + + ;
retVal = 6 ;
}
2018-08-25 19:59:47 +02:00
else if ( gMain . newKeys & DPAD_LEFT & & sBattleDomeStruct - > unk_10 ! = 0 )
2018-08-19 01:06:10 +02:00
{
retVal = 7 ;
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > unk_10 - - ;
2018-08-19 01:06:10 +02:00
}
2018-08-25 19:59:47 +02:00
else if ( gMain . newKeys & DPAD_RIGHT & & ( sBattleDomeStruct - > unk_10 = = 0 | | sBattleDomeStruct - > unk_10 = = 1 ) )
2018-08-19 01:06:10 +02:00
{
retVal = 8 ;
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > unk_10 + + ;
2018-08-18 19:52:25 +02:00
}
2018-08-19 01:06:10 +02:00
if ( retVal = = 9 )
2018-08-18 19:52:25 +02:00
{
2018-08-25 19:59:47 +02:00
if ( sBattleDomeStruct - > unk_10 = = 0 )
gTasks [ taskId2 ] . data [ 1 ] = gUnknown_0860D1C0 [ sBattleDomeStruct - > unk_11 [ 0 ] ] ;
else if ( sBattleDomeStruct - > unk_10 = = 2 )
gTasks [ taskId2 ] . data [ 1 ] = gUnknown_0860D1C0 [ sBattleDomeStruct - > unk_11 [ 1 ] ] ;
2018-08-19 01:06:10 +02:00
else
gTasks [ taskId2 ] . data [ 1 ] = r5 ;
2018-08-18 19:52:25 +02:00
}
}
2018-08-19 01:06:10 +02:00
if ( retVal ! = 0 & & retVal ! = 9 )
{
PlaySE ( SE_SELECT ) ;
gTasks [ taskId2 ] . data [ 1 ] = r5 ;
gTasks [ taskId ] . data [ 2 ] ^ = 1 ;
}
2018-08-18 19:52:25 +02:00
return retVal ;
}
2018-08-19 01:06:10 +02:00
2018-08-19 20:21:37 +02:00
static void DisplayTrainerInfoOnCard ( u8 flags , u8 trainerTournamentId )
2018-08-19 01:06:10 +02:00
{
2018-11-06 17:44:48 +01:00
struct TextPrinterTemplate textPrinter ;
2019-02-08 18:08:25 +01:00
int i , j , k ;
int trainerId = 0 ;
2018-08-19 20:21:37 +02:00
u8 nature = 0 ;
2019-02-08 18:08:25 +01:00
int arrId = 0 ;
int windowId = 0 ;
int x = 0 , y = 0 ;
2018-08-19 20:21:37 +02:00
u8 palSlot = 0 ;
s16 * allocatedArray = AllocZeroed ( sizeof ( s16 ) * 18 ) ;
2019-12-18 08:32:52 +01:00
trainerId = DOME_TRAINERS [ trainerTournamentId ] . trainerId ;
2018-08-19 17:13:05 +02:00
2018-08-19 20:21:37 +02:00
if ( flags & 1 )
arrId = 8 , windowId = 9 , palSlot = 2 ;
if ( flags & 2 )
2018-08-19 17:13:05 +02:00
x = 256 ;
2018-08-19 20:21:37 +02:00
if ( flags & 4 )
2018-08-19 17:13:05 +02:00
y = 160 ;
2018-08-19 20:21:37 +02:00
if ( flags & 8 )
2018-08-19 17:13:05 +02:00
x = - 256 ;
2018-08-19 20:21:37 +02:00
if ( flags & 0x10 )
2018-08-19 17:13:05 +02:00
y = - 160 ;
2019-12-21 10:27:12 +01:00
// Create trainer pic sprite
2018-08-19 17:13:05 +02:00
if ( trainerId = = TRAINER_PLAYER )
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > arr [ arrId ] = CreateTrainerPicSprite ( PlayerGenderToFrontTrainerPicId ( gSaveBlock2Ptr - > playerGender ) , TRUE , x + 48 , y + 64 , palSlot + 12 , 0xFFFF ) ;
2018-08-19 17:13:05 +02:00
else if ( trainerId = = TRAINER_FRONTIER_BRAIN )
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > arr [ arrId ] = CreateTrainerPicSprite ( GetDomeBrainTrainerPicId ( ) , TRUE , x + 48 , y + 64 , palSlot + 12 , 0xFFFF ) ;
2018-08-19 17:13:05 +02:00
else
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > arr [ arrId ] = CreateTrainerPicSprite ( GetFrontierTrainerFrontSpriteId ( trainerId ) , TRUE , x + 48 , y + 64 , palSlot + 12 , 0xFFFF ) ;
2018-08-19 17:13:05 +02:00
2018-08-19 20:21:37 +02:00
if ( flags & 0x1E )
2018-09-10 17:25:58 +02:00
gSprites [ sBattleDomeStruct - > arr [ arrId ] ] . invisible = TRUE ;
2018-08-19 17:13:05 +02:00
2019-12-21 10:27:12 +01:00
// Create party mon icons
for ( i = 0 ; i < FRONTIER_PARTY_SIZE ; i + + )
2018-08-19 17:13:05 +02:00
{
if ( trainerId = = TRAINER_PLAYER )
2018-08-19 20:21:37 +02:00
{
2019-12-18 08:32:52 +01:00
sBattleDomeStruct - > arr [ 2 + i + arrId ] = CreateMonIcon ( DOME_MONS [ trainerTournamentId ] [ i ] ,
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon ,
2018-08-26 15:51:14 +02:00
x | sInfoTrainerMonX [ i ] ,
y + sInfoTrainerMonY [ i ] ,
2018-08-19 17:13:05 +02:00
0 , 0 , TRUE ) ;
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ 2 + i + arrId ] ] . oam . priority = 0 ;
2018-08-19 20:21:37 +02:00
}
2018-08-19 17:13:05 +02:00
else if ( trainerId = = TRAINER_FRONTIER_BRAIN )
2018-08-19 20:21:37 +02:00
{
2019-12-18 08:32:52 +01:00
sBattleDomeStruct - > arr [ 2 + i + arrId ] = CreateMonIcon ( DOME_MONS [ trainerTournamentId ] [ i ] ,
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon ,
2018-08-26 15:51:14 +02:00
x | sInfoTrainerMonX [ i ] ,
y + sInfoTrainerMonY [ i ] ,
2018-08-19 17:13:05 +02:00
0 , 0 , TRUE ) ;
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ 2 + i + arrId ] ] . oam . priority = 0 ;
2018-08-19 20:21:37 +02:00
}
2018-08-19 17:13:05 +02:00
else
2018-08-19 20:21:37 +02:00
{
2019-12-18 08:32:52 +01:00
sBattleDomeStruct - > arr [ 2 + i + arrId ] = CreateMonIcon ( gFacilityTrainerMons [ DOME_MONS [ trainerTournamentId ] [ i ] ] . species ,
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon ,
2018-08-26 15:51:14 +02:00
x | sInfoTrainerMonX [ i ] ,
y + sInfoTrainerMonY [ i ] ,
2018-08-19 17:13:05 +02:00
0 , 0 , TRUE ) ;
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ 2 + i + arrId ] ] . oam . priority = 0 ;
2018-08-19 20:21:37 +02:00
}
if ( flags & 0x1E )
2018-09-10 17:25:58 +02:00
gSprites [ sBattleDomeStruct - > arr [ 2 + i + arrId ] ] . invisible = TRUE ;
2018-08-19 17:13:05 +02:00
}
2019-12-21 10:27:12 +01:00
// Initialize the text printer
2018-08-19 17:13:05 +02:00
textPrinter . fontId = 2 ;
textPrinter . x = 0 ;
textPrinter . y = 0 ;
2018-08-19 20:21:37 +02:00
textPrinter . currentX = textPrinter . x ;
textPrinter . currentY = textPrinter . y ;
2018-08-19 17:13:05 +02:00
textPrinter . letterSpacing = 2 ;
textPrinter . lineSpacing = 0 ;
2018-11-06 18:30:21 +01:00
textPrinter . unk = 0 ;
2019-12-18 08:32:52 +01:00
textPrinter . fgColor = TEXT_DYNAMIC_COLOR_5 ;
textPrinter . bgColor = TEXT_COLOR_TRANSPARENT ;
textPrinter . shadowColor = TEXT_DYNAMIC_COLOR_4 ;
2018-08-19 17:13:05 +02:00
2019-12-21 10:27:12 +01:00
// Get class and trainer name
2018-08-19 17:13:05 +02:00
i = 0 ;
if ( trainerId = = TRAINER_PLAYER )
2018-12-03 14:01:52 +01:00
j = gFacilityClassToTrainerClass [ FACILITY_CLASS_BRENDAN ] ;
2018-08-19 17:13:05 +02:00
else if ( trainerId = = TRAINER_FRONTIER_BRAIN )
j = GetDomeBrainTrainerClass ( ) ;
else
j = GetFrontierOpponentClass ( trainerId ) ;
for ( ; gTrainerClassNames [ j ] [ i ] ! = EOS ; i + + )
gStringVar1 [ i ] = gTrainerClassNames [ j ] [ i ] ;
gStringVar1 [ i ] = CHAR_SPACE ;
gStringVar1 [ i + 1 ] = EOS ;
if ( trainerId = = TRAINER_PLAYER )
{
StringAppend ( gStringVar1 , gSaveBlock2Ptr - > playerName ) ;
}
else if ( trainerId = = TRAINER_FRONTIER_BRAIN )
{
CopyDomeBrainTrainerName ( gStringVar2 ) ;
StringAppend ( gStringVar1 , gStringVar2 ) ;
}
else
{
2018-08-25 11:55:16 +02:00
CopyDomeTrainerName ( gStringVar2 , trainerId ) ;
2018-08-19 17:13:05 +02:00
StringAppend ( gStringVar1 , gStringVar2 ) ;
}
2019-12-21 10:27:12 +01:00
// Print class and trainer name
2018-08-19 17:13:05 +02:00
textPrinter . currentX = GetStringCenterAlignXOffsetWithLetterSpacing ( textPrinter . fontId , gStringVar1 , 0xD0 , textPrinter . letterSpacing ) ;
2018-11-06 17:44:48 +01:00
textPrinter . currentChar = gStringVar1 ;
2018-08-19 17:13:05 +02:00
textPrinter . windowId = windowId ;
PutWindowTilemap ( windowId ) ;
CopyWindowToVram ( windowId , 3 ) ;
AddTextPrinter ( & textPrinter , 0 , NULL ) ;
textPrinter . letterSpacing = 0 ;
2019-12-21 10:27:12 +01:00
// Print names of the party mons
for ( i = 0 ; i < FRONTIER_PARTY_SIZE ; i + + )
2018-08-19 17:13:05 +02:00
{
2019-12-18 08:32:52 +01:00
textPrinter . currentY = sSpeciesNameTextYCoords [ i ] ;
2018-08-19 17:13:05 +02:00
if ( trainerId = = TRAINER_PLAYER )
2019-12-18 08:32:52 +01:00
textPrinter . currentChar = gSpeciesNames [ DOME_MONS [ trainerTournamentId ] [ i ] ] ;
2018-08-19 17:13:05 +02:00
else if ( trainerId = = TRAINER_FRONTIER_BRAIN )
2019-12-18 08:32:52 +01:00
textPrinter . currentChar = gSpeciesNames [ DOME_MONS [ trainerTournamentId ] [ i ] ] ;
2018-08-19 17:13:05 +02:00
else
2019-12-18 08:32:52 +01:00
textPrinter . currentChar = gSpeciesNames [ gFacilityTrainerMons [ DOME_MONS [ trainerTournamentId ] [ i ] ] . species ] ;
2018-08-19 17:13:05 +02:00
2018-08-19 20:21:37 +02:00
textPrinter . windowId = 1 + i + windowId ;
2018-08-19 17:13:05 +02:00
if ( i = = 1 )
textPrinter . currentX = 7 ;
else
textPrinter . currentX = 0 ;
2018-08-19 20:21:37 +02:00
PutWindowTilemap ( 1 + i + windowId ) ;
CopyWindowToVram ( 1 + i + windowId , 3 ) ;
2018-08-19 17:13:05 +02:00
AddTextPrinter ( & textPrinter , 0 , NULL ) ;
}
PutWindowTilemap ( windowId + 4 ) ;
CopyWindowToVram ( windowId + 4 , 3 ) ;
2019-12-21 10:27:12 +01:00
// Print text about trainers potential in the tourney
2018-08-19 17:13:05 +02:00
if ( trainerId = = TRAINER_FRONTIER_BRAIN )
2019-12-21 10:27:12 +01:00
textPrinter . currentChar = sBattleDomePotentialTexts [ DOME_TOURNAMENT_TRAINERS_COUNT ] ;
2018-08-19 17:13:05 +02:00
else
2019-02-08 18:08:25 +01:00
textPrinter . currentChar = sBattleDomePotentialTexts [ trainerTournamentId ] ;
2018-08-19 17:13:05 +02:00
textPrinter . fontId = 1 ;
textPrinter . windowId = windowId + 4 ;
textPrinter . currentX = 0 ;
textPrinter . y = 4 ;
textPrinter . currentY = 4 ;
AddTextPrinter ( & textPrinter , 0 , NULL ) ;
2019-12-21 10:27:12 +01:00
// Calculate move scores to determine the trainers battle style
2019-12-18 08:32:52 +01:00
for ( i = 0 ; i < FRONTIER_PARTY_SIZE ; i + + )
2018-08-19 17:13:05 +02:00
{
2018-12-25 18:50:15 +01:00
for ( j = 0 ; j < MAX_MON_MOVES ; j + + )
2018-08-19 17:13:05 +02:00
{
2019-12-21 10:27:12 +01:00
for ( k = 0 ; k < NUM_MOVE_QUALITIES ; k + + )
2018-08-19 17:13:05 +02:00
{
if ( trainerId = = TRAINER_FRONTIER_BRAIN )
2019-12-21 10:27:12 +01:00
allocatedArray [ k ] + = sBattleStyleMoveQualities [ GetFrontierBrainMonMove ( i , j ) ] [ k ] ;
2018-08-19 17:13:05 +02:00
else if ( trainerId = = TRAINER_PLAYER )
2019-12-21 10:27:12 +01:00
allocatedArray [ k ] + = sBattleStyleMoveQualities [ gSaveBlock2Ptr - > frontier . domePlayerPartyData [ i ] . moves [ j ] ] [ k ] ;
2018-08-19 17:13:05 +02:00
else
2019-12-21 10:27:12 +01:00
allocatedArray [ k ] + = sBattleStyleMoveQualities [ gFacilityTrainerMons [ DOME_MONS [ trainerTournamentId ] [ i ] ] . moves [ j ] ] [ k ] ;
2018-08-19 17:13:05 +02:00
}
}
}
2019-12-21 10:27:12 +01:00
// Get the battle style the trainer uses
// Each element of sBattleStyleThresholds is an array of point thresholds for particular move qualities
// If all the point thresholds in the array are satisfied, the player is considered to be using that battle style
for ( i = 0 ; i < ARRAY_COUNT ( sBattleStyleThresholds ) ; i + + )
2018-08-19 17:13:05 +02:00
{
2019-12-21 10:27:12 +01:00
int thresholdStatCount = 0 ;
2018-08-19 17:13:05 +02:00
2019-12-21 10:27:12 +01:00
for ( k = 0 , j = 0 ; j < NUM_MOVE_QUALITIES ; j + + )
2018-08-19 17:13:05 +02:00
{
2019-12-21 10:27:12 +01:00
if ( sBattleStyleThresholds [ i ] [ j ] ! = 0 )
2018-08-19 17:13:05 +02:00
{
2019-12-21 10:27:12 +01:00
thresholdStatCount + + ;
if ( allocatedArray [ j ] ! = 0 & & allocatedArray [ j ] > = sBattleStyleThresholds [ i ] [ j ] )
k + + ; // number of point thresholds met/exceeded
2018-08-19 17:13:05 +02:00
}
}
2019-12-21 10:27:12 +01:00
if ( thresholdStatCount = = k )
break ; // All thresholds for battle style met/exceeded, player uses this battle style
2018-08-19 17:13:05 +02:00
}
2019-12-21 10:27:12 +01:00
// Print the trainers battle style
2019-02-08 18:08:25 +01:00
textPrinter . currentChar = sBattleDomeOpponentStyleTexts [ i ] ;
2018-08-19 17:13:05 +02:00
textPrinter . y = 20 ;
textPrinter . currentY = 20 ;
AddTextPrinter ( & textPrinter , 0 , NULL ) ;
for ( i = 0 ; i < 18 ; i + + )
allocatedArray [ i ] = 0 ;
2019-12-21 10:27:12 +01:00
// Calculate EV/nature points for the stat portion of battle style
2018-08-19 17:13:05 +02:00
if ( trainerId = = TRAINER_FRONTIER_BRAIN | | trainerId = = TRAINER_PLAYER )
{
2019-12-18 08:32:52 +01:00
for ( i = 0 ; i < FRONTIER_PARTY_SIZE ; i + + )
2018-08-19 17:13:05 +02:00
{
2019-12-18 08:32:52 +01:00
for ( j = 0 ; j < NUM_STATS ; j + + )
2018-08-19 17:13:05 +02:00
{
if ( trainerId = = TRAINER_FRONTIER_BRAIN )
2018-11-01 21:31:10 +01:00
allocatedArray [ j ] = GetFrontierBrainMonEvs ( i , j ) ;
2018-08-19 17:13:05 +02:00
else
2019-12-21 10:27:12 +01:00
allocatedArray [ j ] = gSaveBlock2Ptr - > frontier . domePlayerPartyData [ i ] . evs [ j ] ;
2018-08-19 17:13:05 +02:00
}
2019-12-21 10:27:12 +01:00
allocatedArray [ NUM_STATS ] + = allocatedArray [ 0 ] ;
2018-08-19 17:13:05 +02:00
for ( j = 0 ; j < 5 ; j + + )
{
if ( trainerId = = TRAINER_FRONTIER_BRAIN )
2018-11-01 21:31:10 +01:00
nature = GetFrontierBrainMonNature ( i ) ;
2018-08-19 17:13:05 +02:00
else
2019-12-21 10:27:12 +01:00
nature = gSaveBlock2Ptr - > frontier . domePlayerPartyData [ i ] . nature ;
2018-08-19 17:13:05 +02:00
if ( gNatureStatTable [ nature ] [ j ] > 0 )
{
allocatedArray [ j + 7 ] + = ( allocatedArray [ j + 1 ] * 110 ) / 100 ;
}
else if ( gNatureStatTable [ nature ] [ j ] < 0 )
{
allocatedArray [ j + 7 ] + = ( allocatedArray [ j + 1 ] * 90 ) / 100 ;
allocatedArray [ j + 13 ] + + ;
}
else
{
allocatedArray [ j + 7 ] + = allocatedArray [ j + 1 ] ;
}
}
}
2019-12-21 10:27:12 +01:00
for ( j = 0 , i = 0 ; i < NUM_STATS ; i + + )
j + = allocatedArray [ NUM_STATS + i ] ;
for ( i = 0 ; i < NUM_STATS ; i + + )
allocatedArray [ i ] = ( allocatedArray [ NUM_STATS + i ] * 100 ) / j ;
2018-08-19 17:13:05 +02:00
}
else
{
2019-12-21 10:27:12 +01:00
for ( i = 0 ; i < FRONTIER_PARTY_SIZE ; i + + )
2018-08-19 17:13:05 +02:00
{
2019-12-18 08:32:52 +01:00
int evBits = gFacilityTrainerMons [ DOME_MONS [ trainerTournamentId ] [ i ] ] . evSpread ;
2018-11-18 20:00:36 +01:00
for ( k = 0 , j = 0 ; j < NUM_STATS ; j + + )
2018-08-19 17:13:05 +02:00
{
allocatedArray [ j ] = 0 ;
if ( evBits & 1 )
k + + ;
evBits > > = 1 ;
}
2018-08-29 20:38:54 +02:00
k = MAX_TOTAL_EVS / k ;
2019-12-18 08:32:52 +01:00
evBits = gFacilityTrainerMons [ DOME_MONS [ trainerTournamentId ] [ i ] ] . evSpread ;
2018-11-18 20:00:36 +01:00
for ( j = 0 ; j < NUM_STATS ; j + + )
2018-08-19 17:13:05 +02:00
{
if ( evBits & 1 )
allocatedArray [ j ] = k ;
evBits > > = 1 ;
}
2019-12-21 10:27:12 +01:00
allocatedArray [ NUM_STATS ] + = allocatedArray [ 0 ] ;
2018-08-19 17:13:05 +02:00
for ( j = 0 ; j < 5 ; j + + )
{
2019-12-18 08:32:52 +01:00
nature = gFacilityTrainerMons [ DOME_MONS [ trainerTournamentId ] [ i ] ] . nature ;
2018-08-19 17:13:05 +02:00
if ( gNatureStatTable [ nature ] [ j ] > 0 )
{
allocatedArray [ j + 7 ] + = ( allocatedArray [ j + 1 ] * 110 ) / 100 ;
}
else if ( gNatureStatTable [ nature ] [ j ] < 0 )
{
allocatedArray [ j + 7 ] + = ( allocatedArray [ j + 1 ] * 90 ) / 100 ;
allocatedArray [ j + 13 ] + + ;
}
else
{
allocatedArray [ j + 7 ] + = allocatedArray [ j + 1 ] ;
}
}
}
2019-12-21 10:27:12 +01:00
for ( j = 0 , i = 0 ; i < NUM_STATS ; i + + )
j + = allocatedArray [ i + NUM_STATS ] ;
for ( i = 0 ; i < NUM_STATS ; i + + )
allocatedArray [ i ] = ( allocatedArray [ NUM_STATS + i ] * 100 ) / j ;
2018-08-19 17:13:05 +02:00
}
for ( i = 0 , j = 0 , k = 0 ; k < 6 ; k + + )
{
if ( allocatedArray [ k ] > 29 )
{
if ( i = = 2 )
{
if ( allocatedArray [ 6 ] < allocatedArray [ k ] )
{
if ( allocatedArray [ 7 ] < allocatedArray [ k ] )
{
if ( allocatedArray [ 6 ] < allocatedArray [ 7 ] )
{
2018-08-19 20:21:37 +02:00
allocatedArray [ 6 ] = allocatedArray [ 7 ] ;
2018-08-19 17:13:05 +02:00
allocatedArray [ 7 ] = k ;
}
else
{
allocatedArray [ 7 ] = k ;
}
}
else
{
2018-08-19 20:21:37 +02:00
allocatedArray [ 6 ] = allocatedArray [ 7 ] ;
2018-08-19 17:13:05 +02:00
allocatedArray [ 7 ] = k ;
}
}
else
{
if ( allocatedArray [ 7 ] < allocatedArray [ k ] )
allocatedArray [ 7 ] = k ;
}
}
else
{
2018-08-19 20:21:37 +02:00
allocatedArray [ i + 6 ] = k ;
2018-08-19 17:13:05 +02:00
i + + ;
}
}
if ( allocatedArray [ k ] = = 0 )
{
if ( j = = 2 )
{
if ( allocatedArray [ k + 12 ] > = 2
2018-08-19 20:21:37 +02:00
| | ( ( allocatedArray [ k + 12 ] = = 1 & & allocatedArray [ 12 + allocatedArray [ 8 ] ] = = 0 & & allocatedArray [ 12 + allocatedArray [ 9 ] ] = = 0 )
2018-08-19 17:13:05 +02:00
)
)
{
allocatedArray [ 8 ] = allocatedArray [ 9 ] ;
allocatedArray [ 9 ] = k ;
}
else if ( allocatedArray [ k + 12 ] = = 1 & & allocatedArray [ 12 + allocatedArray [ 8 ] ] = = 0 )
{
allocatedArray [ 8 ] = allocatedArray [ 9 ] ;
allocatedArray [ 9 ] = k ;
}
else if ( allocatedArray [ k + 12 ] = = 1 & & allocatedArray [ 12 + allocatedArray [ 9 ] ] = = 0 )
{
allocatedArray [ 9 ] = k ;
}
}
else
{
allocatedArray [ j + 8 ] = k ;
j + + ;
}
}
}
if ( i = = 2 )
i = gUnknown_0860D349 [ allocatedArray [ 6 ] ] + ( allocatedArray [ 7 ] - ( allocatedArray [ 6 ] + 1 ) ) ;
else if ( i = = 1 )
i = allocatedArray [ 6 ] + 15 ;
else if ( j = = 2 )
i = gUnknown_0860D349 [ allocatedArray [ 8 ] ] + ( allocatedArray [ 9 ] - ( allocatedArray [ 8 ] + 1 ) ) + 21 ;
else if ( j = = 1 )
i = allocatedArray [ 8 ] + 36 ;
else
2019-12-21 10:27:12 +01:00
i = DOME_STATTEXT_WELL_BALANCED ;
2018-08-19 01:06:10 +02:00
2019-02-08 18:08:25 +01:00
textPrinter . currentChar = sBattleDomeOpponentStatsTexts [ i ] ;
2018-08-19 17:13:05 +02:00
textPrinter . y = 36 ;
textPrinter . currentY = 36 ;
AddTextPrinter ( & textPrinter , 0 , NULL ) ;
Free ( allocatedArray ) ;
2018-08-19 01:06:10 +02:00
}
2018-08-19 22:26:07 +02:00
2019-12-21 10:27:12 +01:00
// TODO:
static int BufferDomeWinString ( u8 matchNum , u8 * arg1 )
2018-08-19 22:26:07 +02:00
{
2019-02-08 18:08:25 +01:00
int i ;
2018-08-19 22:26:07 +02:00
u8 tournamentId ;
2019-12-21 10:27:12 +01:00
int winStringId = 0 ;
2019-02-08 18:08:25 +01:00
int count = 0 ;
2018-08-19 22:26:07 +02:00
2019-12-18 08:32:52 +01:00
for ( i = gUnknown_0860D3C4 [ matchNum ] [ 0 ] ; i < gUnknown_0860D3C4 [ matchNum ] [ 0 ] + gUnknown_0860D3C4 [ matchNum ] [ 1 ] ; i + + )
2018-08-19 22:26:07 +02:00
{
tournamentId = gUnknown_0860D3B4 [ i ] ;
2019-12-18 08:32:52 +01:00
if ( ! DOME_TRAINERS [ tournamentId ] . isEliminated )
2018-08-19 22:26:07 +02:00
{
arg1 [ count ] = tournamentId ;
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ tournamentId ] . trainerId = = TRAINER_PLAYER )
2018-08-19 22:26:07 +02:00
StringCopy ( gStringVar1 , gSaveBlock2Ptr - > playerName ) ;
2019-12-18 08:32:52 +01:00
else if ( DOME_TRAINERS [ tournamentId ] . trainerId = = TRAINER_FRONTIER_BRAIN )
2018-08-19 22:26:07 +02:00
CopyDomeBrainTrainerName ( gStringVar1 ) ;
else
2019-12-18 08:32:52 +01:00
CopyDomeTrainerName ( gStringVar1 , DOME_TRAINERS [ tournamentId ] . trainerId ) ;
2018-08-19 22:26:07 +02:00
count + + ;
}
}
2019-12-21 10:27:12 +01:00
// Neither trainer has been eliminated, battle hasn't occurred yet
2018-08-19 22:26:07 +02:00
if ( count = = 2 )
return 0 ;
2019-12-18 08:32:52 +01:00
for ( i = gUnknown_0860D3C4 [ matchNum ] [ 0 ] ; i < gUnknown_0860D3C4 [ matchNum ] [ 0 ] + gUnknown_0860D3C4 [ matchNum ] [ 1 ] ; i + + )
2018-08-19 22:26:07 +02:00
{
tournamentId = gUnknown_0860D3B4 [ i ] ;
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ tournamentId ] . isEliminated
& & DOME_TRAINERS [ tournamentId ] . eliminatedAt > = gUnknown_0860D3C4 [ matchNum ] [ 2 ] )
2018-08-19 22:26:07 +02:00
{
arg1 [ count ] = tournamentId ;
count + + ;
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ tournamentId ] . eliminatedAt = = gUnknown_0860D3C4 [ matchNum ] [ 2 ] )
2018-08-19 22:26:07 +02:00
{
2019-12-18 08:32:52 +01:00
StringCopy ( gStringVar2 , gMoveNames [ gSaveBlock2Ptr - > frontier . domeWinningMoves [ tournamentId ] ] ) ;
2019-12-21 10:27:12 +01:00
winStringId = DOME_TRAINERS [ tournamentId ] . forfeited * 2 ;
2019-12-18 08:32:52 +01:00
if ( gSaveBlock2Ptr - > frontier . domeWinningMoves [ tournamentId ] = = MOVE_NONE & & DOME_TRAINERS [ tournamentId ] . forfeited = = FALSE )
2019-12-21 10:27:12 +01:00
winStringId = 4 ;
2018-08-19 22:26:07 +02:00
}
else
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ tournamentId ] . trainerId = = TRAINER_PLAYER )
2018-08-19 22:26:07 +02:00
StringCopy ( gStringVar1 , gSaveBlock2Ptr - > playerName ) ;
2019-12-18 08:32:52 +01:00
else if ( DOME_TRAINERS [ tournamentId ] . trainerId = = TRAINER_FRONTIER_BRAIN )
2018-08-19 22:26:07 +02:00
CopyDomeBrainTrainerName ( gStringVar1 ) ;
else
2019-12-18 08:32:52 +01:00
CopyDomeTrainerName ( gStringVar1 , DOME_TRAINERS [ tournamentId ] . trainerId ) ;
2018-08-19 22:26:07 +02:00
}
}
if ( count = = 2 )
break ;
}
2019-12-18 08:32:52 +01:00
if ( matchNum = = 14 )
2019-12-21 10:27:12 +01:00
return winStringId + 2 ;
2018-08-19 22:26:07 +02:00
else
2019-12-21 10:27:12 +01:00
return winStringId + 1 ;
2018-08-19 22:26:07 +02:00
}
2018-08-20 22:56:05 +02:00
2018-08-21 23:36:59 +02:00
static void DisplayMatchInfoOnCard ( u8 flags , u8 matchNo )
2018-08-20 22:56:05 +02:00
{
2018-11-06 17:44:48 +01:00
struct TextPrinterTemplate textPrinter ;
2019-02-08 18:08:25 +01:00
int tournamentIds [ 2 ] ;
int trainerIds [ 2 ] ;
2018-08-20 22:56:05 +02:00
bool32 lost [ 2 ] ;
2019-02-08 18:08:25 +01:00
int i ;
int winStringId = 0 ;
int arrId = 0 ;
int windowId = 0 ;
int x = 0 , y = 0 ;
2018-08-20 22:56:05 +02:00
u8 palSlot = 0 ;
if ( flags & 1 )
arrId = 8 , windowId = 9 , palSlot = 2 ;
if ( flags & 2 )
x = 256 ;
if ( flags & 4 )
y = 160 ;
if ( flags & 8 )
x = - 256 ;
if ( flags & 0x10 )
y = - 160 ;
// Copy trainers information to handy arrays.
2019-12-21 10:27:12 +01:00
winStringId = BufferDomeWinString ( matchNo , sBattleDomeStruct - > unk_11 ) ;
2018-08-20 22:56:05 +02:00
for ( i = 0 ; i < 2 ; i + + )
{
2018-08-25 19:59:47 +02:00
tournamentIds [ i ] = sBattleDomeStruct - > unk_11 [ i ] ;
2019-12-18 08:32:52 +01:00
trainerIds [ i ] = DOME_TRAINERS [ tournamentIds [ i ] ] . trainerId ;
if ( DOME_TRAINERS [ tournamentIds [ i ] ] . eliminatedAt < = gUnknown_0860D3C4 [ matchNo ] [ 2 ]
& & DOME_TRAINERS [ tournamentIds [ i ] ] . isEliminated )
2018-08-20 22:56:05 +02:00
lost [ i ] = TRUE ;
else
lost [ i ] = FALSE ;
}
// Draw first trainer sprite.
if ( trainerIds [ 0 ] = = TRAINER_PLAYER )
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > arr [ arrId ] = CreateTrainerPicSprite ( PlayerGenderToFrontTrainerPicId ( gSaveBlock2Ptr - > playerGender ) , TRUE , x + 48 , y + 88 , palSlot + 12 , 0xFFFF ) ;
2018-08-20 22:56:05 +02:00
else if ( trainerIds [ 0 ] = = TRAINER_FRONTIER_BRAIN )
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > arr [ arrId ] = CreateTrainerPicSprite ( GetDomeBrainTrainerPicId ( ) , TRUE , x + 48 , y + 88 , palSlot + 12 , 0xFFFF ) ;
2018-08-20 22:56:05 +02:00
else
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > arr [ arrId ] = CreateTrainerPicSprite ( GetFrontierTrainerFrontSpriteId ( trainerIds [ 0 ] ) , TRUE , x + 48 , y + 88 , palSlot + 12 , 0xFFFF ) ;
2018-08-20 22:56:05 +02:00
if ( flags & 0x1E )
2018-09-10 17:25:58 +02:00
gSprites [ sBattleDomeStruct - > arr [ arrId ] ] . invisible = TRUE ;
2018-08-20 22:56:05 +02:00
if ( lost [ 0 ] )
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ arrId ] ] . oam . paletteNum = 3 ;
2018-08-20 22:56:05 +02:00
// Draw second trainer sprite.
if ( trainerIds [ 1 ] = = TRAINER_PLAYER )
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > arr [ 1 + arrId ] = CreateTrainerPicSprite ( PlayerGenderToFrontTrainerPicId ( gSaveBlock2Ptr - > playerGender ) , TRUE , x + 192 , y + 88 , palSlot + 13 , 0xFFFF ) ;
2018-08-20 22:56:05 +02:00
else if ( trainerIds [ 1 ] = = TRAINER_FRONTIER_BRAIN )
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > arr [ 1 + arrId ] = CreateTrainerPicSprite ( GetDomeBrainTrainerPicId ( ) , TRUE , x + 192 , y + 88 , palSlot + 13 , 0xFFFF ) ;
2018-08-20 22:56:05 +02:00
else
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > arr [ 1 + arrId ] = CreateTrainerPicSprite ( GetFrontierTrainerFrontSpriteId ( trainerIds [ 1 ] ) , TRUE , x + 192 , y + 88 , palSlot + 13 , 0xFFFF ) ;
2018-08-20 22:56:05 +02:00
if ( flags & 0x1E )
2018-09-10 17:25:58 +02:00
gSprites [ sBattleDomeStruct - > arr [ 1 + arrId ] ] . invisible = TRUE ;
2018-08-20 22:56:05 +02:00
if ( lost [ 1 ] )
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ 1 + arrId ] ] . oam . paletteNum = 3 ;
2018-08-20 22:56:05 +02:00
// Draw first trainer's pokemon icons.
2019-12-21 10:27:12 +01:00
for ( i = 0 ; i < FRONTIER_PARTY_SIZE ; i + + )
2018-08-20 22:56:05 +02:00
{
if ( trainerIds [ 0 ] = = TRAINER_PLAYER )
{
2019-12-18 08:32:52 +01:00
sBattleDomeStruct - > arr [ 2 + i + arrId ] = CreateMonIcon ( DOME_MONS [ tournamentIds [ 0 ] ] [ i ] ,
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon ,
2018-08-26 15:51:14 +02:00
x | sFirstTrainerMonX [ i ] ,
y + sFirstTrainerMonY [ i ] ,
2018-08-20 22:56:05 +02:00
0 , 0 , TRUE ) ;
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ 2 + i + arrId ] ] . oam . priority = 0 ;
2018-08-20 22:56:05 +02:00
}
else if ( trainerIds [ 0 ] = = TRAINER_FRONTIER_BRAIN )
{
2019-12-18 08:32:52 +01:00
sBattleDomeStruct - > arr [ 2 + i + arrId ] = CreateMonIcon ( DOME_MONS [ tournamentIds [ 0 ] ] [ i ] ,
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon ,
2018-08-26 15:51:14 +02:00
x | sFirstTrainerMonX [ i ] ,
y + sFirstTrainerMonY [ i ] ,
2018-08-20 22:56:05 +02:00
0 , 0 , TRUE ) ;
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ 2 + i + arrId ] ] . oam . priority = 0 ;
2018-08-20 22:56:05 +02:00
}
else
{
2019-12-18 08:32:52 +01:00
sBattleDomeStruct - > arr [ 2 + i + arrId ] = CreateMonIcon ( gFacilityTrainerMons [ DOME_MONS [ tournamentIds [ 0 ] ] [ i ] ] . species ,
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon ,
2018-08-26 15:51:14 +02:00
x | sFirstTrainerMonX [ i ] ,
y + sFirstTrainerMonY [ i ] ,
2018-08-20 22:56:05 +02:00
0 , 0 , TRUE ) ;
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ 2 + i + arrId ] ] . oam . priority = 0 ;
2018-08-20 22:56:05 +02:00
}
if ( flags & 0x1E )
2018-09-10 17:25:58 +02:00
gSprites [ sBattleDomeStruct - > arr [ 2 + i + arrId ] ] . invisible = TRUE ;
2018-08-20 22:56:05 +02:00
if ( lost [ 0 ] )
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ 2 + i + arrId ] ] . oam . paletteNum = 3 ;
gSprites [ sBattleDomeStruct - > arr [ 2 + i + arrId ] ] . sMonIconStill = TRUE ;
2018-08-20 22:56:05 +02:00
}
}
// Draw second trainer's pokemon icons.
2019-12-21 10:27:12 +01:00
for ( i = 0 ; i < FRONTIER_PARTY_SIZE ; i + + )
2018-08-20 22:56:05 +02:00
{
if ( trainerIds [ 1 ] = = TRAINER_PLAYER )
{
2019-12-18 08:32:52 +01:00
sBattleDomeStruct - > arr [ 5 + i + arrId ] = CreateMonIcon ( DOME_MONS [ tournamentIds [ 1 ] ] [ i ] ,
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon ,
2018-08-26 15:51:14 +02:00
x | sSecondTrainerMonX [ i ] ,
y + sSecondTrainerMonY [ i ] ,
2018-08-20 22:56:05 +02:00
0 , 0 , TRUE ) ;
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ 5 + i + arrId ] ] . oam . priority = 0 ;
2018-08-20 22:56:05 +02:00
}
else if ( trainerIds [ 1 ] = = TRAINER_FRONTIER_BRAIN )
{
2019-12-18 08:32:52 +01:00
sBattleDomeStruct - > arr [ 5 + i + arrId ] = CreateMonIcon ( DOME_MONS [ tournamentIds [ 1 ] ] [ i ] ,
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon ,
2018-08-26 15:51:14 +02:00
x | sSecondTrainerMonX [ i ] ,
y + sSecondTrainerMonY [ i ] ,
2018-08-20 22:56:05 +02:00
0 , 0 , TRUE ) ;
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ 5 + i + arrId ] ] . oam . priority = 0 ;
2018-08-20 22:56:05 +02:00
}
else
{
2019-12-18 08:32:52 +01:00
sBattleDomeStruct - > arr [ 5 + i + arrId ] = CreateMonIcon ( gFacilityTrainerMons [ DOME_MONS [ tournamentIds [ 1 ] ] [ i ] ] . species ,
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon ,
2018-08-26 15:51:14 +02:00
x | sSecondTrainerMonX [ i ] ,
y + sSecondTrainerMonY [ i ] ,
2018-08-20 22:56:05 +02:00
0 , 0 , TRUE ) ;
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ 5 + i + arrId ] ] . oam . priority = 0 ;
2018-08-20 22:56:05 +02:00
}
if ( flags & 0x1E )
2018-09-10 17:25:58 +02:00
gSprites [ sBattleDomeStruct - > arr [ 5 + i + arrId ] ] . invisible = TRUE ;
2018-08-20 22:56:05 +02:00
if ( lost [ 1 ] )
{
2018-08-25 19:59:47 +02:00
gSprites [ sBattleDomeStruct - > arr [ 5 + i + arrId ] ] . oam . paletteNum = 3 ;
gSprites [ sBattleDomeStruct - > arr [ 5 + i + arrId ] ] . sMonIconStill = TRUE ;
2018-08-20 22:56:05 +02:00
}
}
// Print the win string (or 'Let the battle begin!' one).
textPrinter . x = 0 ;
textPrinter . y = 2 ;
textPrinter . currentX = textPrinter . x ;
textPrinter . currentY = textPrinter . y ;
textPrinter . letterSpacing = 0 ;
textPrinter . lineSpacing = 0 ;
2018-11-06 18:30:21 +01:00
textPrinter . unk = 0 ;
2019-12-21 10:27:12 +01:00
textPrinter . fgColor = TEXT_DYNAMIC_COLOR_5 ;
textPrinter . bgColor = TEXT_COLOR_TRANSPARENT ;
textPrinter . shadowColor = TEXT_DYNAMIC_COLOR_4 ;
2019-02-08 18:08:25 +01:00
StringExpandPlaceholders ( gStringVar4 , sBattleDomeWinTexts [ winStringId ] ) ;
2018-11-06 17:44:48 +01:00
textPrinter . currentChar = gStringVar4 ;
2018-08-20 22:56:05 +02:00
textPrinter . windowId = windowId + 8 ;
textPrinter . fontId = 1 ;
PutWindowTilemap ( windowId + 8 ) ;
CopyWindowToVram ( windowId + 8 , 3 ) ;
textPrinter . currentX = 0 ;
textPrinter . currentY = textPrinter . y = 0 ;
AddTextPrinter ( & textPrinter , 0 , NULL ) ;
// Print first trainer's name.
if ( trainerIds [ 0 ] = = TRAINER_PLAYER )
StringCopy ( gStringVar1 , gSaveBlock2Ptr - > playerName ) ;
else if ( trainerIds [ 0 ] = = TRAINER_FRONTIER_BRAIN )
CopyDomeBrainTrainerName ( gStringVar1 ) ;
else
2018-08-25 11:55:16 +02:00
CopyDomeTrainerName ( gStringVar1 , trainerIds [ 0 ] ) ;
2018-08-20 22:56:05 +02:00
textPrinter . fontId = 2 ;
textPrinter . letterSpacing = 2 ;
2018-11-06 17:44:48 +01:00
textPrinter . currentChar = gStringVar1 ;
2018-08-20 22:56:05 +02:00
textPrinter . windowId = windowId + 6 ;
2018-11-06 17:44:48 +01:00
textPrinter . currentX = GetStringCenterAlignXOffsetWithLetterSpacing ( textPrinter . fontId , textPrinter . currentChar , 0x40 , textPrinter . letterSpacing ) ;
2018-08-20 22:56:05 +02:00
textPrinter . currentY = textPrinter . y = 2 ;
PutWindowTilemap ( windowId + 6 ) ;
CopyWindowToVram ( windowId + 6 , 3 ) ;
AddTextPrinter ( & textPrinter , 0 , NULL ) ;
// Print second trainer's name.
if ( trainerIds [ 1 ] = = TRAINER_PLAYER )
StringCopy ( gStringVar1 , gSaveBlock2Ptr - > playerName ) ;
else if ( trainerIds [ 1 ] = = TRAINER_FRONTIER_BRAIN )
CopyDomeBrainTrainerName ( gStringVar1 ) ;
else
2018-08-25 11:55:16 +02:00
CopyDomeTrainerName ( gStringVar1 , trainerIds [ 1 ] ) ;
2018-08-20 22:56:05 +02:00
2018-11-06 17:44:48 +01:00
textPrinter . currentChar = gStringVar1 ;
2018-08-20 22:56:05 +02:00
textPrinter . windowId = windowId + 7 ;
2018-11-06 17:44:48 +01:00
textPrinter . currentX = GetStringCenterAlignXOffsetWithLetterSpacing ( textPrinter . fontId , textPrinter . currentChar , 0x40 , textPrinter . letterSpacing ) ;
2018-08-20 22:56:05 +02:00
textPrinter . currentY = textPrinter . y = 2 ;
PutWindowTilemap ( windowId + 7 ) ;
CopyWindowToVram ( windowId + 7 , 3 ) ;
AddTextPrinter ( & textPrinter , 0 , NULL ) ;
// Print match number.
textPrinter . letterSpacing = 0 ;
2019-02-08 18:08:25 +01:00
textPrinter . currentChar = sBattleDomeMatchNumberTexts [ matchNo ] ;
2018-08-20 22:56:05 +02:00
textPrinter . windowId = windowId + 5 ;
2018-11-06 17:44:48 +01:00
textPrinter . currentX = GetStringCenterAlignXOffsetWithLetterSpacing ( textPrinter . fontId , textPrinter . currentChar , 0xA0 , textPrinter . letterSpacing ) ;
2018-08-20 22:56:05 +02:00
textPrinter . currentY = textPrinter . y = 2 ;
PutWindowTilemap ( windowId + 5 ) ;
CopyWindowToVram ( windowId + 5 , 3 ) ;
AddTextPrinter ( & textPrinter , 0 , NULL ) ;
}
2018-08-21 23:36:59 +02:00
2019-02-08 18:08:25 +01:00
static void ShowDomeTourneyTree ( void )
2018-08-21 23:36:59 +02:00
{
2019-02-08 18:08:25 +01:00
u8 taskId = CreateTask ( Task_ShowTourneyTree , 0 ) ;
2018-08-21 23:36:59 +02:00
gTasks [ taskId ] . data [ 0 ] = 0 ;
gTasks [ taskId ] . data [ 1 ] = 0 ;
gTasks [ taskId ] . data [ 2 ] = 2 ;
gTasks [ taskId ] . data [ 4 ] = 0 ;
2018-08-25 11:55:16 +02:00
SetMainCallback2 ( CB2_BattleDome ) ;
2018-08-21 23:36:59 +02:00
}
2019-02-08 18:08:25 +01:00
static void ShowPreviousDomeResultsTourneyTree ( void )
2018-08-21 23:36:59 +02:00
{
u8 taskId ;
2019-12-21 10:27:12 +01:00
SetFacilityTrainerAndMonPtrs ( ) ;
2019-12-18 08:32:52 +01:00
gSaveBlock2Ptr - > frontier . lvlMode = gSaveBlock2Ptr - > frontier . domeLvlMode - 1 ;
gSaveBlock2Ptr - > frontier . curChallengeBattleNum = DOME_FINAL ;
2019-02-08 18:08:25 +01:00
taskId = CreateTask ( Task_ShowTourneyTree , 0 ) ;
2018-08-21 23:36:59 +02:00
gTasks [ taskId ] . data [ 0 ] = 0 ;
gTasks [ taskId ] . data [ 1 ] = 0 ;
gTasks [ taskId ] . data [ 2 ] = 2 ;
gTasks [ taskId ] . data [ 4 ] = 1 ;
2018-08-25 11:55:16 +02:00
SetMainCallback2 ( CB2_BattleDome ) ;
2018-08-21 23:36:59 +02:00
}
2018-08-26 15:51:14 +02:00
static void sub_819395C ( u8 taskId )
2018-08-21 23:36:59 +02:00
{
u8 newTaskId = 0 ;
2019-02-08 18:08:25 +01:00
int spriteId = gTasks [ taskId ] . data [ 1 ] ;
2018-08-21 23:36:59 +02:00
switch ( gTasks [ taskId ] . data [ 0 ] )
{
case 0 :
if ( ! gPaletteFade . active )
{
2018-08-29 20:38:54 +02:00
BeginNormalPaletteFade ( 0xFFFFFFFF , 0 , 0x10 , 0 , RGB_BLACK ) ;
2018-08-21 23:36:59 +02:00
gTasks [ taskId ] . data [ 0 ] = 1 ;
StartSpriteAnim ( & gSprites [ spriteId ] , 1 ) ;
}
break ;
case 1 :
if ( ! gPaletteFade . active )
gTasks [ taskId ] . data [ 0 ] = 2 ;
break ;
case 2 :
2019-02-08 18:08:25 +01:00
switch ( UpdateTourneyTreeCursor ( taskId ) )
2018-08-21 23:36:59 +02:00
{
case 0 :
default :
2018-08-29 20:38:54 +02:00
BeginNormalPaletteFade ( 0xFFFFFFFF , 0 , 0 , 0x10 , RGB_BLACK ) ;
2018-08-21 23:36:59 +02:00
gTasks [ taskId ] . data [ 0 ] = 7 ;
break ;
case 1 :
break ;
case 2 :
2018-08-29 20:38:54 +02:00
BeginNormalPaletteFade ( 0xFFFFFFFF , 0 , 0 , 0x10 , RGB_BLACK ) ;
2018-08-21 23:36:59 +02:00
gTasks [ taskId ] . data [ 0 ] = 3 ;
break ;
case 3 :
2018-08-29 20:38:54 +02:00
BeginNormalPaletteFade ( 0xFFFFFFFF , 0 , 0 , 0x10 , RGB_BLACK ) ;
2018-08-21 23:36:59 +02:00
gTasks [ taskId ] . data [ 0 ] = 5 ;
break ;
}
break ;
case 3 :
if ( ! gPaletteFade . active )
{
FreeAllWindowBuffers ( ) ;
ScanlineEffect_Stop ( ) ;
2018-08-25 19:59:47 +02:00
FREE_AND_SET_NULL ( sTilemapBuffer ) ;
2019-02-08 18:08:25 +01:00
newTaskId = CreateTask ( Task_ShowOpponentInfo , 0 ) ;
2018-08-21 23:36:59 +02:00
gTasks [ newTaskId ] . data [ 0 ] = 0 ;
2019-02-08 18:08:25 +01:00
gTasks [ newTaskId ] . data [ 1 ] = sTourneyTreeTrainerIds [ spriteId ] ;
2018-08-21 23:36:59 +02:00
gTasks [ newTaskId ] . data [ 2 ] = 1 ;
gTasks [ newTaskId ] . data [ 3 ] = taskId ;
gTasks [ taskId ] . data [ 0 ] = 4 ;
2018-08-25 19:59:47 +02:00
sBattleDomeStruct - > unk_10 = 0 ;
2018-08-21 23:36:59 +02:00
}
break ;
case 4 :
break ;
case 5 :
if ( ! gPaletteFade . active )
{
FreeAllWindowBuffers ( ) ;
ScanlineEffect_Stop ( ) ;
2018-08-25 19:59:47 +02:00
FREE_AND_SET_NULL ( sTilemapBuffer ) ;
2019-02-08 18:08:25 +01:00
newTaskId = CreateTask ( Task_ShowOpponentInfo , 0 ) ;
2018-08-21 23:36:59 +02:00
gTasks [ newTaskId ] . data [ 0 ] = 0 ;
gTasks [ newTaskId ] . data [ 1 ] = spriteId - 16 ;
gTasks [ newTaskId ] . data [ 2 ] = 2 ;
gTasks [ newTaskId ] . data [ 3 ] = taskId ;
gTasks [ taskId ] . data [ 0 ] = 6 ;
}
break ;
case 6 :
break ;
case 7 :
if ( ! gPaletteFade . active )
{
FreeAllWindowBuffers ( ) ;
ScanlineEffect_Stop ( ) ;
2018-08-25 19:59:47 +02:00
FREE_AND_SET_NULL ( sTilemapBuffer ) ;
2018-08-21 23:36:59 +02:00
SetMainCallback2 ( CB2_ReturnToFieldContinueScriptPlayMapMusic ) ;
DestroyTask ( gTasks [ taskId ] . data [ 7 ] ) ;
DestroyTask ( taskId ) ;
}
break ;
}
}
2019-02-08 18:08:25 +01:00
static u8 UpdateTourneyTreeCursor ( u8 taskId )
2018-08-21 23:36:59 +02:00
{
u8 retVal = 1 ;
2019-02-08 18:08:25 +01:00
int direction = 4 ;
int tourneyTreeCursorSpriteId = gTasks [ taskId ] . data [ 1 ] ;
int roundId = gSaveBlock2Ptr - > frontier . curChallengeBattleNum ;
2018-08-21 23:36:59 +02:00
2019-02-08 18:08:25 +01:00
if ( gMain . newKeys = = B_BUTTON | | ( gMain . newKeys & A_BUTTON & & tourneyTreeCursorSpriteId = = 31 ) )
2018-08-21 23:36:59 +02:00
{
PlaySE ( SE_SELECT ) ;
retVal = 0 ;
}
else if ( gMain . newKeys & A_BUTTON )
{
2019-12-18 08:32:52 +01:00
if ( tourneyTreeCursorSpriteId < DOME_TOURNAMENT_TRAINERS_COUNT )
2018-08-21 23:36:59 +02:00
{
PlaySE ( SE_SELECT ) ;
retVal = 2 ;
}
else
{
PlaySE ( SE_SELECT ) ;
retVal = 3 ;
}
}
else
{
2019-02-08 18:08:25 +01:00
if ( gMain . newKeys = = DPAD_UP & & sTourneyTreeCursorMovementMap [ tourneyTreeCursorSpriteId ] [ roundId ] [ 0 ] ! = 0xFF )
direction = 0 ;
else if ( gMain . newKeys = = DPAD_DOWN & & sTourneyTreeCursorMovementMap [ tourneyTreeCursorSpriteId ] [ roundId ] [ 1 ] ! = 0xFF )
direction = 1 ;
else if ( gMain . newKeys = = DPAD_LEFT & & sTourneyTreeCursorMovementMap [ tourneyTreeCursorSpriteId ] [ roundId ] [ 2 ] ! = 0xFF )
direction = 2 ;
else if ( gMain . newKeys = = DPAD_RIGHT & & sTourneyTreeCursorMovementMap [ tourneyTreeCursorSpriteId ] [ roundId ] [ 3 ] ! = 0xFF )
direction = 3 ;
2018-08-21 23:36:59 +02:00
}
2019-02-08 18:08:25 +01:00
if ( direction ! = 4 )
2018-08-21 23:36:59 +02:00
{
PlaySE ( SE_SELECT ) ;
2019-02-08 18:08:25 +01:00
StartSpriteAnim ( & gSprites [ tourneyTreeCursorSpriteId ] , 0 ) ;
tourneyTreeCursorSpriteId = sTourneyTreeCursorMovementMap [ tourneyTreeCursorSpriteId ] [ roundId ] [ direction ] ;
StartSpriteAnim ( & gSprites [ tourneyTreeCursorSpriteId ] , 1 ) ;
gTasks [ taskId ] . data [ 1 ] = tourneyTreeCursorSpriteId ;
2018-08-21 23:36:59 +02:00
}
return retVal ;
}
2018-08-25 11:55:16 +02:00
2019-02-08 18:08:25 +01:00
static void ShowNonInteractiveDomeTourneyTree ( void )
2018-08-25 11:55:16 +02:00
{
2019-02-08 18:08:25 +01:00
u8 taskId = CreateTask ( Task_ShowTourneyTree , 0 ) ;
2018-08-25 11:55:16 +02:00
gTasks [ taskId ] . data [ 0 ] = 0 ;
gTasks [ taskId ] . data [ 1 ] = 1 ;
gTasks [ taskId ] . data [ 2 ] = 2 ;
gTasks [ taskId ] . data [ 4 ] = 0 ;
SetMainCallback2 ( CB2_BattleDome ) ;
}
2019-02-08 18:08:25 +01:00
static void ResolveDomeRoundWinners ( void )
2018-08-25 11:55:16 +02:00
{
2019-02-08 18:08:25 +01:00
int i ;
2018-08-25 11:55:16 +02:00
2019-12-18 08:32:52 +01:00
if ( gSpecialVar_0x8005 = = DOME_PLAYER_WON_MATCH )
2018-08-25 11:55:16 +02:00
{
2019-12-18 08:32:52 +01:00
DOME_TRAINERS [ TrainerIdToTournamentId ( gTrainerBattleOpponent_A ) ] . isEliminated = TRUE ;
DOME_TRAINERS [ TrainerIdToTournamentId ( gTrainerBattleOpponent_A ) ] . eliminatedAt = gSaveBlock2Ptr - > frontier . curChallengeBattleNum ;
gSaveBlock2Ptr - > frontier . domeWinningMoves [ TrainerIdToTournamentId ( gTrainerBattleOpponent_A ) ] = gBattleResults . lastUsedMovePlayer ;
2018-10-21 00:06:42 +02:00
if ( gSaveBlock2Ptr - > frontier . curChallengeBattleNum < DOME_FINAL )
DecideRoundWinners ( gSaveBlock2Ptr - > frontier . curChallengeBattleNum ) ;
2018-08-25 11:55:16 +02:00
}
2019-12-18 08:32:52 +01:00
else // DOME_PLAYER_LOST_MATCH or DOME_PLAYER_RETIRED
2018-08-25 11:55:16 +02:00
{
2019-12-18 08:32:52 +01:00
DOME_TRAINERS [ TrainerIdToTournamentId ( TRAINER_PLAYER ) ] . isEliminated = TRUE ;
DOME_TRAINERS [ TrainerIdToTournamentId ( TRAINER_PLAYER ) ] . eliminatedAt = gSaveBlock2Ptr - > frontier . curChallengeBattleNum ;
gSaveBlock2Ptr - > frontier . domeWinningMoves [ TrainerIdToTournamentId ( TRAINER_PLAYER ) ] = gBattleResults . lastUsedMoveOpponent ;
if ( gBattleOutcome = = B_OUTCOME_FORFEITED | | gSpecialVar_0x8005 = = DOME_PLAYER_RETIRED )
DOME_TRAINERS [ TrainerIdToTournamentId ( TRAINER_PLAYER ) ] . forfeited = TRUE ;
2018-10-21 00:06:42 +02:00
for ( i = gSaveBlock2Ptr - > frontier . curChallengeBattleNum ; i < DOME_ROUNDS_COUNT ; i + + )
2018-08-25 18:46:15 +02:00
DecideRoundWinners ( i ) ;
2018-08-25 11:55:16 +02:00
}
}
2019-02-08 18:08:25 +01:00
static u16 GetWinningMove ( int winnerTournamentId , int loserTournamentId , u8 roundId )
2018-08-25 11:55:16 +02:00
{
2019-02-08 18:08:25 +01:00
int i , j , k ;
2019-12-18 08:32:52 +01:00
int moveScores [ MAX_MON_MOVES * FRONTIER_PARTY_SIZE ] ;
u16 moveIds [ MAX_MON_MOVES * FRONTIER_PARTY_SIZE ] ;
2018-08-25 11:55:16 +02:00
u16 bestScore = 0 ;
u16 bestId = 0 ;
2019-02-08 18:08:25 +01:00
int movePower = 0 ;
2018-10-27 00:04:18 +02:00
SetFacilityPtrsGetLevel ( ) ;
2018-08-25 11:55:16 +02:00
// Calc move points of all 4 moves for all 3 pokemon hitting all 3 target mons.
2019-12-18 08:32:52 +01:00
for ( i = 0 ; i < FRONTIER_PARTY_SIZE ; i + + )
2018-08-25 11:55:16 +02:00
{
2018-12-25 18:50:15 +01:00
for ( j = 0 ; j < MAX_MON_MOVES ; j + + )
2018-08-25 11:55:16 +02:00
{
2019-12-18 08:32:52 +01:00
// TODO: Clean this up, looks like a different data structure (2D array)
moveScores [ i * MAX_MON_MOVES + j ] = 0 ;
if ( DOME_TRAINERS [ winnerTournamentId ] . trainerId = = TRAINER_FRONTIER_BRAIN )
moveIds [ i * MAX_MON_MOVES + j ] = GetFrontierBrainMonMove ( i , j ) ;
2018-08-25 11:55:16 +02:00
else
2019-12-18 08:32:52 +01:00
moveIds [ i * MAX_MON_MOVES + j ] = gFacilityTrainerMons [ DOME_MONS [ winnerTournamentId ] [ i ] ] . moves [ j ] ;
2018-08-25 11:55:16 +02:00
2019-12-18 08:32:52 +01:00
movePower = gBattleMoves [ moveIds [ i * MAX_MON_MOVES + j ] ] . power ;
2018-08-25 11:55:16 +02:00
if ( movePower = = 0 )
movePower = 40 ;
else if ( movePower = = 1 )
movePower = 60 ;
2019-12-18 08:32:52 +01:00
else if ( moveIds [ i * MAX_MON_MOVES + j ] = = MOVE_SELF_DESTRUCT
| | moveIds [ i * MAX_MON_MOVES + j ] = = MOVE_EXPLOSION )
2018-08-25 11:55:16 +02:00
movePower / = 2 ;
2019-12-18 08:32:52 +01:00
for ( k = 0 ; k < FRONTIER_PARTY_SIZE ; k + + )
2018-08-25 11:55:16 +02:00
{
u32 var = 0 ;
2019-12-18 08:32:52 +01:00
u16 targetSpecies = SPECIES_NONE ;
u16 targetAbility = ABILITY_NONE ;
2018-08-25 11:55:16 +02:00
do
{
var = Random32 ( ) ;
2019-12-18 08:32:52 +01:00
} while ( gFacilityTrainerMons [ DOME_MONS [ loserTournamentId ] [ k ] ] . nature ! = GetNatureFromPersonality ( var ) ) ;
2018-08-25 11:55:16 +02:00
2019-12-18 08:32:52 +01:00
targetSpecies = gFacilityTrainerMons [ DOME_MONS [ loserTournamentId ] [ k ] ] . species ;
2018-08-25 11:55:16 +02:00
if ( var & 1 )
2019-05-14 15:42:55 +02:00
targetAbility = gBaseStats [ targetSpecies ] . abilities [ 1 ] ;
2018-08-25 11:55:16 +02:00
else
2019-05-14 15:42:55 +02:00
targetAbility = gBaseStats [ targetSpecies ] . abilities [ 0 ] ;
2018-08-25 11:55:16 +02:00
2019-12-18 08:32:52 +01:00
var = AI_TypeCalc ( moveIds [ i * MAX_MON_MOVES + j ] , targetSpecies , targetAbility ) ;
2018-08-25 11:55:16 +02:00
if ( var & MOVE_RESULT_NOT_VERY_EFFECTIVE & & var & MOVE_RESULT_SUPER_EFFECTIVE )
2019-12-18 08:32:52 +01:00
moveScores [ i * MAX_MON_MOVES + j ] + = movePower ;
2018-08-25 11:55:16 +02:00
else if ( var & MOVE_RESULT_NO_EFFECT )
2019-12-18 08:32:52 +01:00
moveScores [ i * MAX_MON_MOVES + j ] + = 0 ;
2018-08-25 11:55:16 +02:00
else if ( var & MOVE_RESULT_SUPER_EFFECTIVE )
2019-12-18 08:32:52 +01:00
moveScores [ i * MAX_MON_MOVES + j ] + = movePower * 2 ;
2018-08-25 11:55:16 +02:00
else if ( var & MOVE_RESULT_NOT_VERY_EFFECTIVE )
2019-12-18 08:32:52 +01:00
moveScores [ i * MAX_MON_MOVES + j ] + = movePower / 2 ;
2018-08-25 11:55:16 +02:00
else
2019-12-18 08:32:52 +01:00
moveScores [ i * MAX_MON_MOVES + j ] + = movePower ;
2018-08-25 11:55:16 +02:00
}
2019-12-18 08:32:52 +01:00
if ( bestScore < moveScores [ i * MAX_MON_MOVES + j ] )
2018-08-25 11:55:16 +02:00
{
2019-12-18 08:32:52 +01:00
bestId = i * MAX_MON_MOVES + j ;
bestScore = moveScores [ i * MAX_MON_MOVES + j ] ;
2018-08-25 11:55:16 +02:00
}
2019-12-18 08:32:52 +01:00
else if ( bestScore = = moveScores [ i * MAX_MON_MOVES + j ] )
2018-08-25 11:55:16 +02:00
{
2019-12-18 08:32:52 +01:00
if ( moveIds [ bestId ] < moveIds [ i * MAX_MON_MOVES + j ] ) // Why not use (Random() & 1) instead of promoting moves with a higher id?
bestId = i * MAX_MON_MOVES + j ;
2018-08-25 11:55:16 +02:00
}
}
}
j = bestId ;
goto LABEL ;
while ( j ! = 0 )
{
2019-12-18 08:32:52 +01:00
for ( j = 0 , k = 0 ; k < MAX_MON_MOVES * FRONTIER_PARTY_SIZE ; k + + )
2018-08-25 11:55:16 +02:00
{
if ( bestScore < moveScores [ k ] )
{
j = k ;
bestScore = moveScores [ k ] ;
}
else if ( bestScore = = moveScores [ k ] & & moveIds [ j ] < moveIds [ k ] )
{
j = k ;
}
}
if ( i = = roundId - 1 )
break ;
LABEL :
{
for ( i = 0 ; i < roundId - 1 ; i + + )
{
2019-12-18 08:32:52 +01:00
if ( gSaveBlock2Ptr - > frontier . domeWinningMoves [ sub_81953E8 ( winnerTournamentId , i ) ] = = moveIds [ j ] )
2018-08-25 11:55:16 +02:00
break ;
}
if ( i = = roundId - 1 )
break ;
moveScores [ j ] = 0 ;
bestScore = 0 ;
j = 0 ;
2019-12-18 08:32:52 +01:00
for ( k = 0 ; k < MAX_MON_MOVES * FRONTIER_PARTY_SIZE ; k + + )
2018-08-25 11:55:16 +02:00
j + = moveScores [ k ] ;
}
}
if ( moveScores [ j ] = = 0 )
j = bestId ;
return moveIds [ j ] ;
}
2019-02-08 18:08:25 +01:00
static void Task_ShowTourneyTree ( u8 taskId )
2018-08-25 11:55:16 +02:00
{
2019-02-08 18:08:25 +01:00
int i ;
2018-11-06 17:44:48 +01:00
struct TextPrinterTemplate textPrinter ;
2019-02-08 18:08:25 +01:00
int r10 = gTasks [ taskId ] . data [ 1 ] ;
int r4 = gTasks [ taskId ] . data [ 2 ] ;
2018-08-25 11:55:16 +02:00
switch ( gTasks [ taskId ] . data [ 0 ] )
{
case 0 :
SetHBlankCallback ( NULL ) ;
SetVBlankCallback ( NULL ) ;
EnableInterrupts ( INTR_FLAG_HBLANK | INTR_FLAG_VBLANK ) ;
CpuFill32 ( 0 , ( void * ) VRAM , VRAM_SIZE ) ;
ResetBgsAndClearDma3BusyFlags ( 0 ) ;
2019-12-21 10:27:12 +01:00
InitBgsFromTemplates ( 0 , sTourneyTreeBgTemplates , ARRAY_COUNT ( sTourneyTreeBgTemplates ) ) ;
InitWindows ( sTourneyTreeWindowTemplates ) ;
2018-08-25 11:55:16 +02:00
DeactivateAllTextPrinters ( ) ;
gBattle_BG0_X = 0 ;
gBattle_BG0_Y = 0 ;
gBattle_BG1_X = 0 ;
gBattle_BG1_Y = 0 ;
ChangeBgX ( 2 , 0 , 0 ) ;
ChangeBgY ( 2 , 0 , 0 ) ;
ChangeBgX ( 3 , 0 , 0 ) ;
ChangeBgY ( 3 , 0xB00 , 0 ) ;
gTasks [ taskId ] . data [ 0 ] + + ;
break ;
case 1 :
SetGpuReg ( REG_OFFSET_BLDCNT , 0 ) ;
SetGpuReg ( REG_OFFSET_BLDALPHA , 0 ) ;
SetGpuReg ( REG_OFFSET_BLDY , 0 ) ;
SetGpuReg ( REG_OFFSET_MOSAIC , 0 ) ;
SetGpuReg ( REG_OFFSET_WIN0H , 0x5860 ) ;
SetGpuReg ( REG_OFFSET_WIN0V , 0x9F ) ;
SetGpuReg ( REG_OFFSET_WIN1H , 0x9098 ) ;
SetGpuReg ( REG_OFFSET_WIN1V , 0x9F ) ;
SetGpuReg ( REG_OFFSET_WININ , 0 ) ;
2019-12-18 08:32:52 +01:00
SetGpuReg ( REG_OFFSET_WINOUT , WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR ) ;
2018-08-25 11:55:16 +02:00
ResetPaletteFade ( ) ;
ResetSpriteData ( ) ;
FreeAllSpritePalettes ( ) ;
gTasks [ taskId ] . data [ 0 ] + + ;
break ;
case 2 :
2018-08-25 19:59:47 +02:00
sTilemapBuffer = AllocZeroed ( 0x800 ) ;
LZDecompressWram ( gUnknown_08D83900 , sTilemapBuffer ) ;
SetBgTilemapBuffer ( 1 , sTilemapBuffer ) ;
2018-08-25 11:55:16 +02:00
CopyBgTilemapBufferToVram ( 1 ) ;
DecompressAndLoadBgGfxUsingHeap ( 1 , gUnknown_08D82F10 , 0x2000 , 0 , 0 ) ;
DecompressAndLoadBgGfxUsingHeap ( 2 , gUnknown_08D834FC , 0x2000 , 0 , 0 ) ;
DecompressAndLoadBgGfxUsingHeap ( 2 , gUnknown_08D83B2C , 0x2000 , 0 , 1 ) ;
DecompressAndLoadBgGfxUsingHeap ( 3 , gUnknown_08D83C3C , 0x2000 , 0 , 1 ) ;
LoadCompressedPalette ( gUnknown_08D85358 , 0 , 0x200 ) ;
LoadCompressedPalette ( gUnknown_08D85444 , 0x100 , 0x200 ) ;
2019-11-07 01:18:11 +01:00
LoadCompressedPalette ( gBattleWindowTextPalette , 0xF0 , 0x20 ) ;
2018-08-25 11:55:16 +02:00
CpuFill32 ( 0 , gPlttBufferFaded , 0x400 ) ;
ShowBg ( 0 ) ;
ShowBg ( 1 ) ;
ShowBg ( 2 ) ;
ShowBg ( 3 ) ;
gTasks [ taskId ] . data [ 0 ] + + ;
break ;
case 3 :
2019-02-08 18:08:25 +01:00
LoadCompressedSpriteSheet ( sDomeOptionsSpriteSheet ) ;
2018-08-25 11:55:16 +02:00
if ( r10 = = 0 )
{
2019-12-21 10:27:12 +01:00
for ( i = 0 ; i < ARRAY_COUNT ( gUnknown_0860D411 ) ; i + + )
2018-08-25 11:55:16 +02:00
CreateSprite ( & gUnknown_0860CFA8 , gUnknown_0860D411 [ i ] [ 0 ] , gUnknown_0860D411 [ i ] [ 1 ] , 0 ) ;
if ( gTasks [ taskId ] . data [ 4 ] )
CreateSprite ( & gUnknown_0860D008 , 218 , 12 , 0 ) ;
else
CreateSprite ( & gUnknown_0860CFD8 , 218 , 12 , 0 ) ;
}
SetGpuReg ( REG_OFFSET_DISPCNT , DISPCNT_BG_ALL_ON | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJ_1D_MAP ) ;
gTasks [ taskId ] . data [ 0 ] + + ;
break ;
case 4 :
textPrinter . fontId = 2 ;
2018-11-06 17:44:48 +01:00
textPrinter . currentChar = gText_BattleTourney ;
2018-08-25 11:55:16 +02:00
textPrinter . windowId = 2 ;
textPrinter . x = 0 ;
textPrinter . y = 0 ;
textPrinter . letterSpacing = 2 ;
textPrinter . lineSpacing = 0 ;
2018-11-06 17:44:48 +01:00
textPrinter . currentX = GetStringCenterAlignXOffsetWithLetterSpacing ( textPrinter . fontId , textPrinter . currentChar , 0x70 , textPrinter . letterSpacing ) ;
2018-08-25 11:55:16 +02:00
textPrinter . currentY = 1 ;
2018-11-06 18:30:21 +01:00
textPrinter . unk = 0 ;
2019-12-21 10:27:12 +01:00
textPrinter . fgColor = TEXT_DYNAMIC_COLOR_5 ;
textPrinter . bgColor = TEXT_COLOR_TRANSPARENT ;
textPrinter . shadowColor = TEXT_DYNAMIC_COLOR_4 ;
2018-08-25 11:55:16 +02:00
AddTextPrinter ( & textPrinter , 0 , NULL ) ;
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
{
2019-02-08 18:08:25 +01:00
int roundId , var2 ;
2018-08-25 11:55:16 +02:00
2019-12-18 08:32:52 +01:00
CopyDomeTrainerName ( gDisplayedStringBattle , DOME_TRAINERS [ i ] . trainerId ) ;
2018-08-25 11:55:16 +02:00
if ( r10 = = 1 )
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ i ] . isEliminated )
2018-08-25 11:55:16 +02:00
{
2019-12-21 10:27:12 +01:00
if ( DOME_TRAINERS [ i ] . eliminatedAt ! = DOME_ROUND1 )
2018-08-25 11:55:16 +02:00
{
2019-12-18 08:32:52 +01:00
var2 = DOME_TRAINERS [ i ] . eliminatedAt - 1 ;
2018-08-25 11:55:16 +02:00
sub_81948EC ( i , var2 ) ;
}
}
2018-10-21 00:06:42 +02:00
else if ( gSaveBlock2Ptr - > frontier . curChallengeBattleNum ! = DOME_ROUND2 )
2018-08-25 11:55:16 +02:00
{
2018-10-21 00:06:42 +02:00
sub_81948EC ( i , gSaveBlock2Ptr - > frontier . curChallengeBattleNum - 2 ) ;
2018-08-25 11:55:16 +02:00
}
}
else if ( r10 = = 0 )
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ i ] . isEliminated )
2018-08-25 11:55:16 +02:00
{
2019-12-21 10:27:12 +01:00
if ( DOME_TRAINERS [ i ] . eliminatedAt ! = DOME_ROUND1 )
2018-08-25 11:55:16 +02:00
{
2019-12-18 08:32:52 +01:00
var2 = DOME_TRAINERS [ i ] . eliminatedAt - 1 ;
2018-08-25 11:55:16 +02:00
sub_81948EC ( i , var2 ) ;
}
}
2018-10-21 00:06:42 +02:00
else if ( gSaveBlock2Ptr - > frontier . curChallengeBattleNum ! = DOME_ROUND1 )
2018-08-25 11:55:16 +02:00
{
if ( gTasks [ taskId ] . data [ 4 ] )
2018-10-21 00:06:42 +02:00
var2 = gSaveBlock2Ptr - > frontier . curChallengeBattleNum ;
2018-08-25 11:55:16 +02:00
else
2018-10-21 00:06:42 +02:00
var2 = gSaveBlock2Ptr - > frontier . curChallengeBattleNum - 1 ;
2018-08-25 11:55:16 +02:00
sub_81948EC ( i , var2 ) ;
}
}
if ( gTasks [ taskId ] . data [ 4 ] )
2018-10-21 00:06:42 +02:00
roundId = gSaveBlock2Ptr - > frontier . curChallengeBattleNum ;
2018-08-25 11:55:16 +02:00
else
2018-10-21 00:06:42 +02:00
roundId = gSaveBlock2Ptr - > frontier . curChallengeBattleNum - 1 ;
2018-08-25 11:55:16 +02:00
2019-12-18 08:32:52 +01:00
if ( ( ( r10 = = 1 & & DOME_TRAINERS [ i ] . eliminatedAt < gSaveBlock2Ptr - > frontier . curChallengeBattleNum - 1 )
| | ( r10 = = 0 & & DOME_TRAINERS [ i ] . eliminatedAt < = roundId ) )
& & DOME_TRAINERS [ i ] . isEliminated )
2018-08-25 11:55:16 +02:00
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ i ] . trainerId = = TRAINER_PLAYER )
2018-08-25 11:55:16 +02:00
{
2019-12-21 10:27:12 +01:00
textPrinter . fgColor = TEXT_COLOR_LIGHT_GREY ;
textPrinter . shadowColor = TEXT_COLOR_RED ;
2018-08-25 11:55:16 +02:00
}
else
{
2019-12-21 10:27:12 +01:00
textPrinter . fgColor = TEXT_DYNAMIC_COLOR_2 ;
textPrinter . shadowColor = TEXT_DYNAMIC_COLOR_4 ;
2018-08-25 11:55:16 +02:00
}
}
else
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ i ] . trainerId = = TRAINER_PLAYER )
2018-08-25 11:55:16 +02:00
{
2019-12-21 10:27:12 +01:00
textPrinter . fgColor = TEXT_COLOR_LIGHT_GREY ;
textPrinter . shadowColor = TEXT_COLOR_RED ;
2018-08-25 11:55:16 +02:00
}
else
{
2019-12-21 10:27:12 +01:00
textPrinter . fgColor = TEXT_DYNAMIC_COLOR_5 ;
textPrinter . shadowColor = TEXT_DYNAMIC_COLOR_4 ;
2018-08-25 11:55:16 +02:00
}
}
if ( gUnknown_0860D3F1 [ i ] [ 0 ] = = 0 )
textPrinter . currentX = GetStringWidthDifference ( textPrinter . fontId , gDisplayedStringBattle , 0x3D , textPrinter . letterSpacing ) ;
else
textPrinter . currentX = 3 ;
2018-11-06 17:44:48 +01:00
textPrinter . currentChar = gDisplayedStringBattle ;
2018-08-25 11:55:16 +02:00
textPrinter . windowId = gUnknown_0860D3F1 [ i ] [ 0 ] ;
textPrinter . currentY = gUnknown_0860D3F1 [ i ] [ 1 ] ;
AddTextPrinter ( & textPrinter , 0 , NULL ) ;
}
gTasks [ taskId ] . data [ 0 ] + + ;
break ;
case 5 :
PutWindowTilemap ( 0 ) ;
PutWindowTilemap ( 1 ) ;
PutWindowTilemap ( 2 ) ;
CopyWindowToVram ( 0 , 3 ) ;
CopyWindowToVram ( 1 , 3 ) ;
CopyWindowToVram ( 2 , 3 ) ;
2018-08-25 19:59:47 +02:00
SetHBlankCallback ( HblankCb_BattleDome ) ;
2018-08-25 18:46:15 +02:00
SetVBlankCallback ( VblankCb1_BattleDome ) ;
2018-08-25 11:55:16 +02:00
if ( r4 = = 2 )
{
if ( r10 = = 0 )
{
i = CreateTask ( sub_819395C , 0 ) ;
gTasks [ i ] . data [ 0 ] = r10 ;
gTasks [ i ] . data [ 1 ] = r10 ;
gTasks [ i ] . data [ 6 ] = gTasks [ taskId ] . data [ 4 ] ;
}
else
{
i = CreateTask ( sub_8194950 , 0 ) ;
gTasks [ i ] . data [ 0 ] = 0 ;
}
}
else
{
i = gTasks [ taskId ] . data [ 3 ] ;
gTasks [ i ] . data [ 0 ] = 0 ;
}
ScanlineEffect_Clear ( ) ;
2019-01-05 19:27:23 +01:00
i = 0 ;
while ( i < 91 )
{
2019-02-08 18:08:25 +01:00
gScanlineEffectRegBuffers [ 0 ] [ i ] = BGCNT_PRIORITY ( 2 ) | BGCNT_SCREENBASE ( 31 ) | BGCNT_16COLOR | BGCNT_CHARBASE ( 2 ) | BGCNT_TXT256x256 ;
gScanlineEffectRegBuffers [ 1 ] [ i ] = BGCNT_PRIORITY ( 2 ) | BGCNT_SCREENBASE ( 31 ) | BGCNT_16COLOR | BGCNT_CHARBASE ( 2 ) | BGCNT_TXT256x256 ;
2019-01-05 19:27:23 +01:00
i + + ;
}
while ( i < 160 )
{
2019-02-08 18:08:25 +01:00
gScanlineEffectRegBuffers [ 0 ] [ i ] = BGCNT_PRIORITY ( 1 ) | BGCNT_SCREENBASE ( 31 ) | BGCNT_16COLOR | BGCNT_CHARBASE ( 2 ) | BGCNT_TXT256x256 ;
gScanlineEffectRegBuffers [ 1 ] [ i ] = BGCNT_PRIORITY ( 1 ) | BGCNT_SCREENBASE ( 31 ) | BGCNT_16COLOR | BGCNT_CHARBASE ( 2 ) | BGCNT_TXT256x256 ;
2019-01-05 19:27:23 +01:00
i + + ;
}
2019-02-08 18:08:25 +01:00
ScanlineEffect_SetParams ( sTourneyTreeScanlineEffectParams ) ;
2018-08-25 11:55:16 +02:00
DestroyTask ( taskId ) ;
break ;
}
}
2018-08-25 19:59:47 +02:00
static void sub_81948EC ( u8 tournamentId , u8 arg1 )
2018-08-25 11:55:16 +02:00
{
2019-02-08 18:08:25 +01:00
int i ;
2018-08-25 19:59:47 +02:00
const struct UnkStruct_860DD10 * structPtr = gUnknown_0860DD10 [ tournamentId ] [ arg1 ] ;
2018-08-25 11:55:16 +02:00
for ( i = 0 ; i < gUnknown_0860DE10 [ tournamentId ] [ arg1 ] ; i + + )
CopyToBgTilemapBufferRect_ChangePalette ( 1 , & structPtr [ i ] . src , structPtr [ i ] . x , structPtr [ i ] . y , 1 , 1 , 0x11 ) ;
CopyBgTilemapBufferToVram ( 1 ) ;
}
2018-08-25 19:59:47 +02:00
static void sub_8194950 ( u8 taskId )
2018-08-25 11:55:16 +02:00
{
2019-02-08 18:08:25 +01:00
int i ;
2018-11-06 17:44:48 +01:00
struct TextPrinterTemplate textPrinter ;
2018-08-25 11:55:16 +02:00
switch ( gTasks [ taskId ] . data [ 0 ] )
{
case 0 :
2018-08-29 20:38:54 +02:00
BeginNormalPaletteFade ( 0xFFFFFFFF , 0 , 0x10 , 0 , RGB_BLACK ) ;
2018-08-25 11:55:16 +02:00
gTasks [ taskId ] . data [ 0 ] = 1 ;
break ;
case 1 :
if ( ! gPaletteFade . active )
{
gTasks [ taskId ] . data [ 0 ] = 2 ;
gTasks [ taskId ] . data [ 3 ] = 64 ;
textPrinter . fontId = 2 ;
textPrinter . x = 0 ;
textPrinter . y = 0 ;
textPrinter . letterSpacing = 2 ;
textPrinter . lineSpacing = 0 ;
2018-11-06 18:30:21 +01:00
textPrinter . unk = 0 ;
2019-12-21 10:27:12 +01:00
textPrinter . fgColor = TEXT_DYNAMIC_COLOR_2 ;
textPrinter . bgColor = TEXT_COLOR_TRANSPARENT ;
textPrinter . shadowColor = TEXT_DYNAMIC_COLOR_4 ;
2018-08-25 11:55:16 +02:00
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
{
2019-12-18 08:32:52 +01:00
CopyDomeTrainerName ( gDisplayedStringBattle , DOME_TRAINERS [ i ] . trainerId ) ;
if ( DOME_TRAINERS [ i ] . eliminatedAt = = gSaveBlock2Ptr - > frontier . curChallengeBattleNum - 1
& & DOME_TRAINERS [ i ] . isEliminated )
2018-08-25 11:55:16 +02:00
{
if ( gUnknown_0860D3F1 [ i ] [ 0 ] = = 0 )
textPrinter . currentX = GetStringWidthDifference ( textPrinter . fontId , gDisplayedStringBattle , 0x3D , textPrinter . letterSpacing ) ;
else
textPrinter . currentX = 3 ;
2018-11-06 17:44:48 +01:00
textPrinter . currentChar = gDisplayedStringBattle ;
2018-08-25 11:55:16 +02:00
textPrinter . windowId = gUnknown_0860D3F1 [ i ] [ 0 ] ;
textPrinter . currentY = gUnknown_0860D3F1 [ i ] [ 1 ] ;
AddTextPrinter ( & textPrinter , 0 , NULL ) ;
}
2019-12-18 08:32:52 +01:00
if ( ! DOME_TRAINERS [ i ] . isEliminated )
2018-08-25 11:55:16 +02:00
{
2019-02-08 18:08:25 +01:00
int roundId = gSaveBlock2Ptr - > frontier . curChallengeBattleNum - 1 ;
2018-10-21 00:06:42 +02:00
sub_81948EC ( i , roundId ) ;
2018-08-25 11:55:16 +02:00
}
}
}
break ;
case 2 :
if ( - - gTasks [ taskId ] . data [ 3 ] = = 0 )
gTasks [ taskId ] . data [ 0 ] = 3 ;
break ;
case 3 :
if ( gMain . newKeys & ( A_BUTTON | B_BUTTON ) )
{
2018-08-29 20:38:54 +02:00
BeginNormalPaletteFade ( 0xFFFFFFFF , 0 , 0 , 0x10 , RGB_BLACK ) ;
2018-08-25 11:55:16 +02:00
gTasks [ taskId ] . data [ 0 ] = 4 ;
}
break ;
case 4 :
if ( ! gPaletteFade . active )
{
SetMainCallback2 ( CB2_ReturnToFieldContinueScriptPlayMapMusic ) ;
DestroyTask ( taskId ) ;
}
break ;
}
}
static void CB2_BattleDome ( void )
{
AnimateSprites ( ) ;
BuildOamBuffer ( ) ;
RunTextPrinters ( ) ;
UpdatePaletteFade ( ) ;
RunTasks ( ) ;
}
2018-08-25 18:46:15 +02:00
static void VblankCb0_BattleDome ( void )
{
ChangeBgX ( 3 , 0x80 , 1 ) ;
ChangeBgY ( 3 , 0x80 , 2 ) ;
SetGpuReg ( REG_OFFSET_BG0HOFS , gBattle_BG0_X ) ;
SetGpuReg ( REG_OFFSET_BG0VOFS , gBattle_BG0_Y ) ;
SetGpuReg ( REG_OFFSET_BG1HOFS , gBattle_BG1_X ) ;
SetGpuReg ( REG_OFFSET_BG1VOFS , gBattle_BG1_Y ) ;
SetGpuReg ( REG_OFFSET_BG2HOFS , gBattle_BG2_X ) ;
SetGpuReg ( REG_OFFSET_BG2VOFS , gBattle_BG2_Y ) ;
LoadOam ( ) ;
ProcessSpriteCopyRequests ( ) ;
TransferPlttBuffer ( ) ;
}
# define SET_WIN0H_WIN1H(win0H, win1H) \
{ \
* ( vu32 * ) ( REG_ADDR_WIN0H ) = ( ( win0H < < 16 ) | ( win1H ) ) ; \
}
2018-08-25 19:59:47 +02:00
static void HblankCb_BattleDome ( void )
2018-08-25 18:46:15 +02:00
{
register u32 vCount asm ( " r0 " ) = REG_VCOUNT ;
register u32 vCount_ asm ( " r1 " ) = vCount ;
if ( vCount > 41 )
{
if ( vCount < 50 )
{
2019-12-18 08:32:52 +01:00
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG3 | WININ_WIN1_OBJ | WININ_WIN1_CLR ;
2018-09-08 02:24:33 +02:00
SET_WIN0H_WIN1H ( WIN_RANGE ( 152 , 155 ) , WIN_RANGE ( 85 , 88 ) ) ;
2018-08-25 18:46:15 +02:00
return ;
}
else if ( vCount > 57 )
{
if ( vCount < 75 )
{
2019-12-18 08:32:52 +01:00
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG3 | WININ_WIN1_OBJ | WININ_WIN1_CLR ;
2018-09-08 02:24:33 +02:00
SET_WIN0H_WIN1H ( WIN_RANGE ( 144 , 152 ) , WIN_RANGE ( 88 , 96 ) ) ;
2018-08-25 18:46:15 +02:00
return ;
}
else if ( vCount < 82 )
{
2019-12-18 08:32:52 +01:00
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG3 | WININ_WIN1_OBJ | WININ_WIN1_CLR ;
2018-09-08 02:24:33 +02:00
SET_WIN0H_WIN1H ( WIN_RANGE ( 152 , 155 ) , WIN_RANGE ( 85 , 88 ) ) ;
2018-08-25 18:46:15 +02:00
return ;
}
else if ( vCount > 94 )
{
if ( vCount < 103 )
{
2019-12-18 08:32:52 +01:00
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_OBJ | WININ_WIN0_CLR
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG2 | WININ_WIN1_OBJ | WININ_WIN1_CLR ;
2018-09-08 02:24:33 +02:00
SET_WIN0H_WIN1H ( WIN_RANGE ( 152 , 155 ) , WIN_RANGE ( 85 , 88 ) ) ;
2018-08-25 18:46:15 +02:00
return ;
}
else if ( vCount < 119 )
{
2019-12-18 08:32:52 +01:00
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_OBJ | WININ_WIN0_CLR
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG2 | WININ_WIN1_OBJ | WININ_WIN1_CLR ;
2018-09-08 02:24:33 +02:00
SET_WIN0H_WIN1H ( WIN_RANGE ( 144 , 152 ) , WIN_RANGE ( 88 , 96 ) ) ;
2018-08-25 18:46:15 +02:00
return ;
}
else if ( vCount > 126 )
{
if ( vCount_ < 135 )
{
2019-12-18 08:32:52 +01:00
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_OBJ | WININ_WIN0_CLR
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG2 | WININ_WIN1_OBJ | WININ_WIN1_CLR ;
2018-09-08 02:24:33 +02:00
SET_WIN0H_WIN1H ( WIN_RANGE ( 152 , 155 ) , WIN_RANGE ( 85 , 88 ) ) ;
2018-08-25 18:46:15 +02:00
return ;
}
}
}
}
}
2019-12-18 08:32:52 +01:00
REG_WININ = WININ_WIN0_BG_ALL | WININ_WIN0_CLR | WININ_WIN0_OBJ
| WININ_WIN1_BG_ALL | WININ_WIN1_CLR | WININ_WIN1_OBJ ;
2018-08-25 18:46:15 +02:00
SET_WIN0H_WIN1H ( 0 , 0 ) ;
}
static void VblankCb1_BattleDome ( void )
{
SetGpuReg ( REG_OFFSET_BG0HOFS , gBattle_BG0_X ) ;
SetGpuReg ( REG_OFFSET_BG0VOFS , gBattle_BG0_Y ) ;
SetGpuReg ( REG_OFFSET_BG1HOFS , gBattle_BG1_X ) ;
SetGpuReg ( REG_OFFSET_BG1VOFS , gBattle_BG1_Y ) ;
ChangeBgY ( 2 , 0x80 , 2 ) ;
ChangeBgY ( 3 , 0x80 , 1 ) ;
LoadOam ( ) ;
ProcessSpriteCopyRequests ( ) ;
TransferPlttBuffer ( ) ;
ScanlineEffect_InitHBlankDmaTransfer ( ) ;
}
2019-12-21 10:27:12 +01:00
static void SetFacilityTrainerAndMonPtrs ( void )
2018-08-25 18:46:15 +02:00
{
gFacilityTrainerMons = gBattleFrontierMons ;
gFacilityTrainers = gBattleFrontierTrainers ;
}
2019-11-29 03:09:35 +01:00
static void ResetSketchedMoves ( void )
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i , moveSlot ;
2018-08-25 18:46:15 +02:00
for ( i = 0 ; i < 2 ; i + + )
{
2019-02-08 18:08:25 +01:00
int playerMonId = gSaveBlock2Ptr - > frontier . selectedPartyMons [ gSelectedOrderFromParty [ i ] - 1 ] - 1 ;
int count ;
2018-08-25 18:46:15 +02:00
2018-12-25 18:50:15 +01:00
for ( moveSlot = 0 ; moveSlot < MAX_MON_MOVES ; moveSlot + + )
2018-08-25 18:46:15 +02:00
{
count = 0 ;
2018-12-25 18:50:15 +01:00
while ( count < MAX_MON_MOVES )
2018-08-25 18:46:15 +02:00
{
if ( GetMonData ( & gSaveBlock1Ptr - > playerParty [ playerMonId ] , MON_DATA_MOVE1 + count , NULL ) = = GetMonData ( & gPlayerParty [ i ] , MON_DATA_MOVE1 + moveSlot , NULL ) )
break ;
count + + ;
}
2018-12-25 18:50:15 +01:00
if ( count = = MAX_MON_MOVES )
2018-08-25 18:46:15 +02:00
SetMonMoveSlot ( & gPlayerParty [ i ] , MOVE_SKETCH , moveSlot ) ;
}
gSaveBlock1Ptr - > playerParty [ playerMonId ] = gPlayerParty [ i ] ;
}
}
2019-02-08 18:08:25 +01:00
static void RestoreDomePlayerPartyHeldItems ( void )
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i ;
2018-08-25 18:46:15 +02:00
2019-12-18 08:32:52 +01:00
for ( i = 0 ; i < DOME_BATTLE_PARTY_SIZE ; i + + )
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int playerMonId = gSaveBlock2Ptr - > frontier . selectedPartyMons [ gSelectedOrderFromParty [ i ] - 1 ] - 1 ;
2018-08-25 18:46:15 +02:00
u16 item = GetMonData ( & gSaveBlock1Ptr - > playerParty [ playerMonId ] , MON_DATA_HELD_ITEM , NULL ) ;
SetMonData ( & gPlayerParty [ i ] , MON_DATA_HELD_ITEM , & item ) ;
}
}
2019-12-18 08:32:52 +01:00
static void ReduceDomePlayerPartyToSelectedMons ( void )
2018-08-25 18:46:15 +02:00
{
2018-11-25 22:50:54 +01:00
ReducePlayerPartyToSelectedMons ( ) ;
2018-08-25 18:46:15 +02:00
}
2019-02-08 18:08:25 +01:00
static void GetPlayerSeededBeforeOpponent ( void )
2018-08-25 18:46:15 +02:00
{
if ( TrainerIdToTournamentId ( gTrainerBattleOpponent_A ) > TrainerIdToTournamentId ( TRAINER_PLAYER ) )
gSpecialVar_Result = 1 ;
else
gSpecialVar_Result = 2 ;
}
2019-02-08 18:08:25 +01:00
static void BufferLastDomeWinnerName ( void )
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i ;
2018-08-25 18:46:15 +02:00
2019-12-21 10:27:12 +01:00
SetFacilityTrainerAndMonPtrs ( ) ;
2018-08-25 18:46:15 +02:00
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
{
2019-12-18 08:32:52 +01:00
if ( ! DOME_TRAINERS [ i ] . isEliminated )
2018-08-25 18:46:15 +02:00
break ;
}
2019-12-18 08:32:52 +01:00
CopyDomeTrainerName ( gStringVar1 , DOME_TRAINERS [ i ] . trainerId ) ;
2018-08-25 18:46:15 +02:00
}
2019-12-18 08:32:52 +01:00
// For showing the previous tourney results before the player has entered a challenge
static void InitRandomTourneyTreeResults ( void )
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i , j , k ;
int monLevel ;
2019-11-29 03:09:35 +01:00
int species [ FRONTIER_PARTY_SIZE ] ;
2019-02-08 18:08:25 +01:00
int monTypesBits ;
int trainerId ;
int monSetId ;
2018-08-25 18:46:15 +02:00
u8 lvlMode ;
u16 * statSums ;
2019-02-08 18:08:25 +01:00
int * statValues ;
2018-08-25 18:46:15 +02:00
u8 ivs = 0 ;
species [ 0 ] = 0 ;
species [ 1 ] = 0 ;
species [ 2 ] = 0 ;
2019-12-18 08:32:52 +01:00
if ( ( gSaveBlock2Ptr - > frontier . domeLvlMode ! = - gSaveBlock2Ptr - > frontier . domeBattleMode ) & & gSaveBlock2Ptr - > frontier . challengeStatus ! = CHALLENGE_STATUS_SAVING )
2018-08-25 18:46:15 +02:00
return ;
statSums = AllocZeroed ( sizeof ( u16 ) * DOME_TOURNAMENT_TRAINERS_COUNT ) ;
2019-11-29 03:09:35 +01:00
statValues = AllocZeroed ( sizeof ( int ) * NUM_STATS ) ;
2018-08-25 19:59:47 +02:00
lvlMode = gSaveBlock2Ptr - > frontier . lvlMode ;
2019-12-18 08:32:52 +01:00
gSaveBlock2Ptr - > frontier . lvlMode = FRONTIER_LVL_50 ;
2018-08-25 18:46:15 +02:00
// This one, I'd like to call a 'C fakematching'.
{
u8 one ;
2019-12-18 08:32:52 +01:00
gSaveBlock2Ptr - > frontier . domeLvlMode = ( one = 1 ) ;
gSaveBlock2Ptr - > frontier . domeBattleMode = one ;
2018-08-25 18:46:15 +02:00
}
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
{
do
{
if ( i < 5 )
trainerId = Random ( ) % 10 ;
else if ( i < 15 )
trainerId = Random ( ) % 20 + 10 ;
else
trainerId = Random ( ) % 10 + 30 ;
for ( j = 0 ; j < i ; j + + )
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ j ] . trainerId = = trainerId )
2018-08-25 18:46:15 +02:00
break ;
}
} while ( j ! = i ) ;
2019-12-18 08:32:52 +01:00
DOME_TRAINERS [ i ] . trainerId = trainerId ;
2019-11-29 03:09:35 +01:00
for ( j = 0 ; j < FRONTIER_PARTY_SIZE ; j + + )
2018-08-25 18:46:15 +02:00
{
// Make sure the mon is valid.
do
{
2018-11-11 16:44:27 +01:00
monSetId = RandomizeFacilityTrainerMonSet ( trainerId ) ;
2018-08-25 18:46:15 +02:00
for ( k = 0 ; k < j ; k + + )
{
2019-12-18 08:32:52 +01:00
int checkingMonId = DOME_MONS [ i ] [ k ] ;
2018-11-11 16:44:27 +01:00
if ( checkingMonId = = monSetId
| | species [ 0 ] = = gFacilityTrainerMons [ monSetId ] . species
| | species [ 1 ] = = gFacilityTrainerMons [ monSetId ] . species
| | gFacilityTrainerMons [ checkingMonId ] . itemTableId = = gFacilityTrainerMons [ monSetId ] . itemTableId )
2018-08-25 18:46:15 +02:00
break ;
}
} while ( k ! = j ) ;
2019-12-18 08:32:52 +01:00
DOME_MONS [ i ] [ j ] = monSetId ;
2018-11-11 16:44:27 +01:00
species [ j ] = gFacilityTrainerMons [ monSetId ] . species ;
2018-08-25 18:46:15 +02:00
}
2019-12-18 08:32:52 +01:00
DOME_TRAINERS [ i ] . isEliminated = FALSE ;
DOME_TRAINERS [ i ] . eliminatedAt = 0 ;
DOME_TRAINERS [ i ] . forfeited = FALSE ;
2018-08-25 18:46:15 +02:00
}
monLevel = 50 ;
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
2018-12-05 15:31:01 +01:00
{
monTypesBits = 0 ;
statSums [ i ] = 0 ;
2019-12-18 08:32:52 +01:00
ivs = GetDomeTrainerMonIvs ( DOME_TRAINERS [ i ] . trainerId ) ;
2019-11-29 03:09:35 +01:00
for ( j = 0 ; j < FRONTIER_PARTY_SIZE ; j + + )
2018-12-05 15:31:01 +01:00
{
2019-12-18 08:32:52 +01:00
CalcDomeMonStats ( gFacilityTrainerMons [ DOME_MONS [ i ] [ j ] ] . species ,
2018-12-05 15:31:01 +01:00
monLevel , ivs ,
2019-12-18 08:32:52 +01:00
gFacilityTrainerMons [ DOME_MONS [ i ] [ j ] ] . evSpread ,
gFacilityTrainerMons [ DOME_MONS [ i ] [ j ] ] . nature ,
2018-12-05 15:31:01 +01:00
statValues ) ;
statSums [ i ] + = statValues [ STAT_ATK ] ;
statSums [ i ] + = statValues [ STAT_DEF ] ;
statSums [ i ] + = statValues [ STAT_SPATK ] ;
statSums [ i ] + = statValues [ STAT_SPDEF ] ;
statSums [ i ] + = statValues [ STAT_SPEED ] ;
statSums [ i ] + = statValues [ STAT_HP ] ;
2019-12-18 08:32:52 +01:00
monTypesBits | = gBitTable [ gBaseStats [ gFacilityTrainerMons [ DOME_MONS [ i ] [ j ] ] . species ] . type1 ] ;
monTypesBits | = gBitTable [ gBaseStats [ gFacilityTrainerMons [ DOME_MONS [ i ] [ j ] ] . species ] . type2 ] ;
2018-12-05 15:31:01 +01:00
}
// Because GF hates temporary vars, trainerId acts like monTypesCount here.
for ( trainerId = 0 , j = 0 ; j < 32 ; j + + )
{
if ( monTypesBits & 1 )
trainerId + + ;
monTypesBits > > = 1 ;
}
statSums [ i ] + = ( trainerId * monLevel ) / 20 ;
}
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT - 1 ; i + + )
{
for ( j = i + 1 ; j < DOME_TOURNAMENT_TRAINERS_COUNT ; j + + )
{
if ( statSums [ i ] < statSums [ j ] )
{
SwapDomeTrainers ( i , j , statSums ) ;
}
else if ( statSums [ i ] = = statSums [ j ] )
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ i ] . trainerId > DOME_TRAINERS [ j ] . trainerId )
2018-08-25 18:46:15 +02:00
SwapDomeTrainers ( i , j , statSums ) ;
2018-12-05 15:31:01 +01:00
}
}
}
2018-08-25 18:46:15 +02:00
2018-12-05 15:31:01 +01:00
Free ( statSums ) ;
Free ( statValues ) ;
2018-08-25 18:46:15 +02:00
2019-12-18 08:32:52 +01:00
for ( i = 0 ; i < DOME_ROUNDS_COUNT ; i + + )
2018-08-25 18:46:15 +02:00
DecideRoundWinners ( i ) ;
2018-08-25 19:59:47 +02:00
gSaveBlock2Ptr - > frontier . lvlMode = lvlMode ;
2018-08-25 18:46:15 +02:00
}
2019-02-08 18:08:25 +01:00
static int TrainerIdToTournamentId ( u16 trainerId )
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i ;
2018-08-25 18:46:15 +02:00
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ i ] . trainerId = = trainerId )
2018-08-25 18:46:15 +02:00
break ;
}
return i ;
}
// The same as the above one, but has global scope.
2019-02-08 18:08:25 +01:00
int TrainerIdToDomeTournamentId ( u16 trainerId )
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i ;
2018-08-25 18:46:15 +02:00
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ i ] . trainerId = = trainerId )
2018-08-25 18:46:15 +02:00
break ;
}
return i ;
}
2019-02-08 18:08:25 +01:00
static u8 sub_81953E8 ( u8 tournamentId , u8 round )
2018-08-25 18:46:15 +02:00
{
u8 arr [ 2 ] ;
2019-12-21 10:27:12 +01:00
BufferDomeWinString ( gUnknown_0860D1A0 [ gUnknown_0860D1C0 [ tournamentId ] / 2 ] [ round ] - 16 , arr ) ;
2018-08-25 18:46:15 +02:00
if ( tournamentId = = arr [ 0 ] )
return arr [ 1 ] ;
else
return arr [ 0 ] ;
}
2018-08-25 19:59:47 +02:00
static void DecideRoundWinners ( u8 roundId )
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i ;
int moveSlot , monId1 , monId2 ;
int tournamentId1 , tournamentId2 ;
int species ;
int points1 = 0 , points2 = 0 ;
2018-08-25 18:46:15 +02:00
for ( i = 0 ; i < DOME_TOURNAMENT_TRAINERS_COUNT ; i + + )
{
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ i ] . isEliminated | | DOME_TRAINERS [ i ] . trainerId = = TRAINER_PLAYER )
2018-08-25 18:46:15 +02:00
continue ;
tournamentId1 = i ;
2019-12-18 08:32:52 +01:00
tournamentId2 = TournamentIdOfOpponent ( roundId , DOME_TRAINERS [ tournamentId1 ] . trainerId ) ;
2018-08-25 18:46:15 +02:00
// Frontier Brain always wins, check tournamentId1.
2019-12-18 08:32:52 +01:00
if ( DOME_TRAINERS [ tournamentId1 ] . trainerId = = TRAINER_FRONTIER_BRAIN & & tournamentId2 ! = 0xFF )
2018-08-25 18:46:15 +02:00
{
2019-12-18 08:32:52 +01:00
DOME_TRAINERS [ tournamentId2 ] . isEliminated = TRUE ;
DOME_TRAINERS [ tournamentId2 ] . eliminatedAt = roundId ;
gSaveBlock2Ptr - > frontier . domeWinningMoves [ tournamentId2 ] = GetWinningMove ( tournamentId1 , tournamentId2 , roundId ) ;
2018-08-25 18:46:15 +02:00
}
// Frontier Brain always wins, check tournamentId2.
2019-12-18 08:32:52 +01:00
else if ( DOME_TRAINERS [ tournamentId2 ] . trainerId = = TRAINER_FRONTIER_BRAIN & & tournamentId1 ! = 0xFF )
2018-08-25 18:46:15 +02:00
{
2019-12-18 08:32:52 +01:00
DOME_TRAINERS [ tournamentId1 ] . isEliminated = TRUE ;
DOME_TRAINERS [ tournamentId1 ] . eliminatedAt = roundId ;
gSaveBlock2Ptr - > frontier . domeWinningMoves [ tournamentId1 ] = GetWinningMove ( tournamentId2 , tournamentId1 , roundId ) ;
2018-08-25 18:46:15 +02:00
}
// Decide which one of two trainers wins!
2018-12-05 15:31:01 +01:00
else if ( tournamentId2 ! = 0xFF )
2018-08-25 18:46:15 +02:00
{
// BUG: points1 and points2 are not cleared at the beginning of the loop resulting in not fair results.
// Calculate points for both trainers.
2019-12-18 08:32:52 +01:00
for ( monId1 = 0 ; monId1 < FRONTIER_PARTY_SIZE ; monId1 + + )
2018-08-25 18:46:15 +02:00
{
2018-12-25 18:50:15 +01:00
for ( moveSlot = 0 ; moveSlot < MAX_MON_MOVES ; moveSlot + + )
2018-08-25 18:46:15 +02:00
{
2019-12-18 08:32:52 +01:00
for ( monId2 = 0 ; monId2 < FRONTIER_PARTY_SIZE ; monId2 + + )
2018-08-25 18:46:15 +02:00
{
2019-12-18 08:32:52 +01:00
points1 + = GetTypeEffectivenessPoints ( gFacilityTrainerMons [ DOME_MONS [ tournamentId1 ] [ monId1 ] ] . moves [ moveSlot ] ,
gFacilityTrainerMons [ DOME_MONS [ tournamentId2 ] [ monId2 ] ] . species , 2 ) ;
2018-08-25 18:46:15 +02:00
}
}
2019-12-18 08:32:52 +01:00
species = gFacilityTrainerMons [ DOME_MONS [ tournamentId1 ] [ monId1 ] ] . species ;
2018-08-25 18:46:15 +02:00
points1 + = ( gBaseStats [ species ] . baseHP
+ gBaseStats [ species ] . baseAttack
+ gBaseStats [ species ] . baseDefense
+ gBaseStats [ species ] . baseSpeed
+ gBaseStats [ species ] . baseSpAttack
+ gBaseStats [ species ] . baseSpDefense ) / 10 ;
}
// Random part of the formula.
points1 + = ( Random ( ) & 0x1F ) ;
// Favor trainers with higher id;
points1 + = tournamentId1 ;
2019-12-18 08:32:52 +01:00
for ( monId1 = 0 ; monId1 < FRONTIER_PARTY_SIZE ; monId1 + + )
2018-08-25 18:46:15 +02:00
{
2018-12-25 18:50:15 +01:00
for ( moveSlot = 0 ; moveSlot < MAX_MON_MOVES ; moveSlot + + )
2018-08-25 18:46:15 +02:00
{
2019-12-18 08:32:52 +01:00
for ( monId2 = 0 ; monId2 < FRONTIER_PARTY_SIZE ; monId2 + + )
2018-08-25 18:46:15 +02:00
{
2019-12-18 08:32:52 +01:00
points2 + = GetTypeEffectivenessPoints ( gFacilityTrainerMons [ DOME_MONS [ tournamentId2 ] [ monId1 ] ] . moves [ moveSlot ] ,
gFacilityTrainerMons [ DOME_MONS [ tournamentId1 ] [ monId2 ] ] . species , 2 ) ;
2018-08-25 18:46:15 +02:00
}
}
2019-12-18 08:32:52 +01:00
species = gFacilityTrainerMons [ DOME_MONS [ tournamentId2 ] [ monId1 ] ] . species ;
2018-08-25 18:46:15 +02:00
points2 + = ( gBaseStats [ species ] . baseHP
+ gBaseStats [ species ] . baseAttack
+ gBaseStats [ species ] . baseDefense
+ gBaseStats [ species ] . baseSpeed
+ gBaseStats [ species ] . baseSpAttack
+ gBaseStats [ species ] . baseSpDefense ) / 10 ;
}
// Random part of the formula.
points2 + = ( Random ( ) & 0x1F ) ;
// Favor trainers with higher id;
points2 + = tournamentId2 ;
if ( points1 > points2 )
{
2019-12-18 08:32:52 +01:00
DOME_TRAINERS [ tournamentId2 ] . isEliminated = TRUE ;
DOME_TRAINERS [ tournamentId2 ] . eliminatedAt = roundId ;
gSaveBlock2Ptr - > frontier . domeWinningMoves [ tournamentId2 ] = GetWinningMove ( tournamentId1 , tournamentId2 , roundId ) ;
2018-08-25 18:46:15 +02:00
}
else if ( points1 < points2 )
{
2019-12-18 08:32:52 +01:00
DOME_TRAINERS [ tournamentId1 ] . isEliminated = TRUE ;
DOME_TRAINERS [ tournamentId1 ] . eliminatedAt = roundId ;
gSaveBlock2Ptr - > frontier . domeWinningMoves [ tournamentId1 ] = GetWinningMove ( tournamentId2 , tournamentId1 , roundId ) ;
2018-08-25 18:46:15 +02:00
}
// Points are the same, so we favor the one with the higher id.
else if ( tournamentId1 > tournamentId2 )
{
2019-12-18 08:32:52 +01:00
DOME_TRAINERS [ tournamentId2 ] . isEliminated = TRUE ;
DOME_TRAINERS [ tournamentId2 ] . eliminatedAt = roundId ;
gSaveBlock2Ptr - > frontier . domeWinningMoves [ tournamentId2 ] = GetWinningMove ( tournamentId1 , tournamentId2 , roundId ) ;
2018-08-25 18:46:15 +02:00
}
else
{
2019-12-18 08:32:52 +01:00
DOME_TRAINERS [ tournamentId1 ] . isEliminated = TRUE ;
DOME_TRAINERS [ tournamentId1 ] . eliminatedAt = roundId ;
gSaveBlock2Ptr - > frontier . domeWinningMoves [ tournamentId1 ] = GetWinningMove ( tournamentId2 , tournamentId1 , roundId ) ;
2018-08-25 18:46:15 +02:00
}
}
}
}
2019-02-08 18:08:25 +01:00
static void CopyDomeTrainerName ( u8 * str , u16 trainerId )
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i = 0 ;
2018-10-27 00:04:18 +02:00
SetFacilityPtrsGetLevel ( ) ;
2018-08-25 18:46:15 +02:00
if ( trainerId = = TRAINER_FRONTIER_BRAIN )
{
2019-02-08 18:08:25 +01:00
CopyDomeBrainTrainerName ( str ) ;
2018-08-25 18:46:15 +02:00
}
else
{
if ( trainerId = = TRAINER_PLAYER )
{
2018-09-01 22:03:21 +02:00
for ( i = 0 ; i < PLAYER_NAME_LENGTH ; i + + )
2019-02-08 18:08:25 +01:00
str [ i ] = gSaveBlock2Ptr - > playerName [ i ] ;
2018-08-25 18:46:15 +02:00
}
2019-12-21 00:52:29 +01:00
else if ( trainerId < FRONTIER_TRAINERS_COUNT )
2018-08-25 18:46:15 +02:00
{
2018-10-21 00:06:42 +02:00
for ( i = 0 ; i < PLAYER_NAME_LENGTH ; i + + )
2019-02-08 18:08:25 +01:00
str [ i ] = gFacilityTrainers [ trainerId ] . trainerName [ i ] ;
2018-08-25 18:46:15 +02:00
}
2019-02-08 18:08:25 +01:00
str [ i ] = EOS ;
2018-08-25 18:46:15 +02:00
}
}
2018-08-25 19:59:47 +02:00
static u8 GetDomeBrainTrainerPicId ( void )
2018-08-25 18:46:15 +02:00
{
return gTrainers [ TRAINER_TUCKER ] . trainerPic ;
}
2018-08-25 19:59:47 +02:00
static u8 GetDomeBrainTrainerClass ( void )
2018-08-25 18:46:15 +02:00
{
return gTrainers [ TRAINER_TUCKER ] . trainerClass ;
}
2019-02-08 18:08:25 +01:00
static void CopyDomeBrainTrainerName ( u8 * str )
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i ;
2018-08-25 18:46:15 +02:00
2018-10-21 00:06:42 +02:00
for ( i = 0 ; i < PLAYER_NAME_LENGTH ; i + + )
2019-02-08 18:08:25 +01:00
str [ i ] = gTrainers [ TRAINER_TUCKER ] . trainerName [ i ] ;
str [ i ] = EOS ;
2018-08-25 18:46:15 +02:00
}