From 34382fcece5714f04bdb68489c0f76d25c89f1ab Mon Sep 17 00:00:00 2001 From: AgustinGDLV Date: Tue, 23 May 2023 14:19:24 -0700 Subject: [PATCH 1/3] fixed revive in 1v2 battles --- data/battle_scripts_2.s | 4 ++-- data/scripts/debug.inc | 6 ++++++ src/battle_script_commands.c | 13 +++++++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/data/battle_scripts_2.s b/data/battle_scripts_2.s index 8d08135275..0c6c133b50 100644 --- a/data/battle_scripts_2.s +++ b/data/battle_scripts_2.s @@ -59,9 +59,9 @@ BattleScript_ItemRestoreHP:: end BattleScript_ItemRestoreHP_SendOutRevivedBattler: - switchinanim BS_ATTACKER, FALSE + switchinanim BS_SCRIPTING, FALSE waitstate - switchineffects BS_ATTACKER + switchineffects BS_SCRIPTING end BattleScript_ItemCureStatus:: diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc index f86de38f5b..f9ac3ac238 100644 --- a/data/scripts/debug.inc +++ b/data/scripts/debug.inc @@ -68,6 +68,12 @@ Debug_FlagsNotSetBattleConfigMessage_Text: .string "'include/config/battle.h'!$" Debug_Script_1:: + givemon SPECIES_TREECKO, 20, ITEM_NONE + givemon SPECIES_TORCHIC, 20, ITEM_NONE + giveitem ITEM_REVIVE, 3 + giveitem ITEM_HYPER_POTION, 3 + setwildbattle SPECIES_UNOWN, 20, 0, SPECIES_UNOWN, 20, 0 + dowildbattle end Debug_Script_2:: diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 2450e5079a..9cf0eb11d5 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -16444,7 +16444,8 @@ u8 GetFirstFaintedPartyIndex(u8 battlerId) return PARTY_SIZE; } -void BS_ItemRestoreHP(void) { +void BS_ItemRestoreHP(void) +{ NATIVE_ARGS(); u16 healAmount; u32 battlerId = MAX_BATTLERS_COUNT; @@ -16499,6 +16500,7 @@ void BS_ItemRestoreHP(void) { if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && battlerId != MAX_BATTLERS_COUNT) { gAbsentBattlerFlags &= ~gBitTable[battlerId]; + gBattleScripting.battler = battlerId; gBattleCommunication[MULTIUSE_STATE] = TRUE; } } @@ -16506,7 +16508,8 @@ void BS_ItemRestoreHP(void) { gBattlescriptCurrInstr = cmd->nextInstr; } -void BS_ItemCureStatus(void) { +void BS_ItemCureStatus(void) +{ NATIVE_ARGS(); struct Pokemon *party = GetBattlerParty(gBattlerAttacker); @@ -16534,7 +16537,8 @@ void BS_ItemCureStatus(void) { gBattlescriptCurrInstr = cmd->nextInstr; } -void BS_ItemIncreaseStat(void) { +void BS_ItemIncreaseStat(void) +{ NATIVE_ARGS(); u16 statId = GetItemEffect(gLastUsedItem)[1]; u16 stages = ItemId_GetHoldEffectParam(gLastUsedItem); @@ -16542,7 +16546,8 @@ void BS_ItemIncreaseStat(void) { gBattlescriptCurrInstr = cmd->nextInstr; } -void BS_ItemRestorePP(void) { +void BS_ItemRestorePP(void) +{ NATIVE_ARGS(); const u8 *effect = GetItemEffect(gLastUsedItem); u32 i, pp, maxPP, moveId, loopEnd; From a9a32651acf4d6531b5752b8a776d9affa001f59 Mon Sep 17 00:00:00 2001 From: AgustinGDLV Date: Tue, 23 May 2023 15:41:25 -0700 Subject: [PATCH 2/3] fixed player not being able to cancel partner action after item --- src/battle_controller_player.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index b9eb566c02..c88dbff78f 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -312,13 +312,10 @@ static void HandleInputChooseAction(void) && !(gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)]) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { + // Return item to bag if partner had selected one. if (gBattleResources->bufferA[gActiveBattler][1] == B_ACTION_USE_ITEM) { - // Add item to bag if it is a ball - if (itemId <= LAST_BALL) - AddBagItem(itemId, 1); - else - return; + AddBagItem(itemId, 1); } PlaySE(SE_SELECT); BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_CANCEL_PARTNER, 0); From bb10b0d1b053425d2fc53c29cb94179d1820ffbf Mon Sep 17 00:00:00 2001 From: AgustinGDLV Date: Tue, 23 May 2023 15:50:51 -0700 Subject: [PATCH 3/3] fixed GetBattlerSide, removed debug script --- data/scripts/debug.inc | 6 ------ src/battle_script_commands.c | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc index f9ac3ac238..f86de38f5b 100644 --- a/data/scripts/debug.inc +++ b/data/scripts/debug.inc @@ -68,12 +68,6 @@ Debug_FlagsNotSetBattleConfigMessage_Text: .string "'include/config/battle.h'!$" Debug_Script_1:: - givemon SPECIES_TREECKO, 20, ITEM_NONE - givemon SPECIES_TORCHIC, 20, ITEM_NONE - giveitem ITEM_REVIVE, 3 - giveitem ITEM_HYPER_POTION, 3 - setwildbattle SPECIES_UNOWN, 20, 0, SPECIES_UNOWN, 20, 0 - dowildbattle end Debug_Script_2:: diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 9cf0eb11d5..9970f1d130 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -16324,7 +16324,7 @@ void BS_CheckParentalBondCounter(void) void BS_GetBattlerSide(void) { NATIVE_ARGS(u8 battler); - gBattleCommunication[0] = GetBattlerSide(cmd->battler); + gBattleCommunication[0] = GetBattlerSide(GetBattlerForBattleScript(cmd->battler)); gBattlescriptCurrInstr = cmd->nextInstr; }