mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Config for lost money after losing a battle
This commit is contained in:
parent
aa2b2e6a70
commit
bbf7b62ceb
@ -5936,12 +5936,30 @@ BattleScript_LocalBattleLost::
|
||||
jumpifbattletype BATTLE_TYPE_EREADER_TRAINER, BattleScript_LocalBattleLostEnd
|
||||
jumpifhalfword CMP_EQUAL, gTrainerBattleOpponent_A, TRAINER_SECRET_BASE, BattleScript_LocalBattleLostEnd
|
||||
BattleScript_LocalBattleLostPrintWhiteOut::
|
||||
.if B_WHITEOUT_MONEY >= GEN_4
|
||||
jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_LocalBattleLostEnd
|
||||
printstring STRINGID_PLAYERWHITEOUT
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
getmoneyreward
|
||||
printstring STRINGID_PLAYERWHITEOUT2
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
end2
|
||||
BattleScript_LocalBattleLostEnd::
|
||||
printstring STRINGID_PLAYERLOSTTOENEMYTRAINER
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
getmoneyreward
|
||||
printstring STRINGID_PLAYERPAIDPRIZEMONEY
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
end2
|
||||
.else
|
||||
printstring STRINGID_PLAYERWHITEOUT
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
printstring STRINGID_PLAYERWHITEOUT2
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
BattleScript_LocalBattleLostEnd::
|
||||
end2
|
||||
.endif
|
||||
|
||||
BattleScript_CheckDomeDrew::
|
||||
jumpifbyte CMP_EQUAL, gBattleOutcome, B_OUTCOME_DREW, BattleScript_LocalBattleLostEnd_
|
||||
BattleScript_LocalBattleLostPrintTrainersWinText::
|
||||
|
@ -101,6 +101,7 @@
|
||||
#define B_PARALYSIS_SPEED GEN_7 // In Gen7+, Speed is decreased by 50% instead of 75%.
|
||||
#define B_CONFUSION_SELF_DMG_CHANCE GEN_7 // In Gen7+, confusion has a 33.3% of self-damage, instead of 50%.
|
||||
#define B_MULTI_HIT_CHANCE GEN_7 // In Gen5+, multi-hit moves have different %. See Cmd_setmultihitcounter for values.
|
||||
#define B_WHITEOUT_MONEY GEN_7 // In Gen4+, the amount of money lost by losing a battle is determined by the amount of badges earned. Previously, it would cut the current money by half. (While this change was also in FRLG, for the sake of simplicity, setting this to GEN_3 will result in RSE behavior.)
|
||||
|
||||
// Exp and stat settings
|
||||
#define B_EXP_CATCH GEN_7 // In Gen6+, Pokémon get experience from catching.
|
||||
|
@ -609,8 +609,10 @@
|
||||
#define STRINGID_CANTESCAPEBECAUSEOFCURRENTMOVE 606
|
||||
#define STRINGID_NEUTRALIZINGGASENTERS 607
|
||||
#define STRINGID_NEUTRALIZINGGASOVER 608
|
||||
#define STRINGID_PLAYERLOSTTOENEMYTRAINER 609
|
||||
#define STRINGID_PLAYERPAIDPRIZEMONEY 610
|
||||
|
||||
#define BATTLESTRINGS_COUNT 609
|
||||
#define BATTLESTRINGS_COUNT 611
|
||||
|
||||
// The below IDs are all indexes into battle message tables,
|
||||
// used to determine which of a set of messages to print.
|
||||
|
@ -76,8 +76,14 @@ 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_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");
|
||||
#if B_WHITEOUT_MONEY >= GEN_4
|
||||
static const u8 sText_PlayerWhiteout2[] = _("{B_PLAYER_NAME} panicked and lost ¥{B_BUFF1}…\p… … … …\p{B_PLAYER_NAME} whited out!{PAUSE_UNTIL_PRESS}");
|
||||
#else
|
||||
static const u8 sText_PlayerWhiteout2[] = _("{B_PLAYER_NAME} whited out!{PAUSE_UNTIL_PRESS}");
|
||||
#endif
|
||||
static const u8 sText_PreventsEscape[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} prevents\nescape with {B_SCR_ACTIVE_ABILITY}!\p");
|
||||
static const u8 sText_CantEscape2[] = _("Can't escape!\p");
|
||||
static const u8 sText_AttackerCantEscape[] = _("{B_ATK_NAME_WITH_PREFIX} can't escape!");
|
||||
@ -827,6 +833,8 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
[STRINGID_ATTACKERFAINTED - 12] = sText_AttackerFainted,
|
||||
[STRINGID_TARGETFAINTED - 12] = sText_TargetFainted,
|
||||
[STRINGID_PLAYERGOTMONEY - 12] = sText_PlayerGotMoney,
|
||||
[STRINGID_PLAYERLOSTTOENEMYTRAINER - 12] = sText_PlayerLostToEnemyTrainer,
|
||||
[STRINGID_PLAYERPAIDPRIZEMONEY - 12] = sText_PlayerPaidPrizeMoney,
|
||||
[STRINGID_PLAYERWHITEOUT - 12] = sText_PlayerWhiteout,
|
||||
[STRINGID_PLAYERWHITEOUT2 - 12] = sText_PlayerWhiteout2,
|
||||
[STRINGID_PREVENTSESCAPE - 12] = sText_PreventsEscape,
|
||||
|
@ -284,6 +284,13 @@ static const u16 sTrappingMoves[] =
|
||||
MOVE_BIND, MOVE_WRAP, MOVE_FIRE_SPIN, MOVE_CLAMP, MOVE_WHIRLPOOL, MOVE_SAND_TOMB, MOVE_MAGMA_STORM, MOVE_INFESTATION, 0xFFFF
|
||||
};
|
||||
|
||||
static const u16 sBadgeFlags[8] = {
|
||||
FLAG_BADGE01_GET, FLAG_BADGE02_GET, FLAG_BADGE03_GET, FLAG_BADGE04_GET,
|
||||
FLAG_BADGE05_GET, FLAG_BADGE06_GET, FLAG_BADGE07_GET, FLAG_BADGE08_GET,
|
||||
};
|
||||
|
||||
static const u16 sWhiteOutBadgeMoney[9] = { 8, 16, 24, 36, 48, 64, 80, 100, 120 };
|
||||
|
||||
#define STAT_CHANGE_WORKED 0
|
||||
#define STAT_CHANGE_DIDNT_WORK 1
|
||||
|
||||
@ -6648,13 +6655,38 @@ static u32 GetTrainerMoneyToGive(u16 trainerId)
|
||||
|
||||
static void Cmd_getmoneyreward(void)
|
||||
{
|
||||
u32 moneyReward = GetTrainerMoneyToGive(gTrainerBattleOpponent_A);
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
|
||||
moneyReward += GetTrainerMoneyToGive(gTrainerBattleOpponent_B);
|
||||
u32 money;
|
||||
u8 sPartyLevel = 1;
|
||||
|
||||
AddMoney(&gSaveBlock1Ptr->money, moneyReward);
|
||||
PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff1, 5, moneyReward);
|
||||
if (gBattleOutcome == B_OUTCOME_WON)
|
||||
{
|
||||
money = GetTrainerMoneyToGive(gTrainerBattleOpponent_A);
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
|
||||
money += GetTrainerMoneyToGive(gTrainerBattleOpponent_B);
|
||||
AddMoney(&gSaveBlock1Ptr->money, money);
|
||||
}
|
||||
else
|
||||
{
|
||||
s32 i, count;
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) != SPECIES_NONE
|
||||
&& GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) != SPECIES_EGG)
|
||||
{
|
||||
if (GetMonData(&gPlayerParty[i], MON_DATA_LEVEL) > sPartyLevel)
|
||||
sPartyLevel = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL);
|
||||
}
|
||||
}
|
||||
for (count = 0, i = 0; i < ARRAY_COUNT(sBadgeFlags); i++)
|
||||
{
|
||||
if (FlagGet(sBadgeFlags[i]) == TRUE)
|
||||
++count;
|
||||
}
|
||||
money = sWhiteOutBadgeMoney[count] * sPartyLevel;
|
||||
RemoveMoney(&gSaveBlock1Ptr->money, money);
|
||||
}
|
||||
|
||||
PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff1, 5, money);
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
||||
|
@ -361,7 +361,9 @@ static void (*const gMovementStatusHandler[])(struct LinkPlayerObjectEvent *, st
|
||||
void DoWhiteOut(void)
|
||||
{
|
||||
ScriptContext2_RunNewScript(EventScript_WhiteOut);
|
||||
#if B_WHITEOUT_MONEY == GEN_3
|
||||
SetMoney(&gSaveBlock1Ptr->money, GetMoney(&gSaveBlock1Ptr->money) / 2);
|
||||
#endif
|
||||
HealPlayerParty();
|
||||
Overworld_ResetStateAfterWhiteOut();
|
||||
SetWarpDestinationToLastHealLocation();
|
||||
|
Loading…
Reference in New Issue
Block a user