From 59ea75f99fdd2f106a29c6a2f0fb41e231d26deb Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 8 Jun 2021 12:56:38 +0200 Subject: [PATCH 01/20] Fix Ability-popup lag --- data/battle_scripts_1.s | 2 ++ 1 file changed, 2 insertions(+) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 9a36249a1..0dc770fe6 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6657,9 +6657,11 @@ BattleScript_DefiantActivates:: return BattleScript_AbilityPopUp: + .if B_ABILITY_POP_UP == TRUE showabilitypopup BS_ABILITY_BATTLER recordability BS_ABILITY_BATTLER pause 40 + .endif sethword sABILITY_OVERWRITE, 0 return From eadd09bebd756a801ebcdc5b5246e7f1e72bb9b8 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Sun, 25 Jul 2021 07:39:02 -0600 Subject: [PATCH 02/20] block item use under embargo --- src/battle_ai_switch_items.c | 3 +++ src/party_menu.c | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 565c0f261..e8e399935 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -795,6 +795,9 @@ static bool8 ShouldUseItem(void) if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT) return FALSE; + + if (gStatuses3[gActiveBattler] & STATUS3_EMBARGO) + return FALSE; if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) party = gPlayerParty; diff --git a/src/party_menu.c b/src/party_menu.c index 76ee8073f..7712305ef 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -4313,7 +4313,13 @@ static bool8 IsItemFlute(u16 item) static bool8 ExecuteTableBasedItemEffect_(u8 partyMonIndex, u16 item, u8 monMoveIndex) { if (gMain.inBattle) - return ExecuteTableBasedItemEffect(&gPlayerParty[partyMonIndex], item, GetPartyIdFromBattleSlot(partyMonIndex), monMoveIndex); + { + if ((partyMonIndex == 0 && gStatuses3[B_POSITION_PLAYER_LEFT] & STATUS3_EMBARGO) + || (partyMonIndex == 1 && gStatuses3[B_POSITION_PLAYER_RIGHT] & STATUS3_EMBARGO)) + return TRUE; // cannot use on this mon + else + return ExecuteTableBasedItemEffect(&gPlayerParty[partyMonIndex], item, GetPartyIdFromBattleSlot(partyMonIndex), monMoveIndex); + } else return ExecuteTableBasedItemEffect(&gPlayerParty[partyMonIndex], item, partyMonIndex, monMoveIndex); } From fd61770c34c757f3a481222a31f4104207f2725e Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Sun, 25 Jul 2021 07:53:44 -0600 Subject: [PATCH 03/20] water bubble prevents burn --- data/battle_scripts_1.s | 1 + src/battle_pike.c | 2 +- src/battle_script_commands.c | 10 ++++++---- src/battle_util.c | 2 ++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 522ffb701..528674f39 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -4331,6 +4331,7 @@ BattleScript_EffectWillOWisp:: jumpifstatus BS_TARGET, STATUS1_BURN, BattleScript_AlreadyBurned jumpiftype BS_TARGET, TYPE_FIRE, BattleScript_NotAffected jumpifability BS_TARGET, ABILITY_WATER_VEIL, BattleScript_WaterVeilPrevents + jumpifability BS_TARGET, ABILITY_WATER_BUBBLE, BattleScript_WaterVeilPrevents jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_LeafGuardProtects jumpifflowerveil BattleScript_FlowerVeilProtects jumpifleafguard BattleScript_LeafGuardProtects diff --git a/src/battle_pike.c b/src/battle_pike.c index e44ad81cc..5d958dec2 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -821,7 +821,7 @@ static bool8 DoesAbilityPreventStatus(struct Pokemon *mon, u32 status) ret = TRUE; break; case STATUS1_BURN: - if (ability == ABILITY_WATER_VEIL) + if (ability == ABILITY_WATER_VEIL || ability == ABILITY_WATER_BUBBLE) ret = TRUE; break; case STATUS1_PARALYSIS: diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index de7105a27..0da63b4ef 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2588,11 +2588,11 @@ void SetMoveEffect(bool32 primary, u32 certain) statusChanged = TRUE; break; case STATUS1_BURN: - if (GetBattlerAbility(gEffectBattler) == ABILITY_WATER_VEIL + if ((GetBattlerAbility(gEffectBattler) == ABILITY_WATER_VEIL || GetBattlerAbility(gEffectBattler) == ABILITY_WATER_BUBBLE) && (primary == TRUE || certain == MOVE_EFFECT_CERTAIN)) { - gLastUsedAbility = ABILITY_WATER_VEIL; - RecordAbilityBattle(gEffectBattler, ABILITY_WATER_VEIL); + gLastUsedAbility = GetBattlerAbility(gEffectBattler); + RecordAbilityBattle(gEffectBattler, GetBattlerAbility(gEffectBattler)); BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_BRNPrevention; @@ -2621,6 +2621,7 @@ void SetMoveEffect(bool32 primary, u32 certain) break; if (GetBattlerAbility(gEffectBattler) == ABILITY_WATER_VEIL || GetBattlerAbility(gEffectBattler) == ABILITY_COMATOSE + || GetBattlerAbility(gEffectBattler) == ABILITY_WATER_BUBBLE || IsAbilityStatusProtected(gEffectBattler)) break; if (gBattleMons[gEffectBattler].status1) @@ -8195,7 +8196,8 @@ static void Cmd_various(void) } else if (gBattleMons[gBattlerAttacker].status1 & STATUS1_BURN) { - if (GetBattlerAbility(gBattlerTarget) == ABILITY_WATER_VEIL) + if (GetBattlerAbility(gBattlerTarget) == ABILITY_WATER_VEIL + || GetBattlerAbility(gBattlerTarget) == ABILITY_WATER_BUBBLE) { gBattlerAbility = gBattlerTarget; BattleScriptPush(T1_READ_PTR(gBattlescriptCurrInstr + 3)); diff --git a/src/battle_util.c b/src/battle_util.c index 7deebd25e..315cfebaf 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4863,6 +4863,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move && TARGET_TURN_DAMAGED && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_FIRE) && GetBattlerAbility(gBattlerAttacker) != ABILITY_WATER_VEIL + && GetBattlerAbility(gBattlerAttacker) != ABILITY_WATER_BUBBLE && !(gBattleMons[gBattlerAttacker].status1 & STATUS1_ANY) && !IsAbilityStatusProtected(gBattlerAttacker) && (Random() % 3) == 0) @@ -5070,6 +5071,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITY_WATER_VEIL: + case ABILITY_WATER_BUBBLE: if (gBattleMons[battler].status1 & STATUS1_BURN) { StringCopy(gBattleTextBuff1, gStatusConditionString_BurnJpn); From ea6ce80ad4b785f696c615f37cae366c5676bea7 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Wed, 1 Sep 2021 19:57:03 +1200 Subject: [PATCH 04/20] Fix protect-like moves Make Protect-like moves (King's Shield etc.) activate only if the attacker would've touched the target. This does not handle Sucker Punch, because that's not working correctly with Protect currently and will need to be addressed separately. --- include/battle.h | 1 + src/battle_script_commands.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/battle.h b/include/battle.h index b51a3d71b..524f8cd96 100644 --- a/include/battle.h +++ b/include/battle.h @@ -100,6 +100,7 @@ struct DisableStruct u8 truantCounter:1; u8 truantSwitchInHack:1; u8 mimickedMoves:4; + u8 touchedProtectLike: 1; u8 rechargeTimer; u8 autotomizeCount; u8 slowStartTimer; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 21bc7945b..4ba55668e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1454,6 +1454,8 @@ static void Cmd_attackcanceler(void) && (gCurrentMove != MOVE_CURSE || IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_GHOST)) && ((!IsTwoTurnsMove(gCurrentMove) || (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)))) { + if (gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT) + gDisableStructs[gBattlerAttacker].touchedProtectLike = 1; CancelMultiTurnMoves(gBattlerAttacker); gMoveResultFlags |= MOVE_RESULT_MISSED; gLastLandedMoves[gBattlerTarget] = 0; @@ -4776,10 +4778,11 @@ static void Cmd_moveend(void) switch (gBattleScripting.moveendState) { case MOVEEND_PROTECT_LIKE_EFFECT: - if (gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT) + if (gDisableStructs[gBattlerAttacker].touchedProtectLike) { if (gProtectStructs[gBattlerTarget].spikyShielded && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) { + gDisableStructs[gBattlerAttacker].touchedProtectLike = 0; gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 8; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; @@ -4790,6 +4793,7 @@ static void Cmd_moveend(void) } else if (gProtectStructs[gBattlerTarget].kingsShielded) { + gDisableStructs[gBattlerAttacker].touchedProtectLike = 0; i = gBattlerAttacker; gBattlerAttacker = gBattlerTarget; gBattlerTarget = i; // gBattlerTarget and gBattlerAttacker are swapped in order to activate Defiant, if applicable @@ -4800,6 +4804,7 @@ static void Cmd_moveend(void) } else if (gProtectStructs[gBattlerTarget].banefulBunkered) { + gDisableStructs[gBattlerAttacker].touchedProtectLike = 0; gBattleScripting.moveEffect = MOVE_EFFECT_POISON | MOVE_EFFECT_AFFECTS_USER; PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_BANEFUL_BUNKER); BattleScriptPushCursor(); From eb0f0b7ce8d4c0db372fa7acf71610b1b0690fda Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Wed, 1 Sep 2021 21:32:07 +1200 Subject: [PATCH 05/20] Fix Sucker Punch vs Protect moves Might as well do this here too. Sucker Punch should fail against Protect, not trigger Protect's effects. --- src/battle_script_commands.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 4ba55668e..ae5e30cb0 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1452,7 +1452,8 @@ static void Cmd_attackcanceler(void) } else if (IsBattlerProtected(gBattlerTarget, gCurrentMove) && (gCurrentMove != MOVE_CURSE || IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_GHOST)) - && ((!IsTwoTurnsMove(gCurrentMove) || (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)))) + && ((!IsTwoTurnsMove(gCurrentMove) || (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS))) + && gBattleMoves[gCurrentMove].effect != EFFECT_SUCKER_PUNCH) { if (gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT) gDisableStructs[gBattlerAttacker].touchedProtectLike = 1; From 3371773e5cca3614f4993dca1aa3b03c7f9ac6ca Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Wed, 1 Sep 2021 21:34:47 +1200 Subject: [PATCH 06/20] Move touchedProtectLike to protect structs This makes more sense than putting it in DisableStruct. --- include/battle.h | 2 +- src/battle_script_commands.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/battle.h b/include/battle.h index 524f8cd96..f158fe7e2 100644 --- a/include/battle.h +++ b/include/battle.h @@ -100,7 +100,6 @@ struct DisableStruct u8 truantCounter:1; u8 truantSwitchInHack:1; u8 mimickedMoves:4; - u8 touchedProtectLike: 1; u8 rechargeTimer; u8 autotomizeCount; u8 slowStartTimer; @@ -145,6 +144,7 @@ struct ProtectStruct u32 usedThroatChopPreventedMove:1; u32 micle:1; u32 custap:1; // also quick claw + u32 touchedProtectLike:1; u32 physicalDmg; u32 specialDmg; u8 physicalBattlerId; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index ae5e30cb0..106e1a632 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1456,7 +1456,7 @@ static void Cmd_attackcanceler(void) && gBattleMoves[gCurrentMove].effect != EFFECT_SUCKER_PUNCH) { if (gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT) - gDisableStructs[gBattlerAttacker].touchedProtectLike = 1; + gProtectStructs[gBattlerAttacker].touchedProtectLike = 1; CancelMultiTurnMoves(gBattlerAttacker); gMoveResultFlags |= MOVE_RESULT_MISSED; gLastLandedMoves[gBattlerTarget] = 0; @@ -4779,11 +4779,11 @@ static void Cmd_moveend(void) switch (gBattleScripting.moveendState) { case MOVEEND_PROTECT_LIKE_EFFECT: - if (gDisableStructs[gBattlerAttacker].touchedProtectLike) + if (gProtectStructs[gBattlerAttacker].touchedProtectLike) { if (gProtectStructs[gBattlerTarget].spikyShielded && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) { - gDisableStructs[gBattlerAttacker].touchedProtectLike = 0; + gProtectStructs[gBattlerAttacker].touchedProtectLike = 0; gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 8; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; @@ -4794,7 +4794,7 @@ static void Cmd_moveend(void) } else if (gProtectStructs[gBattlerTarget].kingsShielded) { - gDisableStructs[gBattlerAttacker].touchedProtectLike = 0; + gProtectStructs[gBattlerAttacker].touchedProtectLike = 0; i = gBattlerAttacker; gBattlerAttacker = gBattlerTarget; gBattlerTarget = i; // gBattlerTarget and gBattlerAttacker are swapped in order to activate Defiant, if applicable @@ -4805,7 +4805,7 @@ static void Cmd_moveend(void) } else if (gProtectStructs[gBattlerTarget].banefulBunkered) { - gDisableStructs[gBattlerAttacker].touchedProtectLike = 0; + gProtectStructs[gBattlerAttacker].touchedProtectLike = 0; gBattleScripting.moveEffect = MOVE_EFFECT_POISON | MOVE_EFFECT_AFFECTS_USER; PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_BANEFUL_BUNKER); BattleScriptPushCursor(); From 7d251c39f752f19490be57d408396fdfb6d5333b Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Thu, 2 Sep 2021 16:05:36 +1200 Subject: [PATCH 07/20] Correct Liquidation and Sparkling Aria Liquidation is affected by Sheer Force, Sparkling Aria should hit both foes and ally. --- src/data/battle_moves.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 9fc79581f..1edfcb861 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -9768,7 +9768,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .accuracy = 100, .pp = 10, .secondaryEffectChance = 0, - .target = MOVE_TARGET_SELECTED, + .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SOUND | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, @@ -10289,7 +10289,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, }, From 13636f86917315b48bc0eac3685185887e02c64e Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Thu, 2 Sep 2021 16:15:58 +1200 Subject: [PATCH 08/20] Fix stacking effect on HOLD_EFFECT_DOUBLE_PRIZE moneyMultiplier should only ever be 1, 2 or 4. This adds some flags to moneyMultiplier that prevent HOLD_EFFECT_DOUBLE_PRIZE and Happy Hour from infinitely increasing it. --- include/battle.h | 4 +++- src/battle_script_commands.c | 3 ++- src/battle_util.c | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/battle.h b/include/battle.h index b51a3d71b..d788e23b1 100644 --- a/include/battle.h +++ b/include/battle.h @@ -485,7 +485,9 @@ struct BattleStruct u16 assistPossibleMoves[PARTY_SIZE * MAX_MON_MOVES]; // Each of mons can know max 4 moves. u8 focusPunchBattlerId; u8 battlerPreventingSwitchout; - u8 moneyMultiplier; + u8 moneyMultiplier:6; + u8 moneyMultiplierItem:1; + u8 moneyMultiplierMove:1; u8 savedTurnActionNumber; u8 switchInAbilitiesCounter; u8 faintedActionsState; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 5d2249e03..8db6490e8 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2851,9 +2851,10 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect]; break; case MOVE_EFFECT_HAPPY_HOUR: - if (GET_BATTLER_SIDE(gBattlerAttacker) == B_SIDE_PLAYER) + if (GET_BATTLER_SIDE(gBattlerAttacker) == B_SIDE_PLAYER && !gBattleStruct->moneyMultiplierMove) { gBattleStruct->moneyMultiplier *= 2; + gBattleStruct->moneyMultiplierMove = 1; } gBattlescriptCurrInstr++; break; diff --git a/src/battle_util.c b/src/battle_util.c index c6f64d60a..000b2c500 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5626,8 +5626,9 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) switch (battlerHoldEffect) { case HOLD_EFFECT_DOUBLE_PRIZE: - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + if (GetBattlerSide(battlerId) == B_SIDE_PLAYER && !gBattleStruct->moneyMultiplierItem) gBattleStruct->moneyMultiplier *= 2; + gBattleStruct->moneyMultiplierItem = 1; break; case HOLD_EFFECT_RESTORE_STATS: for (i = 0; i < NUM_BATTLE_STATS; i++) From bdbb4b5f7e79ddaf454af56c67dd8717be9115b9 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Mon, 6 Sep 2021 18:27:42 +1200 Subject: [PATCH 09/20] Fix many Disguise bugs Use an unused hitmarker flag to indicate that an HP change shouldn't break Disguise. --- data/battle_scripts_1.s | 10 +++++----- include/constants/battle.h | 3 ++- src/battle_script_commands.c | 3 ++- src/battle_util.c | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index eef725903..b43afb5c6 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2202,7 +2202,7 @@ BattleScript_EffectAbsorb:: waitmessage B_WAIT_TIME_LONG setdrainedhp manipulatedamage DMG_BIG_ROOT - orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE + orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_DISGUISE jumpifability BS_TARGET, ABILITY_LIQUID_OOZE, BattleScript_AbsorbLiquidOoze setbyte cMULTISTRING_CHOOSER, B_MSG_ABSORB goto BattleScript_AbsorbUpdateHp @@ -2804,7 +2804,7 @@ BattleScript_MoveMissedDoDamage:: .else bichalfword gMoveResultFlags, MOVE_RESULT_MISSED .endif - orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE + orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_DISGUISE healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER tryfaintmon BS_ATTACKER, FALSE, NULL @@ -6570,7 +6570,7 @@ BattleScript_MoveEffectRecoil:: jumpifmove MOVE_STRUGGLE, BattleScript_DoRecoil jumpifability BS_ATTACKER, ABILITY_ROCK_HEAD, BattleScript_RecoilEnd BattleScript_DoRecoil:: - orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 + orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 | HITMARKER_IGNORE_DISGUISE healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER printstring STRINGID_PKMNHITWITHRECOIL @@ -7594,7 +7594,7 @@ BattleScript_AirBaloonMsgPop:: return BattleScript_ItemHurtRet:: - orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 + orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 | HITMARKER_IGNORE_DISGUISE healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER printstring STRINGID_HURTBYITEM @@ -7612,7 +7612,7 @@ BattleScript_ItemHealHP_Ret:: playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL printstring STRINGID_PKMNSITEMRESTOREDHPALITTLE waitmessage B_WAIT_TIME_LONG - orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE + orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_DISGUISE healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER return diff --git a/include/constants/battle.h b/include/constants/battle.h index b158076bd..73d5c3deb 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -185,7 +185,8 @@ #define HITMARKER_IGNORE_SAFEGUARD (1 << 13) #define HITMARKER_SYNCHRONISE_EFFECT (1 << 14) #define HITMARKER_RUN (1 << 15) -// 3 free spots because of change in handling of UNDERGROUND/UNDERGWATER/ON AIR +#define HITMARKER_IGNORE_DISGUISE (1 << 16) +// 3 free spots because of change in handling of UNDERGROUND/UNDERWATER/ON AIR #define HITMARKER_UNABLE_TO_USE_MOVE (1 << 19) #define HITMARKER_x100000 (1 << 20) #define HITMARKER_x200000 (1 << 21) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 5d2249e03..26cd1e0e2 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -11869,7 +11869,8 @@ bool32 DoesDisguiseBlockMove(u8 battlerAtk, u8 battlerDef, u32 move) if (GetBattlerAbility(battlerDef) != ABILITY_DISGUISE || gBattleMons[battlerDef].species != SPECIES_MIMIKYU || gBattleMons[battlerDef].status2 & STATUS2_TRANSFORMED - || gBattleMoves[move].power == 0) + || gBattleMoves[move].power == 0 + || gHitMarker & HITMARKER_IGNORE_DISGUISE) return FALSE; else return TRUE; diff --git a/src/battle_util.c b/src/battle_util.c index c6f64d60a..5bd3ba2d2 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -859,7 +859,7 @@ void HandleAction_ActionFinished(void) gHitMarker &= ~(HITMARKER_DESTINYBOND | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_ATTACKSTRING_PRINTED | HITMARKER_NO_PPDEDUCT | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_x100000 | HITMARKER_OBEYS | HITMARKER_x10 | HITMARKER_SYNCHRONISE_EFFECT - | HITMARKER_CHARGING | HITMARKER_x4000000); + | HITMARKER_CHARGING | HITMARKER_x4000000 | HITMARKER_IGNORE_DISGUISE); gCurrentMove = 0; gBattleMoveDamage = 0; From 4c8a12006c51bfad260e87144d3399d488dc8c2c Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Mon, 6 Sep 2021 19:45:30 +1200 Subject: [PATCH 10/20] Fix Hammer Arm's effect chance --- src/data/battle_moves.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 9fc79581f..c223d123c 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -5711,7 +5711,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .type = TYPE_FIGHTING, .accuracy = 90, .pp = 10, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST, From 734e0aa74deae06621e70ba4100b074ae5a7fb46 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Mon, 6 Sep 2021 20:56:02 +1200 Subject: [PATCH 11/20] Add brackets Oops! --- src/battle_util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/battle_util.c b/src/battle_util.c index 000b2c500..4b6904bd9 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5627,8 +5627,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) { case HOLD_EFFECT_DOUBLE_PRIZE: if (GetBattlerSide(battlerId) == B_SIDE_PLAYER && !gBattleStruct->moneyMultiplierItem) + { gBattleStruct->moneyMultiplier *= 2; gBattleStruct->moneyMultiplierItem = 1; + } break; case HOLD_EFFECT_RESTORE_STATS: for (i = 0; i < NUM_BATTLE_STATS; i++) From 949c4ef63b0bc8a3aa84d697607b6a2201fcd521 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Mon, 6 Sep 2021 09:24:15 -0400 Subject: [PATCH 12/20] add ability popup --- data/battle_scripts_1.s | 1 + 1 file changed, 1 insertion(+) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 528674f39..f1ffbfeb5 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -4346,6 +4346,7 @@ BattleScript_EffectWillOWisp:: goto BattleScript_MoveEnd BattleScript_WaterVeilPrevents:: + call BattleScript_AbilityPopUp copybyte gEffectBattler, gBattlerTarget setbyte cMULTISTRING_CHOOSER, B_MSG_ABILITY_PREVENTS_MOVE_STATUS call BattleScript_BRNPrevention From a4b630e6b58a49b20252cc03f64f6ff04f719bac Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Tue, 7 Sep 2021 16:34:32 +1200 Subject: [PATCH 13/20] Fix MOVE_EFFECT_REMOVE_STATUS Wake-Up Slap and Sparkling Aria now print the correct message when the target is cured. Also, fix Ice Hammer's effect chance. --- data/battle_scripts_1.s | 12 ++++++++++++ include/battle_scripts.h | 2 ++ include/constants/battle_string_ids.h | 3 ++- src/battle_message.c | 2 ++ src/battle_script_commands.c | 13 ++++++++++++- src/data/battle_moves.h | 4 ++-- 6 files changed, 32 insertions(+), 4 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 13815027a..fc5954d25 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6467,6 +6467,18 @@ BattleScript_TargetPRLZHeal:: updatestatusicon BS_TARGET return +BattleScript_TargetWokeUp:: + printstring STRINGID_TARGETWOKEUP + waitmessage B_WAIT_TIME_LONG + updatestatusicon BS_TARGET + return + +BattleScript_TargetBurnHeal:: + printstring STRINGID_PKMNBURNHEALED + waitmessage B_WAIT_TIME_LONG + updatestatusicon BS_TARGET + return + BattleScript_MoveEffectSleep:: statusanimation BS_EFFECT_BATTLER printfromtable gFellAsleepStringIds diff --git a/include/battle_scripts.h b/include/battle_scripts.h index b0e5c7e91..232a40aa5 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -124,6 +124,8 @@ extern const u8 BattleScript_MoveUsedIsInLoveCantAttack[]; extern const u8 BattleScript_NightmareTurnDmg[]; extern const u8 BattleScript_CurseTurnDmg[]; extern const u8 BattleScript_TargetPRLZHeal[]; +extern const u8 BattleScript_TargetWokeUp[]; +extern const u8 BattleScript_TargetBurnHeal[]; extern const u8 BattleScript_MoveEffectSleep[]; extern const u8 BattleScript_YawnMakesAsleep[]; extern const u8 BattleScript_MoveEffectPoison[]; diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 5e66b107f..0558e4feb 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -572,8 +572,9 @@ #define STRINGID_PKMNGOTOVERITSINFATUATION 568 #define STRINGID_ITEMCANNOTBEREMOVED 569 #define STRINGID_STICKYBARBTRANSFER 570 +#define STRINGID_PKMNBURNHEALED 571 -#define BATTLESTRINGS_COUNT 571 +#define BATTLESTRINGS_COUNT 572 // 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 d5c3b2967..4640094e1 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -698,9 +698,11 @@ static const u8 sText_PkmnShookOffTheTaunt[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX static const u8 sText_PkmnGotOverItsInfatuation[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} got over\nits infatuation!"); static const u8 sText_ItemCannotBeRemoved[] = _("{B_ATK_NAME_WITH_PREFIX}'s item cannot be removed!"); static const u8 sText_StickyBarbTransfer[] = _("The {B_LAST_ITEM} attached itself to\n{B_ATK_NAME_WITH_PREFIX}!"); +static const u8 sText_PkmnBurnHealed[] = _("{B_DEF_NAME_WITH_PREFIX}'s burn was healed."); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_PKMNBURNHEALED - 12] = sText_PkmnBurnHealed, [STRINGID_STICKYBARBTRANSFER - 12] = sText_StickyBarbTransfer, [STRINGID_ITEMCANNOTBEREMOVED - 12] = sText_ItemCannotBeRemoved, [STRINGID_PKMNGOTOVERITSINFATUATION - 12] = sText_PkmnGotOverItsInfatuation, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index db576cd95..0738c7294 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3110,7 +3110,18 @@ void SetMoveEffect(bool32 primary, u32 certain) MarkBattlerForControllerExec(gActiveBattler); BattleScriptPush(gBattlescriptCurrInstr + 1); - gBattlescriptCurrInstr = BattleScript_TargetPRLZHeal; + switch (gBattleMoves[gCurrentMove].argument) + { + case STATUS1_PARALYSIS: + gBattlescriptCurrInstr = BattleScript_TargetPRLZHeal; + break; + case STATUS1_SLEEP: + gBattlescriptCurrInstr = BattleScript_TargetWokeUp; + break; + case STATUS1_BURN: + gBattlescriptCurrInstr = BattleScript_TargetBurnHeal; + break; + } } break; case MOVE_EFFECT_ATK_DEF_DOWN: // SuperPower diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index d474c981c..657341b5e 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -9767,7 +9767,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .type = TYPE_WATER, .accuracy = 100, .pp = 10, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SOUND | FLAG_SHEER_FORCE_BOOST, @@ -9782,7 +9782,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .type = TYPE_ICE, .accuracy = 90, .pp = 10, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST, From bd92552fb68f382dbab1a4730ad49b74015ac452 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Tue, 7 Sep 2021 16:39:42 +1200 Subject: [PATCH 14/20] Add new line to burn was healed string --- src/battle_message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_message.c b/src/battle_message.c index 4640094e1..19468f168 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -698,7 +698,7 @@ static const u8 sText_PkmnShookOffTheTaunt[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX static const u8 sText_PkmnGotOverItsInfatuation[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} got over\nits infatuation!"); static const u8 sText_ItemCannotBeRemoved[] = _("{B_ATK_NAME_WITH_PREFIX}'s item cannot be removed!"); static const u8 sText_StickyBarbTransfer[] = _("The {B_LAST_ITEM} attached itself to\n{B_ATK_NAME_WITH_PREFIX}!"); -static const u8 sText_PkmnBurnHealed[] = _("{B_DEF_NAME_WITH_PREFIX}'s burn was healed."); +static const u8 sText_PkmnBurnHealed[] = _("{B_DEF_NAME_WITH_PREFIX}'s\nburn was healed."); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { From 6a8f55dabf86584444d081da3842af7c70ea97ac Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 8 Sep 2021 12:38:46 +0200 Subject: [PATCH 15/20] fix galvanice explosion --- data/battle_scripts_1.s | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index fc5954d25..b7d87cc14 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6983,6 +6983,7 @@ BattleScript_MoveStatDrain:: waitanimation printstring STRINGID_TARGETABILITYSTATRAISE waitmessage B_WAIT_TIME_LONG + tryfaintmon BS_ATTACKER, FALSE, NULL goto BattleScript_MoveEnd BattleScript_MonMadeMoveUseless_PPLoss:: @@ -6993,6 +6994,7 @@ BattleScript_MonMadeMoveUseless:: call BattleScript_AbilityPopUp printstring STRINGID_PKMNSXMADEYUSELESS waitmessage B_WAIT_TIME_LONG + tryfaintmon BS_ATTACKER, FALSE, NULL orhalfword gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE goto BattleScript_MoveEnd @@ -7004,6 +7006,7 @@ BattleScript_FlashFireBoost:: call BattleScript_AbilityPopUp printfromtable gFlashFireStringIds waitmessage B_WAIT_TIME_LONG + tryfaintmon BS_ATTACKER, FALSE, NULL goto BattleScript_MoveEnd BattleScript_AbilityPreventsPhasingOut:: From 5c9c425590152e345becca48fa369fba3ba67b6d Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 9 Sep 2021 10:03:24 -0400 Subject: [PATCH 16/20] fix power herb actiation message --- src/battle_script_commands.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index a44e473ae..e45926f6f 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7288,9 +7288,14 @@ static void Cmd_various(void) return; case VARIOUS_JUMP_IF_NO_HOLD_EFFECT: if (GetBattlerHoldEffect(gActiveBattler, TRUE) != gBattlescriptCurrInstr[3]) + { gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 4); + } else + { + gLastUsedItem = gBattleMons[gActiveBattler].item; // For B_LAST_USED_ITEM gBattlescriptCurrInstr += 8; + } return; case VARIOUS_JUMP_IF_NO_ALLY: if (!IsBattlerAlive(BATTLE_PARTNER(gActiveBattler))) From 875bc52d48dcdca1a9974721d0d30eb2be509f0a Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 9 Sep 2021 10:15:18 -0400 Subject: [PATCH 17/20] fix resist berry item print msg --- src/battle_script_commands.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index e45926f6f..a75501862 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2356,6 +2356,7 @@ static void Cmd_resultmessage(void) if (gSpecialStatuses[gBattlerTarget].berryReduced && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) { + gLastUsedItem = gBattleMons[gBattlerTarget].item; gSpecialStatuses[gBattlerTarget].berryReduced = 0; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_PrintBerryReduceString; From 6915b029bdb9e27572118553ebc227993096c240 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 9 Sep 2021 11:15:58 -0400 Subject: [PATCH 18/20] fix echoed voice power boost --- include/battle.h | 1 - src/battle_script_commands.c | 2 +- src/battle_util.c | 7 ++++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/battle.h b/include/battle.h index 9f34243d3..3fbefe55b 100644 --- a/include/battle.h +++ b/include/battle.h @@ -217,7 +217,6 @@ struct FieldTimer u8 mistyTerrainTimer; u8 electricTerrainTimer; u8 psychicTerrainTimer; - u8 echoVoiceCounter; u8 gravityTimer; u8 fairyLockTimer; }; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index a75501862..05702aec6 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1743,7 +1743,7 @@ static void Cmd_ppreduce(void) if (!(gHitMarker & (HITMARKER_NO_PPDEDUCT | HITMARKER_NO_ATTACKSTRING)) && gBattleMons[gBattlerAttacker].pp[gCurrMovePos]) { gProtectStructs[gBattlerAttacker].notFirstStrike = 1; - // For item Metronome + // For item Metronome, echoed voice if (gCurrentMove == gLastResultingMoves[gBattlerAttacker] && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && !WasUnableToUseMove(gBattlerAttacker)) diff --git a/src/battle_util.c b/src/battle_util.c index d5f5939cb..d7fdc9fd6 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7192,12 +7192,13 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) basePower = 150; break; case EFFECT_ECHOED_VOICE: - if (gFieldTimers.echoVoiceCounter != 0) + // gBattleStruct->sameMoveTurns incremented in ppreduce + if (gBattleStruct->sameMoveTurns[battlerAtk] != 0) { - if (gFieldTimers.echoVoiceCounter >= 5) + if (gBattleStruct->sameMoveTurns[battlerAtk] >= 5) basePower *= 5; else - basePower *= gFieldTimers.echoVoiceCounter; + basePower *= gBattleStruct->sameMoveTurns[battlerAtk]; } break; case EFFECT_PAYBACK: From 92429c76498c3b33c40420705b2026766e89f6dc Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 9 Sep 2021 13:38:46 -0400 Subject: [PATCH 19/20] better echoed voice power boost --- src/battle_util.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index d7fdc9fd6..9fb2758b7 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7195,10 +7195,9 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) // gBattleStruct->sameMoveTurns incremented in ppreduce if (gBattleStruct->sameMoveTurns[battlerAtk] != 0) { - if (gBattleStruct->sameMoveTurns[battlerAtk] >= 5) - basePower *= 5; - else - basePower *= gBattleStruct->sameMoveTurns[battlerAtk]; + basePower += (40 * gBattleStruct->sameMoveTurns[battlerAtk]); + if (basePower > 200) + basePower = 200; } break; case EFFECT_PAYBACK: From f9cc09dc4842864ca9dbea04971d8b8ffb80a14b Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 9 Sep 2021 13:54:16 -0400 Subject: [PATCH 20/20] tweak formula --- 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 9fb2758b7..2215fea48 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7195,7 +7195,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) // gBattleStruct->sameMoveTurns incremented in ppreduce if (gBattleStruct->sameMoveTurns[battlerAtk] != 0) { - basePower += (40 * gBattleStruct->sameMoveTurns[battlerAtk]); + basePower += (basePower * gBattleStruct->sameMoveTurns[battlerAtk]); if (basePower > 200) basePower = 200; }