Fix Upper Hand failure still activating Protean (#8329)
This commit is contained in:
parent
8d3be426fd
commit
c2fba193a6
@ -123,11 +123,6 @@ BattleScript_EffectTidyUpDoMoveAnimation::
|
||||
restoretarget
|
||||
goto BattleScript_EffectDragonDanceFromStatUp
|
||||
|
||||
BattleScript_EffectUpperHand::
|
||||
attackcanceler
|
||||
tryupperhand BattleScript_ButItFailed
|
||||
goto BattleScript_HitFromAccCheck
|
||||
|
||||
BattleScript_EffectShedTail::
|
||||
attackcanceler
|
||||
waitstate
|
||||
|
||||
@ -831,7 +831,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[];
|
||||
extern const u8 BattleScript_EffectTidyUp[];
|
||||
extern const u8 BattleScript_EffectSpicyExtract[];
|
||||
extern const u8 BattleScript_EffectFickleBeam[];
|
||||
|
||||
@ -1268,9 +1268,7 @@ static void Cmd_attackcanceler(void)
|
||||
else if (IsBattlerProtected(gBattlerAttacker, gBattlerTarget, gCurrentMove)
|
||||
&& (moveEffect != EFFECT_CURSE || IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_GHOST))
|
||||
&& (!gBattleMoveEffects[moveEffect].twoTurnEffect || (gBattleMons[gBattlerAttacker].volatiles.multipleTurns))
|
||||
&& moveEffect != EFFECT_SUCKER_PUNCH
|
||||
&& moveEffect != EFFECT_COUNTER
|
||||
&& moveEffect != EFFECT_UPPER_HAND)
|
||||
&& moveEffect != EFFECT_COUNTER)
|
||||
{
|
||||
if (!CanBattlerAvoidContactEffects(gBattlerAttacker, gBattlerTarget, GetBattlerAbility(gBattlerAttacker), GetBattlerHoldEffect(gBattlerAttacker), gCurrentMove))
|
||||
gProtectStructs[gBattlerAttacker].touchedProtectLike = TRUE;
|
||||
@ -6070,9 +6068,7 @@ static void Cmd_moveend(void)
|
||||
}
|
||||
break;
|
||||
case PROTECT_OBSTRUCT:
|
||||
if (moveEffect != EFFECT_SUCKER_PUNCH // Why???
|
||||
&& moveEffect != EFFECT_UPPER_HAND // Why???
|
||||
&& !IsProtectivePadsProtected(gBattlerAttacker, GetBattlerHoldEffect(gBattlerAttacker)))
|
||||
if (!IsProtectivePadsProtected(gBattlerAttacker, GetBattlerHoldEffect(gBattlerAttacker)))
|
||||
{
|
||||
gProtectStructs[gBattlerAttacker].touchedProtectLike = FALSE;
|
||||
i = gBattlerAttacker;
|
||||
@ -15465,23 +15461,6 @@ void BS_TryDefog(void)
|
||||
}
|
||||
}
|
||||
|
||||
void BS_TryUpperHand(void)
|
||||
{
|
||||
NATIVE_ARGS(const u8 *failInstr);
|
||||
|
||||
enum Ability abilityDef = GetBattlerAbility(gBattlerTarget);
|
||||
u32 prio = GetChosenMovePriority(gBattlerTarget, abilityDef);
|
||||
|
||||
if (HasBattlerActedThisTurn(gBattlerTarget)
|
||||
|| gChosenMoveByBattler[gBattlerTarget] == MOVE_NONE
|
||||
|| IsBattleMoveStatus(gChosenMoveByBattler[gBattlerTarget])
|
||||
|| prio < 1
|
||||
|| prio > 3) // Fails if priority is less than 1 or greater than 3, if target already moved, or if using a status
|
||||
gBattlescriptCurrInstr = cmd->failInstr;
|
||||
else
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
}
|
||||
|
||||
void BS_TryTriggerStatusForm(void)
|
||||
{
|
||||
NATIVE_ARGS();
|
||||
|
||||
@ -2676,6 +2676,16 @@ static enum MoveCanceler CancelerMoveFailure(struct BattleContext *ctx)
|
||||
|| (IsBattleMoveStatus(GetChosenMoveFromPosition(ctx->battlerDef)) && !gProtectStructs[ctx->battlerDef].noValidMoves))
|
||||
battleScript = BattleScript_ButItFailed;
|
||||
break;
|
||||
case EFFECT_UPPER_HAND:
|
||||
{
|
||||
u32 prio = GetChosenMovePriority(ctx->battlerDef, ctx->abilities[ctx->battlerDef]);
|
||||
if (prio < 1 || prio > 3 // Fails if priority is less than 1 or greater than 3, if target already moved, or if using a status
|
||||
|| HasBattlerActedThisTurn(ctx->battlerDef)
|
||||
|| gChosenMoveByBattler[ctx->battlerDef] == MOVE_NONE
|
||||
|| IsBattleMoveStatus(gChosenMoveByBattler[ctx->battlerDef]))
|
||||
battleScript = BattleScript_ButItFailed;
|
||||
break;
|
||||
}
|
||||
case EFFECT_SNORE:
|
||||
if (!(gBattleMons[ctx->battlerAtk].status1 & STATUS1_SLEEP)
|
||||
&& ctx->abilities[ctx->battlerAtk] != ABILITY_COMATOSE)
|
||||
|
||||
@ -1395,7 +1395,7 @@ const struct BattleMoveEffect gBattleMoveEffects[NUM_BATTLE_MOVE_EFFECTS] =
|
||||
.battleScript = BattleScript_EffectHit,
|
||||
.battleTvScore = 0, // TODO: Assign points
|
||||
},
|
||||
|
||||
|
||||
[EFFECT_ENTRAINMENT] =
|
||||
{
|
||||
.battleScript = BattleScript_EffectEntrainment,
|
||||
@ -2121,7 +2121,7 @@ const struct BattleMoveEffect gBattleMoveEffects[NUM_BATTLE_MOVE_EFFECTS] =
|
||||
|
||||
[EFFECT_UPPER_HAND] =
|
||||
{
|
||||
.battleScript = BattleScript_EffectUpperHand,
|
||||
.battleScript = BattleScript_EffectHit,
|
||||
.battleTvScore = 0, // TODO: Assign points
|
||||
.encourageEncore = TRUE,
|
||||
},
|
||||
|
||||
@ -51,7 +51,10 @@ SINGLE_BATTLE_TEST("Burn Up fails if the user has Protean/Libero and is not a Fi
|
||||
TURN { MOVE(opponent, MOVE_BURN_UP); }
|
||||
} SCENE {
|
||||
MESSAGE("The opposing Kecleon used Burn Up!");
|
||||
NONE_OF { ANIMATION(ANIM_TYPE_MOVE, MOVE_BURN_UP, player); }
|
||||
NONE_OF {
|
||||
ABILITY_POPUP(opponent, ABILITY_PROTEAN);
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_BURN_UP, player);
|
||||
}
|
||||
MESSAGE("But it failed!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,3 +154,20 @@ DOUBLE_BATTLE_TEST("Upper Hand fails if the target has attempted to act even if
|
||||
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_UPPER_HAND, playerLeft);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Upper Hand failing will prevent Protean activation")
|
||||
{
|
||||
GIVEN {
|
||||
WITH_CONFIG(GEN_PROTEAN_LIBERO, GEN_6);
|
||||
PLAYER(SPECIES_REGIROCK);
|
||||
OPPONENT(SPECIES_KECLEON) { Ability(ABILITY_PROTEAN); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, MOVE_UPPER_HAND); }
|
||||
} SCENE {
|
||||
NONE_OF {
|
||||
ABILITY_POPUP(opponent, ABILITY_PROTEAN);
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_UPPER_HAND, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user