From 058bf58b7b6d0e1eb623254bac611b6ee2d15cdb Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Sun, 26 Jan 2025 15:39:14 -0600 Subject: [PATCH] Match current gen behavior for battle environment after fishing (#6099) --- include/config/item.h | 1 + src/battle_setup.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/config/item.h b/include/config/item.h index dce2682959..96156b0db8 100644 --- a/include/config/item.h +++ b/include/config/item.h @@ -41,6 +41,7 @@ // Fishing #define I_FISHING_BITE_ODDS GEN_LATEST // In Gen 1 and Gen 2, the Old Rod has a 100% chance for a bite, Good Rod has a 66% chance for a bite, and Super Rod has a 50% chance for a bite. In Gen 3, all rods have a base 50% chance for a bite. In Gen 4 onwards, the Old Rod has a base 25% chance for a bite, Good Rod has a 50% chance for a bite, and Super Rod has a 75% chance for a bite. #define I_FISHING_MINIGAME GEN_3 // Each generation uses a variation of reeling in Pokémon once they have been hooked. NOTE: Only the Gen 1/2 and Gen 3 minigames are implemented right now! +#define I_FISHING_ENVIRONMENT GEN_LATEST // In Gen 3, the battle environment when fighting a hooked Pokémon is based on the tile the player is standing on. In Gen 4 onwards, the environment is based on tile that is being fished in, resulting in it usually being a water environment. #define I_FISHING_STICKY_BOOST GEN_LATEST // In Gen 3, a Pokemon with Suction Cups or Sticky Hold in the first slot of the party causes the chance for a bite to increase by about 35%. In Gen 4 onwards, it doubles the base bite chance. #define I_FISHING_FOLLOWER_BOOST FALSE // In HGSS, fishing bite odds are increased depending on the friendship of the current following Pokémon. #define I_FISHING_CHAIN FALSE // Introduced in XY, hooking the same Pokémon repeatedly will increase the odds of that mon being shiny. NOTE: This implementation is an approximation of the actual feature, as XY have not been throughoutly documented or datamined. diff --git a/src/battle_setup.c b/src/battle_setup.c index f6fa1a8e9b..96d23dc42a 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -49,6 +49,7 @@ #include "constants/trainers.h" #include "constants/trainer_hill.h" #include "constants/weather.h" +#include "wild_encounter.h" enum { TRANSITION_TYPE_NORMAL, @@ -609,7 +610,11 @@ u8 BattleSetup_GetTerrainId(void) u16 tileBehavior; s16 x, y; - PlayerGetDestCoords(&x, &y); + if (I_FISHING_ENVIRONMENT >= GEN_4 && gIsFishingEncounter) + GetXYCoordsOneStepInFrontOfPlayer(&x, &y); + else + PlayerGetDestCoords(&x, &y); + tileBehavior = MapGridGetMetatileBehaviorAt(x, y); if (MetatileBehavior_IsTallGrass(tileBehavior))