From 34382fcece5714f04bdb68489c0f76d25c89f1ab Mon Sep 17 00:00:00 2001 From: AgustinGDLV Date: Tue, 23 May 2023 14:19:24 -0700 Subject: [PATCH] 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 8d0813527..0c6c133b5 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 f86de38f5..f9ac3ac23 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 2450e5079..9cf0eb11d 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;