From c9ad96d2282bea4ab742a57f90b3f739b3c3e77f Mon Sep 17 00:00:00 2001 From: Papa Cancer Date: Mon, 1 Apr 2019 15:28:17 +0100 Subject: [PATCH] Stomping Tantrum Uses timer in gBattleStruct to count time since last failed move. This is augmented by a MOVE_FAILED result in atk_49 and decreased with an ENDTURN case. EFFECT_STOMPING_TANTRUM doubles base power if the timer is set. --- data/battle_scripts_1.s | 2 ++ include/battle.h | 1 + include/constants/battle_move_effects.h | 1 + include/constants/battle_script_commands.h | 41 +++++++++++----------- src/battle_script_commands.c | 7 ++++ src/battle_util.c | 4 +++ src/data/battle_moves.h | 2 +- 7 files changed, 37 insertions(+), 21 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 764ff256c1..ae219de0a3 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -345,6 +345,7 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectPartingShot .4byte BattleScript_EffectSpectralThief .4byte BattleScript_EffectVCreate + .4byte BattleScript_EffectStompingTantrum BattleScript_EffectVCreate: setmoveeffect MOVE_EFFECT_V_CREATE | MOVE_EFFECT_AFFECTS_USER @@ -1721,6 +1722,7 @@ BattleScript_EffectPlaceholder: printstring STRINGID_NOTDONEYET goto BattleScript_MoveEnd +BattleScript_EffectStompingTantrum: BattleScript_EffectEvasionDownHit: BattleScript_EffectVitalThrow: BattleScript_EffectFalseSwipe: diff --git a/include/battle.h b/include/battle.h index 96dab7efc7..fd747241d3 100644 --- a/include/battle.h +++ b/include/battle.h @@ -576,6 +576,7 @@ struct BattleStruct u8 introState; u8 ateBerry[2]; // array id determined by side, each party pokemon as bit u8 stolenStats[NUM_BATTLE_STATS]; // hp byte is used for which stats to raise, other inform about by how many stages + u8 lastMoveFailed; // as bits for each battler, for the sake of Stomping Tantrum }; #define GET_MOVE_TYPE(move, typeArg) \ diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index bd52d065e6..6d52672259 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -333,5 +333,6 @@ #define EFFECT_PARTING_SHOT 327 #define EFFECT_SPECTRAL_THIEF 328 #define EFFECT_V_CREATE 329 +#define EFFECT_STOMPING_TANTRUM 330 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 681838f76f..89949560df 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -162,26 +162,27 @@ #define ATK48_DONT_CHECK_LOWER 0x8 // atk49, moveend cases -#define ATK49_SPIKY_SHIELD 0 -#define ATK49_RAGE 1 -#define ATK49_DEFROST 2 -#define ATK49_SYNCHRONIZE_TARGET 3 -#define ATK49_MOVE_END_ABILITIES 4 -#define ATK49_STATUS_IMMUNITY_ABILITIES 5 -#define ATK49_SYNCHRONIZE_ATTACKER 6 -#define ATK49_CHOICE_MOVE 7 -#define ATK49_CHANGED_ITEMS 8 -#define ATK49_ATTACKER_INVISIBLE 9 -#define ATK49_ATTACKER_VISIBLE 10 -#define ATK49_TARGET_VISIBLE 11 -#define ATK49_ITEM_EFFECTS_ALL 12 -#define ATK49_KINGSROCK_SHELLBELL 13 -#define ATK49_SUBSTITUTE 14 -#define ATK49_UPDATE_LAST_MOVES 15 -#define ATK49_MIRROR_MOVE 16 -#define ATK49_NEXT_TARGET 17 -#define ATK49_CLEAR_BITS 18 -#define ATK49_COUNT 19 +#define ATK49_FAILED_MOVE_COUNTER 0 +#define ATK49_SPIKY_SHIELD 1 +#define ATK49_RAGE 2 +#define ATK49_DEFROST 3 +#define ATK49_SYNCHRONIZE_TARGET 4 +#define ATK49_MOVE_END_ABILITIES 5 +#define ATK49_STATUS_IMMUNITY_ABILITIES 6 +#define ATK49_SYNCHRONIZE_ATTACKER 7 +#define ATK49_CHOICE_MOVE 8 +#define ATK49_CHANGED_ITEMS 9 +#define ATK49_ATTACKER_INVISIBLE 10 +#define ATK49_ATTACKER_VISIBLE 11 +#define ATK49_TARGET_VISIBLE 12 +#define ATK49_ITEM_EFFECTS_ALL 13 +#define ATK49_KINGSROCK_SHELLBELL 14 +#define ATK49_SUBSTITUTE 15 +#define ATK49_UPDATE_LAST_MOVES 16 +#define ATK49_MIRROR_MOVE 17 +#define ATK49_NEXT_TARGET 18 +#define ATK49_CLEAR_BITS 19 +#define ATK49_COUNT 20 #define BIT_HP 0x1 #define BIT_ATK 0x2 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 5060c2eae5..d416a24d69 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4198,6 +4198,13 @@ static void atk49_moveend(void) { switch (gBattleScripting.atk49_state) { + case ATK49_FAILED_MOVE_COUNTER: + if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT) + gBattleStruct->lastMoveFailed |= gBitTable[gBattlerAttacker]; + else + gBattleStruct->lastMoveFailed &= ~(gBitTable[gBattlerAttacker]); + gBattleScripting.atk49_state++; + break; case ATK49_SPIKY_SHIELD: if (gProtectStructs[gBattlerTarget].spikyShielded && gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT diff --git a/src/battle_util.c b/src/battle_util.c index 9dd20fc61f..4607c17f87 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5149,6 +5149,10 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe if (WEATHER_HAS_EFFECT && gBattleWeather & (WEATHER_HAIL_ANY | WEATHER_SANDSTORM_ANY | WEATHER_RAIN_ANY)) MulModifier(&modifier, UQ_4_12(0.5)); break; + case EFFECT_STOMPING_TANTRUM: + if (gBattleStruct->lastMoveFailed & gBitTable[battlerAtk]) + MulModifier(&modifier, UQ_4_12(2.0)); + break; case EFFECT_BULLDOZE: case EFFECT_MAGNITUDE: case EFFECT_EARTHQUAKE: diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 63fbdc2f57..a322bd9023 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -9277,7 +9277,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_STOMPING_TANTRUM] = { - .effect = EFFECT_PLACEHOLDER, + .effect = EFFECT_STOMPING_TANTRUM, .power = 75, .type = TYPE_GROUND, .accuracy = 100,