Fix status curing of full restore when used on party member (#4603)

* fix getboxmondata for evolutiontracker if compiled with agbcc

* fixed full restore curing status condition when used in battle on party member with missing hp
added more full restore tests

* formatting, removed unused
This commit is contained in:
cawtds 2024-05-20 00:25:03 +02:00 committed by GitHub
parent 57ec87387d
commit b73e33618d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 72 additions and 9 deletions

View file

@ -1387,9 +1387,10 @@
.4byte \jumpInstr
.endm
.macro itemrestorehp jumpInstr:req
.macro itemrestorehp jumpInstr:req, restoreBattlerInstr:req
callnative BS_ItemRestoreHP
.4byte \jumpInstr
.4byte \restoreBattlerInstr
.endm
.macro itemcurestatus jumpInstr:req

View file

@ -57,7 +57,11 @@ BattleScript_ItemRestoreHPRet:
BattleScript_ItemRestoreHP::
call BattleScript_UseItemMessage
itemrestorehp BattleScript_ItemRestoreHPEnd
itemrestorehp BattleScript_ItemRestoreHPEnd, BattleScript_ItemRestoreHP_Battler
call BattleScript_ItemRestoreHP_Party
goto BattleScript_ItemRestoreHPEnd
BattleScript_ItemRestoreHP_Battler::
call BattleScript_ItemRestoreHPRet
BattleScript_ItemRestoreHPEnd:
end
@ -67,7 +71,7 @@ BattleScript_ItemRestoreHP_Party::
bichalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT
printstring STRINGID_ITEMRESTOREDSPECIESHEALTH
waitmessage B_WAIT_TIME_LONG
end
return
BattleScript_ItemRestoreHP_SendOutRevivedBattler:
switchinanim BS_SCRIPTING, FALSE
@ -87,8 +91,13 @@ BattleScript_ItemCureStatusEnd:
BattleScript_ItemHealAndCureStatus::
call BattleScript_UseItemMessage
itemrestorehp BattleScript_ItemCureStatusAfterItemMsg
itemrestorehp BattleScript_ItemCureStatusAfterItemMsg, BattleScript_ItemHealAndCureStatus_Battler
call BattleScript_ItemRestoreHP_Party
goto BattleScript_ItemHealAndCureStatusEnd
BattleScript_ItemHealAndCureStatus_Battler::
call BattleScript_ItemRestoreHPRet
BattleScript_ItemHealAndCureStatusEnd::
goto BattleScript_ItemCureStatusAfterItemMsg
BattleScript_ItemIncreaseStat::

View file

@ -496,7 +496,6 @@ extern const u8 BattleScript_TheRainbowDisappeared[];
extern const u8 BattleScript_HurtByTheSeaOfFire[];
extern const u8 BattleScript_TheSeaOfFireDisappeared[];
extern const u8 BattleScript_TheSwampDisappeared[];
extern const u8 BattleScript_ItemRestoreHP_Party[];
extern const u8 BattleScript_EffectPsychicNoise[];
extern const u8 BattleScript_AromaVeilProtectsRet[];

View file

@ -16021,7 +16021,7 @@ void ApplyExperienceMultipliers(s32 *expAmount, u8 expGetterMonId, u8 faintedBat
void BS_ItemRestoreHP(void)
{
NATIVE_ARGS(const u8 *alreadyMaxHpInstr);
NATIVE_ARGS(const u8 *alreadyMaxHpInstr, const u8 *restoreBattlerInstr);
u16 healAmount;
u32 battler = MAX_BATTLERS_COUNT;
u32 healParam = ItemId_GetEffect(gLastUsedItem)[6];
@ -16074,7 +16074,7 @@ void BS_ItemRestoreHP(void)
if (battler != MAX_BATTLERS_COUNT && hp != 0)
{
gBattleMoveDamage = -healAmount;
gBattlescriptCurrInstr = cmd->nextInstr;
gBattlescriptCurrInstr = cmd->restoreBattlerInstr;
}
else
{
@ -16087,7 +16087,7 @@ void BS_ItemRestoreHP(void)
gAbsentBattlerFlags &= ~gBitTable[battler];
gBattleCommunication[MULTIUSE_STATE] = TRUE;
}
gBattlescriptCurrInstr = BattleScript_ItemRestoreHP_Party;
gBattlescriptCurrInstr = cmd->nextInstr;
}
}
}

View file

@ -20,7 +20,7 @@ SINGLE_BATTLE_TEST("Full Restore restores a battler's HP and cures any primary s
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(300); Status1(status); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN{ USE_ITEM(player, ITEM_FULL_RESTORE, partyIndex: 0); }
TURN { USE_ITEM(player, ITEM_FULL_RESTORE, partyIndex: 0); }
} SCENE {
MESSAGE("Wobbuffet had its HP restored!");
if (status != STATUS1_NONE) {
@ -32,6 +32,35 @@ SINGLE_BATTLE_TEST("Full Restore restores a battler's HP and cures any primary s
}
}
SINGLE_BATTLE_TEST("Full Restore restores a party members HP and cures any primary status")
{
u16 status;
PARAMETRIZE{ status = STATUS1_BURN; }
PARAMETRIZE{ status = STATUS1_FREEZE; }
PARAMETRIZE{ status = STATUS1_PARALYSIS; }
PARAMETRIZE{ status = STATUS1_POISON; }
PARAMETRIZE{ status = STATUS1_TOXIC_POISON; }
PARAMETRIZE{ status = STATUS1_SLEEP; }
PARAMETRIZE{ status = STATUS1_NONE; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(300); Status1(status); }
PLAYER(SPECIES_WYNAUT) { HP(1); MaxHP(300); Status1(status); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { USE_ITEM(player, ITEM_FULL_RESTORE, partyIndex: 1); }
TURN { SWITCH(player, 1); }
} SCENE {
MESSAGE("Wynaut had its HP restored!");
if (status != STATUS1_NONE) {
MESSAGE("Wynaut had its status healed!"); // The message is not printed if status wasn't healed.
}
} THEN {
EXPECT_EQ(player->hp, player->maxHP);
EXPECT_EQ(player->species, SPECIES_WYNAUT);
EXPECT_EQ(player->status1, STATUS1_NONE);
}
}
SINGLE_BATTLE_TEST("Full Restore heals a battler from any primary status")
{
u16 status;
@ -54,6 +83,31 @@ SINGLE_BATTLE_TEST("Full Restore heals a battler from any primary status")
}
}
SINGLE_BATTLE_TEST("Full Restore heals a party member from any primary status")
{
u16 status;
PARAMETRIZE{ status = STATUS1_BURN; }
PARAMETRIZE{ status = STATUS1_FREEZE; }
PARAMETRIZE{ status = STATUS1_PARALYSIS; }
PARAMETRIZE{ status = STATUS1_POISON; }
PARAMETRIZE{ status = STATUS1_TOXIC_POISON; }
PARAMETRIZE{ status = STATUS1_SLEEP; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WYNAUT) { Status1(status); }
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { USE_ITEM(player, ITEM_FULL_RESTORE, partyIndex: 1); }
TURN { SWITCH(player, 1); }
} SCENE {
NOT MESSAGE("Wynaut had its HP restored!"); // The message is not printed if mon has max HP.
MESSAGE("Wynaut had its status healed!");
} THEN {
EXPECT_EQ(player->species, SPECIES_WYNAUT);
EXPECT_EQ(player->status1, STATUS1_NONE);
}
}
SINGLE_BATTLE_TEST("Full Restore restores a battler's HP and cures confusion")
{
GIVEN {