From 3cde800bd0974ff676689c2014ca3188ca3d1fda Mon Sep 17 00:00:00 2001 From: Papa Cancer Date: Sat, 20 Apr 2019 20:17:56 +0100 Subject: [PATCH] Magnetic Flux + Gear Up Both have the same effect so they're in one commit. Uses custom script to check both user and partner for stats and abilities. Magnetic Flux uses Charge animation. --- asm/macros/battle_script.inc | 9 +++ data/battle_anim_scripts.s | 4 +- data/battle_scripts_1.s | 80 +++++++++++++++++++++++++ include/constants/battle_move_effects.h | 2 + src/data/battle_moves.h | 6 +- 5 files changed, 95 insertions(+), 6 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index b6d498982..3dfba0dc2 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1749,3 +1749,12 @@ 1: .endm + .macro setallytonexttarget jumpptr:req + jumpifbyte CMP_GREATER_THAN, gBattlerTarget, 0x1, 1f + addbyte gBattlerTarget, 0x2 + goto \jumpptr + 1: + subbyte gBattlerTarget, 0x2 + goto \jumpptr + .endm + diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 6cbee2044..54d9e4128 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -2825,9 +2825,6 @@ Move_POWDER: Move_GEOMANCY: end -Move_MAGNETIC_FLUX: - end - Move_HAPPY_HOUR: end @@ -6035,6 +6032,7 @@ Move_FOLLOW_ME: loopsewithpan SE_W039, SOUND_PAN_ATTACKER, 22, 3 end +Move_MAGNETIC_FLUX: Move_CHARGE: loadspritegfx ANIM_TAG_ELECTRIC_ORBS loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 14e0c58f3..e190bfc74 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -351,6 +351,8 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectInstruct .4byte BattleScript_EffectThroatChop .4byte BattleScript_EffectLaserFocus + .4byte BattleScript_EffectMagneticFlux + .4byte BattleScript_EffectGearUp BattleScript_EffectCoreEnforcer: setmoveeffect MOVE_EFFECT_CORE_ENFORCER | MOVE_EFFECT_CERTAIN @@ -500,6 +502,84 @@ BattleScript_AromaticMistAnim: BattleScript_EffectAromaticMistEnd: goto BattleScript_MoveEnd +BattleScript_EffectMagneticFlux:: + attackcanceler + attackstring + ppreduce + setbyte gBattleCommunication, 0x0 +BattleScript_EffectMagneticFluxStart: + jumpifability BS_TARGET, ABILITY_MINUS, BattleScript_EffectMagneticFluxCheckStats + jumpifability BS_TARGET, ABILITY_PLUS, BattleScript_EffectMagneticFluxCheckStats + goto BattleScript_EffectMagneticFluxLoop +BattleScript_EffectMagneticFluxCheckStats: + jumpifstat BS_TARGET, CMP_LESS_THAN, STAT_DEF, 0xC, BattleScript_EffectMagneticFluxTryDef + jumpifstat BS_TARGET, CMP_EQUAL, STAT_SPDEF, 0xC, BattleScript_EffectMagneticFluxLoop +BattleScript_EffectMagneticFluxTryDef: + jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, 0x0, BattleScript_EffectMagneticFluxSkipAnim + attackanimation + waitanimation +BattleScript_EffectMagneticFluxSkipAnim: + setbyte sSTAT_ANIM_PLAYED, FALSE + playstatchangeanimation BS_TARGET, BIT_DEF | BIT_SPDEF, 0x0 + setstatchanger STAT_DEF, 1, FALSE + statbuffchange STAT_CHANGE_BS_PTR, BattleScript_EffectMagneticFluxTrySpDef + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_EffectMagneticFluxTrySpDef + addbyte gBattleCommunication, 0x1 + printfromtable gStatUpStringIds + waitmessage 0x40 +BattleScript_EffectMagneticFluxTrySpDef: + setstatchanger STAT_SPDEF, 1, FALSE + statbuffchange STAT_CHANGE_BS_PTR, BattleScript_EffectMagneticFluxLoop + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_EffectMagneticFluxLoop + addbyte gBattleCommunication, 0x1 + printfromtable gStatUpStringIds + waitmessage 0x40 +BattleScript_EffectMagneticFluxLoop: + jumpifbytenotequal gBattlerTarget, gBattlerAttacker, BattleScript_EffectMagneticFluxEnd + setallytonexttarget BattleScript_EffectMagneticFluxStart +BattleScript_EffectMagneticFluxEnd: + jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, 0x0, BattleScript_MoveEnd + goto BattleScript_ButItFailed + +BattleScript_EffectGearUp:: + attackcanceler + attackstring + ppreduce + setbyte gBattleCommunication, 0x0 +BattleScript_EffectGearUpStart: + jumpifability BS_TARGET, ABILITY_MINUS, BattleScript_EffectGearUpCheckStats + jumpifability BS_TARGET, ABILITY_PLUS, BattleScript_EffectGearUpCheckStats + goto BattleScript_EffectGearUpLoop +BattleScript_EffectGearUpCheckStats: + jumpifstat BS_TARGET, CMP_LESS_THAN, STAT_ATK, 0xC, BattleScript_EffectGearUpTryAtk + jumpifstat BS_TARGET, CMP_EQUAL, STAT_SPATK, 0xC, BattleScript_EffectGearUpLoop +BattleScript_EffectGearUpTryAtk: + jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, 0x0, BattleScript_EffectGearUpSkipAnim + attackanimation + waitanimation +BattleScript_EffectGearUpSkipAnim: + setbyte sSTAT_ANIM_PLAYED, FALSE + playstatchangeanimation BS_TARGET, BIT_ATK | BIT_SPATK, 0x0 + setstatchanger STAT_ATK, 1, FALSE + statbuffchange STAT_CHANGE_BS_PTR, BattleScript_EffectGearUpTrySpAtk + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_EffectGearUpTrySpAtk + addbyte gBattleCommunication, 0x1 + printfromtable gStatUpStringIds + waitmessage 0x40 +BattleScript_EffectGearUpTrySpAtk: + setstatchanger STAT_SPATK, 1, FALSE + statbuffchange STAT_CHANGE_BS_PTR, BattleScript_EffectGearUpLoop + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_EffectGearUpLoop + addbyte gBattleCommunication, 0x1 + printfromtable gStatUpStringIds + waitmessage 0x40 +BattleScript_EffectGearUpLoop: + jumpifbytenotequal gBattlerTarget, gBattlerAttacker, BattleScript_EffectGearUpEnd + setallytonexttarget BattleScript_EffectGearUpStart +BattleScript_EffectGearUpEnd: + jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, 0x0, BattleScript_MoveEnd + goto BattleScript_ButItFailed + BattleScript_EffectAcupressure: attackcanceler jumpifbyteequal gBattlerTarget, gBattlerAttacker, BattleScript_EffectAcupressureTry diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 1af103fc8..4d8b8b222 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -339,5 +339,7 @@ #define EFFECT_INSTRUCT 333 #define EFFECT_THROAT_CHOP 334 #define EFFECT_LASER_FOCUS 335 +#define EFFECT_MAGNETIC_FLUX 336 +#define EFFECT_GEAR_UP 337 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 85e3cfd06..dec05ad6c 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -8450,7 +8450,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_MAGNETIC_FLUX] = { - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect + .effect = EFFECT_MAGNETIC_FLUX, .power = 0, .type = TYPE_ELECTRIC, .accuracy = 0, @@ -8942,13 +8942,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_GEAR_UP] = { - .effect = EFFECT_PLACEHOLDER, + .effect = EFFECT_GEAR_UP, .power = 0, .type = TYPE_STEEL, .accuracy = 0, .pp = 20, .secondaryEffectChance = 0, - .target = MOVE_TARGET_SELECTED, + .target = MOVE_TARGET_USER, .priority = 0, .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS,