Requested changes

- Tabs / spaces where proper
- HitFromAtkString -> HitFromAccCheck
- Actually compiles now lol
- Moved assumes into relevant tests
- Cleaned up the check for TryUpperHand
This commit is contained in:
ZnogyroP 2024-01-28 12:50:03 -05:00
parent 537075f23a
commit 7987a72c4d
5 changed files with 30 additions and 28 deletions

View file

@ -1583,10 +1583,10 @@
callnative BS_SetPhotonGeyserCategory
.endm
.macro tryupperhand failInstr:req
callnative BS_TryUpperHand
.4byte \failInstr
.endm
.macro tryupperhand failInstr:req
callnative BS_TryUpperHand
.4byte \failInstr
.endm
@ various command changed to more readable macros
.macro cancelmultiturnmoves battler:req

View file

@ -20,11 +20,10 @@
.section script_data, "aw", %progbits
BattleScript_EffectUpperHand:
attackcanceler
tryupperhand BattleScript_FailedFromAtkString
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
goto BattleScript_HitFromAtkString
BattleScript_EffectUpperHand::
attackcanceler
tryupperhand BattleScript_FailedFromAtkString
goto BattleScript_HitFromAccCheck
BattleScript_EffectShedTail::
attackcanceler

View file

@ -822,5 +822,6 @@ extern const u8 BattleScript_EffectBrickBreak[];
extern const u8 BattleScript_EffectDoodle[];
extern const u8 BattleScript_EffectFilletAway[];
extern const u8 BattleScript_EffectShedTail[];
extern const u8 BattleScript_EffectUpperHand[];
#endif // GUARD_BATTLE_SCRIPTS_H

View file

@ -16527,18 +16527,14 @@ void BS_TryDefog(void)
void BS_TryUpperHand(void)
{
NATIVE_ARGS(const u8 *failInstr);
NATIVE_ARGS(const u8 *failInstr);
if (gProtectStructs[gBattlerTarget].obstructed) // Fails if target is obstructed
gBattlescriptCurrInstr = cmd->failInstr;
else if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget)) // Fails if user moves after target
gBattlescriptCurrInstr = cmd->failInstr;
else if (IS_MOVE_STATUS(gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]])) // Fails if target is using a status move
gBattlescriptCurrInstr = cmd->failInstr;
else if (GetChosenMovePriority(gBattlerTarget) <= 0) // Fails if priority is not greater than 0
gBattlescriptCurrInstr = cmd->failInstr;
else
gBattlescriptCurrInstr = cmd->nextInstr;
if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget) ||
IS_MOVE_STATUS(gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]]) ||
GetChosenMovePriority(gBattlerTarget) <= 0 || GetChosenMovePriority(gBattlerTarget) > 3) // Fails if priority is not greater than 0 or greater than 3, if target already moved, or if using a status move
gBattlescriptCurrInstr = cmd->failInstr;
else
gBattlescriptCurrInstr = cmd->nextInstr;
}
void BS_TryTriggerStatusForm(void)

View file

@ -6,18 +6,13 @@ ASSUMPTIONS
ASSUME(gBattleMoves[MOVE_UPPER_HAND].effect == EFFECT_UPPER_HAND);
ASSUME(gBattleMoves[MOVE_UPPER_HAND].priority == 3);
ASSUME(MoveHasMoveEffect(MOVE_UPPER_HAND, MOVE_EFFECT_FLINCH) == TRUE);
ASSUME(gBattleMoves[MOVE_UPPER_HAND].sheerForceBoost == TRUE);
ASSUME(gBattleMoves[MOVE_BABY_DOLL_EYES].category == BATTLE_CATEGORY_STATUS);
ASSUME(gBattleMoves[MOVE_BABY_DOLL_EYES].priority == 1);
ASSUME(gBattleMoves[MOVE_EXTREME_SPEED].category == BATTLE_CATEGORY_PHYSICAL);
ASSUME(gBattleMoves[MOVE_EXTREME_SPEED].priority == 2);
ASSUME(gBattleMoves[MOVE_DRAINING_KISS].category == BATTLE_CATEGORY_SPECIAL);
ASSUME(gBattleMoves[MOVE_DRAINING_KISS].priority == 0);
}
SINGLE_BATTLE_TEST("Upper Hand succeeds if the target is using a priority attacking move and causes it to flinch")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_EXTREME_SPEED].category == BATTLE_CATEGORY_PHYSICAL);
ASSUME(gBattleMoves[MOVE_EXTREME_SPEED].priority == 2);
PLAYER(SPECIES_MIENSHAO);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
@ -33,6 +28,8 @@ SINGLE_BATTLE_TEST("Upper Hand succeeds if the target is using a priority attack
SINGLE_BATTLE_TEST("Upper Hand fails if the target is using a status move")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_BABY_DOLL_EYES].category == BATTLE_CATEGORY_STATUS);
ASSUME(gBattleMoves[MOVE_BABY_DOLL_EYES].priority == 1);
PLAYER(SPECIES_MIENSHAO);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
@ -50,6 +47,8 @@ SINGLE_BATTLE_TEST("Upper Hand fails if the target is using a status move")
SINGLE_BATTLE_TEST("Upper Hand fails if the target is not using a priority move")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_DRAINING_KISS].category == BATTLE_CATEGORY_SPECIAL);
ASSUME(gBattleMoves[MOVE_DRAINING_KISS].priority == 0);
PLAYER(SPECIES_MIENSHAO);
OPPONENT(SPECIES_COMFEY) { Ability(ABILITY_FLOWER_VEIL); }
} WHEN {
@ -67,6 +66,8 @@ SINGLE_BATTLE_TEST("Upper Hand fails if the target is not using a priority move"
TO_DO_BATTLE_TEST("Upper Hand succeeds if the target's move is boosted in priority by an Ability")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_DRAINING_KISS].category == BATTLE_CATEGORY_SPECIAL);
ASSUME(gBattleMoves[MOVE_DRAINING_KISS].priority == 0);
PLAYER(SPECIES_MIENSHAO) { Speed(10); }
OPPONENT(SPECIES_COMFEY) { Speed(5); Ability(ABILITY_TRIAGE); }
} WHEN {
@ -82,6 +83,8 @@ TO_DO_BATTLE_TEST("Upper Hand succeeds if the target's move is boosted in priori
SINGLE_BATTLE_TEST("Upper Hand fails if the target moves first")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_DRAINING_KISS].category == BATTLE_CATEGORY_SPECIAL);
ASSUME(gBattleMoves[MOVE_DRAINING_KISS].priority == 0);
PLAYER(SPECIES_MIENSHAO) { Speed(5); }
OPPONENT(SPECIES_COMFEY) { Speed(10); Ability(ABILITY_TRIAGE); }
} WHEN {
@ -99,6 +102,9 @@ SINGLE_BATTLE_TEST("Upper Hand fails if the target moves first")
SINGLE_BATTLE_TEST("Upper Hand is boosted by Sheer Force")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_EXTREME_SPEED].category == BATTLE_CATEGORY_PHYSICAL);
ASSUME(gBattleMoves[MOVE_EXTREME_SPEED].priority == 2);
ASSUME(gBattleMoves[MOVE_UPPER_HAND].sheerForceBoost == TRUE);
PLAYER(SPECIES_HARIYAMA) { Ability(ABILITY_SHEER_FORCE); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {