Implemented Ball Fetch

This commit is contained in:
LOuroboros 2020-12-02 23:09:35 -03:00
parent 0c4c6fc778
commit 9e1d7cc827
8 changed files with 36 additions and 1 deletions

View File

@ -6165,6 +6165,11 @@ BattleScript_AttackerFormChangeEnd3::
call BattleScript_AttackerFormChange
end3
BattleScript_BallFetch::
printstring STRINGID_FETCHEDPOKEBALL
waitmessage 0x40
end3
BattleScript_TargetFormChange::
pause 0x5
copybyte gBattlerAbility, gBattlerTarget

View File

@ -827,5 +827,7 @@ extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT];
extern u8 gMultiUsePlayerCursor;
extern u8 gNumberOfMovesToChoose;
extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT];
extern bool8 gHasFetchedBall;
extern u8 gLastUsedBall;
#endif // GUARD_BATTLE_H

View File

@ -352,5 +352,6 @@ extern const u8 BattleScript_CheekPouchActivates[];
extern const u8 BattleScript_AnnounceAirLockCloudNine[];
extern const u8 BattleScript_TargetAbilityStatRaiseOnSwitchin[];
extern const u8 BattleScript_CottonDownActivates[];
extern const u8 BattleScript_BallFetch[];
#endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -558,8 +558,9 @@
#define STRINGID_AURABREAKENTERS 554
#define STRINGID_COMATOSEENTERS 555
#define STRINGID_SCREENCLEANERENTERS 556
#define STRINGID_FETCHEDPOKEBALL 557
#define BATTLESTRINGS_COUNT 557
#define BATTLESTRINGS_COUNT 558
//// multichoice message IDs
// switch in ability message

View File

@ -228,6 +228,8 @@ EWRAM_DATA u32 gFieldStatuses = 0;
EWRAM_DATA struct FieldTimer gFieldTimers = {0};
EWRAM_DATA u8 gBattlerAbility = 0;
EWRAM_DATA u16 gPartnerSpriteId = 0;
EWRAM_DATA bool8 gHasFetchedBall = FALSE;
EWRAM_DATA bool8 gLastUsedBall = 0;
// IWRAM common vars
void (*gPreBattleCallback1)(void);
@ -2886,6 +2888,9 @@ static void BattleStartClearSetData(void)
gLastUsedMove = 0;
gFieldStatuses = 0;
gHasFetchedBall = FALSE;
gLastUsedBall = 0;
gBattlerAttacker = 0;
gBattlerTarget = 0;
gBattleWeather = 0;

View File

@ -685,9 +685,11 @@ static const u8 sText_FairyAuraActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}
static const u8 sText_AuraBreakActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} reversed all\nother POKéMON's auras!");
static const u8 sText_ComatoseActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} is drowsing!");
static const u8 sText_ScreenCleanerActivates[] = _("All screens on the field were\ncleansed!");
static const u8 sText_FetchedPokeBall[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} has fetched\nyour {B_LAST_ITEM}!");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{
[STRINGID_FETCHEDPOKEBALL - 12] = sText_FetchedPokeBall,
[STRINGID_STATWASNOTLOWERED - 12] = sText_StatWasNotLowered,
[STRINGID_CLOAKEDINAFREEZINGLIGHT - 12] = sText_CloakedInAFreezingLight,
[STRINGID_DESTINYKNOTACTIVATES - 12] = sText_DestinyKnotActivates,

View File

@ -11990,6 +11990,11 @@ static void Cmd_handleballthrow(void)
}
else // not caught
{
if (!gHasFetchedBall)
{
gLastUsedBall = gLastUsedItem;
gBattleResults.catchAttempts[gLastUsedBall]++;
}
if (IsCriticalCapture())
gBattleCommunication[MULTISTRING_CHOOSER] = shakes + 3;
else

View File

@ -4126,6 +4126,20 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
effect++;
}
break;
case ABILITY_BALL_FETCH:
if (gBattleMons[battler].item == ITEM_NONE
&& gBattleResults.catchAttempts[gLastUsedBall] >= 1
&& !gHasFetchedBall)
{
gBattleScripting.battler = battler;
BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gLastUsedBall);
MarkBattlerForControllerExec(battler);
gHasFetchedBall = TRUE;
gLastUsedItem = gLastUsedBall;
BattleScriptPushCursorAndCallback(BattleScript_BallFetch);
effect++;
}
break;
}
}
break;