From 59ea75f99fdd2f106a29c6a2f0fb41e231d26deb Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 8 Jun 2021 12:56:38 +0200 Subject: [PATCH 01/10] 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 9a36249a18..0dc770fe6d 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/10] 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 565c0f261c..e8e3999357 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 76ee8073f4..7712305ef2 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/10] 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 522ffb7014..528674f396 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 e44ad81cc9..5d958dec27 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 de7105a270..0da63b4ef1 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 7deebd25e3..315cfebaf8 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 949c4ef63b0bc8a3aa84d697607b6a2201fcd521 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Mon, 6 Sep 2021 09:24:15 -0400 Subject: [PATCH 04/10] 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 528674f396..f1ffbfeb5a 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 6a8f55dabf86584444d081da3842af7c70ea97ac Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 8 Sep 2021 12:38:46 +0200 Subject: [PATCH 05/10] 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 fc5954d25e..b7d87cc145 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 06/10] 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 a44e473aee..e45926f6fa 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 07/10] 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 e45926f6fa..a75501862d 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 08/10] 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 9f34243d3b..3fbefe55bd 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 a75501862d..05702aec6b 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 d5f5939cb3..d7fdc9fd63 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 09/10] 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 d7fdc9fd63..9fb2758b73 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 10/10] 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 9fb2758b73..2215fea481 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; }