diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 32658412b..890202a0c 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1588,6 +1588,10 @@ .macro spectralthiefprintstats various BS_ATTACKER, VARIOUS_SPECTRAL_THIEF .endm + + .macro bringdownairbornebattler battler:req + various \battler, VARIOUS_GRAVITY_ON_AIRBORNE_MONS + .endm @ helpful macros .macro setstatchanger stat:req, stages:req, down:req diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index fe5dd7dd3..087dbd4b4 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -1601,7 +1601,20 @@ BattleScript_EffectGravity: waitanimation printstring STRINGID_GRAVITYINTENSIFIED waitmessage 0x40 - goto BattleScript_MoveEnd + selectfirstvalidtarget +BattleScript_GravityLoop: + movevaluescleanup + jumpifstatus3 BS_TARGET, STATUS3_ON_AIR | STATUS3_MAGNET_RISE | STATUS3_TELEKINESIS, BattleScript_GravityLoopDrop + goto BattleScript_GravityLoopEnd +BattleScript_GravityLoopDrop: + bringdownairbornebattler BS_TARGET + printstring STRINGID_GRAVITYGROUNDING + waitmessage 0x40 +BattleScript_GravityLoopEnd: + setbyte sMOVEEND_STATE, 0x0 + moveend 0x2, 0x10 + jumpifnexttargetvalid BattleScript_GravityLoop + end BattleScript_EffectRoost: attackcanceler diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 11f57f6fe..ac815da69 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -136,6 +136,7 @@ #define VARIOUS_ACUPRESSURE 73 #define VARIOUS_SET_POWDER 74 #define VARIOUS_SPECTRAL_THIEF 75 +#define VARIOUS_GRAVITY_ON_AIRBORNE_MONS 76 // 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 8c863c2a7..745fc5469 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -518,7 +518,8 @@ #define STRINGID_POWDEREXPLODES 514 #define STRINGID_BELCHCANTSELECT 515 #define STRINGID_SPECTRALTHIEFSTEAL 516 +#define STRINGID_GRAVITYGROUNDING 517 -#define BATTLESTRINGS_COUNT 528 +#define BATTLESTRINGS_COUNT 529 #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H diff --git a/src/battle_message.c b/src/battle_message.c index 82060876f..7034931f0 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -626,7 +626,7 @@ static const u8 sText_TerrainBecomesElectric[] = _("An electric current runs acr static const u8 sText_TerrainBecomesPsychic[] = _("The battlefield got weird!"); static const u8 sText_TargetElectrified[] = _("The opposing {B_ATK_NAME_WITH_PREFIX}'s moves\nhave been electrified!"); static const u8 sText_AssaultVestDoesntAllow[] = _("The effects of the {B_LAST_ITEM} prevent status\nmoves from being used!\p"); -static const u8 sText_GravityPreventsUsage[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} can't use {B_CURRENT_MOVE}\nbecause of gravity!\p"); +static const u8 sText_GravityPreventsUsage[] = _("{B_ATK_NAME_WITH_PREFIX} can't use {B_CURRENT_MOVE}\nbecause of gravity!\p"); static const u8 sText_HealBlockPreventsUsage[] = _("The opposing {B_ATK_NAME_WITH_PREFIX} was\nprevented from healing!\p"); static const u8 sText_MegaEvoReacting[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_LAST_ITEM} is reacting\nto {B_ATK_TRAINER_NAME}'s Mega Ring!"); static const u8 sText_MegaEvoEvolved[] = _("{B_ATK_NAME_WITH_PREFIX} has Mega\nEvolved into Mega {B_BUFF1}!"); @@ -643,6 +643,7 @@ static const u8 sText_CoveredInPowder[] = _("{B_DEF_NAME_WITH_PREFIX} is covered static const u8 sText_PowderExplodes[] = _("When the flame touched the powder\non the Pokémon, it exploded!"); static const u8 sText_BelchCantUse[] = _("Belch cannot be used!\p"); static const u8 sText_SpectralThiefSteal[] = _("{B_ATK_NAME_WITH_PREFIX} stole the target's\nboosted stats!"); +static const u8 sText_GravityGrounding[] = _("{B_DEF_NAME_WITH_PREFIX} can't stay airborne\nbecause of gravity!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { @@ -1151,6 +1152,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_POKEMONCANNOTUSEMOVE - 12] = sText_PokemonCannotUseMove, [STRINGID_COVEREDINPOWDER - 12] = sText_CoveredInPowder, [STRINGID_POWDEREXPLODES - 12] = sText_PowderExplodes, + [STRINGID_GRAVITYGROUNDING - 12] = sText_GravityGrounding, }; const u16 gTerrainStringIds[] = diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d3be76bf6..2a5bfe9e3 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -5828,10 +5828,6 @@ static void atk69_setgravity(void) gFieldStatuses |= STATUS_FIELD_GRAVITY; gFieldTimers.gravityTimer = 5; - - for (i = 0; i < MAX_BATTLERS_COUNT; i++) - gStatuses3[i] &= ~(STATUS3_MAGNET_RISE | STATUS3_TELEKINESIS | STATUS3_ON_AIR); - gBattlescriptCurrInstr += 5; } } @@ -6371,6 +6367,12 @@ static void atk76_various(void) switch (gBattlescriptCurrInstr[2]) { + case VARIOUS_GRAVITY_ON_AIRBORNE_MONS: + if (gStatuses3[gActiveBattler] & STATUS3_ON_AIR) + CancelMultiTurnMoves(gActiveBattler); + + gStatuses3[gActiveBattler] &= ~(STATUS3_MAGNET_RISE | STATUS3_TELEKINESIS | STATUS3_ON_AIR); + break; case VARIOUS_SPECTRAL_THIEF: // Raise stats for (i = STAT_ATK; i < NUM_BATTLE_STATS; i++)