diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 40738560f0..80abdafa61 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1177,8 +1177,10 @@ .4byte \jumpInstr .endm - .macro unused_0xe4 + .macro jumpifnotcurrentmoveargtype battler:req, failInstr:req .byte 0xe4 + .byte \battler + .4byte \failInstr .endm .macro pickup diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index fe461e67a6..65f2ebdeeb 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -324,7 +324,7 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectStrengthSap @ EFFECT_STRENGTH_SAP .4byte BattleScript_EffectMindBlown @ EFFECT_MIND_BLOWN .4byte BattleScript_EffectPurify @ EFFECT_PURIFY - .4byte BattleScript_EffectBurnUp @ EFFECT_BURN_UP + .4byte BattleScript_FailIfNotArgType @ EFFECT_FAIL_IF_NOT_ARG_TYPE .4byte BattleScript_EffectShoreUp @ EFFECT_SHORE_UP .4byte BattleScript_EffectGeomancy @ EFFECT_GEOMANCY .4byte BattleScript_EffectFairyLock @ EFFECT_FAIRY_LOCK @@ -369,7 +369,7 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectExtremeEvoboost @ EFFECT_EXTREME_EVOBOOST .4byte BattleScript_EffectHitSetRemoveTerrain @ EFFECT_HIT_SET_REMOVE_TERRAIN .4byte BattleScript_EffectDarkVoid @ EFFECT_DARK_VOID - .4byte BattleScript_EffectDoubleShock @ EFFECT_DOUBLE_SHOCK + .4byte BattleScript_EffectHit @ EFFECT_UNUSED_347 .4byte BattleScript_EffectVictoryDance @ EFFECT_VICTORY_DANCE .4byte BattleScript_EffectTeatime @ EFFECT_TEATIME .4byte BattleScript_EffectAttackUpUserAlly @ EFFECT_ATTACK_UP_USER_ALLY @@ -1413,37 +1413,21 @@ BattleScript_EffectFairyLock: waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd -BattleScript_EffectBurnUp: +BattleScript_FailIfNotArgType: attackcanceler attackstring ppreduce - jumpiftype BS_ATTACKER, TYPE_FIRE, BattleScript_BurnUpWorks - goto BattleScript_ButItFailed - -BattleScript_BurnUpWorks: - setmoveeffect MOVE_EFFECT_BURN_UP | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN + jumpifnotcurrentmoveargtype BS_ATTACKER, BattleScript_ButItFailed accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE goto BattleScript_HitFromCritCalc -BattleScript_BurnUpRemoveType:: +BattleScript_RemoveFireType:: losetype BS_ATTACKER, TYPE_FIRE printstring STRINGID_ATTACKERLOSTFIRETYPE waitmessage B_WAIT_TIME_LONG return -BattleScript_EffectDoubleShock: - attackcanceler - attackstring - ppreduce - jumpiftype BS_ATTACKER, TYPE_ELECTRIC, BattleScript_DoubleShockWorks - goto BattleScript_ButItFailed - -BattleScript_DoubleShockWorks: - setmoveeffect MOVE_EFFECT_DOUBLE_SHOCK | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - goto BattleScript_HitFromCritCalc - -BattleScript_DoubleShockRemoveType:: +BattleScript_RemoveElectricType:: losetype BS_ATTACKER, TYPE_ELECTRIC printstring STRINGID_ATTACKERLOSTELECTRICTYPE waitmessage B_WAIT_TIME_LONG diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 8ed4ff4d55..720e3d34f9 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -442,9 +442,9 @@ extern const u8 BattleScript_AffectionBasedStatusHeal[]; extern const u8 BattleScript_AffectionBasedEndurance[]; extern const u8 BattleScript_SymbiosisActivates[]; extern const u8 BattleScript_MultiHitPrintStrings[]; -extern const u8 BattleScript_BurnUpRemoveType[]; +extern const u8 BattleScript_RemoveFireType[]; extern const u8 BattleScript_TargetAbilityStatRaiseRet[]; -extern const u8 BattleScript_DoubleShockRemoveType[]; +extern const u8 BattleScript_RemoveElectricType[]; extern const u8 BattleScript_SeedSowerActivates[]; extern const u8 BattleScript_AngerShellActivates[]; extern const u8 BattleScript_WellBakedBodyActivates[]; diff --git a/include/battle_util.h b/include/battle_util.h index 936f773d99..1d58221486 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -224,6 +224,7 @@ bool32 IsGen6ExpShareEnabled(void); bool32 MoveHasMoveEffect(u32 move, u32 moveEffect, bool32 effectHitOnly); bool32 MoveHasMoveEffectWithChance(u32 move, u32 moveEffect, u32 chance); bool32 MoveHasMoveEffectSelf(u32 move, u32 moveEffect); +bool32 MoveHasMoveEffectSelfArg(u32 move, u32 moveEffect, u32 argument); // Ability checks bool32 IsSkillSwapBannedAbility(u16 ability); diff --git a/include/constants/battle.h b/include/constants/battle.h index 8dc0a92843..424b71f1dc 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -343,7 +343,7 @@ #define MOVE_EFFECT_SP_DEF_MINUS_1 26 #define MOVE_EFFECT_ACC_MINUS_1 27 #define MOVE_EFFECT_EVS_MINUS_1 28 -#define MOVE_EFFECT_BURN_UP 29 +#define MOVE_EFFECT_REMOVE_ARG_TYPE 29 #define MOVE_EFFECT_RECHARGE 30 #define MOVE_EFFECT_RAGE 31 #define MOVE_EFFECT_STEAL_ITEM 32 @@ -385,17 +385,16 @@ #define MOVE_EFFECT_BUG_BITE 68 #define MOVE_EFFECT_RECOIL_HP_25 69 #define MOVE_EFFECT_TRAP_BOTH 70 -#define MOVE_EFFECT_DOUBLE_SHOCK 71 -#define MOVE_EFFECT_ROUND 72 -#define MOVE_EFFECT_STOCKPILE_WORE_OFF 73 -#define MOVE_EFFECT_DIRE_CLAW 74 -#define MOVE_EFFECT_STEALTH_ROCK 75 -#define MOVE_EFFECT_SPIKES 76 -#define MOVE_EFFECT_SYRUP_BOMB 77 -#define MOVE_EFFECT_FLORAL_HEALING 78 -#define MOVE_EFFECT_SECRET_POWER 79 +#define MOVE_EFFECT_ROUND 71 +#define MOVE_EFFECT_STOCKPILE_WORE_OFF 72 +#define MOVE_EFFECT_DIRE_CLAW 73 +#define MOVE_EFFECT_STEALTH_ROCK 74 +#define MOVE_EFFECT_SPIKES 75 +#define MOVE_EFFECT_SYRUP_BOMB 76 +#define MOVE_EFFECT_FLORAL_HEALING 77 +#define MOVE_EFFECT_SECRET_POWER 78 -#define NUM_MOVE_EFFECTS 80 +#define NUM_MOVE_EFFECTS 79 #define MOVE_EFFECT_AFFECTS_USER 0x2000 #define MOVE_EFFECT_CERTAIN 0x4000 diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 3e3ff9d87f..fc4e22cd4d 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -303,7 +303,7 @@ #define EFFECT_STRENGTH_SAP 299 #define EFFECT_MIND_BLOWN 300 #define EFFECT_PURIFY 301 -#define EFFECT_BURN_UP 302 +#define EFFECT_FAIL_IF_NOT_ARG_TYPE 302 #define EFFECT_SHORE_UP 303 #define EFFECT_GEOMANCY 304 #define EFFECT_FAIRY_LOCK 305 @@ -348,7 +348,7 @@ #define EFFECT_EXTREME_EVOBOOST 344 #define EFFECT_HIT_SET_REMOVE_TERRAIN 345 #define EFFECT_DARK_VOID 346 -#define EFFECT_DOUBLE_SHOCK 347 +#define EFFECT_UNUSED_347 347 #define EFFECT_VICTORY_DANCE 348 #define EFFECT_TEATIME 349 #define EFFECT_ATTACK_UP_USER_ALLY 350 diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index ccba1d2c48..971538b153 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -2022,12 +2022,8 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) ADJUST_SCORE(-9); break; - case EFFECT_BURN_UP: - if (!IS_BATTLER_OF_TYPE(battlerAtk, TYPE_FIRE)) - ADJUST_SCORE(-10); - break; - case EFFECT_DOUBLE_SHOCK: - if (!IS_BATTLER_OF_TYPE(battlerAtk, TYPE_ELECTRIC)) + case EFFECT_FAIL_IF_NOT_ARG_TYPE: + if (!IS_BATTLER_OF_TYPE(battlerAtk, gBattleMoves[move].argument)) ADJUST_SCORE(-10); break; case EFFECT_DEFOG: diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 52640ab992..26e4d00570 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -585,7 +585,7 @@ static void Cmd_trysetsnatch(void); static void Cmd_unused2(void); static void Cmd_switchoutabilities(void); static void Cmd_jumpifhasnohp(void); -static void Cmd_unused0xe4(void); +static void Cmd_jumpifnotcurrentmoveargtype(void); static void Cmd_pickup(void); static void Cmd_unused3(void); static void Cmd_unused4(void); @@ -844,7 +844,7 @@ void (* const gBattleScriptingCommandsTable[])(void) = Cmd_unused2, //0xE1 Cmd_switchoutabilities, //0xE2 Cmd_jumpifhasnohp, //0xE3 - Cmd_unused0xe4, //0xE4 + Cmd_jumpifnotcurrentmoveargtype, //0xE4 Cmd_pickup, //0xE5 Cmd_unused3, //0xE6 Cmd_unused4, //0xE7 @@ -974,8 +974,7 @@ static const u16 sFinalStrikeOnlyEffects[] = { MOVE_EFFECT_BUG_BITE, MOVE_EFFECT_STEAL_ITEM, - MOVE_EFFECT_BURN_UP, - MOVE_EFFECT_DOUBLE_SHOCK, + MOVE_EFFECT_REMOVE_ARG_TYPE, MOVE_EFFECT_SMACK_DOWN, MOVE_EFFECT_REMOVE_STATUS, MOVE_EFFECT_RECOIL_HP_25, @@ -3640,15 +3639,20 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattleMons[gBattlerTarget].status2 |= STATUS2_ESCAPE_PREVENTION; gBattleMons[gBattlerAttacker].status2 |= STATUS2_ESCAPE_PREVENTION; break; - case MOVE_EFFECT_BURN_UP: + case MOVE_EFFECT_REMOVE_ARG_TYPE: // This seems unnecessary but is done to make it work properly with Parental Bond BattleScriptPush(gBattlescriptCurrInstr + 1); - gBattlescriptCurrInstr = BattleScript_BurnUpRemoveType; - break; - case MOVE_EFFECT_DOUBLE_SHOCK: - // This seems unnecessary but is done to make it work properly with Parental Bond - BattleScriptPush(gBattlescriptCurrInstr + 1); - gBattlescriptCurrInstr = BattleScript_DoubleShockRemoveType; + switch (gBattleMoves[gCurrentMove].argument) + { + case TYPE_FIRE: + gBattlescriptCurrInstr = BattleScript_RemoveFireType; + break; + case TYPE_ELECTRIC: + gBattlescriptCurrInstr = BattleScript_RemoveElectricType; + break; + default: // to do - add a generic case + break; + } break; case MOVE_EFFECT_ROUND: TryUpdateRoundTurnOrder(); // If another Pokémon uses Round before the user this turn, the user will use Round directly after it @@ -14427,8 +14431,17 @@ static void Cmd_jumpifhasnohp(void) gBattlescriptCurrInstr = cmd->nextInstr; } -static void Cmd_unused0xe4(void) +static void Cmd_jumpifnotcurrentmoveargtype(void) { + CMD_ARGS(u8 battler, const u8 *failInstr); + + u8 battler = GetBattlerForBattleScript(cmd->battler); + const u8 *failInstr = cmd->failInstr; + + if (!IS_BATTLER_OF_TYPE(battler, gBattleMoves[gCurrentMove].argument)) + gBattlescriptCurrInstr = failInstr; + else + gBattlescriptCurrInstr = cmd->nextInstr; } static void Cmd_pickup(void) diff --git a/src/battle_tv.c b/src/battle_tv.c index 62071b5bed..5a29a354aa 100644 --- a/src/battle_tv.c +++ b/src/battle_tv.c @@ -415,7 +415,6 @@ static const u16 sPoints_MoveEffect[NUM_BATTLE_MOVE_EFFECTS] = [EFFECT_EXTREME_EVOBOOST] = 0, // TODO: Assign points [EFFECT_HIT_SET_REMOVE_TERRAIN] = 0, // TODO: Assign points [EFFECT_DARK_VOID] = 0, // TODO: Assign points - [EFFECT_DOUBLE_SHOCK] = 0, // TODO: Assign points [EFFECT_VICTORY_DANCE] = 0, // TODO: Assign points }; diff --git a/src/battle_util.c b/src/battle_util.c index 4599a817f3..8242d956f8 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3784,7 +3784,7 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) case CANCELLER_THAW: // move thawing if (gBattleMons[gBattlerAttacker].status1 & STATUS1_FREEZE) { - if (!(gBattleMoves[gCurrentMove].effect == EFFECT_BURN_UP && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_FIRE))) + if (!(MoveHasMoveEffectSelfArg(gCurrentMove, MOVE_EFFECT_REMOVE_ARG_TYPE, TYPE_FIRE) && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_FIRE))) { gBattleMons[gBattlerAttacker].status1 &= ~STATUS1_FREEZE; BattleScriptPushCursor(); @@ -3795,7 +3795,7 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) } if (gBattleMons[gBattlerAttacker].status1 & STATUS1_FROSTBITE && gBattleMoves[gCurrentMove].thawsUser) { - if (!(gBattleMoves[gCurrentMove].effect == EFFECT_BURN_UP && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_FIRE))) + if (!(MoveHasMoveEffectSelfArg(gCurrentMove, MOVE_EFFECT_REMOVE_ARG_TYPE, TYPE_FIRE) && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_FIRE))) { gBattleMons[gBattlerAttacker].status1 &= ~STATUS1_FROSTBITE; BattleScriptPushCursor(); @@ -11453,6 +11453,11 @@ bool32 MoveHasMoveEffectSelf(u32 move, u32 moveEffect) return FALSE; } +bool32 MoveHasMoveEffectSelfArg(u32 move, u32 moveEffect, u32 argument) +{ + return (gBattleMoves[move].argument == argument) && MoveHasMoveEffectSelf(move, moveEffect); +} + bool8 CanMonParticipateInSkyBattle(struct Pokemon *mon) { u16 species = GetMonData(mon, MON_DATA_SPECIES); diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index b00c8c880a..fe0792a820 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -10635,7 +10635,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_DYNAMAX] = [MOVE_BURN_UP] = { - .effect = EFFECT_BURN_UP, + .effect = EFFECT_FAIL_IF_NOT_ARG_TYPE, .power = 130, .type = TYPE_FIRE, .accuracy = 100, @@ -10644,6 +10644,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_DYNAMAX] = .priority = 0, .category = BATTLE_CATEGORY_SPECIAL, .thawsUser = TRUE, + .argument = TYPE_FIRE, + ADDITIONAL_EFFECTS( + PRIMARY_EFFECT_SELF(MOVE_EFFECT_REMOVE_ARG_TYPE) + ), }, [MOVE_SPEED_SWAP] = @@ -13414,7 +13418,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_DYNAMAX] = [MOVE_DOUBLE_SHOCK] = { - .effect = EFFECT_DOUBLE_SHOCK, + .effect = EFFECT_FAIL_IF_NOT_ARG_TYPE, .power = 120, .type = TYPE_ELECTRIC, .accuracy = 100, @@ -13424,6 +13428,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_DYNAMAX] = .category = BATTLE_CATEGORY_PHYSICAL, .makesContact = TRUE, .metronomeBanned = TRUE, + .argument = TYPE_ELECTRIC, + ADDITIONAL_EFFECTS( + PRIMARY_EFFECT_SELF(MOVE_EFFECT_REMOVE_ARG_TYPE) + ), }, [MOVE_GIGATON_HAMMER] = diff --git a/test/battle/move_effect/burn_up.c b/test/battle/move_effect/burn_up.c index d24e47992c..cffddf6048 100644 --- a/test/battle/move_effect/burn_up.c +++ b/test/battle/move_effect/burn_up.c @@ -3,7 +3,8 @@ ASSUMPTIONS { - ASSUME(gBattleMoves[MOVE_BURN_UP].effect == EFFECT_BURN_UP); + ASSUME(gBattleMoves[MOVE_BURN_UP].effect == EFFECT_FAIL_IF_NOT_ARG_TYPE); + ASSUME(MoveHasMoveEffectSelfArg(MOVE_BURN_UP, MOVE_EFFECT_REMOVE_ARG_TYPE, TYPE_FIRE) == TRUE); ASSUME(gSpeciesInfo[SPECIES_WOBBUFFET].types[0] != TYPE_FIRE || gSpeciesInfo[SPECIES_WOBBUFFET].types[1] != TYPE_FIRE); ASSUME(gSpeciesInfo[SPECIES_CYNDAQUIL].types[0] == TYPE_FIRE || gSpeciesInfo[SPECIES_CYNDAQUIL].types[1] == TYPE_FIRE); } diff --git a/test/battle/move_effect/double_shock.c b/test/battle/move_effect/double_shock.c index 89f7586815..7357a10fec 100644 --- a/test/battle/move_effect/double_shock.c +++ b/test/battle/move_effect/double_shock.c @@ -3,7 +3,8 @@ ASSUMPTIONS { - ASSUME(gBattleMoves[MOVE_DOUBLE_SHOCK].effect == EFFECT_DOUBLE_SHOCK); + ASSUME(gBattleMoves[MOVE_DOUBLE_SHOCK].effect == EFFECT_FAIL_IF_NOT_ARG_TYPE); + ASSUME(MoveHasMoveEffectSelfArg(MOVE_DOUBLE_SHOCK, MOVE_EFFECT_REMOVE_ARG_TYPE, TYPE_ELECTRIC) == TRUE); ASSUME(gSpeciesInfo[SPECIES_WOBBUFFET].types[0] != TYPE_ELECTRIC || gSpeciesInfo[SPECIES_WOBBUFFET].types[1] != TYPE_ELECTRIC); ASSUME(gSpeciesInfo[SPECIES_PIKACHU].types[0] == TYPE_ELECTRIC || gSpeciesInfo[SPECIES_PIKACHU].types[1] == TYPE_ELECTRIC); }