diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 9dac5beff..66d989b9d 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1223,6 +1223,16 @@ .4byte \ptr .endm + .macro swapstatstages stat + .byte 0xfa + .byte \stat + .endm + + .macro averagestats stat + .byte 0xfb + .byte \stat + .endm + @ various command changed to more readable macros .macro cancelmultiturnmoves bank various \bank, VARIOUS_CANCEL_MULTI_TURN_MOVES diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 3feef4056..46e4aec6b 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -265,6 +265,81 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectGastroAcid .4byte BattleScript_EffectStealthRock .4byte BattleScript_EffectTelekinesis + .4byte BattleScript_EffectPowerSwap + .4byte BattleScript_EffectGuardSwap + .4byte BattleScript_EffectHeartSwap + .4byte BattleScript_EffectPowerSplit + .4byte BattleScript_EffectGuardSplit + +BattleScript_EffectPowerSplit: + attackcanceler + attackstring + ppreduce + accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON + averagestats STAT_ATK + averagestats STAT_SPATK + attackanimation + waitanimation + printstring STRINGID_SHAREDITSPOWER + waitmessage 0x40 + goto BattleScript_MoveEnd + +BattleScript_EffectGuardSplit: + attackcanceler + attackstring + ppreduce + accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON + averagestats STAT_DEF + averagestats STAT_SPDEF + attackanimation + waitanimation + printstring STRINGID_SHAREDITSGUARD + waitmessage 0x40 + goto BattleScript_MoveEnd + +BattleScript_EffectHeartSwap: + attackcanceler + attackstring + ppreduce + accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON + swapstatstages STAT_ATK + swapstatstages STAT_DEF + swapstatstages STAT_SPEED + swapstatstages STAT_SPATK + swapstatstages STAT_SPDEF + swapstatstages STAT_EVASION + swapstatstages STAT_ACC + attackanimation + waitanimation + printstring STRINGID_PKMNSWITCHEDSTATCHANGES + waitmessage 0x40 + goto BattleScript_MoveEnd + +BattleScript_EffectPowerSwap: + attackcanceler + attackstring + ppreduce + accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON + swapstatstages STAT_ATK + swapstatstages STAT_SPATK + attackanimation + waitanimation + printstring STRINGID_PKMNSWITCHEDSTATCHANGES + waitmessage 0x40 + goto BattleScript_MoveEnd + +BattleScript_EffectGuardSwap: + attackcanceler + attackstring + ppreduce + accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON + swapstatstages STAT_DEF + swapstatstages STAT_SPDEF + attackanimation + waitanimation + printstring STRINGID_PKMNSWITCHEDSTATCHANGES + waitmessage 0x40 + goto BattleScript_MoveEnd BattleScript_EffectTelekinesis: attackcanceler @@ -2700,7 +2775,7 @@ BattleScript_EffectEndeavor:: adjustdamage goto BattleScript_HitFromAtkAnimation -BattleScript_EffectSkillSwap:: +BattleScript_EffectSkillSwap: attackcanceler attackstring ppreduce diff --git a/data/text/move_names.inc b/data/text/move_names.inc index 0060c27a5..0406e53b4 100644 --- a/data/text/move_names.inc +++ b/data/text/move_names.inc @@ -467,3 +467,96 @@ gMoveNames:: @ 831977C .string "Seed Flare$", 13 .string "Ominous Wind$", 13 .string "Shadow Force$", 13 + .string "Hone Claws$", 13 + .string "Wide Guard$", 13 + .string "Guard Split$", 13 + .string "Power Split$", 13 + .string "Wonder Room$", 13 + .string "Psyshock$", 13 + .string "Venoshock$", 13 + .string "Autotomize$", 13 + .string "Rage Powder$", 13 + .string "Telekinesis$", 13 + .string "Magic Room$", 13 + .string "Smack Down$", 13 + .string "Storm Throw$", 13 + .string "Flame Burst$", 13 + .string "Sludge Wave$", 13 + .string "Quiver Dance$", 13 + .string "Heavy Slam$", 13 + .string "Synchronoise$", 13 + .string "Electro Ball$", 13 + .string "Soak$", 13 + .string "Flame Charge$", 13 + .string "Coil$", 13 + .string "Low Sweep$", 13 + .string "Acid Spray$", 13 + .string "Foul Play$", 13 + .string "Simple Beam$", 13 + .string "Entrainment$", 13 + .string "After You$", 13 + .string "Round$", 13 + .string "Echoed Voice$", 13 + .string "Chip Away$", 13 + .string "Clear Smog$", 13 + .string "Stored Power$", 13 + .string "Quick Guard$", 13 + .string "Ally Switch$", 13 + .string "Scald$", 13 + .string "Shell Smash$", 13 + .string "Heal Pulse$", 13 + .string "Hex$", 13 + .string "Sky Drop$", 13 + .string "Shift Gear$", 13 + .string "Circle Throw$", 13 + .string "Incinerate$", 13 + .string "Quash$", 13 + .string "Acrobatics$", 13 + .string "Reflect Type$", 13 + .string "Retaliate$", 13 + .string "Final Gambit$", 13 + .string "Bestow$", 13 + .string "Inferno$", 13 + .string "Water Pledge$", 13 + .string "Fire Pledge$", 13 + .string "Grass Pledge$", 13 + .string "Volt Switch$", 13 + .string "Struggle Bug$", 13 + .string "Bulldoze$", 13 + .string "Frost Breath$", 13 + .string "Dragon Tail$", 13 + .string "Work Up$", 13 + .string "Electroweb$", 13 + .string "Wild Charge$", 13 + .string "Drill Run$", 13 + .string "Dual Chop$", 13 + .string "Heart Stamp$", 13 + .string "Horn Leech$", 13 + .string "Sacred Sword$", 13 + .string "Razor Shell$", 13 + .string "Heat Crash$", 13 + .string "Leaf Tornado$", 13 + .string "Steamroller$", 13 + .string "Cotton Guard$", 13 + .string "Night Daze$", 13 + .string "Psystrike$", 13 + .string "Tail Slap$", 13 + .string "Hurricane$", 13 + .string "Head Charge$", 13 + .string "Gear Grind$", 13 + .string "Searing Shot$", 13 + .string "Techno Blast$", 13 + .string "Relic Song$", 13 + .string "Secret Sword$", 13 + .string "Glaciate$", 13 + .string "Bolt Strike$", 13 + .string "Blue Flare$", 13 + .string "Fiery Dance$", 13 + .string "Freeze Shock$", 13 + .string "Ice Burn$", 13 + .string "Snarl$", 13 + .string "Icicle Crash$", 13 + .string "V Create$", 13 + .string "Fusion Flare$", 13 + .string "Fusion Bolt$", 13 + .string "Flying Press$", 13 diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 72b569e62..4ee416b3c 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -254,5 +254,10 @@ #define EFFECT_GASTRO_ACID 248 #define EFFECT_STEALTH_ROCK 249 #define EFFECT_TELEKINESIS 250 +#define EFFECT_POWER_SWAP 251 +#define EFFECT_GUARD_SWAP 252 +#define EFFECT_HEART_SWAP 253 +#define EFFECT_POWER_SPLIT 254 +#define EFFECT_GUARD_SPLIT 255 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/data/battle_moves.h b/include/data/battle_moves.h index c70e24615..6cd5cd709 100644 --- a/include/data/battle_moves.h +++ b/include/data/battle_moves.h @@ -5656,7 +5656,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] = .split = SPLIT_STATUS, }, { // MOVE_POWER_SPLIT - .effect = EFFECT_PLACEHOLDER_209, + .effect = EFFECT_POWER_SPLIT, .power = 0, .type = TYPE_PSYCHIC, .accuracy = 0, diff --git a/src/battle_debug.c b/src/battle_debug.c index 145a408ae..105af0aa5 100644 --- a/src/battle_debug.c +++ b/src/battle_debug.c @@ -1134,7 +1134,7 @@ static void SetUpModifyArrows(struct BattleDebugMenu *data) break; case LIST_ITEM_MOVES: data->modifyArrows.minValue = 0; - data->modifyArrows.maxValue = MOVES_COUNT - 1; + data->modifyArrows.maxValue = MOVES_COUNT_GEN5 - 1; data->modifyArrows.maxDigits = 3; data->modifyArrows.modifiedValPtr = &gBattleMons[data->battlerId].moves[data->currentSecondaryListItemId]; data->modifyArrows.typeOfVal = VAL_U16; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 339b571f2..f28ec7a80 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -341,6 +341,8 @@ static void atkF6_finishaction(void); static void atkF7_finishturn(void); static void atkF8_trainerslideout(void); static void atkF9_settelekinesis(void); +static void atkFA_swapstatstages(void); +static void atkFB_averagestats(void); void (* const gBattleScriptingCommandsTable[])(void) = { @@ -594,6 +596,8 @@ void (* const gBattleScriptingCommandsTable[])(void) = atkF7_finishturn, atkF8_trainerslideout, atkF9_settelekinesis, + atkFA_swapstatstages, + atkFB_averagestats, }; struct StatFractions @@ -10247,3 +10251,28 @@ static void atkF9_settelekinesis(void) gBattlescriptCurrInstr += 5; } } + +static void atkFA_swapstatstages(void) +{ + u8 statId = T1_READ_8(gBattlescriptCurrInstr + 1); + s8 atkStatStage = gBattleMons[gBattlerAttacker].statStages[statId]; + s8 defStatStage = gBattleMons[gBattlerTarget].statStages[statId]; + + gBattleMons[gBattlerAttacker].statStages[statId] = defStatStage; + gBattleMons[gBattlerTarget].statStages[statId] = atkStatStage; + + gBattlescriptCurrInstr += 2; +} + +static void atkFB_averagestats(void) +{ + u8 statId = T1_READ_8(gBattlescriptCurrInstr + 1); + u16 atkStat = *(u16*)((&gBattleMons[gBattlerAttacker].attack) + (statId - 1)); + u16 defStat = *(u16*)((&gBattleMons[gBattlerTarget].attack) + (statId - 1)); + u16 average = (atkStat + defStat) / 2; + + *(u16*)((&gBattleMons[gBattlerAttacker].attack) + (statId - 1)) = average; + *(u16*)((&gBattleMons[gBattlerTarget].attack) + (statId - 1)) = average; + + gBattlescriptCurrInstr += 2; +}