Fix chain fishing shiny rolls (#4906)
This commit is contained in:
commit
5ccf3e2688
@ -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
|
||||
|
||||
@ -42,8 +42,6 @@ u16 GetLocalWaterMon(void);
|
||||
bool8 UpdateRepelCounter(void);
|
||||
bool8 TryDoDoubleWildBattle(void);
|
||||
bool8 StandardWildEncounter_Debug(void);
|
||||
void ResetChainFishingDexNavStreak(void);
|
||||
bool32 IsCurrentEncounterFishing(void);
|
||||
u32 CalculateChainFishingShinyRolls(void);
|
||||
|
||||
#endif // GUARD_WILD_ENCOUNTER_H
|
||||
|
||||
@ -1997,7 +1997,7 @@ static bool8 Fishing_StartEncounter(struct Task *task)
|
||||
|
||||
static bool8 Fishing_NotEvenNibble(struct Task *task)
|
||||
{
|
||||
ResetChainFishingDexNavStreak();
|
||||
gChainFishingDexNavStreak = 0;
|
||||
AlignFishingAnimationFrames();
|
||||
StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingNoCatchDirectionAnimNum(GetPlayerFacingDirection()));
|
||||
FillWindowPixelBuffer(0, PIXEL_FILL(1));
|
||||
@ -2008,7 +2008,7 @@ static bool8 Fishing_NotEvenNibble(struct Task *task)
|
||||
|
||||
static bool8 Fishing_GotAway(struct Task *task)
|
||||
{
|
||||
ResetChainFishingDexNavStreak();
|
||||
gChainFishingDexNavStreak = 0;
|
||||
AlignFishingAnimationFrames();
|
||||
StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingNoCatchDirectionAnimNum(GetPlayerFacingDirection()));
|
||||
FillWindowPixelBuffer(0, PIXEL_FILL(1));
|
||||
|
||||
@ -67,7 +67,6 @@ const struct MapHeader *const GetMapHeaderFromConnection(const struct MapConnect
|
||||
|
||||
void InitMap(void)
|
||||
{
|
||||
ResetChainFishingDexNavStreak();
|
||||
InitMapLayoutData(&gMapHeader);
|
||||
SetOccupiedSecretBaseEntranceMetatiles(gMapHeader.events);
|
||||
RunOnLoadMapScript();
|
||||
|
||||
@ -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())
|
||||
|
||||
@ -1158,7 +1158,7 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
|
||||
totalRerolls += I_SHINY_CHARM_ADDITIONAL_ROLLS;
|
||||
if (LURE_STEP_COUNT != 0)
|
||||
totalRerolls += 1;
|
||||
if (IsCurrentEncounterFishing())
|
||||
if (I_FISHING_CHAIN && gIsFishingEncounter)
|
||||
totalRerolls += CalculateChainFishingShinyRolls();
|
||||
|
||||
while (GET_SHINY_VALUE(value, personality) >= SHINY_ODDS && totalRerolls > 0)
|
||||
|
||||
@ -51,15 +51,7 @@ enum {
|
||||
|
||||
static u16 FeebasRandom(void);
|
||||
static void FeebasSeedRng(u16 seed);
|
||||
static u32 GetLastFishingSpecies(void);
|
||||
static bool32 DoesSpeciesMatchLastFishingSpecies(u32 species);
|
||||
static u32 GetCurrentChainFishingDexNavStreak(void);
|
||||
static bool32 IsChainFishingStreakAtMax(void);
|
||||
static void IncrementChainFishingDexNavStreak(void);
|
||||
static void SetEncounterFishing(void);
|
||||
static void SetLastFishingSpecies(u32 species);
|
||||
static void HandleChainFishingStreak(u32 species);
|
||||
static void UpdateChainFishingSpeciesAndStreak(u32 species);
|
||||
static void UpdateChainFishingStreak();
|
||||
static bool8 IsWildLevelAllowedByRepel(u8 level);
|
||||
static void ApplyFluteEncounterRateMod(u32 *encRate);
|
||||
static void ApplyCleanseTagEncounterRateMod(u32 *encRate);
|
||||
@ -76,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"
|
||||
|
||||
@ -528,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;
|
||||
}
|
||||
@ -877,84 +868,27 @@ bool8 DoesCurrentMapHaveFishingMons(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static u32 GetLastFishingSpecies(void)
|
||||
{
|
||||
return sLastFishingSpecies;
|
||||
}
|
||||
|
||||
static bool32 DoesSpeciesMatchLastFishingSpecies(u32 species)
|
||||
{
|
||||
return (species == GetLastFishingSpecies());
|
||||
}
|
||||
|
||||
static u32 GetCurrentChainFishingDexNavStreak(void)
|
||||
{
|
||||
return gChainFishingDexNavStreak;
|
||||
}
|
||||
|
||||
static bool32 IsChainFishingStreakAtMax(void)
|
||||
{
|
||||
return (GetCurrentChainFishingDexNavStreak() >= FISHING_CHAIN_LENGTH_MAX);
|
||||
}
|
||||
|
||||
static void IncrementChainFishingDexNavStreak(void)
|
||||
{
|
||||
gChainFishingDexNavStreak++;
|
||||
}
|
||||
|
||||
void ResetChainFishingDexNavStreak(void)
|
||||
{
|
||||
gChainFishingDexNavStreak = 0;
|
||||
}
|
||||
|
||||
bool32 IsCurrentEncounterFishing(void)
|
||||
{
|
||||
return gIsFishingEncounter;
|
||||
}
|
||||
|
||||
static void SetEncounterFishing(void)
|
||||
{
|
||||
gIsFishingEncounter = TRUE;
|
||||
}
|
||||
|
||||
u32 CalculateChainFishingShinyRolls(void)
|
||||
{
|
||||
return (1 + (2 * GetCurrentChainFishingDexNavStreak()));
|
||||
return (2 * min(gChainFishingDexNavStreak, FISHING_CHAIN_SHINY_STREAK_MAX));
|
||||
}
|
||||
|
||||
static void SetLastFishingSpecies(u32 species)
|
||||
{
|
||||
sLastFishingSpecies = species;
|
||||
}
|
||||
|
||||
static void HandleChainFishingStreak(u32 species)
|
||||
{
|
||||
if (!DoesSpeciesMatchLastFishingSpecies(species))
|
||||
{
|
||||
ResetChainFishingDexNavStreak();
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsChainFishingStreakAtMax())
|
||||
return;
|
||||
|
||||
IncrementChainFishingDexNavStreak();
|
||||
}
|
||||
|
||||
static void UpdateChainFishingSpeciesAndStreak(u32 species)
|
||||
static void UpdateChainFishingStreak()
|
||||
{
|
||||
if (!I_FISHING_CHAIN)
|
||||
return;
|
||||
|
||||
HandleChainFishingStreak(species);
|
||||
SetLastFishingSpecies(species);
|
||||
if (gChainFishingDexNavStreak >= FISHING_CHAIN_LENGTH_MAX)
|
||||
return;
|
||||
|
||||
gChainFishingDexNavStreak++;
|
||||
}
|
||||
|
||||
void FishingWildEncounter(u8 rod)
|
||||
{
|
||||
u16 species;
|
||||
|
||||
SetEncounterFishing();
|
||||
gIsFishingEncounter = TRUE;
|
||||
if (CheckFeebas() == TRUE)
|
||||
{
|
||||
u8 level = ChooseWildMonLevel(&sWildFeebas, 0, WILD_AREA_FISHING);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user