From eb66b60f3813dda5cd6aae92401c10300b4a3515 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 17 Nov 2018 15:30:34 +0100 Subject: Begin battle pyramid --- src/battle_script_commands.c | 107 ++++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 53 deletions(-) (limited to 'src/battle_script_commands.c') 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; } } } -- cgit v1.2.3 From 4e3772328815e4b01042239c1079395018fb8f81 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 18 Nov 2018 17:52:22 +0100 Subject: Document Battle Pyramid --- src/battle_script_commands.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 920e1045b..ae397159a 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); -- cgit v1.2.3 From 1b0cfb075723af7b457ec118eca2888df449bf9e Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 18 Nov 2018 20:00:36 +0100 Subject: Party Size and Num Stats --- src/battle_script_commands.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 665ee3750..8e084a46c 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3285,7 +3285,7 @@ static void atk23_getexp(void) u16 calculatedExp; s32 viaSentIn; - for (viaSentIn = 0, i = 0; i < 6; i++) + for (viaSentIn = 0, i = 0; i < PARTY_SIZE; i++) { if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE || GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0) continue; @@ -3543,7 +3543,7 @@ static void atk24(void) } else { - for (i = 0; i < 6; i++) + for (i = 0; i < PARTY_SIZE; i++) { if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) && (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->arenaLostPlayerMons & gBitTable[i]))) @@ -3556,7 +3556,7 @@ static void atk24(void) if (HP_count == 0) gBattleOutcome |= B_OUTCOME_LOST; - for (HP_count = 0, i = 0; i < 6; i++) + for (HP_count = 0, i = 0; i < PARTY_SIZE; i++) { if (GetMonData(&gEnemyParty[i], MON_DATA_SPECIES) && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG) && (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->arenaLostOpponentMons & gBitTable[i]))) @@ -4952,7 +4952,7 @@ static void atk4D_switchindataupdate(void) if (gBattleMoves[gCurrentMove].effect == EFFECT_BATON_PASS) { - for (i = 0; i < BATTLE_STATS_NO; i++) + for (i = 0; i < NUM_BATTLE_STATS; i++) { gBattleMons[gActiveBattler].statStages[i] = oldData.statStages[i]; } @@ -7406,7 +7406,7 @@ static void atk8A_normalisebuffs(void) // haze for (i = 0; i < gBattlersCount; i++) { - for (j = 0; j < BATTLE_STATS_NO; j++) + for (j = 0; j < NUM_BATTLE_STATS; j++) gBattleMons[i].statStages[j] = 6; } @@ -9034,7 +9034,7 @@ static void atkBD_copyfoestats(void) // psych up { s32 i; - for (i = 0; i < BATTLE_STATS_NO; i++) + for (i = 0; i < NUM_BATTLE_STATS; i++) { gBattleMons[gBattlerAttacker].statStages[i] = gBattleMons[gBattlerTarget].statStages[i]; } @@ -9868,7 +9868,7 @@ static void atkE5_pickup(void) if (InBattlePyramid()) { - for (i = 0; i < 6; i++) + for (i = 0; i < PARTY_SIZE; i++) { species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); @@ -9891,7 +9891,7 @@ static void atkE5_pickup(void) } else { - for (i = 0; i < 6; i++) + for (i = 0; i < PARTY_SIZE; i++) { species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); -- cgit v1.2.3 From 72f0a079a9221e314e7eecf0e920313bf83d32ac Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Mon, 19 Nov 2018 09:28:55 -0600 Subject: Decompile all of battle_anim_utility_funcs --- src/battle_script_commands.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 07ab81a02..5bd7de072 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -47,11 +47,6 @@ #include "battle_pike.h" #include "battle_pyramid.h" -extern u16 gBattle_BG1_X; -extern u16 gBattle_BG1_Y; -extern u16 gBattle_BG2_X; -extern u16 gBattle_BG2_Y; -extern u16 gBattle_BG3_X; extern struct MusicPlayerInfo gMPlayInfo_BGM; extern const u8* const gBattleScriptsForMoveEffects[]; -- cgit v1.2.3