From 23a06c08369d8a4dbcb1e5f5b10a7d6c404d3e35 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 22 Sep 2018 01:12:27 +0200 Subject: [PATCH] Close combat effect --- data/battle_scripts_1.s | 36 ++++++++++++++++++++----- include/battle_scripts.h | 1 + include/constants/battle.h | 2 +- include/constants/battle_move_effects.h | 1 + src/battle_script_commands.c | 4 +++ src/data/battle_moves.h | 2 +- 6 files changed, 38 insertions(+), 8 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index a3cead061b..d57063bd95 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -299,6 +299,7 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectReflectType .4byte BattleScript_EffectSoak .4byte BattleScript_EffectGrowth + .4byte BattleScript_EffectCloseCombat BattleScript_EffectGrowth: attackcanceler @@ -3181,6 +3182,10 @@ BattleScript_EffectIngrain: BattleScript_EffectSuperpower: setmoveeffect MOVE_EFFECT_ATK_DEF_DOWN | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN goto BattleScript_EffectHit + +BattleScript_EffectCloseCombat: + setmoveeffect MOVE_EFFECT_DEF_SPDEF_DOWN | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN + goto BattleScript_EffectHit BattleScript_EffectMagicCoat: attackcanceler @@ -4554,18 +4559,37 @@ BattleScript_AtkDefDown:: playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_ATK, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE | ATK48_ONLY_MULTIPLE playstatchangeanimation BS_ATTACKER, BIT_ATK, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE setstatchanger STAT_ATK, 1, TRUE - statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | 0x1, BattleScript_82DB144 - jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB144 + statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | 0x1, BattleScript_AtkDefDownTryDef + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_AtkDefDownTryDef printfromtable gStatDownStringIds waitmessage 0x40 -BattleScript_82DB144:: +BattleScript_AtkDefDownTryDef:: playstatchangeanimation BS_ATTACKER, BIT_DEF, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE setstatchanger STAT_DEF, 1, TRUE - statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | 0x1, BattleScript_82DB167 - jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB167 + statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | 0x1, BattleScript_AtkDefDownRet + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_AtkDefDownRet printfromtable gStatDownStringIds waitmessage 0x40 -BattleScript_82DB167:: +BattleScript_AtkDefDownRet:: + return + +BattleScript_DefSpDefDown:: + setbyte sSTAT_ANIM_PLAYED, FALSE + playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_SPDEF, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE | ATK48_ONLY_MULTIPLE + playstatchangeanimation BS_ATTACKER, BIT_DEF, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE + setstatchanger STAT_DEF, 1, TRUE + statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | 0x1, BattleScript_DefSpDefDownTrySpDef + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_DefSpDefDownTrySpDef + printfromtable gStatDownStringIds + waitmessage 0x40 +BattleScript_DefSpDefDownTrySpDef:: + playstatchangeanimation BS_ATTACKER, BIT_SPDEF, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE + setstatchanger STAT_SPDEF, 1, TRUE + statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | 0x1, BattleScript_DefSpDefDownRet + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_DefSpDefDownRet + printfromtable gStatDownStringIds + waitmessage 0x40 +BattleScript_DefSpDefDownRet:: return BattleScript_KnockedOff:: diff --git a/include/battle_scripts.h b/include/battle_scripts.h index f897158e85..f1c80da4bd 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -86,6 +86,7 @@ extern const u8 BattleScript_SelectingNotAllowedMoveTauntInPalace[]; extern const u8 BattleScript_WishComesTrue[]; extern const u8 BattleScript_IngrainTurnHeal[]; extern const u8 BattleScript_AtkDefDown[]; +extern const u8 BattleScript_DefSpDefDown[]; extern const u8 BattleScript_KnockedOff[]; extern const u8 BattleScript_MoveUsedIsImprisoned[]; extern const u8 BattleScript_SelectingImprisionedMove[]; diff --git a/include/constants/battle.h b/include/constants/battle.h index 3a15ba5ef1..6eb81e0ef4 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -309,7 +309,7 @@ #define MOVE_EFFECT_EVS_MINUS_2 0x34 #define MOVE_EFFECT_THRASH 0x35 #define MOVE_EFFECT_KNOCK_OFF 0x36 -#define MOVE_EFFECT_NOTHING_37 0x37 +#define MOVE_EFFECT_DEF_SPDEF_DOWN 0x37 #define MOVE_EFFECT_NOTHING_38 0x38 #define MOVE_EFFECT_NOTHING_39 0x39 #define MOVE_EFFECT_NOTHING_3A 0x3A diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 7394a34043..3ebf8f6a3b 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -288,5 +288,6 @@ #define EFFECT_REFLECT_TYPE 282 #define EFFECT_SOAK 283 #define EFFECT_GROWTH 284 +#define EFFECT_CLOSE_COMBAT 285 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index c92d4f156c..5fa738f08e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2594,6 +2594,10 @@ void SetMoveEffect(bool8 primary, u8 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_AtkDefDown; break; + case MOVE_EFFECT_DEF_SPDEF_DOWN: // Close Combat + BattleScriptPush(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = BattleScript_DefSpDefDown; + break; case MOVE_EFFECT_RECOIL_33: // Double Edge gBattleMoveDamage = gHpDealt / 3; if (gBattleMoveDamage == 0) diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 2f2c932452..569539f5c2 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -4444,7 +4444,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] = .split = SPLIT_PHYSICAL, }, { // MOVE_CLOSE_COMBAT - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect + .effect = EFFECT_CLOSE_COMBAT, .power = 120, .type = TYPE_FIGHTING, .accuracy = 100,