fishing chain only resets on failed attempt or when map warping, encountering different species does not break the chain, differentiate between max shiny streak and max chain length

This commit is contained in:
cawtds 2024-07-06 15:18:51 +02:00
parent 3babd7f130
commit 5dda4b846e
4 changed files with 7 additions and 14 deletions

View File

@ -8,6 +8,7 @@
#define NUM_ALTERING_CAVE_TABLES 9
#define FISHING_CHAIN_LENGTH_MAX 20
#define FISHING_CHAIN_LENGTH_MAX 200
#define FISHING_CHAIN_SHINY_STREAK_MAX 20
#endif // GUARD_CONSTANTS_WILD_ENCOUNTER_H

View File

@ -67,7 +67,6 @@ const struct MapHeader *const GetMapHeaderFromConnection(const struct MapConnect
void InitMap(void)
{
gChainFishingDexNavStreak = 0;
InitMapLayoutData(&gMapHeader);
SetOccupiedSecretBaseEntranceMetatiles(gMapHeader.events);
RunOnLoadMapScript();

View File

@ -907,6 +907,7 @@ if (I_VS_SEEKER_CHARGING != 0)
RunOnTransitionMapScript();
UpdateLocationHistoryForRoamer();
MoveAllRoamersToOtherLocationSets();
gChainFishingDexNavStreak = 0;
if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_FLOOR)
InitBattlePyramidMap(FALSE);
else if (InTrainerHill())

View File

@ -51,7 +51,7 @@ enum {
static u16 FeebasRandom(void);
static void FeebasSeedRng(u16 seed);
static void UpdateChainFishingSpeciesAndStreak(u32 species);
static void UpdateChainFishingStreak();
static bool8 IsWildLevelAllowedByRepel(u8 level);
static void ApplyFluteEncounterRateMod(u32 *encRate);
static void ApplyCleanseTagEncounterRateMod(u32 *encRate);
@ -68,7 +68,6 @@ EWRAM_DATA static u32 sFeebasRngValue = 0;
EWRAM_DATA bool8 gIsFishingEncounter = 0;
EWRAM_DATA bool8 gIsSurfingEncounter = 0;
EWRAM_DATA u8 gChainFishingDexNavStreak = 0;
EWRAM_DATA static u16 sLastFishingSpecies = 0;
#include "data/wild_encounters.h"
@ -520,7 +519,7 @@ static u16 GenerateFishingWildMon(const struct WildPokemonInfo *wildMonInfo, u8
u16 wildMonSpecies = wildMonInfo->wildPokemon[wildMonIndex].species;
u8 level = ChooseWildMonLevel(wildMonInfo->wildPokemon, wildMonIndex, WILD_AREA_FISHING);
UpdateChainFishingSpeciesAndStreak(wildMonSpecies);
UpdateChainFishingStreak();
CreateWildMon(wildMonSpecies, level);
return wildMonSpecies;
}
@ -871,25 +870,18 @@ bool8 DoesCurrentMapHaveFishingMons(void)
u32 CalculateChainFishingShinyRolls(void)
{
return (2 * gChainFishingDexNavStreak);
return (2 * min(gChainFishingDexNavStreak, FISHING_CHAIN_SHINY_STREAK_MAX));
}
static void UpdateChainFishingSpeciesAndStreak(u32 species)
static void UpdateChainFishingStreak()
{
if (!I_FISHING_CHAIN)
return;
if (species != sLastFishingSpecies)
{
gChainFishingDexNavStreak = 0;
return;
}
if (gChainFishingDexNavStreak >= FISHING_CHAIN_LENGTH_MAX)
return;
gChainFishingDexNavStreak++;
sLastFishingSpecies = species;
}
void FishingWildEncounter(u8 rod)