summaryrefslogtreecommitdiff
path: root/src/battle_script_commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/battle_script_commands.c')
-rw-r--r--src/battle_script_commands.c111
1 files changed, 55 insertions, 56 deletions
diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c
index 8e084a46c..07ab81a02 100644
--- a/src/battle_script_commands.c
+++ b/src/battle_script_commands.c
@@ -45,6 +45,7 @@
#include "party_menu.h"
#include "battle_arena.h"
#include "battle_pike.h"
+#include "battle_pyramid.h"
extern u16 gBattle_BG1_X;
extern u16 gBattle_BG1_Y;
@@ -62,11 +63,8 @@ extern void sub_81D388C(struct Pokemon* mon, void* statStoreLocation); // pokena
extern void sub_81D3640(u8 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); // pokenav.s
extern void sub_81D3784(u8 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); // pokenav.s
extern u8* GetMonNickname(struct Pokemon* mon, u8* dst); // party_menu
-extern u8 BattleArena_ShowJudgmentWindow(u8* arg0); // battle frontier 2
extern void sub_81B8E80(u8 battlerId, u8, u8); // party menu
extern bool8 sub_81B1250(void); // ?
-extern bool8 InBattlePyramid(void);
-extern u16 GetBattlePyramidPickupItemId(void);
extern u8 sub_813B21C(void);
extern u16 get_unknown_box_id(void);
@@ -9860,71 +9858,72 @@ static void atkE4_getsecretpowereffect(void)
static void atkE5_pickup(void)
{
- if (!InBattlePike())
+ s32 i;
+ u16 species, heldItem;
+ u8 ability;
+
+ if (InBattlePike())
{
- s32 i;
- u16 species, heldItem;
- u8 ability;
- if (InBattlePyramid())
+ }
+ else if (InBattlePyramid())
+ {
+ for (i = 0; i < PARTY_SIZE; i++)
{
- for (i = 0; i < PARTY_SIZE; i++)
- {
- species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
- heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
+ species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
+ heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
- if (GetMonData(&gPlayerParty[i], MON_DATA_ALT_ABILITY))
- ability = gBaseStats[species].ability2;
- else
- ability = gBaseStats[species].ability1;
+ if (GetMonData(&gPlayerParty[i], MON_DATA_ALT_ABILITY))
+ ability = gBaseStats[species].ability2;
+ else
+ ability = gBaseStats[species].ability1;
- if (ability == ABILITY_PICKUP
- && species != 0
- && species != SPECIES_EGG
- && heldItem == ITEM_NONE
- && (Random() % 10) == 0)
- {
- heldItem = GetBattlePyramidPickupItemId();
- SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &heldItem);
- }
+ if (ability == ABILITY_PICKUP
+ && species != 0
+ && species != SPECIES_EGG
+ && heldItem == ITEM_NONE
+ && (Random() % 10) == 0)
+ {
+ heldItem = GetBattlePyramidPickupItemId();
+ SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &heldItem);
}
}
- else
+ }
+ else
+ {
+ for (i = 0; i < PARTY_SIZE; i++)
{
- for (i = 0; i < PARTY_SIZE; i++)
- {
- species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
- heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
+ species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
+ heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
- if (GetMonData(&gPlayerParty[i], MON_DATA_ALT_ABILITY))
- ability = gBaseStats[species].ability2;
- else
- ability = gBaseStats[species].ability1;
+ if (GetMonData(&gPlayerParty[i], MON_DATA_ALT_ABILITY))
+ ability = gBaseStats[species].ability2;
+ else
+ ability = gBaseStats[species].ability1;
- if (ability == ABILITY_PICKUP
- && species != 0
- && species != SPECIES_EGG
- && heldItem == ITEM_NONE
- && (Random() % 10) == 0)
- {
- s32 j;
- s32 rand = Random() % 100;
- u8 lvlDivBy10 = (GetMonData(&gPlayerParty[i], MON_DATA_LEVEL) - 1) / 10;
- if (lvlDivBy10 > 9)
- lvlDivBy10 = 9;
+ if (ability == ABILITY_PICKUP
+ && species != 0
+ && species != SPECIES_EGG
+ && heldItem == ITEM_NONE
+ && (Random() % 10) == 0)
+ {
+ s32 j;
+ s32 rand = Random() % 100;
+ u8 lvlDivBy10 = (GetMonData(&gPlayerParty[i], MON_DATA_LEVEL) - 1) / 10;
+ if (lvlDivBy10 > 9)
+ lvlDivBy10 = 9;
- for (j = 0; j < 9; j++)
+ for (j = 0; j < 9; j++)
+ {
+ if (sPickupProbabilities[j] > rand)
{
- if (sPickupProbabilities[j] > rand)
- {
- SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &sPickupItems[lvlDivBy10 + j]);
- break;
- }
- else if (rand == 99 || rand == 98)
- {
- SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &sRarePickupItems[lvlDivBy10 + (99 - rand)]);
- break;
- }
+ SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &sPickupItems[lvlDivBy10 + j]);
+ break;
+ }
+ else if (rand == 99 || rand == 98)
+ {
+ SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &sRarePickupItems[lvlDivBy10 + (99 - rand)]);
+ break;
}
}
}