WIP Document apprentice

This commit is contained in:
GriffinR 2019-11-14 18:56:18 -05:00
parent ef8370566f
commit fc3783b739
15 changed files with 3284 additions and 3228 deletions

View File

@ -1,4 +1,5 @@
#include "constants/global.h"
#include "constants/apprentice.h"
#include "constants/battle.h"
#include "constants/battle_pike.h"
#include "constants/battle_pyramid.h"
@ -1110,6 +1111,7 @@ Common_EventScript_LegendaryFlewAway:: @ 8273776
.include "data/scripts/lilycove_lady.inc"
.include "data/text/match_call.inc"
.include "data/scripts/apprentice.inc"
.include "data/text/apprentice.inc"
.include "data/text/battle_dome.inc"
.include "data/scripts/battle_pike.inc"
.include "data/text/blend_master.inc"

View File

@ -89,7 +89,7 @@
"movement_range_y": 1,
"trainer_type": "0",
"trainer_sight_or_berry_tree_id": "0",
"script": "EventScript_Apprentice",
"script": "BattleFrontier_BattleTowerLobby_EventScript_Apprentice",
"flag": "FLAG_HIDE_APPRENTICE"
},
{

View File

@ -11,7 +11,7 @@ BattleFrontier_BattleTowerLobby_MapScript1_23E690: @ 823E690
BattleFrontier_BattleTowerLobby_MapScript1_23E694: @ 823E694
call BattleFrontier_BattleTowerLobby_EventScript_28CC84
setvar VAR_0x8004, 10
setvar VAR_0x8004, APPRENTICE_FUNC_10
special CallApprenticeFunction
compare VAR_0x8004, 0
goto_if_eq BattleFrontier_BattleTowerLobby_EventScript_23E6B5
@ -19,7 +19,7 @@ BattleFrontier_BattleTowerLobby_MapScript1_23E694: @ 823E694
BattleFrontier_BattleTowerLobby_EventScript_23E6B5:: @ 823E6B5
clearflag FLAG_HIDE_APPRENTICE
setvar VAR_0x8004, 23
setvar VAR_0x8004, APPRENTICE_FUNC_23
special CallApprenticeFunction
BattleFrontier_BattleTowerLobby_EventScript_23E6C0:: @ 823E6C0

File diff suppressed because it is too large Load Diff

2527
data/text/apprentice.inc Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
#ifndef GUARD_APPRENTICE_H
#define GUARD_APPRENTICE_H
#define APPRENTICE_SPECIES_COUNT 10
#include "constants/apprentice.h"
struct ApprenticeTrainer
{

View File

@ -1,6 +1,39 @@
#ifndef GUARD_CONSTANTS_APPRENTICE_H
#define GUARD_CONSTANTS_APPRENTICE_H
#define APPRENTICE_SPECIES_COUNT 10
#define NUM_APPRENTICES 16
#define APPRENTICE_LVL_MODE_50 (FRONTIER_LVL_50 + 1)
#define APPRENTICE_LVL_MODE_OPEN (FRONTIER_LVL_OPEN + 1)
#define APPRENTICE_FUNC_0 0
#define APPRENTICE_FUNC_1 1
#define APPRENTICE_FUNC_2 2
#define APPRENTICE_FUNC_3 3
#define APPRENTICE_FUNC_4 4
#define APPRENTICE_FUNC_5 5
#define APPRENTICE_FUNC_6 6
#define APPRENTICE_FUNC_MENU 7
#define APPRENTICE_FUNC_PRINT_MSG 8
#define APPRENTICE_FUNC_9 9
#define APPRENTICE_FUNC_SET_TRUE_1 10
#define APPRENTICE_FUNC_11 11
#define APPRENTICE_FUNC_12 12
#define APPRENTICE_FUNC_13 13
#define APPRENTICE_FUNC_14 14
#define APPRENTICE_FUNC_15 15
#define APPRENTICE_FUNC_16 16
#define APPRENTICE_FUNC_17 17
#define APPRENTICE_FUNC_18 18
#define APPRENTICE_FUNC_19 19
#define APPRENTICE_FUNC_20 20
#define APPRENTICE_FUNC_21 21
#define APPRENTICE_FUNC_22 22
#define APPRENTICE_FUNC_23 23
#define APPRENTICE_FUNC_24 24
#define APPRENTICE_FUNC_25 25
#define APPRENTICE_ASK_WHICH_LEVEL 0
#define APPRENTICE_ASK_3SPECIES 1
#define APPRENTICE_ASK_2SPECIES 2

View File

@ -48,6 +48,7 @@
#define EVENT_OBJECT_TEMPLATES_COUNT 64
#define DECOR_MAX_SECRET_BASE 16
#define DECOR_MAX_PLAYERS_HOUSE 12
#define APPRENTICE_COUNT 4
#define PYRAMID_BAG_ITEMS_COUNT 10
#define HALL_FACILITIES_COUNT 9 // 7 facilities for single mode + tower double mode + tower multi mode.
@ -63,6 +64,7 @@
#define POKEMON_NAME_LENGTH 10
#define PLAYER_NAME_LENGTH 7
#define MAIL_WORDS_COUNT 9
#define EASY_CHAT_BATTLE_WORDS_COUNT 6
#define MOVE_NAME_LENGTH 12
#define MALE 0

View File

@ -195,6 +195,10 @@
#define MON_ALREADY_KNOWS_MOVE 0xFFFE
#define MON_HAS_MAX_MOVES 0xFFFF
#define LEVEL_UP_MOVE_ID 0x01FF
#define LEVEL_UP_MOVE_LV 0xFE00
#define LEVEL_UP_END 0xFFFF
#define MON_MALE 0x00
#define MON_FEMALE 0xFE
#define MON_GENDERLESS 0xFF

View File

@ -214,6 +214,8 @@ struct ApprenticeMon
u16 item;
};
// This is for past players Apprentices or Apprentices received via Record Mix.
// For the current Apprentice, see struct PlayersApprentice
struct Apprentice
{
u8 id:5;
@ -221,7 +223,7 @@ struct Apprentice
u8 field_1;
u8 number;
struct ApprenticeMon party[MULTI_PARTY_SIZE];
u16 easyChatWords[6];
u16 easyChatWords[EASY_CHAT_BATTLE_WORDS_COUNT];
u8 playerId[TRAINER_ID_LENGTH];
u8 playerName[PLAYER_NAME_LENGTH];
u8 language;
@ -264,9 +266,9 @@ struct EmeraldBattleTowerRecord
/*0x02*/ u16 winStreak;
/*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1];
/*0x0C*/ u8 trainerId[TRAINER_ID_LENGTH];
/*0x10*/ u16 greeting[6];
/*0x1C*/ u16 speechWon[6];
/*0x28*/ u16 speechLost[6];
/*0x10*/ u16 greeting[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x1C*/ u16 speechWon[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x28*/ u16 speechLost[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x34*/ struct BattleTowerPokemon party[4];
/*0xE4*/ u8 language;
/*0xE8*/ u32 checksum;
@ -279,9 +281,9 @@ struct BattleTowerEReaderTrainer
/*0x02*/ u16 winStreak;
/*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1];
/*0x0C*/ u8 trainerId[TRAINER_ID_LENGTH];
/*0x10*/ u16 greeting[6];
/*0x1C*/ u16 farewellPlayerLost[6];
/*0x28*/ u16 farewellPlayerWon[6];
/*0x10*/ u16 greeting[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x1C*/ u16 farewellPlayerLost[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x28*/ u16 farewellPlayerWon[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x34*/ struct BattleTowerPokemon party[FRONTIER_PARTY_SIZE];
/*0xB8*/ u32 checksum;
};
@ -413,7 +415,7 @@ struct Sav2_B8
struct PlayersApprentice
{
/*0xB0*/ u8 id;
/*0xB1*/ u8 activeLvlMode:2; // +1, 0 means not active
/*0xB1*/ u8 lvlMode:2; //0: Unassigned, 1: Lv 50, 2: Open Lv
/*0xB1*/ u8 field_B1_1:4;
/*0xB1*/ u8 field_B1_2:2;
/*0xB2*/ u8 field_B2_0:3;
@ -465,7 +467,7 @@ struct SaveBlock2
/*0xA8*/ u32 field_A8; // Written to, but never read.
/*0xAC*/ u32 encryptionKey;
/*0xB0*/ struct PlayersApprentice playerApprentice;
/*0xDC*/ struct Apprentice apprentices[4]; // From record mixing.
/*0xDC*/ struct Apprentice apprentices[APPRENTICE_COUNT];
/*0x1EC*/ struct BerryCrush berryCrush;
/*0x1FC*/ struct PokemonJumpResults pokeJump;
/*0x20C*/ struct BerryPickingResults berryPick;
@ -949,10 +951,10 @@ struct SaveBlock1
/*0x2BA1*/ u8 outbreakPokemonProbability;
/*0x2BA2*/ u16 outbreakDaysLeft;
/*0x2BA4*/ struct GabbyAndTyData gabbyAndTyData;
/*0x2BB0*/ u16 easyChatProfile[6];
/*0x2BBC*/ u16 easyChatBattleStart[6];
/*0x2BC8*/ u16 easyChatBattleWon[6];
/*0x2BD4*/ u16 easyChatBattleLost[6];
/*0x2BB0*/ u16 easyChatProfile[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x2BBC*/ u16 easyChatBattleStart[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x2BC8*/ u16 easyChatBattleWon[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x2BD4*/ u16 easyChatBattleLost[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x2BE0*/ struct MailStruct mail[MAIL_COUNT];
/*0x2E20*/ u8 additionalPhrases[8]; // bitfield for 33 additional phrases in easy chat system
/*0x2E28*/ OldMan oldMan;

View File

@ -2416,6 +2416,10 @@ extern const u8 gUnknown_085EDC45[];
extern const u8 gUnknown_085EDB00[];
extern const u8 gUnknown_085EDC84[];
// Apprentice
extern const u8 gText_Give[];
extern const u8 gText_NoNeed[];
// Easy Chat Entry
extern const u8 gText_StopGivingPkmnMail[];
extern const u8 gText_LikeToQuitQuiz[];

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,4 @@
#define LEVEL_UP_MOVE(lvl, move) ((lvl << 9) | move)
#define LEVEL_UP_END 0xffff
static const u16 sBulbasaurLevelUpLearnset[] = {
LEVEL_UP_MOVE( 1, MOVE_TACKLE),

View File

@ -2943,12 +2943,12 @@ void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon)
u16 moveLevel;
u16 move;
moveLevel = (gLevelUpLearnsets[species][i] & 0xFE00);
moveLevel = (gLevelUpLearnsets[species][i] & LEVEL_UP_MOVE_LV);
if (moveLevel > (level << 9))
break;
move = (gLevelUpLearnsets[species][i] & 0x1FF);
move = (gLevelUpLearnsets[species][i] & LEVEL_UP_MOVE_ID);
if (GiveMoveToBoxMon(boxMon, move) == MON_HAS_MAX_MOVES)
DeleteFirstMoveAndGiveMoveToBoxMon(boxMon, move);
@ -2969,7 +2969,7 @@ u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove)
{
sLearningMoveTableID = 0;
while ((gLevelUpLearnsets[species][sLearningMoveTableID] & 0xFE00) != (level << 9))
while ((gLevelUpLearnsets[species][sLearningMoveTableID] & LEVEL_UP_MOVE_LV) != (level << 9))
{
sLearningMoveTableID++;
if (gLevelUpLearnsets[species][sLearningMoveTableID] == LEVEL_UP_END)
@ -2977,9 +2977,9 @@ u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove)
}
}
if ((gLevelUpLearnsets[species][sLearningMoveTableID] & 0xFE00) == (level << 9))
if ((gLevelUpLearnsets[species][sLearningMoveTableID] & LEVEL_UP_MOVE_LV) == (level << 9))
{
gMoveToLearn = (gLevelUpLearnsets[species][sLearningMoveTableID] & 0x1FF);
gMoveToLearn = (gLevelUpLearnsets[species][sLearningMoveTableID] & LEVEL_UP_MOVE_ID);
sLearningMoveTableID++;
retVal = GiveMoveToMon(mon, gMoveToLearn);
}
@ -6112,23 +6112,23 @@ u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves)
{
u16 moveLevel;
if (gLevelUpLearnsets[species][i] == 0xFFFF)
if (gLevelUpLearnsets[species][i] == LEVEL_UP_END)
break;
moveLevel = gLevelUpLearnsets[species][i] & 0xFE00;
moveLevel = gLevelUpLearnsets[species][i] & LEVEL_UP_MOVE_LV;
if (moveLevel <= (level << 9))
{
for (j = 0; j < MAX_MON_MOVES && learnedMoves[j] != (gLevelUpLearnsets[species][i] & 0x1FF); j++)
for (j = 0; j < MAX_MON_MOVES && learnedMoves[j] != (gLevelUpLearnsets[species][i] & LEVEL_UP_MOVE_ID); j++)
;
if (j == MAX_MON_MOVES)
{
for (k = 0; k < numMoves && moves[k] != (gLevelUpLearnsets[species][i] & 0x1FF); k++)
for (k = 0; k < numMoves && moves[k] != (gLevelUpLearnsets[species][i] & LEVEL_UP_MOVE_ID); k++)
;
if (k == numMoves)
moves[numMoves++] = gLevelUpLearnsets[species][i] & 0x1FF;
moves[numMoves++] = gLevelUpLearnsets[species][i] & LEVEL_UP_MOVE_ID;
}
}
}
@ -6141,8 +6141,8 @@ u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves)
u8 numMoves = 0;
int i;
for (i = 0; i < 20 && gLevelUpLearnsets[species][i] != 0xFFFF; i++)
moves[numMoves++] = gLevelUpLearnsets[species][i] & 0x1FF;
for (i = 0; i < 20 && gLevelUpLearnsets[species][i] != LEVEL_UP_END; i++)
moves[numMoves++] = gLevelUpLearnsets[species][i] & LEVEL_UP_MOVE_ID;
return numMoves;
}
@ -6166,23 +6166,23 @@ u8 GetNumberOfRelearnableMoves(struct Pokemon *mon)
{
u16 moveLevel;
if (gLevelUpLearnsets[species][i] == 0xFFFF)
if (gLevelUpLearnsets[species][i] == LEVEL_UP_END)
break;
moveLevel = gLevelUpLearnsets[species][i] & 0xFE00;
moveLevel = gLevelUpLearnsets[species][i] & LEVEL_UP_MOVE_LV;
if (moveLevel <= (level << 9))
{
for (j = 0; j < MAX_MON_MOVES && learnedMoves[j] != (gLevelUpLearnsets[species][i] & 0x1FF); j++)
for (j = 0; j < MAX_MON_MOVES && learnedMoves[j] != (gLevelUpLearnsets[species][i] & LEVEL_UP_MOVE_ID); j++)
;
if (j == MAX_MON_MOVES)
{
for (k = 0; k < numMoves && moves[k] != (gLevelUpLearnsets[species][i] & 0x1FF); k++)
for (k = 0; k < numMoves && moves[k] != (gLevelUpLearnsets[species][i] & LEVEL_UP_MOVE_ID); k++)
;
if (k == numMoves)
moves[numMoves++] = gLevelUpLearnsets[species][i] & 0x1FF;
moves[numMoves++] = gLevelUpLearnsets[species][i] & LEVEL_UP_MOVE_ID;
}
}
}

View File

@ -1113,14 +1113,14 @@ void GetPlayerHallRecords(struct PlayerHallRecords *dst)
}
}
static bool32 sub_80E841C(struct Apprentice *arg0, struct Apprentice *arg1)
static bool32 sub_80E841C(struct Apprentice *mixApprentice, struct Apprentice *apprentices)
{
s32 i;
for (i = 0; i < 4; i++)
for (i = 0; i < APPRENTICE_COUNT; i++)
{
if (GetTrainerId(arg0->playerId) == GetTrainerId(arg1[i].playerId)
&& arg0->number == arg1[i].number)
if (GetTrainerId(mixApprentice->playerId) == GetTrainerId(apprentices[i].playerId)
&& mixApprentice->number == apprentices[i].number)
{
return TRUE;
}