diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index cc89e0aae..debac5acb 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1440,6 +1440,10 @@ .4byte \ptr .endm + .macro invertstatstages battler + various \battler, VARIOUS_INVERT_STAT_STAGES + .endm + @ helpful macros .macro setstatchanger stat, stages, down setbyte sSTATCHANGER \stat | \stages << 4 | \down << 7 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 4f877d11a..e8a6f2ad3 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -279,6 +279,41 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectEntrainment .4byte BattleScript_EffectHealPulse .4byte BattleScript_EffectQuash + .4byte BattleScript_EffectIonDeluge + .4byte BattleScript_EffectFreezeDry + .4byte BattleScript_EffectTopsyTurvy + +BattleScript_EffectTopsyTurvy: + attackcanceler + attackstring + ppreduce + accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON + jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_ATK, 6, BattleScript_EffectTopsyTurvyWorks + jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_DEF, 6, BattleScript_EffectTopsyTurvyWorks + jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_SPATK, 6, BattleScript_EffectTopsyTurvyWorks + jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_SPDEF, 6, BattleScript_EffectTopsyTurvyWorks + jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_SPEED, 6, BattleScript_EffectTopsyTurvyWorks + jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_ACC, 6, BattleScript_EffectTopsyTurvyWorks + jumpifstat BS_TARGET, CMP_EQUAL, STAT_EVASION, 6, BattleScript_ButItFailed +BattleScript_EffectTopsyTurvyWorks: + attackanimation + waitanimation + invertstatstages BS_TARGET + printstring STRINGID_TOPSYTURVYSWITCHEDSTATS + waitmessage 0x40 + goto BattleScript_MoveEnd + +BattleScript_EffectIonDeluge: + attackcanceler + accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE + attackstring + ppreduce + orword gFieldStatuses, STATUS_FIELD_ION_DELUGE + attackanimation + waitanimation + printstring STRINGID_IONDELUGEON + waitmessage 0x40 + goto BattleScript_MoveEnd BattleScript_EffectQuash: attackcanceler @@ -740,6 +775,7 @@ BattleScript_EffectFoulPlay: BattleScript_EffectPsyshock: BattleScript_EffectWeatherBall: BattleScript_EffectHiddenPower: +BattleScript_EffectFreezeDry: jumpifnotmove MOVE_SURF, BattleScript_HitFromAtkCanceler jumpifnostatus3 BS_TARGET, STATUS3_UNDERWATER, BattleScript_HitFromAtkCanceler orword gHitMarker, HITMARKER_IGNORE_UNDERWATER diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index c81d259f8..ab0535993 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -268,5 +268,8 @@ #define EFFECT_ENTRAINMENT 262 #define EFFECT_HEAL_PULSE 263 #define EFFECT_QUASH 264 +#define EFFECT_ION_DELUGE 265 +#define EFFECT_FREEZE_DRY 266 +#define EFFECT_TOPSY_TURVY 267 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index eef80d608..0156f967b 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -90,6 +90,7 @@ #define VARIOUS_SET_LAST_USED_ABILITY 41 #define VARIOUS_TRY_HEAL_PULSE 42 #define VARIOUS_TRY_QUASH 43 +#define VARIOUS_INVERT_STAT_STAGES 44 // 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 abab41bb8..274514647 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -495,7 +495,9 @@ #define STRINGID_PKMNBLEWAWAYTOXICSPIKES 492 #define STRINGID_PKMNBLEWAWAYSTICKYWEB 493 #define STRINGID_PKMNBLEWAWAYSTEALTHROCK 494 +#define STRINGID_IONDELUGEON 495 +#define STRINGID_TOPSYTURVYSWITCHEDSTATS 496 -#define BATTLESTRINGS_COUNT 506 +#define BATTLESTRINGS_COUNT 516 #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H diff --git a/include/data/battle_moves.h b/include/data/battle_moves.h index 3db40d970..74ed8974d 100644 --- a/include/data/battle_moves.h +++ b/include/data/battle_moves.h @@ -6832,7 +6832,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] = .split = SPLIT_STATUS, }, { // MOVE_ION_DELUGE - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect + .effect = EFFECT_ION_DELUGE, .power = 0, .type = TYPE_ELECTRIC, .accuracy = 0, @@ -6880,7 +6880,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] = .split = SPLIT_PHYSICAL, }, { // MOVE_FREEZE_DRY - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect + .effect = EFFECT_FREEZE_DRY, .power = 70, .type = TYPE_ICE, .accuracy = 100, @@ -6916,7 +6916,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] = .split = SPLIT_STATUS, }, { // MOVE_TOPSY_TURVY - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect + .effect = EFFECT_TOPSY_TURVY, .power = 0, .type = TYPE_DARK, .accuracy = 0, diff --git a/src/battle_message.c b/src/battle_message.c index c8207b0a8..fbf8f516d 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -633,6 +633,8 @@ static const u8 sText_QuashSuccess[] = _(""); static const u8 sText_PkmnBlewAwayToxicSpikes[] = _("{B_ATK_NAME_WITH_PREFIX} blew away\nTOXIC SPIKES!"); static const u8 sText_PkmnBlewAwayStickyWeb[] = _("{B_ATK_NAME_WITH_PREFIX} blew away\nSTICKY WEB!"); static const u8 sText_PkmnBlewAwayStealthRock[] = _("{B_ATK_NAME_WITH_PREFIX} blew away\nSTEALTH ROCK!"); +static const u8 sText_IonDelugeOn[] = _(""); +static const u8 sText_TopsyTurvySwitchedStats[] = _(""); // New selection strings, they must end with "\p". // Use {B_LAST_ITEM} and {B_CURRENT_MOVE}. @@ -1126,6 +1128,8 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = sText_PkmnBlewAwayToxicSpikes, sText_PkmnBlewAwayStickyWeb, sText_PkmnBlewAwayStealthRock, + sText_IonDelugeOn, + sText_TopsyTurvySwitchedStats, }; const u16 gMagicCoatBounceStringIds[] = diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index bbb783d79..df89ddd92 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6430,6 +6430,15 @@ static void atk76_various(void) gBattlescriptCurrInstr += 7; } return; + case VARIOUS_INVERT_STAT_STAGES: + for (i = 0; i < BATTLE_STATS_NO; i++) + { + if (gBattleMons[gActiveBattler].statStages[i] < 6) // Negative becomes positive. + gBattleMons[gActiveBattler].statStages[i] = 6 + (6 - gBattleMons[gActiveBattler].statStages[i]); + else if (gBattleMons[gActiveBattler].statStages[i] > 6) // Positive becomes negative. + gBattleMons[gActiveBattler].statStages[i] = 6 - (gBattleMons[gActiveBattler].statStages[i] - 6); + } + break; } gBattlescriptCurrInstr += 3; diff --git a/src/battle_util.c b/src/battle_util.c index 6c190bd79..2f3d1cded 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -848,6 +848,7 @@ enum ENDTURN_MISTY_TERRAIN, ENDTURN_GRASSY_TERRAIN, ENDTURN_PSYCHIC_TERRAIN, + ENDTURN_ION_DELUGE, ENDTURN_FIELD_COUNT, }; @@ -1257,6 +1258,10 @@ u8 DoFieldEndTurnEffects(void) } gBattleStruct->turnCountersTracker++; break; + case ENDTURN_ION_DELUGE: + gFieldStatuses &= ~(STATUS_FIELD_ION_DELUGE); + gBattleStruct->turnCountersTracker++; + break; case ENDTURN_FIELD_COUNT: effect++; break; @@ -5410,7 +5415,7 @@ static inline void MulByTypeEffectiveness(u16 *modifier, u16 move, u8 moveType, mod = UQ_4_12(1.0); if (moveType == TYPE_PSYCHIC && defType == TYPE_DARK && gStatuses3[battlerDef] & STATUS3_MIRACLE_EYED) mod = UQ_4_12(1.0); - if (move == MOVE_FREEZE_DRY && defType == TYPE_WATER) + if (gBattleMoves[move].effect == EFFECT_FREEZE_DRY && defType == TYPE_WATER) mod = UQ_4_12(2.0); if (moveType == TYPE_GROUND && defType == TYPE_FLYING && IsBattlerGrounded(battlerDef)) mod = UQ_4_12(1.0);