From ce3b877666df878af14e4a025fcad0b693008a9b Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sat, 17 Oct 2020 02:33:15 -0300 Subject: [PATCH] Dive Ball config. --- include/constants/item_config.h | 1 + include/wild_encounter.h | 1 + src/battle_main.c | 1 + src/battle_script_commands.c | 9 +++++++-- src/wild_encounter.c | 2 ++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/constants/item_config.h b/include/constants/item_config.h index f9524e577595..bd3cc87f1ff5 100644 --- a/include/constants/item_config.h +++ b/include/constants/item_config.h @@ -25,5 +25,6 @@ #define P_NEST_BALL_MODIFIER GEN_7 // Nest Ball's formula varies depending on the Gen. See Cmd_handleballthrow. #define P_REPEAT_BALL_MODIFIER GEN_7 // In Gen7+, Net Ball's catch multiplier is x3.5 instead of x3. #define P_TIMER_BALL_MODIFIER GEN_7 // In Gen5+, Timer Ball's effectiveness increases by x0.3 per turn instead of x0.1 +#define P_DIVE_BALL_MODIFIER GEN_3 // In Gen4+, Dive Ball's effectiveness increases by when Surfing or Fishing. #endif // GUARD_CONSTANTS_ITEM_CONFIG_H diff --git a/include/wild_encounter.h b/include/wild_encounter.h index a9479d34dba8..626eee468c2b 100644 --- a/include/wild_encounter.h +++ b/include/wild_encounter.h @@ -30,6 +30,7 @@ struct WildPokemonHeader }; extern bool8 gIsFishingEncounter; +extern bool8 gIsSurfingEncounter; extern const struct WildPokemonHeader gWildMonHeaders[]; diff --git a/src/battle_main.c b/src/battle_main.c index c050616567a1..ccbdafebf866 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -5073,6 +5073,7 @@ static void FreeResetData_ReturnToOvOrDoEvolutions(void) if (!gPaletteFade.active) { gIsFishingEncounter = FALSE; + gIsSurfingEncounter = FALSE; ResetSpriteData(); if (gLeveledUpInBattle == 0 || gBattleOutcome != B_OUTCOME_WON) { diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index a5895cbc734c..39194911cab8 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9793,8 +9793,13 @@ static void Cmd_handleballthrow(void) #endif break; case ITEM_DIVE_BALL: - if (GetCurrentMapType() == MAP_TYPE_UNDERWATER) - ballMultiplier = 35; + #if P_DIVE_BALL_MODIFIER >= GEN_4 + if (GetCurrentMapType() == MAP_TYPE_UNDERWATER || gIsFishingEncounter || gIsSurfingEncounter) + ballMultiplier = 35; + #else + if (GetCurrentMapType() == MAP_TYPE_UNDERWATER) + ballMultiplier = 35; + #endif break; case ITEM_NEST_BALL: #if P_NEST_BALL_MODIFIER >= GEN_6 diff --git a/src/wild_encounter.c b/src/wild_encounter.c index 6ef4987f2430..7d8edca4c48c 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -39,6 +39,7 @@ static bool8 IsAbilityAllowingEncounter(u8 level); // EWRAM vars EWRAM_DATA static u8 sWildEncountersDisabled = 0; EWRAM_DATA bool8 gIsFishingEncounter = 0; +EWRAM_DATA bool8 gIsSurfingEncounter = 0; EWRAM_DATA static u32 sFeebasRngValue = 0; #include "data/wild_encounters.h" @@ -615,6 +616,7 @@ bool8 StandardWildEncounter(u16 currMetaTileBehavior, u16 previousMetaTileBehavi { if (TryGenerateWildMon(gWildMonHeaders[headerId].waterMonsInfo, WILD_AREA_WATER, WILD_CHECK_REPEL | WILD_CHECK_KEEN_EYE) == TRUE) { + gIsSurfingEncounter = TRUE; BattleSetup_StartWildBattle(); return TRUE; }