Fixes Take heart (#5658)
Co-authored-by: KyleLaporte <moog272@gmail.com> Co-authored-by: Pawkkie <61265402+Pawkkie@users.noreply.github.com>
This commit is contained in:
parent
a8351e305c
commit
b55c87f73f
6 changed files with 107 additions and 8 deletions
|
@ -1104,7 +1104,7 @@
|
|||
.byte 0xcc
|
||||
.endm
|
||||
|
||||
.macro cureifburnedparalysedorpoisoned failInstr:req
|
||||
.macro curestatuswithmove failInstr:req
|
||||
.byte 0xcd
|
||||
.4byte \failInstr
|
||||
.endm
|
||||
|
|
|
@ -443,7 +443,7 @@ BattleScript_EffectTakeHeart::
|
|||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
cureifburnedparalysedorpoisoned BattleScript_CalmMindTryToRaiseStats
|
||||
curestatuswithmove BattleScript_CalmMindTryToRaiseStats
|
||||
attackanimation
|
||||
waitanimation
|
||||
updatestatusicon BS_ATTACKER
|
||||
|
@ -5226,7 +5226,7 @@ BattleScript_EffectRefresh::
|
|||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
cureifburnedparalysedorpoisoned BattleScript_ButItFailed
|
||||
curestatuswithmove BattleScript_ButItFailed
|
||||
attackanimation
|
||||
waitanimation
|
||||
printstring STRINGID_PKMNSTATUSNORMAL
|
||||
|
|
|
@ -122,6 +122,8 @@
|
|||
#define STATUS1_PSN_ANY (STATUS1_POISON | STATUS1_TOXIC_POISON)
|
||||
#define STATUS1_ANY (STATUS1_SLEEP | STATUS1_POISON | STATUS1_BURN | STATUS1_FREEZE | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON | STATUS1_FROSTBITE)
|
||||
|
||||
#define STATUS1_REFRESH (STATUS1_POISON | STATUS1_BURN | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON | STATUS1_FROSTBITE)
|
||||
|
||||
// Volatile status ailments
|
||||
// These are removed after exiting the battle or switching out
|
||||
#define STATUS2_CONFUSION (1 << 0 | 1 << 1 | 1 << 2)
|
||||
|
|
|
@ -545,7 +545,7 @@ static void Cmd_trymemento(void);
|
|||
static void Cmd_setforcedtarget(void);
|
||||
static void Cmd_setcharge(void);
|
||||
static void Cmd_callterrainattack(void);
|
||||
static void Cmd_cureifburnedparalysedorpoisoned(void);
|
||||
static void Cmd_curestatuswithmove(void);
|
||||
static void Cmd_settorment(void);
|
||||
static void Cmd_jumpifnodamage(void);
|
||||
static void Cmd_settaunt(void);
|
||||
|
@ -804,7 +804,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
|
|||
Cmd_setforcedtarget, //0xCA
|
||||
Cmd_setcharge, //0xCB
|
||||
Cmd_callterrainattack, //0xCC
|
||||
Cmd_cureifburnedparalysedorpoisoned, //0xCD
|
||||
Cmd_curestatuswithmove, //0xCD
|
||||
Cmd_settorment, //0xCE
|
||||
Cmd_jumpifnodamage, //0xCF
|
||||
Cmd_settaunt, //0xD0
|
||||
|
@ -14135,12 +14135,17 @@ u32 GetNaturePowerMove(u32 battler)
|
|||
return move;
|
||||
}
|
||||
|
||||
// Refresh
|
||||
static void Cmd_cureifburnedparalysedorpoisoned(void)
|
||||
static void Cmd_curestatuswithmove(void)
|
||||
{
|
||||
CMD_ARGS(const u8 *failInstr);
|
||||
u32 shouldHeal;
|
||||
|
||||
if (gBattleMons[gBattlerAttacker].status1 & (STATUS1_POISON | STATUS1_BURN | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON | STATUS1_FROSTBITE))
|
||||
if (gMovesInfo[gCurrentMove].effect == EFFECT_REFRESH)
|
||||
shouldHeal = gBattleMons[gBattlerAttacker].status1 & STATUS1_REFRESH;
|
||||
else // Take Heart
|
||||
shouldHeal = gBattleMons[gBattlerAttacker].status1 & STATUS1_ANY;
|
||||
|
||||
if (shouldHeal)
|
||||
{
|
||||
gBattleMons[gBattlerAttacker].status1 = 0;
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
|
|
68
test/battle/move_effect/refresh.c
Normal file
68
test/battle/move_effect/refresh.c
Normal file
|
@ -0,0 +1,68 @@
|
|||
#include "global.h"
|
||||
#include "test/battle.h"
|
||||
|
||||
ASSUMPTIONS
|
||||
{
|
||||
ASSUME(gMovesInfo[MOVE_REFRESH].effect == EFFECT_REFRESH);
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Refresh cures the user of burn, frostbite, poison, and paralysis")
|
||||
{
|
||||
u32 status1;
|
||||
PARAMETRIZE { status1 = STATUS1_POISON; }
|
||||
PARAMETRIZE { status1 = STATUS1_BURN; }
|
||||
PARAMETRIZE { status1 = STATUS1_PARALYSIS; }
|
||||
PARAMETRIZE { status1 = STATUS1_TOXIC_POISON; }
|
||||
PARAMETRIZE { status1 = STATUS1_FROSTBITE; }
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET) { Status1(status1); };
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_REFRESH); }
|
||||
} SCENE {
|
||||
MESSAGE("Wobbuffet's status returned to normal!");
|
||||
STATUS_ICON(player, none: TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Refresh does not cure the user of Freeze")
|
||||
{
|
||||
PASSES_RANDOMLY(20, 100, RNG_FROZEN);
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET) { Status1(STATUS1_FREEZE); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_REFRESH); }
|
||||
} SCENE {
|
||||
MESSAGE("Wobbuffet used Refresh!");
|
||||
NONE_OF {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_REFRESH, player);
|
||||
STATUS_ICON(player, none: TRUE); }
|
||||
MESSAGE("But it failed!");
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Refresh does not cure sleep when used by Sleep Talk")
|
||||
{
|
||||
GIVEN {
|
||||
ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP);
|
||||
ASSUME(gMovesInfo[MOVE_SLEEP_TALK].effect == EFFECT_SLEEP_TALK);
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WOBBUFFET) { Moves(MOVE_SLEEP_TALK, MOVE_REFRESH); }
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_SPORE); MOVE(opponent, MOVE_SLEEP_TALK); }
|
||||
TURN { MOVE(player, MOVE_SPORE); MOVE(opponent, MOVE_REFRESH); }
|
||||
} SCENE {
|
||||
MESSAGE("Wobbuffet used Spore!");
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player);
|
||||
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent);
|
||||
MESSAGE("Foe Wobbuffet fell asleep!");
|
||||
MESSAGE("Foe Wobbuffet used Sleep Talk!");
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_SLEEP_TALK, opponent);
|
||||
MESSAGE("Foe Wobbuffet used Refresh!");
|
||||
NONE_OF {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_REFRESH, player);
|
||||
STATUS_ICON(player, none: TRUE); }
|
||||
MESSAGE("But it failed!");
|
||||
}
|
||||
}
|
|
@ -40,8 +40,32 @@ SINGLE_BATTLE_TEST("Take Heart cures the user of all status conditions")
|
|||
STATUS_ICON(player, none: TRUE);
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
|
||||
} else {
|
||||
STATUS_ICON(player, none: TRUE);
|
||||
MESSAGE("Wobbuffet's status returned to normal!");
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Take Heart cures sleep when used by Sleep Talk")
|
||||
{
|
||||
GIVEN {
|
||||
ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP);
|
||||
ASSUME(gMovesInfo[MOVE_SLEEP_TALK].effect == EFFECT_SLEEP_TALK);
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WOBBUFFET) { Moves(MOVE_SLEEP_TALK, MOVE_TAKE_HEART); }
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_SPORE); MOVE(opponent, MOVE_SLEEP_TALK); }
|
||||
} SCENE {
|
||||
MESSAGE("Wobbuffet used Spore!");
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player);
|
||||
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent);
|
||||
MESSAGE("Foe Wobbuffet fell asleep!");
|
||||
MESSAGE("Foe Wobbuffet used Sleep Talk!");
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_SLEEP_TALK, opponent);
|
||||
MESSAGE("Foe Wobbuffet used Take Heart!");
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_TAKE_HEART, opponent);
|
||||
STATUS_ICON(opponent, none: TRUE);
|
||||
MESSAGE("Foe Wobbuffet's status returned to normal!");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue