2018-10-27 15:44:29 +02:00
|
|
|
#include "global.h"
|
2018-10-28 21:11:53 +01:00
|
|
|
#include "frontier_util.h"
|
2018-10-27 15:44:29 +02:00
|
|
|
#include "event_data.h"
|
|
|
|
#include "battle_setup.h"
|
|
|
|
#include "overworld.h"
|
|
|
|
#include "random.h"
|
|
|
|
#include "battle_tower.h"
|
|
|
|
#include "field_specials.h"
|
|
|
|
#include "battle.h"
|
2020-08-13 23:42:12 +02:00
|
|
|
#include "script_pokemon_util.h"
|
2018-10-27 15:44:29 +02:00
|
|
|
#include "main.h"
|
|
|
|
#include "window.h"
|
|
|
|
#include "menu.h"
|
|
|
|
#include "text.h"
|
|
|
|
#include "battle_records.h"
|
|
|
|
#include "international_string_util.h"
|
|
|
|
#include "string_util.h"
|
2018-10-27 21:01:35 +02:00
|
|
|
#include "new_game.h"
|
|
|
|
#include "link.h"
|
|
|
|
#include "tv.h"
|
|
|
|
#include "apprentice.h"
|
2018-10-28 00:50:06 +02:00
|
|
|
#include "pokedex.h"
|
2018-10-27 21:01:35 +02:00
|
|
|
#include "recorded_battle.h"
|
2019-04-04 23:53:06 +02:00
|
|
|
#include "data.h"
|
2018-10-28 21:11:53 +01:00
|
|
|
#include "record_mixing.h"
|
|
|
|
#include "strings.h"
|
2019-09-09 03:07:54 +02:00
|
|
|
#include "malloc.h"
|
2018-10-30 21:45:26 +01:00
|
|
|
#include "save.h"
|
|
|
|
#include "load_save.h"
|
|
|
|
#include "battle_dome.h"
|
2018-10-27 15:44:29 +02:00
|
|
|
#include "constants/battle_frontier.h"
|
2019-11-10 02:40:25 +01:00
|
|
|
#include "constants/frontier_util.h"
|
2018-10-27 21:01:35 +02:00
|
|
|
#include "constants/trainers.h"
|
2018-10-28 00:50:06 +02:00
|
|
|
#include "constants/game_stat.h"
|
2018-10-28 21:11:53 +01:00
|
|
|
#include "constants/moves.h"
|
2018-11-01 21:31:10 +01:00
|
|
|
#include "constants/items.h"
|
|
|
|
#include "constants/event_objects.h"
|
2019-03-02 08:44:02 +01:00
|
|
|
#include "party_menu.h"
|
2018-10-27 15:44:29 +02:00
|
|
|
|
2018-11-01 21:31:10 +01:00
|
|
|
struct FrontierBrainMon
|
|
|
|
{
|
|
|
|
u16 species;
|
|
|
|
u16 heldItem;
|
|
|
|
u8 fixedIV;
|
|
|
|
u8 nature;
|
2018-11-27 22:45:50 +01:00
|
|
|
u8 evs[NUM_STATS];
|
2019-11-24 22:58:40 +01:00
|
|
|
u16 moves[MAX_MON_MOVES];
|
2018-11-01 21:31:10 +01:00
|
|
|
};
|
|
|
|
|
2018-10-27 15:44:29 +02:00
|
|
|
// This file's functions.
|
2019-11-21 03:46:29 +01:00
|
|
|
static void GetChallengeStatus(void);
|
|
|
|
static void GetFrontierData(void);
|
|
|
|
static void SetFrontierData(void);
|
2019-11-24 22:58:40 +01:00
|
|
|
static void SetSelectedPartyOrder(void);
|
2018-11-01 21:31:10 +01:00
|
|
|
static void DoSoftReset_(void);
|
2019-11-10 02:40:25 +01:00
|
|
|
static void SetFrontierTrainers(void);
|
2019-11-24 22:58:40 +01:00
|
|
|
static void SaveSelectedParty(void);
|
2018-11-01 21:31:10 +01:00
|
|
|
static void ShowFacilityResultsWindow(void);
|
2019-11-24 22:58:40 +01:00
|
|
|
static void CheckPutFrontierTVShowOnAir(void);
|
2019-11-21 03:46:29 +01:00
|
|
|
static void Script_GetFrontierBrainStatus(void);
|
2019-11-10 02:40:25 +01:00
|
|
|
static void IsTrainerFrontierBrain(void);
|
2019-11-24 22:58:40 +01:00
|
|
|
static void GiveBattlePoints(void);
|
2019-11-10 02:40:25 +01:00
|
|
|
static void GetFacilitySymbolCount(void);
|
|
|
|
static void GiveFacilitySymbol(void);
|
|
|
|
static void CheckBattleTypeFlag(void);
|
2019-11-24 22:58:40 +01:00
|
|
|
static void CheckPartyIneligibility(void);
|
2019-11-10 02:40:25 +01:00
|
|
|
static void ValidateVisitingTrainer(void);
|
2019-11-24 22:58:40 +01:00
|
|
|
static void IncrementWinStreak(void);
|
|
|
|
static void RestoreHeldItems(void);
|
|
|
|
static void SaveRecordBattle(void);
|
2019-11-10 02:40:25 +01:00
|
|
|
static void BufferFrontierTrainerName(void);
|
2019-11-21 03:46:29 +01:00
|
|
|
static void ResetSketchedMoves(void);
|
2019-11-21 04:55:44 +01:00
|
|
|
static void SetFacilityBrainObjectEvent(void);
|
2018-10-28 21:11:53 +01:00
|
|
|
static void ShowTowerResultsWindow(u8);
|
|
|
|
static void ShowDomeResultsWindow(u8);
|
|
|
|
static void ShowPalaceResultsWindow(u8);
|
|
|
|
static void ShowPikeResultsWindow(void);
|
|
|
|
static void ShowFactoryResultsWindow(u8);
|
|
|
|
static void ShowArenaResultsWindow(void);
|
|
|
|
static void ShowPyramidResultsWindow(void);
|
|
|
|
static void ShowLinkContestResultsWindow(void);
|
2018-11-01 15:06:50 +01:00
|
|
|
static void CopyFrontierBrainText(bool8 playerWonText);
|
2018-10-28 21:11:53 +01:00
|
|
|
|
|
|
|
// const rom data
|
2019-11-21 03:46:29 +01:00
|
|
|
static const u8 sFrontierBrainStreakAppearances[NUM_FRONTIER_FACILITIES][4] =
|
|
|
|
{
|
|
|
|
[FRONTIER_FACILITY_TOWER] = {35, 70, 35, 1},
|
|
|
|
[FRONTIER_FACILITY_DOME] = { 4, 9, 5, 0},
|
|
|
|
[FRONTIER_FACILITY_PALACE] = {21, 42, 21, 1},
|
|
|
|
[FRONTIER_FACILITY_ARENA] = {28, 56, 28, 1},
|
|
|
|
[FRONTIER_FACILITY_FACTORY] = {21, 42, 21, 1},
|
|
|
|
[FRONTIER_FACILITY_PIKE] = {28, 140, 56, 1},
|
|
|
|
[FRONTIER_FACILITY_PYRAMID] = {21, 70, 35, 0},
|
2018-10-28 21:11:53 +01:00
|
|
|
};
|
2018-10-27 15:44:29 +02:00
|
|
|
|
2020-04-09 21:18:53 +02:00
|
|
|
static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZE] =
|
2018-11-01 21:31:10 +01:00
|
|
|
{
|
|
|
|
[FRONTIER_FACILITY_TOWER] =
|
|
|
|
{
|
|
|
|
// Silver Symbol.
|
|
|
|
{
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_ALAKAZAM,
|
|
|
|
.heldItem = ITEM_BRIGHT_POWDER,
|
|
|
|
.fixedIV = 24,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_MODEST,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {106, 0, 152, 152, 100, 0},
|
|
|
|
.moves = {MOVE_THUNDER_PUNCH, MOVE_FIRE_PUNCH, MOVE_ICE_PUNCH, MOVE_DISABLE},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_ENTEI,
|
|
|
|
.heldItem = ITEM_LUM_BERRY,
|
|
|
|
.fixedIV = 24,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_LONELY,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {100, 152, 152, 0, 100, 6},
|
|
|
|
.moves = {MOVE_FIRE_BLAST, MOVE_CALM_MIND, MOVE_RETURN, MOVE_ROAR},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_SNORLAX,
|
|
|
|
.heldItem = ITEM_QUICK_CLAW,
|
|
|
|
.fixedIV = 24,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_ADAMANT,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {152, 152, 0, 0, 106, 100},
|
|
|
|
.moves = {MOVE_BODY_SLAM, MOVE_BELLY_DRUM, MOVE_YAWN, MOVE_SHADOW_BALL},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
// Gold Symbol.
|
|
|
|
{
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_RAIKOU,
|
|
|
|
.heldItem = ITEM_LUM_BERRY,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_MODEST,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {158, 0, 252, 100, 0, 0},
|
|
|
|
.moves = {MOVE_THUNDERBOLT, MOVE_CALM_MIND, MOVE_REFLECT, MOVE_REST},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_LATIOS,
|
|
|
|
.heldItem = ITEM_BRIGHT_POWDER,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_MODEST,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {252, 0, 252, 6, 0, 0},
|
|
|
|
.moves = {MOVE_PSYCHIC, MOVE_CALM_MIND, MOVE_RECOVER, MOVE_DRAGON_CLAW},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_SNORLAX,
|
|
|
|
.heldItem = ITEM_CHESTO_BERRY,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_ADAMANT,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {252, 252, 0, 0, 6, 0},
|
|
|
|
.moves = {MOVE_CURSE, MOVE_RETURN, MOVE_REST, MOVE_SHADOW_BALL},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2018-11-26 20:19:52 +01:00
|
|
|
[FRONTIER_FACILITY_DOME] =
|
|
|
|
{
|
2018-11-01 21:31:10 +01:00
|
|
|
// Silver Symbol.
|
|
|
|
{
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_SWAMPERT,
|
|
|
|
.heldItem = ITEM_FOCUS_BAND,
|
|
|
|
.fixedIV = 20,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_BRAVE,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {152, 152, 106, 0, 100, 0},
|
|
|
|
.moves = {MOVE_SURF, MOVE_EARTHQUAKE, MOVE_ICE_BEAM, MOVE_COUNTER},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_SALAMENCE,
|
|
|
|
.heldItem = ITEM_LUM_BERRY,
|
|
|
|
.fixedIV = 20,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_ADAMANT,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {152, 152, 106, 100, 0, 0},
|
|
|
|
.moves = {MOVE_EARTHQUAKE, MOVE_BRICK_BREAK, MOVE_DRAGON_CLAW, MOVE_AERIAL_ACE},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_CHARIZARD,
|
|
|
|
.heldItem = ITEM_WHITE_HERB,
|
|
|
|
.fixedIV = 20,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_QUIET,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {100, 152, 106, 152, 0, 0},
|
|
|
|
.moves = {MOVE_OVERHEAT, MOVE_ROCK_SLIDE, MOVE_AERIAL_ACE, MOVE_EARTHQUAKE},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
// Gold Symbol.
|
|
|
|
{
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_SWAMPERT,
|
|
|
|
.heldItem = ITEM_LEFTOVERS,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_BRAVE,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {252, 252, 6, 0, 0, 0},
|
|
|
|
.moves = {MOVE_SURF, MOVE_EARTHQUAKE, MOVE_ICE_BEAM, MOVE_MIRROR_COAT},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_METAGROSS,
|
|
|
|
.heldItem = ITEM_QUICK_CLAW,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_BRAVE,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {252, 252, 6, 0, 0, 0},
|
|
|
|
.moves = {MOVE_PSYCHIC, MOVE_METEOR_MASH, MOVE_EARTHQUAKE, MOVE_PROTECT},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_LATIAS,
|
|
|
|
.heldItem = ITEM_CHESTO_BERRY,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_MODEST,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {252, 0, 252, 6, 0, 0},
|
|
|
|
.moves = {MOVE_THUNDERBOLT, MOVE_PSYCHIC, MOVE_CALM_MIND, MOVE_REST},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2018-11-26 20:19:52 +01:00
|
|
|
[FRONTIER_FACILITY_PALACE] =
|
|
|
|
{
|
2018-11-01 21:31:10 +01:00
|
|
|
// Silver Symbol.
|
|
|
|
{
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_CROBAT,
|
|
|
|
.heldItem = ITEM_BRIGHT_POWDER,
|
|
|
|
.fixedIV = 16,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_ADAMANT,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {152, 0, 0, 152, 100, 106},
|
|
|
|
.moves = {MOVE_CONFUSE_RAY, MOVE_DOUBLE_TEAM, MOVE_TOXIC, MOVE_FLY},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_SLAKING,
|
|
|
|
.heldItem = ITEM_SCOPE_LENS,
|
|
|
|
.fixedIV = 16,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_HARDY,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {152, 152, 0, 106, 100, 0},
|
|
|
|
.moves = {MOVE_EARTHQUAKE, MOVE_SWAGGER, MOVE_SHADOW_BALL, MOVE_BRICK_BREAK},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_LAPRAS,
|
|
|
|
.heldItem = ITEM_QUICK_CLAW,
|
|
|
|
.fixedIV = 16,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_QUIET,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {0, 0, 252, 0, 106, 152},
|
|
|
|
.moves = {MOVE_ICE_BEAM, MOVE_HORN_DRILL, MOVE_CONFUSE_RAY, MOVE_PROTECT},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
// Gold Symbol.
|
|
|
|
{
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_ARCANINE,
|
|
|
|
.heldItem = ITEM_WHITE_HERB,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_HASTY,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {6, 252, 252, 0, 0, 0},
|
|
|
|
.moves = {MOVE_OVERHEAT, MOVE_EXTREME_SPEED, MOVE_ROAR, MOVE_PROTECT},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_SLAKING,
|
|
|
|
.heldItem = ITEM_SCOPE_LENS,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_HARDY,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {6, 252, 0, 252, 0, 0},
|
|
|
|
.moves = {MOVE_HYPER_BEAM, MOVE_EARTHQUAKE, MOVE_SHADOW_BALL, MOVE_YAWN},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_SUICUNE,
|
|
|
|
.heldItem = ITEM_KINGS_ROCK,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_HASTY,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {252, 0, 252, 6, 0, 0},
|
|
|
|
.moves = {MOVE_BLIZZARD, MOVE_SURF, MOVE_BITE, MOVE_CALM_MIND},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2018-11-26 20:19:52 +01:00
|
|
|
[FRONTIER_FACILITY_ARENA] =
|
|
|
|
{
|
2018-11-01 21:31:10 +01:00
|
|
|
// Silver Symbol.
|
|
|
|
{
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_HERACROSS,
|
|
|
|
.heldItem = ITEM_SALAC_BERRY,
|
|
|
|
.fixedIV = 20,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_JOLLY,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {106, 152, 0, 152, 0, 100},
|
|
|
|
.moves = {MOVE_MEGAHORN, MOVE_ROCK_TOMB, MOVE_ENDURE, MOVE_REVERSAL},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_UMBREON,
|
|
|
|
.heldItem = ITEM_LEFTOVERS,
|
|
|
|
.fixedIV = 20,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_CALM,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {152, 0, 100, 0, 152, 106},
|
|
|
|
.moves = {MOVE_BODY_SLAM, MOVE_CONFUSE_RAY, MOVE_PSYCHIC, MOVE_FAINT_ATTACK},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_SHEDINJA,
|
|
|
|
.heldItem = ITEM_BRIGHT_POWDER,
|
|
|
|
.fixedIV = 20,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_ADAMANT,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {0, 252, 6, 252, 0, 0},
|
|
|
|
.moves = {MOVE_SHADOW_BALL, MOVE_RETURN, MOVE_CONFUSE_RAY, MOVE_AERIAL_ACE},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
// Gold Symbol.
|
|
|
|
{
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_UMBREON,
|
|
|
|
.heldItem = ITEM_CHESTO_BERRY,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_CALM,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {252, 0, 0, 0, 252, 6},
|
|
|
|
.moves = {MOVE_DOUBLE_EDGE, MOVE_CONFUSE_RAY, MOVE_REST, MOVE_PSYCHIC},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_GENGAR,
|
|
|
|
.heldItem = ITEM_LEFTOVERS,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_MODEST,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {252, 0, 252, 0, 6, 0},
|
|
|
|
.moves = {MOVE_PSYCHIC, MOVE_HYPNOSIS, MOVE_DREAM_EATER, MOVE_DESTINY_BOND},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_BRELOOM,
|
|
|
|
.heldItem = ITEM_LUM_BERRY,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_JOLLY,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {6, 252, 0, 252, 0, 0},
|
|
|
|
.moves = {MOVE_SPORE, MOVE_FOCUS_PUNCH, MOVE_GIGA_DRAIN, MOVE_HEADBUTT},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2018-11-26 20:19:52 +01:00
|
|
|
[FRONTIER_FACILITY_FACTORY] =
|
|
|
|
{
|
2018-11-11 16:44:27 +01:00
|
|
|
// Because Factory's pokemon are random, this facility's Brain also uses random pokemon.
|
|
|
|
// What is interesting, this team is actually the one Steven uses in the multi tag battle alongside the player.
|
2018-11-01 21:31:10 +01:00
|
|
|
{
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_METANG,
|
|
|
|
.heldItem = ITEM_SITRUS_BERRY,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_BRAVE,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {0, 252, 252, 0, 6, 0},
|
|
|
|
.moves = {MOVE_LIGHT_SCREEN, MOVE_PSYCHIC, MOVE_REFLECT, MOVE_METAL_CLAW},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_SKARMORY,
|
|
|
|
.heldItem = ITEM_SITRUS_BERRY,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_IMPISH,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {252, 0, 0, 0, 6, 252},
|
|
|
|
.moves = {MOVE_TOXIC, MOVE_AERIAL_ACE, MOVE_PROTECT, MOVE_STEEL_WING},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_AGGRON,
|
|
|
|
.heldItem = ITEM_SITRUS_BERRY,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_ADAMANT,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {0, 252, 0, 0, 252, 6},
|
|
|
|
.moves = {MOVE_THUNDERBOLT, MOVE_PROTECT, MOVE_SOLAR_BEAM, MOVE_DRAGON_CLAW},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_METANG,
|
|
|
|
.heldItem = ITEM_SITRUS_BERRY,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_BRAVE,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {0, 252, 252, 0, 6, 0},
|
|
|
|
.moves = {MOVE_LIGHT_SCREEN, MOVE_PSYCHIC, MOVE_REFLECT, MOVE_METAL_CLAW},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_SKARMORY,
|
|
|
|
.heldItem = ITEM_SITRUS_BERRY,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_IMPISH,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {252, 0, 0, 0, 6, 252},
|
|
|
|
.moves = {MOVE_TOXIC, MOVE_AERIAL_ACE, MOVE_PROTECT, MOVE_STEEL_WING},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_AGGRON,
|
|
|
|
.heldItem = ITEM_SITRUS_BERRY,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_ADAMANT,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {0, 252, 0, 0, 252, 6},
|
|
|
|
.moves = {MOVE_THUNDERBOLT, MOVE_PROTECT, MOVE_SOLAR_BEAM, MOVE_DRAGON_CLAW},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2018-11-26 20:19:52 +01:00
|
|
|
[FRONTIER_FACILITY_PIKE] =
|
|
|
|
{
|
2018-11-01 21:31:10 +01:00
|
|
|
// Silver Symbol.
|
|
|
|
{
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_SEVIPER,
|
|
|
|
.heldItem = ITEM_QUICK_CLAW,
|
|
|
|
.fixedIV = 16,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_BRAVE,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {252, 0, 252, 0, 6, 0},
|
|
|
|
.moves = {MOVE_SWAGGER, MOVE_CRUNCH, MOVE_POISON_FANG, MOVE_GIGA_DRAIN},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_SHUCKLE,
|
|
|
|
.heldItem = ITEM_CHESTO_BERRY,
|
|
|
|
.fixedIV = 16,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_BOLD,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {252, 0, 0, 0, 106, 252},
|
|
|
|
.moves = {MOVE_TOXIC, MOVE_SANDSTORM, MOVE_PROTECT, MOVE_REST},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_MILOTIC,
|
|
|
|
.heldItem = ITEM_LEFTOVERS,
|
|
|
|
.fixedIV = 16,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_MODEST,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {152, 0, 100, 0, 152, 106},
|
|
|
|
.moves = {MOVE_ICE_BEAM, MOVE_MIRROR_COAT, MOVE_SURF, MOVE_RECOVER},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
// Gold Symbol.
|
|
|
|
{
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_SEVIPER,
|
|
|
|
.heldItem = ITEM_FOCUS_BAND,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_BOLD,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {252, 0, 0, 0, 252, 6},
|
|
|
|
.moves = {MOVE_SWAGGER, MOVE_CRUNCH, MOVE_SLUDGE_BOMB, MOVE_GIGA_DRAIN},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_STEELIX,
|
|
|
|
.heldItem = ITEM_BRIGHT_POWDER,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_BRAVE,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {252, 0, 0, 0, 6, 252},
|
|
|
|
.moves = {MOVE_EARTHQUAKE, MOVE_ROCK_SLIDE, MOVE_EXPLOSION, MOVE_SCREECH},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_GYARADOS,
|
|
|
|
.heldItem = ITEM_CHESTO_BERRY,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_ADAMANT,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {252, 6, 0, 0, 0, 252},
|
|
|
|
.moves = {MOVE_DRAGON_DANCE, MOVE_RETURN, MOVE_ROAR, MOVE_REST},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2018-11-26 20:19:52 +01:00
|
|
|
[FRONTIER_FACILITY_PYRAMID] =
|
|
|
|
{
|
2018-11-01 21:31:10 +01:00
|
|
|
// Silver Symbol.
|
|
|
|
{
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_REGIROCK,
|
|
|
|
.heldItem = ITEM_QUICK_CLAW,
|
|
|
|
.fixedIV = 16,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_ADAMANT,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {152, 152, 0, 0, 106, 100},
|
|
|
|
.moves = {MOVE_EXPLOSION, MOVE_SUPERPOWER, MOVE_EARTHQUAKE, MOVE_ANCIENT_POWER},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_REGISTEEL,
|
|
|
|
.heldItem = ITEM_LEFTOVERS,
|
|
|
|
.fixedIV = 16,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_ADAMANT,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {152, 152, 0, 0, 6, 200},
|
|
|
|
.moves = {MOVE_EARTHQUAKE, MOVE_METAL_CLAW, MOVE_TOXIC, MOVE_IRON_DEFENSE},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_REGICE,
|
|
|
|
.heldItem = ITEM_CHESTO_BERRY,
|
|
|
|
.fixedIV = 16,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_MODEST,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {106, 0, 152, 0, 100, 152},
|
|
|
|
.moves = {MOVE_ICE_BEAM, MOVE_AMNESIA, MOVE_THUNDER, MOVE_REST},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
// Gold Symbol.
|
|
|
|
{
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_ARTICUNO,
|
|
|
|
.heldItem = ITEM_SCOPE_LENS,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_MILD,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {6, 0, 252, 252, 0, 0},
|
|
|
|
.moves = {MOVE_BLIZZARD, MOVE_WATER_PULSE, MOVE_AERIAL_ACE, MOVE_REFLECT},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_ZAPDOS,
|
|
|
|
.heldItem = ITEM_LUM_BERRY,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_MILD,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {6, 0, 252, 252, 0, 0},
|
|
|
|
.moves = {MOVE_THUNDER, MOVE_DETECT, MOVE_DRILL_PECK, MOVE_LIGHT_SCREEN},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
{
|
2018-11-26 20:19:52 +01:00
|
|
|
.species = SPECIES_MOLTRES,
|
|
|
|
.heldItem = ITEM_BRIGHT_POWDER,
|
2021-01-07 23:13:14 +01:00
|
|
|
.fixedIV = MAX_PER_STAT_IVS,
|
2019-11-21 03:46:29 +01:00
|
|
|
.nature = NATURE_MILD,
|
2018-11-26 20:19:52 +01:00
|
|
|
.evs = {6, 0, 252, 252, 0, 0},
|
|
|
|
.moves = {MOVE_FIRE_BLAST, MOVE_HYPER_BEAM, MOVE_AERIAL_ACE, MOVE_SAFEGUARD},
|
2018-11-01 21:31:10 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
static const u8 sBattlePointAwards[][NUM_FRONTIER_FACILITIES][FRONTIER_MODE_COUNT] =
|
2018-11-01 21:31:10 +01:00
|
|
|
{
|
|
|
|
{
|
|
|
|
{1, 2, 3, 3}, {1, 1, 0, 0}, {4, 5, 0, 0}, {1, 0, 0, 0}, {3, 4, 0, 0}, {1, 0, 0, 0}, {5, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{2, 3, 4, 4}, {1, 1, 0, 0}, {4, 5, 0, 0}, {1, 0, 0, 0}, {3, 4, 0, 0}, {1, 0, 0, 0}, {5, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{3, 4, 5, 5}, {2, 2, 0, 0}, {5, 6, 0, 0}, {1, 0, 0, 0}, {4, 5, 0, 0}, {2, 0, 0, 0}, {6, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{4, 5, 6, 6}, {2, 2, 0, 0}, {5, 6, 0, 0}, {2, 0, 0, 0}, {4, 5, 0, 0}, {2, 0, 0, 0}, {6, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{5, 6, 7, 7}, {3, 3, 0, 0}, {6, 7, 0, 0}, {2, 0, 0, 0}, {5, 6, 0, 0}, {2, 0, 0, 0}, {7, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{6, 7, 8, 8}, {3, 3, 0, 0}, {6, 7, 0, 0}, {2, 0, 0, 0}, {5, 6, 0, 0}, {4, 0, 0, 0}, {7, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{7, 8, 9, 9}, {4, 4, 0, 0}, {7, 8, 0, 0}, {3, 0, 0, 0}, {6, 7, 0, 0}, {4, 0, 0, 0}, {8, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{8, 9, 10, 10}, {4, 4, 0, 0}, {7, 8, 0, 0}, {3, 0, 0, 0},{6, 7, 0, 0}, {4, 0, 0, 0}, {8, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{9, 10, 11, 11}, {5, 5, 0, 0}, {8, 9, 0, 0}, {4, 0, 0, 0}, {7, 8, 0, 0}, {8, 0, 0, 0}, {9, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{10, 11, 12, 12}, {5, 5, 0, 0}, {8, 9, 0, 0}, {4, 0, 0, 0}, {7, 8, 0, 0}, {8, 0, 0, 0}, {9, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{11, 12, 13, 13}, {6, 6, 0, 0}, {9, 10, 0, 0}, {5, 0, 0,0}, {8, 9, 0, 0}, {8, 0, 0, 0}, {10, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{12, 13, 14, 14}, {6, 6, 0, 0}, {9, 10, 0, 0}, {6, 0, 0,0}, {8, 9, 0, 0}, {8, 0, 0, 0}, {10, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{13, 14, 15, 15}, {7, 7, 0, 0}, {10, 11, 0, 0}, {7, 0, 0, 0}, {9, 10, 0, 0}, {10, 0, 0, 0}, {11, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{14, 15, 15, 15}, {7, 7, 0, 0}, {10, 11, 0, 0}, {8, 0, 0, 0}, {9, 10, 0, 0}, {10, 0, 0, 0}, {11, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{15, 15, 15, 15}, {8, 8, 0, 0}, {11, 12, 0, 0}, {9, 0, 0, 0}, {10, 11, 0, 0}, {10, 0, 0, 0}, {12, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{15, 15, 15, 15}, {8, 8, 0, 0}, {11, 12, 0, 0}, {10, 0, 0, 0}, {10, 11, 0, 0}, {10, 0, 0, 0}, {12, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{15, 15, 15, 15}, {9, 9, 0, 0}, {12, 13, 0, 0}, {11, 0, 0, 0}, {11, 12, 0, 0}, {12, 0, 0, 0}, {13, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{15, 15, 15, 15}, {9, 9, 0, 0}, {12, 13, 0, 0}, {12, 0, 0, 0}, {11, 12, 0, 0}, {12, 0, 0, 0}, {13, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{15, 15, 15, 15}, {10, 10, 0, 0}, {13, 14, 0, 0}, {13, 0, 0, 0}, {12, 13, 0, 0}, {12, 0, 0, 0}, {14, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{15, 15, 15, 15}, {10, 10, 0, 0}, {13, 14, 0, 0}, {14, 0, 0, 0}, {12, 13, 0, 0}, {12, 0, 0, 0}, {14, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{15, 15, 15, 15}, {11, 11, 0, 0}, {14, 15, 0, 0}, {15, 0, 0, 0}, {13, 14, 0, 0}, {12, 0, 0, 0}, {15, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{15, 15, 15, 15}, {11, 11, 0, 0}, {14, 15, 0, 0}, {15, 0, 0, 0}, {13, 14, 0, 0}, {14, 0, 0, 0}, {15, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{15, 15, 15, 15}, {12, 12, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {14, 15, 0, 0}, {14, 0, 0, 0}, {15, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{15, 15, 15, 15}, {12, 12, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {14, 15, 0, 0}, {14, 0, 0, 0}, {15, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{15, 15, 15, 15}, {13, 13, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 15, 0, 0}, {14, 0, 0, 0}, {15, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{15, 15, 15, 15}, {13, 13, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{15, 15, 15, 15}, {14, 14, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{15, 15, 15, 15}, {14, 14, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{15, 15, 15, 15}, {15, 15, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 0, 0, 0}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{15, 15, 15, 15}, {15, 15, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 0, 0, 0}
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
// Flags to change the conversation when the Frontier Brain is encountered for a battle
|
|
|
|
// First bit is has battled them before and not won yet, second bit is has battled them and won (obtained a Symbol)
|
|
|
|
static const u16 sBattledBrainBitFlags[NUM_FRONTIER_FACILITIES][2] =
|
2018-11-01 21:31:10 +01:00
|
|
|
{
|
|
|
|
[FRONTIER_FACILITY_TOWER] = {0x0001, 0x0002},
|
2018-11-05 22:13:59 +01:00
|
|
|
[FRONTIER_FACILITY_DOME] = {0x0004, 0x0008},
|
|
|
|
[FRONTIER_FACILITY_PALACE] = {0x0010, 0x0020},
|
|
|
|
[FRONTIER_FACILITY_ARENA] = {0x0040, 0x0080},
|
|
|
|
[FRONTIER_FACILITY_FACTORY] = {0x0100, 0x0200},
|
|
|
|
[FRONTIER_FACILITY_PIKE] = {0x0400, 0x0800},
|
|
|
|
[FRONTIER_FACILITY_PYRAMID] = {0x1000, 0x2000},
|
2018-11-01 21:31:10 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static void (* const sFrontierUtilFuncs[])(void) =
|
|
|
|
{
|
2019-11-21 03:46:29 +01:00
|
|
|
[FRONTIER_UTIL_FUNC_GET_STATUS] = GetChallengeStatus,
|
|
|
|
[FRONTIER_UTIL_FUNC_GET_DATA] = GetFrontierData,
|
|
|
|
[FRONTIER_UTIL_FUNC_SET_DATA] = SetFrontierData,
|
2019-11-24 22:58:40 +01:00
|
|
|
[FRONTIER_UTIL_FUNC_SET_PARTY_ORDER] = SetSelectedPartyOrder,
|
2019-11-10 02:40:25 +01:00
|
|
|
[FRONTIER_UTIL_FUNC_SOFT_RESET] = DoSoftReset_,
|
2019-11-24 22:58:40 +01:00
|
|
|
[FRONTIER_UTIL_FUNC_SET_TRAINERS] = SetFrontierTrainers,
|
|
|
|
[FRONTIER_UTIL_FUNC_SAVE_PARTY] = SaveSelectedParty,
|
2019-11-10 02:40:25 +01:00
|
|
|
[FRONTIER_UTIL_FUNC_RESULTS_WINDOW] = ShowFacilityResultsWindow,
|
2019-11-24 22:58:40 +01:00
|
|
|
[FRONTIER_UTIL_FUNC_CHECK_AIR_TV_SHOW] = CheckPutFrontierTVShowOnAir,
|
2019-11-21 03:46:29 +01:00
|
|
|
[FRONTIER_UTIL_FUNC_GET_BRAIN_STATUS] = Script_GetFrontierBrainStatus,
|
2019-11-24 22:58:40 +01:00
|
|
|
[FRONTIER_UTIL_FUNC_IS_BRAIN] = IsTrainerFrontierBrain,
|
|
|
|
[FRONTIER_UTIL_FUNC_GIVE_BATTLE_POINTS] = GiveBattlePoints,
|
2019-11-10 02:40:25 +01:00
|
|
|
[FRONTIER_UTIL_FUNC_GET_FACILITY_SYMBOLS] = GetFacilitySymbolCount,
|
|
|
|
[FRONTIER_UTIL_FUNC_GIVE_FACILITY_SYMBOL] = GiveFacilitySymbol,
|
|
|
|
[FRONTIER_UTIL_FUNC_CHECK_BATTLE_TYPE] = CheckBattleTypeFlag,
|
2019-11-24 22:58:40 +01:00
|
|
|
[FRONTIER_UTIL_FUNC_CHECK_INELIGIBLE] = CheckPartyIneligibility,
|
2019-11-10 02:40:25 +01:00
|
|
|
[FRONTIER_UTIL_FUNC_CHECK_VISIT_TRAINER] = ValidateVisitingTrainer,
|
2019-11-24 22:58:40 +01:00
|
|
|
[FRONTIER_UTIL_FUNC_INCREMENT_STREAK] = IncrementWinStreak,
|
|
|
|
[FRONTIER_UTIL_FUNC_RESTORE_HELD_ITEMS] = RestoreHeldItems,
|
|
|
|
[FRONTIER_UTIL_FUNC_SAVE_BATTLE] = SaveRecordBattle,
|
2019-11-10 02:40:25 +01:00
|
|
|
[FRONTIER_UTIL_FUNC_BUFFER_TRAINER_NAME] = BufferFrontierTrainerName,
|
2019-11-21 03:46:29 +01:00
|
|
|
[FRONTIER_UTIL_FUNC_RESET_SKETCH_MOVES] = ResetSketchedMoves,
|
2019-11-21 04:55:44 +01:00
|
|
|
[FRONTIER_UTIL_FUNC_SET_BRAIN_OBJECT] = SetFacilityBrainObjectEvent,
|
2018-11-01 21:31:10 +01:00
|
|
|
};
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
static const struct WindowTemplate sFrontierResultsWindowTemplate =
|
2018-11-01 21:31:10 +01:00
|
|
|
{
|
|
|
|
.bg = 0,
|
|
|
|
.tilemapLeft = 1,
|
|
|
|
.tilemapTop = 1,
|
|
|
|
.width = 0x1c,
|
|
|
|
.height = 0x12,
|
|
|
|
.paletteNum = 15,
|
|
|
|
.baseBlock = 1
|
|
|
|
};
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
static const struct WindowTemplate sLinkContestResultsWindowTemplate =
|
2018-11-01 21:31:10 +01:00
|
|
|
{
|
|
|
|
.bg = 0,
|
|
|
|
.tilemapLeft = 2,
|
|
|
|
.tilemapTop = 2,
|
|
|
|
.width = 0x1a,
|
|
|
|
.height = 15,
|
|
|
|
.paletteNum = 15,
|
|
|
|
.baseBlock = 1
|
|
|
|
};
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
static const struct WindowTemplate sRankingHallRecordsWindowTemplate =
|
2018-11-01 21:31:10 +01:00
|
|
|
{
|
|
|
|
.bg = 0,
|
|
|
|
.tilemapLeft = 2,
|
|
|
|
.tilemapTop = 1,
|
|
|
|
.width = 0x1a,
|
|
|
|
.height = 17,
|
|
|
|
.paletteNum = 15,
|
|
|
|
.baseBlock = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
// Second field - whether the character is female.
|
2019-11-21 03:46:29 +01:00
|
|
|
static const u8 sFrontierBrainObjEventGfx[NUM_FRONTIER_FACILITIES][2] =
|
2018-11-01 21:31:10 +01:00
|
|
|
{
|
2019-11-21 05:12:51 +01:00
|
|
|
[FRONTIER_FACILITY_TOWER] = {OBJ_EVENT_GFX_ANABEL, TRUE},
|
|
|
|
[FRONTIER_FACILITY_DOME] = {OBJ_EVENT_GFX_TUCKER, FALSE},
|
|
|
|
[FRONTIER_FACILITY_PALACE] = {OBJ_EVENT_GFX_SPENSER, FALSE},
|
|
|
|
[FRONTIER_FACILITY_ARENA] = {OBJ_EVENT_GFX_GRETA, TRUE},
|
|
|
|
[FRONTIER_FACILITY_FACTORY] = {OBJ_EVENT_GFX_NOLAND, FALSE},
|
|
|
|
[FRONTIER_FACILITY_PIKE] = {OBJ_EVENT_GFX_LUCY, TRUE},
|
|
|
|
[FRONTIER_FACILITY_PYRAMID] = {OBJ_EVENT_GFX_BRANDON, FALSE},
|
2018-11-01 21:31:10 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
const u16 gFrontierBannedSpecies[] =
|
|
|
|
{
|
|
|
|
SPECIES_MEW, SPECIES_MEWTWO, SPECIES_HO_OH, SPECIES_LUGIA, SPECIES_CELEBI,
|
2018-12-05 15:31:01 +01:00
|
|
|
SPECIES_KYOGRE, SPECIES_GROUDON, SPECIES_RAYQUAZA, SPECIES_JIRACHI, SPECIES_DEOXYS, 0xFFFF
|
2018-11-01 21:31:10 +01:00
|
|
|
};
|
2018-11-27 17:21:48 +01:00
|
|
|
|
2019-11-17 00:11:27 +01:00
|
|
|
static const u8 *const sRecordsWindowChallengeTexts[][2] =
|
|
|
|
{
|
|
|
|
[RANKING_HALL_BATTLE_TOWER_SINGLES] = {gText_BattleTower2, gText_FacilitySingle},
|
|
|
|
[RANKING_HALL_BATTLE_TOWER_DOUBLES] = {gText_BattleTower2, gText_FacilityDouble},
|
|
|
|
[RANKING_HALL_BATTLE_TOWER_MULTIS] = {gText_BattleTower2, gText_FacilityMulti},
|
|
|
|
[RANKING_HALL_BATTLE_DOME] = {gText_BattleDome, gText_FacilitySingle},
|
|
|
|
[RANKING_HALL_BATTLE_PALACE] = {gText_BattlePalace, gText_FacilitySingle},
|
|
|
|
[RANKING_HALL_BATTLE_ARENA] = {gText_BattleArena, gText_Facility},
|
|
|
|
[RANKING_HALL_BATTLE_FACTORY] = {gText_BattleFactory, gText_FacilitySingle},
|
|
|
|
[RANKING_HALL_BATTLE_PIKE] = {gText_BattlePike, gText_Facility},
|
|
|
|
[RANKING_HALL_BATTLE_PYRAMID] = {gText_BattlePyramid, gText_Facility},
|
|
|
|
[RANKING_HALL_BATTLE_TOWER_LINK] = {gText_BattleTower2, gText_FacilityLink},
|
2018-11-27 17:21:48 +01:00
|
|
|
};
|
|
|
|
|
2019-11-17 00:11:27 +01:00
|
|
|
static const u8 *const sLevelModeText[] =
|
2018-11-27 17:21:48 +01:00
|
|
|
{
|
|
|
|
gText_RecordsLv50,
|
|
|
|
gText_RecordsOpenLevel,
|
|
|
|
};
|
|
|
|
|
2019-11-17 00:11:27 +01:00
|
|
|
static const u8 *const sHallFacilityToRecordsText[] =
|
|
|
|
{
|
|
|
|
[RANKING_HALL_BATTLE_TOWER_SINGLES] = gText_FrontierFacilityWinStreak,
|
|
|
|
[RANKING_HALL_BATTLE_TOWER_DOUBLES] = gText_FrontierFacilityWinStreak,
|
|
|
|
[RANKING_HALL_BATTLE_TOWER_MULTIS] = gText_FrontierFacilityWinStreak,
|
|
|
|
[RANKING_HALL_BATTLE_DOME] = gText_FrontierFacilityClearStreak,
|
|
|
|
[RANKING_HALL_BATTLE_PALACE] = gText_FrontierFacilityWinStreak,
|
|
|
|
[RANKING_HALL_BATTLE_ARENA] = gText_FrontierFacilityKOsStreak,
|
|
|
|
[RANKING_HALL_BATTLE_FACTORY] = gText_FrontierFacilityWinStreak,
|
|
|
|
[RANKING_HALL_BATTLE_PIKE] = gText_FrontierFacilityRoomsCleared,
|
|
|
|
[RANKING_HALL_BATTLE_PYRAMID] = gText_FrontierFacilityFloorsCleared,
|
|
|
|
[RANKING_HALL_BATTLE_TOWER_LINK] = gText_FrontierFacilityWinStreak,
|
2018-11-27 17:21:48 +01:00
|
|
|
};
|
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
static const u16 sFrontierBrainTrainerIds[NUM_FRONTIER_FACILITIES] =
|
2018-11-27 17:21:48 +01:00
|
|
|
{
|
|
|
|
[FRONTIER_FACILITY_TOWER] = TRAINER_ANABEL,
|
|
|
|
[FRONTIER_FACILITY_DOME] = TRAINER_TUCKER,
|
|
|
|
[FRONTIER_FACILITY_PALACE] = TRAINER_SPENSER,
|
|
|
|
[FRONTIER_FACILITY_ARENA] = TRAINER_GRETA,
|
|
|
|
[FRONTIER_FACILITY_FACTORY] = TRAINER_NOLAND,
|
|
|
|
[FRONTIER_FACILITY_PIKE] = TRAINER_LUCY,
|
|
|
|
[FRONTIER_FACILITY_PYRAMID] = TRAINER_BRANDON,
|
|
|
|
};
|
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
static const u8 *const sFrontierBrainPlayerLostSilverTexts[NUM_FRONTIER_FACILITIES] =
|
2018-11-27 17:21:48 +01:00
|
|
|
{
|
2019-11-21 03:46:29 +01:00
|
|
|
[FRONTIER_FACILITY_TOWER] = gText_AnabelWonSilver,
|
|
|
|
[FRONTIER_FACILITY_DOME] = gText_TuckerWonSilver,
|
|
|
|
[FRONTIER_FACILITY_PALACE] = gText_SpenserWonSilver,
|
|
|
|
[FRONTIER_FACILITY_ARENA] = gText_GretaWonSilver,
|
|
|
|
[FRONTIER_FACILITY_FACTORY] = gText_NolandWonSilver,
|
|
|
|
[FRONTIER_FACILITY_PIKE] = gText_LucyWonSilver,
|
|
|
|
[FRONTIER_FACILITY_PYRAMID] = gText_BrandonWonSilver,
|
2018-11-27 17:21:48 +01:00
|
|
|
};
|
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
static const u8 *const sFrontierBrainPlayerWonSilverTexts[NUM_FRONTIER_FACILITIES] =
|
2018-11-27 17:21:48 +01:00
|
|
|
{
|
2019-11-21 03:46:29 +01:00
|
|
|
[FRONTIER_FACILITY_TOWER] = gText_AnabelDefeatSilver,
|
|
|
|
[FRONTIER_FACILITY_DOME] = gText_TuckerDefeatSilver,
|
|
|
|
[FRONTIER_FACILITY_PALACE] = gText_SpenserDefeatSilver,
|
|
|
|
[FRONTIER_FACILITY_ARENA] = gText_GretaDefeatSilver,
|
|
|
|
[FRONTIER_FACILITY_FACTORY] = gText_NolandDefeatSilver,
|
|
|
|
[FRONTIER_FACILITY_PIKE] = gText_LucyDefeatSilver,
|
|
|
|
[FRONTIER_FACILITY_PYRAMID] = gText_BrandonDefeatSilver,
|
2018-11-27 17:21:48 +01:00
|
|
|
};
|
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
static const u8 *const sFrontierBrainPlayerLostGoldTexts[NUM_FRONTIER_FACILITIES] =
|
2018-11-27 17:21:48 +01:00
|
|
|
{
|
2019-11-21 03:46:29 +01:00
|
|
|
[FRONTIER_FACILITY_TOWER] = gText_AnabelWonGold,
|
|
|
|
[FRONTIER_FACILITY_DOME] = gText_TuckerWonGold,
|
|
|
|
[FRONTIER_FACILITY_PALACE] = gText_SpenserWonGold,
|
|
|
|
[FRONTIER_FACILITY_ARENA] = gText_GretaWonGold,
|
|
|
|
[FRONTIER_FACILITY_FACTORY] = gText_NolandWonGold,
|
|
|
|
[FRONTIER_FACILITY_PIKE] = gText_LucyWonGold,
|
|
|
|
[FRONTIER_FACILITY_PYRAMID] = gText_BrandonWonGold,
|
2018-11-27 17:21:48 +01:00
|
|
|
};
|
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
static const u8 *const sFrontierBrainPlayerWonGoldTexts[NUM_FRONTIER_FACILITIES] =
|
2018-11-27 17:21:48 +01:00
|
|
|
{
|
2019-11-21 03:46:29 +01:00
|
|
|
[FRONTIER_FACILITY_TOWER] = gText_AnabelDefeatGold,
|
|
|
|
[FRONTIER_FACILITY_DOME] = gText_TuckerDefeatGold,
|
|
|
|
[FRONTIER_FACILITY_PALACE] = gText_SpenserDefeatGold,
|
|
|
|
[FRONTIER_FACILITY_ARENA] = gText_GretaDefeatGold,
|
|
|
|
[FRONTIER_FACILITY_FACTORY] = gText_NolandDefeatGold,
|
|
|
|
[FRONTIER_FACILITY_PIKE] = gText_LucyDefeatGold,
|
|
|
|
[FRONTIER_FACILITY_PYRAMID] = gText_BrandonDefeatGold,
|
2018-11-27 17:21:48 +01:00
|
|
|
};
|
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
static const u8 *const *const sFrontierBrainPlayerLostTexts[] =
|
2018-11-27 17:21:48 +01:00
|
|
|
{
|
2019-11-21 03:46:29 +01:00
|
|
|
sFrontierBrainPlayerLostSilverTexts,
|
|
|
|
sFrontierBrainPlayerLostGoldTexts,
|
2018-11-27 17:21:48 +01:00
|
|
|
};
|
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
static const u8 *const *const sFrontierBrainPlayerWonTexts[] =
|
2018-11-27 17:21:48 +01:00
|
|
|
{
|
2019-11-21 03:46:29 +01:00
|
|
|
sFrontierBrainPlayerWonSilverTexts,
|
|
|
|
sFrontierBrainPlayerWonGoldTexts,
|
2018-11-27 17:21:48 +01:00
|
|
|
};
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
// code
|
2018-11-01 21:31:10 +01:00
|
|
|
void CallFrontierUtilFunc(void)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
2018-11-01 21:31:10 +01:00
|
|
|
sFrontierUtilFuncs[gSpecialVar_0x8004]();
|
2018-10-27 15:44:29 +02:00
|
|
|
}
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
// Buffers into VAR_TEMP_0 specifically because this is used to react to the status in OnFrame map scripts
|
2019-11-21 03:46:29 +01:00
|
|
|
static void GetChallengeStatus(void)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
|
|
|
VarSet(VAR_TEMP_0, 0xFF);
|
2019-11-24 22:58:40 +01:00
|
|
|
switch (gSaveBlock2Ptr->frontier.challengeStatus)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
break;
|
2019-11-24 22:58:40 +01:00
|
|
|
case CHALLENGE_STATUS_SAVING:
|
2019-09-13 23:03:43 +02:00
|
|
|
FrontierGamblerSetWonOrLost(FALSE);
|
2019-11-24 22:58:40 +01:00
|
|
|
VarSet(VAR_TEMP_0, gSaveBlock2Ptr->frontier.challengeStatus);
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
2019-11-24 22:58:40 +01:00
|
|
|
case CHALLENGE_STATUS_LOST:
|
2019-09-13 23:03:43 +02:00
|
|
|
FrontierGamblerSetWonOrLost(FALSE);
|
2019-11-24 22:58:40 +01:00
|
|
|
VarSet(VAR_TEMP_0, gSaveBlock2Ptr->frontier.challengeStatus);
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
2019-11-24 22:58:40 +01:00
|
|
|
case CHALLENGE_STATUS_WON:
|
2019-09-13 23:03:43 +02:00
|
|
|
FrontierGamblerSetWonOrLost(TRUE);
|
2019-11-24 22:58:40 +01:00
|
|
|
VarSet(VAR_TEMP_0, gSaveBlock2Ptr->frontier.challengeStatus);
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
2019-11-24 22:58:40 +01:00
|
|
|
case CHALLENGE_STATUS_PAUSED:
|
|
|
|
VarSet(VAR_TEMP_0, gSaveBlock2Ptr->frontier.challengeStatus);
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
static void GetFrontierData(void)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
|
|
|
u8 facility = VarGet(VAR_FRONTIER_FACILITY);
|
2019-11-21 03:46:29 +01:00
|
|
|
u8 hasSymbol = GetPlayerSymbolCountForFacility(facility);
|
|
|
|
if (hasSymbol == 2)
|
|
|
|
hasSymbol = 1;
|
2018-10-27 15:44:29 +02:00
|
|
|
|
|
|
|
switch (gSpecialVar_0x8005)
|
|
|
|
{
|
2019-11-24 22:58:40 +01:00
|
|
|
case FRONTIER_DATA_CHALLENGE_STATUS:
|
|
|
|
gSpecialVar_Result = gSaveBlock2Ptr->frontier.challengeStatus;
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
2019-11-24 22:58:40 +01:00
|
|
|
case FRONTIER_DATA_LVL_MODE:
|
2018-10-27 15:44:29 +02:00
|
|
|
gSpecialVar_Result = gSaveBlock2Ptr->frontier.lvlMode;
|
|
|
|
break;
|
2019-11-24 22:58:40 +01:00
|
|
|
case FRONTIER_DATA_BATTLE_NUM:
|
2018-10-27 15:44:29 +02:00
|
|
|
gSpecialVar_Result = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
|
|
|
|
break;
|
2019-11-24 22:58:40 +01:00
|
|
|
case FRONTIER_DATA_PAUSED:
|
|
|
|
gSpecialVar_Result = gSaveBlock2Ptr->frontier.challengePaused;
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
2019-11-24 22:58:40 +01:00
|
|
|
case FRONTIER_DATA_BATTLE_OUTCOME:
|
2018-10-27 15:44:29 +02:00
|
|
|
gSpecialVar_Result = gBattleOutcome;
|
|
|
|
gBattleOutcome = 0;
|
|
|
|
break;
|
2020-01-08 11:43:06 +01:00
|
|
|
case FRONTIER_DATA_RECORD_DISABLED:
|
|
|
|
gSpecialVar_Result = gSaveBlock2Ptr->frontier.disableRecordBattle;
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
2019-11-24 22:58:40 +01:00
|
|
|
case FRONTIER_DATA_HEARD_BRAIN_SPEECH:
|
|
|
|
gSpecialVar_Result = gSaveBlock2Ptr->frontier.battledBrainFlags & sBattledBrainBitFlags[facility][hasSymbol];
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
static void SetFrontierData(void)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
|
|
|
s32 i;
|
|
|
|
u8 facility = VarGet(VAR_FRONTIER_FACILITY);
|
2019-11-21 03:46:29 +01:00
|
|
|
u8 hasSymbol = GetPlayerSymbolCountForFacility(facility);
|
|
|
|
if (hasSymbol == 2)
|
|
|
|
hasSymbol = 1;
|
2018-10-27 15:44:29 +02:00
|
|
|
|
|
|
|
switch (gSpecialVar_0x8005)
|
|
|
|
{
|
2019-11-24 22:58:40 +01:00
|
|
|
case FRONTIER_DATA_CHALLENGE_STATUS:
|
|
|
|
gSaveBlock2Ptr->frontier.challengeStatus = gSpecialVar_0x8006;
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
2019-11-24 22:58:40 +01:00
|
|
|
case FRONTIER_DATA_LVL_MODE:
|
2018-10-27 15:44:29 +02:00
|
|
|
gSaveBlock2Ptr->frontier.lvlMode = gSpecialVar_0x8006;
|
|
|
|
break;
|
2019-11-24 22:58:40 +01:00
|
|
|
case FRONTIER_DATA_BATTLE_NUM:
|
2018-10-27 15:44:29 +02:00
|
|
|
gSaveBlock2Ptr->frontier.curChallengeBattleNum = gSpecialVar_0x8006;
|
|
|
|
break;
|
2019-11-24 22:58:40 +01:00
|
|
|
case FRONTIER_DATA_PAUSED:
|
|
|
|
gSaveBlock2Ptr->frontier.challengePaused = gSpecialVar_0x8006;
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
2019-11-24 22:58:40 +01:00
|
|
|
case FRONTIER_DATA_SELECTED_MON_ORDER:
|
|
|
|
for (i = 0; i < MAX_FRONTIER_PARTY_SIZE; i++)
|
2018-11-25 22:50:54 +01:00
|
|
|
gSaveBlock2Ptr->frontier.selectedPartyMons[i] = gSelectedOrderFromParty[i];
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
2020-01-08 11:43:06 +01:00
|
|
|
case FRONTIER_DATA_RECORD_DISABLED:
|
|
|
|
gSaveBlock2Ptr->frontier.disableRecordBattle = gSpecialVar_0x8006;
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
2019-11-24 22:58:40 +01:00
|
|
|
case FRONTIER_DATA_HEARD_BRAIN_SPEECH:
|
|
|
|
gSaveBlock2Ptr->frontier.battledBrainFlags |= sBattledBrainBitFlags[facility][hasSymbol];
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
static void SetSelectedPartyOrder(void)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
|
|
|
s32 i;
|
|
|
|
|
2019-10-18 01:22:03 +02:00
|
|
|
ClearSelectedPartyOrder();
|
2018-10-27 15:44:29 +02:00
|
|
|
for (i = 0; i < gSpecialVar_0x8005; i++)
|
2018-11-25 22:50:54 +01:00
|
|
|
gSelectedOrderFromParty[i] = gSaveBlock2Ptr->frontier.selectedPartyMons[i];
|
|
|
|
ReducePlayerPartyToSelectedMons();
|
2018-10-27 15:44:29 +02:00
|
|
|
}
|
|
|
|
|
2018-11-01 21:31:10 +01:00
|
|
|
static void DoSoftReset_(void)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
|
|
|
DoSoftReset();
|
|
|
|
}
|
|
|
|
|
2019-11-10 02:40:25 +01:00
|
|
|
static void SetFrontierTrainers(void)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
|
|
|
gFacilityTrainers = gBattleFrontierTrainers;
|
|
|
|
}
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
static void SaveSelectedParty(void)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
for (i = 0; i < MAX_FRONTIER_PARTY_SIZE; i++)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
|
|
|
u16 monId = gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1;
|
|
|
|
if (monId < PARTY_SIZE)
|
|
|
|
gSaveBlock1Ptr->playerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1] = gPlayerParty[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-01 21:31:10 +01:00
|
|
|
static void ShowFacilityResultsWindow(void)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
2019-11-21 03:46:29 +01:00
|
|
|
if (gSpecialVar_0x8006 >= FRONTIER_MODE_COUNT)
|
2018-10-27 15:44:29 +02:00
|
|
|
gSpecialVar_0x8006 = 0;
|
|
|
|
switch (gSpecialVar_0x8005)
|
|
|
|
{
|
2018-10-27 21:01:35 +02:00
|
|
|
case FRONTIER_FACILITY_TOWER:
|
2018-10-27 17:39:05 +02:00
|
|
|
ShowTowerResultsWindow(gSpecialVar_0x8006);
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
2018-10-27 21:01:35 +02:00
|
|
|
case FRONTIER_FACILITY_DOME:
|
2018-10-27 17:39:05 +02:00
|
|
|
ShowDomeResultsWindow(gSpecialVar_0x8006);
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
2018-10-27 21:01:35 +02:00
|
|
|
case FRONTIER_FACILITY_PALACE:
|
2018-10-27 17:39:05 +02:00
|
|
|
ShowPalaceResultsWindow(gSpecialVar_0x8006);
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
2018-10-27 21:01:35 +02:00
|
|
|
case FRONTIER_FACILITY_PIKE:
|
2018-10-27 17:39:05 +02:00
|
|
|
ShowPikeResultsWindow();
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
2018-10-27 21:01:35 +02:00
|
|
|
case FRONTIER_FACILITY_FACTORY:
|
|
|
|
ShowFactoryResultsWindow(gSpecialVar_0x8006);
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
2018-10-27 21:01:35 +02:00
|
|
|
case FRONTIER_FACILITY_ARENA:
|
2018-10-27 17:39:05 +02:00
|
|
|
ShowArenaResultsWindow();
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
2018-10-27 21:01:35 +02:00
|
|
|
case FRONTIER_FACILITY_PYRAMID:
|
|
|
|
ShowPyramidResultsWindow();
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
2019-11-21 03:46:29 +01:00
|
|
|
case FACILITY_LINK_CONTEST:
|
2018-10-27 21:01:35 +02:00
|
|
|
ShowLinkContestResultsWindow();
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
static bool8 IsWinStreakActive(u32 challenge)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
2019-11-24 22:58:40 +01:00
|
|
|
if (gSaveBlock2Ptr->frontier.winStreakActiveFlags & challenge)
|
2018-10-27 15:44:29 +02:00
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2018-11-01 21:31:10 +01:00
|
|
|
static void PrintAligned(const u8 *str, s32 y)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
2018-11-05 22:13:59 +01:00
|
|
|
s32 x = GetStringCenterAlignXOffset(1, str, 224);
|
2018-10-27 15:44:29 +02:00
|
|
|
y = (y * 8) + 1;
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x, y, TEXT_SPEED_FF, NULL);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void PrintHyphens(s32 y)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
|
|
|
s32 i;
|
|
|
|
u8 text[37];
|
|
|
|
|
|
|
|
for (i = 0; i < 36; i++)
|
|
|
|
text[i] = CHAR_HYPHEN;
|
|
|
|
text[i] = EOS;
|
|
|
|
|
|
|
|
y = (y * 8) + 1;
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, text, 4, y, TEXT_SPEED_FF, NULL);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
// Battle Tower records.
|
|
|
|
static void TowerPrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL);
|
2019-11-24 22:58:40 +01:00
|
|
|
if (num > MAX_STREAK)
|
|
|
|
num = MAX_STREAK;
|
2018-10-27 15:44:29 +02:00
|
|
|
ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4);
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_WinStreak);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void TowerPrintRecordStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
2018-10-27 17:39:05 +02:00
|
|
|
u16 num = gSaveBlock2Ptr->frontier.towerRecordWinStreaks[battleMode][lvlMode];
|
2018-10-27 15:44:29 +02:00
|
|
|
TowerPrintStreak(gText_Record, num, x1, x2, y);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static u16 TowerGetWinStreak(u8 battleMode, u8 lvlMode)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
2018-10-27 17:39:05 +02:00
|
|
|
u16 winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode];
|
2019-11-24 22:58:40 +01:00
|
|
|
if (winStreak > MAX_STREAK)
|
|
|
|
return MAX_STREAK;
|
2018-10-27 15:44:29 +02:00
|
|
|
else
|
|
|
|
return winStreak;
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void TowerPrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
|
|
|
bool8 isCurrent;
|
2018-10-27 17:39:05 +02:00
|
|
|
u16 winStreak = TowerGetWinStreak(battleMode, lvlMode);
|
2018-10-27 15:44:29 +02:00
|
|
|
switch (battleMode)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case FRONTIER_MODE_SINGLES:
|
|
|
|
if (lvlMode != FRONTIER_LVL_50)
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_TOWER_SINGLES_OPEN);
|
2018-10-27 15:44:29 +02:00
|
|
|
else
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_TOWER_SINGLES_50);
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
|
|
|
case FRONTIER_MODE_DOUBLES:
|
|
|
|
if (lvlMode != FRONTIER_LVL_50)
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_TOWER_DOUBLES_OPEN);
|
2018-10-27 15:44:29 +02:00
|
|
|
else
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_TOWER_DOUBLES_50);
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
|
|
|
case FRONTIER_MODE_MULTIS:
|
|
|
|
if (lvlMode != FRONTIER_LVL_50)
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_TOWER_MULTIS_OPEN);
|
2018-10-27 15:44:29 +02:00
|
|
|
else
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_TOWER_MULTIS_50);
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
|
|
|
case FRONTIER_MODE_LINK_MULTIS:
|
|
|
|
if (lvlMode != FRONTIER_LVL_50)
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_TOWER_LINK_MULTIS_OPEN);
|
2018-10-27 15:44:29 +02:00
|
|
|
else
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_TOWER_LINK_MULTIS_50);
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isCurrent == TRUE)
|
|
|
|
TowerPrintStreak(gText_Current, winStreak, x1, x2, y);
|
|
|
|
else
|
|
|
|
TowerPrintStreak(gText_Prev, winStreak, x1, x2, y);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void ShowTowerResultsWindow(u8 battleMode)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
2019-11-24 22:58:40 +01:00
|
|
|
gRecordsWindowId = AddWindow(&sFrontierResultsWindowTemplate);
|
2019-02-22 07:40:11 +01:00
|
|
|
DrawStdWindowFrame(gRecordsWindowId, FALSE);
|
2019-03-02 23:25:39 +01:00
|
|
|
FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
|
2018-10-27 15:44:29 +02:00
|
|
|
if (battleMode == FRONTIER_MODE_SINGLES)
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_SingleBattleRoomResults);
|
|
|
|
else if (battleMode == FRONTIER_MODE_DOUBLES)
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_DoubleBattleRoomResults);
|
|
|
|
else if (battleMode == FRONTIER_MODE_MULTIS)
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_MultiBattleRoomResults);
|
|
|
|
else
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_LinkMultiBattleRoomResults);
|
|
|
|
|
2018-11-01 21:31:10 +01:00
|
|
|
PrintAligned(gStringVar4, 2);
|
2018-10-27 15:44:29 +02:00
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 16, 49, TEXT_SPEED_FF, NULL);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 16, 97, TEXT_SPEED_FF, NULL);
|
|
|
|
PrintHyphens(10);
|
|
|
|
TowerPrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_50, 72, 132, 49);
|
|
|
|
TowerPrintRecordStreak(battleMode, FRONTIER_LVL_50, 72, 132, 65);
|
|
|
|
TowerPrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_OPEN, 72, 132, 97);
|
|
|
|
TowerPrintRecordStreak(battleMode, FRONTIER_LVL_OPEN, 72, 132, 113);
|
|
|
|
PutWindowTilemap(gRecordsWindowId);
|
|
|
|
CopyWindowToVram(gRecordsWindowId, 3);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
// Battle Dome records.
|
|
|
|
static u16 DomeGetWinStreak(u8 battleMode, u8 lvlMode)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
2018-10-27 17:39:05 +02:00
|
|
|
u16 winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode];
|
2019-11-24 22:58:40 +01:00
|
|
|
if (winStreak > MAX_STREAK)
|
|
|
|
return MAX_STREAK;
|
2018-10-27 15:44:29 +02:00
|
|
|
else
|
|
|
|
return winStreak;
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void PrintTwoStrings(const u8 *str1, const u8 *str2, u16 num, u8 x1, u8 x2, u8 y)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, str1, x1, y, TEXT_SPEED_FF, NULL);
|
|
|
|
ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4);
|
|
|
|
StringExpandPlaceholders(gStringVar4, str2);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void DomePrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y)
|
2018-10-27 15:44:29 +02:00
|
|
|
{
|
|
|
|
bool8 isCurrent;
|
2018-10-27 17:39:05 +02:00
|
|
|
u16 winStreak = DomeGetWinStreak(battleMode, lvlMode);
|
2018-10-27 15:44:29 +02:00
|
|
|
switch (battleMode)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case FRONTIER_MODE_SINGLES:
|
|
|
|
if (lvlMode != FRONTIER_LVL_50)
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_DOME_SINGLES_OPEN);
|
2018-10-27 15:44:29 +02:00
|
|
|
else
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_DOME_SINGLES_50);
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
|
|
|
case FRONTIER_MODE_DOUBLES:
|
|
|
|
if (lvlMode != FRONTIER_LVL_50)
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_DOME_DOUBLES_OPEN);
|
2018-10-27 15:44:29 +02:00
|
|
|
else
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_DOME_DOUBLES_50);
|
2018-10-27 15:44:29 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isCurrent == TRUE)
|
2018-10-27 17:39:05 +02:00
|
|
|
PrintTwoStrings(gText_Current, gText_ClearStreak, winStreak, x1, x2, y);
|
|
|
|
else
|
|
|
|
PrintTwoStrings(gText_Prev, gText_ClearStreak, winStreak, x1, x2, y);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void ShowDomeResultsWindow(u8 battleMode)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
2019-11-24 22:58:40 +01:00
|
|
|
gRecordsWindowId = AddWindow(&sFrontierResultsWindowTemplate);
|
2019-02-22 07:40:11 +01:00
|
|
|
DrawStdWindowFrame(gRecordsWindowId, FALSE);
|
2019-03-02 23:25:39 +01:00
|
|
|
FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
|
2018-10-27 17:39:05 +02:00
|
|
|
if (battleMode == FRONTIER_MODE_SINGLES)
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_SingleBattleTourneyResults);
|
|
|
|
else
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_DoubleBattleTourneyResults);
|
|
|
|
|
2018-11-01 21:31:10 +01:00
|
|
|
PrintAligned(gStringVar4, 0);
|
2018-10-27 17:39:05 +02:00
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 8, 33, TEXT_SPEED_FF, NULL);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL);
|
|
|
|
PrintHyphens(10);
|
|
|
|
DomePrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_50, 64, 121, 33);
|
|
|
|
PrintTwoStrings(gText_Record, gText_ClearStreak, gSaveBlock2Ptr->frontier.domeRecordWinStreaks[battleMode][FRONTIER_LVL_50], 64, 121, 49);
|
|
|
|
PrintTwoStrings(gText_Total, gText_Championships, gSaveBlock2Ptr->frontier.domeTotalChampionships[battleMode][FRONTIER_LVL_50], 64, 112, 65);
|
|
|
|
DomePrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_OPEN, 64, 121, 97);
|
|
|
|
PrintTwoStrings(gText_Record, gText_ClearStreak, gSaveBlock2Ptr->frontier.domeRecordWinStreaks[battleMode][FRONTIER_LVL_OPEN], 64, 121, 113);
|
|
|
|
PrintTwoStrings(gText_Total, gText_Championships, gSaveBlock2Ptr->frontier.domeTotalChampionships[battleMode][FRONTIER_LVL_OPEN], 64, 112, 129);
|
|
|
|
PutWindowTilemap(gRecordsWindowId);
|
|
|
|
CopyWindowToVram(gRecordsWindowId, 3);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
// Battle Palace records.
|
|
|
|
static void PalacePrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL);
|
2019-11-24 22:58:40 +01:00
|
|
|
if (num > MAX_STREAK)
|
|
|
|
num = MAX_STREAK;
|
2018-10-27 17:39:05 +02:00
|
|
|
ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4);
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_WinStreak);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void PalacePrintRecordStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
|
|
|
u16 num = gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[battleMode][lvlMode];
|
|
|
|
PalacePrintStreak(gText_Record, num, x1, x2, y);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static u16 PalaceGetWinStreak(u8 battleMode, u8 lvlMode)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
|
|
|
u16 winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode];
|
2019-11-24 22:58:40 +01:00
|
|
|
if (winStreak > MAX_STREAK)
|
|
|
|
return MAX_STREAK;
|
2018-10-27 17:39:05 +02:00
|
|
|
else
|
|
|
|
return winStreak;
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void PalacePrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
|
|
|
bool8 isCurrent;
|
|
|
|
u16 winStreak = PalaceGetWinStreak(battleMode, lvlMode);
|
|
|
|
switch (battleMode)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case FRONTIER_MODE_SINGLES:
|
|
|
|
if (lvlMode != FRONTIER_LVL_50)
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_PALACE_SINGLES_OPEN);
|
2018-10-27 17:39:05 +02:00
|
|
|
else
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_PALACE_SINGLES_50);
|
2018-10-27 17:39:05 +02:00
|
|
|
break;
|
|
|
|
case FRONTIER_MODE_DOUBLES:
|
|
|
|
if (lvlMode != FRONTIER_LVL_50)
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_PALACE_DOUBLES_OPEN);
|
2018-10-27 17:39:05 +02:00
|
|
|
else
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_PALACE_DOUBLES_50);
|
2018-10-27 17:39:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isCurrent == TRUE)
|
|
|
|
PalacePrintStreak(gText_Current, winStreak, x1, x2, y);
|
2018-10-27 15:44:29 +02:00
|
|
|
else
|
2018-10-27 17:39:05 +02:00
|
|
|
PalacePrintStreak(gText_Prev, winStreak, x1, x2, y);
|
2018-10-27 15:44:29 +02:00
|
|
|
}
|
2018-10-27 17:39:05 +02:00
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void ShowPalaceResultsWindow(u8 battleMode)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
2019-11-24 22:58:40 +01:00
|
|
|
gRecordsWindowId = AddWindow(&sFrontierResultsWindowTemplate);
|
2019-02-22 07:40:11 +01:00
|
|
|
DrawStdWindowFrame(gRecordsWindowId, FALSE);
|
2019-03-02 23:25:39 +01:00
|
|
|
FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
|
2018-10-27 17:39:05 +02:00
|
|
|
if (battleMode == FRONTIER_MODE_SINGLES)
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_SingleBattleHallResults);
|
|
|
|
else
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_DoubleBattleHallResults);
|
|
|
|
|
2018-11-01 21:31:10 +01:00
|
|
|
PrintAligned(gStringVar4, 2);
|
2018-10-27 17:39:05 +02:00
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 16, 49, TEXT_SPEED_FF, NULL);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 16, 97, TEXT_SPEED_FF, NULL);
|
|
|
|
PrintHyphens(10);
|
|
|
|
PalacePrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_50, 72, 131, 49);
|
|
|
|
PalacePrintRecordStreak(battleMode, FRONTIER_LVL_50, 72, 131, 65);
|
|
|
|
PalacePrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_OPEN, 72, 131, 97);
|
|
|
|
PalacePrintRecordStreak(battleMode, FRONTIER_LVL_OPEN, 72, 131, 113);
|
|
|
|
PutWindowTilemap(gRecordsWindowId);
|
|
|
|
CopyWindowToVram(gRecordsWindowId, 3);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
// Battle Pike records.
|
|
|
|
static u16 PikeGetWinStreak(u8 lvlMode)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
|
|
|
u16 winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode];
|
2019-11-24 22:58:40 +01:00
|
|
|
if (winStreak > MAX_STREAK)
|
|
|
|
return MAX_STREAK;
|
2018-10-27 17:39:05 +02:00
|
|
|
else
|
|
|
|
return winStreak;
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void PikePrintCleared(const u8 *str1, const u8 *str2, u16 num, u8 x1, u8 x2, u8 y)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, str1, x1, y, TEXT_SPEED_FF, NULL);
|
|
|
|
ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4);
|
|
|
|
StringExpandPlaceholders(gStringVar4, str2);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void PikePrintPrevOrCurrentStreak(u8 lvlMode, u8 x1, u8 x2, u8 y)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
|
|
|
bool8 isCurrent;
|
|
|
|
u16 winStreak = PikeGetWinStreak(lvlMode);
|
|
|
|
|
|
|
|
if (lvlMode != FRONTIER_LVL_50)
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_PIKE_OPEN);
|
2018-10-27 17:39:05 +02:00
|
|
|
else
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_PIKE_50);
|
2018-10-27 17:39:05 +02:00
|
|
|
|
|
|
|
if (isCurrent == TRUE)
|
|
|
|
PrintTwoStrings(gText_Current, gText_RoomsCleared, winStreak, x1, x2, y);
|
|
|
|
else
|
|
|
|
PrintTwoStrings(gText_Prev, gText_RoomsCleared, winStreak, x1, x2, y);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void ShowPikeResultsWindow(void)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
2019-11-24 22:58:40 +01:00
|
|
|
gRecordsWindowId = AddWindow(&sFrontierResultsWindowTemplate);
|
2019-02-22 07:40:11 +01:00
|
|
|
DrawStdWindowFrame(gRecordsWindowId, FALSE);
|
2019-03-02 23:25:39 +01:00
|
|
|
FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
|
2018-10-27 17:39:05 +02:00
|
|
|
StringExpandPlaceholders(gStringVar4, gText_BattleChoiceResults);
|
2018-11-01 21:31:10 +01:00
|
|
|
PrintAligned(gStringVar4, 0);
|
2018-10-27 17:39:05 +02:00
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 8, 33, TEXT_SPEED_FF, NULL);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL);
|
|
|
|
PrintHyphens(10);
|
|
|
|
PikePrintPrevOrCurrentStreak(FRONTIER_LVL_50, 64, 114, 33);
|
|
|
|
PikePrintCleared(gText_Record, gText_RoomsCleared, gSaveBlock2Ptr->frontier.pikeRecordStreaks[FRONTIER_LVL_50], 64, 114, 49);
|
|
|
|
PikePrintCleared(gText_Total, gText_TimesCleared, gSaveBlock2Ptr->frontier.pikeTotalStreaks[FRONTIER_LVL_50], 64, 114, 65);
|
|
|
|
PikePrintPrevOrCurrentStreak(FRONTIER_LVL_OPEN, 64, 114, 97);
|
|
|
|
PikePrintCleared(gText_Record, gText_RoomsCleared, gSaveBlock2Ptr->frontier.pikeRecordStreaks[FRONTIER_LVL_OPEN], 64, 114, 113);
|
|
|
|
PikePrintCleared(gText_Total, gText_TimesCleared, gSaveBlock2Ptr->frontier.pikeTotalStreaks[FRONTIER_LVL_OPEN], 64, 114, 129);
|
|
|
|
PutWindowTilemap(gRecordsWindowId);
|
|
|
|
CopyWindowToVram(gRecordsWindowId, 3);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
// Battle Arena records.
|
|
|
|
static void ArenaPrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL);
|
2019-11-24 22:58:40 +01:00
|
|
|
if (num > MAX_STREAK)
|
|
|
|
num = MAX_STREAK;
|
2018-10-27 17:39:05 +02:00
|
|
|
ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4);
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_KOsInARow);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void ArenaPrintRecordStreak(u8 lvlMode, u8 x1, u8 x2, u8 y)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
|
|
|
u16 num = gSaveBlock2Ptr->frontier.arenaRecordStreaks[lvlMode];
|
|
|
|
ArenaPrintStreak(gText_Record, num, x1, x2, y);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static u16 ArenaGetWinStreak(u8 lvlMode)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
|
|
|
u16 winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode];
|
2019-11-24 22:58:40 +01:00
|
|
|
if (winStreak > MAX_STREAK)
|
|
|
|
return MAX_STREAK;
|
2018-10-27 17:39:05 +02:00
|
|
|
else
|
|
|
|
return winStreak;
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void ArenaPrintPrevOrCurrentStreak(u8 lvlMode, u8 x1, u8 x2, u8 y)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
|
|
|
bool8 isCurrent;
|
|
|
|
u16 winStreak = ArenaGetWinStreak(lvlMode);
|
|
|
|
|
|
|
|
if (lvlMode != FRONTIER_LVL_50)
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_ARENA_OPEN);
|
2018-10-27 17:39:05 +02:00
|
|
|
else
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_ARENA_50);
|
2018-10-27 17:39:05 +02:00
|
|
|
|
|
|
|
if (isCurrent == TRUE)
|
|
|
|
ArenaPrintStreak(gText_Current, winStreak, x1, x2, y);
|
|
|
|
else
|
|
|
|
ArenaPrintStreak(gText_Prev, winStreak, x1, x2, y);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void ShowArenaResultsWindow(void)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
2019-11-24 22:58:40 +01:00
|
|
|
gRecordsWindowId = AddWindow(&sFrontierResultsWindowTemplate);
|
2019-02-22 07:40:11 +01:00
|
|
|
DrawStdWindowFrame(gRecordsWindowId, FALSE);
|
2019-03-02 23:25:39 +01:00
|
|
|
FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
|
2018-10-27 17:39:05 +02:00
|
|
|
PrintHyphens(10);
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_SetKOTourneyResults);
|
2018-11-01 21:31:10 +01:00
|
|
|
PrintAligned(gStringVar4, 2);
|
2018-10-27 17:39:05 +02:00
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 16, 49, TEXT_SPEED_FF, NULL);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 16, 97, TEXT_SPEED_FF, NULL);
|
|
|
|
ArenaPrintPrevOrCurrentStreak(FRONTIER_LVL_50, 72, 126, 49);
|
|
|
|
ArenaPrintRecordStreak(FRONTIER_LVL_50, 72, 126, 65);
|
|
|
|
ArenaPrintPrevOrCurrentStreak(FRONTIER_LVL_OPEN, 72, 126, 97);
|
|
|
|
ArenaPrintRecordStreak(FRONTIER_LVL_OPEN, 72, 126, 113);
|
|
|
|
PutWindowTilemap(gRecordsWindowId);
|
|
|
|
CopyWindowToVram(gRecordsWindowId, 3);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
// Battle Factory records.
|
|
|
|
static void FactoryPrintStreak(const u8 *str, u16 num1, u16 num2, u8 x1, u8 x2, u8 x3, u8 y)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL);
|
2019-11-24 22:58:40 +01:00
|
|
|
if (num1 > MAX_STREAK)
|
|
|
|
num1 = MAX_STREAK;
|
2018-10-27 17:39:05 +02:00
|
|
|
ConvertIntToDecimalStringN(gStringVar1, num1, STR_CONV_MODE_RIGHT_ALIGN, 4);
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_WinStreak);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL);
|
|
|
|
|
|
|
|
ConvertIntToDecimalStringN(gStringVar1, num2, STR_CONV_MODE_RIGHT_ALIGN, 4);
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_TimesVar1);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x3, y, TEXT_SPEED_FF, NULL);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void FactoryPrintRecordStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 x3, u8 y)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
2018-10-27 21:01:35 +02:00
|
|
|
u16 num1 = gSaveBlock2Ptr->frontier.factoryRecordWinStreaks[battleMode][lvlMode];
|
|
|
|
u16 num2 = gSaveBlock2Ptr->frontier.factoryRecordRentsCount[battleMode][lvlMode];
|
|
|
|
FactoryPrintStreak(gText_Record, num1, num2, x1, x2, x3, y);
|
2018-10-27 17:39:05 +02:00
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static u16 FactoryGetWinStreak(u8 battleMode, u8 lvlMode)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
2018-10-27 21:01:35 +02:00
|
|
|
u16 winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode];
|
2019-11-24 22:58:40 +01:00
|
|
|
if (winStreak > MAX_STREAK)
|
|
|
|
return MAX_STREAK;
|
2018-10-27 17:39:05 +02:00
|
|
|
else
|
|
|
|
return winStreak;
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static u16 FactoryGetRentsCount(u8 battleMode, u8 lvlMode)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
2018-10-27 21:01:35 +02:00
|
|
|
u16 rents = gSaveBlock2Ptr->frontier.factoryRentsCount[battleMode][lvlMode];
|
2019-11-24 22:58:40 +01:00
|
|
|
if (rents > MAX_STREAK)
|
|
|
|
return MAX_STREAK;
|
2018-10-27 17:39:05 +02:00
|
|
|
else
|
|
|
|
return rents;
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void FactoryPrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 x3, u8 y)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
|
|
|
bool8 isCurrent;
|
2018-10-27 21:01:35 +02:00
|
|
|
u16 winStreak = FactoryGetWinStreak(battleMode, lvlMode);
|
|
|
|
u16 rents = FactoryGetRentsCount(battleMode, lvlMode);
|
2018-10-27 17:39:05 +02:00
|
|
|
switch (battleMode)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case FRONTIER_MODE_SINGLES:
|
|
|
|
if (lvlMode != FRONTIER_LVL_50)
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_FACTORY_SINGLES_OPEN);
|
2018-10-27 17:39:05 +02:00
|
|
|
else
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_FACTORY_SINGLES_50);
|
2018-10-27 17:39:05 +02:00
|
|
|
break;
|
|
|
|
case FRONTIER_MODE_DOUBLES:
|
|
|
|
if (lvlMode != FRONTIER_LVL_50)
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_FACTORY_DOUBLES_OPEN);
|
2018-10-27 17:39:05 +02:00
|
|
|
else
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_FACTORY_DOUBLES_50);
|
2018-10-27 17:39:05 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isCurrent == TRUE)
|
2018-10-27 21:01:35 +02:00
|
|
|
FactoryPrintStreak(gText_Current, winStreak, rents, x1, x2, x3, y);
|
2018-10-27 17:39:05 +02:00
|
|
|
else
|
2018-10-27 21:01:35 +02:00
|
|
|
FactoryPrintStreak(gText_Prev, winStreak, rents, x1, x2, x3, y);
|
2018-10-27 17:39:05 +02:00
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void ShowFactoryResultsWindow(u8 battleMode)
|
2018-10-27 17:39:05 +02:00
|
|
|
{
|
2019-11-24 22:58:40 +01:00
|
|
|
gRecordsWindowId = AddWindow(&sFrontierResultsWindowTemplate);
|
2019-02-22 07:40:11 +01:00
|
|
|
DrawStdWindowFrame(gRecordsWindowId, FALSE);
|
2019-03-02 23:25:39 +01:00
|
|
|
FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
|
2018-10-27 17:39:05 +02:00
|
|
|
if (battleMode == FRONTIER_MODE_SINGLES)
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_BattleSwapSingleResults);
|
|
|
|
else
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_BattleSwapDoubleResults);
|
|
|
|
|
2018-11-01 21:31:10 +01:00
|
|
|
PrintAligned(gStringVar4, 0);
|
2018-10-27 17:39:05 +02:00
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 8, 33, TEXT_SPEED_FF, NULL);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_RentalSwap, 152, 33, TEXT_SPEED_FF, NULL);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL);
|
|
|
|
PrintHyphens(10);
|
2018-10-27 21:01:35 +02:00
|
|
|
FactoryPrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_50, 8, 64, 158, 49);
|
|
|
|
FactoryPrintRecordStreak(battleMode, FRONTIER_LVL_50, 8, 64, 158, 65);
|
|
|
|
FactoryPrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_OPEN, 8, 64, 158, 113);
|
|
|
|
FactoryPrintRecordStreak(battleMode, FRONTIER_LVL_OPEN, 8, 64, 158, 129);
|
|
|
|
PutWindowTilemap(gRecordsWindowId);
|
|
|
|
CopyWindowToVram(gRecordsWindowId, 3);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
// Battle Pyramid records.
|
|
|
|
static void PyramidPrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y)
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL);
|
2019-11-24 22:58:40 +01:00
|
|
|
if (num > MAX_STREAK)
|
|
|
|
num = MAX_STREAK;
|
2018-10-27 21:01:35 +02:00
|
|
|
ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4);
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_FloorsCleared);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void PyramidPrintRecordStreak(u8 lvlMode, u8 x1, u8 x2, u8 y)
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
|
|
|
u16 num = gSaveBlock2Ptr->frontier.pyramidRecordStreaks[lvlMode];
|
|
|
|
PyramidPrintStreak(gText_Record, num, x1, x2, y);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static u16 PyramidGetWinStreak(u8 lvlMode)
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
|
|
|
u16 winStreak = gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode];
|
2019-11-24 22:58:40 +01:00
|
|
|
if (winStreak > MAX_STREAK)
|
|
|
|
return MAX_STREAK;
|
2018-10-27 21:01:35 +02:00
|
|
|
else
|
|
|
|
return winStreak;
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void PyramidPrintPrevOrCurrentStreak(u8 lvlMode, u8 x1, u8 x2, u8 y)
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
|
|
|
bool8 isCurrent;
|
|
|
|
u16 winStreak = PyramidGetWinStreak(lvlMode);
|
|
|
|
|
|
|
|
if (lvlMode != FRONTIER_LVL_50)
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_PYRAMID_OPEN);
|
2018-10-27 21:01:35 +02:00
|
|
|
else
|
2019-11-24 22:58:40 +01:00
|
|
|
isCurrent = IsWinStreakActive(STREAK_PYRAMID_50);
|
2018-10-27 21:01:35 +02:00
|
|
|
|
|
|
|
if (isCurrent == TRUE)
|
|
|
|
PyramidPrintStreak(gText_Current, winStreak, x1, x2, y);
|
|
|
|
else
|
|
|
|
PyramidPrintStreak(gText_Prev, winStreak, x1, x2, y);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void ShowPyramidResultsWindow(void)
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
2019-11-24 22:58:40 +01:00
|
|
|
gRecordsWindowId = AddWindow(&sFrontierResultsWindowTemplate);
|
2019-02-22 07:40:11 +01:00
|
|
|
DrawStdWindowFrame(gRecordsWindowId, FALSE);
|
2019-03-02 23:25:39 +01:00
|
|
|
FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
|
2018-10-27 21:01:35 +02:00
|
|
|
StringExpandPlaceholders(gStringVar4, gText_BattleQuestResults);
|
2018-11-01 21:31:10 +01:00
|
|
|
PrintAligned(gStringVar4, 2);
|
2018-10-27 21:01:35 +02:00
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 8, 49, TEXT_SPEED_FF, NULL);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL);
|
|
|
|
PrintHyphens(10);
|
|
|
|
PyramidPrintPrevOrCurrentStreak(FRONTIER_LVL_50, 64, 111, 49);
|
|
|
|
PyramidPrintRecordStreak(FRONTIER_LVL_50, 64, 111, 65);
|
|
|
|
PyramidPrintPrevOrCurrentStreak(FRONTIER_LVL_OPEN, 64, 111, 97);
|
|
|
|
PyramidPrintRecordStreak(FRONTIER_LVL_OPEN, 64, 111, 113);
|
|
|
|
PutWindowTilemap(gRecordsWindowId);
|
|
|
|
CopyWindowToVram(gRecordsWindowId, 3);
|
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
// Link contest records. Why is it in this file?
|
|
|
|
static void ShowLinkContestResultsWindow(void)
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
|
|
|
const u8 *str;
|
|
|
|
s32 i, j;
|
|
|
|
s32 x;
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
gRecordsWindowId = AddWindow(&sLinkContestResultsWindowTemplate);
|
2019-02-22 07:40:11 +01:00
|
|
|
DrawStdWindowFrame(gRecordsWindowId, FALSE);
|
2019-03-02 23:25:39 +01:00
|
|
|
FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
|
2018-10-27 21:01:35 +02:00
|
|
|
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_LinkContestResults);
|
2018-11-05 22:13:59 +01:00
|
|
|
x = GetStringCenterAlignXOffset(1, gStringVar4, 208);
|
2018-10-27 21:01:35 +02:00
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x, 1, TEXT_SPEED_FF, NULL);
|
|
|
|
|
|
|
|
str = gText_1st;
|
2018-11-05 22:13:59 +01:00
|
|
|
x = GetStringRightAlignXOffset(1, str, 38) + 50;
|
2018-10-27 21:01:35 +02:00
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x, 25, TEXT_SPEED_FF, NULL);
|
|
|
|
|
|
|
|
str = gText_2nd;
|
2018-11-05 22:13:59 +01:00
|
|
|
x = GetStringRightAlignXOffset(1, str, 38) + 88;
|
2018-10-27 21:01:35 +02:00
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x, 25, TEXT_SPEED_FF, NULL);
|
|
|
|
|
|
|
|
str = gText_3rd;
|
2018-11-05 22:13:59 +01:00
|
|
|
x = GetStringRightAlignXOffset(1, str, 38) + 126;
|
2018-10-27 21:01:35 +02:00
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x, 25, TEXT_SPEED_FF, NULL);
|
|
|
|
|
|
|
|
str = gText_4th;
|
2018-11-05 22:13:59 +01:00
|
|
|
x = GetStringRightAlignXOffset(1, str, 38) + 164;
|
2018-10-27 21:01:35 +02:00
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x, 25, TEXT_SPEED_FF, NULL);
|
|
|
|
|
|
|
|
x = 6;
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Cool, x, 41, TEXT_SPEED_FF, NULL);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Beauty, x, 57, TEXT_SPEED_FF, NULL);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Cute, x, 73, TEXT_SPEED_FF, NULL);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Smart, x, 89, TEXT_SPEED_FF, NULL);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Tough, x, 105, TEXT_SPEED_FF, NULL);
|
|
|
|
|
2021-01-19 10:40:06 +01:00
|
|
|
for (i = 0; i < CONTEST_CATEGORIES_COUNT; i++)
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
2021-01-19 10:40:06 +01:00
|
|
|
for (j = 0; j < CONTESTANT_COUNT; j++)
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
|
|
|
ConvertIntToDecimalStringN(gStringVar4, gSaveBlock2Ptr->contestLinkResults[i][j], STR_CONV_MODE_RIGHT_ALIGN, 4);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, (j * 38) + 64, (i * 16) + 41, TEXT_SPEED_FF, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-27 17:39:05 +02:00
|
|
|
PutWindowTilemap(gRecordsWindowId);
|
|
|
|
CopyWindowToVram(gRecordsWindowId, 3);
|
|
|
|
}
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
static void CheckPutFrontierTVShowOnAir(void)
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
2019-02-15 09:40:57 +01:00
|
|
|
u8 name[32];
|
2018-10-27 21:01:35 +02:00
|
|
|
s32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
|
|
|
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
|
|
|
s32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
|
|
|
|
|
|
|
switch (facility)
|
|
|
|
{
|
|
|
|
case FRONTIER_FACILITY_TOWER:
|
|
|
|
if (gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] > gSaveBlock2Ptr->frontier.towerRecordWinStreaks[battleMode][lvlMode])
|
|
|
|
{
|
|
|
|
gSaveBlock2Ptr->frontier.towerRecordWinStreaks[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode];
|
|
|
|
if (battleMode == FRONTIER_MODE_LINK_MULTIS)
|
|
|
|
{
|
2019-02-15 09:40:57 +01:00
|
|
|
StringCopy(name, gLinkPlayers[gBattleScripting.multiplayerId ^ 1].name);
|
|
|
|
StripExtCtrlCodes(name);
|
2019-11-24 22:58:40 +01:00
|
|
|
StringCopy(gSaveBlock2Ptr->frontier.opponentNames[lvlMode], name);
|
|
|
|
SetTrainerId(gLinkPlayers[gBattleScripting.multiplayerId ^ 1].trainerId, gSaveBlock2Ptr->frontier.opponentTrainerIds[lvlMode]);
|
2018-10-27 21:01:35 +02:00
|
|
|
}
|
|
|
|
if (gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] > 1
|
2019-11-24 22:58:40 +01:00
|
|
|
&& ShouldAirFrontierTVShow())
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
|
|
|
switch (battleMode)
|
|
|
|
{
|
|
|
|
case FRONTIER_MODE_SINGLES:
|
2019-11-24 22:58:40 +01:00
|
|
|
TryPutFrontierTVShowOnAir(gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode], 1);
|
2018-10-27 21:01:35 +02:00
|
|
|
break;
|
|
|
|
case FRONTIER_MODE_DOUBLES:
|
2019-11-24 22:58:40 +01:00
|
|
|
TryPutFrontierTVShowOnAir(gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode], 2);
|
2018-10-27 21:01:35 +02:00
|
|
|
break;
|
|
|
|
case FRONTIER_MODE_MULTIS:
|
2019-11-24 22:58:40 +01:00
|
|
|
TryPutFrontierTVShowOnAir(gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode], 3);
|
2018-10-27 21:01:35 +02:00
|
|
|
break;
|
|
|
|
case FRONTIER_MODE_LINK_MULTIS:
|
2019-11-24 22:58:40 +01:00
|
|
|
TryPutFrontierTVShowOnAir(gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode], 4);
|
2018-10-27 21:01:35 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_DOME:
|
|
|
|
if (gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] > gSaveBlock2Ptr->frontier.domeRecordWinStreaks[battleMode][lvlMode])
|
|
|
|
{
|
|
|
|
gSaveBlock2Ptr->frontier.domeRecordWinStreaks[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode];
|
|
|
|
if (gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] > 1
|
2019-11-24 22:58:40 +01:00
|
|
|
&& ShouldAirFrontierTVShow())
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
|
|
|
if (battleMode == FRONTIER_MODE_SINGLES)
|
2019-11-24 22:58:40 +01:00
|
|
|
TryPutFrontierTVShowOnAir(gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode], 5);
|
2018-10-27 21:01:35 +02:00
|
|
|
else
|
2019-11-24 22:58:40 +01:00
|
|
|
TryPutFrontierTVShowOnAir(gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode], 6);
|
2018-10-27 21:01:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_PALACE:
|
|
|
|
if (gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] > gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[battleMode][lvlMode])
|
|
|
|
{
|
|
|
|
gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode];
|
|
|
|
if (gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] > 1
|
2019-11-24 22:58:40 +01:00
|
|
|
&& ShouldAirFrontierTVShow())
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
|
|
|
if (battleMode == FRONTIER_MODE_SINGLES)
|
2019-11-24 22:58:40 +01:00
|
|
|
TryPutFrontierTVShowOnAir(gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode], 11);
|
2018-10-27 21:01:35 +02:00
|
|
|
else
|
2019-11-24 22:58:40 +01:00
|
|
|
TryPutFrontierTVShowOnAir(gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode], 12);
|
2018-10-27 21:01:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_ARENA:
|
|
|
|
if (gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode] > gSaveBlock2Ptr->frontier.arenaRecordStreaks[lvlMode])
|
|
|
|
{
|
|
|
|
gSaveBlock2Ptr->frontier.arenaRecordStreaks[lvlMode] = gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode];
|
|
|
|
if (gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode] > 1
|
2019-11-24 22:58:40 +01:00
|
|
|
&& ShouldAirFrontierTVShow())
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
2019-11-24 22:58:40 +01:00
|
|
|
TryPutFrontierTVShowOnAir(gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode], 10);
|
2018-10-27 21:01:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_FACTORY:
|
|
|
|
if (gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] > gSaveBlock2Ptr->frontier.factoryRecordWinStreaks[battleMode][lvlMode])
|
|
|
|
{
|
|
|
|
gSaveBlock2Ptr->frontier.factoryRecordWinStreaks[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode];
|
|
|
|
gSaveBlock2Ptr->frontier.factoryRecordRentsCount[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.factoryRentsCount[battleMode][lvlMode];
|
|
|
|
if (gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] > 1
|
2019-11-24 22:58:40 +01:00
|
|
|
&& ShouldAirFrontierTVShow())
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
|
|
|
if (battleMode == FRONTIER_MODE_SINGLES)
|
2019-11-24 22:58:40 +01:00
|
|
|
TryPutFrontierTVShowOnAir(gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode], 7);
|
2018-10-27 21:01:35 +02:00
|
|
|
else
|
2019-11-24 22:58:40 +01:00
|
|
|
TryPutFrontierTVShowOnAir(gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode], 8);
|
2018-10-27 21:01:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_PIKE:
|
|
|
|
if (gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] > gSaveBlock2Ptr->frontier.pikeRecordStreaks[lvlMode])
|
|
|
|
{
|
|
|
|
gSaveBlock2Ptr->frontier.pikeRecordStreaks[lvlMode] = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode];
|
|
|
|
if (gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] > 1
|
2019-11-24 22:58:40 +01:00
|
|
|
&& ShouldAirFrontierTVShow())
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
2019-11-24 22:58:40 +01:00
|
|
|
TryPutFrontierTVShowOnAir(gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode], 9);
|
2018-10-27 21:01:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_PYRAMID:
|
|
|
|
if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] > gSaveBlock2Ptr->frontier.pyramidRecordStreaks[lvlMode])
|
|
|
|
{
|
|
|
|
gSaveBlock2Ptr->frontier.pyramidRecordStreaks[lvlMode] = gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode];
|
|
|
|
if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] > 1
|
2019-11-24 22:58:40 +01:00
|
|
|
&& ShouldAirFrontierTVShow())
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
2019-11-24 22:58:40 +01:00
|
|
|
TryPutFrontierTVShowOnAir(gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode], 13);
|
2018-10-27 21:01:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
static void Script_GetFrontierBrainStatus(void)
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
|
|
|
VarGet(VAR_FRONTIER_FACILITY); // Unused return value.
|
2019-11-21 03:46:29 +01:00
|
|
|
gSpecialVar_Result = GetFrontierBrainStatus();
|
2018-10-27 21:01:35 +02:00
|
|
|
}
|
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
u8 GetFrontierBrainStatus(void)
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
2019-11-21 03:46:29 +01:00
|
|
|
s32 status = FRONTIER_BRAIN_NOT_READY;
|
2018-10-27 21:01:35 +02:00
|
|
|
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
|
|
|
s32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
2019-11-21 03:46:29 +01:00
|
|
|
u16 winStreakNoModifier = GetCurrentFacilityWinStreak();
|
|
|
|
s32 winStreak = winStreakNoModifier + sFrontierBrainStreakAppearances[facility][3];
|
2018-10-27 21:01:35 +02:00
|
|
|
s32 symbolsCount;
|
|
|
|
|
|
|
|
if (battleMode != FRONTIER_MODE_SINGLES)
|
2019-11-21 03:46:29 +01:00
|
|
|
return FRONTIER_BRAIN_NOT_READY;
|
2018-10-27 21:01:35 +02:00
|
|
|
|
2018-11-01 21:31:10 +01:00
|
|
|
symbolsCount = GetPlayerSymbolCountForFacility(facility);
|
2018-10-27 21:01:35 +02:00
|
|
|
switch (symbolsCount)
|
|
|
|
{
|
2019-11-21 03:46:29 +01:00
|
|
|
// Missing a symbol
|
2018-10-27 21:01:35 +02:00
|
|
|
case 0:
|
|
|
|
case 1:
|
2019-11-21 03:46:29 +01:00
|
|
|
if (winStreak == sFrontierBrainStreakAppearances[facility][symbolsCount])
|
|
|
|
status = symbolsCount + 1; // FRONTIER_BRAIN_SILVER and FRONTIER_BRAIN_GOLD
|
2018-10-27 21:01:35 +02:00
|
|
|
break;
|
2019-11-21 03:46:29 +01:00
|
|
|
// Already received both symbols
|
2018-10-27 21:01:35 +02:00
|
|
|
case 2:
|
|
|
|
default:
|
2019-11-21 03:46:29 +01:00
|
|
|
// Silver streak is reached
|
|
|
|
if (winStreak == sFrontierBrainStreakAppearances[facility][0])
|
|
|
|
status = FRONTIER_BRAIN_STREAK;
|
|
|
|
// Gold streak is reached
|
|
|
|
else if (winStreak == sFrontierBrainStreakAppearances[facility][1])
|
|
|
|
status = FRONTIER_BRAIN_STREAK_LONG;
|
|
|
|
// Some increment of the gold streak is reached
|
|
|
|
else if (winStreak > sFrontierBrainStreakAppearances[facility][1] && (winStreak - sFrontierBrainStreakAppearances[facility][1]) % sFrontierBrainStreakAppearances[facility][2] == 0)
|
|
|
|
status = FRONTIER_BRAIN_STREAK_LONG;
|
2018-10-27 21:01:35 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
return status;
|
2018-10-27 21:01:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CopyFrontierTrainerText(u8 whichText, u16 trainerId)
|
|
|
|
{
|
|
|
|
switch (whichText)
|
|
|
|
{
|
|
|
|
case FRONTIER_BEFORE_TEXT:
|
|
|
|
if (trainerId == TRAINER_EREADER)
|
|
|
|
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.greeting);
|
|
|
|
else if (trainerId == TRAINER_FRONTIER_BRAIN)
|
2018-11-01 15:06:50 +01:00
|
|
|
CopyFrontierBrainText(FALSE);
|
2019-12-21 00:52:29 +01:00
|
|
|
else if (trainerId < FRONTIER_TRAINERS_COUNT)
|
2018-10-27 21:01:35 +02:00
|
|
|
FrontierSpeechToString(gFacilityTrainers[trainerId].speechBefore);
|
|
|
|
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
|
|
|
|
FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].greeting);
|
|
|
|
else
|
2019-11-20 23:36:52 +01:00
|
|
|
BufferApprenticeChallengeText(trainerId - TRAINER_RECORD_MIXING_APPRENTICE);
|
2018-10-27 21:01:35 +02:00
|
|
|
break;
|
|
|
|
case FRONTIER_PLAYER_LOST_TEXT:
|
|
|
|
if (trainerId == TRAINER_EREADER)
|
|
|
|
{
|
|
|
|
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.farewellPlayerLost);
|
|
|
|
}
|
|
|
|
else if (trainerId == TRAINER_FRONTIER_BRAIN)
|
|
|
|
{
|
2018-11-01 15:06:50 +01:00
|
|
|
CopyFrontierBrainText(FALSE);
|
2018-10-27 21:01:35 +02:00
|
|
|
}
|
2019-12-21 00:52:29 +01:00
|
|
|
else if (trainerId < FRONTIER_TRAINERS_COUNT)
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
|
|
|
FrontierSpeechToString(gFacilityTrainers[trainerId].speechWin);
|
|
|
|
}
|
|
|
|
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
|
|
|
|
{
|
|
|
|
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
2018-11-01 15:06:50 +01:00
|
|
|
FrontierSpeechToString(GetRecordedBattleEasyChatSpeech());
|
2018-10-27 21:01:35 +02:00
|
|
|
else
|
|
|
|
FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].speechWon);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
2018-11-01 15:06:50 +01:00
|
|
|
FrontierSpeechToString(GetRecordedBattleEasyChatSpeech());
|
2018-10-27 21:01:35 +02:00
|
|
|
else
|
2019-11-19 17:36:38 +01:00
|
|
|
FrontierSpeechToString(gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].speechWon);
|
2018-10-27 21:01:35 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FRONTIER_PLAYER_WON_TEXT:
|
|
|
|
if (trainerId == TRAINER_EREADER)
|
|
|
|
{
|
|
|
|
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.farewellPlayerWon);
|
|
|
|
}
|
|
|
|
else if (trainerId == TRAINER_FRONTIER_BRAIN)
|
|
|
|
{
|
2018-11-01 15:06:50 +01:00
|
|
|
CopyFrontierBrainText(TRUE);
|
2018-10-27 21:01:35 +02:00
|
|
|
}
|
2019-12-21 00:52:29 +01:00
|
|
|
else if (trainerId < FRONTIER_TRAINERS_COUNT)
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
|
|
|
FrontierSpeechToString(gFacilityTrainers[trainerId].speechLose);
|
|
|
|
}
|
|
|
|
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
|
|
|
|
{
|
|
|
|
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
2018-11-01 15:06:50 +01:00
|
|
|
FrontierSpeechToString(GetRecordedBattleEasyChatSpeech());
|
2018-10-27 21:01:35 +02:00
|
|
|
else
|
|
|
|
FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].speechLost);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
|
|
|
{
|
2018-11-01 15:06:50 +01:00
|
|
|
trainerId = GetRecordedBattleApprenticeId();
|
2019-11-19 17:36:38 +01:00
|
|
|
FrontierSpeechToString(gApprentices[trainerId].speechLost);
|
2018-10-27 21:01:35 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
trainerId = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].id;
|
2019-11-19 17:36:38 +01:00
|
|
|
FrontierSpeechToString(gApprentices[trainerId].speechLost);
|
2018-10-27 21:01:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
void ResetWinStreaks(void)
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
|
|
|
s32 battleMode, lvlMode;
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
gSaveBlock2Ptr->frontier.winStreakActiveFlags = 0;
|
2020-04-09 21:18:53 +02:00
|
|
|
for (battleMode = 0; battleMode < FRONTIER_MODE_COUNT; battleMode++)
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
2020-04-09 21:18:53 +02:00
|
|
|
for (lvlMode = 0; lvlMode < FRONTIER_LVL_TENT; lvlMode++)
|
2018-10-27 21:01:35 +02:00
|
|
|
{
|
|
|
|
gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] = 0;
|
|
|
|
if (battleMode < FRONTIER_MODE_MULTIS)
|
|
|
|
{
|
|
|
|
gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] = 0;
|
|
|
|
gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] = 0;
|
|
|
|
gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] = 0;
|
|
|
|
}
|
|
|
|
if (battleMode == FRONTIER_MODE_SINGLES)
|
|
|
|
{
|
|
|
|
gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode] = 0;
|
|
|
|
gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] = 0;
|
|
|
|
gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-11-24 22:58:40 +01:00
|
|
|
if (gSaveBlock2Ptr->frontier.challengeStatus != 0)
|
|
|
|
gSaveBlock2Ptr->frontier.challengeStatus = CHALLENGE_STATUS_SAVING;
|
2018-10-27 21:01:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
u32 GetCurrentFacilityWinStreak(void)
|
|
|
|
{
|
|
|
|
s32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
|
|
|
s32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
|
|
|
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
|
|
|
|
|
|
|
switch (facility)
|
|
|
|
{
|
|
|
|
case FRONTIER_FACILITY_TOWER:
|
|
|
|
return gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode];
|
|
|
|
case FRONTIER_FACILITY_DOME:
|
|
|
|
return gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode];
|
|
|
|
case FRONTIER_FACILITY_PALACE:
|
|
|
|
return gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode];
|
|
|
|
case FRONTIER_FACILITY_ARENA:
|
|
|
|
return gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode];
|
|
|
|
case FRONTIER_FACILITY_FACTORY:
|
|
|
|
return gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode];
|
|
|
|
case FRONTIER_FACILITY_PIKE:
|
|
|
|
return gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode];
|
|
|
|
case FRONTIER_FACILITY_PYRAMID:
|
|
|
|
return gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode];
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2018-10-28 00:50:06 +02:00
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
void ResetFrontierTrainerIds(void)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
s32 i;
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
for (i = 0; i < (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.trainerIds); i++)
|
2019-02-07 18:37:28 +01:00
|
|
|
gSaveBlock2Ptr->frontier.trainerIds[i] = 0xFFFF;
|
2018-10-28 00:50:06 +02:00
|
|
|
}
|
|
|
|
|
2019-11-10 02:40:25 +01:00
|
|
|
static void IsTrainerFrontierBrain(void)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN)
|
|
|
|
gSpecialVar_Result = TRUE;
|
|
|
|
else
|
|
|
|
gSpecialVar_Result = FALSE;
|
|
|
|
}
|
|
|
|
|
2018-11-01 21:31:10 +01:00
|
|
|
u8 GetPlayerSymbolCountForFacility(u8 facility)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
return FlagGet(FLAG_SYS_TOWER_SILVER + facility * 2)
|
|
|
|
+ FlagGet(FLAG_SYS_TOWER_GOLD + facility * 2);
|
|
|
|
}
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
static void GiveBattlePoints(void)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
s32 challengeNum = 0;
|
|
|
|
s32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
|
|
|
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
|
|
|
s32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
|
|
|
s32 points;
|
|
|
|
|
|
|
|
switch (facility)
|
|
|
|
{
|
|
|
|
case FRONTIER_FACILITY_TOWER:
|
|
|
|
challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / 7;
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_DOME:
|
|
|
|
challengeNum = gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode];
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_PALACE:
|
|
|
|
challengeNum = gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] / 7;
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_ARENA:
|
|
|
|
challengeNum = gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode] / 7;
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_FACTORY:
|
|
|
|
challengeNum = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] / 7;
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_PIKE:
|
|
|
|
challengeNum = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] / 14;
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_PYRAMID:
|
|
|
|
challengeNum = gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / 7;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (challengeNum != 0)
|
|
|
|
challengeNum--;
|
2019-11-21 03:46:29 +01:00
|
|
|
if (challengeNum >= ARRAY_COUNT(sBattlePointAwards))
|
|
|
|
challengeNum = ARRAY_COUNT(sBattlePointAwards) - 1;
|
2018-10-28 00:50:06 +02:00
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
points = sBattlePointAwards[challengeNum][facility][battleMode];
|
2018-10-28 00:50:06 +02:00
|
|
|
if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN)
|
|
|
|
points += 10;
|
|
|
|
gSaveBlock2Ptr->frontier.battlePoints += points;
|
|
|
|
ConvertIntToDecimalStringN(gStringVar1, points, STR_CONV_MODE_LEFT_ALIGN, 2);
|
2019-11-21 03:46:29 +01:00
|
|
|
if (gSaveBlock2Ptr->frontier.battlePoints > MAX_BATTLE_FRONTIER_POINTS)
|
|
|
|
gSaveBlock2Ptr->frontier.battlePoints = MAX_BATTLE_FRONTIER_POINTS;
|
2018-10-28 00:50:06 +02:00
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
points = gSaveBlock2Ptr->frontier.cardBattlePoints;
|
2019-11-21 03:46:29 +01:00
|
|
|
points += sBattlePointAwards[challengeNum][facility][battleMode];
|
|
|
|
IncrementDailyBattlePoints(sBattlePointAwards[challengeNum][facility][battleMode]);
|
2018-10-28 00:50:06 +02:00
|
|
|
if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN)
|
|
|
|
{
|
|
|
|
points += 10;
|
2019-10-20 08:31:51 +02:00
|
|
|
IncrementDailyBattlePoints(10);
|
2018-10-28 00:50:06 +02:00
|
|
|
}
|
|
|
|
if (points > 0xFFFF)
|
|
|
|
points = 0xFFFF;
|
2019-11-24 22:58:40 +01:00
|
|
|
gSaveBlock2Ptr->frontier.cardBattlePoints = points;
|
2018-10-28 00:50:06 +02:00
|
|
|
}
|
|
|
|
|
2019-11-10 02:40:25 +01:00
|
|
|
static void GetFacilitySymbolCount(void)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
2018-11-01 21:31:10 +01:00
|
|
|
gSpecialVar_Result = GetPlayerSymbolCountForFacility(facility);
|
2018-10-28 00:50:06 +02:00
|
|
|
}
|
|
|
|
|
2019-11-10 02:40:25 +01:00
|
|
|
static void GiveFacilitySymbol(void)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
2018-11-01 21:31:10 +01:00
|
|
|
if (GetPlayerSymbolCountForFacility(facility) == 0)
|
2018-10-28 00:50:06 +02:00
|
|
|
FlagSet(FLAG_SYS_TOWER_SILVER + facility * 2);
|
|
|
|
else
|
|
|
|
FlagSet(FLAG_SYS_TOWER_GOLD + facility * 2);
|
|
|
|
}
|
|
|
|
|
2019-11-10 02:40:25 +01:00
|
|
|
static void CheckBattleTypeFlag(void)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
if (gBattleTypeFlags & gSpecialVar_0x8005)
|
|
|
|
gSpecialVar_Result = TRUE;
|
|
|
|
else
|
|
|
|
gSpecialVar_Result = FALSE;
|
|
|
|
}
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
static u8 AppendCaughtBannedMonSpeciesName(u16 species, u8 count, s32 numBannedMonsCaught)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_CAUGHT))
|
|
|
|
{
|
2019-11-21 03:46:29 +01:00
|
|
|
count++;
|
|
|
|
switch (count)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
case 3:
|
|
|
|
case 5:
|
|
|
|
case 7:
|
|
|
|
case 9:
|
|
|
|
case 11:
|
2019-11-21 03:46:29 +01:00
|
|
|
if (numBannedMonsCaught == count)
|
2018-10-28 00:50:06 +02:00
|
|
|
StringAppend(gStringVar1, gText_SpaceAndSpace);
|
2019-11-21 03:46:29 +01:00
|
|
|
else if (numBannedMonsCaught > count)
|
2018-10-28 00:50:06 +02:00
|
|
|
StringAppend(gStringVar1, gText_CommaSpace);
|
|
|
|
break;
|
|
|
|
case 2:
|
2019-11-21 03:46:29 +01:00
|
|
|
if (count == numBannedMonsCaught)
|
2018-10-28 00:50:06 +02:00
|
|
|
StringAppend(gStringVar1, gText_SpaceAndSpace);
|
|
|
|
else
|
|
|
|
StringAppend(gStringVar1, gText_CommaSpace);
|
|
|
|
StringAppend(gStringVar1, gText_NewLine);
|
|
|
|
break;
|
|
|
|
default:
|
2019-11-21 03:46:29 +01:00
|
|
|
if (count == numBannedMonsCaught)
|
2018-10-28 00:50:06 +02:00
|
|
|
StringAppend(gStringVar1, gText_SpaceAndSpace);
|
|
|
|
else
|
|
|
|
StringAppend(gStringVar1, gText_CommaSpace);
|
2019-11-24 22:58:40 +01:00
|
|
|
StringAppend(gStringVar1, gText_LineBreak);
|
2018-10-28 00:50:06 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
StringAppend(gStringVar1, gSpeciesNames[species]);
|
|
|
|
}
|
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
return count;
|
2018-10-28 00:50:06 +02:00
|
|
|
}
|
|
|
|
|
2018-10-28 21:11:53 +01:00
|
|
|
static void AppendIfValid(u16 species, u16 heldItem, u16 hp, u8 lvlMode, u8 monLevel, u16 *speciesArray, u16 *itemsArray, u8 *count)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
s32 i = 0;
|
|
|
|
|
|
|
|
if (species == SPECIES_EGG || species == SPECIES_NONE)
|
|
|
|
return;
|
|
|
|
|
2018-12-05 15:31:01 +01:00
|
|
|
for (i = 0; gFrontierBannedSpecies[i] != 0xFFFF && gFrontierBannedSpecies[i] != species; i++)
|
2018-10-28 00:50:06 +02:00
|
|
|
;
|
|
|
|
|
2018-12-05 15:31:01 +01:00
|
|
|
if (gFrontierBannedSpecies[i] != 0xFFFF)
|
2018-10-28 00:50:06 +02:00
|
|
|
return;
|
|
|
|
if (lvlMode == FRONTIER_LVL_50 && monLevel > 50)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < *count && speciesArray[i] != species; i++)
|
|
|
|
;
|
|
|
|
if (i != *count)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (heldItem != 0)
|
|
|
|
{
|
|
|
|
for (i = 0; i < *count && itemsArray[i] != heldItem; i++)
|
|
|
|
;
|
|
|
|
if (i != *count)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
speciesArray[*count] = species;
|
|
|
|
itemsArray[*count] = heldItem;
|
|
|
|
(*count)++;
|
|
|
|
}
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
// gSpecialVar_Result is the level mode before and after calls to this function
|
|
|
|
// gSpecialVar_0x8004 is used to store the return value instead (TRUE if there are insufficient eligible mons)
|
|
|
|
// The names of ineligible pokemon that have been caught are also buffered to print
|
|
|
|
static void CheckPartyIneligibility(void)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
2019-11-21 03:46:29 +01:00
|
|
|
u16 speciesArray[PARTY_SIZE];
|
|
|
|
u16 itemArray[PARTY_SIZE];
|
2018-10-28 00:50:06 +02:00
|
|
|
s32 monId = 0;
|
|
|
|
s32 toChoose = 0;
|
|
|
|
u8 count = 0;
|
|
|
|
s32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
|
|
|
s32 monIdLooper;
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
// count is re-used, define for clarity
|
|
|
|
#define numEligibleMons count
|
|
|
|
|
2018-10-28 00:50:06 +02:00
|
|
|
switch (battleMode)
|
|
|
|
{
|
|
|
|
case FRONTIER_MODE_SINGLES:
|
2019-11-24 22:58:40 +01:00
|
|
|
toChoose = FRONTIER_PARTY_SIZE;
|
2018-10-28 00:50:06 +02:00
|
|
|
break;
|
|
|
|
case FRONTIER_MODE_MULTIS:
|
|
|
|
case FRONTIER_MODE_LINK_MULTIS:
|
2019-11-24 22:58:40 +01:00
|
|
|
toChoose = FRONTIER_MULTI_PARTY_SIZE;
|
2018-10-28 00:50:06 +02:00
|
|
|
break;
|
|
|
|
case FRONTIER_MODE_DOUBLES:
|
|
|
|
if (VarGet(VAR_FRONTIER_FACILITY) == FRONTIER_FACILITY_TOWER)
|
2019-11-24 22:58:40 +01:00
|
|
|
toChoose = FRONTIER_DOUBLES_PARTY_SIZE;
|
2018-10-28 00:50:06 +02:00
|
|
|
else
|
2019-11-24 22:58:40 +01:00
|
|
|
toChoose = FRONTIER_PARTY_SIZE;
|
2018-10-28 00:50:06 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
monIdLooper = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
monId = monIdLooper;
|
2019-11-24 22:58:40 +01:00
|
|
|
numEligibleMons = 0;
|
2018-10-28 00:50:06 +02:00
|
|
|
do
|
|
|
|
{
|
|
|
|
u16 species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES2);
|
|
|
|
u16 heldItem = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
|
|
|
|
u8 level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL);
|
|
|
|
u16 hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP);
|
|
|
|
if (VarGet(VAR_FRONTIER_FACILITY) == FRONTIER_FACILITY_PYRAMID)
|
|
|
|
{
|
2019-11-21 03:46:29 +01:00
|
|
|
if (heldItem == ITEM_NONE)
|
2019-11-24 22:58:40 +01:00
|
|
|
AppendIfValid(species, heldItem, hp, gSpecialVar_Result, level, speciesArray, itemArray, &numEligibleMons);
|
2018-10-28 00:50:06 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-11-24 22:58:40 +01:00
|
|
|
AppendIfValid(species, heldItem, hp, gSpecialVar_Result, level, speciesArray, itemArray, &numEligibleMons);
|
2018-10-28 00:50:06 +02:00
|
|
|
}
|
|
|
|
monId++;
|
|
|
|
if (monId >= PARTY_SIZE)
|
|
|
|
monId = 0;
|
|
|
|
} while (monId != monIdLooper);
|
|
|
|
|
|
|
|
monIdLooper++;
|
2019-11-24 22:58:40 +01:00
|
|
|
} while (monIdLooper < PARTY_SIZE && numEligibleMons < toChoose);
|
2018-10-28 00:50:06 +02:00
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
if (numEligibleMons < toChoose)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
s32 i;
|
|
|
|
s32 caughtBannedMons = 0;
|
2018-11-01 21:31:10 +01:00
|
|
|
s32 species = gFrontierBannedSpecies[0];
|
2018-12-05 15:31:01 +01:00
|
|
|
for (i = 0; species != 0xFFFF; i++, species = gFrontierBannedSpecies[i])
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_CAUGHT))
|
|
|
|
caughtBannedMons++;
|
|
|
|
}
|
|
|
|
gStringVar1[0] = EOS;
|
2019-11-24 22:58:40 +01:00
|
|
|
gSpecialVar_0x8004 = TRUE;
|
2018-10-28 00:50:06 +02:00
|
|
|
count = 0;
|
2018-12-05 15:31:01 +01:00
|
|
|
for (i = 0; gFrontierBannedSpecies[i] != 0xFFFF; i++)
|
2019-11-24 22:58:40 +01:00
|
|
|
count = AppendCaughtBannedMonSpeciesName(gFrontierBannedSpecies[i], count, caughtBannedMons);
|
2018-10-28 00:50:06 +02:00
|
|
|
|
|
|
|
if (count == 0)
|
|
|
|
{
|
|
|
|
StringAppend(gStringVar1, gText_Space2);
|
|
|
|
StringAppend(gStringVar1, gText_Are);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (count & 1)
|
2019-11-24 22:58:40 +01:00
|
|
|
StringAppend(gStringVar1, gText_LineBreak);
|
2018-10-28 00:50:06 +02:00
|
|
|
else
|
|
|
|
StringAppend(gStringVar1, gText_Space2);
|
|
|
|
StringAppend(gStringVar1, gText_Are2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-11-24 22:58:40 +01:00
|
|
|
gSpecialVar_0x8004 = FALSE;
|
2018-10-28 00:50:06 +02:00
|
|
|
gSaveBlock2Ptr->frontier.lvlMode = gSpecialVar_Result;
|
|
|
|
}
|
2019-11-24 22:58:40 +01:00
|
|
|
#undef numEligibleMons
|
2018-10-28 00:50:06 +02:00
|
|
|
}
|
|
|
|
|
2019-11-10 02:40:25 +01:00
|
|
|
static void ValidateVisitingTrainer(void)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
ValidateEReaderTrainer();
|
|
|
|
}
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
static void IncrementWinStreak(void)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
s32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
|
|
|
s32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
|
|
|
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
|
|
|
|
|
|
|
switch (facility)
|
|
|
|
{
|
|
|
|
case FRONTIER_FACILITY_TOWER:
|
2019-11-24 22:58:40 +01:00
|
|
|
if (gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] < MAX_STREAK)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode]++;
|
|
|
|
if (battleMode == FRONTIER_MODE_SINGLES)
|
|
|
|
{
|
|
|
|
SetGameStat(GAME_STAT_BATTLE_TOWER_BEST_STREAK, gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode]);
|
2019-11-24 22:58:40 +01:00
|
|
|
gSaveBlock2Ptr->frontier.towerSinglesStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode];
|
2018-10-28 00:50:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_DOME:
|
2019-11-24 22:58:40 +01:00
|
|
|
if (gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] < MAX_STREAK)
|
2018-10-28 00:50:06 +02:00
|
|
|
gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode]++;
|
2019-11-24 22:58:40 +01:00
|
|
|
if (gSaveBlock2Ptr->frontier.domeTotalChampionships[battleMode][lvlMode] < MAX_STREAK)
|
2018-10-28 00:50:06 +02:00
|
|
|
gSaveBlock2Ptr->frontier.domeTotalChampionships[battleMode][lvlMode]++;
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_PALACE:
|
2019-11-24 22:58:40 +01:00
|
|
|
if (gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] < MAX_STREAK)
|
2018-10-28 00:50:06 +02:00
|
|
|
gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode]++;
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_ARENA:
|
2019-11-24 22:58:40 +01:00
|
|
|
if (gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode] < MAX_STREAK)
|
2018-10-28 00:50:06 +02:00
|
|
|
gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode]++;
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_FACTORY:
|
2019-11-24 22:58:40 +01:00
|
|
|
if (gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] < MAX_STREAK)
|
2018-10-28 00:50:06 +02:00
|
|
|
gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode]++;
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_PIKE:
|
2019-11-24 22:58:40 +01:00
|
|
|
if (gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] < MAX_STREAK)
|
2018-10-28 00:50:06 +02:00
|
|
|
gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode]++;
|
|
|
|
break;
|
|
|
|
case FRONTIER_FACILITY_PYRAMID:
|
2019-11-24 22:58:40 +01:00
|
|
|
if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] < MAX_STREAK)
|
2018-10-28 00:50:06 +02:00
|
|
|
gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode]++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
static void RestoreHeldItems(void)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
for (i = 0; i < MAX_FRONTIER_PARTY_SIZE; i++)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
if (gSaveBlock2Ptr->frontier.selectedPartyMons[i] != 0)
|
|
|
|
{
|
|
|
|
u16 item = GetMonData(&gSaveBlock1Ptr->playerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_HELD_ITEM, NULL);
|
|
|
|
SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
static void SaveRecordBattle(void)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
gSpecialVar_Result = MoveRecordedBattleToSaveData();
|
2020-01-08 11:43:06 +01:00
|
|
|
gSaveBlock2Ptr->frontier.disableRecordBattle = TRUE;
|
2018-10-28 00:50:06 +02:00
|
|
|
}
|
|
|
|
|
2019-11-10 02:40:25 +01:00
|
|
|
static void BufferFrontierTrainerName(void)
|
2018-10-28 00:50:06 +02:00
|
|
|
{
|
|
|
|
switch (gSpecialVar_0x8005)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
GetFrontierTrainerName(gStringVar1, gTrainerBattleOpponent_A);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
GetFrontierTrainerName(gStringVar2, gTrainerBattleOpponent_A);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2018-10-28 21:11:53 +01:00
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
static void ResetSketchedMoves(void)
|
2018-10-28 21:11:53 +01:00
|
|
|
{
|
|
|
|
u8 i, j, k;
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
for (i = 0; i < MAX_FRONTIER_PARTY_SIZE; i++)
|
2018-10-28 21:11:53 +01:00
|
|
|
{
|
|
|
|
u16 monId = gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1;
|
|
|
|
if (monId < PARTY_SIZE)
|
|
|
|
{
|
2018-12-25 18:50:15 +01:00
|
|
|
for (j = 0; j < MAX_MON_MOVES; j++)
|
2018-10-28 21:11:53 +01:00
|
|
|
{
|
2018-12-25 18:50:15 +01:00
|
|
|
for (k = 0; k < MAX_MON_MOVES; k++)
|
2018-10-28 21:11:53 +01:00
|
|
|
{
|
|
|
|
if (GetMonData(&gSaveBlock1Ptr->playerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_MOVE1 + k, NULL)
|
|
|
|
== GetMonData(&gPlayerParty[i], MON_DATA_MOVE1 + j, NULL))
|
|
|
|
break;
|
|
|
|
}
|
2018-12-25 18:50:15 +01:00
|
|
|
if (k == MAX_MON_MOVES)
|
2018-10-28 21:11:53 +01:00
|
|
|
SetMonMoveSlot(&gPlayerParty[i], MOVE_SKETCH, j);
|
|
|
|
}
|
|
|
|
gSaveBlock1Ptr->playerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1] = gPlayerParty[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-21 04:55:44 +01:00
|
|
|
static void SetFacilityBrainObjectEvent(void)
|
2018-10-28 21:11:53 +01:00
|
|
|
{
|
2019-11-21 06:14:40 +01:00
|
|
|
SetFrontierBrainObjEventGfx(VarGet(VAR_FRONTIER_FACILITY));
|
2018-10-28 21:11:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Battle Frontier Ranking Hall records.
|
|
|
|
static void Print1PRecord(s32 position, s32 x, s32 y, struct RankingHall1P *hallRecord, s32 hallFacilityId)
|
|
|
|
{
|
|
|
|
u8 text[32];
|
|
|
|
u16 winStreak;
|
|
|
|
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_123Dot[position], x * 8, (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL);
|
|
|
|
hallRecord->name[PLAYER_NAME_LENGTH] = EOS;
|
|
|
|
if (hallRecord->winStreak)
|
|
|
|
{
|
|
|
|
TVShowConvertInternationalString(text, hallRecord->name, hallRecord->language);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, text, (x + 2) * 8, (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL);
|
|
|
|
winStreak = hallRecord->winStreak;
|
2019-11-24 22:58:40 +01:00
|
|
|
if (winStreak > MAX_STREAK)
|
|
|
|
winStreak = MAX_STREAK;
|
2018-10-28 21:11:53 +01:00
|
|
|
ConvertIntToDecimalStringN(gStringVar2, winStreak, STR_CONV_MODE_RIGHT_ALIGN, 4);
|
2019-11-17 00:11:27 +01:00
|
|
|
StringExpandPlaceholders(gStringVar4, sHallFacilityToRecordsText[hallFacilityId]);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, GetStringRightAlignXOffset(1, sHallFacilityToRecordsText[hallFacilityId], 0xC8), (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL);
|
2018-10-28 21:11:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Print2PRecord(s32 position, s32 x, s32 y, struct RankingHall2P *hallRecord)
|
|
|
|
{
|
|
|
|
u8 text[32];
|
|
|
|
u16 winStreak;
|
|
|
|
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_123Dot[position], x * 8, (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL);
|
|
|
|
if (hallRecord->winStreak)
|
|
|
|
{
|
|
|
|
hallRecord->name1[PLAYER_NAME_LENGTH] = EOS;
|
|
|
|
hallRecord->name2[PLAYER_NAME_LENGTH] = EOS;
|
|
|
|
TVShowConvertInternationalString(text, hallRecord->name1, hallRecord->language);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, text, (x + 2) * 8, (8 * (y + 5 * position - 1)) + 1, TEXT_SPEED_FF, NULL);
|
|
|
|
if (IsStringJapanese(hallRecord->name2))
|
|
|
|
TVShowConvertInternationalString(text, hallRecord->name2, LANGUAGE_JAPANESE);
|
|
|
|
else
|
|
|
|
StringCopy(text, hallRecord->name2);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, text, (x + 4) * 8, (8 * (y + 5 * position + 1)) + 1, TEXT_SPEED_FF, NULL);
|
|
|
|
|
|
|
|
winStreak = hallRecord->winStreak;
|
2019-11-24 22:58:40 +01:00
|
|
|
if (winStreak > MAX_STREAK)
|
|
|
|
winStreak = MAX_STREAK;
|
2018-10-28 21:11:53 +01:00
|
|
|
ConvertIntToDecimalStringN(gStringVar2, winStreak, STR_CONV_MODE_RIGHT_ALIGN, 4);
|
2019-11-17 00:11:27 +01:00
|
|
|
StringExpandPlaceholders(gStringVar4, sHallFacilityToRecordsText[RANKING_HALL_BATTLE_TOWER_LINK]);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, GetStringRightAlignXOffset(1, sHallFacilityToRecordsText[RANKING_HALL_BATTLE_TOWER_LINK], 0xC8), (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL);
|
2018-10-28 21:11:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Fill1PRecords(struct RankingHall1P *dst, s32 hallFacilityId, s32 lvlMode)
|
|
|
|
{
|
|
|
|
s32 i, j;
|
|
|
|
struct RankingHall1P record1P[4];
|
|
|
|
struct PlayerHallRecords *playerHallRecords = calloc(1, sizeof(struct PlayerHallRecords));
|
|
|
|
GetPlayerHallRecords(playerHallRecords);
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
record1P[i] = gSaveBlock2Ptr->hallRecords1P[hallFacilityId][lvlMode][i];
|
|
|
|
|
|
|
|
record1P[3] = playerHallRecords->onePlayer[hallFacilityId][lvlMode];
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
s32 highestWinStreak = 0;
|
|
|
|
s32 highestId = 0;
|
|
|
|
for (j = 0; j < 4; j++)
|
|
|
|
{
|
|
|
|
if (record1P[j].winStreak > highestWinStreak)
|
|
|
|
{
|
|
|
|
highestId = j;
|
|
|
|
highestWinStreak = record1P[j].winStreak;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (record1P[3].winStreak >= highestWinStreak)
|
|
|
|
highestId = 3;
|
|
|
|
|
|
|
|
dst[i] = record1P[highestId];
|
|
|
|
record1P[highestId].winStreak = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
free(playerHallRecords);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Fill2PRecords(struct RankingHall2P *dst, s32 lvlMode)
|
|
|
|
{
|
|
|
|
s32 i, j;
|
|
|
|
struct RankingHall2P record2P[4];
|
|
|
|
struct PlayerHallRecords *playerHallRecords = calloc(1, sizeof(struct PlayerHallRecords));
|
|
|
|
GetPlayerHallRecords(playerHallRecords);
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
record2P[i] = gSaveBlock2Ptr->hallRecords2P[lvlMode][i];
|
|
|
|
|
|
|
|
record2P[3] = playerHallRecords->twoPlayers[lvlMode];
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
s32 highestWinStreak = 0;
|
|
|
|
s32 highestId = 0;
|
|
|
|
for (j = 0; j < 3; j++)
|
|
|
|
{
|
|
|
|
if (record2P[j].winStreak > highestWinStreak)
|
|
|
|
{
|
|
|
|
highestId = j;
|
|
|
|
highestWinStreak = record2P[j].winStreak;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (record2P[3].winStreak >= highestWinStreak)
|
|
|
|
highestId = 3;
|
|
|
|
|
|
|
|
dst[i] = record2P[highestId];
|
|
|
|
record2P[highestId].winStreak = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
free(playerHallRecords);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void PrintHallRecords(s32 hallFacilityId, s32 lvlMode)
|
|
|
|
{
|
|
|
|
s32 i;
|
|
|
|
s32 x;
|
|
|
|
struct RankingHall1P records1P[3];
|
|
|
|
struct RankingHall2P records2P[3];
|
|
|
|
|
2019-11-17 00:11:27 +01:00
|
|
|
StringCopy(gStringVar1, sRecordsWindowChallengeTexts[hallFacilityId][0]);
|
|
|
|
StringExpandPlaceholders(gStringVar4, sRecordsWindowChallengeTexts[hallFacilityId][1]);
|
2018-10-28 21:11:53 +01:00
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL);
|
2019-11-17 00:11:27 +01:00
|
|
|
x = GetStringRightAlignXOffset(1, sLevelModeText[lvlMode], 0xD0);
|
|
|
|
AddTextPrinterParameterized(gRecordsWindowId, 1, sLevelModeText[lvlMode], x, 1, TEXT_SPEED_FF, NULL);
|
|
|
|
if (hallFacilityId == RANKING_HALL_BATTLE_TOWER_LINK)
|
2018-10-28 21:11:53 +01:00
|
|
|
{
|
2019-11-24 22:58:40 +01:00
|
|
|
gSaveBlock2Ptr->frontier.opponentNames[0][PLAYER_NAME_LENGTH] = EOS;
|
|
|
|
gSaveBlock2Ptr->frontier.opponentNames[1][PLAYER_NAME_LENGTH] = EOS;
|
2018-10-28 21:11:53 +01:00
|
|
|
Fill2PRecords(records2P, lvlMode);
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
Print2PRecord(i, 1, 4, &records2P[i]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Fill1PRecords(records1P, hallFacilityId, lvlMode);
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
Print1PRecord(i, 1, 4, &records1P[i], hallFacilityId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ShowRankingHallRecordsWindow(void)
|
|
|
|
{
|
2019-11-24 22:58:40 +01:00
|
|
|
gRecordsWindowId = AddWindow(&sRankingHallRecordsWindowTemplate);
|
2019-02-22 07:40:11 +01:00
|
|
|
DrawStdWindowFrame(gRecordsWindowId, FALSE);
|
2019-03-02 23:25:39 +01:00
|
|
|
FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
|
2018-10-28 21:11:53 +01:00
|
|
|
PrintHallRecords(gSpecialVar_0x8005, FRONTIER_LVL_50);
|
|
|
|
PutWindowTilemap(gRecordsWindowId);
|
|
|
|
CopyWindowToVram(gRecordsWindowId, 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScrollRankingHallRecordsWindow(void)
|
|
|
|
{
|
2019-03-02 23:25:39 +01:00
|
|
|
FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
|
2018-10-28 21:11:53 +01:00
|
|
|
PrintHallRecords(gSpecialVar_0x8005, FRONTIER_LVL_OPEN);
|
|
|
|
CopyWindowToVram(gRecordsWindowId, 2);
|
|
|
|
}
|
2018-10-30 21:45:26 +01:00
|
|
|
|
2018-11-05 22:13:59 +01:00
|
|
|
void ClearRankingHallRecords(void)
|
2018-10-30 21:45:26 +01:00
|
|
|
{
|
|
|
|
s32 i, j, k;
|
|
|
|
|
2020-12-13 05:28:01 +01:00
|
|
|
// BUG: Passing 0 as a pointer instead of a pointer holding a value of 0.
|
|
|
|
#ifdef BUGFIX
|
|
|
|
u8 zero = 0;
|
|
|
|
#define ZERO (&zero)
|
|
|
|
#else
|
|
|
|
#define ZERO 0
|
|
|
|
#endif
|
|
|
|
|
2018-10-30 21:45:26 +01:00
|
|
|
for (i = 0; i < HALL_FACILITIES_COUNT; i++)
|
|
|
|
{
|
|
|
|
for (j = 0; j < 2; j++)
|
|
|
|
{
|
|
|
|
for (k = 0; k < 3; k++)
|
|
|
|
{
|
2020-12-13 05:28:01 +01:00
|
|
|
CopyTrainerId(gSaveBlock2Ptr->hallRecords1P[i][j][k].id, ZERO);
|
2018-10-30 21:45:26 +01:00
|
|
|
gSaveBlock2Ptr->hallRecords1P[i][j][k].name[0] = EOS;
|
|
|
|
gSaveBlock2Ptr->hallRecords1P[i][j][k].winStreak = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (j = 0; j < 2; j++)
|
|
|
|
{
|
|
|
|
for (k = 0; k < 3; k++)
|
|
|
|
{
|
2020-12-13 05:28:01 +01:00
|
|
|
CopyTrainerId(gSaveBlock2Ptr->hallRecords2P[j][k].id1, ZERO);
|
|
|
|
CopyTrainerId(gSaveBlock2Ptr->hallRecords2P[j][k].id2, ZERO);
|
2018-10-30 21:45:26 +01:00
|
|
|
gSaveBlock2Ptr->hallRecords2P[j][k].name1[0] = EOS;
|
|
|
|
gSaveBlock2Ptr->hallRecords2P[j][k].name2[0] = EOS;
|
|
|
|
gSaveBlock2Ptr->hallRecords2P[j][k].winStreak = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-24 22:58:40 +01:00
|
|
|
void SaveGameFrontier(void)
|
2018-10-30 21:45:26 +01:00
|
|
|
{
|
|
|
|
s32 i;
|
|
|
|
struct Pokemon *monsParty = calloc(PARTY_SIZE, sizeof(struct Pokemon));
|
|
|
|
|
|
|
|
for (i = 0; i < PARTY_SIZE; i++)
|
|
|
|
monsParty[i] = gPlayerParty[i];
|
|
|
|
|
|
|
|
i = gPlayerPartyCount;
|
|
|
|
LoadPlayerParty();
|
2018-12-27 23:30:47 +01:00
|
|
|
SetContinueGameWarpStatusToDynamicWarp();
|
2018-10-30 21:45:26 +01:00
|
|
|
TrySavingData(SAVE_LINK);
|
2018-12-27 23:30:47 +01:00
|
|
|
ClearContinueGameWarpStatus2();
|
2018-10-30 21:45:26 +01:00
|
|
|
gPlayerPartyCount = i;
|
|
|
|
|
|
|
|
for (i = 0; i < PARTY_SIZE; i++)
|
|
|
|
gPlayerParty[i] = monsParty[i];
|
|
|
|
|
|
|
|
free(monsParty);
|
|
|
|
}
|
|
|
|
|
2018-11-01 21:31:10 +01:00
|
|
|
// Frontier Brain functions.
|
2018-10-30 21:45:26 +01:00
|
|
|
u8 GetFrontierBrainTrainerPicIndex(void)
|
|
|
|
{
|
|
|
|
s32 facility;
|
|
|
|
|
|
|
|
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
|
|
|
facility = GetRecordedBattleFrontierFacility();
|
|
|
|
else
|
|
|
|
facility = VarGet(VAR_FRONTIER_FACILITY);
|
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
return gTrainers[sFrontierBrainTrainerIds[facility]].trainerPic;
|
2018-10-30 21:45:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
u8 GetFrontierBrainTrainerClass(void)
|
|
|
|
{
|
|
|
|
s32 facility;
|
|
|
|
|
|
|
|
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
|
|
|
facility = GetRecordedBattleFrontierFacility();
|
|
|
|
else
|
|
|
|
facility = VarGet(VAR_FRONTIER_FACILITY);
|
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
return gTrainers[sFrontierBrainTrainerIds[facility]].trainerClass;
|
2018-10-30 21:45:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CopyFrontierBrainTrainerName(u8 *dst)
|
|
|
|
{
|
|
|
|
s32 i;
|
|
|
|
s32 facility;
|
|
|
|
|
|
|
|
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
|
|
|
facility = GetRecordedBattleFrontierFacility();
|
|
|
|
else
|
|
|
|
facility = VarGet(VAR_FRONTIER_FACILITY);
|
|
|
|
|
|
|
|
for (i = 0; i < PLAYER_NAME_LENGTH; i++)
|
2019-11-21 03:46:29 +01:00
|
|
|
dst[i] = gTrainers[sFrontierBrainTrainerIds[facility]].trainerName[i];
|
2018-10-30 21:45:26 +01:00
|
|
|
|
|
|
|
dst[i] = EOS;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 IsFrontierBrainFemale(void)
|
|
|
|
{
|
|
|
|
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
2019-11-21 03:46:29 +01:00
|
|
|
return sFrontierBrainObjEventGfx[facility][1];
|
2018-10-30 21:45:26 +01:00
|
|
|
}
|
|
|
|
|
2019-11-21 06:14:40 +01:00
|
|
|
void SetFrontierBrainObjEventGfx_2(void)
|
2018-10-30 21:45:26 +01:00
|
|
|
{
|
|
|
|
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
2019-11-21 03:46:29 +01:00
|
|
|
VarSet(VAR_OBJ_GFX_ID_0, sFrontierBrainObjEventGfx[facility][0]);
|
2018-10-30 21:45:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define FRONTIER_BRAIN_OTID 61226
|
|
|
|
|
|
|
|
void CreateFrontierBrainPokemon(void)
|
|
|
|
{
|
|
|
|
s32 i, j;
|
2019-12-18 08:32:52 +01:00
|
|
|
s32 selectedMonBits;
|
2018-10-30 21:45:26 +01:00
|
|
|
s32 monPartyId;
|
2018-11-01 15:06:50 +01:00
|
|
|
s32 monLevel = 0;
|
2018-10-30 21:45:26 +01:00
|
|
|
u8 friendship;
|
|
|
|
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
2018-11-01 15:06:50 +01:00
|
|
|
s32 symbol = GetFronterBrainSymbol();
|
2018-10-30 21:45:26 +01:00
|
|
|
|
|
|
|
if (facility == FRONTIER_FACILITY_DOME)
|
2019-12-18 08:32:52 +01:00
|
|
|
selectedMonBits = GetDomeTrainerSelectedMons(TrainerIdToDomeTournamentId(TRAINER_FRONTIER_BRAIN));
|
2018-10-30 21:45:26 +01:00
|
|
|
else
|
2019-12-18 08:32:52 +01:00
|
|
|
selectedMonBits = (1 << FRONTIER_PARTY_SIZE) - 1; // all 3 mons selected
|
2018-10-30 21:45:26 +01:00
|
|
|
|
|
|
|
ZeroEnemyPartyMons();
|
|
|
|
monPartyId = 0;
|
|
|
|
monLevel = SetFacilityPtrsGetLevel();
|
2019-12-18 08:32:52 +01:00
|
|
|
for (i = 0; i < FRONTIER_PARTY_SIZE; selectedMonBits >>= 1, i++)
|
2018-10-30 21:45:26 +01:00
|
|
|
{
|
2019-12-18 08:32:52 +01:00
|
|
|
if (!(selectedMonBits & 1))
|
2018-10-30 21:45:26 +01:00
|
|
|
continue;
|
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
|
|
|
|
2018-10-30 21:45:26 +01:00
|
|
|
do
|
|
|
|
{
|
2020-10-24 03:36:38 +02:00
|
|
|
do
|
|
|
|
{
|
|
|
|
j = Random32(); //should just be one while loop, but that doesn't match
|
|
|
|
} while (IsShinyOtIdPersonality(FRONTIER_BRAIN_OTID, j));
|
|
|
|
} while (sFrontierBrainsMons[facility][symbol][i].nature != GetNatureFromPersonality(j));
|
2018-10-30 21:45:26 +01:00
|
|
|
CreateMon(&gEnemyParty[monPartyId],
|
|
|
|
sFrontierBrainsMons[facility][symbol][i].species,
|
|
|
|
monLevel,
|
|
|
|
sFrontierBrainsMons[facility][symbol][i].fixedIV,
|
|
|
|
TRUE, j,
|
2019-08-31 05:06:43 +02:00
|
|
|
OT_ID_PRESET, FRONTIER_BRAIN_OTID);
|
2018-10-30 21:45:26 +01:00
|
|
|
SetMonData(&gEnemyParty[monPartyId], MON_DATA_HELD_ITEM, &sFrontierBrainsMons[facility][symbol][i].heldItem);
|
2018-11-27 22:45:50 +01:00
|
|
|
for (j = 0; j < NUM_STATS; j++)
|
2018-10-30 21:45:26 +01:00
|
|
|
SetMonData(&gEnemyParty[monPartyId], MON_DATA_HP_EV + j, &sFrontierBrainsMons[facility][symbol][i].evs[j]);
|
2019-12-18 08:32:52 +01:00
|
|
|
friendship = MAX_FRIENDSHIP;
|
2018-12-25 18:50:15 +01:00
|
|
|
for (j = 0; j < MAX_MON_MOVES; j++)
|
2018-10-30 21:45:26 +01:00
|
|
|
{
|
|
|
|
SetMonMoveSlot(&gEnemyParty[monPartyId], sFrontierBrainsMons[facility][symbol][i].moves[j], j);
|
|
|
|
if (sFrontierBrainsMons[facility][symbol][i].moves[j] == MOVE_FRUSTRATION)
|
|
|
|
friendship = 0;
|
|
|
|
}
|
|
|
|
SetMonData(&gEnemyParty[monPartyId], MON_DATA_FRIENDSHIP, &friendship);
|
|
|
|
CalculateMonStats(&gEnemyParty[monPartyId]);
|
|
|
|
monPartyId++;
|
|
|
|
}
|
|
|
|
}
|
2018-11-01 15:06:50 +01:00
|
|
|
|
2018-11-01 21:31:10 +01:00
|
|
|
u16 GetFrontierBrainMonSpecies(u8 monId)
|
2018-11-01 15:06:50 +01:00
|
|
|
{
|
|
|
|
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
|
|
|
s32 symbol = GetFronterBrainSymbol();
|
|
|
|
|
2018-11-01 21:31:10 +01:00
|
|
|
return sFrontierBrainsMons[facility][symbol][monId].species;
|
2018-11-01 15:06:50 +01:00
|
|
|
}
|
|
|
|
|
2019-11-21 06:14:40 +01:00
|
|
|
void SetFrontierBrainObjEventGfx(u8 facility)
|
2018-11-01 15:06:50 +01:00
|
|
|
{
|
|
|
|
gTrainerBattleOpponent_A = TRAINER_FRONTIER_BRAIN;
|
2019-11-21 03:46:29 +01:00
|
|
|
VarSet(VAR_OBJ_GFX_ID_0, sFrontierBrainObjEventGfx[facility][0]);
|
2018-11-01 15:06:50 +01:00
|
|
|
}
|
|
|
|
|
2018-11-01 21:31:10 +01:00
|
|
|
u16 GetFrontierBrainMonMove(u8 monId, u8 moveSlotId)
|
2018-11-01 15:06:50 +01:00
|
|
|
{
|
|
|
|
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
|
|
|
s32 symbol = GetFronterBrainSymbol();
|
|
|
|
|
|
|
|
return sFrontierBrainsMons[facility][symbol][monId].moves[moveSlotId];
|
|
|
|
}
|
|
|
|
|
2018-11-01 21:31:10 +01:00
|
|
|
u8 GetFrontierBrainMonNature(u8 monId)
|
2018-11-01 15:06:50 +01:00
|
|
|
{
|
|
|
|
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
|
|
|
s32 symbol = GetFronterBrainSymbol();
|
|
|
|
|
2018-11-01 21:31:10 +01:00
|
|
|
return sFrontierBrainsMons[facility][symbol][monId].nature;
|
2018-11-01 15:06:50 +01:00
|
|
|
}
|
|
|
|
|
2018-11-01 21:31:10 +01:00
|
|
|
u8 GetFrontierBrainMonEvs(u8 monId, u8 evStatId)
|
2018-11-01 15:06:50 +01:00
|
|
|
{
|
|
|
|
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
|
|
|
s32 symbol = GetFronterBrainSymbol();
|
|
|
|
|
|
|
|
return sFrontierBrainsMons[facility][symbol][monId].evs[evStatId];
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 GetFronterBrainSymbol(void)
|
|
|
|
{
|
|
|
|
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
2018-11-01 21:31:10 +01:00
|
|
|
s32 symbol = GetPlayerSymbolCountForFacility(facility);
|
2018-11-01 15:06:50 +01:00
|
|
|
|
|
|
|
if (symbol == 2)
|
|
|
|
{
|
|
|
|
u16 winStreak = GetCurrentFacilityWinStreak();
|
2019-11-21 03:46:29 +01:00
|
|
|
if (winStreak + sFrontierBrainStreakAppearances[facility][3] == sFrontierBrainStreakAppearances[facility][0])
|
2018-11-01 15:06:50 +01:00
|
|
|
symbol = 0;
|
2019-11-21 03:46:29 +01:00
|
|
|
else if (winStreak + sFrontierBrainStreakAppearances[facility][3] == sFrontierBrainStreakAppearances[facility][1])
|
2018-11-01 15:06:50 +01:00
|
|
|
symbol = 1;
|
2019-11-21 03:46:29 +01:00
|
|
|
else if (winStreak + sFrontierBrainStreakAppearances[facility][3] > sFrontierBrainStreakAppearances[facility][1]
|
|
|
|
&& (winStreak + sFrontierBrainStreakAppearances[facility][3] - sFrontierBrainStreakAppearances[facility][1]) % sFrontierBrainStreakAppearances[facility][2] == 0)
|
2018-11-01 15:06:50 +01:00
|
|
|
symbol = 1;
|
|
|
|
}
|
|
|
|
return symbol;
|
|
|
|
}
|
|
|
|
|
2019-11-21 03:46:29 +01:00
|
|
|
// Called for intro speech as well despite the fact that its handled in the map scripts files instead
|
2018-11-01 15:06:50 +01:00
|
|
|
static void CopyFrontierBrainText(bool8 playerWonText)
|
|
|
|
{
|
|
|
|
s32 facility;
|
|
|
|
s32 symbol;
|
|
|
|
|
|
|
|
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
|
|
|
{
|
|
|
|
facility = GetRecordedBattleFrontierFacility();
|
|
|
|
symbol = GetRecordedBattleFronterBrainSymbol();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
facility = VarGet(VAR_FRONTIER_FACILITY);
|
|
|
|
symbol = GetFronterBrainSymbol();
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (playerWonText)
|
|
|
|
{
|
|
|
|
case FALSE:
|
2019-11-21 03:46:29 +01:00
|
|
|
StringCopy(gStringVar4, sFrontierBrainPlayerLostTexts[symbol][facility]);
|
2018-11-01 15:06:50 +01:00
|
|
|
break;
|
|
|
|
case TRUE:
|
2019-11-21 03:46:29 +01:00
|
|
|
StringCopy(gStringVar4, sFrontierBrainPlayerWonTexts[symbol][facility]);
|
2018-11-01 15:06:50 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|