diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 986d373c6b9a..ea55903631e8 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1690,6 +1690,10 @@ .4byte \failInstr .endm + .macro setmagiccoattarget + callnative BS_SetMagicCoatTarget + .endm + @ various command changed to more readable macros .macro cancelmultiturnmoves battler:req various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES @@ -1700,10 +1704,6 @@ various \battler, VARIOUS_STORE_HEALING_WISH .endm - .macro setmagiccoattarget battler:req - various \battler, VARIOUS_SET_MAGIC_COAT_TARGET - .endm - .macro getifcantrunfrombattle battler:req various \battler, VARIOUS_IS_RUNNING_IMPOSSIBLE .endm diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 04ab06a76d79..c2372ea830c8 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6884,25 +6884,34 @@ BattleScript_GrudgeTakesPp:: waitmessage B_WAIT_TIME_LONG return -BattleScript_MagicCoatBounce:: +BattleScript_MagicBounce:: attackstring ppreduce pause B_WAIT_TIME_SHORT - jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0, BattleScript_MagicCoatBounce_Print call BattleScript_AbilityPopUp -BattleScript_MagicCoatBounce_Print: - printfromtable gMagicCoatBounceStringIds + printstring STRINGID_PKMNMOVEBOUNCEDABILITY waitmessage B_WAIT_TIME_LONG + setmagiccoattarget orword gHitMarker, HITMARKER_ATTACKSTRING_PRINTED | HITMARKER_NO_PPDEDUCT | HITMARKER_ALLOW_NO_PP bicword gHitMarker, HITMARKER_NO_ATTACKSTRING - setmagiccoattarget BS_ATTACKER return -BattleScript_MagicCoatBouncePrankster:: +BattleScript_MagicCoat:: attackstring ppreduce pause B_WAIT_TIME_SHORT - printfromtable gMagicCoatBounceStringIds + setmagiccoattarget + printstring STRINGID_PKMNMOVEBOUNCED + waitmessage B_WAIT_TIME_LONG + orword gHitMarker, HITMARKER_ATTACKSTRING_PRINTED | HITMARKER_NO_PPDEDUCT | HITMARKER_ALLOW_NO_PP + bicword gHitMarker, HITMARKER_NO_ATTACKSTRING + return + +BattleScript_MagicCoatPrankster:: + attackstring + ppreduce + pause B_WAIT_TIME_SHORT + printstring STRINGID_PKMNMOVEBOUNCED waitmessage B_WAIT_TIME_LONG printstring STRINGID_ITDOESNTAFFECT waitmessage B_WAIT_TIME_LONG diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 84c1b70cf4e8..71daf5f66f0c 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -111,8 +111,9 @@ extern const u8 BattleScript_MoveUsedIsImprisoned[]; extern const u8 BattleScript_SelectingImprisonedMove[]; extern const u8 BattleScript_SelectingImprisonedMoveInPalace[]; extern const u8 BattleScript_GrudgeTakesPp[]; -extern const u8 BattleScript_MagicCoatBounce[]; -extern const u8 BattleScript_MagicCoatBouncePrankster[]; +extern const u8 BattleScript_MagicBounce[]; +extern const u8 BattleScript_MagicCoat[]; +extern const u8 BattleScript_MagicCoatPrankster[]; extern const u8 BattleScript_SnatchedMove[]; extern const u8 BattleScript_EnduredMsg[]; extern const u8 BattleScript_OneHitKOMsg[]; diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 32e9ec23ee91..a8daf8841b58 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -90,149 +90,148 @@ // Cmd_various #define VARIOUS_CANCEL_MULTI_TURN_MOVES 0 -#define VARIOUS_SET_MAGIC_COAT_TARGET 1 -#define VARIOUS_IS_RUNNING_IMPOSSIBLE 2 -#define VARIOUS_GET_MOVE_TARGET 3 -#define VARIOUS_GET_BATTLER_FAINTED 4 -#define VARIOUS_RESET_SWITCH_IN_ABILITY_BITS 5 -#define VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP 6 -#define VARIOUS_RESET_PLAYER_FAINTED 7 -#define VARIOUS_PALACE_FLAVOR_TEXT 8 -#define VARIOUS_ARENA_JUDGMENT_WINDOW 9 -#define VARIOUS_ARENA_OPPONENT_MON_LOST 10 -#define VARIOUS_ARENA_PLAYER_MON_LOST 11 -#define VARIOUS_ARENA_BOTH_MONS_LOST 12 -#define VARIOUS_EMIT_YESNOBOX 13 -#define VARIOUS_DRAW_ARENA_REF_TEXT_BOX 14 -#define VARIOUS_ERASE_ARENA_REF_TEXT_BOX 15 -#define VARIOUS_ARENA_JUDGMENT_STRING 16 -#define VARIOUS_ARENA_WAIT_STRING 17 -#define VARIOUS_WAIT_CRY 18 -#define VARIOUS_RETURN_OPPONENT_MON1 19 -#define VARIOUS_RETURN_OPPONENT_MON2 20 -#define VARIOUS_VOLUME_DOWN 21 -#define VARIOUS_VOLUME_UP 22 -#define VARIOUS_SET_ALREADY_STATUS_MOVE_ATTEMPT 23 -#define VARIOUS_PALACE_TRY_ESCAPE_STATUS 24 -#define VARIOUS_SET_TELEPORT_OUTCOME 25 -#define VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC 26 -#define VARIOUS_STAT_TEXT_BUFFER 27 -#define VARIOUS_SWITCHIN_ABILITIES 28 -#define VARIOUS_INSTANT_HP_DROP 29 -#define VARIOUS_CLEAR_STATUS 30 -#define VARIOUS_RESTORE_PP 31 -#define VARIOUS_TRY_ACTIVATE_MOXIE 32 -#define VARIOUS_TRY_ACTIVATE_FELL_STINGER 33 -#define VARIOUS_PLAY_MOVE_ANIMATION 34 -#define VARIOUS_SET_LUCKY_CHANT 35 -#define VARIOUS_SUCKER_PUNCH_CHECK 36 -#define VARIOUS_SET_SIMPLE_BEAM 37 -#define VARIOUS_TRY_ENTRAINMENT 38 -#define VARIOUS_SET_LAST_USED_ABILITY 39 -#define VARIOUS_INVERT_STAT_STAGES 40 -#define VARIOUS_TRY_ME_FIRST 41 -#define VARIOUS_JUMP_IF_BATTLE_END 42 -#define VARIOUS_TRY_ELECTRIFY 43 -#define VARIOUS_TRY_REFLECT_TYPE 44 -#define VARIOUS_TRY_SOAK 45 -#define VARIOUS_HANDLE_MEGA_EVO 46 -#define VARIOUS_TRY_LAST_RESORT 47 -#define VARIOUS_SET_ARG_TO_BATTLE_DAMAGE 48 -#define VARIOUS_TRY_AUTOTOMIZE 49 -#define VARIOUS_ABILITY_POPUP 50 -#define VARIOUS_JUMP_IF_TARGET_ALLY 51 -#define VARIOUS_TRY_SYNCHRONOISE 52 -#define VARIOUS_PSYCHO_SHIFT 53 -#define VARIOUS_CURE_STATUS 54 -#define VARIOUS_POWER_TRICK 55 -#define VARIOUS_AFTER_YOU 56 -#define VARIOUS_BESTOW 57 -#define VARIOUS_JUMP_IF_NOT_GROUNDED 58 -#define VARIOUS_HANDLE_TRAINER_SLIDE_MSG 59 -#define VARIOUS_TRY_TRAINER_SLIDE_MSG_FIRST_OFF 60 -#define VARIOUS_TRY_TRAINER_SLIDE_MSG_LAST_ON 61 -#define VARIOUS_SET_AURORA_VEIL 62 -#define VARIOUS_TRY_THIRD_TYPE 63 -#define VARIOUS_ACUPRESSURE 64 -#define VARIOUS_SET_POWDER 65 -#define VARIOUS_SPECTRAL_THIEF 66 -#define VARIOUS_GRAVITY_ON_AIRBORNE_MONS 67 -#define VARIOUS_CHECK_IF_GRASSY_TERRAIN_HEALS 68 -#define VARIOUS_JUMP_IF_ROAR_FAILS 69 -#define VARIOUS_TRY_INSTRUCT 70 -#define VARIOUS_JUMP_IF_NOT_BERRY 71 -#define VARIOUS_TRACE_ABILITY 72 -#define VARIOUS_UPDATE_NICK 73 -#define VARIOUS_TRY_ILLUSION_OFF 74 -#define VARIOUS_SET_SPRITEIGNORE0HP 75 -#define VARIOUS_HANDLE_FORM_CHANGE 76 -#define VARIOUS_GET_STAT_VALUE 77 -#define VARIOUS_JUMP_IF_FULL_HP 78 -#define VARIOUS_LOSE_TYPE 79 -#define VARIOUS_TRY_ACTIVATE_SOULHEART 80 -#define VARIOUS_TRY_ACTIVATE_RECEIVER 81 -#define VARIOUS_TRY_ACTIVATE_BEAST_BOOST 82 -#define VARIOUS_TRY_FRISK 83 -#define VARIOUS_JUMP_IF_SHIELDS_DOWN_PROTECTED 84 -#define VARIOUS_TRY_FAIRY_LOCK 85 -#define VARIOUS_JUMP_IF_NO_ALLY 86 -#define VARIOUS_POISON_TYPE_IMMUNITY 87 -#define VARIOUS_JUMP_IF_HOLD_EFFECT 88 -#define VARIOUS_INFATUATE_WITH_BATTLER 89 -#define VARIOUS_SET_LAST_USED_ITEM 90 -#define VARIOUS_PARALYZE_TYPE_IMMUNITY 91 -#define VARIOUS_JUMP_IF_ABSENT 92 -#define VARIOUS_DESTROY_ABILITY_POPUP 93 -#define VARIOUS_TOTEM_BOOST 94 -#define VARIOUS_TRY_ACTIVATE_GRIM_NEIGH 95 -#define VARIOUS_MOVEEND_ITEM_EFFECTS 96 -#define VARIOUS_TERRAIN_SEED 97 -#define VARIOUS_MAKE_INVISIBLE 98 -#define VARIOUS_ROOM_SERVICE 99 -#define VARIOUS_EERIE_SPELL_PP_REDUCE 100 -#define VARIOUS_JUMP_IF_TEAM_HEALTHY 101 -#define VARIOUS_TRY_HEAL_QUARTER_HP 102 -#define VARIOUS_REMOVE_TERRAIN 103 -#define VARIOUS_JUMP_IF_PRANKSTER_BLOCKED 104 -#define VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER 105 -#define VARIOUS_GET_ROTOTILLER_TARGETS 106 -#define VARIOUS_JUMP_IF_NOT_ROTOTILLER_AFFECTED 107 -#define VARIOUS_TRY_ACTIVATE_BATTLE_BOND 108 -#define VARIOUS_CONSUME_BERRY 109 -#define VARIOUS_JUMP_IF_CANT_REVERT_TO_PRIMAL 110 -#define VARIOUS_JUMP_IF_SPECIES 111 -#define VARIOUS_UPDATE_ABILITY_POPUP 112 -#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 113 -#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 114 -#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 115 -#define VARIOUS_TRY_NO_RETREAT 116 -#define VARIOUS_TRY_TAR_SHOT 117 -#define VARIOUS_CAN_TAR_SHOT_WORK 118 -#define VARIOUS_CHECK_POLTERGEIST 119 -#define VARIOUS_CUT_1_3_HP_RAISE_STATS 120 -#define VARIOUS_TRY_END_NEUTRALIZING_GAS 121 -#define VARIOUS_JUMP_IF_UNDER_200 122 -#define VARIOUS_SET_SKY_DROP 123 -#define VARIOUS_CLEAR_SKY_DROP 124 -#define VARIOUS_SKY_DROP_YAWN 125 -#define VARIOUS_CURE_CERTAIN_STATUSES 126 -#define VARIOUS_TRY_RESET_NEGATIVE_STAT_STAGES 127 -#define VARIOUS_JUMP_IF_LAST_USED_ITEM_BERRY 128 -#define VARIOUS_JUMP_IF_LAST_USED_ITEM_HOLD_EFFECT 129 -#define VARIOUS_SAVE_BATTLER_ITEM 130 -#define VARIOUS_RESTORE_BATTLER_ITEM 131 -#define VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM 132 -#define VARIOUS_SET_BEAK_BLAST 133 -#define VARIOUS_SWAP_SIDE_STATUSES 134 -#define VARIOUS_SWAP_STATS 135 -#define VARIOUS_TEATIME_INVUL 136 -#define VARIOUS_TEATIME_TARGETS 137 -#define VARIOUS_TRY_WIND_RIDER_POWER 138 -#define VARIOUS_ACTIVATE_WEATHER_CHANGE_ABILITIES 139 -#define VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES 140 -#define VARIOUS_STORE_HEALING_WISH 141 -#define VARIOUS_HIT_SWITCH_TARGET_FAILED 142 -#define VARIOUS_TRY_REVIVAL_BLESSING 143 +#define VARIOUS_IS_RUNNING_IMPOSSIBLE 1 +#define VARIOUS_GET_MOVE_TARGET 2 +#define VARIOUS_GET_BATTLER_FAINTED 3 +#define VARIOUS_RESET_SWITCH_IN_ABILITY_BITS 4 +#define VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP 5 +#define VARIOUS_RESET_PLAYER_FAINTED 6 +#define VARIOUS_PALACE_FLAVOR_TEXT 7 +#define VARIOUS_ARENA_JUDGMENT_WINDOW 8 +#define VARIOUS_ARENA_OPPONENT_MON_LOST 9 +#define VARIOUS_ARENA_PLAYER_MON_LOST 10 +#define VARIOUS_ARENA_BOTH_MONS_LOST 11 +#define VARIOUS_EMIT_YESNOBOX 12 +#define VARIOUS_DRAW_ARENA_REF_TEXT_BOX 13 +#define VARIOUS_ERASE_ARENA_REF_TEXT_BOX 14 +#define VARIOUS_ARENA_JUDGMENT_STRING 15 +#define VARIOUS_ARENA_WAIT_STRING 16 +#define VARIOUS_WAIT_CRY 17 +#define VARIOUS_RETURN_OPPONENT_MON1 18 +#define VARIOUS_RETURN_OPPONENT_MON2 19 +#define VARIOUS_VOLUME_DOWN 20 +#define VARIOUS_VOLUME_UP 21 +#define VARIOUS_SET_ALREADY_STATUS_MOVE_ATTEMPT 22 +#define VARIOUS_PALACE_TRY_ESCAPE_STATUS 23 +#define VARIOUS_SET_TELEPORT_OUTCOME 24 +#define VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC 25 +#define VARIOUS_STAT_TEXT_BUFFER 26 +#define VARIOUS_SWITCHIN_ABILITIES 27 +#define VARIOUS_INSTANT_HP_DROP 28 +#define VARIOUS_CLEAR_STATUS 29 +#define VARIOUS_RESTORE_PP 30 +#define VARIOUS_TRY_ACTIVATE_MOXIE 31 +#define VARIOUS_TRY_ACTIVATE_FELL_STINGER 32 +#define VARIOUS_PLAY_MOVE_ANIMATION 33 +#define VARIOUS_SET_LUCKY_CHANT 34 +#define VARIOUS_SUCKER_PUNCH_CHECK 35 +#define VARIOUS_SET_SIMPLE_BEAM 36 +#define VARIOUS_TRY_ENTRAINMENT 37 +#define VARIOUS_SET_LAST_USED_ABILITY 38 +#define VARIOUS_INVERT_STAT_STAGES 39 +#define VARIOUS_TRY_ME_FIRST 40 +#define VARIOUS_JUMP_IF_BATTLE_END 41 +#define VARIOUS_TRY_ELECTRIFY 42 +#define VARIOUS_TRY_REFLECT_TYPE 43 +#define VARIOUS_TRY_SOAK 44 +#define VARIOUS_HANDLE_MEGA_EVO 45 +#define VARIOUS_TRY_LAST_RESORT 46 +#define VARIOUS_SET_ARG_TO_BATTLE_DAMAGE 47 +#define VARIOUS_TRY_AUTOTOMIZE 48 +#define VARIOUS_ABILITY_POPUP 49 +#define VARIOUS_JUMP_IF_TARGET_ALLY 50 +#define VARIOUS_TRY_SYNCHRONOISE 51 +#define VARIOUS_PSYCHO_SHIFT 52 +#define VARIOUS_CURE_STATUS 53 +#define VARIOUS_POWER_TRICK 54 +#define VARIOUS_AFTER_YOU 55 +#define VARIOUS_BESTOW 56 +#define VARIOUS_JUMP_IF_NOT_GROUNDED 57 +#define VARIOUS_HANDLE_TRAINER_SLIDE_MSG 58 +#define VARIOUS_TRY_TRAINER_SLIDE_MSG_FIRST_OFF 59 +#define VARIOUS_TRY_TRAINER_SLIDE_MSG_LAST_ON 60 +#define VARIOUS_SET_AURORA_VEIL 61 +#define VARIOUS_TRY_THIRD_TYPE 62 +#define VARIOUS_ACUPRESSURE 63 +#define VARIOUS_SET_POWDER 64 +#define VARIOUS_SPECTRAL_THIEF 65 +#define VARIOUS_GRAVITY_ON_AIRBORNE_MONS 66 +#define VARIOUS_CHECK_IF_GRASSY_TERRAIN_HEALS 67 +#define VARIOUS_JUMP_IF_ROAR_FAILS 68 +#define VARIOUS_TRY_INSTRUCT 69 +#define VARIOUS_JUMP_IF_NOT_BERRY 70 +#define VARIOUS_TRACE_ABILITY 71 +#define VARIOUS_UPDATE_NICK 72 +#define VARIOUS_TRY_ILLUSION_OFF 73 +#define VARIOUS_SET_SPRITEIGNORE0HP 74 +#define VARIOUS_HANDLE_FORM_CHANGE 75 +#define VARIOUS_GET_STAT_VALUE 76 +#define VARIOUS_JUMP_IF_FULL_HP 77 +#define VARIOUS_LOSE_TYPE 78 +#define VARIOUS_TRY_ACTIVATE_SOULHEART 79 +#define VARIOUS_TRY_ACTIVATE_RECEIVER 80 +#define VARIOUS_TRY_ACTIVATE_BEAST_BOOST 81 +#define VARIOUS_TRY_FRISK 82 +#define VARIOUS_JUMP_IF_SHIELDS_DOWN_PROTECTED 83 +#define VARIOUS_TRY_FAIRY_LOCK 84 +#define VARIOUS_JUMP_IF_NO_ALLY 85 +#define VARIOUS_POISON_TYPE_IMMUNITY 86 +#define VARIOUS_JUMP_IF_HOLD_EFFECT 87 +#define VARIOUS_INFATUATE_WITH_BATTLER 88 +#define VARIOUS_SET_LAST_USED_ITEM 89 +#define VARIOUS_PARALYZE_TYPE_IMMUNITY 90 +#define VARIOUS_JUMP_IF_ABSENT 91 +#define VARIOUS_DESTROY_ABILITY_POPUP 92 +#define VARIOUS_TOTEM_BOOST 93 +#define VARIOUS_TRY_ACTIVATE_GRIM_NEIGH 94 +#define VARIOUS_MOVEEND_ITEM_EFFECTS 95 +#define VARIOUS_TERRAIN_SEED 96 +#define VARIOUS_MAKE_INVISIBLE 97 +#define VARIOUS_ROOM_SERVICE 98 +#define VARIOUS_EERIE_SPELL_PP_REDUCE 99 +#define VARIOUS_JUMP_IF_TEAM_HEALTHY 100 +#define VARIOUS_TRY_HEAL_QUARTER_HP 101 +#define VARIOUS_REMOVE_TERRAIN 102 +#define VARIOUS_JUMP_IF_PRANKSTER_BLOCKED 103 +#define VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER 104 +#define VARIOUS_GET_ROTOTILLER_TARGETS 105 +#define VARIOUS_JUMP_IF_NOT_ROTOTILLER_AFFECTED 106 +#define VARIOUS_TRY_ACTIVATE_BATTLE_BOND 107 +#define VARIOUS_CONSUME_BERRY 108 +#define VARIOUS_JUMP_IF_CANT_REVERT_TO_PRIMAL 109 +#define VARIOUS_JUMP_IF_SPECIES 110 +#define VARIOUS_UPDATE_ABILITY_POPUP 111 +#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 112 +#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 113 +#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 114 +#define VARIOUS_TRY_NO_RETREAT 115 +#define VARIOUS_TRY_TAR_SHOT 116 +#define VARIOUS_CAN_TAR_SHOT_WORK 117 +#define VARIOUS_CHECK_POLTERGEIST 118 +#define VARIOUS_CUT_1_3_HP_RAISE_STATS 119 +#define VARIOUS_TRY_END_NEUTRALIZING_GAS 120 +#define VARIOUS_JUMP_IF_UNDER_200 121 +#define VARIOUS_SET_SKY_DROP 122 +#define VARIOUS_CLEAR_SKY_DROP 123 +#define VARIOUS_SKY_DROP_YAWN 124 +#define VARIOUS_CURE_CERTAIN_STATUSES 125 +#define VARIOUS_TRY_RESET_NEGATIVE_STAT_STAGES 126 +#define VARIOUS_JUMP_IF_LAST_USED_ITEM_BERRY 127 +#define VARIOUS_JUMP_IF_LAST_USED_ITEM_HOLD_EFFECT 128 +#define VARIOUS_SAVE_BATTLER_ITEM 129 +#define VARIOUS_RESTORE_BATTLER_ITEM 130 +#define VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM 131 +#define VARIOUS_SET_BEAK_BLAST 132 +#define VARIOUS_SWAP_SIDE_STATUSES 133 +#define VARIOUS_SWAP_STATS 134 +#define VARIOUS_TEATIME_INVUL 135 +#define VARIOUS_TEATIME_TARGETS 136 +#define VARIOUS_TRY_WIND_RIDER_POWER 137 +#define VARIOUS_ACTIVATE_WEATHER_CHANGE_ABILITIES 138 +#define VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES 139 +#define VARIOUS_STORE_HEALING_WISH 140 +#define VARIOUS_HIT_SWITCH_TARGET_FAILED 141 +#define VARIOUS_TRY_REVIVAL_BLESSING 142 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/src/battle_message.c b/src/battle_message.c index 52c6dec6ae2b..1598c4cef7c4 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -258,7 +258,7 @@ static const u8 sText_PkmnSealedOpponentMove[] = _("{B_ATK_NAME_WITH_PREFIX} sea static const u8 sText_PkmnWantsGrudge[] = _("{B_ATK_NAME_WITH_PREFIX} wants the\nopponent to bear a GRUDGE!"); static const u8 sText_PkmnLostPPGrudge[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_BUFF1} lost\nall its PP due to the GRUDGE!"); static const u8 sText_PkmnShroudedItself[] = _("{B_ATK_NAME_WITH_PREFIX} shrouded\nitself in {B_CURRENT_MOVE}!"); -static const u8 sText_PkmnMoveBounced[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_CURRENT_MOVE}\nwas bounced back by MAGIC COAT!"); +static const u8 sText_PkmnMoveBounced[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_CURRENT_MOVE}\nwas bounced back by MAGIC COAT!"); static const u8 sText_PkmnWaitsForTarget[] = _("{B_ATK_NAME_WITH_PREFIX} waits for a target\nto make a move!"); static const u8 sText_PkmnSnatchedMove[] = _("{B_DEF_NAME_WITH_PREFIX} SNATCHED\n{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s move!"); static const u8 sText_ElectricityWeakened[] = _("Electricity's power was\nweakened!"); @@ -1613,11 +1613,6 @@ const u16 gTerrainPreventsStringIds[] = [B_MSG_TERRAINPREVENTS_PSYCHIC] = STRINGID_PSYCHICTERRAINPREVENTS }; -const u16 gMagicCoatBounceStringIds[] = -{ - STRINGID_PKMNMOVEBOUNCED, STRINGID_PKMNMOVEBOUNCEDABILITY -}; - const u16 gHealingWishStringIds[] = { STRINGID_HEALINGWISHCAMETRUE, STRINGID_LUNARDANCECAMETRUE diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 183141228f38..4f4ed0d3cbeb 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1343,19 +1343,18 @@ static void Cmd_attackcanceler(void) && !gBattleStruct->bouncedMoveIsUsed) { gBattleStruct->bouncedMoveIsUsed = TRUE; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; // Edge case for bouncing a powder move against a grass type pokemon. SetAtkCancellerForCalledMove(); if (BlocksPrankster(gCurrentMove, gBattlerTarget, gBattlerAttacker, TRUE)) { // Opponent used a prankster'd magic coat -> reflected status move should fail against a dark-type attacker gBattlerTarget = gBattlerAttacker; - gBattlescriptCurrInstr = BattleScript_MagicCoatBouncePrankster; + gBattlescriptCurrInstr = BattleScript_MagicCoatPrankster; } else { BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_MagicCoatBounce; + gBattlescriptCurrInstr = BattleScript_MagicCoat; } return; } @@ -1378,11 +1377,10 @@ static void Cmd_attackcanceler(void) if (gBattleStruct->bouncedMoveIsUsed) { - gBattleCommunication[MULTISTRING_CHOOSER] = 1; // Edge case for bouncing a powder move against a grass type pokemon. SetAtkCancellerForCalledMove(); BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_MagicCoatBounce; + gBattlescriptCurrInstr = BattleScript_MagicBounce; gBattlerAbility = battler; return; } @@ -8997,7 +8995,7 @@ static void Cmd_various(void) struct Pokemon *mon; s32 i; u8 data[10]; - u32 side, battler, bits; + u32 battler, bits; if (gBattleControllerExecFlags) return; @@ -9308,18 +9306,6 @@ static void Cmd_various(void) } break; } - case VARIOUS_SET_MAGIC_COAT_TARGET: - { - VARIOUS_ARGS(); - gBattleStruct->attackerBeforeBounce = battler; - gBattlerAttacker = gBattlerTarget; - side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); - if (IsAffectedByFollowMe(gBattlerAttacker, side, gCurrentMove)) - gBattlerTarget = gSideTimers[side].followmeTarget; - else - gBattlerTarget = battler; - break; - } case VARIOUS_IS_RUNNING_IMPOSSIBLE: { VARIOUS_ARGS(); @@ -17335,3 +17321,18 @@ void BS_TryHitSwitchTarget(void) gBattlescriptCurrInstr = cmd->failInstr; } } + +void BS_SetMagicCoatTarget(void) +{ + NATIVE_ARGS(); + u32 side; + gBattleStruct->attackerBeforeBounce = gBattleScripting.battler = gBattlerAttacker; + gBattlerAttacker = gBattlerTarget; + side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); + if (IsAffectedByFollowMe(gBattlerAttacker, side, gCurrentMove)) + gBattlerTarget = gSideTimers[side].followmeTarget; + else + gBattlerTarget = gBattleStruct->attackerBeforeBounce; + + gBattlescriptCurrInstr = cmd->nextInstr; +} diff --git a/test/battle/move_effect/magic_coat.c b/test/battle/move_effect/magic_coat.c new file mode 100644 index 000000000000..417f4e851edf --- /dev/null +++ b/test/battle/move_effect/magic_coat.c @@ -0,0 +1,23 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gMovesInfo[MOVE_MAGIC_COAT].effect == EFFECT_MAGIC_COAT); +} + +SINGLE_BATTLE_TEST("Magic Coat prints the correct message when bouncing back a move") +{ + GIVEN { + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_WYNAUT); + } WHEN { + TURN { MOVE(player, MOVE_MAGIC_COAT); MOVE(opponent, MOVE_SPORE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_MAGIC_COAT, player); + MESSAGE("Foe Wynaut's Spore was bounced back by MAGIC COAT!"); + MESSAGE("Foe Wynaut fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + } +}