Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Earn battle points from trainer battles (with a variable) #5286

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -5612,7 +5612,13 @@ BattleScript_LocalBattleWonLoseTexts::
trainerslidein BS_FAINTED
waitstate
printstring STRINGID_TRAINER2LOSETEXT
BattleScript_LocalBattleWonBP::
getmoneyreward
printstring STRINGID_PLAYERGOTBP
waitmessage B_WAIT_TIME_LONG
end2
BattleScript_LocalBattleWonReward::
jumpifbyte CMP_EQUAL, gSpecialVar_0x8003, 1, BattleScript_LocalBattleWonBP
getmoneyreward
printstring STRINGID_PLAYERGOTMONEY
waitmessage B_WAIT_TIME_LONG
Expand Down
1 change: 1 addition & 0 deletions include/config/overworld.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
#define OW_FLAG_NO_COLLISION 0 // If this flag is set, the player will be able to walk over tiles with collision. Mainly intended for debugging purposes.

#define BATTLE_PYRAMID_RANDOM_ENCOUNTERS FALSE // If set to TRUE, battle pyramid Pokemon will be generated randomly based on the round's challenge instead of hardcoded in src/data/battle_frontier/battle_pyramid_level_50_wild_mons.h (or open_level_wild_mons.h)
#define BATTLE_FRONTIER_INTRO_FOR_BP_FIGHTS FALSE // If set to TRUE, battle frontier intros will be played before a fight where a player can earn BP

// Map pop-up config
#define OW_POPUP_GENERATION GEN_3 // Different generations display location names in overworld pop-ups differently.
Expand Down
3 changes: 2 additions & 1 deletion include/constants/battle_string_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -712,8 +712,9 @@
#define STRINGID_FOGLIFTED 710
#define STRINGID_PKMNMADESHELLGLEAM 711
#define STRINGID_FICKLEBEAMDOUBLED 712
#define STRINGID_PLAYERGOTBP 713

#define BATTLESTRINGS_COUNT 713
#define BATTLESTRINGS_COUNT 714

// This is the string id that gBattleStringsTable starts with.
// String ids before this (e.g. STRINGID_INTROMSG) are not in the table,
Expand Down
1 change: 1 addition & 0 deletions include/field_specials.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ void ResetFanClub(void);
bool8 ShouldShowBoxWasFullMessage(void);
void SetPCBoxToSendMon(u8 boxId);
void PreparePartyForSkyBattle(void);
void GiveFrontierBattlePoints(void);

#endif // GUARD_FIELD_SPECIALS_H
2 changes: 2 additions & 0 deletions src/battle_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ static const u8 sText_ItDoesntAffect[] = _("It doesn't affect\n{B_DEF_NAME_WITH_
static const u8 sText_AttackerFainted[] = _("{B_ATK_NAME_WITH_PREFIX}\nfainted!\p");
static const u8 sText_TargetFainted[] = _("{B_DEF_NAME_WITH_PREFIX}\nfainted!\p");
static const u8 sText_PlayerGotMoney[] = _("{B_PLAYER_NAME} got ¥{B_BUFF1}\nfor winning!\p");
static const u8 sText_PlayerGotBP[] = _("{B_PLAYER_NAME} got {B_BUFF1} Battle Point(s)\nfor winning!\p");
static const u8 sText_PlayerLostToEnemyTrainer[] = _("{B_PLAYER_NAME} is out of\nusable POKéMON!\pPlayer lost against\n{B_TRAINER1_CLASS} {B_TRAINER1_NAME}!{PAUSE_UNTIL_PRESS}");
static const u8 sText_PlayerPaidPrizeMoney[] = _("{B_PLAYER_NAME} paid ¥{B_BUFF1} as the prize\nmoney…\p… … … …\p{B_PLAYER_NAME} whited out!{PAUSE_UNTIL_PRESS}");
static const u8 sText_PlayerWhiteout[] = _("{B_PLAYER_NAME} is out of\nusable POKéMON!\p");
Expand Down Expand Up @@ -1018,6 +1019,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
[STRINGID_ATTACKERFAINTED - BATTLESTRINGS_TABLE_START] = sText_AttackerFainted,
[STRINGID_TARGETFAINTED - BATTLESTRINGS_TABLE_START] = sText_TargetFainted,
[STRINGID_PLAYERGOTMONEY - BATTLESTRINGS_TABLE_START] = sText_PlayerGotMoney,
[STRINGID_PLAYERGOTBP - BATTLESTRINGS_TABLE_START] = sText_PlayerGotBP,
[STRINGID_PLAYERWHITEOUT - BATTLESTRINGS_TABLE_START] = sText_PlayerWhiteout,
[STRINGID_PLAYERWHITEOUT2 - BATTLESTRINGS_TABLE_START] = sText_PlayerWhiteout2,
[STRINGID_PREVENTSESCAPE - BATTLESTRINGS_TABLE_START] = sText_PreventsEscape,
Expand Down
27 changes: 21 additions & 6 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -7754,13 +7754,22 @@ static void Cmd_getmoneyreward(void)

u32 money;
u8 sPartyLevel = 1;
u8 b_buff_number = 5;

if (gBattleOutcome == B_OUTCOME_WON)
{
money = GetTrainerMoneyToGive(gTrainerBattleOpponent_A);
if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
money += GetTrainerMoneyToGive(gTrainerBattleOpponent_B);
AddMoney(&gSaveBlock1Ptr->money, money);
{
if (VarGet(gSpecialVar_0x8003) == 1)
{
money = gSpecialVar_0x8004;
b_buff_number = 3;
GiveFrontierBattlePoints();
}
else{
money = GetTrainerMoneyToGive(gTrainerBattleOpponent_A);
if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
money += GetTrainerMoneyToGive(gTrainerBattleOpponent_B);
AddMoney(&gSaveBlock1Ptr->money, money);
}
}
else
{
Expand All @@ -7782,8 +7791,14 @@ static void Cmd_getmoneyreward(void)
money = sWhiteOutBadgeMoney[count] * sPartyLevel;
RemoveMoney(&gSaveBlock1Ptr->money, money);
}

if (VarGet(gSpecialVar_0x8003) == 1)
{
gSpecialVar_0x8003 = 0;
gSpecialVar_0x8004 = 0;
}

PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff1, 5, money);
PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff1, b_buff_number, money);
gBattlescriptCurrInstr = cmd->nextInstr;
}

Expand Down
3 changes: 3 additions & 0 deletions src/battle_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,9 @@ u8 GetTrainerBattleTransition(void)
u32 trainerId = SanitizeTrainerId(gTrainerBattleOpponent_A);
u32 trainerClass = GetTrainerClassFromId(gTrainerBattleOpponent_A);

if (BATTLE_FRONTIER_INTRO_FOR_BP_FIGHTS && VarGet(gSpecialVar_0x8003) == 1)
return GetSpecialBattleTransition(FRONTIER_MODE_DOUBLES);

if (DoesTrainerHaveMugshot(trainerId))
return B_TRANSITION_MUGSHOT;

Expand Down
Loading