Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battle Item Tests + critical fixes + new test macro #2940

Merged
merged 32 commits into from
May 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c81a985
Fix USE_ITEM explicit targets
mrgriffin Apr 20, 2023
e1e8277
batch 1
u8-Salem Apr 20, 2023
94cb569
local specialties tests
u8-Salem Apr 21, 2023
301a12f
fix battleUsage for heal powder
u8-Salem Apr 21, 2023
1cc28c8
X item tests
u8-Salem Apr 21, 2023
b4aee00
replace pokemon with battler in string
u8-Salem Apr 21, 2023
cbac6d0
Full Restore test
u8-Salem Apr 21, 2023
38476bd
fix Full Restore not healing confusion
u8-Salem Apr 21, 2023
4bad450
Full Restore confusion test
u8-Salem Apr 21, 2023
ff609f2
healing items tests
u8-Salem Apr 21, 2023
929e474
temporarily rename test string for easier test runs
u8-Salem Apr 22, 2023
42215c9
actually working restore hp tests
u8-Salem Apr 22, 2023
727f1ac
guard spec test
u8-Salem Apr 22, 2023
18ac811
Dire Hit test
u8-Salem Apr 22, 2023
1b6bb3e
make the test fail intentionally
u8-Salem Apr 22, 2023
0b66cf0
remove no longer needed variable
u8-Salem Apr 24, 2023
c4497bc
revive tests
u8-Salem Apr 24, 2023
e0cae31
Merge branch 'battleItemFixes' into battleItemTests
u8-Salem Apr 24, 2023
5030350
Merge branch 'upcoming' into battleItemFixes
u8-Salem Apr 24, 2023
632668e
Merge branch 'battleItemFixes' into battleItemTests
u8-Salem Apr 24, 2023
f74a1b0
fix strings after update
u8-Salem Apr 24, 2023
59666a1
heal powder test
u8-Salem Apr 24, 2023
60e048b
more robust status cure tests
u8-Salem Apr 25, 2023
7fad0a2
add MovesWithPP macro to allow for setting pps in tests
u8-Salem Apr 25, 2023
08ec873
update MoveWithPP macro to use struct
u8-Salem Apr 25, 2023
d3e9a68
restore pp item tests
u8-Salem Apr 25, 2023
9f2589e
better usage of THEN over FINALLY
u8-Salem Apr 25, 2023
a2809ac
fix gChosenMovePos not being assigned correctly for battle items
u8-Salem Apr 25, 2023
a5d3915
add Max Mushroom test
u8-Salem Apr 26, 2023
47cd903
update dire hit failing comment
u8-Salem Apr 30, 2023
772c504
remove identifier strings
u8-Salem Apr 30, 2023
15ce9eb
fix dire hit message mismatch
u8-Salem May 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion data/battle_scripts_2.s
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ BattleScript_ItemCureStatus::
BattleScript_ItemHealAndCureStatus::
call BattleScript_UseItemMessage
itemrestorehp
curestatus BS_ATTACKER
itemcurestatus
printstring STRINGID_ITEMRESTOREDSPECIESHEALTH
waitmessage B_WAIT_TIME_LONG
bichalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
healthbarupdate BS_ATTACKER
Expand Down
2 changes: 2 additions & 0 deletions include/recorded_battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ enum
RECORDED_PARTY_INDEX,
RECORDED_BATTLE_PALACE_ACTION,
RECORDED_ITEM_ID,
RECORDED_ITEM_TARGET,
RECORDED_ITEM_MOVE,
};

