From b7706f1b995c9c248d060a86e6aed2cd155908e4 Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Thu, 10 Jun 2021 21:59:13 -0700 Subject: [PATCH] Remove ball catch rate modifier effects. --- include/constants/item_config.h | 12 -- include/wild_encounter.h | 3 - src/battle_main.c | 3 - src/battle_script_commands.c | 206 ++++---------------------------- src/wild_encounter.c | 4 - 5 files changed, 24 insertions(+), 204 deletions(-) diff --git a/include/constants/item_config.h b/include/constants/item_config.h index 0311491e6..f510cba16 100644 --- a/include/constants/item_config.h +++ b/include/constants/item_config.h @@ -16,16 +16,4 @@ #define I_KEY_ESCAPE_ROPE GEN_7 // In Gen8, Escape Rope became a Key Item. Keep in mind, this will make it free to buy in marts. #define I_LEGACY_HEALING_ITEMS GEN_7 // In Gen7+, certain healing items recover less HP than they used to. -// Ball config -#define I_LURE_BALL_MODIFIER GEN_7 // In Gen7+, Lure Ball's catch multiplier is x5 instead of x3. -#define I_NET_BALL_MODIFIER GEN_7 // In Gen7+, Net Ball's catch multiplier is x5 instead of x3. -#define I_REPEAT_BALL_MODIFIER GEN_7 // In Gen7+, Repeat Ball's catch multiplier is x3.5 instead of x3. -#define I_DUSK_BALL_MODIFIER GEN_7 // In Gen7+, Dusk Ball's catch multiplier is x3 instead of x3.5. -#define I_QUICK_BALL_MODIFIER GEN_7 // In Gen5+, Quick Ball's catch multiplier is x5 instead of x4. -#define I_DREAM_BALL_MODIFIER GEN_8 // In Gen8+, Dream Ball's catch multiplier is x4 when the target is asleep. -#define I_TIMER_BALL_MODIFIER GEN_7 // In Gen5+, Timer Ball's effectiveness increases by x0.3 per turn instead of x0.1 -#define I_DIVE_BALL_MODIFIER GEN_7 // In Gen4+, Dive Ball's effectiveness increases by when Surfing or Fishing. -#define I_HEAVY_BALL_MODIFIER GEN_7 // In Gen7+, Heavy Ball's ranges change. See Cmd_handleballthrow. -#define I_NEST_BALL_MODIFIER GEN_7 // Nest Ball's formula varies depending on the Gen. See Cmd_handleballthrow. - #endif // GUARD_CONSTANTS_ITEM_CONFIG_H diff --git a/include/wild_encounter.h b/include/wild_encounter.h index 626eee468..55bbaa7dd 100644 --- a/include/wild_encounter.h +++ b/include/wild_encounter.h @@ -29,9 +29,6 @@ struct WildPokemonHeader const struct WildPokemonInfo *fishingMonsInfo; }; -extern bool8 gIsFishingEncounter; -extern bool8 gIsSurfingEncounter; - extern const struct WildPokemonHeader gWildMonHeaders[]; void DisableWildEncounters(bool8 disabled); diff --git a/src/battle_main.c b/src/battle_main.c index cf1e4a0f9..001e2ec17 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -48,7 +48,6 @@ #include "trig.h" #include "tv.h" #include "util.h" -#include "wild_encounter.h" #include "window.h" #include "constants/abilities.h" #include "constants/battle_move_effects.h" @@ -5073,8 +5072,6 @@ 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 6b1ada4b2..15e44dd75 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -41,8 +41,6 @@ #include "constants/battle_string_ids.h" #include "battle_setup.h" #include "overworld.h" -#include "wild_encounter.h" -#include "rtc.h" #include "party_menu.h" #include "battle_arena.h" #include "battle_pike.h" @@ -55,7 +53,6 @@ #include "data.h" #include "constants/party_menu.h" -extern struct Evolution gEvolutionTable[][EVOS_PER_MON]; extern struct MusicPlayerInfo gMPlayInfo_BGM; extern const u8* const gBattleScriptsForMoveEffects[]; @@ -9757,8 +9754,7 @@ static void Cmd_removelightscreenreflect(void) // brick break static void Cmd_handleballthrow(void) { - u8 ballMultiplier = 10; - s8 ballAddition = 0; + u8 ballMultiplier = 0; if (gBattleControllerExecFlags) return; @@ -9780,7 +9776,7 @@ static void Cmd_handleballthrow(void) } else { - u32 odds, i; + u32 odds; u8 catchRate; if (gLastUsedItem == ITEM_SAFARI_BALL) @@ -9788,201 +9784,55 @@ static void Cmd_handleballthrow(void) else catchRate = gBaseStats[gBattleMons[gBattlerTarget].species].catchRate; - - #ifdef POKEMON_EXPANSION - if (gBaseStats[gBattleMons[gBattlerTarget].species].flags & F_ULTRA_BEAST) - { - if (gLastUsedItem == ITEM_BEAST_BALL) - ballMultiplier = 50; - else - ballMultiplier = 1; - } - else - { - #endif - if (gLastUsedItem > ITEM_SAFARI_BALL) { switch (gLastUsedItem) { case ITEM_NET_BALL: if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_WATER) || IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_BUG)) - #if I_NET_BALL_MODIFIER >= GEN_7 - ballMultiplier = 50; - #else - ballMultiplier = 30; - #endif + ballMultiplier = 30; + else + ballMultiplier = 10; break; case ITEM_DIVE_BALL: - #if I_DIVE_BALL_MODIFIER >= GEN_4 - if (GetCurrentMapType() == MAP_TYPE_UNDERWATER || gIsFishingEncounter || gIsSurfingEncounter) - ballMultiplier = 35; - #else - if (GetCurrentMapType() == MAP_TYPE_UNDERWATER) - ballMultiplier = 35; - #endif + if (GetCurrentMapType() == MAP_TYPE_UNDERWATER) + ballMultiplier = 35; + else + ballMultiplier = 10; break; case ITEM_NEST_BALL: - #if I_NEST_BALL_MODIFIER >= GEN_6 - //((41 - Pokémon's level) ÷ 10)× if Pokémon's level is between 1 and 29, 1× otherwise. - if (gBattleMons[gBattlerTarget].level < 30) - ballMultiplier = 41 - gBattleMons[gBattlerTarget].level; - #elif I_NEST_BALL_MODIFIER == GEN_5 - //((41 - Pokémon's level) ÷ 10)×, minimum 1× - if (gBattleMons[gBattlerTarget].level < 31) - ballMultiplier = 41 - gBattleMons[gBattlerTarget].level; - #else - //((40 - Pokémon's level) ÷ 10)×, minimum 1× - if (gBattleMons[gBattlerTarget].level < 40) - { - ballMultiplier = 40 - gBattleMons[gBattlerTarget].level; - if (ballMultiplier <= 9) - ballMultiplier = 10; - } - #endif + if (gBattleMons[gBattlerTarget].level < 40) + { + ballMultiplier = 40 - gBattleMons[gBattlerTarget].level; + if (ballMultiplier <= 9) + ballMultiplier = 10; + } + else + { + ballMultiplier = 10; + } break; case ITEM_REPEAT_BALL: if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gBattlerTarget].species), FLAG_GET_CAUGHT)) - #if I_REPEAT_BALL_MODIFIER >= GEN_7 - ballMultiplier = 35; - #else - ballMultiplier = 30; - #endif + ballMultiplier = 30; + else + ballMultiplier = 10; break; case ITEM_TIMER_BALL: - #if I_TIMER_BALL_MODIFIER >= GEN_5 - ballMultiplier = (gBattleResults.battleTurnCounter * 3) + 10; - #else - ballMultiplier = gBattleResults.battleTurnCounter + 10; - #endif + ballMultiplier = gBattleResults.battleTurnCounter + 10; if (ballMultiplier > 40) ballMultiplier = 40; break; case ITEM_LUXURY_BALL: case ITEM_PREMIER_BALL: - case ITEM_FRIEND_BALL: - case ITEM_HEAL_BALL: - case ITEM_CHERISH_BALL: ballMultiplier = 10; break; - case ITEM_SPORT_BALL: - ballMultiplier = 15; - break; - case ITEM_LEVEL_BALL: - if (gBattleMons[gBattlerAttacker].level >= 4 * gBattleMons[gBattlerTarget].level) - ballMultiplier = 80; - else if (gBattleMons[gBattlerAttacker].level > 2 * gBattleMons[gBattlerTarget].level) - ballMultiplier = 40; - else if (gBattleMons[gBattlerAttacker].level > gBattleMons[gBattlerTarget].level) - ballMultiplier = 20; - break; - case ITEM_LURE_BALL: - if (gIsFishingEncounter) - #if I_LURE_BALL_MODIFIER >= GEN_7 - ballMultiplier = 50; - #else - ballMultiplier = 30; - #endif - break; - case ITEM_MOON_BALL: - for (i = 0; i < EVOS_PER_MON; i++) - { - if (gEvolutionTable[gBattleMons[gBattlerTarget].species][i].method == EVO_ITEM - && gEvolutionTable[gBattleMons[gBattlerTarget].species][i].param == ITEM_MOON_STONE) - ballMultiplier = 40; - } - break; - case ITEM_LOVE_BALL: - if (gBattleMons[gBattlerTarget].species == gBattleMons[gBattlerAttacker].species) - { - u8 gender1 = GetMonGender(&gEnemyParty[gBattlerPartyIndexes[gBattlerTarget]]); - u8 gender2 = GetMonGender(&gPlayerParty[gBattlerPartyIndexes[gBattlerAttacker]]); - - if (gender1 != gender2 && gender1 != MON_GENDERLESS && gender2 != MON_GENDERLESS) - ballMultiplier = 80; - } - break; - case ITEM_HEAVY_BALL: - i = GetPokedexHeightWeight(SpeciesToNationalPokedexNum(gBattleMons[gBattlerTarget].species), 1); - #if I_HEAVY_BALL_MODIFIER >= GEN_7 - if (i < 1000) - ballAddition = -20; - else if (i < 2000) - ballAddition = 0; - else if (i < 3000) - ballAddition = 20; - else - ballAddition = 30; - #elif I_HEAVY_BALL_MODIFIER >= GEN_4 - if (i < 2048) - ballAddition = -20; - else if (i < 3072) - ballAddition = 20; - else if (i < 4096) - ballAddition = 30; - else - ballAddition = 40; - #else - if (i < 1024) - ballAddition = -20; - else if (i < 2048) - ballAddition = 0; - else if (i < 3072) - ballAddition = 20; - else if (i < 4096) - ballAddition = 30; - else - ballAddition = 40; - #endif - break; - case ITEM_FAST_BALL: - if (gBaseStats[gBattleMons[gBattlerTarget].species].baseSpeed >= 100) - ballMultiplier = 40; - break; - case ITEM_QUICK_BALL: - if (gBattleResults.battleTurnCounter == 0) - #if I_QUICK_BALL_MODIFIER >= GEN_5 - ballMultiplier = 50; - #else - ballMultiplier = 40; - #endif - break; - case ITEM_DUSK_BALL: - RtcCalcLocalTime(); - if ((gLocalTime.hours >= 20 && gLocalTime.hours <= 3) || gMapHeader.cave || gMapHeader.mapType == MAP_TYPE_UNDERGROUND) - #if I_DUSK_BALL_MODIFIER >= GEN_7 - ballMultiplier = 30; - #else - ballMultiplier = 35; - #endif - break; - case ITEM_DREAM_BALL: - #if I_DREAM_BALL_MODIFIER >= GEN_8 - if (gBattleMons[gBattlerTarget].status1 & STATUS1_SLEEP) - ballMultiplier = 40; - #else - ballMultiplier = 10; - #endif - break; - case ITEM_BEAST_BALL: - ballMultiplier = 1; - break; } } else ballMultiplier = sBallCatchBonuses[gLastUsedItem - ITEM_ULTRA_BALL]; - #ifdef POKEMON_EXPANSION - } - #endif - - // catchRate is unsigned, which means that it may potentially overflow if sum is applied directly. - if (catchRate < 21 && ballAddition == -20) - catchRate = 1; - else - catchRate = catchRate + ballAddition; - - odds = ((catchRate) * ballMultiplier / 10) + odds = (catchRate * ballMultiplier / 10) * (gBattleMons[gBattlerTarget].maxHP * 3 - gBattleMons[gBattlerTarget].hp * 2) / (3 * gBattleMons[gBattlerTarget].maxHP); @@ -10040,14 +9890,6 @@ static void Cmd_handleballthrow(void) gBattleCommunication[MULTISTRING_CHOOSER] = 0; else gBattleCommunication[MULTISTRING_CHOOSER] = 1; - - if (gLastUsedItem == ITEM_HEAL_BALL) - { - MonRestorePP(&gEnemyParty[gBattlerPartyIndexes[gBattlerTarget]]); - HealStatusConditions(&gEnemyParty[gBattlerPartyIndexes[gBattlerTarget]], gBattlerPartyIndexes[gBattlerTarget], STATUS1_ANY, gBattlerTarget); - gBattleMons[gBattlerTarget].hp = gBattleMons[gBattlerTarget].maxHP; - SetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerTarget]], MON_DATA_HP, &gBattleMons[gBattlerTarget].hp); - } } else // not caught { diff --git a/src/wild_encounter.c b/src/wild_encounter.c index 83cdf72d9..767fbe4e7 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -38,8 +38,6 @@ 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" @@ -616,7 +614,6 @@ 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; } @@ -758,7 +755,6 @@ void FishingWildEncounter(u8 rod) } IncrementGameStat(GAME_STAT_FISHING_CAPTURES); SetPokemonAnglerSpecies(species); - gIsFishingEncounter = TRUE; BattleSetup_StartWildBattle(); }