From c06029bc721119b0efd6e26c24a3f77772dfd77b Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Fri, 25 Jun 2021 13:37:59 -0600 Subject: [PATCH 01/37] add last used ball --- graphics/battle_interface/ability_pop_up.pal | 19 ++ graphics/battle_interface/last_used_ball.png | Bin 0 -> 223 bytes include/battle.h | 2 + include/battle_interface.h | 4 + include/battle_util.h | 1 + include/constants/battle_config.h | 4 + include/global.h | 3 +- include/item_use.h | 1 + src/battle_controller_player.c | 16 +- src/battle_interface.c | 181 +++++++++++++++++++ src/battle_main.c | 4 + src/battle_script_commands.c | 3 +- src/battle_util.c | 11 ++ src/item_use.c | 54 ++++-- src/new_game.c | 2 + 15 files changed, 283 insertions(+), 22 deletions(-) create mode 100644 graphics/battle_interface/ability_pop_up.pal create mode 100644 graphics/battle_interface/last_used_ball.png diff --git a/graphics/battle_interface/ability_pop_up.pal b/graphics/battle_interface/ability_pop_up.pal new file mode 100644 index 000000000..19895d0bc --- /dev/null +++ b/graphics/battle_interface/ability_pop_up.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +1 177 91 +143 129 149 +103 91 111 +79 65 85 +59 31 81 +103 89 109 +231 239 245 +249 253 255 +0 0 0 +0 0 0 +107 115 115 +74 66 82 +0 0 0 +214 214 206 +132 140 140 +0 0 0 diff --git a/graphics/battle_interface/last_used_ball.png b/graphics/battle_interface/last_used_ball.png new file mode 100644 index 0000000000000000000000000000000000000000..581569cf1bf4ce3f5cee78fcd83a7a34b149d012 GIT binary patch literal 223 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfvg8-ipSH_Le)y2(0UQw2Yj+z{f zK*sa;Uw{7n50nRj?BZfCCy?fA*Uq){^Z*&j&Z>)mRF^unv_P&x8 zS#yg)?8er2d6p7uYPU)$efU;Y`E%9Nr%yw_D=__j$HY1FVdQ&MBb@0Cx9FNdN!< literal 0 HcmV?d00001 diff --git a/include/battle.h b/include/battle.h index f009cbe7f..9a10ae77d 100644 --- a/include/battle.h +++ b/include/battle.h @@ -37,6 +37,7 @@ #define B_ACTION_CANCEL_PARTNER 12 // when choosing an action #define B_ACTION_NOTHING_FAINTED 13 // when choosing an action #define B_ACTION_DEBUG 20 +#define B_ACTION_THROW_BALL 21 // R to throw last used ball #define B_ACTION_NONE 0xFF #define MAX_TRAINER_ITEMS 4 @@ -586,6 +587,7 @@ struct BattleStruct u16 moveEffect2; // For Knock Off u16 changedSpecies[PARTY_SIZE]; // For Zygarde or future forms when multiple mons can change into the same pokemon. u8 quickClawBattlerId; + u8 ballSpriteIds[2]; // item gfx, window gfx }; #define GET_MOVE_TYPE(move, typeArg) \ diff --git a/include/battle_interface.h b/include/battle_interface.h index 0bcadaaac..c852b776a 100644 --- a/include/battle_interface.h +++ b/include/battle_interface.h @@ -93,5 +93,9 @@ u8 GetScaledHPFraction(s16 hp, s16 maxhp, u8 scale); u8 GetHPBarLevel(s16 hp, s16 maxhp); void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle); void DestroyAbilityPopUp(u8 battlerId); +bool32 CanThrowLastUsedBall(void); +void TryHideLastUsedBall(void); +void TryRestoreLastUsedBall(void); +void TryAddLastUsedBallItemSprites(void); #endif // GUARD_BATTLE_INTERFACE_H diff --git a/include/battle_util.h b/include/battle_util.h index 0bf49dadf..717017c06 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -46,6 +46,7 @@ struct TypePower extern const struct TypePower gNaturalGiftTable[]; +void HandleAction_ThrowBall(void); void HandleAction_UseMove(void); void HandleAction_Switch(void); void HandleAction_UseItem(void); diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index fe376da8d..0f878d3af 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -151,6 +151,10 @@ #define B_CRITICAL_CAPTURE TRUE // If set to TRUE, Critical Capture will be enabled. #define B_CATCHING_CHARM_BOOST 20 // % boost in Critical Capture odds if player has the Catching Charm. +// Last Used Ball +#define B_LAST_USED_BALL TRUE // If TRUE, the "last used ball" feature from Gen 7 will be implemented +#define B_LAST_USED_BALL_BUTTON R_BUTTON // If last used ball is implemented, this button (or button combo) will trigger throwing the last used ball. + // Other #define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. #define B_SLEEP_TURNS GEN_7 // In Gen5+, sleep lasts for 1-3 turns instead of 2-5 turns. diff --git a/include/global.h b/include/global.h index e6b0797e7..a5d720eda 100644 --- a/include/global.h +++ b/include/global.h @@ -490,7 +490,8 @@ struct SaveBlock2 u16 optionsBattleSceneOff:1; // whether battle animations are disabled u16 regionMapZoom:1; // whether the map is zoomed in /*0x18*/ struct Pokedex pokedex; - /*0x90*/ u8 filler_90[0x8]; + /*0x90*/ u16 lastUsedBall; + /*0x92*/ u8 filler_90[0x6]; /*0x98*/ struct Time localTimeOffset; /*0xA0*/ struct Time lastBerryTreeUpdate; /*0xA8*/ u32 gcnLinkFlags; // Read by Pokemon Colosseum/XD diff --git a/include/item_use.h b/include/item_use.h index f577f8d46..42db6ff10 100644 --- a/include/item_use.h +++ b/include/item_use.h @@ -33,5 +33,6 @@ void ItemUseInBattle_EnigmaBerry(u8); void Task_UseDigEscapeRopeOnField(u8 taskId); u8 CanUseDigOrEscapeRopeOnCurMap(void); u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId); +u32 CanThrowBall(void); #endif // GUARD_ITEM_USE_H diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 89f73ffc4..89a044275 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -249,7 +249,8 @@ static void HandleInputChooseAction(void) if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); - + TryHideLastUsedBall(); + switch (gActionSelectionCursor[gActiveBattler]) { case 0: @@ -336,6 +337,15 @@ static void HandleInputChooseAction(void) BtlController_EmitTwoReturnValues(1, B_ACTION_DEBUG, 0); PlayerBufferExecCompleted(); } + #if B_LAST_USED_BALL == TRUE + else if (JOY_NEW(B_LAST_USED_BALL_BUTTON) && CanThrowLastUsedBall()) + { + PlaySE(SE_SELECT); + TryHideLastUsedBall(); + BtlController_EmitTwoReturnValues(1, B_ACTION_THROW_BALL, 0); + PlayerBufferExecCompleted(); + } + #endif } static void UnusedEndBounceEffect(void) @@ -372,6 +382,7 @@ static void HandleInputChooseTarget(void) else BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8)); EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX); + TryHideLastUsedBall(); HideMegaTriggerSprite(); PlayerBufferExecCompleted(); } @@ -514,6 +525,7 @@ static void HandleInputShowTargets(void) else BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8)); HideMegaTriggerSprite(); + TryHideLastUsedBall(); PlayerBufferExecCompleted(); } else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59) @@ -606,6 +618,7 @@ static void HandleInputChooseMove(void) else BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8)); HideMegaTriggerSprite(); + TryHideLastUsedBall(); PlayerBufferExecCompleted(); } else if (canSelectTarget == 1) @@ -2691,6 +2704,7 @@ static void PlayerHandleChooseAction(void) for (i = 0; i < 4; i++) ActionSelectionDestroyCursorAt(i); + TryRestoreLastUsedBall(); ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0); BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo); BattlePutTextOnWindow(gDisplayedStringBattle, 1); diff --git a/src/battle_interface.c b/src/battle_interface.c index 128f342df..828b57a2f 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -27,6 +27,9 @@ #include "constants/battle_config.h" #include "data.h" #include "pokemon_summary_screen.h" +#include "item_icon.h" +#include "item_use.h" +#include "item.h" enum { // Corresponds to gHealthboxElementsGfxTable (and the tables after it) in graphics.c @@ -196,6 +199,9 @@ static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32 static void SpriteCb_AbilityPopUp(struct Sprite *sprite); static void Task_FreeAbilityPopUpGfx(u8 taskId); +static void SpriteCB_LastUsedBall(struct Sprite *sprite); +static void SpriteCB_LastUsedBallWin(struct Sprite *sprite); + // const rom data static const struct OamData sUnknown_0832C138 = { @@ -812,6 +818,9 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId) gSprites[megaIndicatorSpriteId].invisible = TRUE; } + gBattleStruct->ballSpriteIds[0] = MAX_SPRITES; + gBattleStruct->ballSpriteIds[1] = MAX_SPRITES; + return healthboxLeftSpriteId; } @@ -3128,3 +3137,175 @@ static void Task_FreeAbilityPopUpGfx(u8 taskId) DestroyTask(taskId); } } + +// last used ball +#define LAST_BALL_WINDOW_TAG 0xD721 + +static const struct OamData sOamData_LastUsedBall = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = SPRITE_SHAPE(32x32), + .x = 0, + .matrixNum = 0, + .size = SPRITE_SIZE(32x32), + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0, +}; + +static const struct SpriteTemplate sSpriteTemplate_LastUsedBallWindow = +{ + .tileTag = LAST_BALL_WINDOW_TAG, + .paletteTag = ABILITY_POP_UP_TAG, + .oam = &sOamData_LastUsedBall, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_LastUsedBallWin +}; + +static const u8 sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball.4bpp"); +static const struct SpriteSheet sSpriteSheet_LastUsedBallWindow = +{ + sLastUsedBallWindowGfx, sizeof(sLastUsedBallWindowGfx), LAST_BALL_WINDOW_TAG +}; + +#define LAST_USED_BALL_X_F 15 +#define LAST_USED_BALL_X_0 -15 +#define LAST_USED_BALL_Y 68 + +#define LAST_BALL_WIN_X_F (LAST_USED_BALL_X_F - 1) +#define LAST_BALL_WIN_X_0 (LAST_USED_BALL_X_0 - 0) +#define LAST_USED_WIN_Y (LAST_USED_BALL_Y - 8) + +#define sHide data[0] + +bool32 CanThrowLastUsedBall(void) +{ + return (!(CanThrowBall() != 0 + || (gBattleTypeFlags & BATTLE_TYPE_TRAINER) + || !CheckBagHasItem(gSaveBlock2Ptr->lastUsedBall, 1))); +} + + +void TryAddLastUsedBallItemSprites(void) +{ + if (CanThrowBall() != 0 + || (gBattleTypeFlags & BATTLE_TYPE_TRAINER) + || !CheckBagHasItem(gSaveBlock2Ptr->lastUsedBall, 1)) + return; + + // ball + if (gBattleStruct->ballSpriteIds[0] == MAX_SPRITES) + { + gBattleStruct->ballSpriteIds[0] = AddItemIconSprite(102, 102, gSaveBlock2Ptr->lastUsedBall); + gSprites[gBattleStruct->ballSpriteIds[0]].pos1.x = LAST_USED_BALL_X_0; + gSprites[gBattleStruct->ballSpriteIds[0]].pos1.y = LAST_USED_BALL_Y; + gSprites[gBattleStruct->ballSpriteIds[0]].sHide = FALSE; // restore + gSprites[gBattleStruct->ballSpriteIds[0]].callback = SpriteCB_LastUsedBall; + } + + // window + LoadSpritePalette(&sSpritePalette_AbilityPopUp); + if (GetSpriteTileStartByTag(LAST_BALL_WINDOW_TAG) == 0xFFFF) + LoadSpriteSheet(&sSpriteSheet_LastUsedBallWindow); + + if (gBattleStruct->ballSpriteIds[1] == MAX_SPRITES) + { + gBattleStruct->ballSpriteIds[1] = CreateSprite(&sSpriteTemplate_LastUsedBallWindow, + LAST_BALL_WIN_X_0, + LAST_USED_WIN_Y, 5); + gSprites[gBattleStruct->ballSpriteIds[0]].sHide = FALSE; // restore + } +} + +static void DestroyLastUsedBallWinGfx(struct Sprite *sprite) +{ + FreeSpriteTilesByTag(LAST_BALL_WINDOW_TAG); + FreeSpritePaletteByTag(ABILITY_POP_UP_TAG); + DestroySprite(sprite); + gBattleStruct->ballSpriteIds[1] = MAX_SPRITES; +} + +static void DestroyLastUsedBallGfx(struct Sprite *sprite) +{ + FreeSpriteTilesByTag(102); + FreeSpritePaletteByTag(102); + DestroySprite(sprite); + gBattleStruct->ballSpriteIds[0] = MAX_SPRITES; +} + +static void SpriteCB_LastUsedBallWin(struct Sprite *sprite) +{ + if (sprite->sHide) + { + if (sprite->pos1.x != LAST_BALL_WIN_X_0) + sprite->pos1.x--; + + if (sprite->pos1.x == LAST_BALL_WIN_X_0) + DestroyLastUsedBallWinGfx(sprite); + } + else + { + if (sprite->pos1.x != LAST_BALL_WIN_X_F) + sprite->pos1.x++; + } +} + +static void SpriteCB_LastUsedBall(struct Sprite *sprite) +{ + if (sprite->sHide) + { + if (sprite->pos1.x != LAST_USED_BALL_X_0) + sprite->pos1.x--; + + if (sprite->pos1.x == LAST_USED_BALL_X_0) + DestroyLastUsedBallGfx(sprite); + } + else + { + if (sprite->pos1.x != LAST_USED_BALL_X_F) + sprite->pos1.x++; + } +} + +static void TryHideOrRestoreLastUsedBall(u8 caseId) +{ + if (gBattleStruct->ballSpriteIds[0] == MAX_SPRITES) + return; + + switch (caseId) + { + case 0: // hide + if (gBattleStruct->ballSpriteIds[0] != MAX_SPRITES) + gSprites[gBattleStruct->ballSpriteIds[0]].sHide = TRUE; // hide + if (gBattleStruct->ballSpriteIds[1] != MAX_SPRITES) + gSprites[gBattleStruct->ballSpriteIds[1]].sHide = TRUE; // hide + break; + case 1: // restore + if (gBattleStruct->ballSpriteIds[0] != MAX_SPRITES) + gSprites[gBattleStruct->ballSpriteIds[0]].sHide = FALSE; // restore + if (gBattleStruct->ballSpriteIds[1] != MAX_SPRITES) + gSprites[gBattleStruct->ballSpriteIds[1]].sHide = FALSE; // restore + break; + } +} + +void TryHideLastUsedBall(void) +{ + TryHideOrRestoreLastUsedBall(0); +} + +void TryRestoreLastUsedBall(void) +{ + if (gBattleStruct->ballSpriteIds[0] != MAX_SPRITES) + TryHideOrRestoreLastUsedBall(1); + else + TryAddLastUsedBallItemSprites(); +} + diff --git a/src/battle_main.c b/src/battle_main.c index 9cf56abf7..2d4dfa16f 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -401,6 +401,7 @@ static void (* const sTurnActionsFuncsTable[])(void) = [B_ACTION_TRY_FINISH] = HandleAction_TryFinish, [B_ACTION_FINISHED] = HandleAction_ActionFinished, [B_ACTION_NOTHING_FAINTED] = HandleAction_NothingIsFainted, + [B_ACTION_THROW_BALL] = HandleAction_ThrowBall, }; static void (* const sEndTurnFuncsTable[])(void) = @@ -4053,6 +4054,9 @@ static void HandleTurnActionSelectionState(void) case B_ACTION_SAFARI_BALL: gBattleCommunication[gActiveBattler]++; break; + case B_ACTION_THROW_BALL: + gBattleCommunication[gActiveBattler]++; + break; case B_ACTION_SAFARI_POKEBLOCK: if ((gBattleResources->bufferB[gActiveBattler][1] | (gBattleResources->bufferB[gActiveBattler][2] << 8)) != 0) { diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index c8a393da3..f5f093cc5 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -12017,7 +12017,8 @@ static void Cmd_handleballthrow(void) { u32 odds; u8 catchRate; - + + gSaveBlock2Ptr->lastUsedBall = gLastUsedItem; if (gLastUsedItem == ITEM_SAFARI_BALL) catchRate = gBattleStruct->safariCatchFactor * 1275 / 100; else diff --git a/src/battle_util.c b/src/battle_util.c index 87f9003e0..7a86b659f 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -742,6 +742,17 @@ void HandleAction_SafariZoneBallThrow(void) gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT; } +void HandleAction_ThrowBall(void) +{ + gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber]; + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + gLastUsedItem = gSaveBlock2Ptr->lastUsedBall; + RemoveBagItem(gLastUsedItem, 1); + gBattlescriptCurrInstr = BattleScript_BallThrow; + gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT; +} + void HandleAction_ThrowPokeblock(void) { gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber]; diff --git a/src/item_use.c b/src/item_use.c index 6b1519e9b..ad7a46499 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -936,42 +936,58 @@ void ItemUseOutOfBattle_EvolutionStone(u8 taskId) SetUpItemUseCallback(taskId); } -void ItemUseInBattle_PokeBall(u8 taskId) +u32 CanThrowBall(void) { if (IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)) - && IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT))) // There are two present pokemon. + && IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT))) { - static const u8 textCantThrowPokeBall[] = _("Cannot throw a ball!\nThere are two pokemon out there!\p"); - - if (!InBattlePyramid()) - DisplayItemMessage(taskId, 1, textCantThrowPokeBall, BagMenu_InitListsMenu); - else - DisplayItemMessageInBattlePyramid(taskId, textCantThrowPokeBall, Task_CloseBattlePyramidBagMessage); + return 1; // There are two present pokemon. } else if (gBattlerInMenuId == GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT) - && IsBattlerAlive(GetBattlerAtPosition(B_POSITION_PLAYER_LEFT))) // Attempting to throw a ball with the second pokemon while both are alive. + && IsBattlerAlive(GetBattlerAtPosition(B_POSITION_PLAYER_LEFT))) { - static const u8 textCantThrowPokeBall[] = _("Cannot throw a ball!\p"); - - if (!InBattlePyramid()) - DisplayItemMessage(taskId, 1, textCantThrowPokeBall, BagMenu_InitListsMenu); - else - DisplayItemMessageInBattlePyramid(taskId, textCantThrowPokeBall, Task_CloseBattlePyramidBagMessage); + return 2; // Attempting to throw a ball with the second pokemon while both are alive. } - else if (IsPlayerPartyAndPokemonStorageFull() == FALSE) // have room for mon? + else if (IsPlayerPartyAndPokemonStorageFull() == TRUE) { + return 3; // No room for mon + } + + return 0; // usable +} + +static const u8 sText_CantThrowPokeBall_TwoMons[] = _("Cannot throw a ball!\nThere are two pokemon out there!\p"); +static const u8 sText_CantThrowPokeBall[] = _("Cannot throw a ball!\p"); +void ItemUseInBattle_PokeBall(u8 taskId) +{ + switch (CanThrowBall()) + { + case 0: // usable + default: RemoveBagItem(gSpecialVar_ItemId, 1); if (!InBattlePyramid()) Task_FadeAndCloseBagMenu(taskId); else CloseBattlePyramidBag(taskId); - } - else - { + break; + case 1: // There are two present pokemon. + if (!InBattlePyramid()) + DisplayItemMessage(taskId, 1, sText_CantThrowPokeBall_TwoMons, BagMenu_InitListsMenu); + else + DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_TwoMons, Task_CloseBattlePyramidBagMessage); + break; + case 2: // Attempting to throw a ball with the second pokemon while both are alive. + if (!InBattlePyramid()) + DisplayItemMessage(taskId, 1, sText_CantThrowPokeBall_TwoMons, BagMenu_InitListsMenu); + else + DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_TwoMons, Task_CloseBattlePyramidBagMessage); + break; + case 3: // No room for mon if (!InBattlePyramid()) DisplayItemMessage(taskId, 1, gText_BoxFull, BagMenu_InitListsMenu); else DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage); + break; } } diff --git a/src/new_game.c b/src/new_game.c index 2a950efbc..c1dd85e90 100644 --- a/src/new_game.c +++ b/src/new_game.c @@ -45,6 +45,7 @@ #include "berry_powder.h" #include "mevent.h" #include "union_room_chat.h" +#include "constants/items.h" extern const u8 EventScript_ResetAllMapFlags[]; @@ -204,6 +205,7 @@ void NewGameInitData(void) WipeTrainerNameRecords(); ResetTrainerHillResults(); ResetContestLinkResults(); + gSaveBlock2Ptr->lastUsedBall = ITEM_POKE_BALL; } static void ResetMiniGamesRecords(void) From d28ac33b0e8f350d49511257d0d5df10ae2c8352 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Sun, 4 Jul 2021 09:28:59 -0600 Subject: [PATCH 02/37] fix throw last used ball action turn order checks --- src/battle_main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/battle_main.c b/src/battle_main.c index 2d4dfa16f..6befbfbf5 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4485,7 +4485,9 @@ static void SetActionsAndBattlersTurnOrder(void) { for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { - if (gChosenActionByBattler[gActiveBattler] == B_ACTION_USE_ITEM || gChosenActionByBattler[gActiveBattler] == B_ACTION_SWITCH) + if (gChosenActionByBattler[gActiveBattler] == B_ACTION_USE_ITEM + || gChosenActionByBattler[gActiveBattler] == B_ACTION_SWITCH + || gChosenActionByBattler[gActiveBattler] == B_ACTION_THROW_BALL) { gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[gActiveBattler]; gBattlerByTurnOrder[turnOrderId] = gActiveBattler; @@ -4494,7 +4496,9 @@ static void SetActionsAndBattlersTurnOrder(void) } for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { - if (gChosenActionByBattler[gActiveBattler] != B_ACTION_USE_ITEM && gChosenActionByBattler[gActiveBattler] != B_ACTION_SWITCH) + if (gChosenActionByBattler[gActiveBattler] != B_ACTION_USE_ITEM + && gChosenActionByBattler[gActiveBattler] != B_ACTION_SWITCH + && gChosenActionByBattler[gActiveBattler] != B_ACTION_THROW_BALL) { gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[gActiveBattler]; gBattlerByTurnOrder[turnOrderId] = gActiveBattler; @@ -4510,7 +4514,9 @@ static void SetActionsAndBattlersTurnOrder(void) if (gActionsByTurnOrder[i] != B_ACTION_USE_ITEM && gActionsByTurnOrder[j] != B_ACTION_USE_ITEM && gActionsByTurnOrder[i] != B_ACTION_SWITCH - && gActionsByTurnOrder[j] != B_ACTION_SWITCH) + && gActionsByTurnOrder[j] != B_ACTION_SWITCH + && gActionsByTurnOrder[i] != B_ACTION_THROW_BALL + && gActionsByTurnOrder[j] != B_ACTION_THROW_BALL) { if (GetWhoStrikesFirst(battler1, battler2, FALSE)) SwapTurnOrder(i, j); From 542f0accf5a4f0c3dde59e6e76dca98c7ab08db6 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Sun, 4 Jul 2021 10:09:57 -0600 Subject: [PATCH 03/37] fix updating last used ball when run out of item id --- src/battle_interface.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/battle_interface.c b/src/battle_interface.c index 828b57a2f..b233627d8 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -729,6 +729,12 @@ u8 GetMegaIndicatorSpriteId(u32 healthboxSpriteId) return gSprites[spriteId].hOther_IndicatorSpriteId; } +static void InitLastUsedBallAssets(void) +{ + gBattleStruct->ballSpriteIds[0] = MAX_SPRITES; + gBattleStruct->ballSpriteIds[1] = MAX_SPRITES; +} + u8 CreateBattlerHealthboxSprites(u8 battlerId) { s16 data6 = 0; @@ -3195,6 +3201,14 @@ bool32 CanThrowLastUsedBall(void) void TryAddLastUsedBallItemSprites(void) { + if (gSaveBlock2Ptr->lastUsedBall != ITEM_NONE && !CheckBagHasItem(gSaveBlock2Ptr->lastUsedBall, 1)) + { + // we're out of the last used ball, so just set it to the first ball in the bag + // we have to compact the bag first bc it is typically only compacted when you open it + CompactItemsInBagPocket(&gBagPockets[BALLS_POCKET]); + gSaveBlock2Ptr->lastUsedBall = gBagPockets[BALLS_POCKET].itemSlots[0].itemId; + } + if (CanThrowBall() != 0 || (gBattleTypeFlags & BATTLE_TYPE_TRAINER) || !CheckBagHasItem(gSaveBlock2Ptr->lastUsedBall, 1)) From 07e3e73372eb6d625a198e07fd4a2360c5d25031 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Sun, 18 Jul 2021 11:20:51 -0600 Subject: [PATCH 04/37] fix ITEM_NONE to 0 for compilation reasons --- src/battle_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_interface.c b/src/battle_interface.c index b233627d8..1564881e4 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -3201,7 +3201,7 @@ bool32 CanThrowLastUsedBall(void) void TryAddLastUsedBallItemSprites(void) { - if (gSaveBlock2Ptr->lastUsedBall != ITEM_NONE && !CheckBagHasItem(gSaveBlock2Ptr->lastUsedBall, 1)) + if (gSaveBlock2Ptr->lastUsedBall != 0 && !CheckBagHasItem(gSaveBlock2Ptr->lastUsedBall, 1)) { // we're out of the last used ball, so just set it to the first ball in the bag // we have to compact the bag first bc it is typically only compacted when you open it From d3446123461ee5ccfdf803934189244b351b459f Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 12 Aug 2021 14:49:17 -0600 Subject: [PATCH 05/37] fix last used ball window in wild doubles --- src/battle_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_interface.c b/src/battle_interface.c index 1564881e4..28d6bc97c 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -3183,7 +3183,7 @@ static const struct SpriteSheet sSpriteSheet_LastUsedBallWindow = #define LAST_USED_BALL_X_F 15 #define LAST_USED_BALL_X_0 -15 -#define LAST_USED_BALL_Y 68 +#define LAST_USED_BALL_Y ((IsDoubleBattle()) ? 78 : 68) #define LAST_BALL_WIN_X_F (LAST_USED_BALL_X_F - 1) #define LAST_BALL_WIN_X_0 (LAST_USED_BALL_X_0 - 0) From 9e4f33d09eefca193668718d84411105257f412d Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 26 Aug 2021 16:14:05 -0300 Subject: [PATCH 06/37] Implemented Desolate Land, Primordial Sea and Delta Stream --- asm/macros/battle_script.inc | 4 + data/battle_scripts_1.s | 85 ++ include/battle_scripts.h | 7 + include/constants/battle.h | 35 +- include/constants/battle_script_commands.h | 1 + include/constants/battle_string_ids.h | 1130 ++++++++++---------- src/battle_message.c | 24 + src/battle_script_commands.c | 44 + src/battle_util.c | 54 +- 9 files changed, 807 insertions(+), 577 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 9fa3fe0c3..78938293e 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1769,6 +1769,10 @@ various \battler, VARIOUS_TRY_ACTIVATE_GRIM_NEIGH .endm + .macro trytoclearprimalweather + various BS_ATTACKER, VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER + .endm + @ helpful macros .macro setstatchanger stat:req, stages:req, down:req setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index eef725903..63c300a74 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -3664,6 +3664,9 @@ BattleScript_EffectSandstorm:: attackcanceler attackstring ppreduce + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessened + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRain + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOn setsandstorm goto BattleScript_MoveWeatherChange @@ -3866,6 +3869,9 @@ BattleScript_EffectRainDance:: attackcanceler attackstring ppreduce + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessened + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRain + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOn setrain BattleScript_MoveWeatherChange:: attackanimation @@ -3879,9 +3885,30 @@ BattleScript_EffectSunnyDay:: attackcanceler attackstring ppreduce + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessened + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRain + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOn setsunny goto BattleScript_MoveWeatherChange +BattleScript_ExtremelyHarshSunlightWasNotLessened: + pause B_WAIT_TIME_SHORT + printstring STRINGID_EXTREMELYHARSHSUNLIGHTWASNOTLESSENED + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + +BattleScript_NoReliefFromHeavyRain: + pause B_WAIT_TIME_SHORT + printstring STRINGID_NORELIEFROMHEAVYRAIN + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + +BattleScript_MysteriousAirCurrentBlowsOn: + pause B_WAIT_TIME_SHORT + printstring STRINGID_MYSTERIOUSAIRCURRENTBLOWSON + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + BattleScript_EffectDefenseUpHit:: setmoveeffect MOVE_EFFECT_DEF_PLUS_1 | MOVE_EFFECT_AFFECTS_USER goto BattleScript_EffectHit @@ -4239,6 +4266,9 @@ BattleScript_EffectHail:: attackcanceler attackstring ppreduce + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessened + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRain + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOn sethail goto BattleScript_MoveWeatherChange @@ -5240,6 +5270,9 @@ BattleScript_DoSwitchOut:: getswitchedmondata BS_ATTACKER switchindataupdate BS_ATTACKER hpthresholds BS_ATTACKER + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON hidepartystatussummary BS_ATTACKER switchinanim BS_ATTACKER, FALSE @@ -6860,6 +6893,58 @@ BattleScript_DroughtActivates:: call BattleScript_WeatherFormChanges end3 +BattleScript_DesolateLandActivates:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + printstring STRINGID_EXTREMELYHARSHSUNLIGHT + waitstate + playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES, NULL + call BattleScript_WeatherFormChanges + end3 + +BattleScript_DesolateLandEvaporatesWaterTypeMoves:: + accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE + attackstring + pause B_WAIT_TIME_SHORT + ppreduce + printstring STRINGID_MOVEEVAPORATEDINTHEHARSHSUNLIGHT + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + +BattleScript_PrimordialSeaActivates:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + printstring STRINGID_HEAVYRAIN + waitstate + playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES, NULL + call BattleScript_WeatherFormChanges + end3 + +BattleScript_PrimordialSeaFizzlesOutFireTypeMoves:: + accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE + attackstring + pause B_WAIT_TIME_SHORT + ppreduce + printstring STRINGID_MOVEFIZZLEDOUTINTHEHEAVYRAIN + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + +BattleScript_DeltaStreamActivates:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + printstring STRINGID_MYSTERIOUSAIRCURRENT + waitmessage B_WAIT_TIME_LONG + end3 + +BattleScript_AttackWeakenedByStrongWinds:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS + waitmessage B_WAIT_TIME_LONG + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 + goto BattleScript_HitFromAtkAnimation + BattleScript_SnowWarningActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp diff --git a/include/battle_scripts.h b/include/battle_scripts.h index f0712fc43..f3470776a 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -369,5 +369,12 @@ extern const u8 BattleScript_JabocaRowapBerryActivates[]; extern const u8 BattleScript_NotAffectedAbilityPopUp[]; extern const u8 BattleScript_BattlerShookOffTaunt[]; extern const u8 BattleScript_BattlerGotOverItsInfatuation[]; +extern const u8 BattleScript_DesolateLandActivates[]; +extern const u8 BattleScript_DesolateLandEvaporatesWaterTypeMoves[]; +extern const u8 BattleScript_PrimordialSeaActivates[]; +extern const u8 BattleScript_PrimordialSeaFizzlesOutFireTypeMoves[]; +extern const u8 BattleScript_DeltaStreamActivates[]; +extern const u8 BattleScript_MysteriousAirCurrentBlowsOn[]; +extern const u8 BattleScript_AttackWeakenedByStrongWinds[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/battle.h b/include/constants/battle.h index b158076bd..cb3e2c7be 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -256,24 +256,31 @@ #define WEATHER_RAIN_TEMPORARY (1 << 0) #define WEATHER_RAIN_DOWNPOUR (1 << 1) // unused #define WEATHER_RAIN_PERMANENT (1 << 2) -#define WEATHER_RAIN_ANY (WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_DOWNPOUR | WEATHER_RAIN_PERMANENT) -#define WEATHER_SANDSTORM_TEMPORARY (1 << 3) -#define WEATHER_SANDSTORM_PERMANENT (1 << 4) +#define WEATHER_RAIN_PRIMAL (1 << 3) +#define WEATHER_RAIN_ANY (WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_DOWNPOUR | WEATHER_RAIN_PERMANENT | WEATHER_RAIN_PRIMAL) +#define WEATHER_SANDSTORM_TEMPORARY (1 << 4) +#define WEATHER_SANDSTORM_PERMANENT (1 << 5) #define WEATHER_SANDSTORM_ANY (WEATHER_SANDSTORM_TEMPORARY | WEATHER_SANDSTORM_PERMANENT) -#define WEATHER_SUN_TEMPORARY (1 << 5) -#define WEATHER_SUN_PERMANENT (1 << 6) -#define WEATHER_SUN_ANY (WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT) -#define WEATHER_HAIL_TEMPORARY (1 << 7) -#define WEATHER_HAIL_PERMANENT (1 << 8) +#define WEATHER_SUN_TEMPORARY (1 << 6) +#define WEATHER_SUN_PERMANENT (1 << 7) +#define WEATHER_SUN_PRIMAL (1 << 8) +#define WEATHER_SUN_ANY (WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT | WEATHER_SUN_PRIMAL) +#define WEATHER_HAIL_TEMPORARY (1 << 9) +#define WEATHER_HAIL_PERMANENT (1 << 10) #define WEATHER_HAIL_ANY (WEATHER_HAIL_TEMPORARY | WEATHER_HAIL_PERMANENT) -#define WEATHER_ANY (WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY) +#define WEATHER_STRONG_WINDS (1 << 11) +#define WEATHER_ANY (WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY | WEATHER_STRONG_WINDS) +#define WEATHER_PRIMAL_ANY (WEATHER_RAIN_PRIMAL | WEATHER_SUN_PRIMAL | WEATHER_STRONG_WINDS) // Battle Weather as enum -#define ENUM_WEATHER_NONE 0 -#define ENUM_WEATHER_RAIN 1 -#define ENUM_WEATHER_SUN 2 -#define ENUM_WEATHER_SANDSTORM 3 -#define ENUM_WEATHER_HAIL 4 +#define ENUM_WEATHER_NONE 0 +#define ENUM_WEATHER_RAIN 1 +#define ENUM_WEATHER_SUN 2 +#define ENUM_WEATHER_SANDSTORM 3 +#define ENUM_WEATHER_HAIL 4 +#define ENUM_WEATHER_SUN_PRIMAL 5 +#define ENUM_WEATHER_RAIN_PRIMAL 6 +#define ENUM_WEATHER_STRONG_WINDS 7 // Move Effects #define MOVE_EFFECT_SLEEP 0x1 diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index faaf8f17e..5b94cb145 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -173,6 +173,7 @@ #define VARIOUS_DESTROY_ABILITY_POPUP 102 #define VARIOUS_TOTEM_BOOST 103 #define VARIOUS_TRY_ACTIVATE_GRIM_NEIGH 104 +#define VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER 105 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index cda885694..04abb280b 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -12,566 +12,578 @@ #define STRINGID_TRAINERSLIDE 6 // todo: make some of those names less vague: attacker/target vs pkmn, etc. -#define STRINGID_TRAINER1LOSETEXT 12 -#define STRINGID_PKMNGAINEDEXP 13 -#define STRINGID_PKMNGREWTOLV 14 -#define STRINGID_PKMNLEARNEDMOVE 15 -#define STRINGID_TRYTOLEARNMOVE1 16 -#define STRINGID_TRYTOLEARNMOVE2 17 -#define STRINGID_TRYTOLEARNMOVE3 18 -#define STRINGID_PKMNFORGOTMOVE 19 -#define STRINGID_STOPLEARNINGMOVE 20 -#define STRINGID_DIDNOTLEARNMOVE 21 -#define STRINGID_PKMNLEARNEDMOVE2 22 -#define STRINGID_ATTACKMISSED 23 -#define STRINGID_PKMNPROTECTEDITSELF 24 -#define STRINGID_STATSWONTINCREASE2 25 -#define STRINGID_AVOIDEDDAMAGE 26 -#define STRINGID_ITDOESNTAFFECT 27 -#define STRINGID_ATTACKERFAINTED 28 -#define STRINGID_TARGETFAINTED 29 -#define STRINGID_PLAYERGOTMONEY 30 -#define STRINGID_PLAYERWHITEOUT 31 -#define STRINGID_PLAYERWHITEOUT2 32 -#define STRINGID_PREVENTSESCAPE 33 -#define STRINGID_HITXTIMES 34 -#define STRINGID_PKMNFELLASLEEP 35 -#define STRINGID_PKMNMADESLEEP 36 -#define STRINGID_PKMNALREADYASLEEP 37 -#define STRINGID_PKMNALREADYASLEEP2 38 -#define STRINGID_PKMNWASNTAFFECTED 39 -#define STRINGID_PKMNWASPOISONED 40 -#define STRINGID_PKMNPOISONEDBY 41 -#define STRINGID_PKMNHURTBYPOISON 42 -#define STRINGID_PKMNALREADYPOISONED 43 -#define STRINGID_PKMNBADLYPOISONED 44 -#define STRINGID_PKMNENERGYDRAINED 45 -#define STRINGID_PKMNWASBURNED 46 -#define STRINGID_PKMNBURNEDBY 47 -#define STRINGID_PKMNHURTBYBURN 48 -#define STRINGID_PKMNWASFROZEN 49 -#define STRINGID_PKMNFROZENBY 50 -#define STRINGID_PKMNISFROZEN 51 -#define STRINGID_PKMNWASDEFROSTED 52 -#define STRINGID_PKMNWASDEFROSTED2 53 -#define STRINGID_PKMNWASDEFROSTEDBY 54 -#define STRINGID_PKMNWASPARALYZED 55 -#define STRINGID_PKMNWASPARALYZEDBY 56 -#define STRINGID_PKMNISPARALYZED 57 -#define STRINGID_PKMNISALREADYPARALYZED 58 -#define STRINGID_PKMNHEALEDPARALYSIS 59 -#define STRINGID_PKMNDREAMEATEN 60 -#define STRINGID_STATSWONTINCREASE 61 -#define STRINGID_STATSWONTDECREASE 62 -#define STRINGID_TEAMSTOPPEDWORKING 63 -#define STRINGID_FOESTOPPEDWORKING 64 -#define STRINGID_PKMNISCONFUSED 65 -#define STRINGID_PKMNHEALEDCONFUSION 66 -#define STRINGID_PKMNWASCONFUSED 67 -#define STRINGID_PKMNALREADYCONFUSED 68 -#define STRINGID_PKMNFELLINLOVE 69 -#define STRINGID_PKMNINLOVE 70 -#define STRINGID_PKMNIMMOBILIZEDBYLOVE 71 -#define STRINGID_PKMNBLOWNAWAY 72 -#define STRINGID_PKMNCHANGEDTYPE 73 -#define STRINGID_PKMNFLINCHED 74 -#define STRINGID_PKMNREGAINEDHEALTH 75 -#define STRINGID_PKMNHPFULL 76 -#define STRINGID_PKMNRAISEDSPDEF 77 -#define STRINGID_PKMNRAISEDDEF 78 -#define STRINGID_PKMNCOVEREDBYVEIL 79 -#define STRINGID_PKMNUSEDSAFEGUARD 80 -#define STRINGID_PKMNSAFEGUARDEXPIRED 81 -#define STRINGID_PKMNWENTTOSLEEP 82 -#define STRINGID_PKMNSLEPTHEALTHY 83 -#define STRINGID_PKMNWHIPPEDWHIRLWIND 84 -#define STRINGID_PKMNTOOKSUNLIGHT 85 -#define STRINGID_PKMNLOWEREDHEAD 86 -#define STRINGID_PKMNISGLOWING 87 -#define STRINGID_PKMNFLEWHIGH 88 -#define STRINGID_PKMNDUGHOLE 89 -#define STRINGID_PKMNSQUEEZEDBYBIND 90 -#define STRINGID_PKMNTRAPPEDINVORTEX 91 -#define STRINGID_PKMNWRAPPEDBY 92 -#define STRINGID_PKMNCLAMPED 93 -#define STRINGID_PKMNHURTBY 94 -#define STRINGID_PKMNFREEDFROM 95 -#define STRINGID_PKMNCRASHED 96 -#define STRINGID_PKMNSHROUDEDINMIST 97 -#define STRINGID_PKMNPROTECTEDBYMIST 98 -#define STRINGID_PKMNGETTINGPUMPED 99 -#define STRINGID_PKMNHITWITHRECOIL 100 -#define STRINGID_PKMNPROTECTEDITSELF2 101 -#define STRINGID_PKMNBUFFETEDBYSANDSTORM 102 -#define STRINGID_PKMNPELTEDBYHAIL 103 -#define STRINGID_PKMNSEEDED 104 -#define STRINGID_PKMNEVADEDATTACK 105 -#define STRINGID_PKMNSAPPEDBYLEECHSEED 106 -#define STRINGID_PKMNFASTASLEEP 107 -#define STRINGID_PKMNWOKEUP 108 -#define STRINGID_PKMNUPROARKEPTAWAKE 109 -#define STRINGID_PKMNWOKEUPINUPROAR 110 -#define STRINGID_PKMNCAUSEDUPROAR 111 -#define STRINGID_PKMNMAKINGUPROAR 112 -#define STRINGID_PKMNCALMEDDOWN 113 -#define STRINGID_PKMNCANTSLEEPINUPROAR 114 -#define STRINGID_PKMNSTOCKPILED 115 -#define STRINGID_PKMNCANTSTOCKPILE 116 -#define STRINGID_PKMNCANTSLEEPINUPROAR2 117 -#define STRINGID_UPROARKEPTPKMNAWAKE 118 -#define STRINGID_PKMNSTAYEDAWAKEUSING 119 -#define STRINGID_PKMNSTORINGENERGY 120 -#define STRINGID_PKMNUNLEASHEDENERGY 121 -#define STRINGID_PKMNFATIGUECONFUSION 122 -#define STRINGID_PLAYERPICKEDUPMONEY 123 -#define STRINGID_PKMNUNAFFECTED 124 -#define STRINGID_PKMNTRANSFORMEDINTO 125 -#define STRINGID_PKMNMADESUBSTITUTE 126 -#define STRINGID_PKMNHASSUBSTITUTE 127 -#define STRINGID_SUBSTITUTEDAMAGED 128 -#define STRINGID_PKMNSUBSTITUTEFADED 129 -#define STRINGID_PKMNMUSTRECHARGE 130 -#define STRINGID_PKMNRAGEBUILDING 131 -#define STRINGID_PKMNMOVEWASDISABLED 132 -#define STRINGID_PKMNMOVEISDISABLED 133 -#define STRINGID_PKMNMOVEDISABLEDNOMORE 134 -#define STRINGID_PKMNGOTENCORE 135 -#define STRINGID_PKMNENCOREENDED 136 -#define STRINGID_PKMNTOOKAIM 137 -#define STRINGID_PKMNSKETCHEDMOVE 138 -#define STRINGID_PKMNTRYINGTOTAKEFOE 139 -#define STRINGID_PKMNTOOKFOE 140 -#define STRINGID_PKMNREDUCEDPP 141 -#define STRINGID_PKMNSTOLEITEM 142 -#define STRINGID_TARGETCANTESCAPENOW 143 -#define STRINGID_PKMNFELLINTONIGHTMARE 144 -#define STRINGID_PKMNLOCKEDINNIGHTMARE 145 -#define STRINGID_PKMNLAIDCURSE 146 -#define STRINGID_PKMNAFFLICTEDBYCURSE 147 -#define STRINGID_SPIKESSCATTERED 148 -#define STRINGID_PKMNHURTBYSPIKES 149 -#define STRINGID_PKMNIDENTIFIED 150 -#define STRINGID_PKMNPERISHCOUNTFELL 151 -#define STRINGID_PKMNBRACEDITSELF 152 -#define STRINGID_PKMNENDUREDHIT 153 -#define STRINGID_MAGNITUDESTRENGTH 154 -#define STRINGID_PKMNCUTHPMAXEDATTACK 155 -#define STRINGID_PKMNCOPIEDSTATCHANGES 156 -#define STRINGID_PKMNGOTFREE 157 -#define STRINGID_PKMNSHEDLEECHSEED 158 -#define STRINGID_PKMNBLEWAWAYSPIKES 159 -#define STRINGID_PKMNFLEDFROMBATTLE 160 -#define STRINGID_PKMNFORESAWATTACK 161 -#define STRINGID_PKMNTOOKATTACK 162 -#define STRINGID_PKMNATTACK 163 -#define STRINGID_PKMNCENTERATTENTION 164 -#define STRINGID_PKMNCHARGINGPOWER 165 -#define STRINGID_NATUREPOWERTURNEDINTO 166 -#define STRINGID_PKMNSTATUSNORMAL 167 -#define STRINGID_PKMNHASNOMOVESLEFT 168 -#define STRINGID_PKMNSUBJECTEDTOTORMENT 169 -#define STRINGID_PKMNCANTUSEMOVETORMENT 170 -#define STRINGID_PKMNTIGHTENINGFOCUS 171 -#define STRINGID_PKMNFELLFORTAUNT 172 -#define STRINGID_PKMNCANTUSEMOVETAUNT 173 -#define STRINGID_PKMNREADYTOHELP 174 -#define STRINGID_PKMNSWITCHEDITEMS 175 -#define STRINGID_PKMNCOPIEDFOE 176 -#define STRINGID_PKMNMADEWISH 177 -#define STRINGID_PKMNWISHCAMETRUE 178 -#define STRINGID_PKMNPLANTEDROOTS 179 -#define STRINGID_PKMNABSORBEDNUTRIENTS 180 -#define STRINGID_PKMNANCHOREDITSELF 181 -#define STRINGID_PKMNWASMADEDROWSY 182 -#define STRINGID_PKMNKNOCKEDOFF 183 -#define STRINGID_PKMNSWAPPEDABILITIES 184 -#define STRINGID_PKMNSEALEDOPPONENTMOVE 185 -#define STRINGID_PKMNCANTUSEMOVESEALED 186 -#define STRINGID_PKMNWANTSGRUDGE 187 -#define STRINGID_PKMNLOSTPPGRUDGE 188 -#define STRINGID_PKMNSHROUDEDITSELF 189 -#define STRINGID_PKMNMOVEBOUNCED 190 -#define STRINGID_PKMNWAITSFORTARGET 191 -#define STRINGID_PKMNSNATCHEDMOVE 192 -#define STRINGID_PKMNMADEITRAIN 193 -#define STRINGID_PKMNRAISEDSPEED 194 -#define STRINGID_PKMNPROTECTEDBY 195 -#define STRINGID_PKMNPREVENTSUSAGE 196 -#define STRINGID_PKMNRESTOREDHPUSING 197 -#define STRINGID_PKMNCHANGEDTYPEWITH 198 -#define STRINGID_PKMNPREVENTSPARALYSISWITH 199 -#define STRINGID_PKMNPREVENTSROMANCEWITH 200 -#define STRINGID_PKMNPREVENTSPOISONINGWITH 201 -#define STRINGID_PKMNPREVENTSCONFUSIONWITH 202 -#define STRINGID_PKMNRAISEDFIREPOWERWITH 203 -#define STRINGID_PKMNANCHORSITSELFWITH 204 -#define STRINGID_PKMNCUTSATTACKWITH 205 -#define STRINGID_PKMNPREVENTSSTATLOSSWITH 206 -#define STRINGID_PKMNHURTSWITH 207 -#define STRINGID_PKMNTRACED 208 -#define STRINGID_STATSHARPLY 209 -#define STRINGID_STATROSE 210 -#define STRINGID_STATHARSHLY 211 -#define STRINGID_STATFELL 212 -#define STRINGID_ATTACKERSSTATROSE 213 -#define STRINGID_DEFENDERSSTATROSE 214 -#define STRINGID_ATTACKERSSTATFELL 215 -#define STRINGID_DEFENDERSSTATFELL 216 -#define STRINGID_CRITICALHIT 217 -#define STRINGID_ONEHITKO 218 -#define STRINGID_123POOF 219 -#define STRINGID_ANDELLIPSIS 220 -#define STRINGID_NOTVERYEFFECTIVE 221 -#define STRINGID_SUPEREFFECTIVE 222 -#define STRINGID_GOTAWAYSAFELY 223 -#define STRINGID_WILDPKMNFLED 224 -#define STRINGID_NORUNNINGFROMTRAINERS 225 -#define STRINGID_CANTESCAPE 226 -#define STRINGID_DONTLEAVEBIRCH 227 -#define STRINGID_BUTNOTHINGHAPPENED 228 -#define STRINGID_BUTITFAILED 229 -#define STRINGID_ITHURTCONFUSION 230 -#define STRINGID_MIRRORMOVEFAILED 231 -#define STRINGID_STARTEDTORAIN 232 -#define STRINGID_DOWNPOURSTARTED 233 -#define STRINGID_RAINCONTINUES 234 -#define STRINGID_DOWNPOURCONTINUES 235 -#define STRINGID_RAINSTOPPED 236 -#define STRINGID_SANDSTORMBREWED 237 -#define STRINGID_SANDSTORMRAGES 238 -#define STRINGID_SANDSTORMSUBSIDED 239 -#define STRINGID_SUNLIGHTGOTBRIGHT 240 -#define STRINGID_SUNLIGHTSTRONG 241 -#define STRINGID_SUNLIGHTFADED 242 -#define STRINGID_STARTEDHAIL 243 -#define STRINGID_HAILCONTINUES 244 -#define STRINGID_HAILSTOPPED 245 -#define STRINGID_FAILEDTOSPITUP 246 -#define STRINGID_FAILEDTOSWALLOW 247 -#define STRINGID_WINDBECAMEHEATWAVE 248 -#define STRINGID_STATCHANGESGONE 249 -#define STRINGID_COINSSCATTERED 250 -#define STRINGID_TOOWEAKFORSUBSTITUTE 251 -#define STRINGID_SHAREDPAIN 252 -#define STRINGID_BELLCHIMED 253 -#define STRINGID_FAINTINTHREE 254 -#define STRINGID_NOPPLEFT 255 -#define STRINGID_BUTNOPPLEFT 256 -#define STRINGID_PLAYERUSEDITEM 257 -#define STRINGID_WALLYUSEDITEM 258 -#define STRINGID_TRAINERBLOCKEDBALL 259 -#define STRINGID_DONTBEATHIEF 260 -#define STRINGID_ITDODGEDBALL 261 -#define STRINGID_YOUMISSEDPKMN 262 -#define STRINGID_PKMNBROKEFREE 263 -#define STRINGID_ITAPPEAREDCAUGHT 264 -#define STRINGID_AARGHALMOSTHADIT 265 -#define STRINGID_SHOOTSOCLOSE 266 -#define STRINGID_GOTCHAPKMNCAUGHT 267 -#define STRINGID_GOTCHAPKMNCAUGHT2 268 -#define STRINGID_GIVENICKNAMECAPTURED 269 -#define STRINGID_PKMNSENTTOPC 270 -#define STRINGID_PKMNDATAADDEDTODEX 271 -#define STRINGID_ITISRAINING 272 -#define STRINGID_SANDSTORMISRAGING 273 -#define STRINGID_CANTESCAPE2 274 -#define STRINGID_PKMNIGNORESASLEEP 275 -#define STRINGID_PKMNIGNOREDORDERS 276 -#define STRINGID_PKMNBEGANTONAP 277 -#define STRINGID_PKMNLOAFING 278 -#define STRINGID_PKMNWONTOBEY 279 -#define STRINGID_PKMNTURNEDAWAY 280 -#define STRINGID_PKMNPRETENDNOTNOTICE 281 -#define STRINGID_ENEMYABOUTTOSWITCHPKMN 282 -#define STRINGID_CREPTCLOSER 283 -#define STRINGID_CANTGETCLOSER 284 -#define STRINGID_PKMNWATCHINGCAREFULLY 285 -#define STRINGID_PKMNCURIOUSABOUTX 286 -#define STRINGID_PKMNENTHRALLEDBYX 287 -#define STRINGID_PKMNIGNOREDX 288 -#define STRINGID_THREWPOKEBLOCKATPKMN 289 -#define STRINGID_OUTOFSAFARIBALLS 290 -#define STRINGID_PKMNSITEMCUREDPARALYSIS 291 -#define STRINGID_PKMNSITEMCUREDPOISON 292 -#define STRINGID_PKMNSITEMHEALEDBURN 293 -#define STRINGID_PKMNSITEMDEFROSTEDIT 294 -#define STRINGID_PKMNSITEMWOKEIT 295 -#define STRINGID_PKMNSITEMSNAPPEDOUT 296 -#define STRINGID_PKMNSITEMCUREDPROBLEM 297 -#define STRINGID_PKMNSITEMRESTOREDHEALTH 298 -#define STRINGID_PKMNSITEMRESTOREDPP 299 -#define STRINGID_PKMNSITEMRESTOREDSTATUS 300 -#define STRINGID_PKMNSITEMRESTOREDHPALITTLE 301 -#define STRINGID_ITEMALLOWSONLYYMOVE 302 -#define STRINGID_PKMNHUNGONWITHX 303 -#define STRINGID_EMPTYSTRING3 304 -#define STRINGID_PKMNSXPREVENTSBURNS 305 -#define STRINGID_PKMNSXBLOCKSY 306 -#define STRINGID_PKMNSXRESTOREDHPALITTLE2 307 -#define STRINGID_PKMNSXWHIPPEDUPSANDSTORM 308 -#define STRINGID_PKMNSXPREVENTSYLOSS 309 -#define STRINGID_PKMNSXINFATUATEDY 310 -#define STRINGID_PKMNSXMADEYINEFFECTIVE 311 -#define STRINGID_PKMNSXCUREDYPROBLEM 312 -#define STRINGID_ITSUCKEDLIQUIDOOZE 313 -#define STRINGID_PKMNTRANSFORMED 314 -#define STRINGID_ELECTRICITYWEAKENED 315 -#define STRINGID_FIREWEAKENED 316 -#define STRINGID_PKMNHIDUNDERWATER 317 -#define STRINGID_PKMNSPRANGUP 318 -#define STRINGID_HMMOVESCANTBEFORGOTTEN 319 -#define STRINGID_XFOUNDONEY 320 -#define STRINGID_PLAYERDEFEATEDTRAINER1 321 -#define STRINGID_SOOTHINGAROMA 322 -#define STRINGID_ITEMSCANTBEUSEDNOW 323 -#define STRINGID_FORXCOMMAYZ 324 -#define STRINGID_USINGITEMSTATOFPKMNROSE 325 -#define STRINGID_PKMNUSEDXTOGETPUMPED 326 -#define STRINGID_PKMNSXMADEYUSELESS 327 -#define STRINGID_PKMNTRAPPEDBYSANDTOMB 328 -#define STRINGID_EMPTYSTRING4 329 -#define STRINGID_ABOOSTED 330 -#define STRINGID_PKMNSXINTENSIFIEDSUN 331 -#define STRINGID_PKMNMAKESGROUNDMISS 332 -#define STRINGID_YOUTHROWABALLNOWRIGHT 333 -#define STRINGID_PKMNSXTOOKATTACK 334 -#define STRINGID_PKMNCHOSEXASDESTINY 335 -#define STRINGID_PKMNLOSTFOCUS 336 -#define STRINGID_USENEXTPKMN 337 -#define STRINGID_PKMNFLEDUSINGITS 338 -#define STRINGID_PKMNFLEDUSING 339 -#define STRINGID_PKMNWASDRAGGEDOUT 340 -#define STRINGID_PREVENTEDFROMWORKING 341 -#define STRINGID_PKMNSITEMNORMALIZEDSTATUS 342 -#define STRINGID_TRAINER1USEDITEM 343 -#define STRINGID_BOXISFULL 344 -#define STRINGID_PKMNAVOIDEDATTACK 345 -#define STRINGID_PKMNSXMADEITINEFFECTIVE 346 -#define STRINGID_PKMNSXPREVENTSFLINCHING 347 -#define STRINGID_PKMNALREADYHASBURN 348 -#define STRINGID_STATSWONTDECREASE2 349 -#define STRINGID_PKMNSXBLOCKSY2 350 -#define STRINGID_PKMNSXWOREOFF 351 -#define STRINGID_PKMNRAISEDDEFALITTLE 352 -#define STRINGID_PKMNRAISEDSPDEFALITTLE 353 -#define STRINGID_THEWALLSHATTERED 354 -#define STRINGID_PKMNSXPREVENTSYSZ 355 -#define STRINGID_PKMNSXCUREDITSYPROBLEM 356 -#define STRINGID_ATTACKERCANTESCAPE 357 -#define STRINGID_PKMNOBTAINEDX 358 -#define STRINGID_PKMNOBTAINEDX2 359 -#define STRINGID_PKMNOBTAINEDXYOBTAINEDZ 360 -#define STRINGID_BUTNOEFFECT 361 -#define STRINGID_PKMNSXHADNOEFFECTONY 362 -#define STRINGID_TWOENEMIESDEFEATED 363 -#define STRINGID_TRAINER2LOSETEXT 364 -#define STRINGID_PKMNINCAPABLEOFPOWER 365 -#define STRINGID_GLINTAPPEARSINEYE 366 -#define STRINGID_PKMNGETTINGINTOPOSITION 367 -#define STRINGID_PKMNBEGANGROWLINGDEEPLY 368 -#define STRINGID_PKMNEAGERFORMORE 369 -#define STRINGID_DEFEATEDOPPONENTBYREFEREE 370 -#define STRINGID_LOSTTOOPPONENTBYREFEREE 371 -#define STRINGID_TIEDOPPONENTBYREFEREE 372 -#define STRINGID_QUESTIONFORFEITMATCH 373 -#define STRINGID_FORFEITEDMATCH 374 -#define STRINGID_PKMNTRANSFERREDSOMEONESPC 375 -#define STRINGID_PKMNTRANSFERREDLANETTESPC 376 -#define STRINGID_PKMNBOXSOMEONESPCFULL 377 -#define STRINGID_PKMNBOXLANETTESPCFULL 378 -#define STRINGID_TRAINER1WINTEXT 379 -#define STRINGID_TRAINER2WINTEXT 380 +#define STRINGID_TRAINER1LOSETEXT 12 +#define STRINGID_PKMNGAINEDEXP 13 +#define STRINGID_PKMNGREWTOLV 14 +#define STRINGID_PKMNLEARNEDMOVE 15 +#define STRINGID_TRYTOLEARNMOVE1 16 +#define STRINGID_TRYTOLEARNMOVE2 17 +#define STRINGID_TRYTOLEARNMOVE3 18 +#define STRINGID_PKMNFORGOTMOVE 19 +#define STRINGID_STOPLEARNINGMOVE 20 +#define STRINGID_DIDNOTLEARNMOVE 21 +#define STRINGID_PKMNLEARNEDMOVE2 22 +#define STRINGID_ATTACKMISSED 23 +#define STRINGID_PKMNPROTECTEDITSELF 24 +#define STRINGID_STATSWONTINCREASE2 25 +#define STRINGID_AVOIDEDDAMAGE 26 +#define STRINGID_ITDOESNTAFFECT 27 +#define STRINGID_ATTACKERFAINTED 28 +#define STRINGID_TARGETFAINTED 29 +#define STRINGID_PLAYERGOTMONEY 30 +#define STRINGID_PLAYERWHITEOUT 31 +#define STRINGID_PLAYERWHITEOUT2 32 +#define STRINGID_PREVENTSESCAPE 33 +#define STRINGID_HITXTIMES 34 +#define STRINGID_PKMNFELLASLEEP 35 +#define STRINGID_PKMNMADESLEEP 36 +#define STRINGID_PKMNALREADYASLEEP 37 +#define STRINGID_PKMNALREADYASLEEP2 38 +#define STRINGID_PKMNWASNTAFFECTED 39 +#define STRINGID_PKMNWASPOISONED 40 +#define STRINGID_PKMNPOISONEDBY 41 +#define STRINGID_PKMNHURTBYPOISON 42 +#define STRINGID_PKMNALREADYPOISONED 43 +#define STRINGID_PKMNBADLYPOISONED 44 +#define STRINGID_PKMNENERGYDRAINED 45 +#define STRINGID_PKMNWASBURNED 46 +#define STRINGID_PKMNBURNEDBY 47 +#define STRINGID_PKMNHURTBYBURN 48 +#define STRINGID_PKMNWASFROZEN 49 +#define STRINGID_PKMNFROZENBY 50 +#define STRINGID_PKMNISFROZEN 51 +#define STRINGID_PKMNWASDEFROSTED 52 +#define STRINGID_PKMNWASDEFROSTED2 53 +#define STRINGID_PKMNWASDEFROSTEDBY 54 +#define STRINGID_PKMNWASPARALYZED 55 +#define STRINGID_PKMNWASPARALYZEDBY 56 +#define STRINGID_PKMNISPARALYZED 57 +#define STRINGID_PKMNISALREADYPARALYZED 58 +#define STRINGID_PKMNHEALEDPARALYSIS 59 +#define STRINGID_PKMNDREAMEATEN 60 +#define STRINGID_STATSWONTINCREASE 61 +#define STRINGID_STATSWONTDECREASE 62 +#define STRINGID_TEAMSTOPPEDWORKING 63 +#define STRINGID_FOESTOPPEDWORKING 64 +#define STRINGID_PKMNISCONFUSED 65 +#define STRINGID_PKMNHEALEDCONFUSION 66 +#define STRINGID_PKMNWASCONFUSED 67 +#define STRINGID_PKMNALREADYCONFUSED 68 +#define STRINGID_PKMNFELLINLOVE 69 +#define STRINGID_PKMNINLOVE 70 +#define STRINGID_PKMNIMMOBILIZEDBYLOVE 71 +#define STRINGID_PKMNBLOWNAWAY 72 +#define STRINGID_PKMNCHANGEDTYPE 73 +#define STRINGID_PKMNFLINCHED 74 +#define STRINGID_PKMNREGAINEDHEALTH 75 +#define STRINGID_PKMNHPFULL 76 +#define STRINGID_PKMNRAISEDSPDEF 77 +#define STRINGID_PKMNRAISEDDEF 78 +#define STRINGID_PKMNCOVEREDBYVEIL 79 +#define STRINGID_PKMNUSEDSAFEGUARD 80 +#define STRINGID_PKMNSAFEGUARDEXPIRED 81 +#define STRINGID_PKMNWENTTOSLEEP 82 +#define STRINGID_PKMNSLEPTHEALTHY 83 +#define STRINGID_PKMNWHIPPEDWHIRLWIND 84 +#define STRINGID_PKMNTOOKSUNLIGHT 85 +#define STRINGID_PKMNLOWEREDHEAD 86 +#define STRINGID_PKMNISGLOWING 87 +#define STRINGID_PKMNFLEWHIGH 88 +#define STRINGID_PKMNDUGHOLE 89 +#define STRINGID_PKMNSQUEEZEDBYBIND 90 +#define STRINGID_PKMNTRAPPEDINVORTEX 91 +#define STRINGID_PKMNWRAPPEDBY 92 +#define STRINGID_PKMNCLAMPED 93 +#define STRINGID_PKMNHURTBY 94 +#define STRINGID_PKMNFREEDFROM 95 +#define STRINGID_PKMNCRASHED 96 +#define STRINGID_PKMNSHROUDEDINMIST 97 +#define STRINGID_PKMNPROTECTEDBYMIST 98 +#define STRINGID_PKMNGETTINGPUMPED 99 +#define STRINGID_PKMNHITWITHRECOIL 100 +#define STRINGID_PKMNPROTECTEDITSELF2 101 +#define STRINGID_PKMNBUFFETEDBYSANDSTORM 102 +#define STRINGID_PKMNPELTEDBYHAIL 103 +#define STRINGID_PKMNSEEDED 104 +#define STRINGID_PKMNEVADEDATTACK 105 +#define STRINGID_PKMNSAPPEDBYLEECHSEED 106 +#define STRINGID_PKMNFASTASLEEP 107 +#define STRINGID_PKMNWOKEUP 108 +#define STRINGID_PKMNUPROARKEPTAWAKE 109 +#define STRINGID_PKMNWOKEUPINUPROAR 110 +#define STRINGID_PKMNCAUSEDUPROAR 111 +#define STRINGID_PKMNMAKINGUPROAR 112 +#define STRINGID_PKMNCALMEDDOWN 113 +#define STRINGID_PKMNCANTSLEEPINUPROAR 114 +#define STRINGID_PKMNSTOCKPILED 115 +#define STRINGID_PKMNCANTSTOCKPILE 116 +#define STRINGID_PKMNCANTSLEEPINUPROAR2 117 +#define STRINGID_UPROARKEPTPKMNAWAKE 118 +#define STRINGID_PKMNSTAYEDAWAKEUSING 119 +#define STRINGID_PKMNSTORINGENERGY 120 +#define STRINGID_PKMNUNLEASHEDENERGY 121 +#define STRINGID_PKMNFATIGUECONFUSION 122 +#define STRINGID_PLAYERPICKEDUPMONEY 123 +#define STRINGID_PKMNUNAFFECTED 124 +#define STRINGID_PKMNTRANSFORMEDINTO 125 +#define STRINGID_PKMNMADESUBSTITUTE 126 +#define STRINGID_PKMNHASSUBSTITUTE 127 +#define STRINGID_SUBSTITUTEDAMAGED 128 +#define STRINGID_PKMNSUBSTITUTEFADED 129 +#define STRINGID_PKMNMUSTRECHARGE 130 +#define STRINGID_PKMNRAGEBUILDING 131 +#define STRINGID_PKMNMOVEWASDISABLED 132 +#define STRINGID_PKMNMOVEISDISABLED 133 +#define STRINGID_PKMNMOVEDISABLEDNOMORE 134 +#define STRINGID_PKMNGOTENCORE 135 +#define STRINGID_PKMNENCOREENDED 136 +#define STRINGID_PKMNTOOKAIM 137 +#define STRINGID_PKMNSKETCHEDMOVE 138 +#define STRINGID_PKMNTRYINGTOTAKEFOE 139 +#define STRINGID_PKMNTOOKFOE 140 +#define STRINGID_PKMNREDUCEDPP 141 +#define STRINGID_PKMNSTOLEITEM 142 +#define STRINGID_TARGETCANTESCAPENOW 143 +#define STRINGID_PKMNFELLINTONIGHTMARE 144 +#define STRINGID_PKMNLOCKEDINNIGHTMARE 145 +#define STRINGID_PKMNLAIDCURSE 146 +#define STRINGID_PKMNAFFLICTEDBYCURSE 147 +#define STRINGID_SPIKESSCATTERED 148 +#define STRINGID_PKMNHURTBYSPIKES 149 +#define STRINGID_PKMNIDENTIFIED 150 +#define STRINGID_PKMNPERISHCOUNTFELL 151 +#define STRINGID_PKMNBRACEDITSELF 152 +#define STRINGID_PKMNENDUREDHIT 153 +#define STRINGID_MAGNITUDESTRENGTH 154 +#define STRINGID_PKMNCUTHPMAXEDATTACK 155 +#define STRINGID_PKMNCOPIEDSTATCHANGES 156 +#define STRINGID_PKMNGOTFREE 157 +#define STRINGID_PKMNSHEDLEECHSEED 158 +#define STRINGID_PKMNBLEWAWAYSPIKES 159 +#define STRINGID_PKMNFLEDFROMBATTLE 160 +#define STRINGID_PKMNFORESAWATTACK 161 +#define STRINGID_PKMNTOOKATTACK 162 +#define STRINGID_PKMNATTACK 163 +#define STRINGID_PKMNCENTERATTENTION 164 +#define STRINGID_PKMNCHARGINGPOWER 165 +#define STRINGID_NATUREPOWERTURNEDINTO 166 +#define STRINGID_PKMNSTATUSNORMAL 167 +#define STRINGID_PKMNHASNOMOVESLEFT 168 +#define STRINGID_PKMNSUBJECTEDTOTORMENT 169 +#define STRINGID_PKMNCANTUSEMOVETORMENT 170 +#define STRINGID_PKMNTIGHTENINGFOCUS 171 +#define STRINGID_PKMNFELLFORTAUNT 172 +#define STRINGID_PKMNCANTUSEMOVETAUNT 173 +#define STRINGID_PKMNREADYTOHELP 174 +#define STRINGID_PKMNSWITCHEDITEMS 175 +#define STRINGID_PKMNCOPIEDFOE 176 +#define STRINGID_PKMNMADEWISH 177 +#define STRINGID_PKMNWISHCAMETRUE 178 +#define STRINGID_PKMNPLANTEDROOTS 179 +#define STRINGID_PKMNABSORBEDNUTRIENTS 180 +#define STRINGID_PKMNANCHOREDITSELF 181 +#define STRINGID_PKMNWASMADEDROWSY 182 +#define STRINGID_PKMNKNOCKEDOFF 183 +#define STRINGID_PKMNSWAPPEDABILITIES 184 +#define STRINGID_PKMNSEALEDOPPONENTMOVE 185 +#define STRINGID_PKMNCANTUSEMOVESEALED 186 +#define STRINGID_PKMNWANTSGRUDGE 187 +#define STRINGID_PKMNLOSTPPGRUDGE 188 +#define STRINGID_PKMNSHROUDEDITSELF 189 +#define STRINGID_PKMNMOVEBOUNCED 190 +#define STRINGID_PKMNWAITSFORTARGET 191 +#define STRINGID_PKMNSNATCHEDMOVE 192 +#define STRINGID_PKMNMADEITRAIN 193 +#define STRINGID_PKMNRAISEDSPEED 194 +#define STRINGID_PKMNPROTECTEDBY 195 +#define STRINGID_PKMNPREVENTSUSAGE 196 +#define STRINGID_PKMNRESTOREDHPUSING 197 +#define STRINGID_PKMNCHANGEDTYPEWITH 198 +#define STRINGID_PKMNPREVENTSPARALYSISWITH 199 +#define STRINGID_PKMNPREVENTSROMANCEWITH 200 +#define STRINGID_PKMNPREVENTSPOISONINGWITH 201 +#define STRINGID_PKMNPREVENTSCONFUSIONWITH 202 +#define STRINGID_PKMNRAISEDFIREPOWERWITH 203 +#define STRINGID_PKMNANCHORSITSELFWITH 204 +#define STRINGID_PKMNCUTSATTACKWITH 205 +#define STRINGID_PKMNPREVENTSSTATLOSSWITH 206 +#define STRINGID_PKMNHURTSWITH 207 +#define STRINGID_PKMNTRACED 208 +#define STRINGID_STATSHARPLY 209 +#define STRINGID_STATROSE 210 +#define STRINGID_STATHARSHLY 211 +#define STRINGID_STATFELL 212 +#define STRINGID_ATTACKERSSTATROSE 213 +#define STRINGID_DEFENDERSSTATROSE 214 +#define STRINGID_ATTACKERSSTATFELL 215 +#define STRINGID_DEFENDERSSTATFELL 216 +#define STRINGID_CRITICALHIT 217 +#define STRINGID_ONEHITKO 218 +#define STRINGID_123POOF 219 +#define STRINGID_ANDELLIPSIS 220 +#define STRINGID_NOTVERYEFFECTIVE 221 +#define STRINGID_SUPEREFFECTIVE 222 +#define STRINGID_GOTAWAYSAFELY 223 +#define STRINGID_WILDPKMNFLED 224 +#define STRINGID_NORUNNINGFROMTRAINERS 225 +#define STRINGID_CANTESCAPE 226 +#define STRINGID_DONTLEAVEBIRCH 227 +#define STRINGID_BUTNOTHINGHAPPENED 228 +#define STRINGID_BUTITFAILED 229 +#define STRINGID_ITHURTCONFUSION 230 +#define STRINGID_MIRRORMOVEFAILED 231 +#define STRINGID_STARTEDTORAIN 232 +#define STRINGID_DOWNPOURSTARTED 233 +#define STRINGID_RAINCONTINUES 234 +#define STRINGID_DOWNPOURCONTINUES 235 +#define STRINGID_RAINSTOPPED 236 +#define STRINGID_SANDSTORMBREWED 237 +#define STRINGID_SANDSTORMRAGES 238 +#define STRINGID_SANDSTORMSUBSIDED 239 +#define STRINGID_SUNLIGHTGOTBRIGHT 240 +#define STRINGID_SUNLIGHTSTRONG 241 +#define STRINGID_SUNLIGHTFADED 242 +#define STRINGID_STARTEDHAIL 243 +#define STRINGID_HAILCONTINUES 244 +#define STRINGID_HAILSTOPPED 245 +#define STRINGID_FAILEDTOSPITUP 246 +#define STRINGID_FAILEDTOSWALLOW 247 +#define STRINGID_WINDBECAMEHEATWAVE 248 +#define STRINGID_STATCHANGESGONE 249 +#define STRINGID_COINSSCATTERED 250 +#define STRINGID_TOOWEAKFORSUBSTITUTE 251 +#define STRINGID_SHAREDPAIN 252 +#define STRINGID_BELLCHIMED 253 +#define STRINGID_FAINTINTHREE 254 +#define STRINGID_NOPPLEFT 255 +#define STRINGID_BUTNOPPLEFT 256 +#define STRINGID_PLAYERUSEDITEM 257 +#define STRINGID_WALLYUSEDITEM 258 +#define STRINGID_TRAINERBLOCKEDBALL 259 +#define STRINGID_DONTBEATHIEF 260 +#define STRINGID_ITDODGEDBALL 261 +#define STRINGID_YOUMISSEDPKMN 262 +#define STRINGID_PKMNBROKEFREE 263 +#define STRINGID_ITAPPEAREDCAUGHT 264 +#define STRINGID_AARGHALMOSTHADIT 265 +#define STRINGID_SHOOTSOCLOSE 266 +#define STRINGID_GOTCHAPKMNCAUGHT 267 +#define STRINGID_GOTCHAPKMNCAUGHT2 268 +#define STRINGID_GIVENICKNAMECAPTURED 269 +#define STRINGID_PKMNSENTTOPC 270 +#define STRINGID_PKMNDATAADDEDTODEX 271 +#define STRINGID_ITISRAINING 272 +#define STRINGID_SANDSTORMISRAGING 273 +#define STRINGID_CANTESCAPE2 274 +#define STRINGID_PKMNIGNORESASLEEP 275 +#define STRINGID_PKMNIGNOREDORDERS 276 +#define STRINGID_PKMNBEGANTONAP 277 +#define STRINGID_PKMNLOAFING 278 +#define STRINGID_PKMNWONTOBEY 279 +#define STRINGID_PKMNTURNEDAWAY 280 +#define STRINGID_PKMNPRETENDNOTNOTICE 281 +#define STRINGID_ENEMYABOUTTOSWITCHPKMN 282 +#define STRINGID_CREPTCLOSER 283 +#define STRINGID_CANTGETCLOSER 284 +#define STRINGID_PKMNWATCHINGCAREFULLY 285 +#define STRINGID_PKMNCURIOUSABOUTX 286 +#define STRINGID_PKMNENTHRALLEDBYX 287 +#define STRINGID_PKMNIGNOREDX 288 +#define STRINGID_THREWPOKEBLOCKATPKMN 289 +#define STRINGID_OUTOFSAFARIBALLS 290 +#define STRINGID_PKMNSITEMCUREDPARALYSIS 291 +#define STRINGID_PKMNSITEMCUREDPOISON 292 +#define STRINGID_PKMNSITEMHEALEDBURN 293 +#define STRINGID_PKMNSITEMDEFROSTEDIT 294 +#define STRINGID_PKMNSITEMWOKEIT 295 +#define STRINGID_PKMNSITEMSNAPPEDOUT 296 +#define STRINGID_PKMNSITEMCUREDPROBLEM 297 +#define STRINGID_PKMNSITEMRESTOREDHEALTH 298 +#define STRINGID_PKMNSITEMRESTOREDPP 299 +#define STRINGID_PKMNSITEMRESTOREDSTATUS 300 +#define STRINGID_PKMNSITEMRESTOREDHPALITTLE 301 +#define STRINGID_ITEMALLOWSONLYYMOVE 302 +#define STRINGID_PKMNHUNGONWITHX 303 +#define STRINGID_EMPTYSTRING3 304 +#define STRINGID_PKMNSXPREVENTSBURNS 305 +#define STRINGID_PKMNSXBLOCKSY 306 +#define STRINGID_PKMNSXRESTOREDHPALITTLE2 307 +#define STRINGID_PKMNSXWHIPPEDUPSANDSTORM 308 +#define STRINGID_PKMNSXPREVENTSYLOSS 309 +#define STRINGID_PKMNSXINFATUATEDY 310 +#define STRINGID_PKMNSXMADEYINEFFECTIVE 311 +#define STRINGID_PKMNSXCUREDYPROBLEM 312 +#define STRINGID_ITSUCKEDLIQUIDOOZE 313 +#define STRINGID_PKMNTRANSFORMED 314 +#define STRINGID_ELECTRICITYWEAKENED 315 +#define STRINGID_FIREWEAKENED 316 +#define STRINGID_PKMNHIDUNDERWATER 317 +#define STRINGID_PKMNSPRANGUP 318 +#define STRINGID_HMMOVESCANTBEFORGOTTEN 319 +#define STRINGID_XFOUNDONEY 320 +#define STRINGID_PLAYERDEFEATEDTRAINER1 321 +#define STRINGID_SOOTHINGAROMA 322 +#define STRINGID_ITEMSCANTBEUSEDNOW 323 +#define STRINGID_FORXCOMMAYZ 324 +#define STRINGID_USINGITEMSTATOFPKMNROSE 325 +#define STRINGID_PKMNUSEDXTOGETPUMPED 326 +#define STRINGID_PKMNSXMADEYUSELESS 327 +#define STRINGID_PKMNTRAPPEDBYSANDTOMB 328 +#define STRINGID_EMPTYSTRING4 329 +#define STRINGID_ABOOSTED 330 +#define STRINGID_PKMNSXINTENSIFIEDSUN 331 +#define STRINGID_PKMNMAKESGROUNDMISS 332 +#define STRINGID_YOUTHROWABALLNOWRIGHT 333 +#define STRINGID_PKMNSXTOOKATTACK 334 +#define STRINGID_PKMNCHOSEXASDESTINY 335 +#define STRINGID_PKMNLOSTFOCUS 336 +#define STRINGID_USENEXTPKMN 337 +#define STRINGID_PKMNFLEDUSINGITS 338 +#define STRINGID_PKMNFLEDUSING 339 +#define STRINGID_PKMNWASDRAGGEDOUT 340 +#define STRINGID_PREVENTEDFROMWORKING 341 +#define STRINGID_PKMNSITEMNORMALIZEDSTATUS 342 +#define STRINGID_TRAINER1USEDITEM 343 +#define STRINGID_BOXISFULL 344 +#define STRINGID_PKMNAVOIDEDATTACK 345 +#define STRINGID_PKMNSXMADEITINEFFECTIVE 346 +#define STRINGID_PKMNSXPREVENTSFLINCHING 347 +#define STRINGID_PKMNALREADYHASBURN 348 +#define STRINGID_STATSWONTDECREASE2 349 +#define STRINGID_PKMNSXBLOCKSY2 350 +#define STRINGID_PKMNSXWOREOFF 351 +#define STRINGID_PKMNRAISEDDEFALITTLE 352 +#define STRINGID_PKMNRAISEDSPDEFALITTLE 353 +#define STRINGID_THEWALLSHATTERED 354 +#define STRINGID_PKMNSXPREVENTSYSZ 355 +#define STRINGID_PKMNSXCUREDITSYPROBLEM 356 +#define STRINGID_ATTACKERCANTESCAPE 357 +#define STRINGID_PKMNOBTAINEDX 358 +#define STRINGID_PKMNOBTAINEDX2 359 +#define STRINGID_PKMNOBTAINEDXYOBTAINEDZ 360 +#define STRINGID_BUTNOEFFECT 361 +#define STRINGID_PKMNSXHADNOEFFECTONY 362 +#define STRINGID_TWOENEMIESDEFEATED 363 +#define STRINGID_TRAINER2LOSETEXT 364 +#define STRINGID_PKMNINCAPABLEOFPOWER 365 +#define STRINGID_GLINTAPPEARSINEYE 366 +#define STRINGID_PKMNGETTINGINTOPOSITION 367 +#define STRINGID_PKMNBEGANGROWLINGDEEPLY 368 +#define STRINGID_PKMNEAGERFORMORE 369 +#define STRINGID_DEFEATEDOPPONENTBYREFEREE 370 +#define STRINGID_LOSTTOOPPONENTBYREFEREE 371 +#define STRINGID_TIEDOPPONENTBYREFEREE 372 +#define STRINGID_QUESTIONFORFEITMATCH 373 +#define STRINGID_FORFEITEDMATCH 374 +#define STRINGID_PKMNTRANSFERREDSOMEONESPC 375 +#define STRINGID_PKMNTRANSFERREDLANETTESPC 376 +#define STRINGID_PKMNBOXSOMEONESPCFULL 377 +#define STRINGID_PKMNBOXLANETTESPCFULL 378 +#define STRINGID_TRAINER1WINTEXT 379 +#define STRINGID_TRAINER2WINTEXT 380 + +#define STRINGID_ENDUREDSTURDY 381 +#define STRINGID_POWERHERB 382 +#define STRINGID_HURTBYITEM 383 +#define STRINGID_PSNBYITEM 384 +#define STRINGID_BRNBYITEM 385 +#define STRINGID_DEFABILITYIN 386 +#define STRINGID_GRAVITYINTENSIFIED 387 +#define STRINGID_TARGETIDENTIFIED 388 +#define STRINGID_TARGETWOKEUP 389 +#define STRINGID_PKMNSTOLEANDATEITEM 390 +#define STRINGID_TAILWINDBLEW 391 +#define STRINGID_PKMNWENTBACK 392 +#define STRINGID_PKMNCANTUSEITEMSANYMORE 393 +#define STRINGID_PKMNFLUNG 394 +#define STRINGID_PKMNPREVENTEDFROMHEALING 395 +#define STRINGID_PKMNSWITCHEDATKANDDEF 396 +#define STRINGID_PKMNSABILITYSUPPRESSED 397 +#define STRINGID_SHIELDEDFROMCRITICALHITS 398 +#define STRINGID_SWITCHEDATKANDSPATK 399 +#define STRINGID_SWITCHEDDEFANDSPDEF 400 +#define STRINGID_PKMNACQUIREDABILITY 401 +#define STRINGID_POISONSPIKESSCATTERED 402 +#define STRINGID_PKMNSWITCHEDSTATCHANGES 403 +#define STRINGID_PKMNSURROUNDEDWITHVEILOFWATER 404 +#define STRINGID_PKMNLEVITATEDONELECTROMAGNETISM 405 +#define STRINGID_PKMNTWISTEDDIMENSIONS 406 +#define STRINGID_POINTEDSTONESFLOAT 407 +#define STRINGID_CLOAKEDINMYSTICALMOONLIGHT 408 +#define STRINGID_TRAPPERBYSWIRLINGMAGMA 409 +#define STRINGID_VANISHEDINSTANTLY 410 +#define STRINGID_PROTECTEDTEAM 411 +#define STRINGID_SHAREDITSGUARD 412 +#define STRINGID_SHAREDITSPOWER 413 +#define STRINGID_SWAPSDEFANDSPDEFOFALLPOKEMON 414 +#define STRINGID_BECAMENIMBLE 415 +#define STRINGID_HURLEDINTOTHEAIR 416 +#define STRINGID_HELDITEMSLOSEEFFECTS 417 +#define STRINGID_FELLSTRAIGHTDOWN 418 +#define STRINGID_TRANSFORMEDINTOWATERTYPE 419 +#define STRINGID_PKMNACQUIREDSIMPLE 420 +#define STRINGID_EMPTYSTRING5 421 +#define STRINGID_KINDOFFER 422 +#define STRINGID_RESETSTARGETSSTATLEVELS 423 +#define STRINGID_EMPTYSTRING6 424 +#define STRINGID_ALLYSWITCHPOSITION 425 +#define STRINGID_RESTORETARGETSHEALTH 426 +#define STRINGID_TOOKPJMNINTOTHESKY 427 +#define STRINGID_FREEDFROMSKYDROP 428 +#define STRINGID_POSTPONETARGETMOVE 429 +#define STRINGID_REFLECTTARGETSTYPE 430 +#define STRINGID_TRANSFERHELDITEM 431 +#define STRINGID_EMBARGOENDS 432 +#define STRINGID_ELECTROMAGNETISM 433 +#define STRINGID_BUFFERENDS 434 +#define STRINGID_TELEKINESISENDS 435 +#define STRINGID_TAILWINDENDS 436 +#define STRINGID_LUCKYCHANTENDS 437 +#define STRINGID_TRICKROOMENDS 438 +#define STRINGID_WONDERROOMENDS 439 +#define STRINGID_MAGICROOMENDS 440 +#define STRINGID_MUDSPORTENDS 441 +#define STRINGID_WATERSPORTENDS 442 +#define STRINGID_GRAVITYENDS 443 +#define STRINGID_AQUARINGHEAL 444 +#define STRINGID_AURORAVEILENDS 445 +#define STRINGID_ELECTRICTERRAINENDS 446 +#define STRINGID_MISTYTERRAINENDS 447 +#define STRINGID_PSYCHICTERRAINENDS 448 +#define STRINGID_GRASSYTERRAINENDS 449 +#define STRINGID_TARGETABILITYSTATRAISE 450 +#define STRINGID_TARGETSSTATWASMAXEDOUT 451 +#define STRINGID_ATTACKERABILITYSTATRAISE 452 +#define STRINGID_POISONHEALHPUP 453 +#define STRINGID_BADDREAMSDMG 454 +#define STRINGID_MOLDBREAKERENTERS 455 +#define STRINGID_TERAVOLTENTERS 456 +#define STRINGID_TURBOBLAZEENTERS 457 +#define STRINGID_SLOWSTARTENTERS 458 +#define STRINGID_SLOWSTARTEND 459 +#define STRINGID_SOLARPOWERHPDROP 460 +#define STRINGID_AFTERMATHDMG 461 +#define STRINGID_ANTICIPATIONACTIVATES 462 +#define STRINGID_FOREWARNACTIVATES 463 +#define STRINGID_ICEBODYHPGAIN 464 +#define STRINGID_SNOWWARNINGHAIL 465 +#define STRINGID_FRISKACTIVATES 466 +#define STRINGID_UNNERVEENTERS 467 +#define STRINGID_HARVESTBERRY 468 +#define STRINGID_LASTABILITYRAISEDSTAT 469 +#define STRINGID_MAGICBOUNCEACTIVATES 470 +#define STRINGID_PROTEANTYPECHANGE 471 +#define STRINGID_SYMBIOSISITEMPASS 472 +#define STRINGID_STEALTHROCKDMG 473 +#define STRINGID_TOXICSPIKESABSORBED 474 +#define STRINGID_TOXICSPIKESPOISONED 475 +#define STRINGID_STICKYWEBSWITCHIN 476 +#define STRINGID_HEALINGWISHCAMETRUE 477 +#define STRINGID_HEALINGWISHHEALED 478 +#define STRINGID_LUNARDANCECAMETRUE 479 +#define STRINGID_CUSEDBODYDISABLED 480 +#define STRINGID_ATTACKERACQUIREDABILITY 481 +#define STRINGID_TARGETABILITYSTATLOWER 482 +#define STRINGID_TARGETSTATWONTGOHIGHER 483 +#define STRINGID_PKMNMOVEBOUNCEDABILITY 484 +#define STRINGID_IMPOSTERTRANSFORM 485 +#define STRINGID_ASSAULTVESTDOESNTALLOW 486 +#define STRINGID_GRAVITYPREVENTSUSAGE 487 +#define STRINGID_HEALBLOCKPREVENTSUSAGE 488 +#define STRINGID_NOTDONEYET 489 +#define STRINGID_STICKYWEBUSED 490 +#define STRINGID_QUASHSUCCESS 491 +#define STRINGID_PKMNBLEWAWAYTOXICSPIKES 492 +#define STRINGID_PKMNBLEWAWAYSTICKYWEB 493 +#define STRINGID_PKMNBLEWAWAYSTEALTHROCK 494 +#define STRINGID_IONDELUGEON 495 +#define STRINGID_TOPSYTURVYSWITCHEDSTATS 496 +#define STRINGID_TERRAINBECOMESMISTY 497 +#define STRINGID_TERRAINBECOMESGRASSY 498 +#define STRINGID_TERRAINBECOMESELECTRIC 499 +#define STRINGID_TERRAINBECOMESPSYCHIC 500 +#define STRINGID_TARGETELECTRIFIED 501 +#define STRINGID_MEGAEVOREACTING 502 +#define STRINGID_MEGAEVOEVOLVED 503 +#define STRINGID_DRASTICALLY 504 +#define STRINGID_SEVERELY 505 +#define STRINGID_INFESTATION 506 +#define STRINGID_NOEFFECTONTARGET 507 +#define STRINGID_BURSTINGFLAMESHIT 508 +#define STRINGID_BESTOWITEMGIVING 509 +#define STRINGID_THIRDTYPEADDED 510 +#define STRINGID_FELLFORFEINT 511 +#define STRINGID_POKEMONCANNOTUSEMOVE 512 +#define STRINGID_COVEREDINPOWDER 513 +#define STRINGID_POWDEREXPLODES 514 +#define STRINGID_BELCHCANTSELECT 515 +#define STRINGID_SPECTRALTHIEFSTEAL 516 +#define STRINGID_GRAVITYGROUNDING 517 +#define STRINGID_MISTYTERRAINPREVENTS 518 +#define STRINGID_GRASSYTERRAINHEALS 519 +#define STRINGID_ELECTRICTERRAINPREVENTS 520 +#define STRINGID_PSYCHICTERRAINPREVENTS 521 +#define STRINGID_SAFETYGOOGLESPROTECTED 522 +#define STRINGID_FLOWERVEILPROTECTED 523 +#define STRINGID_SWEETVEILPROTECTED 524 +#define STRINGID_AROMAVEILPROTECTED 525 +#define STRINGID_CELEBRATEMESSAGE 526 +#define STRINGID_USEDINSTRUCTEDMOVE 527 +#define STRINGID_THROATCHOPENDS 528 +#define STRINGID_PKMNCANTUSEMOVETHROATCHOP 529 +#define STRINGID_LASERFOCUS 530 +#define STRINGID_GEMACTIVATES 531 +#define STRINGID_BERRYDMGREDUCES 532 +#define STRINGID_TARGETATEITEM 533 +#define STRINGID_AIRBALLOONFLOAT 534 +#define STRINGID_AIRBALLOONPOP 535 +#define STRINGID_INCINERATEBURN 536 +#define STRINGID_BUGBITE 537 +#define STRINGID_ILLUSIONWOREOFF 538 +#define STRINGID_ATTACKERCUREDTARGETSTATUS 539 +#define STRINGID_ATTACKERLOSTFIRETYPE 540 +#define STRINGID_HEALERCURE 541 +#define STRINGID_SCRIPTINGABILITYSTATRAISE 542 +#define STRINGID_RECEIVERABILITYTAKEOVER 543 +#define STRINGID_PKNMABSORBINGPOWER 544 +#define STRINGID_NOONEWILLBEABLETORUNAWAY 545 +#define STRINGID_DESTINYKNOTACTIVATES 546 +#define STRINGID_CLOAKEDINAFREEZINGLIGHT 547 +#define STRINGID_STATWASNOTLOWERED 548 +#define STRINGID_FERVENTWISHREACHED 549 +#define STRINGID_AIRLOCKACTIVATES 550 +#define STRINGID_PRESSUREENTERS 551 +#define STRINGID_DARKAURAENTERS 552 +#define STRINGID_FAIRYAURAENTERS 553 +#define STRINGID_AURABREAKENTERS 554 +#define STRINGID_COMATOSEENTERS 555 +#define STRINGID_SCREENCLEANERENTERS 556 +#define STRINGID_FETCHEDPOKEBALL 557 +#define STRINGID_BATTLERABILITYRAISEDSTAT 558 +#define STRINGID_ASANDSTORMKICKEDUP 559 +#define STRINGID_PKMNSWILLPERISHIN3TURNS 560 +#define STRINGID_ABILITYRAISEDSTATDRASTICALLY 561 +#define STRINGID_AURAFLAREDTOLIFE 562 +#define STRINGID_ASONEENTERS 563 +#define STRINGID_CURIOUSMEDICINEENTERS 564 +#define STRINGID_CANACTFASTERTHANKSTO 565 +#define STRINGID_MICLEBERRYACTIVATES 566 +#define STRINGID_PKMNSHOOKOFFTHETAUNT 567 +#define STRINGID_PKMNGOTOVERITSINFATUATION 568 +#define STRINGID_EXTREMELYHARSHSUNLIGHT 569 +#define STRINGID_EXTREMESUNLIGHTFADED 570 +#define STRINGID_MOVEEVAPORATEDINTHEHARSHSUNLIGHT 571 +#define STRINGID_EXTREMELYHARSHSUNLIGHTWASNOTLESSENED 572 +#define STRINGID_HEAVYRAIN 573 +#define STRINGID_HEAVYRAINLIFTED 574 +#define STRINGID_MOVEFIZZLEDOUTINTHEHEAVYRAIN 575 +#define STRINGID_NORELIEFROMHEAVYRAIN 576 +#define STRINGID_MYSTERIOUSAIRCURRENT 577 +#define STRINGID_STRONGWINDSDISSIPATED 578 +#define STRINGID_MYSTERIOUSAIRCURRENTBLOWSON 579 +#define STRINGID_ATTACKWEAKENEDBSTRONGWINDS 580 -#define STRINGID_ENDUREDSTURDY 381 -#define STRINGID_POWERHERB 382 -#define STRINGID_HURTBYITEM 383 -#define STRINGID_PSNBYITEM 384 -#define STRINGID_BRNBYITEM 385 -#define STRINGID_DEFABILITYIN 386 -#define STRINGID_GRAVITYINTENSIFIED 387 -#define STRINGID_TARGETIDENTIFIED 388 -#define STRINGID_TARGETWOKEUP 389 -#define STRINGID_PKMNSTOLEANDATEITEM 390 -#define STRINGID_TAILWINDBLEW 391 -#define STRINGID_PKMNWENTBACK 392 -#define STRINGID_PKMNCANTUSEITEMSANYMORE 393 -#define STRINGID_PKMNFLUNG 394 -#define STRINGID_PKMNPREVENTEDFROMHEALING 395 -#define STRINGID_PKMNSWITCHEDATKANDDEF 396 -#define STRINGID_PKMNSABILITYSUPPRESSED 397 -#define STRINGID_SHIELDEDFROMCRITICALHITS 398 -#define STRINGID_SWITCHEDATKANDSPATK 399 -#define STRINGID_SWITCHEDDEFANDSPDEF 400 -#define STRINGID_PKMNACQUIREDABILITY 401 -#define STRINGID_POISONSPIKESSCATTERED 402 -#define STRINGID_PKMNSWITCHEDSTATCHANGES 403 -#define STRINGID_PKMNSURROUNDEDWITHVEILOFWATER 404 -#define STRINGID_PKMNLEVITATEDONELECTROMAGNETISM 405 -#define STRINGID_PKMNTWISTEDDIMENSIONS 406 -#define STRINGID_POINTEDSTONESFLOAT 407 -#define STRINGID_CLOAKEDINMYSTICALMOONLIGHT 408 -#define STRINGID_TRAPPERBYSWIRLINGMAGMA 409 -#define STRINGID_VANISHEDINSTANTLY 410 -#define STRINGID_PROTECTEDTEAM 411 -#define STRINGID_SHAREDITSGUARD 412 -#define STRINGID_SHAREDITSPOWER 413 -#define STRINGID_SWAPSDEFANDSPDEFOFALLPOKEMON 414 -#define STRINGID_BECAMENIMBLE 415 -#define STRINGID_HURLEDINTOTHEAIR 416 -#define STRINGID_HELDITEMSLOSEEFFECTS 417 -#define STRINGID_FELLSTRAIGHTDOWN 418 -#define STRINGID_TRANSFORMEDINTOWATERTYPE 419 -#define STRINGID_PKMNACQUIREDSIMPLE 420 -#define STRINGID_EMPTYSTRING5 421 -#define STRINGID_KINDOFFER 422 -#define STRINGID_RESETSTARGETSSTATLEVELS 423 -#define STRINGID_EMPTYSTRING6 424 -#define STRINGID_ALLYSWITCHPOSITION 425 -#define STRINGID_RESTORETARGETSHEALTH 426 -#define STRINGID_TOOKPJMNINTOTHESKY 427 -#define STRINGID_FREEDFROMSKYDROP 428 -#define STRINGID_POSTPONETARGETMOVE 429 -#define STRINGID_REFLECTTARGETSTYPE 430 -#define STRINGID_TRANSFERHELDITEM 431 -#define STRINGID_EMBARGOENDS 432 -#define STRINGID_ELECTROMAGNETISM 433 -#define STRINGID_BUFFERENDS 434 -#define STRINGID_TELEKINESISENDS 435 -#define STRINGID_TAILWINDENDS 436 -#define STRINGID_LUCKYCHANTENDS 437 -#define STRINGID_TRICKROOMENDS 438 -#define STRINGID_WONDERROOMENDS 439 -#define STRINGID_MAGICROOMENDS 440 -#define STRINGID_MUDSPORTENDS 441 -#define STRINGID_WATERSPORTENDS 442 -#define STRINGID_GRAVITYENDS 443 -#define STRINGID_AQUARINGHEAL 444 -#define STRINGID_AURORAVEILENDS 445 -#define STRINGID_ELECTRICTERRAINENDS 446 -#define STRINGID_MISTYTERRAINENDS 447 -#define STRINGID_PSYCHICTERRAINENDS 448 -#define STRINGID_GRASSYTERRAINENDS 449 -#define STRINGID_TARGETABILITYSTATRAISE 450 -#define STRINGID_TARGETSSTATWASMAXEDOUT 451 -#define STRINGID_ATTACKERABILITYSTATRAISE 452 -#define STRINGID_POISONHEALHPUP 453 -#define STRINGID_BADDREAMSDMG 454 -#define STRINGID_MOLDBREAKERENTERS 455 -#define STRINGID_TERAVOLTENTERS 456 -#define STRINGID_TURBOBLAZEENTERS 457 -#define STRINGID_SLOWSTARTENTERS 458 -#define STRINGID_SLOWSTARTEND 459 -#define STRINGID_SOLARPOWERHPDROP 460 -#define STRINGID_AFTERMATHDMG 461 -#define STRINGID_ANTICIPATIONACTIVATES 462 -#define STRINGID_FOREWARNACTIVATES 463 -#define STRINGID_ICEBODYHPGAIN 464 -#define STRINGID_SNOWWARNINGHAIL 465 -#define STRINGID_FRISKACTIVATES 466 -#define STRINGID_UNNERVEENTERS 467 -#define STRINGID_HARVESTBERRY 468 -#define STRINGID_LASTABILITYRAISEDSTAT 469 -#define STRINGID_MAGICBOUNCEACTIVATES 470 -#define STRINGID_PROTEANTYPECHANGE 471 -#define STRINGID_SYMBIOSISITEMPASS 472 -#define STRINGID_STEALTHROCKDMG 473 -#define STRINGID_TOXICSPIKESABSORBED 474 -#define STRINGID_TOXICSPIKESPOISONED 475 -#define STRINGID_STICKYWEBSWITCHIN 476 -#define STRINGID_HEALINGWISHCAMETRUE 477 -#define STRINGID_HEALINGWISHHEALED 478 -#define STRINGID_LUNARDANCECAMETRUE 479 -#define STRINGID_CUSEDBODYDISABLED 480 -#define STRINGID_ATTACKERACQUIREDABILITY 481 -#define STRINGID_TARGETABILITYSTATLOWER 482 -#define STRINGID_TARGETSTATWONTGOHIGHER 483 -#define STRINGID_PKMNMOVEBOUNCEDABILITY 484 -#define STRINGID_IMPOSTERTRANSFORM 485 -#define STRINGID_ASSAULTVESTDOESNTALLOW 486 -#define STRINGID_GRAVITYPREVENTSUSAGE 487 -#define STRINGID_HEALBLOCKPREVENTSUSAGE 488 -#define STRINGID_NOTDONEYET 489 -#define STRINGID_STICKYWEBUSED 490 -#define STRINGID_QUASHSUCCESS 491 -#define STRINGID_PKMNBLEWAWAYTOXICSPIKES 492 -#define STRINGID_PKMNBLEWAWAYSTICKYWEB 493 -#define STRINGID_PKMNBLEWAWAYSTEALTHROCK 494 -#define STRINGID_IONDELUGEON 495 -#define STRINGID_TOPSYTURVYSWITCHEDSTATS 496 -#define STRINGID_TERRAINBECOMESMISTY 497 -#define STRINGID_TERRAINBECOMESGRASSY 498 -#define STRINGID_TERRAINBECOMESELECTRIC 499 -#define STRINGID_TERRAINBECOMESPSYCHIC 500 -#define STRINGID_TARGETELECTRIFIED 501 -#define STRINGID_MEGAEVOREACTING 502 -#define STRINGID_MEGAEVOEVOLVED 503 -#define STRINGID_DRASTICALLY 504 -#define STRINGID_SEVERELY 505 -#define STRINGID_INFESTATION 506 -#define STRINGID_NOEFFECTONTARGET 507 -#define STRINGID_BURSTINGFLAMESHIT 508 -#define STRINGID_BESTOWITEMGIVING 509 -#define STRINGID_THIRDTYPEADDED 510 -#define STRINGID_FELLFORFEINT 511 -#define STRINGID_POKEMONCANNOTUSEMOVE 512 -#define STRINGID_COVEREDINPOWDER 513 -#define STRINGID_POWDEREXPLODES 514 -#define STRINGID_BELCHCANTSELECT 515 -#define STRINGID_SPECTRALTHIEFSTEAL 516 -#define STRINGID_GRAVITYGROUNDING 517 -#define STRINGID_MISTYTERRAINPREVENTS 518 -#define STRINGID_GRASSYTERRAINHEALS 519 -#define STRINGID_ELECTRICTERRAINPREVENTS 520 -#define STRINGID_PSYCHICTERRAINPREVENTS 521 -#define STRINGID_SAFETYGOOGLESPROTECTED 522 -#define STRINGID_FLOWERVEILPROTECTED 523 -#define STRINGID_SWEETVEILPROTECTED 524 -#define STRINGID_AROMAVEILPROTECTED 525 -#define STRINGID_CELEBRATEMESSAGE 526 -#define STRINGID_USEDINSTRUCTEDMOVE 527 -#define STRINGID_THROATCHOPENDS 528 -#define STRINGID_PKMNCANTUSEMOVETHROATCHOP 529 -#define STRINGID_LASERFOCUS 530 -#define STRINGID_GEMACTIVATES 531 -#define STRINGID_BERRYDMGREDUCES 532 -#define STRINGID_TARGETATEITEM 533 -#define STRINGID_AIRBALLOONFLOAT 534 -#define STRINGID_AIRBALLOONPOP 535 -#define STRINGID_INCINERATEBURN 536 -#define STRINGID_BUGBITE 537 -#define STRINGID_ILLUSIONWOREOFF 538 -#define STRINGID_ATTACKERCUREDTARGETSTATUS 539 -#define STRINGID_ATTACKERLOSTFIRETYPE 540 -#define STRINGID_HEALERCURE 541 -#define STRINGID_SCRIPTINGABILITYSTATRAISE 542 -#define STRINGID_RECEIVERABILITYTAKEOVER 543 -#define STRINGID_PKNMABSORBINGPOWER 544 -#define STRINGID_NOONEWILLBEABLETORUNAWAY 545 -#define STRINGID_DESTINYKNOTACTIVATES 546 -#define STRINGID_CLOAKEDINAFREEZINGLIGHT 547 -#define STRINGID_STATWASNOTLOWERED 548 -#define STRINGID_FERVENTWISHREACHED 549 -#define STRINGID_AIRLOCKACTIVATES 550 -#define STRINGID_PRESSUREENTERS 551 -#define STRINGID_DARKAURAENTERS 552 -#define STRINGID_FAIRYAURAENTERS 553 -#define STRINGID_AURABREAKENTERS 554 -#define STRINGID_COMATOSEENTERS 555 -#define STRINGID_SCREENCLEANERENTERS 556 -#define STRINGID_FETCHEDPOKEBALL 557 -#define STRINGID_BATTLERABILITYRAISEDSTAT 558 -#define STRINGID_ASANDSTORMKICKEDUP 559 -#define STRINGID_PKMNSWILLPERISHIN3TURNS 560 -#define STRINGID_ABILITYRAISEDSTATDRASTICALLY 561 -#define STRINGID_AURAFLAREDTOLIFE 562 -#define STRINGID_ASONEENTERS 563 -#define STRINGID_CURIOUSMEDICINEENTERS 564 -#define STRINGID_CANACTFASTERTHANKSTO 565 -#define STRINGID_MICLEBERRYACTIVATES 566 -#define STRINGID_PKMNSHOOKOFFTHETAUNT 567 -#define STRINGID_PKMNGOTOVERITSINFATUATION 568 - -#define BATTLESTRINGS_COUNT 569 +#define BATTLESTRINGS_COUNT 581 // The below IDs are all indexes into battle message tables, // used to determine which of a set of messages to print. diff --git a/src/battle_message.c b/src/battle_message.c index 8a00cbf2b..fdc1d8a1e 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -696,9 +696,33 @@ static const u8 sText_CanActFaster[] = _("{B_ATK_NAME_WITH_PREFIX} can act faste static const u8 sText_MicleBerryActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} boosted the accuracy of its\nnext move using {B_LAST_ITEM}!"); static const u8 sText_PkmnShookOffTheTaunt[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} shook off\nthe taunt!"); static const u8 sText_PkmnGotOverItsInfatuation[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} got over\nits infatuation!"); +static const u8 sText_ExtremelyHarshSunlight[] = _("The sunlight turned\nextremely harsh!"); +static const u8 sText_ExtremeSunlightFaded[] = _("The extreme sunlight faded.{PAUSE 64}"); +static const u8 sText_MoveEvaporatedInTheHarshSunlight[] = _("The Water-type attack evaporated\nin the harsh sunlight!"); +static const u8 sText_ExtremelyHarshSunlightWasNotLessened[] = _("The extremely harsh sunlight\nwas not lessened at all!"); +static const u8 sText_HeavyRain[] = _("A heavy rain began to fall!"); +static const u8 sText_HeavyRainLifted[] = _("The heavy rain has lifted!{PAUSE 64}"); +static const u8 sText_MoveFizzledOutInTheHeavyRain[] = _("The Fire-type attack fizzled out\nin the heavy rain!"); +static const u8 sText_NoReliefFromHeavyRain[] = _("There is no relief from\nthis heavy rain!"); +static const u8 sText_MysteriousAirCurrent[] = _("A mysterious air current is\nprotecting Flying-type Pokémon!"); +static const u8 sText_StrongWindsDissipated[] = _("The mysterious strong winds\nhave dissipated!{PAUSE 64}"); +static const u8 sText_MysteriousAirCurrentBlowsOn[] = _("The mysterious air current\nblows on regardless!"); +static const u8 sText_AttackWeakenedByStrongWinds[] = _("The mysterious strong winds\nweakened the attack!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_ATTACKWEAKENEDBSTRONGWINDS - 12] = sText_AttackWeakenedByStrongWinds, + [STRINGID_MYSTERIOUSAIRCURRENTBLOWSON - 12] = sText_MysteriousAirCurrentBlowsOn, + [STRINGID_STRONGWINDSDISSIPATED - 12] = sText_StrongWindsDissipated, + [STRINGID_MYSTERIOUSAIRCURRENT - 12] = sText_MysteriousAirCurrent, + [STRINGID_NORELIEFROMHEAVYRAIN - 12] = sText_NoReliefFromHeavyRain, + [STRINGID_MOVEFIZZLEDOUTINTHEHEAVYRAIN - 12] = sText_MoveFizzledOutInTheHeavyRain, + [STRINGID_HEAVYRAINLIFTED - 12] = sText_HeavyRainLifted, + [STRINGID_HEAVYRAIN - 12] = sText_HeavyRain, + [STRINGID_EXTREMELYHARSHSUNLIGHTWASNOTLESSENED - 12] = sText_ExtremelyHarshSunlightWasNotLessened, + [STRINGID_MOVEEVAPORATEDINTHEHARSHSUNLIGHT - 12] = sText_MoveEvaporatedInTheHarshSunlight, + [STRINGID_EXTREMESUNLIGHTFADED - 12] = sText_ExtremeSunlightFaded, + [STRINGID_EXTREMELYHARSHSUNLIGHT - 12] = sText_ExtremelyHarshSunlight, [STRINGID_PKMNGOTOVERITSINFATUATION - 12] = sText_PkmnGotOverItsInfatuation, [STRINGID_PKMNSHOOKOFFTHETAUNT - 12] = sText_PkmnShookOffTheTaunt, [STRINGID_MICLEBERRYACTIVATES - 12] = sText_MicleBerryActivates, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 21bc7945b..85cd16066 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1323,6 +1323,30 @@ static void Cmd_attackcanceler(void) { s32 i, moveType; + GET_MOVE_TYPE(gCurrentMove, moveType); + if (moveType == TYPE_FIRE + && (gBattleWeather & WEATHER_RAIN_PRIMAL) + && !IsAbilityOnField(ABILITY_AIR_LOCK) + && !IsAbilityOnField(ABILITY_CLOUD_NINE) + && gBattleMoves[gCurrentMove].power >= 1) + { + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_PrimordialSeaFizzlesOutFireTypeMoves; + return; + } + + GET_MOVE_TYPE(gCurrentMove, moveType); + if (moveType == TYPE_WATER + && (gBattleWeather & WEATHER_SUN_PRIMAL) + && !IsAbilityOnField(ABILITY_AIR_LOCK) + && !IsAbilityOnField(ABILITY_CLOUD_NINE) + && gBattleMoves[gCurrentMove].power >= 1) + { + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_DesolateLandEvaporatesWaterTypeMoves; + return; + } + if (gBattleOutcome != 0) { gCurrentActionFuncId = B_ACTION_FINISHED; @@ -8422,6 +8446,26 @@ static void Cmd_various(void) gBattlescriptCurrInstr += 7; // exit if loop failed (failsafe) } return; + case VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER: + if (gBattleWeather & WEATHER_SUN_PRIMAL) + { + gBattleWeather &= ~WEATHER_SUN_PRIMAL; + PrepareStringBattle(STRINGID_EXTREMESUNLIGHTFADED, gActiveBattler); + gBattleCommunication[MSG_DISPLAY] = 1; + } + else if (gBattleWeather & WEATHER_RAIN_PRIMAL) + { + gBattleWeather &= ~WEATHER_RAIN_PRIMAL; + PrepareStringBattle(STRINGID_HEAVYRAINLIFTED, gActiveBattler); + gBattleCommunication[MSG_DISPLAY] = 1; + } + else if (gBattleWeather & WEATHER_STRONG_WINDS) + { + gBattleWeather &= ~WEATHER_STRONG_WINDS; + PrepareStringBattle(STRINGID_STRONGWINDSDISSIPATED, gActiveBattler); + gBattleCommunication[MSG_DISPLAY] = 1; + } + break; } gBattlescriptCurrInstr += 3; diff --git a/src/battle_util.c b/src/battle_util.c index b85ad9fab..a231f14cd 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2098,9 +2098,10 @@ u8 DoFieldEndTurnEffects(void) } break; case ENDTURN_RAIN: - if (gBattleWeather & WEATHER_RAIN_ANY) + if (gBattleWeather & WEATHER_RAIN_ANY || gBattleWeather & WEATHER_RAIN_PRIMAL) { - if (!(gBattleWeather & WEATHER_RAIN_PERMANENT)) + if (!(gBattleWeather & WEATHER_RAIN_PERMANENT) + && !(gBattleWeather & WEATHER_RAIN_PRIMAL)) { if (--gWishFutureKnock.weatherDuration == 0) { @@ -2148,9 +2149,11 @@ u8 DoFieldEndTurnEffects(void) gBattleStruct->turnCountersTracker++; break; case ENDTURN_SUN: - if (gBattleWeather & WEATHER_SUN_ANY) + if (gBattleWeather & WEATHER_SUN_ANY || gBattleWeather & WEATHER_SUN_PRIMAL) { - if (!(gBattleWeather & WEATHER_SUN_PERMANENT) && --gWishFutureKnock.weatherDuration == 0) + if (!(gBattleWeather & WEATHER_SUN_PERMANENT) + && !(gBattleWeather & WEATHER_SUN_PRIMAL) + && --gWishFutureKnock.weatherDuration == 0) { gBattleWeather &= ~WEATHER_SUN_TEMPORARY; gBattlescriptCurrInstr = BattleScript_SunlightFaded; @@ -3643,9 +3646,12 @@ u8 TryWeatherFormChange(u8 battler) static const u16 sWeatherFlagsInfo[][3] = { [ENUM_WEATHER_RAIN] = {WEATHER_RAIN_TEMPORARY, WEATHER_RAIN_PERMANENT, HOLD_EFFECT_DAMP_ROCK}, + [ENUM_WEATHER_RAIN_PRIMAL] = {WEATHER_RAIN_PRIMAL, WEATHER_RAIN_PRIMAL, HOLD_EFFECT_DAMP_ROCK}, [ENUM_WEATHER_SUN] = {WEATHER_SUN_TEMPORARY, WEATHER_SUN_PERMANENT, HOLD_EFFECT_HEAT_ROCK}, + [ENUM_WEATHER_SUN_PRIMAL] = {WEATHER_SUN_PRIMAL, WEATHER_SUN_PRIMAL, HOLD_EFFECT_HEAT_ROCK}, [ENUM_WEATHER_SANDSTORM] = {WEATHER_SANDSTORM_TEMPORARY, WEATHER_SANDSTORM_PERMANENT, HOLD_EFFECT_SMOOTH_ROCK}, [ENUM_WEATHER_HAIL] = {WEATHER_HAIL_TEMPORARY, WEATHER_HAIL_PERMANENT, HOLD_EFFECT_ICY_ROCK}, + [ENUM_WEATHER_STRONG_WINDS] = {WEATHER_STRONG_WINDS, WEATHER_STRONG_WINDS, HOLD_EFFECT_NONE}, }; bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility) @@ -3656,6 +3662,13 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility) gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]); return TRUE; } + else if (gBattleWeather & WEATHER_PRIMAL_ANY + && GetBattlerAbility(battler) != ABILITY_DESOLATE_LAND + && GetBattlerAbility(battler) != ABILITY_PRIMORDIAL_SEA + && GetBattlerAbility(battler) != ABILITY_DELTA_STREAM) + { + return FALSE; + } else if (!(gBattleWeather & (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]))) { gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0]); @@ -4233,6 +4246,27 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_DESOLATE_LAND: + if (TryChangeBattleWeather(battler, ENUM_WEATHER_SUN_PRIMAL, TRUE)) + { + BattleScriptPushCursorAndCallback(BattleScript_DesolateLandActivates); + effect++; + } + break; + case ABILITY_PRIMORDIAL_SEA: + if (TryChangeBattleWeather(battler, ENUM_WEATHER_RAIN_PRIMAL, TRUE)) + { + BattleScriptPushCursorAndCallback(BattleScript_PrimordialSeaActivates); + effect++; + } + break; + case ABILITY_DELTA_STREAM: + if (TryChangeBattleWeather(battler, ENUM_WEATHER_STRONG_WINDS, TRUE)) + { + BattleScriptPushCursorAndCallback(BattleScript_DeltaStreamActivates); + effect++; + } + break; } break; case ABILITYEFFECT_ENDTURN: // 1 @@ -8105,6 +8139,18 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat modifier = UQ_4_12(1.0); } + // WEATHER_STRONG_WINDS weakens super effective moves against flying type mons + if (gBattleWeather & WEATHER_STRONG_WINDS + && modifier == UQ_4_12(2.0) + && (IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING)) + && !IsAbilityOnField(ABILITY_AIR_LOCK) + && !IsAbilityOnField(ABILITY_CLOUD_NINE)) + { + modifier = UQ_4_12(1.0); + gBattlescriptCurrInstr = BattleScript_AttackWeakenedByStrongWinds; + gBattlescriptCurrInstr++; + } + if (GetBattlerAbility(battlerDef) == ABILITY_WONDER_GUARD && modifier <= UQ_4_12(1.0) && gBattleMoves[move].power) { modifier = UQ_4_12(0.0); From 216d8f0608af0b44f472437c1a6ee095955af1b4 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 27 Aug 2021 18:28:34 -0300 Subject: [PATCH 07/37] Solved game freezing issue My approach with BattleScript_AttackWeakenedByStrongWinds was incorrect and thus caused the game to freeze when Battle Scene is enabled, so I resorted to printing the string directly, which I don't like because there is no pauses between `attackstring` and `STRINGID_ATTACKWEAKENEDBSTRONGWINDS`. --- data/battle_scripts_1.s | 9 --------- include/battle_scripts.h | 1 - src/battle_util.c | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 63c300a74..f46bffcf3 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6936,15 +6936,6 @@ BattleScript_DeltaStreamActivates:: waitmessage B_WAIT_TIME_LONG end3 -BattleScript_AttackWeakenedByStrongWinds:: - pause B_WAIT_TIME_SHORT - call BattleScript_AbilityPopUp - printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS - waitmessage B_WAIT_TIME_LONG - printstring STRINGID_EMPTYSTRING3 - waitmessage 1 - goto BattleScript_HitFromAtkAnimation - BattleScript_SnowWarningActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp diff --git a/include/battle_scripts.h b/include/battle_scripts.h index f3470776a..28118b21c 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -375,6 +375,5 @@ extern const u8 BattleScript_PrimordialSeaActivates[]; extern const u8 BattleScript_PrimordialSeaFizzlesOutFireTypeMoves[]; extern const u8 BattleScript_DeltaStreamActivates[]; extern const u8 BattleScript_MysteriousAirCurrentBlowsOn[]; -extern const u8 BattleScript_AttackWeakenedByStrongWinds[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/src/battle_util.c b/src/battle_util.c index a231f14cd..e258daac5 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8147,7 +8147,7 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat && !IsAbilityOnField(ABILITY_CLOUD_NINE)) { modifier = UQ_4_12(1.0); - gBattlescriptCurrInstr = BattleScript_AttackWeakenedByStrongWinds; + PrepareStringBattle(STRINGID_ATTACKWEAKENEDBSTRONGWINDS, battlerDef); gBattlescriptCurrInstr++; } From c0c6821f6299e3a143291ff5977d9f397c41919b Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 30 Aug 2021 19:48:59 -0300 Subject: [PATCH 08/37] Made AI_CheckBadMove take the primal weathers into account Credits to Syreldar. Also took the chance and removed trailing spaces from the file. --- src/battle_ai_main.c | 278 +++++++++++++++++++++++++------------------ 1 file changed, 163 insertions(+), 115 deletions(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 07f5e68fc..f6ed7335d 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -249,7 +249,7 @@ static u8 ChooseMoveOrAction_Singles(void) RecordLastUsedMoveByTarget(); GetAiLogicData(sBattler_AI, gBattlerTarget); - + while (flags != 0) { if (flags & 1) @@ -364,10 +364,10 @@ static u8 ChooseMoveOrAction_Doubles(void) BattleAI_SetupAIData(gBattleStruct->palaceFlags >> 4); else BattleAI_SetupAIData(0xF); - + gBattlerTarget = i; GetAiLogicData(sBattler_AI, gBattlerTarget); - + if ((i & BIT_SIDE) != (sBattler_AI & BIT_SIDE)) RecordLastUsedMoveByTarget(); @@ -510,19 +510,21 @@ static void BattleAI_DoAIProcessing(void) static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { // move data + s32 moveType; u8 atkPriority = GetMovePriority(battlerAtk, move); u16 moveEffect = gBattleMoves[move].effect; - u8 moveType = gBattleMoves[move].type; u8 moveTarget = gBattleMoves[move].target; u16 accuracy = AI_GetMoveAccuracy(battlerAtk, battlerDef, AI_DATA->atkAbility, AI_DATA->defAbility, AI_DATA->atkHoldEffect, AI_DATA->defHoldEffect, move); u8 effectiveness = AI_GetMoveEffectiveness(move, battlerAtk, battlerDef); bool32 isDoubleBattle = IsValidDoubleBattle(battlerAtk); u32 i; u16 predictedMove = gLastMoves[battlerDef]; // TODO better move prediction - + if (IsTargetingPartner(battlerAtk, battlerDef)) return score; - + + GET_MOVE_TYPE(move, move); + // check non-user target if (!(gBattleMoves[move].target & MOVE_TARGET_USER)) { @@ -532,7 +534,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { RETURN_SCORE_MINUS(20); } - + // check ground immunities if (moveType == TYPE_GROUND && !IsBattlerGrounded(battlerDef) @@ -544,11 +546,11 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { RETURN_SCORE_MINUS(20); } - + // check off screen if (IsSemiInvulnerable(battlerDef, move) && moveEffect != EFFECT_SEMI_INVULNERABLE && GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) != 1) RETURN_SCORE_MINUS(20); // if target off screen and we go first, don't use move - + // check if negates type switch (effectiveness) { @@ -559,7 +561,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) RETURN_SCORE_MINUS(10); break; } - + // target ability checks if (!DoesBattlerIgnoreAbilityChecks(AI_DATA->atkAbility, move)) { @@ -674,7 +676,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) RETURN_SCORE_MINUS(10); break; } // def ability checks - + // target partner ability checks & not attacking partner if (isDoubleBattle) { @@ -712,35 +714,35 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } } // def partner ability checks } // ignore def ability check - + // gen7+ dark type mons immune to priority->elevated moves from prankster #if B_PRANKSTER >= GEN_7 if (AI_DATA->atkAbility == ABILITY_PRANKSTER && IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK) && IS_MOVE_STATUS(move) && !(moveTarget & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_USER))) RETURN_SCORE_MINUS(10); #endif - + // terrain & effect checks if (AI_IsTerrainAffected(battlerDef, STATUS_FIELD_ELECTRIC_TERRAIN)) { if (moveEffect == EFFECT_SLEEP || moveEffect == EFFECT_YAWN) RETURN_SCORE_MINUS(20); } - + if (AI_IsTerrainAffected(battlerDef, STATUS_FIELD_MISTY_TERRAIN)) { if (IsNonVolatileStatusMoveEffect(moveEffect) || IsConfusionMoveEffect(moveEffect)) RETURN_SCORE_MINUS(20); } - + if (AI_IsTerrainAffected(battlerAtk, STATUS_FIELD_PSYCHIC_TERRAIN) && atkPriority > 0) { RETURN_SCORE_MINUS(20); } } // end check MOVE_TARGET_USER - + // the following checks apply to any target (including user) - + // throat chop check if (gDisableStructs[battlerAtk].throatChopTimer && TestMoveFlags(move, FLAG_SOUND)) return 0; // Can't even select move at all @@ -748,8 +750,35 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (gStatuses3[battlerAtk] & STATUS3_HEAL_BLOCK && IsHealBlockPreventingMove(battlerAtk, move)) return 0; // Can't even select heal blocked move // primal weather check - //TODO - + if (WEATHER_HAS_EFFECT) + { + if (gBattleWeather & WEATHER_PRIMAL_ANY) + { + switch (move) + { + case MOVE_SUNNY_DAY: + case MOVE_RAIN_DANCE: + case MOVE_HAIL: + case MOVE_SANDSTORM: + RETURN_SCORE_MINUS(30); + } + } + + if (!IS_MOVE_STATUS(move)) + { + if (gBattleWeather & WEATHER_SUN_PRIMAL) + { + if (moveType == TYPE_WATER) + RETURN_SCORE_MINUS(30); + } + else if (gBattleWeather & WEATHER_RAIN_PRIMAL) + { + if (moveType == TYPE_FIRE) + RETURN_SCORE_MINUS(30); + } + } + } + // check move effects switch (moveEffect) { @@ -763,7 +792,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_EXPLOSION: if (!(AI_THINKING_STRUCT->aiFlags & AI_FLAG_WILL_SUICIDE)) score -= 2; - + if (effectiveness == AI_EFFECTIVENESS_x0) { score -= 10; @@ -813,7 +842,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (!BattlerStatCanRise(battlerAtk, AI_DATA->atkAbility, STAT_SPATK) || !HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL)) score -= 10; break; - case EFFECT_SPECIAL_DEFENSE_UP: + case EFFECT_SPECIAL_DEFENSE_UP: case EFFECT_SPECIAL_DEFENSE_UP_2: if (!BattlerStatCanRise(battlerAtk, AI_DATA->atkAbility, STAT_SPDEF)) score -= 10; @@ -1121,7 +1150,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_LOW_KICK: // AI_CBM_HighRiskForDamage if (AI_DATA->defAbility == ABILITY_WONDER_GUARD && effectiveness < AI_EFFECTIVENESS_x2) - score -= 10; + score -= 10; break; case EFFECT_COUNTER: case EFFECT_MIRROR_COAT: @@ -1131,7 +1160,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) || DoesSubstituteBlockMove(battlerAtk, AI_DATA->battlerDefPartner, predictedMove)) score -= 10; break; - + case EFFECT_ROAR: if (CountUsablePartyMons(battlerDef) == 0) score -= 10; @@ -1279,7 +1308,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_SPIKES: if (gSideTimers[GetBattlerSide(battlerDef)].spikesAmount >= 3) score -= 10; - else if (PartnerMoveIsSameNoTarget(AI_DATA->battlerAtkPartner, move, AI_DATA->partnerMove) + else if (PartnerMoveIsSameNoTarget(AI_DATA->battlerAtkPartner, move, AI_DATA->partnerMove) && gSideTimers[GetBattlerSide(battlerDef)].spikesAmount == 2) score -= 10; // only one mon needs to set up the last layer of Spikes break; @@ -1457,7 +1486,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; break; } - + if (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect == HOLD_EFFECT_CURE_ATTRACT) score -= 6; break; @@ -1687,7 +1716,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (gBattleMons[battlerAtk].hp > (gBattleMons[battlerAtk].hp + gBattleMons[battlerDef].hp) / 2) score -= 10; break; - + case EFFECT_CONVERSION_2: //TODO break; @@ -1747,7 +1776,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; } // move check - + if (decreased) break; if (IsBattlerIncapacitated(battlerDef, AI_DATA->defAbility)) @@ -1789,7 +1818,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) IncreaseAllyProtectionViability(&viability, 0xFF); }*/ } - break; + break; case EFFECT_MIRACLE_EYE: if (gStatuses3[battlerDef] & STATUS3_MIRACLE_EYED) score -= 10; @@ -1837,7 +1866,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) || ((AI_DATA->defAbility == ABILITY_CONTRARY) && !IsTargetingPartner(battlerAtk, battlerDef))) // don't want to raise target stats unless its your partner score -= 10; break; - + case EFFECT_PSYCH_UP: // haze stats check { for (i = STAT_ATK; i < NUM_BATTLE_STATS; i++) @@ -2001,7 +2030,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) u32 atkNegativeStages = CountNegativeStatStages(battlerAtk); u32 defPositiveStages = CountPositiveStatStages(battlerDef); u32 defNegativeStages = CountNegativeStatStages(battlerDef); - + if (atkPositiveStages >= defPositiveStages && atkNegativeStages <= defNegativeStages) score -= 10; break; @@ -2399,21 +2428,21 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; break;*/ } // move effect checks - + if (score < 0) score = 0; - + return score; } static s16 AI_TryToFaint(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) -{ +{ if (IsTargetingPartner(battlerAtk, battlerDef)) return score; - + if (gBattleMoves[move].power == 0) return score; // can't make anything faint with no power - + if (CanAttackerFaintTarget(battlerAtk, battlerDef, AI_THINKING_STRUCT->movesetIndex, 0) && gBattleMoves[move].effect != EFFECT_EXPLOSION) { // this move can faint the target @@ -2427,24 +2456,43 @@ static s16 AI_TryToFaint(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // this move isn't expected to faint the target if (TestMoveFlags(move, FLAG_HIGH_CRIT)) score += 2; // crit makes it more likely to make them faint - + if (GetMoveDamageResult(move) == MOVE_POWER_OTHER) score--; - + switch (AI_GetMoveEffectiveness(move, battlerAtk, battlerDef)) { case AI_EFFECTIVENESS_x4: - score += 4; + if (WEATHER_HAS_EFFECT + && gBattleWeather & WEATHER_STRONG_WINDS + && IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING)) + { + if (AI_RandLessThan(176)) //Consider it supereffective instead of hypereffective. + score += 2; + else + score++; + } + else + score += 4; break; case AI_EFFECTIVENESS_x2: - if (AI_RandLessThan(176)) - score += 2; + if (WEATHER_HAS_EFFECT + && gBattleWeather & WEATHER_STRONG_WINDS + && IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING)) + { + break; // Don't increase score, consider it neutral. + } else - score++; + { + if (AI_RandLessThan(176)) + score += 2; + else + score++; + } break; } } - + //AI_TryToFaint_CheckIfDanger if (!IsAiFaster(AI_CHECK_FASTER) && CanTargetFaintAi(battlerDef, battlerAtk)) { // AI_TryToFaint_Danger @@ -2453,7 +2501,7 @@ static s16 AI_TryToFaint(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) else score++; } - + return score; } @@ -2472,7 +2520,7 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) bool32 attackerHasBadAbility = (GetAbilityRating(AI_DATA->atkAbility) < 0); bool32 partnerHasBadAbility = (GetAbilityRating(atkPartnerAbility) < 0); u16 predictedMove = gLastMoves[battlerDef]; //for now - + // check what effect partner is using if (AI_DATA->partnerMove != 0) { @@ -2506,8 +2554,8 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; } } // check partner move effect - - + + // consider our move effect relative to partner state switch (effect) { @@ -2528,8 +2576,8 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; } // our effect relative to partner - - + + // consider global move effects switch (effect) { @@ -2559,8 +2607,8 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; } // global move effect check - - + + // check specific target if (IsTargetingPartner(battlerAtk, battlerDef)) { @@ -2667,11 +2715,11 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { RETURN_SCORE_PLUS(1); } - break; + break; } } // ability checks } // move power check - + // attacker move effects specifically targeting partner if (!partnerProtecting) { @@ -2784,12 +2832,12 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; } // attacker move effects } // check partner protecting - + score -= 30; // otherwise, don't target partner } else // checking opponent { - // these checks mostly handled in AI_CheckBadMove and AI_CheckViability + // these checks mostly handled in AI_CheckBadMove and AI_CheckViability switch (effect) { case EFFECT_SKILL_SWAP: @@ -2812,10 +2860,10 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 3; break; } - + // lightning rod, flash fire against enemy handled in AI_CheckBadMove } - + return score; } @@ -2831,11 +2879,11 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) u32 i; u8 atkHpPercent = GetHealthPercentage(battlerAtk); u8 defHpPercent = GetHealthPercentage(battlerDef); - + // Targeting partner, check benefits of doing that instead if (IsTargetingPartner(battlerAtk, battlerDef)) return score; - + // check always hits if (!IS_MOVE_STATUS(move) && gBattleMoves[move].accuracy == 0) { @@ -2844,22 +2892,22 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (AI_RandLessThan(100) && (gBattleMons[battlerDef].statStages[STAT_EVASION] >= 8 || gBattleMons[battlerAtk].statStages[STAT_ACC] <= 4)) score++; } - + // check high crit if (TestMoveFlags(move, FLAG_HIGH_CRIT) && effectiveness >= AI_EFFECTIVENESS_x2 && AI_RandLessThan(128)) score++; - + // check already dead if (!IsBattlerIncapacitated(battlerDef, AI_DATA->defAbility) && CanTargetFaintAi(battlerAtk, battlerDef) && GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) == 1) // opponent should go first { - if (atkPriority > 0) + if (atkPriority > 0) score++; else score--; } - + // check damage if (gBattleMoves[move].power != 0 && GetMoveDamageResult(move) == MOVE_POWER_WEAK) score--; @@ -2867,11 +2915,11 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // check status move preference if (AI_THINKING_STRUCT->aiFlags & AI_FLAG_PREFER_STATUS_MOVES && IS_MOVE_STATUS(move) && effectiveness != AI_EFFECTIVENESS_x0) score++; - + // check thawing moves if ((gBattleMons[battlerAtk].status1 & STATUS1_FREEZE) && TestMoveFlags(move, FLAG_THAW_USER)) score += (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) ? 20 : 10; - + // check burn if (gBattleMons[battlerAtk].status1 & STATUS1_BURN) { @@ -2890,7 +2938,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; } } - + // ability checks switch (AI_DATA->atkAbility) { @@ -2917,12 +2965,12 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; } break; - } // ability checks - + } // ability checks + // move effect checks switch (moveEffect) { - + case EFFECT_HIT: break; case EFFECT_SLEEP: @@ -2964,7 +3012,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; } } - + if (!AI_RandLessThan(100)) { score--; @@ -3010,7 +3058,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; } } - + if (!AI_RandLessThan(100)) { score--; @@ -3033,7 +3081,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 2; else if (atkHpPercent <= 70) score -= 2; - else + else score++; break; case EFFECT_EVASION_UP: @@ -3163,7 +3211,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_ATTACK_SPATK_UP: // work up if (GetHealthPercentage(battlerAtk) <= 40 || AI_DATA->atkAbility == ABILITY_CONTRARY) break; - + if (HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) IncreaseStatUpScore(battlerAtk, battlerDef, STAT_ATK, &score); else if (HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL)) @@ -3215,7 +3263,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) default: break; } - + if (ShouldRecover(battlerAtk, battlerDef, move, healPercent)) score += 2; } @@ -3443,7 +3491,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (newHp > healthBenchmark && ShouldAbsorb(battlerAtk, battlerDef, move, AI_THINKING_STRUCT->simulatedDmg[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex])) score += 2; } - break; + break; case EFFECT_SLEEP_TALK: case EFFECT_SNORE: if (!IsWakeupTurn(battlerAtk) && gBattleMons[battlerAtk].status1 & STATUS1_SLEEP) @@ -3478,13 +3526,13 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_THIEF: { bool32 canSteal = FALSE; - + #if defined B_TRAINERS_KNOCK_OFF_ITEMS && B_TRAINERS_KNOCK_OFF_ITEMS == TRUE canSteal = TRUE; #endif if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER || GetBattlerSide(battlerAtk) == B_SIDE_PLAYER) canSteal = TRUE; - + if (canSteal && AI_DATA->atkItem == ITEM_NONE && AI_DATA->defItem != ITEM_NONE && CanBattlerGetOrLoseItem(battlerDef, AI_DATA->defItem) @@ -3628,8 +3676,8 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (AI_DATA->defAbility == ABILITY_MAGIC_BOUNCE || CountUsablePartyMons(battlerDef) == 0) break; if (gDisableStructs[battlerAtk].isFirstTurn) - score += 2; - //TODO - track entire opponent party data to determine hazard effectiveness + score += 2; + //TODO - track entire opponent party data to determine hazard effectiveness break; case EFFECT_FORESIGHT: if (AI_DATA->atkAbility == ABILITY_SCRAPPY) @@ -3658,7 +3706,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (HasMoveEffect(battlerDef, EFFECT_MORNING_SUN) || HasMoveEffect(battlerDef, EFFECT_SYNTHESIS) || HasMoveEffect(battlerDef, EFFECT_MOONLIGHT)) - score += 2; + score += 2; } break; case EFFECT_HAIL: @@ -3667,7 +3715,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if ((HasMoveEffect(battlerAtk, EFFECT_AURORA_VEIL) || HasMoveEffect(AI_DATA->battlerAtkPartner, EFFECT_AURORA_VEIL)) && ShouldSetScreen(battlerAtk, battlerDef, EFFECT_AURORA_VEIL)) score += 3; - + score++; if (AI_DATA->atkHoldEffect == HOLD_EFFECT_ICY_ROCK) score++; @@ -3726,7 +3774,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_SPECTRAL_THIEF: // Want to copy positive stat changes for (i = STAT_ATK; i < NUM_BATTLE_STATS; i++) - { + { if (gBattleMons[battlerDef].statStages[i] > gBattleMons[battlerAtk].statStages[i]) { switch (i) @@ -3785,7 +3833,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (HasMoveEffect(battlerAtk, EFFECT_SWALLOW) || HasMoveEffect(battlerAtk, EFFECT_SPIT_UP)) score += 2; - + IncreaseStatUpScore(battlerAtk, battlerDef, STAT_DEF, &score); IncreaseStatUpScore(battlerAtk, battlerDef, STAT_SPDEF, &score); break; @@ -3802,20 +3850,20 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) || HasMoveEffect(battlerAtk, EFFECT_PSYCH_UP) || HasMoveEffect(battlerAtk, EFFECT_SPECTRAL_THIEF)) score++; - + if (AI_DATA->defAbility == ABILITY_CONTRARY) score += 2; - + IncreaseConfusionScore(battlerAtk, battlerDef, move, &score); break; case EFFECT_FLATTER: if (HasMoveEffect(battlerAtk, EFFECT_PSYCH_UP) || HasMoveEffect(battlerAtk, EFFECT_SPECTRAL_THIEF)) score += 2; - + if (AI_DATA->defAbility == ABILITY_CONTRARY) score += 2; - + IncreaseConfusionScore(battlerAtk, battlerDef, move, &score); break; case EFFECT_FURY_CUTTER: @@ -3856,7 +3904,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 3; break; } - + switch (move) { case MOVE_DEFOG: @@ -3872,7 +3920,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) && GetWhoStrikesFirst(battlerAtk, AI_DATA->battlerAtkPartner, TRUE) == 1) // Partner going first break; // Don't use Defog if partner is going to set up hazards } - + // check defog lowering evasion if (ShouldLowerEvasion(battlerAtk, battlerDef, AI_DATA->defAbility)) { @@ -3912,7 +3960,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_CHARGE: if (HasDamagingMoveOfType(battlerAtk, TYPE_ELECTRIC)) score += 2; - + IncreaseStatUpScore(battlerAtk, battlerDef, STAT_SPDEF, &score); break; case EFFECT_TAUNT: @@ -4081,7 +4129,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { if (AI_DATA->defAbility != AI_DATA->atkAbility && !(gStatuses3[battlerDef] & STATUS3_GASTRO_ACID)) score += 2; - } + } break; case EFFECT_IMPRISON: if (predictedMove != MOVE_NONE && HasMove(battlerAtk, predictedMove)) @@ -4152,7 +4200,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_SHELL_SMASH: if (AI_DATA->atkHoldEffect == HOLD_EFFECT_POWER_HERB) score += 3; - + IncreaseStatUpScore(battlerAtk, battlerDef, STAT_SPEED, &score); IncreaseStatUpScore(battlerAtk, battlerDef, STAT_SPATK, &score); IncreaseStatUpScore(battlerAtk, battlerDef, STAT_ATK, &score); @@ -4256,7 +4304,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (gStatuses3[battlerAtk] & STATUS3_YAWN && IsBattlerGrounded(battlerAtk)) score += 10; //fallthrough - case EFFECT_GRASSY_TERRAIN: + case EFFECT_GRASSY_TERRAIN: case EFFECT_PSYCHIC_TERRAIN: score += 2; if (AI_DATA->atkHoldEffect == HOLD_EFFECT_TERRAIN_EXTENDER) @@ -4529,7 +4577,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) //case EFFECT_SKY_DROP //break; } // move effect checks - + return score; } @@ -4539,15 +4587,15 @@ static s16 AI_SetupFirstTurn(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (IsTargetingPartner(battlerAtk, battlerDef) || gBattleResults.battleTurnCounter != 0) return score; - - if (AI_THINKING_STRUCT->aiFlags & AI_FLAG_SMART_SWITCHING + + if (AI_THINKING_STRUCT->aiFlags & AI_FLAG_SMART_SWITCHING && GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) == 1 && CanTargetFaintAi(battlerDef, battlerAtk) && GetMovePriority(battlerAtk, move) == 0) { RETURN_SCORE_MINUS(20); // No point in setting up if you will faint. Should just switch if possible.. } - + // check effects to prioritize first turn switch (gBattleMoves[move].effect) { @@ -4636,7 +4684,7 @@ static s16 AI_SetupFirstTurn(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) default: break; } - + return score; } @@ -4645,10 +4693,10 @@ static s16 AI_Risky(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { if (IsTargetingPartner(battlerAtk, battlerDef)) return score; - + if (TestMoveFlags(move, FLAG_HIGH_CRIT)) score += 2; - + switch (gBattleMoves[move].effect) { case EFFECT_SLEEP: @@ -4675,7 +4723,7 @@ static s16 AI_Risky(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) default: break; } - + return score; } @@ -4684,10 +4732,10 @@ static s16 AI_PreferStrongestMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 sc { if (IsTargetingPartner(battlerAtk, battlerDef)) return score; - + if (GetMoveDamageResult(move) == MOVE_POWER_BEST) score += 2; - + return score; } @@ -4695,14 +4743,14 @@ static s16 AI_PreferStrongestMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 sc static s16 AI_PreferBatonPass(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { u32 i; - + if (IsTargetingPartner(battlerAtk, battlerDef) || CountUsablePartyMons(battlerAtk) == 0 || GetMoveDamageResult(move) != MOVE_POWER_OTHER || !HasMoveEffect(battlerAtk, EFFECT_BATON_PASS) || IsBattlerTrapped(battlerAtk, TRUE)) return score; - + if (IsStatRaisingEffect(gBattleMoves[move].effect)) { if (gBattleResults.battleTurnCounter == 0) @@ -4710,9 +4758,9 @@ static s16 AI_PreferBatonPass(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) else if (GetHealthPercentage(battlerAtk) < 60) score -= 10; else - score++; + score++; } - + // other specific checks switch (gBattleMoves[move].effect) { @@ -4738,12 +4786,12 @@ static s16 AI_PreferBatonPass(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (gStatuses3[battlerAtk] & (STATUS3_ROOTED | STATUS3_AQUA_RING)) score += 2; if (gStatuses3[battlerAtk] & STATUS3_LEECHSEED) - score -= 3; + score -= 3; break; default: break; } - + return score; } @@ -4751,7 +4799,7 @@ static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { u16 effect = gBattleMoves[move].effect; u8 moveType = gBattleMoves[move].type; - + if (IsTargetingPartner(battlerAtk, battlerDef)) { if ((effect == EFFECT_HEAL_PULSE || effect == EFFECT_HIT_ENEMY_HEAL_ALLY) @@ -4761,7 +4809,7 @@ static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (CanTargetFaintAi(FOE(battlerAtk), AI_DATA->battlerAtkPartner) || (CanTargetFaintAi(BATTLE_PARTNER(FOE(battlerAtk)), AI_DATA->battlerAtkPartner))) score--; - + if (GetHealthPercentage(battlerDef) <= 50) score++; } @@ -4800,7 +4848,7 @@ static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // med hp if (IsStatRaisingEffect(effect) || IsStatLoweringEffect(effect)) score -= 2; - + switch (effect) { case EFFECT_EXPLOSION: @@ -4823,7 +4871,7 @@ static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // low hp if (IsStatRaisingEffect(effect) || IsStatLoweringEffect(effect)) score -= 2; - + // check other discouraged low hp effects switch (effect) { @@ -4856,7 +4904,7 @@ static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } } } - + // consider target HP if (CanAttackerFaintTarget(battlerAtk, battlerDef, AI_THINKING_STRUCT->movesetIndex, 0)) { @@ -4928,7 +4976,7 @@ static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 2; // don't use status moves if target is at low health } } - + return score; } @@ -4947,7 +4995,7 @@ static s16 AI_Roaming(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { if (IsBattlerTrapped(battlerAtk, FALSE)) return score; - + AI_Flee(); return score; } From e39dc493fc8767621796d41e569917053bd0812c Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 30 Aug 2021 20:33:21 -0300 Subject: [PATCH 09/37] A couple of improvements, courtesy of Syreldar -Optimized the checks for `WEATHER_RAIN_PRIMAL` and `WEATHER_SUN_PRIMAL` in `Cmd_attackcanceler`. -Moved the dmg calculation effect of `WEATHER_STRONG_WINDS` to the `CalcFinalDmg` function. --- src/battle_script_commands.c | 13 +++++-------- src/battle_util.c | 18 ++++++------------ 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 85cd16066..2df8edc91 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1324,23 +1324,21 @@ static void Cmd_attackcanceler(void) s32 i, moveType; GET_MOVE_TYPE(gCurrentMove, moveType); + if (moveType == TYPE_FIRE && (gBattleWeather & WEATHER_RAIN_PRIMAL) - && !IsAbilityOnField(ABILITY_AIR_LOCK) - && !IsAbilityOnField(ABILITY_CLOUD_NINE) - && gBattleMoves[gCurrentMove].power >= 1) + && WEATHER_HAS_EFFECT + && gBattleMoves[gCurrentMove].power) { BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_PrimordialSeaFizzlesOutFireTypeMoves; return; } - GET_MOVE_TYPE(gCurrentMove, moveType); if (moveType == TYPE_WATER && (gBattleWeather & WEATHER_SUN_PRIMAL) - && !IsAbilityOnField(ABILITY_AIR_LOCK) - && !IsAbilityOnField(ABILITY_CLOUD_NINE) - && gBattleMoves[gCurrentMove].power >= 1) + && WEATHER_HAS_EFFECT + && gBattleMoves[gCurrentMove].power) { BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_DesolateLandEvaporatesWaterTypeMoves; @@ -1366,7 +1364,6 @@ static void Cmd_attackcanceler(void) return; // Check Protean activation. - GET_MOVE_TYPE(gCurrentMove, moveType); if ((GetBattlerAbility(gBattlerAttacker) == ABILITY_PROTEAN || GetBattlerAbility(gBattlerAttacker) == ABILITY_LIBERO) && (gBattleMons[gBattlerAttacker].type1 != moveType || gBattleMons[gBattlerAttacker].type2 != moveType || (gBattleMons[gBattlerAttacker].type3 != moveType && gBattleMons[gBattlerAttacker].type3 != TYPE_MYSTERY)) diff --git a/src/battle_util.c b/src/battle_util.c index e258daac5..96cbfbc87 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7898,6 +7898,12 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move else if (moveType == TYPE_WATER) dmg = ApplyModifier(UQ_4_12(0.5), dmg); } + else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) + { + if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING) + && typeEffectivenessModifier >= UQ_4_12(2.0)) + dmg = ApplyModifier(UQ_4_12(0.5), dmg); + } // check stab if (IS_BATTLER_OF_TYPE(battlerAtk, moveType) && move != MOVE_STRUGGLE) @@ -8139,18 +8145,6 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat modifier = UQ_4_12(1.0); } - // WEATHER_STRONG_WINDS weakens super effective moves against flying type mons - if (gBattleWeather & WEATHER_STRONG_WINDS - && modifier == UQ_4_12(2.0) - && (IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING)) - && !IsAbilityOnField(ABILITY_AIR_LOCK) - && !IsAbilityOnField(ABILITY_CLOUD_NINE)) - { - modifier = UQ_4_12(1.0); - PrepareStringBattle(STRINGID_ATTACKWEAKENEDBSTRONGWINDS, battlerDef); - gBattlescriptCurrInstr++; - } - if (GetBattlerAbility(battlerDef) == ABILITY_WONDER_GUARD && modifier <= UQ_4_12(1.0) && gBattleMoves[move].power) { modifier = UQ_4_12(0.0); From 0a3805492577ca978e19cec9222c79debbe78620 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 30 Aug 2021 21:21:07 -0300 Subject: [PATCH 10/37] Print `STRINGID_ATTACKWEAKENEDBSTRONGWINDS` properly --- data/battle_scripts_1.s | 7 +++++++ include/battle_scripts.h | 1 + src/battle_util.c | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index f46bffcf3..ecfddf762 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6936,6 +6936,13 @@ BattleScript_DeltaStreamActivates:: waitmessage B_WAIT_TIME_LONG end3 +BattleScript_AttackWeakenedByStrongWinds:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS + waitmessage B_WAIT_TIME_LONG + end3 + BattleScript_SnowWarningActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 28118b21c..f3470776a 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -375,5 +375,6 @@ extern const u8 BattleScript_PrimordialSeaActivates[]; extern const u8 BattleScript_PrimordialSeaFizzlesOutFireTypeMoves[]; extern const u8 BattleScript_DeltaStreamActivates[]; extern const u8 BattleScript_MysteriousAirCurrentBlowsOn[]; +extern const u8 BattleScript_AttackWeakenedByStrongWinds[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/src/battle_util.c b/src/battle_util.c index 96cbfbc87..0f89def27 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -484,6 +484,14 @@ void HandleAction_UseMove(void) for (i = 0; i < MAX_BATTLERS_COUNT; i++) gBattleStruct->hpBefore[i] = gBattleMons[i].hp; + GET_MOVE_TYPE(gCurrentMove, moveType); + if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) + { + if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_FLYING) + && CalcTypeEffectivenessMultiplier(gCurrentMove, moveType, gBattlerAttacker, gBattlerTarget, FALSE) >= UQ_4_12(2.0)) + BattleScriptPushCursorAndCallback(BattleScript_AttackWeakenedByStrongWinds); + } + gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT; } From d0fd883ec71fdefa62e510dc17ac1f3fd580e079 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 30 Aug 2021 21:49:45 -0300 Subject: [PATCH 11/37] Small comment tweak --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index 0f89def27..ad4753119 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7891,7 +7891,7 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move && gBattleMoves[move].effect != EFFECT_FACADE && abilityAtk != ABILITY_GUTS) dmg = ApplyModifier(UQ_4_12(0.5), dmg); - // check sunny/rain weather + // check weather if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_RAIN_ANY) { if (moveType == TYPE_FIRE) From 97ce02464b247ce6961062d8154f6e19f4e2b17a Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 30 Aug 2021 22:09:33 -0300 Subject: [PATCH 12/37] Removed small redundancy --- src/battle_util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index ad4753119..ba651877e 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2106,7 +2106,7 @@ u8 DoFieldEndTurnEffects(void) } break; case ENDTURN_RAIN: - if (gBattleWeather & WEATHER_RAIN_ANY || gBattleWeather & WEATHER_RAIN_PRIMAL) + if (gBattleWeather & WEATHER_RAIN_ANY) { if (!(gBattleWeather & WEATHER_RAIN_PERMANENT) && !(gBattleWeather & WEATHER_RAIN_PRIMAL)) @@ -2157,7 +2157,7 @@ u8 DoFieldEndTurnEffects(void) gBattleStruct->turnCountersTracker++; break; case ENDTURN_SUN: - if (gBattleWeather & WEATHER_SUN_ANY || gBattleWeather & WEATHER_SUN_PRIMAL) + if (gBattleWeather & WEATHER_SUN_ANY) { if (!(gBattleWeather & WEATHER_SUN_PERMANENT) && !(gBattleWeather & WEATHER_SUN_PRIMAL) From 69b7910f470b5077d6dbdc7d2d9af99da3290d25 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 30 Aug 2021 23:52:52 -0300 Subject: [PATCH 13/37] Gave an entrance animation to Delta Stream --- data/battle_anim_scripts.s | 25 +++++ data/battle_scripts_1.s | 3 +- .../backgrounds/windstorm_brew.png | Bin 0 -> 1100 bytes include/constants/battle_anim.h | 1 + include/graphics.h | 4 + src/battle_anim_flying.c | 100 +++++++++++++++++- src/graphics.c | 5 +- 7 files changed, 135 insertions(+), 3 deletions(-) create mode 100644 graphics/battle_anims/backgrounds/windstorm_brew.png diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 33182e878..11fb01724 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -822,6 +822,7 @@ gBattleAnims_General:: .4byte General_SlideOffScreen @ B_ANIM_SLIDE_OFFSCREEN .4byte General_RestoreBg @ B_ANIM_RESTORE_BG .4byte General_TotemFlare @ B_ANIM_TOTEM_FLARE + .4byte General_StrongWinds @ B_ANIM_STRONG_WINDS .align 2 gBattleAnims_Special:: @@ -24397,6 +24398,30 @@ General_TotemFlare:: clearmonbg ANIM_ATTACKER end +General_StrongWinds:: + loadspritegfx ANIM_TAG_FLYING_DIRT + playsewithpan SE_M_GUST, 0 + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_FLYING_DIRT, 0, 12, 12, RGB(20, 20, 20) + waitforvisualfinish + createvisualtask AnimTask_LoadWindstormBackground, 5, FALSE + delay 16 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 10, 2304, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 90, 2048, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 50, 2560, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 20, 2304, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 70, 1984, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 0, 2816, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 60, 2560, 96, 0 + waitforvisualfinish + stopsound + end + RainbowEndureEffect: launchtemplate gBlueEndureEnergySpriteTemplate 0x2 0x4 0x0 0xffe8 0x1a 0x2 delay 0x3 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index ecfddf762..45d654cd6 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6933,7 +6933,8 @@ BattleScript_DeltaStreamActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp printstring STRINGID_MYSTERIOUSAIRCURRENT - waitmessage B_WAIT_TIME_LONG + waitstate + playanimation BS_ATTACKER, B_ANIM_STRONG_WINDS, NULL end3 BattleScript_AttackWeakenedByStrongWinds:: diff --git a/graphics/battle_anims/backgrounds/windstorm_brew.png b/graphics/battle_anims/backgrounds/windstorm_brew.png new file mode 100644 index 0000000000000000000000000000000000000000..c36e720cfe8a114139595802c7642a920f67a831 GIT binary patch literal 1100 zcmV-S1he~zP){FYyfYAzTU@aYmx`yA^CJV9g%a^ocNnri4!k6 z51jd*$ay_C)>gCVPg+Mz7RXJh~d#xWFU#c}uf28t;dEleLl`{U{nOB_fRe9TOA zHei#`aO-4>7G&?otBv-n5&1NyvIh#XhvbW^}Yh`}6PyOT`MMsiqIHgt1ZmF)d=A$s7Hw0aM-kUP=7aAR-- zRgmyC6*cQqL;H*xFo;8?u^I(`mZ^cpLW-RHQIZzI+Y30TNrH%*oRiD?Hxo#538%0F6ZX8S{JnW_{AD_7zq_s9g*%`%-HOV4!{^+x z`oBs|&!)p!$_e0Qm+-x?c$sBMc%F~3Jrmu$>eESd@sZivrf{6{$z@y5^k1pETUYE- z>`{`jxTAergLOu?|5$A5)uAHPSV6*UzWMMe^5wQ7u>98G`(pil$x)JIM5+AF8Nx8P zKZr-p$&_PtHchHl2@0&s23$n!TIWY zjZTBlZ8Y6H=*_g1C^<3HPxA3R^6D*VDFW=f7jjD3L&g@*@Pu!J@`Um=o__$VNqB*f SRB7S>00005L{ literal 0 HcmV?d00001 diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index c04bc14f7..4cfcafcd3 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -523,6 +523,7 @@ #define B_ANIM_SLIDE_OFFSCREEN 26 // for Emergency Exit #define B_ANIM_RESTORE_BG 27 // for Terrain Endings #define B_ANIM_TOTEM_FLARE 28 // Totem boosts aura flare +#define B_ANIM_STRONG_WINDS 29 // special animations table (gBattleAnims_Special) #define B_ANIM_LVL_UP 0 diff --git a/include/graphics.h b/include/graphics.h index dc020c401..6139e90cf 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4697,6 +4697,7 @@ extern const u32 gBattleAnimSpritePal_MagnifyingGlass[]; extern const u32 gBattleAnimSpritePal_BrownOrb[]; extern const u32 gBattleAnimSpritePal_MetalSoundWaves[]; extern const u32 gBattleAnimSpritePal_FlyingDirt[]; +extern const u32 gBattleAnimSpritePal_Windstorm[]; extern const u32 gBattleAnimSpritePal_IcicleSpear[]; extern const u32 gBattleAnimSpritePal_Hail[]; extern const u32 gBattleAnimSpritePal_GlowyRedOrb[]; @@ -5199,6 +5200,9 @@ extern const u16 gSlotMachineReelTimePikachu_Pal[]; extern const u32 gBattleAnimBgTilemap_Sandstorm[]; extern const u32 gBattleAnimBgImage_Sandstorm[]; +extern const u32 gBattleAnimBgTilemap_Windstorm[]; +extern const u32 gBattleAnimBgImage_Windstorm[]; + // Pokedex Area Screen extern const u32 gPokedexAreaScreenAreaUnknown_Gfx[]; extern const u16 gPokedexAreaScreenAreaUnknown_Pal[]; diff --git a/src/battle_anim_flying.c b/src/battle_anim_flying.c index 2b93206ca..cce21c84e 100644 --- a/src/battle_anim_flying.c +++ b/src/battle_anim_flying.c @@ -5,6 +5,8 @@ #include "constants/battle_anim.h" #include "constants/rgb.h" #include "random.h" +#include "gpu_regs.h" +#include "graphics.h" extern const struct SpriteTemplate gFlashingHitSplatSpriteTemplate; @@ -30,7 +32,7 @@ static void AnimUnusedFlashingLight_Step(struct Sprite *); static void AnimSkyAttackBird(struct Sprite *); static void AnimSkyAttackBird_Step(struct Sprite *); static void AnimTask_AnimateGustTornadoPalette_Step(u8); - +static void AnimTask_LoadWindstormBackground_Step(u8 taskId); const struct SpriteTemplate gEllipticalGustSpriteTemplate = { @@ -1231,3 +1233,99 @@ static void AnimTask_SetAttackerVisibility(u8 taskId) } DestroyAnimVisualTask(taskId); } + +void AnimTask_LoadWindstormBackground(u8 taskId) +{ + int var0; + struct BattleAnimBgData animBg; + + var0 = 0; + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16)); + SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1); + SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 0); + + if (!IsContest()) + SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1); + + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); + SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); + + GetBattleAnimBg1Data(&animBg); + AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimBgImage_Windstorm, animBg.tilesOffset); + AnimLoadCompressedBgTilemapHandleContest(&animBg, gBattleAnimBgTilemap_Windstorm, 0); + LoadCompressedPalette(gBattleAnimSpritePal_Windstorm, animBg.paletteId * 16, 32); + + if (gBattleAnimArgs[0] && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + var0 = 1; + + gTasks[taskId].data[0] = var0; + gTasks[taskId].func = AnimTask_LoadWindstormBackground_Step; +} + +static void AnimTask_LoadWindstormBackground_Step(u8 taskId) +{ + struct BattleAnimBgData animBg; + + if (gTasks[taskId].data[0] == 0) + gBattle_BG1_X += -6; + else + gBattle_BG1_X += 6; + + gBattle_BG1_Y += -1; + + switch (gTasks[taskId].data[12]) + { + case 0: + if (++gTasks[taskId].data[10] == 4) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[11]++; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 16 - gTasks[taskId].data[11])); + if (gTasks[taskId].data[11] == 7) + { + gTasks[taskId].data[12]++; + gTasks[taskId].data[11] = 0; + } + } + break; + case 1: + if (++gTasks[taskId].data[11] == 101) + { + gTasks[taskId].data[11] = 7; + gTasks[taskId].data[12]++; + } + break; + case 2: + if (++gTasks[taskId].data[10] == 4) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[11]--; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 16 - gTasks[taskId].data[11])); + if (gTasks[taskId].data[11] == 0) + { + gTasks[taskId].data[12]++; + gTasks[taskId].data[11] = 0; + } + } + break; + case 3: + GetBattleAnimBg1Data(&animBg); + ClearBattleAnimBg(animBg.bgId); + gTasks[taskId].data[12]++; + break; + case 4: + if (!IsContest()) + SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0); + + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1); + DestroyAnimVisualTask(taskId); + break; + } +} diff --git a/src/graphics.c b/src/graphics.c index 4c648a479..247231d55 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1312,11 +1312,14 @@ const u32 gUnknown_08D85A1C[] = INCBIN_U32("graphics/battle_frontier/battle_tile #include "data/graphics/intro_scene.h" const u32 gBattleAnimSpriteGfx_FlyingDirt[] = INCBIN_U32("graphics/battle_anims/sprites/flying_dirt.4bpp.lz"); +const u32 gBattleAnimSpritePal_FlyingDirt[] = INCBIN_U32("graphics/battle_anims/sprites/flying_dirt.gbapal.lz"); const u32 gBattleAnimBgTilemap_Sandstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/sandstorm_brew.bin.lz"); const u32 gBattleAnimBgImage_Sandstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/sandstorm_brew.4bpp.lz"); -const u32 gBattleAnimSpritePal_FlyingDirt[] = INCBIN_U32("graphics/battle_anims/sprites/flying_dirt.gbapal.lz"); +const u32 gBattleAnimBgTilemap_Windstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/sandstorm_brew.bin.lz"); +const u32 gBattleAnimBgImage_Windstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/windstorm_brew.4bpp.lz"); +const u32 gBattleAnimSpritePal_Windstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/windstorm_brew.gbapal.lz"); const u32 gBattleAnimSpriteGfx_MetalSoundWaves[] = INCBIN_U32("graphics/battle_anims/sprites/metal_sound_waves.4bpp.lz"); const u32 gBattleAnimSpritePal_MetalSoundWaves[] = INCBIN_U32("graphics/battle_anims/sprites/metal_sound_waves.gbapal.lz"); From e4fb9c4593c8f37700005376b55c6e14c7a3a63d Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Tue, 31 Aug 2021 12:51:03 -0400 Subject: [PATCH 14/37] fix throwing ball in wild doubles --- src/battle_main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/battle_main.c b/src/battle_main.c index c728ae266..9e08fbbbc 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4055,6 +4055,7 @@ static void HandleTurnActionSelectionState(void) gBattleCommunication[gActiveBattler]++; break; case B_ACTION_THROW_BALL: + gBattleStruct->throwingPokeBall = TRUE; gBattleCommunication[gActiveBattler]++; break; case B_ACTION_SAFARI_POKEBLOCK: @@ -4170,6 +4171,13 @@ static void HandleTurnActionSelectionState(void) if (gBattleCommunication[ACTIONS_CONFIRMED_COUNT] == gBattlersCount) { sub_818603C(1); + + if (WILD_DOUBLE_BATTLE && gBattleStruct->throwingPokeBall) { + // if we choose to throw a ball with our second mon, skip the action of the first + // (if we have chosen throw ball with first, second's is already skipped) + gChosenActionByBattler[B_POSITION_PLAYER_LEFT] = B_ACTION_NOTHING_FAINTED; + } + gBattleMainFunc = SetActionsAndBattlersTurnOrder; if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) From 88476e0ac27c7fe44450a3f27feebc588ea95090 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Tue, 31 Aug 2021 12:59:20 -0400 Subject: [PATCH 15/37] remove 2nd case in CanThrowBall --- src/item_use.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/item_use.c b/src/item_use.c index ad7a46499..5a5cd6a52 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -943,11 +943,14 @@ u32 CanThrowBall(void) { return 1; // There are two present pokemon. } - else if (gBattlerInMenuId == GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT) + /*else if (gBattlerInMenuId == GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT) && IsBattlerAlive(GetBattlerAtPosition(B_POSITION_PLAYER_LEFT))) { + /* * this is removed. instead, selecting a ball to throw with the second mon just clears the action of your first mon. + * see the end of HandleTurnActionSelectionState in battle_main.c + */ return 2; // Attempting to throw a ball with the second pokemon while both are alive. - } + }*/ else if (IsPlayerPartyAndPokemonStorageFull() == TRUE) { return 3; // No room for mon From 39a254f80d240243f6e3a0568d0ae98f3ba0d5a5 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 1 Sep 2021 07:45:41 -0400 Subject: [PATCH 16/37] fix sprite pos changes --- src/battle_interface.c | 24 ++++++++++++------------ src/item_use.c | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/battle_interface.c b/src/battle_interface.c index e17036faa..5f3eecaac 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -3218,8 +3218,8 @@ void TryAddLastUsedBallItemSprites(void) if (gBattleStruct->ballSpriteIds[0] == MAX_SPRITES) { gBattleStruct->ballSpriteIds[0] = AddItemIconSprite(102, 102, gSaveBlock2Ptr->lastUsedBall); - gSprites[gBattleStruct->ballSpriteIds[0]].pos1.x = LAST_USED_BALL_X_0; - gSprites[gBattleStruct->ballSpriteIds[0]].pos1.y = LAST_USED_BALL_Y; + gSprites[gBattleStruct->ballSpriteIds[0]].x = LAST_USED_BALL_X_0; + gSprites[gBattleStruct->ballSpriteIds[0]].y = LAST_USED_BALL_Y; gSprites[gBattleStruct->ballSpriteIds[0]].sHide = FALSE; // restore gSprites[gBattleStruct->ballSpriteIds[0]].callback = SpriteCB_LastUsedBall; } @@ -3258,16 +3258,16 @@ static void SpriteCB_LastUsedBallWin(struct Sprite *sprite) { if (sprite->sHide) { - if (sprite->pos1.x != LAST_BALL_WIN_X_0) - sprite->pos1.x--; + if (sprite->x != LAST_BALL_WIN_X_0) + sprite->x--; - if (sprite->pos1.x == LAST_BALL_WIN_X_0) + if (sprite->x == LAST_BALL_WIN_X_0) DestroyLastUsedBallWinGfx(sprite); } else { - if (sprite->pos1.x != LAST_BALL_WIN_X_F) - sprite->pos1.x++; + if (sprite->x != LAST_BALL_WIN_X_F) + sprite->x++; } } @@ -3275,16 +3275,16 @@ static void SpriteCB_LastUsedBall(struct Sprite *sprite) { if (sprite->sHide) { - if (sprite->pos1.x != LAST_USED_BALL_X_0) - sprite->pos1.x--; + if (sprite->x != LAST_USED_BALL_X_0) + sprite->x--; - if (sprite->pos1.x == LAST_USED_BALL_X_0) + if (sprite->x == LAST_USED_BALL_X_0) DestroyLastUsedBallGfx(sprite); } else { - if (sprite->pos1.x != LAST_USED_BALL_X_F) - sprite->pos1.x++; + if (sprite->x != LAST_USED_BALL_X_F) + sprite->x++; } } diff --git a/src/item_use.c b/src/item_use.c index d0aa82b85..63854a1ac 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -966,7 +966,7 @@ void ItemUseInBattle_PokeBall(u8 taskId) break; case 1: // There are two present pokemon. if (!InBattlePyramid()) - DisplayItemMessage(taskId, 1, sText_CantThrowPokeBall_TwoMons, BagMenu_InitListsMenu); + DisplayItemMessage(taskId, 1, sText_CantThrowPokeBall_TwoMons, CloseItemMessage); else DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_TwoMons, Task_CloseBattlePyramidBagMessage); break; From 3f34fec42fb3aa55173e207c384e3b40f1e46591 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 23 Sep 2021 12:03:01 -0400 Subject: [PATCH 17/37] change last ball graphic based on config. replace saveblock field with ewram field --- .../battle_interface/last_used_ball_l.png | Bin 0 -> 214 bytes ...ast_used_ball.png => last_used_ball_r.png} | Bin include/battle.h | 1 + src/battle_interface.c | 36 ++++++++++++++---- src/battle_main.c | 1 + src/battle_script_commands.c | 2 +- src/battle_util.c | 2 +- 7 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 graphics/battle_interface/last_used_ball_l.png rename graphics/battle_interface/{last_used_ball.png => last_used_ball_r.png} (100%) diff --git a/graphics/battle_interface/last_used_ball_l.png b/graphics/battle_interface/last_used_ball_l.png new file mode 100644 index 0000000000000000000000000000000000000000..90fcef37398ed2b8bef3c2cc0649bc4ad9a8fac1 GIT binary patch literal 214 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfvg8-ipSH_Le)y2(0UQw2Yj+z{f zK*sa;Uw{7n50nRj?BZfCCy?fA*Uq){^Z*&j&Z>)mRHCPgV~EDY^unv_P&x8 zS#yg)?8er2d6p7uYPU)$efU;Y`Lk$&!&Tdk1N(LxH11ySDHySpEAoNZk!hg?jk{ML zNYHg+U~^;L!1<<%`?2$5R*B*OhF;5_9Y;HAOBfhR1(d!8PtREbw2Z;i)z4*}Q$iB} D1m#Ns literal 0 HcmV?d00001 diff --git a/graphics/battle_interface/last_used_ball.png b/graphics/battle_interface/last_used_ball_r.png similarity index 100% rename from graphics/battle_interface/last_used_ball.png rename to graphics/battle_interface/last_used_ball_r.png diff --git a/include/battle.h b/include/battle.h index 54693a33b..0becc4dd4 100644 --- a/include/battle.h +++ b/include/battle.h @@ -890,5 +890,6 @@ extern u8 gNumberOfMovesToChoose; extern u8 gBattleControllerData[MAX_BATTLERS_COUNT]; extern bool8 gHasFetchedBall; extern u8 gLastUsedBall; +extern u16 gLastThrownBall; #endif // GUARD_BATTLE_H diff --git a/src/battle_interface.c b/src/battle_interface.c index 5f3eecaac..4a3d1eaec 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -30,6 +30,7 @@ #include "item_icon.h" #include "item_use.h" #include "item.h" +#include "constants/items.h" enum { // Corresponds to gHealthboxElementsGfxTable (and the tables after it) in graphics.c @@ -3175,7 +3176,11 @@ static const struct SpriteTemplate sSpriteTemplate_LastUsedBallWindow = .callback = SpriteCB_LastUsedBallWin }; -static const u8 sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball.4bpp"); +#if B_LAST_USED_BALL_BUTTON == R_BUTTON + static const u8 sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_r.4bpp"); +#else + static const u8 sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_r.4bpp"); +#endif static const struct SpriteSheet sSpriteSheet_LastUsedBallWindow = { sLastUsedBallWindowGfx, sizeof(sLastUsedBallWindowGfx), LAST_BALL_WINDOW_TAG @@ -3193,31 +3198,39 @@ static const struct SpriteSheet sSpriteSheet_LastUsedBallWindow = bool32 CanThrowLastUsedBall(void) { - return (!(CanThrowBall() != 0 - || (gBattleTypeFlags & BATTLE_TYPE_TRAINER) - || !CheckBagHasItem(gSaveBlock2Ptr->lastUsedBall, 1))); + #if B_LAST_USED_BALL == FALSE + return FALSE; + #else + return (!(CanThrowBall() != 0 + || (gBattleTypeFlags & BATTLE_TYPE_TRAINER) + || !CheckBagHasItem(gLastThrownBall, 1))); + #endif } void TryAddLastUsedBallItemSprites(void) { - if (gSaveBlock2Ptr->lastUsedBall != 0 && !CheckBagHasItem(gSaveBlock2Ptr->lastUsedBall, 1)) + #if B_LAST_USED_BALL == TRUE + if (gLastThrownBall == 0) + gLastThrownBall = ITEM_POKE_BALL; + + if (gLastThrownBall != 0 && !CheckBagHasItem(gLastThrownBall, 1)) { // we're out of the last used ball, so just set it to the first ball in the bag // we have to compact the bag first bc it is typically only compacted when you open it CompactItemsInBagPocket(&gBagPockets[BALLS_POCKET]); - gSaveBlock2Ptr->lastUsedBall = gBagPockets[BALLS_POCKET].itemSlots[0].itemId; + gLastThrownBall = gBagPockets[BALLS_POCKET].itemSlots[0].itemId; } if (CanThrowBall() != 0 || (gBattleTypeFlags & BATTLE_TYPE_TRAINER) - || !CheckBagHasItem(gSaveBlock2Ptr->lastUsedBall, 1)) + || !CheckBagHasItem(gLastThrownBall, 1)) return; // ball if (gBattleStruct->ballSpriteIds[0] == MAX_SPRITES) { - gBattleStruct->ballSpriteIds[0] = AddItemIconSprite(102, 102, gSaveBlock2Ptr->lastUsedBall); + gBattleStruct->ballSpriteIds[0] = AddItemIconSprite(102, 102, gLastThrownBall); gSprites[gBattleStruct->ballSpriteIds[0]].x = LAST_USED_BALL_X_0; gSprites[gBattleStruct->ballSpriteIds[0]].y = LAST_USED_BALL_Y; gSprites[gBattleStruct->ballSpriteIds[0]].sHide = FALSE; // restore @@ -3236,6 +3249,7 @@ void TryAddLastUsedBallItemSprites(void) LAST_USED_WIN_Y, 5); gSprites[gBattleStruct->ballSpriteIds[0]].sHide = FALSE; // restore } + #endif } static void DestroyLastUsedBallWinGfx(struct Sprite *sprite) @@ -3290,6 +3304,7 @@ static void SpriteCB_LastUsedBall(struct Sprite *sprite) static void TryHideOrRestoreLastUsedBall(u8 caseId) { + #if B_LAST_USED_BALL == TRUE if (gBattleStruct->ballSpriteIds[0] == MAX_SPRITES) return; @@ -3308,18 +3323,23 @@ static void TryHideOrRestoreLastUsedBall(u8 caseId) gSprites[gBattleStruct->ballSpriteIds[1]].sHide = FALSE; // restore break; } + #endif } void TryHideLastUsedBall(void) { + #if B_LAST_USED_BALL == TRUE TryHideOrRestoreLastUsedBall(0); + #endif } void TryRestoreLastUsedBall(void) { + #if B_LAST_USED_BALL == TRUE if (gBattleStruct->ballSpriteIds[0] != MAX_SPRITES) TryHideOrRestoreLastUsedBall(1); else TryAddLastUsedBallItemSprites(); + #endif } diff --git a/src/battle_main.c b/src/battle_main.c index b1cc8bbc4..b8b013635 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -230,6 +230,7 @@ EWRAM_DATA u16 gPartnerSpriteId = 0; EWRAM_DATA struct TotemBoost gTotemBoosts[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA bool8 gHasFetchedBall = FALSE; EWRAM_DATA u8 gLastUsedBall = 0; +EWRAM_DATA u16 gLastThrownBall = 0; // IWRAM common vars void (*gPreBattleCallback1)(void); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index cd64a2497..313f47878 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -12021,7 +12021,7 @@ static void Cmd_handleballthrow(void) u32 odds; u8 catchRate; - gSaveBlock2Ptr->lastUsedBall = gLastUsedItem; + gLastThrownBall = gLastUsedItem; if (gLastUsedItem == ITEM_SAFARI_BALL) catchRate = gBattleStruct->safariCatchFactor * 1275 / 100; else diff --git a/src/battle_util.c b/src/battle_util.c index 04070bf7e..f482d40dd 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -759,7 +759,7 @@ void HandleAction_ThrowBall(void) gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber]; gBattle_BG0_X = 0; gBattle_BG0_Y = 0; - gLastUsedItem = gSaveBlock2Ptr->lastUsedBall; + gLastUsedItem = gLastThrownBall; RemoveBagItem(gLastUsedItem, 1); gBattlescriptCurrInstr = BattleScript_BallThrow; gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT; From 768598b1545b361a3a5f3e312a2d66c2d510f1a3 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 23 Sep 2021 12:22:36 -0400 Subject: [PATCH 18/37] fix bad merge --- include/battle_util.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/battle_util.h b/include/battle_util.h index d01ca3411..15b238b17 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -48,7 +48,6 @@ struct TypePower extern const struct TypePower gNaturalGiftTable[]; void HandleAction_ThrowBall(void); -bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide); bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide, u32 move); void HandleAction_UseMove(void); void HandleAction_Switch(void); From 3925c07c1a2e7c6b3803e66f49f4af316fe26aec Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 23 Sep 2021 13:20:32 -0400 Subject: [PATCH 19/37] fix l graphic --- src/battle_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_interface.c b/src/battle_interface.c index 4a3d1eaec..63a05860d 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -3179,7 +3179,7 @@ static const struct SpriteTemplate sSpriteTemplate_LastUsedBallWindow = #if B_LAST_USED_BALL_BUTTON == R_BUTTON static const u8 sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_r.4bpp"); #else - static const u8 sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_r.4bpp"); + static const u8 sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_l.4bpp"); #endif static const struct SpriteSheet sSpriteSheet_LastUsedBallWindow = { From 64a45d8f4851e0d56af1cfcec1c6023f48871f27 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sun, 3 Oct 2021 07:21:47 -0300 Subject: [PATCH 20/37] =?UTF-8?q?Tweaked=20trytoclearprimalweather=20Made?= =?UTF-8?q?=20it=20so=20it=20won't=20actually=20try=20to=20clear=20a=20pri?= =?UTF-8?q?mal=20weather=20if=20a=20Pok=C3=A9mon=20with=20Desolate=20Land,?= =?UTF-8?q?=20Primordial=20Sea=20or=20Delta=20Stream=20is=20present=20on?= =?UTF-8?q?=20the=20field.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/battle_script_commands.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 6b1e4e77a..90979264a 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8762,19 +8762,30 @@ static void Cmd_various(void) gBattlescriptCurrInstr += 7; return; case VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER: - if (gBattleWeather & WEATHER_SUN_PRIMAL) + { + bool8 shouldNotClear = FALSE; + + for (i = 0; i < gBattlersCount; i++) + { + if (((GetBattlerAbility(i) == ABILITY_DESOLATE_LAND && gBattleWeather & WEATHER_SUN_PRIMAL) + || (GetBattlerAbility(i) == ABILITY_PRIMORDIAL_SEA && gBattleWeather & WEATHER_RAIN_PRIMAL) + || (GetBattlerAbility(i) == ABILITY_DELTA_STREAM && gBattleWeather & WEATHER_STRONG_WINDS)) + && IsBattlerAlive(i)) + shouldNotClear = TRUE; + } + if (gBattleWeather & WEATHER_SUN_PRIMAL && !shouldNotClear) { gBattleWeather &= ~WEATHER_SUN_PRIMAL; PrepareStringBattle(STRINGID_EXTREMESUNLIGHTFADED, gActiveBattler); gBattleCommunication[MSG_DISPLAY] = 1; } - else if (gBattleWeather & WEATHER_RAIN_PRIMAL) + else if (gBattleWeather & WEATHER_RAIN_PRIMAL && !shouldNotClear) { gBattleWeather &= ~WEATHER_RAIN_PRIMAL; PrepareStringBattle(STRINGID_HEAVYRAINLIFTED, gActiveBattler); gBattleCommunication[MSG_DISPLAY] = 1; } - else if (gBattleWeather & WEATHER_STRONG_WINDS) + else if (gBattleWeather & WEATHER_STRONG_WINDS && !shouldNotClear) { gBattleWeather &= ~WEATHER_STRONG_WINDS; PrepareStringBattle(STRINGID_STRONGWINDSDISSIPATED, gActiveBattler); @@ -8782,6 +8793,7 @@ static void Cmd_various(void) } break; } + } gBattlescriptCurrInstr += 3; } From dcefb523f828619a923ea7c8403be2ffecb05bf1 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 4 Oct 2021 06:43:43 -0300 Subject: [PATCH 21/37] Tweaks and fixes -Fixed the Flying-type checks of WEATHER_STRONG_WINDS. -Fixed the order of actions involving the printing of STRINGID_ATTACKWEAKENEDBSTRONGWINDS. --- data/battle_scripts_1.s | 2 +- src/battle_script_commands.c | 20 ++++++++++++++++++++ src/battle_util.c | 16 ++++++---------- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 39fb01cdd..083db5f07 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7293,7 +7293,7 @@ BattleScript_AttackWeakenedByStrongWinds:: call BattleScript_AbilityPopUp printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS waitmessage B_WAIT_TIME_LONG - end3 + return BattleScript_SnowWarningActivates:: pause B_WAIT_TIME_SHORT diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 90979264a..1fd7daea5 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1914,6 +1914,9 @@ static void Cmd_typecalc(void) static void Cmd_adjustdamage(void) { u8 holdEffect, param; + u32 moveType; + + GET_MOVE_TYPE(gCurrentMove, moveType); if (DoesSubstituteBlockMove(gBattlerAttacker, gBattlerTarget, gCurrentMove)) goto END; @@ -1991,6 +1994,23 @@ END: gBattlescriptCurrInstr = BattleScript_GemActivates; gLastUsedItem = gBattleMons[gBattlerAttacker].item; } + + // WEATHER_STRONG_WINDS prints a string when it's about to reduce the power + // of a move that is Super Effective against a Flying-type Pokémon. + if (gBattleWeather & WEATHER_STRONG_WINDS) + { + if ((gBattleMons[gBattlerTarget].type1 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[gBattlerTarget].type1) >= UQ_4_12(2.0)) + || (gBattleMons[gBattlerTarget].type2 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[gBattlerTarget].type2) >= UQ_4_12(2.0)) + || (gBattleMons[gBattlerTarget].type3 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[gBattlerTarget].type3) >= UQ_4_12(2.0))) + { + gBattlerAbility = gBattlerTarget; + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_AttackWeakenedByStrongWinds; + } + } } static void Cmd_multihitresultmessage(void) diff --git a/src/battle_util.c b/src/battle_util.c index 2e7f3e18d..8873d7ae3 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -486,14 +486,6 @@ void HandleAction_UseMove(void) for (i = 0; i < MAX_BATTLERS_COUNT; i++) gBattleStruct->hpBefore[i] = gBattleMons[i].hp; - GET_MOVE_TYPE(gCurrentMove, moveType); - if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) - { - if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_FLYING) - && CalcTypeEffectivenessMultiplier(gCurrentMove, moveType, gBattlerAttacker, gBattlerTarget, FALSE) >= UQ_4_12(2.0)) - BattleScriptPushCursorAndCallback(BattleScript_AttackWeakenedByStrongWinds); - } - gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT; } @@ -8300,8 +8292,12 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move } else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) { - if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING) - && typeEffectivenessModifier >= UQ_4_12(2.0)) + if ((gBattleMons[battlerDef].type1 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[battlerDef].type1) >= UQ_4_12(2.0)) + || (gBattleMons[battlerDef].type2 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[battlerDef].type2) >= UQ_4_12(2.0)) + || (gBattleMons[battlerDef].type3 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[battlerDef].type3) >= UQ_4_12(2.0))) dmg = ApplyModifier(UQ_4_12(0.5), dmg); } From dc451167d13d42bca8b402335c08e8ab171e163b Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 6 Oct 2021 05:09:47 -0300 Subject: [PATCH 22/37] More fixes -Removed ability popup when Strong Winds weakens a SE Flying-type move -Went back to the way I handled the dmg calculation for that originally -Made sure to try to clear the primal weathers in a couple of other battle scripts -Allowed Drought, Drizzle, Sand Stream and Snow Warning to activate but fail if WEATHER_STRONG_WINDS is in effect. --- data/battle_scripts_1.s | 21 +++++++++++++++++++-- src/battle_util.c | 22 ++++++++++++---------- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 083db5f07..8aa2b32ba 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -4135,6 +4135,12 @@ BattleScript_MysteriousAirCurrentBlowsOn: waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd +BattleScript_MysteriousAirCurrentBlowsOnEnd3: + pause B_WAIT_TIME_SHORT + printstring STRINGID_MYSTERIOUSAIRCURRENTBLOWSON + waitmessage B_WAIT_TIME_LONG + end3 + BattleScript_EffectDefenseUpHit:: setmoveeffect MOVE_EFFECT_DEF_PLUS_1 | MOVE_EFFECT_AFFECTS_USER goto BattleScript_EffectHit @@ -5255,6 +5261,9 @@ BattleScript_FaintedMonTryChooseAnother: getswitchedmondata BS_ATTACKER switchindataupdate BS_ATTACKER hpthresholds BS_ATTACKER + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON hidepartystatussummary BS_ATTACKER switchinanim BS_ATTACKER, 0 @@ -5265,6 +5274,9 @@ BattleScript_FaintedMonChooseAnother: getswitchedmondata BS_FAINTED switchindataupdate BS_FAINTED hpthresholds BS_FAINTED + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON hidepartystatussummary BS_FAINTED switchinanim BS_FAINTED, FALSE @@ -5297,6 +5309,9 @@ BattleScript_HandleFaintedMonLoop:: getswitchedmondata BS_FAINTED switchindataupdate BS_FAINTED hpthresholds BS_FAINTED + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON hidepartystatussummary BS_FAINTED switchinanim BS_FAINTED, FALSE @@ -6974,6 +6989,7 @@ BattleScript_ItemSteal:: BattleScript_DrizzleActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNMADEITRAIN waitstate playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES, NULL @@ -7132,6 +7148,7 @@ BattleScript_HealerActivates:: BattleScript_SandstreamActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNSXWHIPPEDUPSANDSTORM waitstate playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES, NULL @@ -7238,6 +7255,7 @@ BattleScript_IntimidatePrevented: BattleScript_DroughtActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNSXINTENSIFIEDSUN waitstate playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES, NULL @@ -7289,8 +7307,6 @@ BattleScript_DeltaStreamActivates:: end3 BattleScript_AttackWeakenedByStrongWinds:: - pause B_WAIT_TIME_SHORT - call BattleScript_AbilityPopUp printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS waitmessage B_WAIT_TIME_LONG return @@ -7298,6 +7314,7 @@ BattleScript_AttackWeakenedByStrongWinds:: BattleScript_SnowWarningActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_SNOWWARNINGHAIL waitstate playanimation BS_BATTLER_0, B_ANIM_HAIL_CONTINUES, NULL diff --git a/src/battle_util.c b/src/battle_util.c index 8873d7ae3..17b04ebf8 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8290,16 +8290,6 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move else if (moveType == TYPE_WATER) dmg = ApplyModifier(UQ_4_12(0.5), dmg); } - else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) - { - if ((gBattleMons[battlerDef].type1 == TYPE_FLYING - && GetTypeModifier(moveType, gBattleMons[battlerDef].type1) >= UQ_4_12(2.0)) - || (gBattleMons[battlerDef].type2 == TYPE_FLYING - && GetTypeModifier(moveType, gBattleMons[battlerDef].type2) >= UQ_4_12(2.0)) - || (gBattleMons[battlerDef].type3 == TYPE_FLYING - && GetTypeModifier(moveType, gBattleMons[battlerDef].type3) >= UQ_4_12(2.0))) - dmg = ApplyModifier(UQ_4_12(0.5), dmg); - } // check stab if (IS_BATTLER_OF_TYPE(battlerAtk, moveType) && move != MOVE_STRUGGLE) @@ -8541,6 +8531,18 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat modifier = UQ_4_12(1.0); } + // WEATHER_STRONG_WINDS weakens Super Effective moves against Flying-type Pokémon + if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) + { + if ((gBattleMons[battlerDef].type1 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[battlerDef].type1) >= UQ_4_12(2.0)) + || (gBattleMons[battlerDef].type2 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[battlerDef].type2) >= UQ_4_12(2.0)) + || (gBattleMons[battlerDef].type3 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[battlerDef].type3) >= UQ_4_12(2.0))) + modifier = UQ_4_12(1.0); + } + if (((GetBattlerAbility(battlerDef) == ABILITY_WONDER_GUARD && modifier <= UQ_4_12(1.0)) || (GetBattlerAbility(battlerDef) == ABILITY_TELEPATHY && battlerDef == BATTLE_PARTNER(battlerAtk))) && gBattleMoves[move].power) From b93c746a495c8a7fe4bb01e16f4227fe6a7af3a1 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 6 Oct 2021 06:04:56 -0300 Subject: [PATCH 23/37] Reverted comment after the previous commit --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index 17b04ebf8..d783edab2 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8275,7 +8275,7 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move && gBattleMoves[move].effect != EFFECT_FACADE && abilityAtk != ABILITY_GUTS) dmg = ApplyModifier(UQ_4_12(0.5), dmg); - // check weather + // check sunny/rain weather if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_RAIN_ANY) { if (moveType == TYPE_FIRE) From 0f2cc99f45d46f9c5780bbf265b023e4dcc1832c Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 6 Oct 2021 06:32:06 -0300 Subject: [PATCH 24/37] WEATHER_STRONG_WINDS modifier fix MulByTypeEffectiveness was the right answer all along. I also added a short pause to BattleScript_AttackWeakenedByStrongWinds before STRINGID_ATTACKWEAKENEDBSTRONGWINDS is printed. --- data/battle_scripts_1.s | 1 + src/battle_util.c | 19 +++++++------------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 8aa2b32ba..e3a395e18 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7307,6 +7307,7 @@ BattleScript_DeltaStreamActivates:: end3 BattleScript_AttackWeakenedByStrongWinds:: + pause B_WAIT_TIME_SHORT printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS waitmessage B_WAIT_TIME_LONG return diff --git a/src/battle_util.c b/src/battle_util.c index d783edab2..4e57d3425 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8476,6 +8476,13 @@ static void MulByTypeEffectiveness(u16 *modifier, u16 move, u8 moveType, u8 batt if (gProtectStructs[battlerDef].kingsShielded && gBattleMoves[move].effect != EFFECT_FEINT) mod = UQ_4_12(1.0); + // WEATHER_STRONG_WINDS weakens Super Effective moves against Flying-type Pokémon + if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) + { + if (defType == TYPE_FLYING && mod >= UQ_4_12(2.0)) + mod = UQ_4_12(1.0); + } + MulModifier(modifier, mod); } @@ -8531,18 +8538,6 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat modifier = UQ_4_12(1.0); } - // WEATHER_STRONG_WINDS weakens Super Effective moves against Flying-type Pokémon - if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) - { - if ((gBattleMons[battlerDef].type1 == TYPE_FLYING - && GetTypeModifier(moveType, gBattleMons[battlerDef].type1) >= UQ_4_12(2.0)) - || (gBattleMons[battlerDef].type2 == TYPE_FLYING - && GetTypeModifier(moveType, gBattleMons[battlerDef].type2) >= UQ_4_12(2.0)) - || (gBattleMons[battlerDef].type3 == TYPE_FLYING - && GetTypeModifier(moveType, gBattleMons[battlerDef].type3) >= UQ_4_12(2.0))) - modifier = UQ_4_12(1.0); - } - if (((GetBattlerAbility(battlerDef) == ABILITY_WONDER_GUARD && modifier <= UQ_4_12(1.0)) || (GetBattlerAbility(battlerDef) == ABILITY_TELEPATHY && battlerDef == BATTLE_PARTNER(battlerAtk))) && gBattleMoves[move].power) From a646c3311b15c3c7bf5fe45dd6e94c41c3f8bc41 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 6 Oct 2021 07:59:43 -0300 Subject: [PATCH 25/37] Another set of fixes The ability pop up is supposed to show as weather changing abilities try but fail to activate. --- data/battle_scripts_1.s | 41 +++++++++++++++++++++++++++++++++++++++++ src/battle_util.c | 3 ++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index e3a395e18..ed34b9461 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -4123,12 +4123,36 @@ BattleScript_ExtremelyHarshSunlightWasNotLessened: waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd +BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3: + pause B_WAIT_TIME_SHORT + printstring STRINGID_EXTREMELYHARSHSUNLIGHTWASNOTLESSENED + waitmessage B_WAIT_TIME_LONG + end3 + +BattleScript_ExtremelyHarshSunlightWasNotLessenedRet: + pause B_WAIT_TIME_SHORT + printstring STRINGID_EXTREMELYHARSHSUNLIGHTWASNOTLESSENED + waitmessage B_WAIT_TIME_LONG + return + BattleScript_NoReliefFromHeavyRain: pause B_WAIT_TIME_SHORT printstring STRINGID_NORELIEFROMHEAVYRAIN waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd +BattleScript_NoReliefFromHeavyRainEnd3: + pause B_WAIT_TIME_SHORT + printstring STRINGID_NORELIEFROMHEAVYRAIN + waitmessage B_WAIT_TIME_LONG + end3 + +BattleScript_NoReliefFromHeavyRainRet: + pause B_WAIT_TIME_SHORT + printstring STRINGID_NORELIEFROMHEAVYRAIN + waitmessage B_WAIT_TIME_LONG + return + BattleScript_MysteriousAirCurrentBlowsOn: pause B_WAIT_TIME_SHORT printstring STRINGID_MYSTERIOUSAIRCURRENTBLOWSON @@ -4141,6 +4165,12 @@ BattleScript_MysteriousAirCurrentBlowsOnEnd3: waitmessage B_WAIT_TIME_LONG end3 +BattleScript_MysteriousAirCurrentBlowsOnRet: + pause B_WAIT_TIME_SHORT + printstring STRINGID_MYSTERIOUSAIRCURRENTBLOWSON + waitmessage B_WAIT_TIME_LONG + return + BattleScript_EffectDefenseUpHit:: setmoveeffect MOVE_EFFECT_DEF_PLUS_1 | MOVE_EFFECT_AFFECTS_USER goto BattleScript_EffectHit @@ -6989,6 +7019,8 @@ BattleScript_ItemSteal:: BattleScript_DrizzleActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNMADEITRAIN waitstate @@ -7148,6 +7180,8 @@ BattleScript_HealerActivates:: BattleScript_SandstreamActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNSXWHIPPEDUPSANDSTORM waitstate @@ -7158,6 +7192,9 @@ BattleScript_SandstreamActivates:: BattleScript_SandSpitActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedRet + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainRet + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnRet printstring STRINGID_ASANDSTORMKICKEDUP waitstate playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES, NULL @@ -7255,6 +7292,8 @@ BattleScript_IntimidatePrevented: BattleScript_DroughtActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNSXINTENSIFIEDSUN waitstate @@ -7315,6 +7354,8 @@ BattleScript_AttackWeakenedByStrongWinds:: BattleScript_SnowWarningActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_SNOWWARNINGHAIL waitstate diff --git a/src/battle_util.c b/src/battle_util.c index 4e57d3425..59c936b6b 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3694,7 +3694,8 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility) && GetBattlerAbility(battler) != ABILITY_PRIMORDIAL_SEA && GetBattlerAbility(battler) != ABILITY_DELTA_STREAM) { - return FALSE; + weatherEnumId = 0; + return TRUE; } else if (!(gBattleWeather & (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]))) { From fe5a0a7f04bc287f542aec665f498d7b333dafde Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 6 Oct 2021 08:29:53 -0300 Subject: [PATCH 26/37] Oopsie --- data/battle_scripts_1.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index ed34b9461..4948fd470 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7324,7 +7324,7 @@ BattleScript_PrimordialSeaActivates:: call BattleScript_AbilityPopUp printstring STRINGID_HEAVYRAIN waitstate - playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES, NULL + playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES, NULL call BattleScript_WeatherFormChanges end3 From b520fe5d89e173217cf7d535129e59068f3f4aed Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 6 Oct 2021 08:38:19 -0300 Subject: [PATCH 27/37] Tweaked Strong Winds' animation --- data/battle_anim_scripts.s | 15 +-------------- .../backgrounds/windstorm_brew.png | Bin 1100 -> 1067 bytes 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 948fe221a..4063885e0 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -24419,20 +24419,7 @@ General_StrongWinds:: createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_FLYING_DIRT, 0, 12, 12, RGB(20, 20, 20) waitforvisualfinish createvisualtask AnimTask_LoadWindstormBackground, 5, FALSE - delay 16 - createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 10, 2304, 96, 0 - delay 10 - createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 90, 2048, 96, 0 - delay 10 - createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 50, 2560, 96, 0 - delay 10 - createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 20, 2304, 96, 0 - delay 10 - createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 70, 1984, 96, 0 - delay 10 - createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 0, 2816, 96, 0 - delay 10 - createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 60, 2560, 96, 0 + delay 32 waitforvisualfinish stopsound end diff --git a/graphics/battle_anims/backgrounds/windstorm_brew.png b/graphics/battle_anims/backgrounds/windstorm_brew.png index c36e720cfe8a114139595802c7642a920f67a831..2a28952662266dc252e5a0b850e41ed187241047 100644 GIT binary patch delta 84 zcmX@Zv6^Fo%EUZl&Av1J)my3xmL^9wg*z8Hnnzpg5!#c+z`(#>;_2(k{*;T2ThY?W oQ}o$H6IBl80#6sm5Rc;<&*d=-bl5)Y1FB>2boFyt=akR{0037Uc>n+a delta 115 zcmZ3@afV}piU50wr>`sfQx171Ex|1uBDxbBRD~EgN(%hk-F;k)8Gyj6K~sLBqM7ck zs|Sv3TefY*ym^y)n`^4l65=+uZb}C#U`+CMcVXyYmGxj?U@q` Date: Wed, 6 Oct 2021 09:10:56 -0300 Subject: [PATCH 28/37] Fixed infinite loop --- data/battle_scripts_1.s | 29 ++++++++++++++--------------- include/battle_scripts.h | 2 ++ src/battle_util.c | 36 +++++++++++++++++++++++++++++++++--- 3 files changed, 49 insertions(+), 18 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 4948fd470..5803a0220 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -4171,6 +4171,20 @@ BattleScript_MysteriousAirCurrentBlowsOnRet: waitmessage B_WAIT_TIME_LONG return +BattleScript_BlockedByPrimalWeatherEnd3:: + call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 + end3 + +BattleScript_BlockedByPrimalWeatherRet:: + call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedRet + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainRet + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnRet + return + BattleScript_EffectDefenseUpHit:: setmoveeffect MOVE_EFFECT_DEF_PLUS_1 | MOVE_EFFECT_AFFECTS_USER goto BattleScript_EffectHit @@ -7019,9 +7033,6 @@ BattleScript_ItemSteal:: BattleScript_DrizzleActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNMADEITRAIN waitstate playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES, NULL @@ -7180,9 +7191,6 @@ BattleScript_HealerActivates:: BattleScript_SandstreamActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNSXWHIPPEDUPSANDSTORM waitstate playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES, NULL @@ -7192,9 +7200,6 @@ BattleScript_SandstreamActivates:: BattleScript_SandSpitActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedRet - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainRet - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnRet printstring STRINGID_ASANDSTORMKICKEDUP waitstate playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES, NULL @@ -7292,9 +7297,6 @@ BattleScript_IntimidatePrevented: BattleScript_DroughtActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNSXINTENSIFIEDSUN waitstate playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES, NULL @@ -7354,9 +7356,6 @@ BattleScript_AttackWeakenedByStrongWinds:: BattleScript_SnowWarningActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_SNOWWARNINGHAIL waitstate playanimation BS_BATTLER_0, B_ANIM_HAIL_CONTINUES, NULL diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 1f22cedd5..cd4600543 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -396,5 +396,7 @@ extern const u8 BattleScript_PrimordialSeaFizzlesOutFireTypeMoves[]; extern const u8 BattleScript_DeltaStreamActivates[]; extern const u8 BattleScript_MysteriousAirCurrentBlowsOn[]; extern const u8 BattleScript_AttackWeakenedByStrongWinds[]; +extern const u8 BattleScript_BlockedByPrimalWeatherEnd3[]; +extern const u8 BattleScript_BlockedByPrimalWeatherRet[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/src/battle_util.c b/src/battle_util.c index 59c936b6b..282a6ff74 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3694,8 +3694,7 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility) && GetBattlerAbility(battler) != ABILITY_PRIMORDIAL_SEA && GetBattlerAbility(battler) != ABILITY_DELTA_STREAM) { - weatherEnumId = 0; - return TRUE; + return FALSE; } else if (!(gBattleWeather & (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]))) { @@ -4167,6 +4166,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_DrizzleActivates); effect++; } + else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone) + { + gSpecialStatuses[battler].switchInAbilityDone = 1; + BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3); + effect++; + } break; case ABILITY_SAND_STREAM: if (TryChangeBattleWeather(battler, ENUM_WEATHER_SANDSTORM, TRUE)) @@ -4174,6 +4179,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_SandstreamActivates); effect++; } + else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone) + { + gSpecialStatuses[battler].switchInAbilityDone = 1; + BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3); + effect++; + } break; case ABILITY_DROUGHT: if (TryChangeBattleWeather(battler, ENUM_WEATHER_SUN, TRUE)) @@ -4181,6 +4192,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_DroughtActivates); effect++; } + else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone) + { + gSpecialStatuses[battler].switchInAbilityDone = 1; + BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3); + effect++; + } break; case ABILITY_SNOW_WARNING: if (TryChangeBattleWeather(battler, ENUM_WEATHER_HAIL, TRUE)) @@ -4188,6 +4205,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_SnowWarningActivates); effect++; } + else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone) + { + gSpecialStatuses[battler].switchInAbilityDone = 1; + BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3); + effect++; + } break; case ABILITY_ELECTRIC_SURGE: if (TryChangeBattleTerrain(battler, STATUS_FIELD_ELECTRIC_TERRAIN, &gFieldTimers.electricTerrainTimer)) @@ -4989,13 +5012,20 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && TARGET_TURN_DAMAGED && !(WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_SANDSTORM_ANY) - && TryChangeBattleWeather(battler, ENUM_WEATHER_SANDSTORM, TRUE)) + && TryChangeBattleWeather(battler, ENUM_WEATHER_SANDSTORM, TRUE) + && !(WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY)) { gBattleScripting.battler = gActiveBattler = battler; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SandSpitActivates; effect++; } + else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY) + { + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_BlockedByPrimalWeatherRet; + effect++; + } break; case ABILITY_PERISH_BODY: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) From 1ad8448532c33f0962e1bfe8c6838ccc22b23686 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 6 Oct 2021 13:54:33 -0400 Subject: [PATCH 29/37] remove saveblock field --- include/global.h | 3 +-- src/new_game.c | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/global.h b/include/global.h index a0aa45d3d..53a6175a2 100644 --- a/include/global.h +++ b/include/global.h @@ -485,8 +485,7 @@ struct SaveBlock2 u16 optionsBattleSceneOff:1; // whether battle animations are disabled u16 regionMapZoom:1; // whether the map is zoomed in /*0x18*/ struct Pokedex pokedex; - /*0x90*/ u16 lastUsedBall; - /*0x92*/ u8 filler_90[0x6]; + /*0x90*/ u8 filler_90[0x8]; /*0x98*/ struct Time localTimeOffset; /*0xA0*/ struct Time lastBerryTreeUpdate; /*0xA8*/ u32 gcnLinkFlags; // Read by Pokemon Colosseum/XD diff --git a/src/new_game.c b/src/new_game.c index c1dd85e90..e0453c9ad 100644 --- a/src/new_game.c +++ b/src/new_game.c @@ -205,7 +205,6 @@ void NewGameInitData(void) WipeTrainerNameRecords(); ResetTrainerHillResults(); ResetContestLinkResults(); - gSaveBlock2Ptr->lastUsedBall = ITEM_POKE_BALL; } static void ResetMiniGamesRecords(void) From 3d24fd5f3094a20cf1325607148323e397a6f00c Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 6 Oct 2021 13:56:04 -0400 Subject: [PATCH 30/37] last ball defaults to first bag pocket item --- src/battle_interface.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/battle_interface.c b/src/battle_interface.c index c1f76c6ce..b3bb981c7 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -3206,10 +3206,8 @@ bool32 CanThrowLastUsedBall(void) void TryAddLastUsedBallItemSprites(void) { #if B_LAST_USED_BALL == TRUE - if (gLastThrownBall == 0) - gLastThrownBall = ITEM_POKE_BALL; - - if (gLastThrownBall != 0 && !CheckBagHasItem(gLastThrownBall, 1)) + if ((gLastThrownBall == 0 + || (gLastThrownBall != 0 && !CheckBagHasItem(gLastThrownBall, 1))) { // we're out of the last used ball, so just set it to the first ball in the bag // we have to compact the bag first bc it is typically only compacted when you open it From 33d19d4e348a5bdf0009ebe488e61a78684ca00a Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 6 Oct 2021 14:19:15 -0400 Subject: [PATCH 31/37] syntax fix --- src/battle_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_interface.c b/src/battle_interface.c index b3bb981c7..0e33455ac 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -3206,7 +3206,7 @@ bool32 CanThrowLastUsedBall(void) void TryAddLastUsedBallItemSprites(void) { #if B_LAST_USED_BALL == TRUE - if ((gLastThrownBall == 0 + if (gLastThrownBall == 0 || (gLastThrownBall != 0 && !CheckBagHasItem(gLastThrownBall, 1))) { // we're out of the last used ball, so just set it to the first ball in the bag From 5f5df066d618a6383dc2858460d5e2076f18d7a5 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 6 Oct 2021 15:18:42 -0400 Subject: [PATCH 32/37] fix perish song + soundproof --- data/battle_scripts_1.s | 1 + src/battle_util.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 0615e1239..0939b5b18 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -3878,6 +3878,7 @@ BattleScript_PerishSongLoopIncrement:: goto BattleScript_MoveEnd BattleScript_PerishSongBlocked:: + copybyte sBATTLER, gBattlerTarget printstring STRINGID_PKMNSXBLOCKSY2 waitmessage B_WAIT_TIME_LONG goto BattleScript_PerishSongLoopIncrement diff --git a/src/battle_util.c b/src/battle_util.c index a709aaf9e..cd5997f1f 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4458,7 +4458,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITYEFFECT_MOVES_BLOCK: // 2 - if ((gLastUsedAbility == ABILITY_SOUNDPROOF && gBattleMoves[move].flags & FLAG_SOUND) + if ((gLastUsedAbility == ABILITY_SOUNDPROOF && gBattleMoves[move].flags & FLAG_SOUND && gCurrentMove != MOVE_PERISH_SONG) || (gLastUsedAbility == ABILITY_BULLETPROOF && gBattleMoves[move].flags & FLAG_BALLISTIC)) { if (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS) From 1afc43a0e8259ad1b1f025f544cfec1884c68fdb Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 6 Oct 2021 15:30:44 -0400 Subject: [PATCH 33/37] fix DoesSubstituteBlockMove calls --- src/battle_script_commands.c | 6 +++--- src/battle_util.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 12f7763e3..35c5fee1a 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -5139,7 +5139,7 @@ static void Cmd_moveend(void) // Attacker is the damage-dealer, battler is mon to be switched out if (IsBattlerAlive(battler) && GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_EJECT_BUTTON - && !DoesSubstituteBlockMove(gCurrentMove, gBattlerAttacker, battler) + && !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove) && (gSpecialStatuses[battler].physicalDmg != 0 || gSpecialStatuses[battler].specialDmg != 0) && CountUsablePartyMons(battler) > 0) // Has mon to switch into { @@ -5173,7 +5173,7 @@ static void Cmd_moveend(void) // Attacker is the one to be switched out, battler is one with red card if (battler != gBattlerAttacker && IsBattlerAlive(battler) - && !DoesSubstituteBlockMove(gCurrentMove, gBattlerAttacker, battler) + && !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove) && GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_RED_CARD && (gSpecialStatuses[battler].physicalDmg != 0 || gSpecialStatuses[battler].specialDmg != 0) && CanBattlerSwitch(gBattlerAttacker)) @@ -5240,7 +5240,7 @@ static void Cmd_moveend(void) if (battler != gBattlerAttacker // Cannot pickpocket yourself && GetBattlerAbility(battler) == ABILITY_PICKPOCKET // Target must have pickpocket ability && BATTLER_DAMAGED(battler) // Target needs to have been damaged - && !DoesSubstituteBlockMove(gCurrentMove, gBattlerAttacker, battler) // Subsitute unaffected + && !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove) // Subsitute unaffected && IsBattlerAlive(battler) // Battler must be alive to pickpocket && gBattleMons[battler].item == ITEM_NONE // Pickpocketer can't have an item already && CanStealItem(battler, gBattlerAttacker, gBattleMons[gBattlerAttacker].item)) // Cannot steal plates, mega stones, etc diff --git a/src/battle_util.c b/src/battle_util.c index a709aaf9e..31e5e14fc 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -6810,7 +6810,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) if (TARGET_TURN_DAMAGED && (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) && IsMoveMakingContact(gCurrentMove, gBattlerAttacker) - && !DoesSubstituteBlockMove(gCurrentMove, gBattlerAttacker, battlerId) + && !DoesSubstituteBlockMove(gBattlerAttacker, battlerId, gCurrentMove) && IsBattlerAlive(gBattlerAttacker) && CanStealItem(gBattlerAttacker, gBattlerTarget, gBattleMons[gBattlerTarget].item) && gBattleMons[gBattlerAttacker].item == ITEM_NONE) From 7548e74013197b6e22f816c5080c5e1b1766d0ea Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 7 Oct 2021 00:41:33 -0300 Subject: [PATCH 34/37] Forgot to clear the primal weathers in some places --- data/battle_scripts_1.s | 18 ++++++++++++++++++ src/battle_script_commands.c | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 5803a0220..4e11922ff 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -737,6 +737,9 @@ BattleScript_EffectPartingShotSwitch: getswitchedmondata BS_ATTACKER switchindataupdate BS_ATTACKER hpthresholds BS_ATTACKER + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON switchinanim BS_ATTACKER, TRUE waitstate @@ -1789,6 +1792,9 @@ BattleScript_EffectHealingWish: getswitchedmondata BS_ATTACKER switchindataupdate BS_ATTACKER hpthresholds BS_ATTACKER + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON switchinanim BS_ATTACKER, TRUE waitstate @@ -2148,6 +2154,9 @@ BattleScript_EffectHitEscape: getswitchedmondata BS_ATTACKER switchindataupdate BS_ATTACKER hpthresholds BS_ATTACKER + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON switchinanim BS_ATTACKER, TRUE waitstate @@ -4026,6 +4035,9 @@ BattleScript_EffectBatonPass:: getswitchedmondata BS_ATTACKER switchindataupdate BS_ATTACKER hpthresholds BS_ATTACKER + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON switchinanim BS_ATTACKER, TRUE waitstate @@ -5862,6 +5874,9 @@ BattleScript_RoarSuccessSwitch:: call BattleScript_RoarSuccessRet getswitchedmondata BS_TARGET switchindataupdate BS_TARGET + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 switchinanim BS_TARGET, FALSE waitstate printstring STRINGID_PKMNWASDRAGGEDOUT @@ -8535,6 +8550,9 @@ BattleScript_EjectButtonActivates:: getswitchedmondata BS_SCRIPTING switchindataupdate BS_SCRIPTING hpthresholds BS_SCRIPTING + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring 0x3 switchinanim BS_SCRIPTING 0x1 waitstate diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 1fd7daea5..8f059df28 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8775,7 +8775,7 @@ static void Cmd_various(void) } gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY; // remove the terrain break; - case VARIOUS_JUMP_IF_PRANKSTER_BLOCKED: + case VARIOUS_JUMP_IF_PRANKSTER_BLOCKED: if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gActiveBattler)) gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); else From 359da5313e0c472e65afc5533e82d54e53b3365b Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 7 Oct 2021 00:56:13 -0300 Subject: [PATCH 35/37] Handled some edge cases Gastro Acid, Worry Seed, Simple Beam, Core Enforcer and Transform --- data/battle_scripts_1.s | 15 +++++++++++++++ src/battle_script_commands.c | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 4e11922ff..32f741f65 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -645,6 +645,9 @@ BattleScript_MoveEffectCoreEnforcer:: setgastroacid BattleScript_CoreEnforcerRet printstring STRINGID_PKMNSABILITYSUPPRESSED waitmessage B_WAIT_TIME_LONG + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 BattleScript_CoreEnforcerRet: return @@ -1744,6 +1747,9 @@ BattleScript_EffectSimpleBeam: waitanimation printstring STRINGID_PKMNACQUIREDSIMPLE waitmessage B_WAIT_TIME_LONG + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 goto BattleScript_MoveEnd BattleScript_EffectSuckerPunch: @@ -1832,6 +1838,9 @@ BattleScript_EffectWorrySeed: waitanimation printstring STRINGID_PKMNACQUIREDABILITY waitmessage B_WAIT_TIME_LONG + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 goto BattleScript_MoveEnd BattleScript_EffectPowerSplit: @@ -1960,6 +1969,9 @@ BattleScript_EffectGastroAcid: waitanimation printstring STRINGID_PKMNSABILITYSUPPRESSED waitmessage B_WAIT_TIME_LONG + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 goto BattleScript_MoveEnd BattleScript_EffectToxicSpikes: @@ -3095,6 +3107,9 @@ BattleScript_EffectTransform:: attackcanceler attackstring ppreduce + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 transformdataexecution attackanimation waitanimation diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 8f059df28..a372582da 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8790,7 +8790,8 @@ static void Cmd_various(void) if (((GetBattlerAbility(i) == ABILITY_DESOLATE_LAND && gBattleWeather & WEATHER_SUN_PRIMAL) || (GetBattlerAbility(i) == ABILITY_PRIMORDIAL_SEA && gBattleWeather & WEATHER_RAIN_PRIMAL) || (GetBattlerAbility(i) == ABILITY_DELTA_STREAM && gBattleWeather & WEATHER_STRONG_WINDS)) - && IsBattlerAlive(i)) + && IsBattlerAlive(i) + && !(gStatuses3[i] & STATUS3_GASTRO_ACID)) shouldNotClear = TRUE; } if (gBattleWeather & WEATHER_SUN_PRIMAL && !shouldNotClear) From db0d9f62358f8dfd44ff4bd5e5042c5f451a9762 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Fri, 8 Oct 2021 08:22:49 -0400 Subject: [PATCH 36/37] sound moves targeting user not blocked by own soundproof --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index cd5997f1f..81389effd 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4458,7 +4458,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITYEFFECT_MOVES_BLOCK: // 2 - if ((gLastUsedAbility == ABILITY_SOUNDPROOF && gBattleMoves[move].flags & FLAG_SOUND && gCurrentMove != MOVE_PERISH_SONG) + if ((gLastUsedAbility == ABILITY_SOUNDPROOF && gBattleMoves[move].flags & FLAG_SOUND && !(gBattleMoves[move].target & MOVE_TARGET_USER)) || (gLastUsedAbility == ABILITY_BULLETPROOF && gBattleMoves[move].flags & FLAG_BALLISTIC)) { if (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS) From 274e964d9144a9b2c64710d8a4b0150e06899fde Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Sat, 9 Oct 2021 15:05:01 +1300 Subject: [PATCH 37/37] Fix Safety Googles Fix typo and update gLastUsedItem before calling the safety goggles battle script. --- data/battle_scripts_1.s | 2 +- include/constants/battle_string_ids.h | 2 +- include/constants/hold_effects.h | 2 +- src/battle_ai_util.c | 10 +++++----- src/battle_debug.c | 4 ++-- src/battle_message.c | 4 ++-- src/battle_script_commands.c | 4 ++-- src/battle_util.c | 7 ++++--- 8 files changed, 18 insertions(+), 17 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 67f7762ac..38538747b 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6797,7 +6797,7 @@ BattleScript_PowderMoveNoEffect:: pause B_WAIT_TIME_SHORT jumpiftype BS_TARGET, TYPE_GRASS, BattleScript_PowderMoveNoEffectPrint jumpifability BS_TARGET, ABILITY_OVERCOAT, BattleScript_PowderMoveNoEffectOvercoat - printstring STRINGID_SAFETYGOOGLESPROTECTED + printstring STRINGID_SAFETYGOGGLESPROTECTED goto BattleScript_PowderMoveNoEffectWaitMsg BattleScript_PowderMoveNoEffectOvercoat: call BattleScript_AbilityPopUp diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index b74c9cd14..e8fe7e359 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -523,7 +523,7 @@ #define STRINGID_GRASSYTERRAINHEALS 519 #define STRINGID_ELECTRICTERRAINPREVENTS 520 #define STRINGID_PSYCHICTERRAINPREVENTS 521 -#define STRINGID_SAFETYGOOGLESPROTECTED 522 +#define STRINGID_SAFETYGOGGLESPROTECTED 522 #define STRINGID_FLOWERVEILPROTECTED 523 #define STRINGID_SWEETVEILPROTECTED 524 #define STRINGID_AROMAVEILPROTECTED 525 diff --git a/include/constants/hold_effects.h b/include/constants/hold_effects.h index 3dc4a1389..d7d74d3e1 100644 --- a/include/constants/hold_effects.h +++ b/include/constants/hold_effects.h @@ -130,7 +130,7 @@ // Gen6 hold effects #define HOLD_EFFECT_FAIRY_POWER 139 #define HOLD_EFFECT_MEGA_STONE 140 -#define HOLD_EFFECT_SAFETY_GOOGLES 141 +#define HOLD_EFFECT_SAFETY_GOGGLES 141 #define HOLD_EFFECT_LUMINOUS_MOSS 142 #define HOLD_EFFECT_SNOWBALL 143 #define HOLD_EFFECT_WEAKNESS_POLICY 144 diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 95d979e94..fef6e6c6f 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -643,7 +643,7 @@ bool32 IsAffectedByPowder(u8 battler, u16 ability, u16 holdEffect) { if ((B_POWDER_GRASS >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GRASS)) || ability == ABILITY_OVERCOAT - || holdEffect == HOLD_EFFECT_SAFETY_GOOGLES) + || holdEffect == HOLD_EFFECT_SAFETY_GOGGLES) return FALSE; return TRUE; } @@ -1448,7 +1448,7 @@ bool32 ShouldSetSandstorm(u8 battler, u16 ability, u16 holdEffect) || ability == ABILITY_SAND_FORCE || ability == ABILITY_OVERCOAT || ability == ABILITY_MAGIC_GUARD - || holdEffect == HOLD_EFFECT_SAFETY_GOOGLES + || holdEffect == HOLD_EFFECT_SAFETY_GOGGLES || IS_BATTLER_OF_TYPE(battler, TYPE_ROCK) || IS_BATTLER_OF_TYPE(battler, TYPE_STEEL) || IS_BATTLER_OF_TYPE(battler, TYPE_GROUND) @@ -1473,7 +1473,7 @@ bool32 ShouldSetHail(u8 battler, u16 ability, u16 holdEffect) || ability == ABILITY_SLUSH_RUSH || ability == ABILITY_MAGIC_GUARD || ability == ABILITY_OVERCOAT - || holdEffect == HOLD_EFFECT_SAFETY_GOOGLES + || holdEffect == HOLD_EFFECT_SAFETY_GOGGLES || IS_BATTLER_OF_TYPE(battler, TYPE_ICE) || HasMove(battler, MOVE_BLIZZARD) || HasMoveEffect(battler, EFFECT_AURORA_VEIL) @@ -2273,7 +2273,7 @@ static u32 GetWeatherDamage(u8 battlerId) { if (BattlerAffectedBySandstorm(battlerId, ability) && !(gStatuses3[battlerId] & (STATUS3_UNDERGROUND | STATUS3_UNDERWATER)) - && holdEffect != HOLD_EFFECT_SAFETY_GOOGLES) + && holdEffect != HOLD_EFFECT_SAFETY_GOGGLES) { damage = gBattleMons[battlerId].maxHP / 16; if (damage == 0) @@ -2284,7 +2284,7 @@ static u32 GetWeatherDamage(u8 battlerId) { if (BattlerAffectedByHail(battlerId, ability) && !(gStatuses3[battlerId] & (STATUS3_UNDERGROUND | STATUS3_UNDERWATER)) - && holdEffect != HOLD_EFFECT_SAFETY_GOOGLES) + && holdEffect != HOLD_EFFECT_SAFETY_GOGGLES) { damage = gBattleMons[battlerId].maxHP / 16; if (damage == 0) diff --git a/src/battle_debug.c b/src/battle_debug.c index b9cfcdc03..ce5aa4a97 100644 --- a/src/battle_debug.c +++ b/src/battle_debug.c @@ -1951,7 +1951,7 @@ static const u8 sText_HoldEffectAbsorbBulb[] = _("Absorb Bulb"); static const u8 sText_HoldEffectCellBattery[] = _("Cell Battery"); static const u8 sText_HoldEffectFairyPower[] = _("Fairy Power"); static const u8 sText_HoldEffectMegaStone[] = _("Mega Stone"); -static const u8 sText_HoldEffectSafetyGoogles[] = _("Safety Googles"); +static const u8 sText_HoldEffectSafetyGoggles[] = _("Safety Goggles"); static const u8 sText_HoldEffectLuminousMoss[] = _("Luminous Moss"); static const u8 sText_HoldEffectSnowball[] = _("Snowball"); static const u8 sText_HoldEffectWeaknessPolicy[] = _("Weakness Policy"); @@ -2091,7 +2091,7 @@ static const u8 *const sHoldEffectNames[] = [HOLD_EFFECT_CELL_BATTERY] = sText_HoldEffectCellBattery, [HOLD_EFFECT_FAIRY_POWER] = sText_HoldEffectFairyPower, [HOLD_EFFECT_MEGA_STONE] = sText_HoldEffectMegaStone, - [HOLD_EFFECT_SAFETY_GOOGLES] = sText_HoldEffectSafetyGoogles, + [HOLD_EFFECT_SAFETY_GOGGLES] = sText_HoldEffectSafetyGoggles, [HOLD_EFFECT_LUMINOUS_MOSS] = sText_HoldEffectLuminousMoss, [HOLD_EFFECT_SNOWBALL] = sText_HoldEffectSnowball, [HOLD_EFFECT_WEAKNESS_POLICY] = sText_HoldEffectWeaknessPolicy, diff --git a/src/battle_message.c b/src/battle_message.c index f8df8f4b8..69463ce69 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -653,7 +653,7 @@ static const u8 sText_MistyTerrainPreventsStatus[] = _("{B_DEF_NAME_WITH_PREFIX} static const u8 sText_GrassyTerrainHeals[] = _("{B_ATK_NAME_WITH_PREFIX} is healed\nby the grassy terrain!"); static const u8 sText_ElectricTerrainPreventsSleep[] = _("{B_DEF_NAME_WITH_PREFIX} surrounds itself\nwith electrified terrain!"); static const u8 sText_PsychicTerrainPreventsPriority[] = _("{B_DEF_NAME_WITH_PREFIX} surrounds itself\nwith psychic terrain!"); -static const u8 sText_SafetyGooglesProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is not affected\nthanks to its {B_LAST_ITEM}!"); +static const u8 sText_SafetyGogglesProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is not affected\nthanks to its {B_LAST_ITEM}!"); static const u8 sText_FlowerVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} surrounded itself\nwith a veil of petals!"); static const u8 sText_SweetVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} surrounded itself\nwith a veil of sweetness!"); static const u8 sText_AromaVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is protected\nby an aromatic veil!"); @@ -780,7 +780,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_AROMAVEILPROTECTED - 12] = sText_AromaVeilProtected, [STRINGID_SWEETVEILPROTECTED - 12] = sText_SweetVeilProtected, [STRINGID_FLOWERVEILPROTECTED - 12] = sText_FlowerVeilProtected, - [STRINGID_SAFETYGOOGLESPROTECTED - 12] = sText_SafetyGooglesProtected, + [STRINGID_SAFETYGOGGLESPROTECTED - 12] = sText_SafetyGogglesProtected, [STRINGID_SPECTRALTHIEFSTEAL - 12] = sText_SpectralThiefSteal, [STRINGID_BELCHCANTSELECT - 12] = sText_BelchCantUse, [STRINGID_TRAINER1LOSETEXT - 12] = sText_Trainer1LoseText, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 3b627a020..5e5d19750 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10129,7 +10129,7 @@ static void Cmd_weatherdamage(void) && ability != ABILITY_SAND_RUSH && ability != ABILITY_OVERCOAT && !(gStatuses3[gBattlerAttacker] & (STATUS3_UNDERGROUND | STATUS3_UNDERWATER)) - && GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOOGLES) + && GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOGGLES) { gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16; if (gBattleMoveDamage == 0) @@ -10154,7 +10154,7 @@ static void Cmd_weatherdamage(void) && ability != ABILITY_OVERCOAT && ability != ABILITY_ICE_BODY && !(gStatuses3[gBattlerAttacker] & (STATUS3_UNDERGROUND | STATUS3_UNDERWATER)) - && GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOOGLES) + && GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOGGLES) { gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16; if (gBattleMoveDamage == 0) diff --git a/src/battle_util.c b/src/battle_util.c index 01ee1a691..34855ecd3 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3386,9 +3386,10 @@ u8 AtkCanceller_UnableToUseMove(void) gBattlerAbility = gBattlerTarget; effect = 1; } - else if (GetBattlerHoldEffect(gBattlerTarget, TRUE) == HOLD_EFFECT_SAFETY_GOOGLES) + else if (GetBattlerHoldEffect(gBattlerTarget, TRUE) == HOLD_EFFECT_SAFETY_GOGGLES) { - RecordItemEffectBattle(gBattlerTarget, HOLD_EFFECT_SAFETY_GOOGLES); + RecordItemEffectBattle(gBattlerTarget, HOLD_EFFECT_SAFETY_GOGGLES); + gLastUsedItem = gBattleMons[gBattlerTarget].item; effect = 1; } @@ -4882,7 +4883,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move case ABILITY_EFFECT_SPORE: if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_GRASS) && GetBattlerAbility(gBattlerAttacker) != ABILITY_OVERCOAT - && GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOOGLES) + && GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOGGLES) { i = Random() % 3; if (i == 0)