Skip to content

Commit

Permalink
Dive Ball config.
Browse files Browse the repository at this point in the history
  • Loading branch information
AsparagusEduardo committed Oct 17, 2020
1 parent 14c243b commit ce3b877
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/constants/item_config.h
Expand Up @@ -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
1 change: 1 addition & 0 deletions include/wild_encounter.h
Expand Up @@ -30,6 +30,7 @@ struct WildPokemonHeader
};

extern bool8 gIsFishingEncounter;
extern bool8 gIsSurfingEncounter;

extern const struct WildPokemonHeader gWildMonHeaders[];

Expand Down
1 change: 1 addition & 0 deletions src/battle_main.c
Expand Up @@ -5073,6 +5073,7 @@ static void FreeResetData_ReturnToOvOrDoEvolutions(void)
if (!gPaletteFade.active)
{
gIsFishingEncounter = FALSE;
gIsSurfingEncounter = FALSE;
ResetSpriteData();
if (gLeveledUpInBattle == 0 || gBattleOutcome != B_OUTCOME_WON)
{
Expand Down
9 changes: 7 additions & 2 deletions src/battle_script_commands.c
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/wild_encounter.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit ce3b877

Please sign in to comment.