summaryrefslogtreecommitdiff
path: root/src/battle_script_commands.c
diff options
context:
space:
mode:
authorDizzyEggg <jajkodizzy@wp.pl>2018-11-17 15:30:34 +0100
committerDizzyEggg <jajkodizzy@wp.pl>2018-11-17 15:30:34 +0100
commiteb66b60f3813dda5cd6aae92401c10300b4a3515 (patch)
treedaea42ae4093a3d094aa5f17f61c0ab4b3feac33 /src/battle_script_commands.c
parent032dd251e628debd1ec7774fa42b6e7d39b3d83b (diff)
Begin battle pyramid
Diffstat (limited to 'src/battle_script_commands.c')
-rw-r--r--src/battle_script_commands.c107
1 files changed, 54 insertions, 53 deletions
diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c
index 665ee3750..920e1045b 100644
--- a/src/battle_script_commands.c
+++ b/src/battle_script_commands.c
@@ -9860,71 +9860,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 < 6; 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 < 6; 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;
}
}
}