diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 689cd8855a..7db4856fad 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1497,6 +1497,11 @@ .4byte \ptr .endm + .macro jumpifcantusesynchronoise ptr + various BS_ATTACKER, VARIOUS_TRY_SYNCHRONOISE + .4byte \ptr + .endm + .macro trycopycat ptr various BS_ATTACKER, VARIOUS_TRY_COPYCAT .4byte \ptr diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 1f487d87a7..125b077f28 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -319,6 +319,59 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectCopycat .4byte BattleScript_EffectDefog .4byte BattleScript_EffectHitEnemyHealAlly + .4byte BattleScript_EffectSmackDown + .4byte BattleScript_EffectSynchronoise + +BattleScript_EffectSynchronoise: + attackcanceler + attackstring + ppreduce + selectfirstvalidtarget +BattleScript_SynchronoiseLoop: + movevaluescleanup + jumpifcantusesynchronoise BattleScript_SynchronoiseNoEffect + accuracycheck BattleScript_SynchronoiseMissed, ACC_CURR_MOVE + critcalc + damagecalc + adjustdamage + attackanimation + waitanimation + effectivenesssound + hitanimation BS_TARGET + waitstate + healthbarupdate BS_TARGET + datahpupdate BS_TARGET + critmessage + waitmessage 0x40 + resultmessage + waitmessage 0x40 + printstring STRINGID_EMPTYSTRING3 + waitmessage 0x1 + tryfaintmon BS_TARGET, FALSE, NULL +BattleScript_SynchronoiseMoveTargetEnd: + setbyte sMOVEEND_STATE, 0x0 + moveend 0x2, 0x10 + jumpifnexttargetvalid BattleScript_SynchronoiseLoop + end +BattleScript_SynchronoiseMissed: + pause 0x20 + resultmessage + waitmessage 0x40 + goto BattleScript_SynchronoiseMoveTargetEnd +BattleScript_SynchronoiseNoEffect: + pause 0x20 + printstring STRINGID_NOEFFECTONTARGET + waitmessage 0x40 + goto BattleScript_SynchronoiseMoveTargetEnd + +BattleScript_EffectSmackDown: + setmoveeffect MOVE_EFFECT_SMACK_DOWN + goto BattleScript_EffectHit + +BattleScript_MoveEffectSmackDown:: + printstring STRINGID_FELLSTRAIGHTDOWN + waitmessage 0x40 + return BattleScript_EffectHitEnemyHealAlly: jumpiftargetally BattleScript_EffectHealPulse diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 4370504e75..e96babfb5f 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -278,5 +278,6 @@ extern const u8 BattleScript_EffectWithChance[]; extern const u8 BattleScript_MoveEffectClearSmog[]; extern const u8 BattleScript_ForceRandomSwitch[]; extern const u8 BattleScript_SideStatusWoreOffReturn[]; +extern const u8 BattleScript_MoveEffectSmackDown[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/battle_util.h b/include/battle_util.h index 727f9d07f3..3f14bd59f3 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -91,5 +91,6 @@ s32 GetStealthHazardDamage(u8 hazardType, u8 battlerId); u16 GetMegaEvolutionSpecies(u16 preEvoSpecies, u16 heldItemId); bool32 CanMegaEvolve(u8 battlerId); void UndoMegaEvolution(u8 monId); +bool32 DoBattlersShareType(u32 battler1, u32 battler2); #endif // GUARD_BATTLE_UTIL_H diff --git a/include/constants/battle.h b/include/constants/battle.h index a583da05ca..0e61152450 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -314,7 +314,7 @@ #define MOVE_EFFECT_RECOIL_50 0x39 #define MOVE_EFFECT_CLEAR_SMOG 0x3A #define MOVE_EFFECT_SP_ATK_TWO_DOWN 0x3B -#define MOVE_EFFECT_NOTHING_3C 0x3C +#define MOVE_EFFECT_SMACK_DOWN 0x3C #define MOVE_EFFECT_NOTHING_3D 0x3D #define MOVE_EFFECT_NOTHING_3E 0x3E #define MOVE_EFFECT_NOTHING_3F 0x3F diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index fb641e3299..b2d3788012 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -308,5 +308,7 @@ #define EFFECT_COPYCAT 302 #define EFFECT_DEFOG 303 #define EFFECT_HIT_ENEMY_HEAL_ALLY 304 // Pollen Puff +#define EFFECT_SMACK_DOWN 305 +#define EFFECT_SYNCHRONOISE 306 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 518c6a1036..96503f298d 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -110,6 +110,7 @@ #define VARIOUS_ABILITY_POPUP 57 #define VARIOUS_DEFOG 58 #define VARIOUS_JUMP_IF_TARGET_ALLY 59 +#define VARIOUS_TRY_SYNCHRONOISE 60 // atk80, dmg manipulation #define ATK80_DMG_CHANGE_SIGN 0 diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 1c4e489751..ba44bdeb1e 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -507,6 +507,7 @@ #define STRINGID_DRASTICALLY 504 #define STRINGID_SEVERELY 505 #define STRINGID_INFESTATION 506 +#define STRINGID_NOEFFECTONTARGET 507 #define BATTLESTRINGS_COUNT 519 diff --git a/src/battle_interface.c b/src/battle_interface.c index 69d38fc50a..f0a3af8420 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -3183,8 +3183,8 @@ static void SpriteCb_AbilityPopUp(struct Sprite *sprite) { if (sprite->tIsMain && ++sprite->tFrames == 4) PlaySE(SE_SELECT); - if ((!sprite->tRightToLeft && (sprite->pos1.x -= 3) <= sprite->tOriginalX) - || (sprite->tRightToLeft && (sprite->pos1.x += 3) >= sprite->tOriginalX) + if ((!sprite->tRightToLeft && (sprite->pos1.x -= 4) <= sprite->tOriginalX) + || (sprite->tRightToLeft && (sprite->pos1.x += 4) >= sprite->tOriginalX) ) { sprite->pos1.x = sprite->tOriginalX; @@ -3196,8 +3196,8 @@ static void SpriteCb_AbilityPopUp(struct Sprite *sprite) { if (sprite->tFrames == 0) { - if ((!sprite->tRightToLeft && (sprite->pos1.x += 3) >= sprite->tOriginalX + ABILITY_POP_UP_POS_X_SLIDE) - ||(sprite->tRightToLeft && (sprite->pos1.x -= 3) <= sprite->tOriginalX - ABILITY_POP_UP_POS_X_SLIDE) + if ((!sprite->tRightToLeft && (sprite->pos1.x += 4) >= sprite->tOriginalX + ABILITY_POP_UP_POS_X_SLIDE) + ||(sprite->tRightToLeft && (sprite->pos1.x -= 4) <= sprite->tOriginalX - ABILITY_POP_UP_POS_X_SLIDE) ) { gBattleStruct->activeAbilityPopUps &= ~(gBitTable[sprite->tBattlerId]); diff --git a/src/battle_message.c b/src/battle_message.c index d5bbbebcc8..22a32638a6 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -648,6 +648,7 @@ static const u8 sText_MegaEvoEvolved[] = _("{B_ATK_NAME_WITH_PREFIX} has Mega\nE static const u8 sText_drastically[] = _("drastically "); static const u8 sText_severely[] = _("severely "); static const u8 sText_Infestation[] = _("{B_DEF_NAME_WITH_PREFIX} has been afflicted\nwith an infestation by {B_ATK_NAME_WITH_PREFIX}!"); +static const u8 sText_NoEffectOnTarget[] = _("It had no effect\non {B_DEF_NAME_WITH_PREFIX}!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { @@ -1147,6 +1148,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = sText_drastically, sText_severely, sText_Infestation, + sText_NoEffectOnTarget, }; const u16 gTerrainStringIds[] = diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 4a41b34ad4..e1e58616ad 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2702,6 +2702,15 @@ void SetMoveEffect(bool8 primary, u8 certain) gBattlescriptCurrInstr = BattleScript_MoveEffectClearSmog; } break; + case MOVE_EFFECT_SMACK_DOWN: + if (!IsBattlerGrounded(gBattlerTarget)) + { + gStatuses3[gBattlerTarget] |= STATUS3_SMACKED_DOWN; + gStatuses3[gBattlerTarget] &= ~(STATUS3_MAGNET_RISE | STATUS3_TELEKINESIS | STATUS3_ON_AIR); + BattleScriptPush(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = BattleScript_MoveEffectSmackDown; + } + break; } } } @@ -6844,6 +6853,12 @@ static void atk76_various(void) else gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); return; + case VARIOUS_TRY_SYNCHRONOISE: + if (!DoBattlersShareType(gBattlerAttacker, gBattlerTarget)) + gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); + else + gBattlescriptCurrInstr += 7; + return; } gBattlescriptCurrInstr += 3; diff --git a/src/battle_util.c b/src/battle_util.c index 244c77cd3a..17ce185af7 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5670,3 +5670,13 @@ void UndoMegaEvolution(u8 monId) CalculateMonStats(&gPlayerParty[monId]); } } + +bool32 DoBattlersShareType(u32 battler1, u32 battler2) +{ + if (gBattleMons[battler1].type1 == gBattleMons[battler2].type1 || gBattleMons[battler1].type1 == gBattleMons[battler2].type2) + return TRUE; + else if (gBattleMons[battler1].type2 == gBattleMons[battler2].type1 || gBattleMons[battler1].type2 == gBattleMons[battler2].type2) + return TRUE; + else + return FALSE; +} diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index ecef5a3a45..fd25be5de4 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -5757,12 +5757,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .split = SPLIT_STATUS, }, { // MOVE_SMACK_DOWN - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect + .effect = EFFECT_SMACK_DOWN, .power = 50, .type = TYPE_ROCK, .accuracy = 100, .pp = 15, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGSROCK_AFFECTED, @@ -5829,7 +5829,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .split = SPLIT_PHYSICAL, }, { // MOVE_SYNCHRONOISE - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect + .effect = EFFECT_SYNCHRONOISE, .power = 120, .type = TYPE_PSYCHIC, .accuracy = 100, @@ -7416,7 +7416,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .split = SPLIT_PHYSICAL, }, { // MOVE_LIGHT_OF_RUIN - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect (same as HEAD_SMASH) + .effect = EFFECT_RECOIL_50, .power = 140, .type = TYPE_FAIRY, .accuracy = 90,