diff --git a/include/config/battle.h b/include/config/battle.h index e0bb6d548..f6fdfa3de 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -123,7 +123,7 @@ #define B_HEAL_BELL_SOUNDPROOF GEN_LATEST // In Gen5, Heal Bell affects all mons with Soundproof. In Gen6-8 it affects inactive mons, but not battlers. In Gen9 it always affects the user. // Ability settings -#define B_EXPANDED_ABILITY_NAMES FALSE // If TRUE, ability names are increased from 12 characters to 16 characters. +#define B_EXPANDED_ABILITY_NAMES TRUE // If TRUE, ability names are increased from 12 characters to 16 characters. #define B_ABILITY_WEATHER GEN_LATEST // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability. #define B_GALE_WINGS GEN_LATEST // In Gen7+ requires full HP to trigger. #define B_STANCE_CHANGE_FAIL GEN_LATEST // In Gen7+, Stance Change fails if the Pokémon is unable to use a move because of confusion, paralysis, etc. In Gen6, it doesn't. @@ -217,7 +217,7 @@ #define B_SHOW_TARGETS TRUE // If set to TRUE, all available targets, for moves hitting 2 or 3 Pokémon, will be shown before selecting a move. #define B_SHOW_CATEGORY_ICON TRUE // If set to TRUE, it will show an icon in the summary showing the move's category. #define B_HIDE_HEALTHBOX_IN_ANIMS TRUE // If set to TRUE, hides healthboxes during move animations. -#define B_EXPANDED_MOVE_NAMES FALSE // If set to FALSE, move names are decreased from 16 characters to 12 characters. +#define B_EXPANDED_MOVE_NAMES TRUE // If set to FALSE, move names are decreased from 16 characters to 12 characters. #define B_WAIT_TIME_MULTIPLIER 16 // This determines how long text pauses in battle last. Vanilla is 16. Lower values result in faster battles. #define B_QUICK_MOVE_CURSOR_TO_RUN FALSE // If set to TRUE, pushing B in the battle options against a wild encounter will move the cursor to the run option diff --git a/include/config/item.h b/include/config/item.h index 6f141e9e2..55e50e2c8 100644 --- a/include/config/item.h +++ b/include/config/item.h @@ -2,6 +2,7 @@ #define GUARD_CONFIG_ITEM_H // Item config +#define I_EXPANDED_ITEM_NAMES TRUE // If set to FALSE, item names are decreased from 20 characters to 14 characters. #define I_SHINY_CHARM_ADDITIONAL_ROLLS 2 // Amount of additional shiny rolls if the player has the Shiny Charm. Set it to 0 to disable Shiny Charm's effects. #define I_KEY_FOSSILS GEN_LATEST // In Gen4+, all Gen 3 fossils became regular items. #define I_KEY_ESCAPE_ROPE GEN_LATEST // In Gen8, Escape Rope became a Key Item. Keep in mind, this will make it free to buy in marts. @@ -11,7 +12,7 @@ #define I_BERRY_EV_JUMP GEN_LATEST // In Gen4 only, EV-lowering Berries lower a stat's EV to 100 if it is above 100. #define I_GRISEOUS_ORB_FORM_CHANGE GEN_LATEST // In Gen9+, the Griseous Orb no longer changes Giratina's form when held. #define I_GEM_BOOST_POWER GEN_LATEST // In Gen6+, the Gem boost power was reduced from 50% to 30%. -#define I_USE_EVO_HELD_ITEMS_FROM_BAG TRUE // If TRUE, items such as Razor Claw or Electirizer will be usable from the bag to evolve a Pokémon just like in LA. +#define I_USE_EVO_HELD_ITEMS_FROM_BAG FALSE // If TRUE, items such as Razor Claw or Electirizer will be usable from the bag to evolve a Pokémon just like in LA. #define I_TYPE_BOOST_POWER GEN_LATEST // In Gen4+, all regular type boosting held items had their power increased from 10% to 20%. eg. Charcoal #define I_SELL_VALUE_FRACTION GEN_LATEST // In Gen9+, items sell for 1/4 of their value instead of 1/2. #define I_PRICE GEN_LATEST // Some items have varied in value across generations. @@ -30,10 +31,15 @@ // Repel/Lure config // These two settings are both independent and complementary. -#define VAR_LAST_REPEL_LURE_USED 0 // If this var has been assigned, last Repel/Lure used will be saved and the player will get prompted with the vanilla repel YES/NO option, unless I_REPEL_LURE_MENU is set to TRUE. -#define I_REPEL_LURE_MENU FALSE // If TRUE, the player is able to choose which Repel/Lure to use once the previous one runs out. Cursor position is saved by VAR_LAST_REPEL_LURE_USED if not 0. +#define VAR_LAST_REPEL_LURE_USED 0 // If this var has been assigned, last Repel/Lure used will be saved and the player will get prompted with the vanilla repel YES/NO option, unless I_REPEL_LURE_MENU is set to TRUE. +#define I_REPEL_LURE_MENU TRUE // If TRUE, the player is able to choose which Repel/Lure to use once the previous one runs out. Cursor position is saved by VAR_LAST_REPEL_LURE_USED if not 0. // Vs. Seeker -#define I_VS_SEEKER_CHARGING TRUE // If this flag is assigned, the Vs Seeker functionality will be enabled. When the player has the Vs. Seeker, Match Call rematch functions will stop working. +#define I_VS_SEEKER_CHARGING 0 // If this flag is assigned, the Vs Seeker functionality will be enabled. When the player has the Vs. Seeker, Match Call rematch functions will stop working. + +//Fishing +#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. +#define I_FISHING_MINIGAME GEN_3 // Each generation uses a variation of reeling in Pokémon once they have been hooked. +#define I_FISHING_PROXIMITY FALSE // Introduced in XY, fishing away from other people in enclosed areas will increase the chances of a Pokémon being hooked. NOTE: This implementation is an approximation of the actual feature, as XY have not been throughoutly documented or datamined. #endif // GUARD_CONFIG_ITEM_H diff --git a/include/constants/global.h b/include/constants/global.h index 69f8b98f8..ad031ede4 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -63,7 +63,7 @@ #define CONTEST_CATEGORIES_COUNT 5 // string lengths -#define ITEM_NAME_LENGTH 14 +#define ITEM_NAME_LENGTH ((I_EXPANDED_ITEM_NAMES == TRUE) ? 20 : 14) #define ITEM_NAME_PLURAL_LENGTH ITEM_NAME_LENGTH + 2 // 2 is used for the instance where a word's suffix becomes y->ies #define POKEMON_NAME_LENGTH 10 #define POKEMON_NAME_BUFFER_SIZE max(20, POKEMON_NAME_LENGTH + 1) // Frequently used buffer size. Larger than necessary diff --git a/src/battle_main.c b/src/battle_main.c index 732a7f4cf..fdbcce2e7 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -40,6 +40,7 @@ #include "wild_encounter.h" #include "util.h" #include "constants/abilities.h" +#include "constants/battle_ai.h" #include "constants/battle_move_effects.h" #include "constants/battle_setup.h" #include "constants/hold_effects.h" @@ -3252,8 +3253,7 @@ enum static void HandleTurnActionSelectionState(void) { - u32 battler; - s32 i; + s32 i, battler; gBattleCommunication[ACTIONS_CONFIRMED_COUNT] = 0; for (battler = 0; battler < gBattlersCount; battler++) @@ -3269,7 +3269,10 @@ static void HandleTurnActionSelectionState(void) if ((gBattleTypeFlags & BATTLE_TYPE_HAS_AI || IsWildMonSmart()) && (BattlerHasAi(battler))) { - AI_DATA->mostSuitableMonId[battler] = GetMostSuitableMonToSwitchInto(battler, FALSE); + if (AI_THINKING_STRUCT->aiFlags[battler] & AI_FLAG_RISKY) // Risky AI switches aggressively even mid battle + AI_DATA->mostSuitableMonId[battler] = GetMostSuitableMonToSwitchInto(battler, TRUE); + else + AI_DATA->mostSuitableMonId[battler] = GetMostSuitableMonToSwitchInto(battler, FALSE); gBattleStruct->aiMoveOrAction[battler] = ComputeBattleAiScores(battler); } // fallthrough @@ -3376,7 +3379,7 @@ static void HandleTurnActionSelectionState(void) } if (((gBattleTypeFlags & (BATTLE_TYPE_LINK - | BATTLE_TYPE_BATTLE_TOWER + | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK)) && !gTestRunnerEnabled) @@ -3481,7 +3484,7 @@ static void HandleTurnActionSelectionState(void) gBattleCommunication[battler] = STATE_BEFORE_ACTION_CHOSEN; } else if (IsRunningFromBattleImpossible(battler) != BATTLE_RUN_SUCCESS - && gBattleResources->bufferB[battler][1] == B_ACTION_RUN) + && gBattleResources->bufferB[battler][1] == B_ACTION_RUN) { gSelectionBattleScripts[battler] = BattleScript_PrintCantEscapeFromBattle; gBattleCommunication[battler] = STATE_SELECTION_SCRIPT; @@ -3620,7 +3623,11 @@ static void HandleTurnActionSelectionState(void) } break; case STATE_WAIT_ACTION_CONFIRMED_STANDBY: - if (!(gBattleControllerExecFlags & ((gBitTable[battler]) | (0xF0000000) | (gBitTable[battler] << 4) | (gBitTable[battler] << 8) | (gBitTable[battler] << 0xC)))) + if (!(gBattleControllerExecFlags & ((gBitTable[battler]) + | (0xF << 28) + | (gBitTable[battler] << 4) + | (gBitTable[battler] << 8) + | (gBitTable[battler] << 12)))) { if (AllAtActionConfirmed()) i = TRUE; @@ -3642,8 +3649,10 @@ static void HandleTurnActionSelectionState(void) } break; case STATE_WAIT_ACTION_CONFIRMED: - if (!(gBattleControllerExecFlags & ((gBitTable[battler]) | (0xF0000000) | (gBitTable[battler] << 4) | (gBitTable[battler] << 8) | (gBitTable[battler] << 0xC)))) - ++gBattleCommunication[ACTIONS_CONFIRMED_COUNT]; + if (!(gBattleControllerExecFlags & ((gBitTable[battler]) | (0xF << 28) | (gBitTable[battler] << 4) | (gBitTable[battler] << 8) | (gBitTable[battler] << 12)))) + { + gBattleCommunication[ACTIONS_CONFIRMED_COUNT]++; + } break; case STATE_SELECTION_SCRIPT: if (*(gBattleStruct->selectionScriptFinished + battler)) @@ -3654,15 +3663,45 @@ static void HandleTurnActionSelectionState(void) { gBattlerAttacker = battler; gBattlescriptCurrInstr = gSelectionBattleScripts[battler]; - if (!(gBattleControllerExecFlags & ((gBitTable[battler]) | (0xF0000000) | (gBitTable[battler] << 4) | (gBitTable[battler] << 8) | (gBitTable[battler] << 0xC)))) + if (!(gBattleControllerExecFlags & ((gBitTable[battler]) | (0xF << 28) | (gBitTable[battler] << 4) | (gBitTable[battler] << 8) | (gBitTable[battler] << 12)))) + { gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]](); + } gSelectionBattleScripts[battler] = gBattlescriptCurrInstr; } break; case STATE_WAIT_SET_BEFORE_ACTION: - if (!(gBattleControllerExecFlags & ((gBitTable[battler]) | (0xF0000000) | (gBitTable[battler] << 4) | (gBitTable[battler] << 8) | (gBitTable[battler] << 0xC)))) + if (!(gBattleControllerExecFlags & ((gBitTable[battler]) | (0xF << 28) | (gBitTable[battler] << 4) | (gBitTable[battler] << 8) | (gBitTable[battler] << 12)))) + { gBattleCommunication[battler] = STATE_BEFORE_ACTION_CHOSEN; + } break; + // case STATE_SELECTION_SCRIPT_MAY_RUN: + // if (*(gBattleStruct->selectionScriptFinished + battler)) + // { + // if (gBattleResources->bufferB[battler][1] == B_ACTION_NOTHING_FAINTED) + // { + // gHitMarker |= HITMARKER_RUN; + // gChosenActionByBattler[battler] = B_ACTION_RUN; + // gBattleCommunication[battler] = STATE_WAIT_ACTION_CONFIRMED_STANDBY; + // } + // else + // { + // RecordedBattle_ClearBattlerAction(battler, 1); + // gBattleCommunication[battler] = *(gBattleStruct->stateIdAfterSelScript + battler); + // } + // } + // else + // { + // gBattlerAttacker = battler; + // gBattlescriptCurrInstr = gSelectionBattleScripts[battler]; + // if (!(gBattleControllerExecFlags & ((gBitTable[battler]) | (0xF << 28) | (gBitTable[battler] << 4) | (gBitTable[battler] << 8) | (gBitTable[battler] << 12)))) + // { + // gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]](); + // } + // gSelectionBattleScripts[battler] = gBattlescriptCurrInstr; + // } + // break; } } @@ -3682,7 +3721,6 @@ static void HandleTurnActionSelectionState(void) gChosenActionByBattler[GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT)] = B_ACTION_NOTHING_FAINTED; else gChosenActionByBattler[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)] = B_ACTION_NOTHING_FAINTED; - gBattleStruct->throwingPokeBall = FALSE; } gBattleMainFunc = SetActionsAndBattlersTurnOrder; diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 4c9ef0fa9..0329ab967 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -184,7 +184,7 @@ struct PokemonSummaryScreenData u8 ALIGNED(4) expPointsStrBuf[9]; u8 ALIGNED(4) expToNextLevelStrBuf[9]; - u8 ALIGNED(4) abilityNameStrBuf[13]; + u8 ALIGNED(4) abilityNameStrBuf[ABILITY_NAME_LENGTH]; u8 ALIGNED(4) abilityDescStrBuf[52]; } summary; diff --git a/test/test_runner.c b/test/test_runner.c index 2eda5e58d..2ddc58eb6 100644 --- a/test/test_runner.c +++ b/test/test_runner.c @@ -9,7 +9,7 @@ #include "test_runner.h" #include "test/test.h" -#define TIMEOUT_SECONDS 55 +#define TIMEOUT_SECONDS 70 void CB2_TestRunner(void);