extern u32 gRecordedBattleRngSeed;
Expand Down
2 changes: 2 additions & 0 deletions src/battle_controller_recorded_opponent.c
Original file line number Diff line number Diff line change
Expand Up @@ -1441,6 +1441,8 @@ static void RecordedOpponentHandleChooseItem(void)
u8 byte1 = RecordedBattle_GetBattlerAction(RECORDED_ITEM_ID, gActiveBattler);
u8 byte2 = RecordedBattle_GetBattlerAction(RECORDED_ITEM_ID, gActiveBattler);
gBattleStruct->chosenItem[gActiveBattler] = (byte1 << 8) | byte2;
gBattleStruct->itemPartyIndex[gActiveBattler] = RecordedBattle_GetBattlerAction(RECORDED_ITEM_TARGET, gActiveBattler);
gChosenMovePos = RecordedBattle_GetBattlerAction(RECORDED_ITEM_MOVE, gActiveBattler);
BtlController_EmitOneReturnValue(BUFFER_B, gBattleStruct->chosenItem[gActiveBattler]);
RecordedOpponentBufferExecCompleted();
}
Expand Down
2 changes: 2 additions & 0 deletions src/battle_controller_recorded_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,8 @@ static void RecordedPlayerHandleChooseItem(void)
u8 byte1 = RecordedBattle_GetBattlerAction(RECORDED_ITEM_ID, gActiveBattler);
u8 byte2 = RecordedBattle_GetBattlerAction(RECORDED_ITEM_ID, gActiveBattler);
gBattleStruct->chosenItem[gActiveBattler] = (byte1 << 8) | byte2;
gBattleStruct->itemPartyIndex[gActiveBattler] = RecordedBattle_GetBattlerAction(RECORDED_ITEM_TARGET, gActiveBattler);
gChosenMovePos = RecordedBattle_GetBattlerAction(RECORDED_ITEM_MOVE, gActiveBattler);
BtlController_EmitOneReturnValue(BUFFER_B, gBattleStruct->chosenItem[gActiveBattler]);
RecordedPlayerBufferExecCompleted();
}
Expand Down
2 changes: 1 addition & 1 deletion src/battle_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ static const u8 sText_XFoundOneY[] = _("{B_ATK_NAME_WITH_PREFIX} found\none {B_L
static const u8 sText_SoothingAroma[] = _("A soothing aroma wafted\nthrough the area!");
static const u8 sText_ItemsCantBeUsedNow[] = _("Items can't be used now.{PAUSE 64}");
static const u8 sText_ForXCommaYZ[] = _("For {B_SCR_ACTIVE_NAME_WITH_PREFIX},\n{B_LAST_ITEM} {B_BUFF1}");
static const u8 sText_PkmnUsedXToGetPumped[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} used\n{B_LAST_ITEM} to get pumped!");
static const u8 sText_PkmnUsedXToGetPumped[] = _("{B_ACTIVE_NAME_WITH_PREFIX} used\n{B_LAST_ITEM} to get pumped!");
static const u8 sText_PkmnLostFocus[] = _("{B_ATK_NAME_WITH_PREFIX} lost its\nfocus and couldn't move!");
static const u8 sText_PkmnWasDraggedOut[] = _("{B_DEF_NAME_WITH_PREFIX} was\ndragged out!\p");
static const u8 sText_TheWallShattered[] = _("The wall shattered!");
Expand Down
10 changes: 7 additions & 3 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -16563,8 +16563,7 @@ void BS_ItemIncreaseStat(void) {
void BS_ItemRestorePP(void) {
NATIVE_ARGS();
const u8 *effect = GetItemEffect(gLastUsedItem);
u32 i, pp, maxPP, moveId;
u32 loopEnd = MAX_MON_MOVES;
u32 i, pp, maxPP, moveId, loopEnd;
u32 battlerId = MAX_BATTLERS_COUNT;
struct Pokemon *mon = (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER) ? &gPlayerParty[gBattleStruct->itemPartyIndex[gBattlerAttacker]] : &gEnemyParty[gBattleStruct->itemPartyIndex[gBattlerAttacker]];

Expand All @@ -16574,6 +16573,11 @@ void BS_ItemRestorePP(void) {
i = gChosenMovePos;
loopEnd = gChosenMovePos + 1;
}
else
{
i = 0;
loopEnd = MAX_MON_MOVES;
}

// Check if the recipient is an active battler.
if (gBattleStruct->itemPartyIndex[gBattlerAttacker] == gBattlerPartyIndexes[gBattlerAttacker])
Expand All @@ -16583,7 +16587,7 @@ void BS_ItemRestorePP(void) {
battlerId = BATTLE_PARTNER(gBattlerAttacker);

// Heal PP!
for (i = 0; i < loopEnd; i++)
for (; i < loopEnd; i++)
{
pp = GetMonData(mon, MON_DATA_PP1 + i, NULL);
moveId = GetMonData(mon, MON_DATA_MOVE1 + i, NULL);
Expand Down
2 changes: 1 addition & 1 deletion src/data/items.h
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ const struct Item gItems[] =
.pocket = POCKET_ITEMS,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_Medicine,
.battleUsage = EFFECT_ITEM_RESTORE_HP,
.battleUsage = EFFECT_ITEM_CURE_STATUS,
.flingPower = 30,
},

Expand Down
Loading