diff options
author | Eduardo Quezada D'Ottone <eduardo602002@gmail.com> | 2020-10-31 03:42:03 -0300 |
---|---|---|
committer | Eduardo Quezada D'Ottone <eduardo602002@gmail.com> | 2020-10-31 03:42:03 -0300 |
commit | 380e20e7c1594918e31cb0c658dc183a84e0a463 (patch) | |
tree | 312b30cbcc7d447667fbf4ac3a7b4ea8bf1e539a | |
parent | a933f4478e80ed1a8948bd2cb2eb967d2178f077 (diff) |
Created Shuckle makes Berry Juice (markdown)
-rw-r--r-- | Shuckle-makes-Berry-Juice.md | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/Shuckle-makes-Berry-Juice.md b/Shuckle-makes-Berry-Juice.md new file mode 100644 index 0000000..08dfb44 --- /dev/null +++ b/Shuckle-makes-Berry-Juice.md @@ -0,0 +1,107 @@ +In Gold, Silver and Crystal only, Shuckle could randomly make Berry Juice by holding a berry after winning a battle. +Let's implement it back! + +In `src_battle_script_commands.c`, search for the function `Cmd_pickup` and below both instances of `if (ability == ABILITY_PICKUP`, add the following block: + +```diff +static void Cmd_pickup(void) +{ + s32 i; + u16 species, heldItem; + u8 ability; + + if (InBattlePike()) + { + + } + else if (InBattlePyramid()) + { + for (i = 0; i < PARTY_SIZE; i++) + { + species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); + heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); + + if (GetMonData(&gPlayerParty[i], MON_DATA_ABILITY_NUM)) + ability = gBaseStats[species].abilities[1]; + else + ability = gBaseStats[species].abilities[0]; + + 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 if (species == SPECIES_SHUCKLE ++ && heldItem >= FIRST_BERRY_INDEX ++ && heldItem <= LAST_BERRY_INDEX) ++ { ++ if (!(Random() % 16)) ++ { ++ heldItem = ITEM_BERRY_JUICE; ++ SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &heldItem); ++ } ++ } + } + } + else + { + for (i = 0; i < PARTY_SIZE; i++) + { + species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); + heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); + + if (GetMonData(&gPlayerParty[i], MON_DATA_ABILITY_NUM)) + ability = gBaseStats[species].abilities[1]; + else + ability = gBaseStats[species].abilities[0]; + + 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 < (int)ARRAY_COUNT(sPickupProbabilities); j++) + { + 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; + } + } + } ++ else if (species == SPECIES_SHUCKLE ++ && heldItem >= FIRST_BERRY_INDEX ++ && heldItem <= LAST_BERRY_INDEX) ++ { ++ if (!(Random() % 16)) ++ { ++ heldItem = ITEM_BERRY_JUICE; ++ SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &heldItem); ++ } ++ } + } + } + + gBattlescriptCurrInstr++; +} +``` + +And that's it! + +~AsparagusEduardo |