summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorghoulslash <41651341+ghoulslash@users.noreply.github.com>2020-09-29 15:49:59 -0600
committerghoulslash <41651341+ghoulslash@users.noreply.github.com>2020-09-29 15:49:59 -0600
commit8bfe136b64b2ab0f7a2a3195d3bd55bd7e15c3fe (patch)
tree5dd530a3ca4d937a05ecea73cfb0555c3f2f9f81
parent3ce160d31b23a73374a0b192d6c85e01999a6bd8 (diff)
Created Chain Fishing (markdown)
-rw-r--r--Chain-Fishing.md107
1 files changed, 107 insertions, 0 deletions
diff --git a/Chain-Fishing.md b/Chain-Fishing.md
new file mode 100644
index 0000000..62a38d6
--- /dev/null
+++ b/Chain-Fishing.md
@@ -0,0 +1,107 @@
+## Chain Fishing
+
+This adds the chain fishing feature to emerald, where reeling in consecutive pokemon species increases the number of chances of it being shiny by up to 41 total times `(1 + 2 * streak)`
+
+### Open [src/wild_encounter.c](../blob/master/src/wild_encounter.c)
+**1.** We need 3 new EWRAM_DATA variables:
+```diff
++ EWRAM_DATA u8 gChainFishingStreak = 0;
++ EWRAM_DATA static u16 sLastFishingSpecies = 0;
++ EWRAM_DATA bool8 gIsFishingEncounter = FALSE; //same as in dizzyegg's item expansion repo
+```
+**2.** Add the non-static EWRAM_DATA variables to [include/wild_encounter.h](../blob/master/include/wild_encounter.h):
+```diff
++ extern u8 gChainFishingStreak;
++ extern bool8 gIsFishingEncounter;
+```
+
+**3.** Find the function `FishingWildEncounter` and make the following edits
+```diff
+void FishingWildEncounter(u8 rod)
+{
+ u16 species;
+
++ gIsFishingEncounter = TRUE; //must be set before mon is created
+ if (CheckFeebas() == TRUE)
+ {
+ u8 level = ChooseWildMonLevel(&gWildFeebasRoute119Data);
+ species = gWildFeebasRoute119Data.species;
+ CreateWildMon(species, level);
+ }
+ else
+ {
+ species = GenerateFishingWildMon(gWildMonHeaders[GetCurrentMapWildMonHeaderId()].fishingMonsInfo, rod);
+ }
+
++ if (species == sLastFishingSpecies && gChainFishingStreak < MAX_CHAIN_FISHING_STREAK)
++ gChainFishingStreak++;
++ else
++ gChainFishingStreak = 0; //reeling in different species resets chain fish counter
++
++ sLastFishingSpecies = species;
+ IncrementGameStat(GAME_STAT_FISHING_CAPTURES);
+ SetPokemonAnglerSpecies(species);
+ BattleSetup_StartWildBattle();
+```
+**4.** Reset the chain counter
+- Open [src/battle_main.c](../blob/master/src/battle_main.c)
+- - add `#include "wild_encounter.h"` to the top
+- - find the function, `FreeResetData_ReturnToOvOrDoEvolutions` and change to the following:
+```diff
+ if (!gPaletteFade.active)
+ {
++ gIsFishingEncounter = FALSE;
+ ResetSpriteData();
+ //etc
+```
+- Open [src/field_player_avatar.c](../blob/master/src/field_player_avatar.c)
+- - At the top of the functions `Fishing_NotEvenNibble` and `Fishing_GotAway`, add the following:
+```c
+gChainFishingStreak = 0;
+```
+- Open [src/fieldmap.c](../blob/master/src/fieldmap.c)
+- - add `#include "wild_encounter.h"` to the top
+- - find the function `InitMap` and add the following to the top to reset when the player changes maps
+```c
+gChainFishingStreak = 0;
+```
+**5.** Increase the shiny rate
+- Open [src/pokemon.c](../blob/master/src/pokemon.c)
+- add `#include "wild_encounter.h"` to the top
+- Find the function `CreateBoxMon`
+- define `u32 shinyValue;` at the top
+- remove Line 2207, `SetBoxMonData(boxMon, MON_DATA_PERSONALITY, &personality);`
+- edit the personality generation section underneath `else //Player is the OT` to:
+```diff
+ else //Player is the OT
+ {
++ u32 rolls = 0;
++ u32 shinyRolls = 0;
+
+ value = gSaveBlock2Ptr->playerTrainerId[0]
+ | (gSaveBlock2Ptr->playerTrainerId[1] << 8)
+ | (gSaveBlock2Ptr->playerTrainerId[2] << 16)
+ | (gSaveBlock2Ptr->playerTrainerId[3] << 24);
+
++ #ifdef ITEM_SHINY_CHARM
++ if (CheckBagHasItem(ITEM_SHINY_CHARM, 1))
++ shinyRolls += 3; //if you have the shiny charm, add 3 more rolls
++ #endif
++
++ if (gIsFishingEncounter)
++ shinyRolls += 1 + 2 * gChainFishingStreak; //1 + 2 rolls per streak count. max 41
++
++ if (shinyRolls)
++ {
++ do {
++ personality = Random32();
++ shinyValue = HIHALF(value) ^ LOHALF(value) ^ HIHALF(personality) ^ LOHALF(personality);
++ rolls++;
++ } while (shinyValue >= SHINY_ODDS && rolls < shinyRolls);
+ }
+ }
+
++ SetBoxMonData(boxMon, MON_DATA_PERSONALITY, &personality);
+ SetBoxMonData(boxMon, MON_DATA_OT_ID, &value);
+ //etc...
+```