Destiny Bond fails on repeated use in Gen 7+ (#5652)
This commit is contained in:
parent
7744298788
commit
da2a1e2aba
8 changed files with 91 additions and 9 deletions
|
@ -928,8 +928,9 @@
|
||||||
.4byte \failInstr
|
.4byte \failInstr
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.macro setdestinybond
|
.macro trysetdestinybond failInstr:req
|
||||||
.byte 0xaa
|
.byte 0xaa
|
||||||
|
.4byte \failInstr
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.macro trysetdestinybondtohappen
|
.macro trysetdestinybondtohappen
|
||||||
|
|
|
@ -4063,7 +4063,7 @@ BattleScript_EffectDestinyBond::
|
||||||
attackcanceler
|
attackcanceler
|
||||||
attackstring
|
attackstring
|
||||||
ppreduce
|
ppreduce
|
||||||
setdestinybond
|
trysetdestinybond BattleScript_ButItFailed
|
||||||
attackanimation
|
attackanimation
|
||||||
waitanimation
|
waitanimation
|
||||||
printstring STRINGID_PKMNTRYINGTOTAKEFOE
|
printstring STRINGID_PKMNTRYINGTOTAKEFOE
|
||||||
|
|
|
@ -331,5 +331,6 @@ void TryDeactivateSleepClause(u32 battlerSide, u32 indexInParty);
|
||||||
bool32 IsSleepClauseActiveForSide(u32 battlerSide);
|
bool32 IsSleepClauseActiveForSide(u32 battlerSide);
|
||||||
bool32 IsSleepClauseEnabled();
|
bool32 IsSleepClauseEnabled();
|
||||||
void ClearDamageCalcResults(void);
|
void ClearDamageCalcResults(void);
|
||||||
|
u32 DoesDestinyBondFail(u32 battler);
|
||||||
|
|
||||||
#endif // GUARD_BATTLE_UTIL_H
|
#endif // GUARD_BATTLE_UTIL_H
|
||||||
|
|
|
@ -125,6 +125,7 @@
|
||||||
#define B_POWDER_RAIN GEN_LATEST // In Gen7+, Powder doesn't damage the user of a Fire type move in heavy rain.
|
#define B_POWDER_RAIN GEN_LATEST // In Gen7+, Powder doesn't damage the user of a Fire type move in heavy rain.
|
||||||
#define B_AFTER_YOU_TURN_ORDER GEN_LATEST // In Gen8+, After You doesn't fail if the turn order wouldn't change after use.
|
#define B_AFTER_YOU_TURN_ORDER GEN_LATEST // In Gen8+, After You doesn't fail if the turn order wouldn't change after use.
|
||||||
#define B_QUASH_TURN_ORDER GEN_LATEST // In Gen8+, Quash-affected battlers move according to speed order. Before Gen8, Quash-affected battlers move in the order they were affected by Quash.
|
#define B_QUASH_TURN_ORDER GEN_LATEST // In Gen8+, Quash-affected battlers move according to speed order. Before Gen8, Quash-affected battlers move in the order they were affected by Quash.
|
||||||
|
#define B_DESTINY_BOND_FAIL GEN_LATEST // In Gen7+, Destiny Bond fails if used repeatedly.
|
||||||
|
|
||||||
// Ability settings
|
// Ability settings
|
||||||
#define B_ABILITY_WEATHER GEN_LATEST // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability.
|
#define B_ABILITY_WEATHER GEN_LATEST // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability.
|
||||||
|
|
|
@ -1875,6 +1875,8 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
||||||
ADJUST_SCORE(-10);
|
ADJUST_SCORE(-10);
|
||||||
break;
|
break;
|
||||||
case EFFECT_DESTINY_BOND:
|
case EFFECT_DESTINY_BOND:
|
||||||
|
if (DoesDestinyBondFail(battlerAtk))
|
||||||
|
ADJUST_SCORE(-10);
|
||||||
if (gBattleMons[battlerDef].status2 & STATUS2_DESTINY_BOND)
|
if (gBattleMons[battlerDef].status2 & STATUS2_DESTINY_BOND)
|
||||||
ADJUST_SCORE(-10);
|
ADJUST_SCORE(-10);
|
||||||
else if (GetActiveGimmick(battlerDef) == GIMMICK_DYNAMAX)
|
else if (GetActiveGimmick(battlerDef) == GIMMICK_DYNAMAX)
|
||||||
|
|
|
@ -508,7 +508,7 @@ static void Cmd_settypetorandomresistance(void);
|
||||||
static void Cmd_setalwayshitflag(void);
|
static void Cmd_setalwayshitflag(void);
|
||||||
static void Cmd_copymovepermanently(void);
|
static void Cmd_copymovepermanently(void);
|
||||||
static void Cmd_trychoosesleeptalkmove(void);
|
static void Cmd_trychoosesleeptalkmove(void);
|
||||||
static void Cmd_setdestinybond(void);
|
static void Cmd_trysetdestinybond(void);
|
||||||
static void Cmd_trysetdestinybondtohappen(void);
|
static void Cmd_trysetdestinybondtohappen(void);
|
||||||
static void Cmd_settailwind(void);
|
static void Cmd_settailwind(void);
|
||||||
static void Cmd_tryspiteppreduce(void);
|
static void Cmd_tryspiteppreduce(void);
|
||||||
|
@ -767,7 +767,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
|
||||||
Cmd_setalwayshitflag, //0xA7
|
Cmd_setalwayshitflag, //0xA7
|
||||||
Cmd_copymovepermanently, //0xA8
|
Cmd_copymovepermanently, //0xA8
|
||||||
Cmd_trychoosesleeptalkmove, //0xA9
|
Cmd_trychoosesleeptalkmove, //0xA9
|
||||||
Cmd_setdestinybond, //0xAA
|
Cmd_trysetdestinybond, //0xAA
|
||||||
Cmd_trysetdestinybondtohappen, //0xAB
|
Cmd_trysetdestinybondtohappen, //0xAB
|
||||||
Cmd_settailwind, //0xAC
|
Cmd_settailwind, //0xAC
|
||||||
Cmd_tryspiteppreduce, //0xAD
|
Cmd_tryspiteppreduce, //0xAD
|
||||||
|
@ -13446,12 +13446,18 @@ static void Cmd_trychoosesleeptalkmove(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Cmd_setdestinybond(void)
|
static void Cmd_trysetdestinybond(void)
|
||||||
{
|
{
|
||||||
CMD_ARGS();
|
CMD_ARGS(const u8 *failInstr);
|
||||||
|
if (DoesDestinyBondFail(gBattlerAttacker))
|
||||||
gBattleMons[gBattlerAttacker].status2 |= STATUS2_DESTINY_BOND;
|
{
|
||||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
gBattlescriptCurrInstr = cmd->failInstr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gBattleMons[gBattlerAttacker].status2 |= STATUS2_DESTINY_BOND;
|
||||||
|
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TrySetDestinyBondToHappen(void)
|
static void TrySetDestinyBondToHappen(void)
|
||||||
|
|
|
@ -12010,3 +12010,12 @@ void ClearDamageCalcResults(void)
|
||||||
gBattleStruct->printedStrongWindsWeakenedAttack = FALSE;
|
gBattleStruct->printedStrongWindsWeakenedAttack = FALSE;
|
||||||
gBattleStruct->numSpreadTargets = 0;
|
gBattleStruct->numSpreadTargets = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool32 DoesDestinyBondFail(u32 battler)
|
||||||
|
{
|
||||||
|
if (B_DESTINY_BOND_FAIL >= GEN_7
|
||||||
|
&& gMovesInfo[gLastResultingMoves[battler]].effect == EFFECT_DESTINY_BOND
|
||||||
|
&& !(gBattleStruct->lastMoveFailed & (1u << battler)))
|
||||||
|
return TRUE;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "test/battle.h"
|
#include "test/battle.h"
|
||||||
|
|
||||||
|
ASSUMPTIONS
|
||||||
|
{
|
||||||
|
ASSUME(gMovesInfo[MOVE_DESTINY_BOND].effect == EFFECT_DESTINY_BOND);
|
||||||
|
}
|
||||||
|
|
||||||
SINGLE_BATTLE_TEST("Destiny Bond faints the opposing mon if it fainted from the attack")
|
SINGLE_BATTLE_TEST("Destiny Bond faints the opposing mon if it fainted from the attack")
|
||||||
{
|
{
|
||||||
GIVEN {
|
GIVEN {
|
||||||
|
@ -15,3 +20,60 @@ SINGLE_BATTLE_TEST("Destiny Bond faints the opposing mon if it fainted from the
|
||||||
MESSAGE("The opposing Wobbuffet fainted!");
|
MESSAGE("The opposing Wobbuffet fainted!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Destiny Bond fails if used sequentially in Gen 7+")
|
||||||
|
{
|
||||||
|
GIVEN {
|
||||||
|
ASSUME(B_DESTINY_BOND_FAIL >= GEN_7);
|
||||||
|
PLAYER(SPECIES_ZIGZAGOON);
|
||||||
|
OPPONENT(SPECIES_ZIGZAGOON);
|
||||||
|
OPPONENT(SPECIES_ZIGZAGOON);
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(player, MOVE_DESTINY_BOND); }
|
||||||
|
TURN { MOVE(player, MOVE_DESTINY_BOND); SWITCH(opponent, 1); }
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_DESTINY_BOND, player);
|
||||||
|
MESSAGE("2 sent out Zigzagoon!");
|
||||||
|
NOT { ANIMATION(ANIM_TYPE_MOVE, MOVE_DESTINY_BOND, player); }
|
||||||
|
MESSAGE("But it failed!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Destiny Bond does not fail if used repeatedly separated by other moves in Gen 7+")
|
||||||
|
{
|
||||||
|
GIVEN {
|
||||||
|
ASSUME(B_DESTINY_BOND_FAIL >= GEN_7);
|
||||||
|
PLAYER(SPECIES_ZIGZAGOON);
|
||||||
|
OPPONENT(SPECIES_ZIGZAGOON);
|
||||||
|
OPPONENT(SPECIES_ZIGZAGOON);
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(player, MOVE_DESTINY_BOND); }
|
||||||
|
TURN { MOVE(player, MOVE_GROWL); SWITCH(opponent, 1); }
|
||||||
|
TURN { MOVE(player, MOVE_DESTINY_BOND); }
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_DESTINY_BOND, player);
|
||||||
|
MESSAGE("2 sent out Zigzagoon!");
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_DESTINY_BOND, player);
|
||||||
|
NOT { MESSAGE("But it failed!"); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Destiny Bond does not fail if used after failing in Gen 7+")
|
||||||
|
{
|
||||||
|
GIVEN {
|
||||||
|
ASSUME(B_DESTINY_BOND_FAIL >= GEN_7);
|
||||||
|
PLAYER(SPECIES_ZIGZAGOON);
|
||||||
|
OPPONENT(SPECIES_ZIGZAGOON);
|
||||||
|
OPPONENT(SPECIES_ZIGZAGOON);
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(player, MOVE_DESTINY_BOND); }
|
||||||
|
TURN { MOVE(player, MOVE_DESTINY_BOND); SWITCH(opponent, 1); }
|
||||||
|
TURN { MOVE(player, MOVE_DESTINY_BOND); }
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_DESTINY_BOND, player);
|
||||||
|
MESSAGE("2 sent out Zigzagoon!");
|
||||||
|
NOT { ANIMATION(ANIM_TYPE_MOVE, MOVE_DESTINY_BOND, player); }
|
||||||
|
MESSAGE("But it failed!");
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_DESTINY_BOND, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue