From 09fd393f97f4af4c00453aba39f6068fd5825918 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Tue, 23 Aug 2022 22:38:35 -0400 Subject: [PATCH 1/3] Replaced instances of power == 0 with IS_MOVE_STATUS + fixed Wonder Skin --- src/battle_ai_main.c | 2 +- src/battle_ai_switch_items.c | 7 +++---- src/battle_dome.c | 2 +- src/battle_gfx_sfx_util.c | 2 +- src/battle_script_commands.c | 16 ++++++++-------- src/battle_tv.c | 4 ++-- src/battle_util.c | 6 +++--- 7 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 732dea780..0d029e397 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -245,7 +245,7 @@ static void SetBattlerAiData(u8 battlerId) AI_DATA->holdEffectParams[battlerId] = GetBattlerHoldEffectParam(battlerId); AI_DATA->predictedMoves[battlerId] = gLastMoves[battlerId]; AI_DATA->hpPercents[battlerId] = GetHealthPercentage(battlerId); - AI_DATA->moveLimitations[battlerId] = CheckMoveLimitations(battlerId, 0, 0xFF); + AI_DATA->moveLimitations[battlerId] = CheckMoveLimitations(battlerId, 0, MOVE_LIMITATIONS_ALL); } void GetAiLogicData(void) diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 13cc82824..e29970cdf 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -154,7 +154,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void) return FALSE; if (gLastLandedMoves[gActiveBattler] == MOVE_UNAVAILABLE) return FALSE; - if (gBattleMoves[gLastLandedMoves[gActiveBattler]].power == 0) + if (IS_MOVE_STATUS(gLastLandedMoves[gActiveBattler])) return FALSE; if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) @@ -245,8 +245,7 @@ static bool8 ShouldSwitchIfNaturalCure(void) BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0); return TRUE; } - else if (gBattleMoves[gLastLandedMoves[gActiveBattler]].power == 0 - && Random() & 1) + else if (IS_MOVE_STATUS(gLastLandedMoves[gActiveBattler]) && Random() & 1) { *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE; BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0); @@ -350,7 +349,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u16 flags, u8 moduloPercent) return FALSE; if (gLastHitBy[gActiveBattler] == 0xFF) return FALSE; - if (gBattleMoves[gLastLandedMoves[gActiveBattler]].power == 0) + if (IS_MOVE_STATUS(gLastLandedMoves[gActiveBattler])) return FALSE; if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) diff --git a/src/battle_dome.c b/src/battle_dome.c index 8b3b29fc1..84b7652a5 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -2747,7 +2747,7 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int mode) int i = 0; int typePower = TYPE_x1; - if (move == MOVE_NONE || move == MOVE_UNAVAILABLE || gBattleMoves[move].power == 0) + if (move == MOVE_NONE || move == MOVE_UNAVAILABLE || IS_MOVE_STATUS(move)) return 0; defType1 = gBaseStats[targetSpecies].type1; diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index 8cd23098f..eeab8adda 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -282,7 +282,7 @@ static u8 GetBattlePalaceMoveGroup(u8 battlerId, u16 move) case MOVE_TARGET_RANDOM: case MOVE_TARGET_BOTH: case MOVE_TARGET_FOES_AND_ALLY: - if (gBattleMoves[move].power == 0) + if (IS_MOVE_STATUS(move)) return PALACE_MOVE_GROUP_SUPPORT; else return PALACE_MOVE_GROUP_ATTACK; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 420d5790c..dc03f101c 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1345,7 +1345,7 @@ static bool32 TryAegiFormChange(void) default: return FALSE; case SPECIES_AEGISLASH: // Shield -> Blade - if (gBattleMoves[gCurrentMove].power == 0) + if (IS_MOVE_STATUS(gCurrentMove)) return FALSE; gBattleMons[gBattlerAttacker].species = SPECIES_AEGISLASH_BLADE; break; @@ -1687,7 +1687,7 @@ u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move, u32 atkAbility, u && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE)) moveAcc = 50; // Check Wonder Skin. - if (defAbility == ABILITY_WONDER_SKIN && gBattleMoves[move].power == 0) + if (defAbility == ABILITY_WONDER_SKIN && IS_MOVE_STATUS(move) && moveAcc > 50) moveAcc = 50; calc = gAccuracyStageRatios[buff].dividend * moveAcc; @@ -8395,7 +8395,7 @@ static void Cmd_various(void) gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); else if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget)) gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); - else if (gBattleMoves[gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]]].power == 0) + else if (IS_MOVE_STATUS(gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]])) gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); else gBattlescriptCurrInstr += 7; @@ -8493,7 +8493,7 @@ static void Cmd_various(void) case VARIOUS_TRY_ME_FIRST: if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget)) gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); - else if (gBattleMoves[gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]]].power == 0) + else if (IS_MOVE_STATUS(gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]])) gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); else { @@ -13451,11 +13451,11 @@ bool32 DoesSubstituteBlockMove(u8 battlerAtk, u8 battlerDef, u32 move) bool32 DoesDisguiseBlockMove(u8 battlerAtk, u8 battlerDef, u32 move) { - if (GetBattlerAbility(battlerDef) != ABILITY_DISGUISE - || gBattleMons[battlerDef].species != SPECIES_MIMIKYU + if (gBattleMons[battlerDef].species != SPECIES_MIMIKYU || gBattleMons[battlerDef].status2 & STATUS2_TRANSFORMED - || gBattleMoves[move].power == 0 - || gHitMarker & HITMARKER_IGNORE_DISGUISE) + || IS_MOVE_STATUS(move) + || gHitMarker & HITMARKER_IGNORE_DISGUISE + || GetBattlerAbility(battlerDef) != ABILITY_DISGUISE) return FALSE; else return TRUE; diff --git a/src/battle_tv.c b/src/battle_tv.c index b6647b116..19d3eba8d 100644 --- a/src/battle_tv.c +++ b/src/battle_tv.c @@ -1435,7 +1435,7 @@ static void TrySetBattleSeminarShow(void) return; else if (gBattleTypeFlags & (BATTLE_TYPE_PALACE | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID)) return; - else if (gBattleMoves[gBattleMons[gBattlerAttacker].moves[gMoveSelectionCursor[gBattlerAttacker]]].power == 0) + else if (IS_MOVE_STATUS(gBattleMons[gBattlerAttacker].moves[gMoveSelectionCursor[gBattlerAttacker]])) return; i = 0; @@ -1496,7 +1496,7 @@ static void TrySetBattleSeminarShow(void) static bool8 ShouldCalculateDamage(u16 moveId, s32 *dmg, u16 *powerOverride) { - if (gBattleMoves[moveId].power == 0) + if (IS_MOVE_STATUS(moveId)) { *dmg = 0; return FALSE; diff --git a/src/battle_util.c b/src/battle_util.c index fd9b699b8..7f4274b20 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1764,7 +1764,7 @@ u8 TrySetCantSelectMoveBattleScript(void) } } - if (!gBattleStruct->zmove.active && gDisableStructs[gActiveBattler].tauntTimer != 0 && gBattleMoves[move].power == 0) + if (!gBattleStruct->zmove.active && gDisableStructs[gActiveBattler].tauntTimer != 0 && IS_MOVE_STATUS(move)) { gCurrentMove = move; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) @@ -1884,7 +1884,7 @@ u8 TrySetCantSelectMoveBattleScript(void) limitations++; } } - else if (holdEffect == HOLD_EFFECT_ASSAULT_VEST && gBattleMoves[move].power == 0 && move != MOVE_ME_FIRST) + else if (holdEffect == HOLD_EFFECT_ASSAULT_VEST && IS_MOVE_STATUS(move) && move != MOVE_ME_FIRST) { gCurrentMove = move; gLastUsedItem = gBattleMons[gActiveBattler].item; @@ -3545,7 +3545,7 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case CANCELLER_TAUNTED: // taunt - if (gDisableStructs[gBattlerAttacker].tauntTimer && gBattleMoves[gCurrentMove].power == 0) + if (gDisableStructs[gBattlerAttacker].tauntTimer && IS_MOVE_STATUS(gCurrentMove)) { gProtectStructs[gBattlerAttacker].usedTauntedMove = TRUE; CancelMultiTurnMoves(gBattlerAttacker); From 56a2e91518ce4170722a4fe73131d4bb78dba6df Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Tue, 23 Aug 2022 22:40:04 -0400 Subject: [PATCH 2/3] Updated move limitations --- data/battle_scripts_1.s | 13 +++++++++++++ include/battle_scripts.h | 4 ++++ include/battle_util.h | 12 ++++++++++-- src/battle_util.c | 37 ++++++++++++++++++++----------------- 4 files changed, 47 insertions(+), 19 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 5e6ab3392..08474a1e8 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7257,6 +7257,10 @@ BattleScript_SelectingNotAllowedStuffCheeks:: printselectionstring STRINGID_STUFFCHEEKSCANTSELECT endselectionscript +BattleScript_SelectingNotAllowedStuffCheeksInPalace:: + printstring STRINGID_STUFFCHEEKSCANTSELECT + goto BattleScript_SelectingUnusableMoveInPalace + BattleScript_SelectingNotAllowedBelch:: printselectionstring STRINGID_BELCHCANTSELECT endselectionscript @@ -9196,14 +9200,23 @@ BattleScript_ItemHealHP_Ret:: BattleScript_SelectingNotAllowedMoveChoiceItem:: printselectionstring STRINGID_ITEMALLOWSONLYYMOVE endselectionscript +BattleScript_SelectingNotAllowedMoveChoiceItemInPalace:: + printstring STRINGID_ITEMALLOWSONLYYMOVE + goto BattleScript_SelectingUnusableMoveInPalace BattleScript_SelectingNotAllowedMoveGorillaTactics:: printselectionstring STRINGID_ABILITYALLOWSONLYMOVE endselectionscript +BattleScript_SelectingNotAllowedMoveGorillaTacticsInPalace:: + printstring STRINGID_ABILITYALLOWSONLYMOVE + goto BattleScript_SelectingUnusableMoveInPalace BattleScript_SelectingNotAllowedMoveAssaultVest:: printselectionstring STRINGID_ASSAULTVESTDOESNTALLOW endselectionscript +BattleScript_SelectingNotAllowedMoveAssaultVestInPalace:: + printstring STRINGID_ASSAULTVESTDOESNTALLOW + goto BattleScript_SelectingUnusableMoveInPalace BattleScript_HangedOnMsg:: playanimation BS_TARGET, B_ANIM_HANGED_ON diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 09e11bd8c..77d889cc3 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -210,6 +210,7 @@ extern const u8 BattleScript_BerryPPHealEnd2[]; extern const u8 BattleScript_ItemHealHP_End2[]; extern const u8 BattleScript_ItemHealHP_Ret[]; extern const u8 BattleScript_SelectingNotAllowedMoveChoiceItem[]; +extern const u8 BattleScript_SelectingNotAllowedMoveChoiceItemInPalace[]; extern const u8 BattleScript_HangedOnMsg[]; extern const u8 BattleScript_BerryConfuseHealEnd2[]; extern const u8 BattleScript_BerryConfuseHealRet[]; @@ -275,6 +276,7 @@ extern const u8 BattleScript_SnowWarningActivates[]; extern const u8 BattleScript_HarvestActivates[]; extern const u8 BattleScript_ImposterActivates[]; extern const u8 BattleScript_SelectingNotAllowedMoveAssaultVest[]; +extern const u8 BattleScript_SelectingNotAllowedMoveAssaultVestInPalace[]; extern const u8 BattleScript_SelectingNotAllowedMoveGravity[]; extern const u8 BattleScript_MoveUsedGravityPrevents[]; extern const u8 BattleScript_SelectingNotAllowedMoveGravityInPalace[]; @@ -301,6 +303,7 @@ extern const u8 BattleScript_DazzlingProtected[]; extern const u8 BattleScript_MoveUsedPsychicTerrainPrevents[]; extern const u8 BattleScript_MoveUsedPowder[]; extern const u8 BattleScript_SelectingNotAllowedStuffCheeks[]; +extern const u8 BattleScript_SelectingNotAllowedStuffCheeksInPalace[]; extern const u8 BattleScript_SelectingNotAllowedBelch[]; extern const u8 BattleScript_SelectingNotAllowedBelchInPalace[]; extern const u8 BattleScript_PsychicSurgeActivates[]; @@ -405,6 +408,7 @@ extern const u8 BattleScript_BlockedByPrimalWeatherRet[]; extern const u8 BattleScript_PrimalReversion[]; extern const u8 BattleScript_HyperspaceFuryRemoveProtect[]; extern const u8 BattleScript_SelectingNotAllowedMoveGorillaTactics[]; +extern const u8 BattleScript_SelectingNotAllowedMoveGorillaTacticsInPalace[]; extern const u8 BattleScript_WanderingSpiritActivates[]; extern const u8 BattleScript_MirrorArmorReflect[]; extern const u8 BattleScript_GooeyActivates[]; diff --git a/include/battle_util.h b/include/battle_util.h index d0edbc9d1..0219a0e6a 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -7,7 +7,15 @@ #define MOVE_LIMITATION_TORMENTED (1 << 3) #define MOVE_LIMITATION_TAUNT (1 << 4) #define MOVE_LIMITATION_IMPRISON (1 << 5) -#define MOVE_LIMITATIONS_ALL 0xFF +#define MOVE_LIMITATION_ENCORE (1 << 6) +#define MOVE_LIMITATION_CHOICE_ITEM (1 << 7) +#define MOVE_LIMITATION_ASSAULT_VEST (1 << 8) +#define MOVE_LIMITATION_GRAVITY (1 << 9) +#define MOVE_LIMITATION_HEAL_BLOCK (1 << 10) +#define MOVE_LIMITATION_BELCH (1 << 11) +#define MOVE_LIMITATION_THROAT_CHOP (1 << 12) +#define MOVE_LIMITATION_STUFF_CHEEKS (1 << 13) +#define MOVE_LIMITATIONS_ALL 0xFFFF #define ABILITYEFFECT_ON_SWITCHIN 0 #define ABILITYEFFECT_ENDTURN 1 @@ -89,7 +97,7 @@ void BattleScriptPush(const u8 *bsPtr); void BattleScriptPushCursor(void); void BattleScriptPop(void); u8 TrySetCantSelectMoveBattleScript(void); -u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check); +u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u16 check); bool8 AreAllMovesUnusable(void); u8 GetImprisonedMovesCount(u8 battlerId, u16 move); u8 DoFieldEndTurnEffects(void); diff --git a/src/battle_util.c b/src/battle_util.c index 7f4274b20..22c319a46 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1859,7 +1859,7 @@ u8 TrySetCantSelectMoveBattleScript(void) gCurrentMove = move; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedBelchInPalace; + gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedStuffCheeksInPalace; gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else @@ -1876,6 +1876,7 @@ u8 TrySetCantSelectMoveBattleScript(void) gLastUsedItem = gBattleMons[gActiveBattler].item; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { + gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveChoiceItemInPalace; gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else @@ -1890,6 +1891,7 @@ u8 TrySetCantSelectMoveBattleScript(void) gLastUsedItem = gBattleMons[gActiveBattler].item; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { + gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveAssaultVestInPalace; gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else @@ -1905,6 +1907,7 @@ u8 TrySetCantSelectMoveBattleScript(void) gLastUsedItem = gBattleMons[gActiveBattler].item; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { + gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveGorillaTacticsInPalace; gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else @@ -1930,7 +1933,7 @@ u8 TrySetCantSelectMoveBattleScript(void) return limitations; } -u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check) +u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u16 check) { u8 holdEffect = GetBattlerHoldEffect(battlerId, TRUE); u16 *choicedMove = &gBattleStruct->choicedMove[battlerId]; @@ -1941,49 +1944,49 @@ u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check) for (i = 0; i < MAX_MON_MOVES; i++) { // No move - if (gBattleMons[battlerId].moves[i] == MOVE_NONE && check & MOVE_LIMITATION_ZEROMOVE) + if (check & MOVE_LIMITATION_ZEROMOVE && gBattleMons[battlerId].moves[i] == MOVE_NONE) unusableMoves |= gBitTable[i]; // No PP - else if (gBattleMons[battlerId].pp[i] == 0 && check & MOVE_LIMITATION_PP) + else if (check & MOVE_LIMITATION_PP && gBattleMons[battlerId].pp[i] == 0) unusableMoves |= gBitTable[i]; // Disable - else if (gBattleMons[battlerId].moves[i] == gDisableStructs[battlerId].disabledMove && check & MOVE_LIMITATION_DISABLED) + else if (check & MOVE_LIMITATION_DISABLED && gBattleMons[battlerId].moves[i] == gDisableStructs[battlerId].disabledMove) unusableMoves |= gBitTable[i]; // Torment - else if (gBattleMons[battlerId].moves[i] == gLastMoves[battlerId] && check & MOVE_LIMITATION_TORMENTED && gBattleMons[battlerId].status2 & STATUS2_TORMENT) + else if (check & MOVE_LIMITATION_TORMENTED && gBattleMons[battlerId].moves[i] == gLastMoves[battlerId] && gBattleMons[battlerId].status2 & STATUS2_TORMENT) unusableMoves |= gBitTable[i]; // Taunt - else if (gDisableStructs[battlerId].tauntTimer && check & MOVE_LIMITATION_TAUNT && gBattleMoves[gBattleMons[battlerId].moves[i]].power == 0) + else if (check & MOVE_LIMITATION_TAUNT && gDisableStructs[battlerId].tauntTimer && IS_MOVE_STATUS(gBattleMons[battlerId].moves[i])) unusableMoves |= gBitTable[i]; // Imprison - else if (GetImprisonedMovesCount(battlerId, gBattleMons[battlerId].moves[i]) && check & MOVE_LIMITATION_IMPRISON) + else if (check & MOVE_LIMITATION_IMPRISON && GetImprisonedMovesCount(battlerId, gBattleMons[battlerId].moves[i])) unusableMoves |= gBitTable[i]; // Encore - else if (gDisableStructs[battlerId].encoreTimer && gDisableStructs[battlerId].encoredMove != gBattleMons[battlerId].moves[i]) + else if (check & MOVE_LIMITATION_ENCORE && gDisableStructs[battlerId].encoreTimer && gDisableStructs[battlerId].encoredMove != gBattleMons[battlerId].moves[i]) unusableMoves |= gBitTable[i]; // Choice Items - else if (HOLD_EFFECT_CHOICE(holdEffect) && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battlerId].moves[i]) + else if (check & MOVE_LIMITATION_CHOICE_ITEM && HOLD_EFFECT_CHOICE(holdEffect) && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battlerId].moves[i]) unusableMoves |= gBitTable[i]; // Assault Vest - else if (holdEffect == HOLD_EFFECT_ASSAULT_VEST && gBattleMoves[gBattleMons[battlerId].moves[i]].power == 0 && gBattleMons[battlerId].moves[i] != MOVE_ME_FIRST) + else if (check & MOVE_LIMITATION_ASSAULT_VEST && holdEffect == HOLD_EFFECT_ASSAULT_VEST && IS_MOVE_STATUS(gBattleMons[battlerId].moves[i]) && gBattleMons[battlerId].moves[i] != MOVE_ME_FIRST) unusableMoves |= gBitTable[i]; // Gravity - else if (IsGravityPreventingMove(gBattleMons[battlerId].moves[i])) + else if (check & MOVE_LIMITATION_GRAVITY && IsGravityPreventingMove(gBattleMons[battlerId].moves[i])) unusableMoves |= gBitTable[i]; // Heal Block - else if (IsHealBlockPreventingMove(battlerId, gBattleMons[battlerId].moves[i])) + else if (check & MOVE_LIMITATION_HEAL_BLOCK && IsHealBlockPreventingMove(battlerId, gBattleMons[battlerId].moves[i])) unusableMoves |= gBitTable[i]; // Belch - else if (IsBelchPreventingMove(battlerId, gBattleMons[battlerId].moves[i])) + else if (check & MOVE_LIMITATION_BELCH && IsBelchPreventingMove(battlerId, gBattleMons[battlerId].moves[i])) unusableMoves |= gBitTable[i]; // Throat Chop - else if (gDisableStructs[battlerId].throatChopTimer && gBattleMoves[gBattleMons[battlerId].moves[i]].flags & FLAG_SOUND) + else if (check & MOVE_LIMITATION_THROAT_CHOP && gDisableStructs[battlerId].throatChopTimer && gBattleMoves[gBattleMons[battlerId].moves[i]].flags & FLAG_SOUND) unusableMoves |= gBitTable[i]; // Stuff Cheeks - else if (gBattleMons[battlerId].moves[i] == MOVE_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[gActiveBattler].item) != POCKET_BERRIES) + else if (check & MOVE_LIMITATION_STUFF_CHEEKS && gBattleMons[battlerId].moves[i] == MOVE_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[gActiveBattler].item) != POCKET_BERRIES) unusableMoves |= gBitTable[i]; // Gorilla Tactics - else if (GetBattlerAbility(battlerId) == ABILITY_GORILLA_TACTICS && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battlerId].moves[i]) + else if (check & MOVE_LIMITATION_CHOICE_ITEM && GetBattlerAbility(battlerId) == ABILITY_GORILLA_TACTICS && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battlerId].moves[i]) unusableMoves |= gBitTable[i]; } return unusableMoves; From eea718cfc6f75aebd1c5c04cdfd5e20aae4acd99 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 24 Aug 2022 00:30:49 -0400 Subject: [PATCH 3/3] Placeholder moves can't be used in battle. --- data/battle_scripts_1.s | 11 +++++++++++ include/battle_scripts.h | 2 ++ include/battle_util.h | 2 ++ include/pokemon_summary_screen.h | 1 + src/battle_ai_main.c | 2 ++ src/battle_util.c | 17 +++++++++++++++++ src/data/text/move_descriptions.h | 5 +++-- src/menu_specialized.c | 7 ++++++- src/pokemon_summary_screen.c | 11 +++++++++-- 9 files changed, 53 insertions(+), 5 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 08474a1e8..d3ff57492 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -9200,6 +9200,7 @@ BattleScript_ItemHealHP_Ret:: BattleScript_SelectingNotAllowedMoveChoiceItem:: printselectionstring STRINGID_ITEMALLOWSONLYYMOVE endselectionscript + BattleScript_SelectingNotAllowedMoveChoiceItemInPalace:: printstring STRINGID_ITEMALLOWSONLYYMOVE goto BattleScript_SelectingUnusableMoveInPalace @@ -9207,6 +9208,7 @@ BattleScript_SelectingNotAllowedMoveChoiceItemInPalace:: BattleScript_SelectingNotAllowedMoveGorillaTactics:: printselectionstring STRINGID_ABILITYALLOWSONLYMOVE endselectionscript + BattleScript_SelectingNotAllowedMoveGorillaTacticsInPalace:: printstring STRINGID_ABILITYALLOWSONLYMOVE goto BattleScript_SelectingUnusableMoveInPalace @@ -9214,10 +9216,19 @@ BattleScript_SelectingNotAllowedMoveGorillaTacticsInPalace:: BattleScript_SelectingNotAllowedMoveAssaultVest:: printselectionstring STRINGID_ASSAULTVESTDOESNTALLOW endselectionscript + BattleScript_SelectingNotAllowedMoveAssaultVestInPalace:: printstring STRINGID_ASSAULTVESTDOESNTALLOW goto BattleScript_SelectingUnusableMoveInPalace +BattleScript_SelectingNotAllowedPlaceholder:: + printselectionstring STRINGID_NOTDONEYET + endselectionscript + +BattleScript_SelectingNotAllowedPlaceholderInPalace:: + printstring STRINGID_NOTDONEYET + goto BattleScript_SelectingUnusableMoveInPalace + BattleScript_HangedOnMsg:: playanimation BS_TARGET, B_ANIM_HANGED_ON printstring STRINGID_PKMNHUNGONWITHX diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 77d889cc3..19380932d 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -277,6 +277,8 @@ extern const u8 BattleScript_HarvestActivates[]; extern const u8 BattleScript_ImposterActivates[]; extern const u8 BattleScript_SelectingNotAllowedMoveAssaultVest[]; extern const u8 BattleScript_SelectingNotAllowedMoveAssaultVestInPalace[]; +extern const u8 BattleScript_SelectingNotAllowedPlaceholder[]; +extern const u8 BattleScript_SelectingNotAllowedPlaceholderInPalace[]; extern const u8 BattleScript_SelectingNotAllowedMoveGravity[]; extern const u8 BattleScript_MoveUsedGravityPrevents[]; extern const u8 BattleScript_SelectingNotAllowedMoveGravityInPalace[]; diff --git a/include/battle_util.h b/include/battle_util.h index 0219a0e6a..d26aa2477 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -15,6 +15,8 @@ #define MOVE_LIMITATION_BELCH (1 << 11) #define MOVE_LIMITATION_THROAT_CHOP (1 << 12) #define MOVE_LIMITATION_STUFF_CHEEKS (1 << 13) + +#define MOVE_LIMITATION_PLACEHOLDER (1 << 15) #define MOVE_LIMITATIONS_ALL 0xFFFF #define ABILITYEFFECT_ON_SWITCHIN 0 diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index 3996c8e15..4e9e62284 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -6,6 +6,7 @@ extern u8 gLastViewedMonIndex; extern const u8 *const gMoveDescriptionPointers[]; +extern const u8 gNotDoneYetDescription[]; extern const u8 *const gNatureNamePointers[]; void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)); diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 0d029e397..c253d37fb 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -2512,6 +2512,8 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (gBattleMons[battlerAtk].hp <= gBattleMons[battlerAtk].maxHP / 3) score -= 10; break;*/ + case EFFECT_PLACEHOLDER: + return 0; // cannot even select } // move effect checks if (score < 0) diff --git a/src/battle_util.c b/src/battle_util.c index 22c319a46..6f3c16514 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1930,6 +1930,20 @@ u8 TrySetCantSelectMoveBattleScript(void) } } + if (gBattleMoves[move].effect == EFFECT_PLACEHOLDER) + { + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedPlaceholderInPalace; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; + } + else + { + gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedPlaceholder; + limitations++; + } + } + return limitations; } @@ -1949,6 +1963,9 @@ u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u16 check) // No PP else if (check & MOVE_LIMITATION_PP && gBattleMons[battlerId].pp[i] == 0) unusableMoves |= gBitTable[i]; + // Placeholder + else if (check & MOVE_LIMITATION_PLACEHOLDER && gBattleMoves[gBattleMons[battlerId].moves[i]].effect == EFFECT_PLACEHOLDER) + unusableMoves |= gBitTable[i]; // Disable else if (check & MOVE_LIMITATION_DISABLED && gBattleMons[battlerId].moves[i] == gDisableStructs[battlerId].disabledMove) unusableMoves |= gBitTable[i]; diff --git a/src/data/text/move_descriptions.h b/src/data/text/move_descriptions.h index 5f6bcfb0e..7d890b1d3 100644 --- a/src/data/text/move_descriptions.h +++ b/src/data/text/move_descriptions.h @@ -2978,8 +2978,9 @@ static const u8 sEerieSpellDescription[] = _( "Attacks with psychic power.\n" "Foe's last move has 3 PP cut."); -static const u8 sNotDoneYetDescription[] = _( - "Not done yet."); +const u8 gNotDoneYetDescription[] = _( + "This move can't be used. Its\n" + "effect is in development."); // MOVE_NONE is ignored in this table. Make sure to always subtract 1 before getting the right pointer. const u8 *const gMoveDescriptionPointers[MOVES_COUNT - 1] = diff --git a/src/menu_specialized.c b/src/menu_specialized.c index 42c80b5ee..0893fd314 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -24,6 +24,7 @@ #include "trig.h" #include "window.h" #include "constants/songs.h" +#include "constants/battle_move_effects.h" #include "gba/io_reg.h" extern const struct CompressedSpriteSheet gMonFrontPicTable[]; @@ -807,7 +808,11 @@ static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove) } AddTextPrinterParameterized(0, FONT_NORMAL, str, 0x6A, 0x29, TEXT_SKIP_DRAW, NULL); - str = gMoveDescriptionPointers[chosenMove - 1]; + if (move->effect != EFFECT_PLACEHOLDER) + str = gMoveDescriptionPointers[chosenMove - 1]; + else + str = gNotDoneYetDescription; + AddTextPrinterParameterized(0, FONT_NARROW, str, 0, 0x41, 0, NULL); } diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 2befc159f..d47253b71 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -41,13 +41,14 @@ #include "text.h" #include "tv.h" #include "window.h" +#include "constants/battle_config.h" +#include "constants/battle_move_effects.h" #include "constants/items.h" #include "constants/moves.h" #include "constants/party_menu.h" #include "constants/region_map_sections.h" #include "constants/rgb.h" #include "constants/songs.h" -#include "constants/battle_config.h" enum { PSS_PAGE_INFO, @@ -3730,15 +3731,21 @@ static void PrintContestMoveDescription(u8 moveSlot) static void PrintMoveDetails(u16 move) { u8 windowId = AddWindowFromTemplateList(sPageMovesTemplate, PSS_DATA_WINDOW_MOVE_DESCRIPTION); + u8 moveEffect; FillWindowPixelBuffer(windowId, PIXEL_FILL(0)); if (move != MOVE_NONE) { if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES) { + moveEffect = gBattleMoves[move].effect; if (B_SHOW_SPLIT_ICON == TRUE) ShowSplitIcon(GetBattleMoveSplit(move)); PrintMovePowerAndAccuracy(move); - PrintTextOnWindow(windowId, gMoveDescriptionPointers[move - 1], 6, 1, 0, 0); + + if (moveEffect != EFFECT_PLACEHOLDER) + PrintTextOnWindow(windowId, gMoveDescriptionPointers[move - 1], 6, 1, 0, 0); + else + PrintTextOnWindow(windowId, gNotDoneYetDescription, 6, 1, 0, 0); } else {