From ae482ed1f4648fb5f09e0c4c382ff401ce2cec96 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 12 Dec 2022 21:08:46 -0300 Subject: [PATCH 01/17] Implemented Ceaseless Edge's effect --- data/battle_scripts_1.s | 35 +++++++++++++++++++++++++ include/constants/battle_move_effects.h | 3 ++- src/data/battle_moves.h | 2 +- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 94a220608..d1d1e670f 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -416,6 +416,18 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectDoubleShock @ EFFECT_DOUBLE_SHOCK .4byte BattleScript_EffectSpecialAttackUpHit @ EFFECT_SPECIAL_ATTACK_UP_HIT .4byte BattleScript_EffectVictoryDance @ EFFECT_VICTORY_DANCE + .4byte BattleScript_EffectCeaselessEdge @ EFFECT_CEASELESS_EDGE + +BattleScript_EffectCeaselessEdge:: + call BattleScript_EffectHit_Ret + trysetspikes BattleScript_ButItFailedAtkStringPpReduce + attackstring + ppreduce + attackanimation + waitanimation + printstring STRINGID_SPIKESSCATTERED + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd BattleScript_AffectionBasedEndurance:: playanimation BS_TARGET, B_ANIM_AFFECTION_HANGED_ON @@ -3029,6 +3041,29 @@ BattleScript_MoveEnd:: moveendall end +BattleScript_EffectHit_Ret:: + attackcanceler + accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE + attackstring + ppreduce + critcalc + damagecalc + adjustdamage + attackanimation + waitanimation + effectivenesssound + hitanimation BS_TARGET + waitstate + healthbarupdate BS_TARGET + datahpupdate BS_TARGET + critmessage + waitmessage B_WAIT_TIME_LONG + resultmessage + waitmessage B_WAIT_TIME_LONG + seteffectwithchance + tryfaintmon BS_TARGET + return + BattleScript_EffectNaturalGift: attackcanceler attackstring diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 5af1017a9..1ac102c35 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -397,7 +397,8 @@ #define EFFECT_DOUBLE_SHOCK 391 #define EFFECT_SPECIAL_ATTACK_UP_HIT 392 #define EFFECT_VICTORY_DANCE 393 +#define EFFECT_CEASELESS_EDGE 394 -#define NUM_BATTLE_MOVE_EFFECTS 394 +#define NUM_BATTLE_MOVE_EFFECTS 395 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index ef4d15039..225da6ff7 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -13598,7 +13598,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = [MOVE_CEASELESS_EDGE] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_CEASELESS_EDGE, + .effect = EFFECT_CEASELESS_EDGE, .power = 65, .type = TYPE_DARK, .accuracy = 90, From 3ce486976640d517f34188be08124bce9461d33a Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 12 Dec 2022 21:41:13 -0300 Subject: [PATCH 02/17] Implemented Shell Trap's effect --- data/battle_scripts_1.s | 18 ++++++++++++++++++ include/battle_scripts.h | 1 + include/constants/battle_move_effects.h | 3 ++- include/constants/battle_string_ids.h | 4 +++- src/battle_main.c | 13 ++++++++----- src/battle_message.c | 4 ++++ src/battle_script_commands.c | 7 ++++--- src/data/battle_moves.h | 2 +- 8 files changed, 41 insertions(+), 11 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index d1d1e670f..f2a0223cf 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -417,6 +417,24 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectSpecialAttackUpHit @ EFFECT_SPECIAL_ATTACK_UP_HIT .4byte BattleScript_EffectVictoryDance @ EFFECT_VICTORY_DANCE .4byte BattleScript_EffectCeaselessEdge @ EFFECT_CEASELESS_EDGE + .4byte BattleScript_EffectShellTrap @ EFFECT_SHELL_TRAP + +BattleScript_EffectShellTrap: + jumpifnodamage BattleScript_EffectShellTrap_Failed + goto BattleScript_EffectHit + +BattleScript_EffectShellTrap_Failed: + printstring STRINGID_ATTACKERSHELLTRAPDIDNTWORK + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + +BattleScript_ShellTrapSetUp:: + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 + playanimation BS_ATTACKER, B_ANIM_SHELL_TRAP_SETUP, NULL + printstring STRINGID_ATTACKERSETASHELLTRAP + waitmessage B_WAIT_TIME_LONG + end2 BattleScript_EffectCeaselessEdge:: call BattleScript_EffectHit_Ret diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 75afdbf63..89ad9302b 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -433,6 +433,7 @@ extern const u8 BattleScript_MultiHitPrintStrings[]; extern const u8 BattleScript_BurnUpRemoveType[]; extern const u8 BattleScript_TargetAbilityStatRaiseRet[]; extern const u8 BattleScript_DoubleShockRemoveType[]; +extern const u8 BattleScript_ShellTrapSetUp[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[]; diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 1ac102c35..c16084c30 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -398,7 +398,8 @@ #define EFFECT_SPECIAL_ATTACK_UP_HIT 392 #define EFFECT_VICTORY_DANCE 393 #define EFFECT_CEASELESS_EDGE 394 +#define EFFECT_SHELL_TRAP 395 -#define NUM_BATTLE_MOVE_EFFECTS 395 +#define NUM_BATTLE_MOVE_EFFECTS 396 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 8dd94cca4..64ddcbebd 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -632,8 +632,10 @@ #define STRINGID_TARGETTOUGHEDITOUT 630 #define STRINGID_ATTACKERLOSTELECTRICTYPE 631 #define STRINGID_ATTACKERSWITCHEDSTATWITHTARGET 632 +#define STRINGID_ATTACKERSETASHELLTRAP 633 +#define STRINGID_ATTACKERSHELLTRAPDIDNTWORK 634 -#define BATTLESTRINGS_COUNT 633 +#define BATTLESTRINGS_COUNT 635 // This is the string id that gBattleStringsTable starts with. // String ids before this (e.g. STRINGID_INTROMSG) are not in the table, diff --git a/src/battle_main.c b/src/battle_main.c index d138cf231..8ba87133e 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -101,7 +101,7 @@ static void SetActionsAndBattlersTurnOrder(void); static void UpdateBattlerPartyOrdersOnSwitch(void); static bool8 AllAtActionConfirmed(void); static void TryChangeTurnOrder(void); -static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void); +static void CheckChosenMoveForEffectsBeforeTurnStarts(void); static void CheckMegaEvolutionBeforeTurn(void); static void CheckQuickClaw_CustapBerryActivation(void); static void FreeResetData_ReturnToOvOrDoEvolutions(void); @@ -4878,7 +4878,7 @@ static void CheckMegaEvolutionBeforeTurn(void) } #if B_MEGA_EVO_TURN_ORDER <= GEN_6 - gBattleMainFunc = CheckFocusPunch_ClearVarsBeforeTurnStarts; + gBattleMainFunc = CheckChosenMoveForEffectsBeforeTurnStarts; gBattleStruct->focusPunchBattlerId = 0; #else gBattleMainFunc = TryChangeTurnOrder; // This will just do nothing if no mon has mega evolved @@ -4903,11 +4903,11 @@ static void TryChangeTurnOrder(void) } } } - gBattleMainFunc = CheckFocusPunch_ClearVarsBeforeTurnStarts; + gBattleMainFunc = CheckChosenMoveForEffectsBeforeTurnStarts; gBattleStruct->focusPunchBattlerId = 0; } -static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void) +static void CheckChosenMoveForEffectsBeforeTurnStarts(void) { u32 i; @@ -4921,7 +4921,7 @@ static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void) && !(gDisableStructs[gBattlerAttacker].truantCounter) && !(gProtectStructs[gActiveBattler].noValidMoves)) { - switch(gChosenMoveByBattler[gActiveBattler]) + switch (gChosenMoveByBattler[gActiveBattler]) { case MOVE_FOCUS_PUNCH: BattleScriptExecute(BattleScript_FocusPunchSetUp); @@ -4929,6 +4929,9 @@ static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void) case MOVE_BEAK_BLAST: BattleScriptExecute(BattleScript_BeakBlastSetUp); return; + case MOVE_SHELL_TRAP: + BattleScriptExecute(BattleScript_ShellTrapSetUp); + return; } } } diff --git a/src/battle_message.c b/src/battle_message.c index 031261a28..60578897e 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -761,9 +761,13 @@ static const u8 sText_AttackerMeltedTheIce[] = _("{B_ATK_NAME_WITH_PREFIX} melte static const u8 sText_TargetToughedItOut[] = _("{B_DEF_NAME_WITH_PREFIX} toughed it out\nto show you its best side!"); static const u8 sText_AttackerLostElectricType[] = _("{B_ATK_NAME_WITH_PREFIX} used up all\nof its electricity!"); static const u8 sText_AttackerSwitchedStatWithTarget[] = _("{B_ATK_NAME_WITH_PREFIX} switched {B_BUFF1}\nwith its target!"); +static const u8 sText_AttackerSetAShellTrap[] = _("{B_ATK_NAME_WITH_PREFIX} set\na shell trap!"); +static const u8 sText_AttackerShellTrapDidntWork[] = _("{B_ATK_NAME_WITH_PREFIX}'s shell trap\ndidn't work!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_ATTACKERSHELLTRAPDIDNTWORK - BATTLESTRINGS_TABLE_START] = sText_AttackerShellTrapDidntWork, + [STRINGID_ATTACKERSETASHELLTRAP - BATTLESTRINGS_TABLE_START] = sText_AttackerSetAShellTrap, [STRINGID_ATTACKERSWITCHEDSTATWITHTARGET - BATTLESTRINGS_TABLE_START] = sText_AttackerSwitchedStatWithTarget, [STRINGID_TARGETTOUGHEDITOUT - BATTLESTRINGS_TABLE_START] = sText_TargetToughedItOut, [STRINGID_ATTACKERMELTEDTHEICE - BATTLESTRINGS_TABLE_START] = sText_AttackerMeltedTheIce, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 9c780c28e..3d85d1379 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10031,7 +10031,7 @@ static void Cmd_various(void) gBattleMons[gActiveBattler].item = gLastUsedItem; break; case VARIOUS_SET_BEAK_BLAST: - gProtectStructs[gBattlerAttacker].beakBlastCharge = TRUE; + gProtectStructs[gActiveBattler].beakBlastCharge = TRUE; break; case VARIOUS_SWAP_SIDE_STATUSES: CourtChangeSwapSideStatuses(); @@ -11926,8 +11926,9 @@ static void Cmd_trysetencore(void) } if (gLastMoves[gBattlerTarget] == MOVE_STRUGGLE - || gLastMoves[gBattlerTarget] == MOVE_ENCORE - || gLastMoves[gBattlerTarget] == MOVE_MIRROR_MOVE) + || gLastMoves[gBattlerTarget] == MOVE_ENCORE + || gLastMoves[gBattlerTarget] == MOVE_MIRROR_MOVE + || gLastMoves[gBattlerTarget] == MOVE_SHELL_TRAP) { i = MAX_MON_MOVES; } diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 225da6ff7..6badf0ee5 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -11616,7 +11616,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = [MOVE_SHELL_TRAP] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_SHELL_TRAP, + .effect = EFFECT_SHELL_TRAP, .power = 150, .type = TYPE_FIRE, .accuracy = 100, From 2cb9400ef0b6b732da416d10a12065ffd38191e4 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Tue, 13 Dec 2022 02:19:41 -0300 Subject: [PATCH 03/17] Implemented Dire Claw's effect --- data/battle_scripts_1.s | 5 +++++ include/constants/battle.h | 3 ++- include/constants/battle_move_effects.h | 3 ++- src/battle_script_commands.c | 16 ++++++++++++++++ src/data/battle_moves.h | 4 ++-- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index f2a0223cf..b3313abbe 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -418,6 +418,11 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectVictoryDance @ EFFECT_VICTORY_DANCE .4byte BattleScript_EffectCeaselessEdge @ EFFECT_CEASELESS_EDGE .4byte BattleScript_EffectShellTrap @ EFFECT_SHELL_TRAP + .4byte BattleScript_EffectDireClaw @ EFFECT_DIRE_CLAW + +BattleScript_EffectDireClaw:: + setmoveeffect MOVE_EFFECT_DIRE_CLAW + goto BattleScript_EffectHit BattleScript_EffectShellTrap: jumpifnodamage BattleScript_EffectShellTrap_Failed diff --git a/include/constants/battle.h b/include/constants/battle.h index be44c21cb..fa9d4bd18 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -371,8 +371,9 @@ #define MOVE_EFFECT_RELIC_SONG 69 #define MOVE_EFFECT_TRAP_BOTH 70 #define MOVE_EFFECT_DOUBLE_SHOCK 71 +#define MOVE_EFFECT_DIRE_CLAW 72 -#define NUM_MOVE_EFFECTS 72 +#define NUM_MOVE_EFFECTS 73 #define MOVE_EFFECT_AFFECTS_USER 0x4000 #define MOVE_EFFECT_CERTAIN 0x8000 diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index c16084c30..fa3184855 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -399,7 +399,8 @@ #define EFFECT_VICTORY_DANCE 393 #define EFFECT_CEASELESS_EDGE 394 #define EFFECT_SHELL_TRAP 395 +#define EFFECT_DIRE_CLAW 396 -#define NUM_BATTLE_MOVE_EFFECTS 396 +#define NUM_BATTLE_MOVE_EFFECTS 397 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 3d85d1379..e5d7935fd 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3647,6 +3647,22 @@ void SetMoveEffect(bool32 primary, u32 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_DoubleShockRemoveType; break; + case MOVE_EFFECT_DIRE_CLAW: + if (gBattleMons[gEffectBattler].status1) + { + gBattlescriptCurrInstr++; + } + else + { + DIRE_CLAW_STATUS_PICK: + gBattleScripting.moveEffect = Random() % 6; + if (gBattleScripting.moveEffect == MOVE_EFFECT_NONE + || gBattleScripting.moveEffect == MOVE_EFFECT_BURN + || gBattleScripting.moveEffect == MOVE_EFFECT_FREEZE) + goto DIRE_CLAW_STATUS_PICK; + SetMoveEffect(FALSE, 0); + } + break; } } } diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 6badf0ee5..6481b7d45 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -13279,11 +13279,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = #else .power = 60, #endif - .effect = EFFECT_PLACEHOLDER, // EFFECT_DIRE_CLAW, + .effect = EFFECT_DIRE_CLAW, .type = TYPE_POISON, .accuracy = 100, .pp = 15, - .secondaryEffectChance = 0, + .secondaryEffectChance = 50, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, From 1229fa752a3b711e802f401e4a5e09d3160b9bfd Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 14 Dec 2022 09:14:40 -0300 Subject: [PATCH 04/17] Fixed Triple Axe's target, added its effect and fixed Ceaseless Edge's --- data/battle_scripts_1.s | 12 ++++++++---- include/constants/battle_move_effects.h | 3 ++- src/data/battle_moves.h | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index b3313abbe..622463830 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -419,6 +419,14 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectCeaselessEdge @ EFFECT_CEASELESS_EDGE .4byte BattleScript_EffectShellTrap @ EFFECT_SHELL_TRAP .4byte BattleScript_EffectDireClaw @ EFFECT_DIRE_CLAW + .4byte BattleScript_EffectStoneAxe @ EFFECT_STONE_AXE + +BattleScript_EffectStoneAxe:: + call BattleScript_EffectHit_Ret + setstealthrock BattleScript_ButItFailed + printstring STRINGID_POINTEDSTONESFLOAT + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd BattleScript_EffectDireClaw:: setmoveeffect MOVE_EFFECT_DIRE_CLAW @@ -444,10 +452,6 @@ BattleScript_ShellTrapSetUp:: BattleScript_EffectCeaselessEdge:: call BattleScript_EffectHit_Ret trysetspikes BattleScript_ButItFailedAtkStringPpReduce - attackstring - ppreduce - attackanimation - waitanimation printstring STRINGID_SPIKESSCATTERED waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index fa3184855..16aac5284 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -400,7 +400,8 @@ #define EFFECT_CEASELESS_EDGE 394 #define EFFECT_SHELL_TRAP 395 #define EFFECT_DIRE_CLAW 396 +#define EFFECT_STONE_AXE 397 -#define NUM_BATTLE_MOVE_EFFECTS 397 +#define NUM_BATTLE_MOVE_EFFECTS 398 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 6481b7d45..22b695fc4 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -13326,13 +13326,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = [MOVE_STONE_AXE] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_STONE_AXE, + .effect = EFFECT_STONE_AXE, .power = 65, .type = TYPE_ROCK, .accuracy = 90, .pp = 15, .secondaryEffectChance = 0, - .target = MOVE_TARGET_USER, + .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, From 4bb86c5d961a68da83f5798a0dd06be4a8507c97 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 14 Dec 2022 09:33:09 -0300 Subject: [PATCH 05/17] Implemented Barb Barrage's effect --- data/battle_scripts_1.s | 2 ++ include/constants/battle_move_effects.h | 3 ++- src/battle_util.c | 4 ++++ src/data/battle_moves.h | 10 +++++++--- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 622463830..ec604ebc6 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -420,6 +420,7 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectShellTrap @ EFFECT_SHELL_TRAP .4byte BattleScript_EffectDireClaw @ EFFECT_DIRE_CLAW .4byte BattleScript_EffectStoneAxe @ EFFECT_STONE_AXE + .4byte BattleScript_EffectBarbBarrage @ EFFECT_BARB_BARRAGE BattleScript_EffectStoneAxe:: call BattleScript_EffectHit_Ret @@ -3265,6 +3266,7 @@ BattleScript_CantMakeAsleep:: orhalfword gMoveResultFlags, MOVE_RESULT_FAILED goto BattleScript_MoveEnd +BattleScript_EffectBarbBarrage: BattleScript_EffectPoisonHit: setmoveeffect MOVE_EFFECT_POISON goto BattleScript_EffectHit diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 16aac5284..f51ae08c1 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -401,7 +401,8 @@ #define EFFECT_SHELL_TRAP 395 #define EFFECT_DIRE_CLAW 396 #define EFFECT_STONE_AXE 397 +#define EFFECT_BARB_BARRAGE 398 -#define NUM_BATTLE_MOVE_EFFECTS 398 +#define NUM_BATTLE_MOVE_EFFECTS 399 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/src/battle_util.c b/src/battle_util.c index 00e3b869b..08eea7f41 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8483,6 +8483,10 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) basePower = CalcBeatUpPower(); #endif break; + case EFFECT_BARB_BARRAGE: + if (gBattleMons[battlerDef].status1 & STATUS1_PSN_ANY) + basePower *= 2; + break; } // Move-specific base power changes diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 22b695fc4..227f77daf 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -13490,12 +13490,16 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = [MOVE_BARB_BARRAGE] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_BARB_BARRAGE, + .effect = EFFECT_BARB_BARRAGE, .power = 60, .type = TYPE_POISON, .accuracy = 100, - .pp = 15, - .secondaryEffectChance = 0, + #if B_UPDATED_MOVE_DATA >= GEN_9 + .pp = 10, + #else + .pp = 15, + #endif + .secondaryEffectChance = 50, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, From 9972cce0ec3ad30c7acf2c853aec3fc996a93833 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 21 Dec 2022 20:05:10 -0300 Subject: [PATCH 06/17] Updated MOVE_EFFECT_DIRE_CLAW --- src/battle_script_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index e5d7935fd..bb0d20199 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3656,7 +3656,7 @@ void SetMoveEffect(bool32 primary, u32 certain) { DIRE_CLAW_STATUS_PICK: gBattleScripting.moveEffect = Random() % 6; - if (gBattleScripting.moveEffect == MOVE_EFFECT_NONE + if (gBattleScripting.moveEffect == 0 || gBattleScripting.moveEffect == MOVE_EFFECT_BURN || gBattleScripting.moveEffect == MOVE_EFFECT_FREEZE) goto DIRE_CLAW_STATUS_PICK; From 0159065deaf90c3d8296c1ecca6b2912fdc6a8b9 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 28 Dec 2022 07:51:11 -0300 Subject: [PATCH 07/17] Removed Shell Trap It's time to let it go for my own mental sanity. Besides, it's a Gen. 7 move. I shouldn't have added it here. --- data/battle_scripts_1.s | 18 ------------------ include/battle_scripts.h | 1 - include/constants/battle_move_effects.h | 9 ++++----- include/constants/battle_string_ids.h | 4 +--- src/battle_main.c | 13 +++++-------- src/battle_message.c | 4 ---- src/battle_script_commands.c | 5 ++--- src/data/battle_moves.h | 2 +- 8 files changed, 13 insertions(+), 43 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index ec604ebc6..49d06a033 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -417,7 +417,6 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectSpecialAttackUpHit @ EFFECT_SPECIAL_ATTACK_UP_HIT .4byte BattleScript_EffectVictoryDance @ EFFECT_VICTORY_DANCE .4byte BattleScript_EffectCeaselessEdge @ EFFECT_CEASELESS_EDGE - .4byte BattleScript_EffectShellTrap @ EFFECT_SHELL_TRAP .4byte BattleScript_EffectDireClaw @ EFFECT_DIRE_CLAW .4byte BattleScript_EffectStoneAxe @ EFFECT_STONE_AXE .4byte BattleScript_EffectBarbBarrage @ EFFECT_BARB_BARRAGE @@ -433,23 +432,6 @@ BattleScript_EffectDireClaw:: setmoveeffect MOVE_EFFECT_DIRE_CLAW goto BattleScript_EffectHit -BattleScript_EffectShellTrap: - jumpifnodamage BattleScript_EffectShellTrap_Failed - goto BattleScript_EffectHit - -BattleScript_EffectShellTrap_Failed: - printstring STRINGID_ATTACKERSHELLTRAPDIDNTWORK - waitmessage B_WAIT_TIME_LONG - goto BattleScript_MoveEnd - -BattleScript_ShellTrapSetUp:: - printstring STRINGID_EMPTYSTRING3 - waitmessage 1 - playanimation BS_ATTACKER, B_ANIM_SHELL_TRAP_SETUP, NULL - printstring STRINGID_ATTACKERSETASHELLTRAP - waitmessage B_WAIT_TIME_LONG - end2 - BattleScript_EffectCeaselessEdge:: call BattleScript_EffectHit_Ret trysetspikes BattleScript_ButItFailedAtkStringPpReduce diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 89ad9302b..75afdbf63 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -433,7 +433,6 @@ extern const u8 BattleScript_MultiHitPrintStrings[]; extern const u8 BattleScript_BurnUpRemoveType[]; extern const u8 BattleScript_TargetAbilityStatRaiseRet[]; extern const u8 BattleScript_DoubleShockRemoveType[]; -extern const u8 BattleScript_ShellTrapSetUp[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[]; diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index f51ae08c1..423fa9a58 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -398,11 +398,10 @@ #define EFFECT_SPECIAL_ATTACK_UP_HIT 392 #define EFFECT_VICTORY_DANCE 393 #define EFFECT_CEASELESS_EDGE 394 -#define EFFECT_SHELL_TRAP 395 -#define EFFECT_DIRE_CLAW 396 -#define EFFECT_STONE_AXE 397 -#define EFFECT_BARB_BARRAGE 398 +#define EFFECT_DIRE_CLAW 395 +#define EFFECT_STONE_AXE 396 +#define EFFECT_BARB_BARRAGE 397 -#define NUM_BATTLE_MOVE_EFFECTS 399 +#define NUM_BATTLE_MOVE_EFFECTS 398 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 64ddcbebd..8dd94cca4 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -632,10 +632,8 @@ #define STRINGID_TARGETTOUGHEDITOUT 630 #define STRINGID_ATTACKERLOSTELECTRICTYPE 631 #define STRINGID_ATTACKERSWITCHEDSTATWITHTARGET 632 -#define STRINGID_ATTACKERSETASHELLTRAP 633 -#define STRINGID_ATTACKERSHELLTRAPDIDNTWORK 634 -#define BATTLESTRINGS_COUNT 635 +#define BATTLESTRINGS_COUNT 633 // This is the string id that gBattleStringsTable starts with. // String ids before this (e.g. STRINGID_INTROMSG) are not in the table, diff --git a/src/battle_main.c b/src/battle_main.c index 8ba87133e..d138cf231 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -101,7 +101,7 @@ static void SetActionsAndBattlersTurnOrder(void); static void UpdateBattlerPartyOrdersOnSwitch(void); static bool8 AllAtActionConfirmed(void); static void TryChangeTurnOrder(void); -static void CheckChosenMoveForEffectsBeforeTurnStarts(void); +static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void); static void CheckMegaEvolutionBeforeTurn(void); static void CheckQuickClaw_CustapBerryActivation(void); static void FreeResetData_ReturnToOvOrDoEvolutions(void); @@ -4878,7 +4878,7 @@ static void CheckMegaEvolutionBeforeTurn(void) } #if B_MEGA_EVO_TURN_ORDER <= GEN_6 - gBattleMainFunc = CheckChosenMoveForEffectsBeforeTurnStarts; + gBattleMainFunc = CheckFocusPunch_ClearVarsBeforeTurnStarts; gBattleStruct->focusPunchBattlerId = 0; #else gBattleMainFunc = TryChangeTurnOrder; // This will just do nothing if no mon has mega evolved @@ -4903,11 +4903,11 @@ static void TryChangeTurnOrder(void) } } } - gBattleMainFunc = CheckChosenMoveForEffectsBeforeTurnStarts; + gBattleMainFunc = CheckFocusPunch_ClearVarsBeforeTurnStarts; gBattleStruct->focusPunchBattlerId = 0; } -static void CheckChosenMoveForEffectsBeforeTurnStarts(void) +static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void) { u32 i; @@ -4921,7 +4921,7 @@ static void CheckChosenMoveForEffectsBeforeTurnStarts(void) && !(gDisableStructs[gBattlerAttacker].truantCounter) && !(gProtectStructs[gActiveBattler].noValidMoves)) { - switch (gChosenMoveByBattler[gActiveBattler]) + switch(gChosenMoveByBattler[gActiveBattler]) { case MOVE_FOCUS_PUNCH: BattleScriptExecute(BattleScript_FocusPunchSetUp); @@ -4929,9 +4929,6 @@ static void CheckChosenMoveForEffectsBeforeTurnStarts(void) case MOVE_BEAK_BLAST: BattleScriptExecute(BattleScript_BeakBlastSetUp); return; - case MOVE_SHELL_TRAP: - BattleScriptExecute(BattleScript_ShellTrapSetUp); - return; } } } diff --git a/src/battle_message.c b/src/battle_message.c index 60578897e..031261a28 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -761,13 +761,9 @@ static const u8 sText_AttackerMeltedTheIce[] = _("{B_ATK_NAME_WITH_PREFIX} melte static const u8 sText_TargetToughedItOut[] = _("{B_DEF_NAME_WITH_PREFIX} toughed it out\nto show you its best side!"); static const u8 sText_AttackerLostElectricType[] = _("{B_ATK_NAME_WITH_PREFIX} used up all\nof its electricity!"); static const u8 sText_AttackerSwitchedStatWithTarget[] = _("{B_ATK_NAME_WITH_PREFIX} switched {B_BUFF1}\nwith its target!"); -static const u8 sText_AttackerSetAShellTrap[] = _("{B_ATK_NAME_WITH_PREFIX} set\na shell trap!"); -static const u8 sText_AttackerShellTrapDidntWork[] = _("{B_ATK_NAME_WITH_PREFIX}'s shell trap\ndidn't work!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { - [STRINGID_ATTACKERSHELLTRAPDIDNTWORK - BATTLESTRINGS_TABLE_START] = sText_AttackerShellTrapDidntWork, - [STRINGID_ATTACKERSETASHELLTRAP - BATTLESTRINGS_TABLE_START] = sText_AttackerSetAShellTrap, [STRINGID_ATTACKERSWITCHEDSTATWITHTARGET - BATTLESTRINGS_TABLE_START] = sText_AttackerSwitchedStatWithTarget, [STRINGID_TARGETTOUGHEDITOUT - BATTLESTRINGS_TABLE_START] = sText_TargetToughedItOut, [STRINGID_ATTACKERMELTEDTHEICE - BATTLESTRINGS_TABLE_START] = sText_AttackerMeltedTheIce, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index bb0d20199..6e0f4c05d 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10047,7 +10047,7 @@ static void Cmd_various(void) gBattleMons[gActiveBattler].item = gLastUsedItem; break; case VARIOUS_SET_BEAK_BLAST: - gProtectStructs[gActiveBattler].beakBlastCharge = TRUE; + gProtectStructs[gBattlerAttacker].beakBlastCharge = TRUE; break; case VARIOUS_SWAP_SIDE_STATUSES: CourtChangeSwapSideStatuses(); @@ -11943,8 +11943,7 @@ static void Cmd_trysetencore(void) if (gLastMoves[gBattlerTarget] == MOVE_STRUGGLE || gLastMoves[gBattlerTarget] == MOVE_ENCORE - || gLastMoves[gBattlerTarget] == MOVE_MIRROR_MOVE - || gLastMoves[gBattlerTarget] == MOVE_SHELL_TRAP) + || gLastMoves[gBattlerTarget] == MOVE_MIRROR_MOVE) { i = MAX_MON_MOVES; } diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 227f77daf..40663a421 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -11616,7 +11616,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = [MOVE_SHELL_TRAP] = { - .effect = EFFECT_SHELL_TRAP, + .effect = EFFECT_PLACEHOLDER, // EFFECT_SHELL_TRAP, .power = 150, .type = TYPE_FIRE, .accuracy = 100, From f5c165ff0ccc0801ff0a9b93619103cc81940f91 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 28 Dec 2022 08:18:15 -0300 Subject: [PATCH 08/17] Updated Dire Claw's effect again Thanks to MGriffin for providing a much nicer code for it. --- src/battle_script_commands.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 6e0f4c05d..df995ef60 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3654,13 +3654,9 @@ void SetMoveEffect(bool32 primary, u32 certain) } else { - DIRE_CLAW_STATUS_PICK: - gBattleScripting.moveEffect = Random() % 6; - if (gBattleScripting.moveEffect == 0 - || gBattleScripting.moveEffect == MOVE_EFFECT_BURN - || gBattleScripting.moveEffect == MOVE_EFFECT_FREEZE) - goto DIRE_CLAW_STATUS_PICK; - SetMoveEffect(FALSE, 0); + static const u8 sDireClawEffects[] = { MOVE_EFFECT_POISON, MOVE_EFFECT_PARALYSIS, MOVE_EFFECT_SLEEP }; + gBattleScripting.moveEffect = sDireClawEffects[Random() % 3]; + SetMoveEffect(TRUE, 0); } break; } @@ -11942,8 +11938,8 @@ static void Cmd_trysetencore(void) } if (gLastMoves[gBattlerTarget] == MOVE_STRUGGLE - || gLastMoves[gBattlerTarget] == MOVE_ENCORE - || gLastMoves[gBattlerTarget] == MOVE_MIRROR_MOVE) + || gLastMoves[gBattlerTarget] == MOVE_ENCORE + || gLastMoves[gBattlerTarget] == MOVE_MIRROR_MOVE) { i = MAX_MON_MOVES; } From 9a6bdfb74f50d9133860944c8824382d907aba4c Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 4 Jan 2023 12:13:34 -0300 Subject: [PATCH 09/17] Added AI conditionals for the new move effects in this batch --- src/battle_ai_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 92866a7c2..5ec8e91aa 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -1486,6 +1486,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_SPIKES: + case EFFECT_CEASELESS_EDGE: if (gSideTimers[GetBattlerSide(battlerDef)].spikesAmount >= 3) score -= 10; else if (PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove) @@ -1493,6 +1494,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; // only one mon needs to set up the last layer of Spikes break; case EFFECT_STEALTH_ROCK: + case EFFECT_STONE_AXE: if (gSideTimers[GetBattlerSide(battlerDef)].stealthRockAmount > 0 || PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) //Only one mon needs to set up Stealth Rocks score -= 10; @@ -3472,6 +3474,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_TOXIC: case EFFECT_POISON: + case EFFECT_BARB_BARRAGE: IncreasePoisonScore(battlerAtk, battlerDef, move, &score); break; case EFFECT_LIGHT_SCREEN: @@ -3865,7 +3868,9 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_SPIKES: + case EFFECT_CEASELESS_EDGE: case EFFECT_STEALTH_ROCK: + case EFFECT_STONE_AXE: case EFFECT_STICKY_WEB: case EFFECT_TOXIC_SPIKES: if (AI_DATA->abilities[battlerDef] == ABILITY_MAGIC_BOUNCE || CountUsablePartyMons(battlerDef) == 0) @@ -4596,6 +4601,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; }*/ break; + case EFFECT_DIRE_CLAW: + if (gBattleMons[battlerDef].status1 & STATUS1_NONE) + score += 3; + break; case EFFECT_FEINT: if (gBattleMoves[predictedMove].effect == EFFECT_PROTECT) score += 3; @@ -4900,6 +4909,7 @@ static s16 AI_SetupFirstTurn(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_HAIL: case EFFECT_GEOMANCY: case EFFECT_VICTORY_DANCE: + case EFFECT_STONE_AXE: score += 2; break; default: From 2414283bb76739b5f24e0926a08e9366744a196d Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 4 Jan 2023 12:32:17 -0300 Subject: [PATCH 10/17] Removed BattleScript_EffectHit_Ret --- data/battle_scripts_1.s | 71 +++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 27 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index d606809ed..d64336638 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -423,22 +423,62 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectBarbBarrage @ EFFECT_BARB_BARRAGE BattleScript_EffectStoneAxe:: - call BattleScript_EffectHit_Ret + attackcanceler + accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE + attackstring + ppreduce + critcalc + damagecalc + adjustdamage + attackanimation + waitanimation + effectivenesssound + hitanimation BS_TARGET + waitstate + healthbarupdate BS_TARGET + datahpupdate BS_TARGET + critmessage + waitmessage B_WAIT_TIME_LONG + resultmessage + waitmessage B_WAIT_TIME_LONG + seteffectwithchance + tryfaintmon BS_TARGET setstealthrock BattleScript_ButItFailed printstring STRINGID_POINTEDSTONESFLOAT waitmessage B_WAIT_TIME_LONG - goto BattleScript_MoveEnd + moveendall + end BattleScript_EffectDireClaw:: setmoveeffect MOVE_EFFECT_DIRE_CLAW goto BattleScript_EffectHit BattleScript_EffectCeaselessEdge:: - call BattleScript_EffectHit_Ret + attackcanceler + accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE + attackstring + ppreduce + critcalc + damagecalc + adjustdamage + attackanimation + waitanimation + effectivenesssound + hitanimation BS_TARGET + waitstate + healthbarupdate BS_TARGET + datahpupdate BS_TARGET + critmessage + waitmessage B_WAIT_TIME_LONG + resultmessage + waitmessage B_WAIT_TIME_LONG + seteffectwithchance + tryfaintmon BS_TARGET trysetspikes BattleScript_ButItFailedAtkStringPpReduce printstring STRINGID_SPIKESSCATTERED waitmessage B_WAIT_TIME_LONG - goto BattleScript_MoveEnd + moveendall + end BattleScript_EffectTeatime:: attackcanceler @@ -3151,29 +3191,6 @@ BattleScript_MoveEnd:: moveendall end -BattleScript_EffectHit_Ret:: - attackcanceler - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - attackstring - ppreduce - critcalc - damagecalc - adjustdamage - attackanimation - waitanimation - effectivenesssound - hitanimation BS_TARGET - waitstate - healthbarupdate BS_TARGET - datahpupdate BS_TARGET - critmessage - waitmessage B_WAIT_TIME_LONG - resultmessage - waitmessage B_WAIT_TIME_LONG - seteffectwithchance - tryfaintmon BS_TARGET - return - BattleScript_EffectNaturalGift: attackcanceler attackstring From 7e398ce80e1858833d33110e469becd5c7c334f9 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 4 Jan 2023 12:45:49 -0300 Subject: [PATCH 11/17] Corrected the AI conditionals --- src/battle_ai_main.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 5ec8e91aa..2f9690250 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -1486,7 +1486,6 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_SPIKES: - case EFFECT_CEASELESS_EDGE: if (gSideTimers[GetBattlerSide(battlerDef)].spikesAmount >= 3) score -= 10; else if (PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove) @@ -1494,7 +1493,6 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; // only one mon needs to set up the last layer of Spikes break; case EFFECT_STEALTH_ROCK: - case EFFECT_STONE_AXE: if (gSideTimers[GetBattlerSide(battlerDef)].stealthRockAmount > 0 || PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) //Only one mon needs to set up Stealth Rocks score -= 10; @@ -4601,10 +4599,6 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; }*/ break; - case EFFECT_DIRE_CLAW: - if (gBattleMons[battlerDef].status1 & STATUS1_NONE) - score += 3; - break; case EFFECT_FEINT: if (gBattleMoves[predictedMove].effect == EFFECT_PROTECT) score += 3; From 72566e63230497ebf8533d8b254ea33ba7f9216a Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 5 Jan 2023 03:01:18 -0300 Subject: [PATCH 12/17] Turned Stone Axe's and Ceaseless Edge's effects into MOVE_EFFECTs --- data/battle_scripts_1.s | 24 ++++++++++++++++-------- include/battle_scripts.h | 2 ++ include/constants/battle.h | 4 +++- src/battle_script_commands.c | 20 ++++++++++++++++++++ 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index d64336638..238c0e21b 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -441,14 +441,18 @@ BattleScript_EffectStoneAxe:: waitmessage B_WAIT_TIME_LONG resultmessage waitmessage B_WAIT_TIME_LONG - seteffectwithchance tryfaintmon BS_TARGET - setstealthrock BattleScript_ButItFailed - printstring STRINGID_POINTEDSTONESFLOAT - waitmessage B_WAIT_TIME_LONG + setmoveeffect MOVE_EFFECT_STEALTH_ROCK + seteffectprimary moveendall end +BattleScript_StealthRockActivates:: + setstealthrock BattleScript_MoveEnd + printstring STRINGID_POINTEDSTONESFLOAT + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + BattleScript_EffectDireClaw:: setmoveeffect MOVE_EFFECT_DIRE_CLAW goto BattleScript_EffectHit @@ -472,14 +476,18 @@ BattleScript_EffectCeaselessEdge:: waitmessage B_WAIT_TIME_LONG resultmessage waitmessage B_WAIT_TIME_LONG - seteffectwithchance tryfaintmon BS_TARGET - trysetspikes BattleScript_ButItFailedAtkStringPpReduce - printstring STRINGID_SPIKESSCATTERED - waitmessage B_WAIT_TIME_LONG + setmoveeffect MOVE_EFFECT_SPIKES + seteffectprimary moveendall end +BattleScript_SpikesActivate:: + trysetspikes BattleScript_MoveEnd + printstring STRINGID_SPIKESSCATTERED + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + BattleScript_EffectTeatime:: attackcanceler attackstring diff --git a/include/battle_scripts.h b/include/battle_scripts.h index d79566a44..55caf9022 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -448,6 +448,8 @@ extern const u8 BattleScript_SupremeOverlordActivates[]; extern const u8 BattleScript_CostarActivates[]; extern const u8 BattleScript_ToxicDebrisActivates[]; extern const u8 BattleScript_EarthEaterActivates[]; +extern const u8 BattleScript_StealthRockActivates[]; +extern const u8 BattleScript_SpikesActivate[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[]; diff --git a/include/constants/battle.h b/include/constants/battle.h index fa9d4bd18..e7e65951b 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -372,8 +372,10 @@ #define MOVE_EFFECT_TRAP_BOTH 70 #define MOVE_EFFECT_DOUBLE_SHOCK 71 #define MOVE_EFFECT_DIRE_CLAW 72 +#define MOVE_EFFECT_STEALTH_ROCK 73 +#define MOVE_EFFECT_SPIKES 74 -#define NUM_MOVE_EFFECTS 73 +#define NUM_MOVE_EFFECTS 75 #define MOVE_EFFECT_AFFECTS_USER 0x4000 #define MOVE_EFFECT_CERTAIN 0x8000 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index fcf09641f..9a8a2cabf 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2789,6 +2789,7 @@ void SetMoveEffect(bool32 primary, u32 certain) bool32 mirrorArmorReflected = (GetBattlerAbility(gBattlerTarget) == ABILITY_MIRROR_ARMOR); u32 flags = 0; u16 battlerAbility; + bool8 activateAfterFaint = FALSE; if (gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_1ST_HIT && gBattleMons[gBattlerTarget].hp != 0 @@ -2806,6 +2807,10 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattleStruct->moveEffect2 = gBattleScripting.moveEffect; gBattlescriptCurrInstr++; return; + case MOVE_EFFECT_STEALTH_ROCK: + case MOVE_EFFECT_SPIKES: + activateAfterFaint = TRUE; + break; } if (gBattleScripting.moveEffect & MOVE_EFFECT_AFFECTS_USER) @@ -2838,6 +2843,7 @@ void SetMoveEffect(bool32 primary, u32 certain) INCREMENT_RESET_RETURN if (gBattleMons[gEffectBattler].hp == 0 + && !activateAfterFaint && gBattleScripting.moveEffect != MOVE_EFFECT_PAYDAY && gBattleScripting.moveEffect != MOVE_EFFECT_STEAL_ITEM && gBattleScripting.moveEffect != MOVE_EFFECT_BUG_BITE) @@ -3659,6 +3665,20 @@ void SetMoveEffect(bool32 primary, u32 certain) SetMoveEffect(TRUE, 0); } break; + case MOVE_EFFECT_STEALTH_ROCK: + if (!(gSideStatuses[GetBattlerSide(gEffectBattler)] & SIDE_STATUS_STEALTH_ROCK)) + { + BattleScriptPush(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = BattleScript_StealthRockActivates; + } + break; + case MOVE_EFFECT_SPIKES: + if (!(gSideStatuses[GetBattlerSide(gEffectBattler)] & SIDE_STATUS_SPIKES)) + { + BattleScriptPush(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = BattleScript_SpikesActivate; + } + break; } } } From f39f48fc5102c10eeed978e9832f501c607e64d5 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 5 Jan 2023 03:07:28 -0300 Subject: [PATCH 13/17] Made MOVE_EFFECT_DIRE_CLAW a tiny bit prettier --- src/battle_script_commands.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 9a8a2cabf..74e5f31ef 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3654,11 +3654,7 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattlescriptCurrInstr = BattleScript_DoubleShockRemoveType; break; case MOVE_EFFECT_DIRE_CLAW: - if (gBattleMons[gEffectBattler].status1) - { - gBattlescriptCurrInstr++; - } - else + if (!gBattleMons[gEffectBattler].status1) { static const u8 sDireClawEffects[] = { MOVE_EFFECT_POISON, MOVE_EFFECT_PARALYSIS, MOVE_EFFECT_SLEEP }; gBattleScripting.moveEffect = sDireClawEffects[Random() % 3]; From fe74dd938b3a6a4547d9f3fbc1fdd6b7396b16c6 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 1 Mar 2023 04:00:19 -0300 Subject: [PATCH 14/17] Small corrections --- data/battle_scripts_1.s | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 70730d2a9..2556d60e1 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -417,7 +417,7 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectVictoryDance @ EFFECT_VICTORY_DANCE .4byte BattleScript_EffectTeatime @ EFFECT_TEATIME .4byte BattleScript_EffectAttackUpUserAlly @ EFFECT_ATTACK_UP_USER_ALLY - .4byte BattleScript_EffectShellTrap @ EFFECT_SHELL_TRAP + .4byte BattleScript_EffectShellTrap @ EFFECT_SHELL_TRAP .4byte BattleScript_EffectCeaselessEdge @ EFFECT_CEASELESS_EDGE .4byte BattleScript_EffectDireClaw @ EFFECT_DIRE_CLAW .4byte BattleScript_EffectStoneAxe @ EFFECT_STONE_AXE @@ -524,7 +524,7 @@ BattleScript_EffectAttackUpUserAlly_AllyAnim: playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 printfromtable gStatUpStringIds waitmessage B_WAIT_TIME_LONG - goto BattleScript_EffectAttackUpUserAlly_Ends + goto BattleScript_EffectAttackUpUserAlly_End BattleScript_EffectTeatime:: attackcanceler From fe735f9700262fe0baf103ba77af83c9cf6c59f7 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 1 Mar 2023 20:03:27 -0300 Subject: [PATCH 15/17] Applied review suggestions -Merged EFFECT_CEASELESS_EDGE and EFFECT_STONE_AXE into EFFECT_HIT_SET_ENTRY_HAZARD -Updated gDmgHazardsStringIds and relevant battle scripts. Can't say that I like it at all. String tables are stupid imo. -Coupled Barb Barrage's effect in CalcMoveBasePower with Venoshock's --- data/battle_scripts_1.s | 36 ++++--------------------- include/constants/battle_move_effects.h | 7 +++-- include/constants/battle_string_ids.h | 6 +++++ src/battle_ai_main.c | 5 ++-- src/battle_message.c | 5 +++- src/battle_script_commands.c | 6 +++-- src/battle_util.c | 5 +--- src/data/battle_moves.h | 6 +++-- 8 files changed, 29 insertions(+), 47 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 2556d60e1..425834b7e 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -418,39 +418,13 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectTeatime @ EFFECT_TEATIME .4byte BattleScript_EffectAttackUpUserAlly @ EFFECT_ATTACK_UP_USER_ALLY .4byte BattleScript_EffectShellTrap @ EFFECT_SHELL_TRAP - .4byte BattleScript_EffectCeaselessEdge @ EFFECT_CEASELESS_EDGE + .4byte BattleScript_EffectHitSetEntryHazard @ EFFECT_HIT_SET_ENTRY_HAZARD .4byte BattleScript_EffectDireClaw @ EFFECT_DIRE_CLAW - .4byte BattleScript_EffectStoneAxe @ EFFECT_STONE_AXE .4byte BattleScript_EffectBarbBarrage @ EFFECT_BARB_BARRAGE -BattleScript_EffectStoneAxe:: - attackcanceler - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - attackstring - ppreduce - critcalc - damagecalc - adjustdamage - attackanimation - waitanimation - effectivenesssound - hitanimation BS_TARGET - waitstate - healthbarupdate BS_TARGET - datahpupdate BS_TARGET - critmessage - waitmessage B_WAIT_TIME_LONG - resultmessage - waitmessage B_WAIT_TIME_LONG - tryfaintmon BS_TARGET - setmoveeffect MOVE_EFFECT_STEALTH_ROCK - seteffectprimary - moveendall - end - BattleScript_StealthRockActivates:: setstealthrock BattleScript_MoveEnd - printstring STRINGID_POINTEDSTONESFLOAT + printfromtable gDmgHazardsStringIds waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd @@ -458,7 +432,7 @@ BattleScript_EffectDireClaw:: setmoveeffect MOVE_EFFECT_DIRE_CLAW goto BattleScript_EffectHit -BattleScript_EffectCeaselessEdge:: +BattleScript_EffectHitSetEntryHazard:: attackcanceler accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE attackstring @@ -478,14 +452,14 @@ BattleScript_EffectCeaselessEdge:: resultmessage waitmessage B_WAIT_TIME_LONG tryfaintmon BS_TARGET - setmoveeffect MOVE_EFFECT_SPIKES + argumenttomoveeffect seteffectprimary moveendall end BattleScript_SpikesActivate:: trysetspikes BattleScript_MoveEnd - printstring STRINGID_SPIKESSCATTERED + printfromtable gDmgHazardsStringIds waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 0adee76c9..ad589211c 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -399,11 +399,10 @@ #define EFFECT_TEATIME 393 #define EFFECT_ATTACK_UP_USER_ALLY 394 // Howl 8th Gen #define EFFECT_SHELL_TRAP 395 -#define EFFECT_CEASELESS_EDGE 396 +#define EFFECT_HIT_SET_ENTRY_HAZARD 396 #define EFFECT_DIRE_CLAW 397 -#define EFFECT_STONE_AXE 398 -#define EFFECT_BARB_BARRAGE 399 +#define EFFECT_BARB_BARRAGE 398 -#define NUM_BATTLE_MOVE_EFFECTS 400 +#define NUM_BATTLE_MOVE_EFFECTS 399 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index f3e702ec4..01065e047 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -921,4 +921,10 @@ #define B_MSG_Z_STAT_UP 5 #define B_MSG_Z_HP_TRAP 6 +// gDmgHazardsStringIds +#define B_MSG_PKMNHURTBYSPIKES 0 +#define B_MSG_STEALTHROCKDMG 1 +#define B_MSG_POINTEDSTONESFLOAT 2 +#define B_MSG_SPIKESSCATTERED 3 + #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index bbc1660fa..f61dc49a8 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -3872,9 +3872,8 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_SPIKES: - case EFFECT_CEASELESS_EDGE: + case EFFECT_HIT_SET_ENTRY_HAZARD: case EFFECT_STEALTH_ROCK: - case EFFECT_STONE_AXE: case EFFECT_STICKY_WEB: case EFFECT_TOXIC_SPIKES: if (AI_DATA->abilities[battlerDef] == ABILITY_MAGIC_BOUNCE || CountUsablePartyMons(battlerDef) == 0) @@ -4910,7 +4909,7 @@ static s16 AI_SetupFirstTurn(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_HAIL: case EFFECT_GEOMANCY: case EFFECT_VICTORY_DANCE: - case EFFECT_STONE_AXE: + case EFFECT_HIT_SET_ENTRY_HAZARD: score += 2; break; default: diff --git a/src/battle_message.c b/src/battle_message.c index 29580ded0..99f88f53b 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1462,7 +1462,10 @@ const u16 gHealingWishStringIds[] = const u16 gDmgHazardsStringIds[] = { - STRINGID_PKMNHURTBYSPIKES, STRINGID_STEALTHROCKDMG + [B_MSG_PKMNHURTBYSPIKES] = STRINGID_PKMNHURTBYSPIKES, + [B_MSG_STEALTHROCKDMG] = STRINGID_STEALTHROCKDMG, + [B_MSG_POINTEDSTONESFLOAT] = STRINGID_POINTEDSTONESFLOAT, + [B_MSG_SPIKESSCATTERED] = STRINGID_SPIKESSCATTERED }; const u16 gSwitchInAbilityStringIds[] = diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index a445786ce..0799cf2f3 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3768,6 +3768,7 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_STEALTH_ROCK: if (!(gSideStatuses[GetBattlerSide(gEffectBattler)] & SIDE_STATUS_STEALTH_ROCK)) { + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_POINTEDSTONESFLOAT; BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_StealthRockActivates; } @@ -3775,6 +3776,7 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_SPIKES: if (!(gSideStatuses[GetBattlerSide(gEffectBattler)] & SIDE_STATUS_SPIKES)) { + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SPIKESSCATTERED; BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_SpikesActivate; } @@ -7045,7 +7047,7 @@ static void Cmd_switchineffects(void) gBattleMoveDamage = 1; gSideStatuses[GetBattlerSide(gActiveBattler)] |= SIDE_STATUS_SPIKES_DAMAGED; - SetDmgHazardsBattlescript(gActiveBattler, 0); + SetDmgHazardsBattlescript(gActiveBattler, B_MSG_PKMNHURTBYSPIKES); } else if (!(gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_STEALTH_ROCK_DAMAGED) && (gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_STEALTH_ROCK) @@ -7056,7 +7058,7 @@ static void Cmd_switchineffects(void) gBattleMoveDamage = GetStealthHazardDamage(gBattleMoves[MOVE_STEALTH_ROCK].type, gActiveBattler); if (gBattleMoveDamage != 0) - SetDmgHazardsBattlescript(gActiveBattler, 1); + SetDmgHazardsBattlescript(gActiveBattler, B_MSG_STEALTHROCKDMG); } else if (!(gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_TOXIC_SPIKES_DAMAGED) && (gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_TOXIC_SPIKES) diff --git a/src/battle_util.c b/src/battle_util.c index a94467085..9b3a39406 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8761,10 +8761,6 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) basePower = CalcBeatUpPower(); #endif break; - case EFFECT_BARB_BARRAGE: - if (gBattleMons[battlerDef].status1 & STATUS1_PSN_ANY) - basePower *= 2; - break; } // Move-specific base power changes @@ -9130,6 +9126,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe if (gBattleMons[battlerDef].hp <= (gBattleMons[battlerDef].maxHP / 2)) MulModifier(&modifier, UQ_4_12(2.0)); break; + case EFFECT_BARB_BARRAGE: case EFFECT_VENOSHOCK: if (gBattleMons[battlerDef].status1 & STATUS1_PSN_ANY) MulModifier(&modifier, UQ_4_12(2.0)); diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index cc4e322f2..530dacd13 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -13323,7 +13323,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = [MOVE_STONE_AXE] = { - .effect = EFFECT_STONE_AXE, + .effect = EFFECT_HIT_SET_ENTRY_HAZARD, .power = 65, .type = TYPE_ROCK, .accuracy = 90, @@ -13335,6 +13335,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .split = SPLIT_PHYSICAL, .zMovePower = 120, .zMoveEffect = Z_EFFECT_NONE, + .argument = MOVE_EFFECT_STEALTH_ROCK, }, [MOVE_SPRINGTIDE_STORM] = @@ -13599,7 +13600,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = [MOVE_CEASELESS_EDGE] = { - .effect = EFFECT_CEASELESS_EDGE, + .effect = EFFECT_HIT_SET_ENTRY_HAZARD, .power = 65, .type = TYPE_DARK, .accuracy = 90, @@ -13611,6 +13612,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .split = SPLIT_PHYSICAL, .zMovePower = 120, .zMoveEffect = Z_EFFECT_NONE, + .argument = MOVE_EFFECT_SPIKES, }, [MOVE_BLEAKWIND_STORM] = From aefd3189456da25904b0e39a6ca2a5f63c1a3505 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Tue, 14 Mar 2023 11:43:52 -0300 Subject: [PATCH 16/17] Applied review suggestions and expanded usage of activateAfterFaint in Cmd_setmoveeffect --- data/battle_scripts_1.s | 25 ++----------------------- include/battle_scripts.h | 2 +- src/battle_script_commands.c | 13 ++++++------- src/data/battle_moves.h | 4 ++-- 4 files changed, 11 insertions(+), 33 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 425834b7e..4c61e5e69 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -433,31 +433,10 @@ BattleScript_EffectDireClaw:: goto BattleScript_EffectHit BattleScript_EffectHitSetEntryHazard:: - attackcanceler - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - attackstring - ppreduce - critcalc - damagecalc - adjustdamage - attackanimation - waitanimation - effectivenesssound - hitanimation BS_TARGET - waitstate - healthbarupdate BS_TARGET - datahpupdate BS_TARGET - critmessage - waitmessage B_WAIT_TIME_LONG - resultmessage - waitmessage B_WAIT_TIME_LONG - tryfaintmon BS_TARGET argumenttomoveeffect - seteffectprimary - moveendall - end + goto BattleScript_EffectHit -BattleScript_SpikesActivate:: +BattleScript_SpikesActivates:: trysetspikes BattleScript_MoveEnd printfromtable gDmgHazardsStringIds waitmessage B_WAIT_TIME_LONG diff --git a/include/battle_scripts.h b/include/battle_scripts.h index c4b15d9f1..c6cbddcd3 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -457,7 +457,7 @@ extern const u8 BattleScript_LunarDanceActivates[]; extern const u8 BattleScript_ShellTrapSetUp[]; extern const u8 BattleScript_CouldntFullyProtect[]; extern const u8 BattleScript_StealthRockActivates[]; -extern const u8 BattleScript_SpikesActivate[]; +extern const u8 BattleScript_SpikesActivates[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[]; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 0799cf2f3..15a72c7e8 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2896,6 +2896,9 @@ void SetMoveEffect(bool32 primary, u32 certain) return; case MOVE_EFFECT_STEALTH_ROCK: case MOVE_EFFECT_SPIKES: + case MOVE_EFFECT_PAYDAY: + case MOVE_EFFECT_STEAL_ITEM: + case MOVE_EFFECT_BUG_BITE: activateAfterFaint = TRUE; break; } @@ -2938,11 +2941,7 @@ void SetMoveEffect(bool32 primary, u32 certain) if (TestSheerForceFlag(gBattlerAttacker, gCurrentMove) && affectsUser != MOVE_EFFECT_AFFECTS_USER) INCREMENT_RESET_RETURN - if (gBattleMons[gEffectBattler].hp == 0 - && !activateAfterFaint - && gBattleScripting.moveEffect != MOVE_EFFECT_PAYDAY - && gBattleScripting.moveEffect != MOVE_EFFECT_STEAL_ITEM - && gBattleScripting.moveEffect != MOVE_EFFECT_BUG_BITE) + if (gBattleMons[gEffectBattler].hp == 0 && !activateAfterFaint) INCREMENT_RESET_RETURN if (DoesSubstituteBlockMove(gBattlerAttacker, gEffectBattler, gCurrentMove) && affectsUser != MOVE_EFFECT_AFFECTS_USER) @@ -3761,7 +3760,7 @@ void SetMoveEffect(bool32 primary, u32 certain) if (!gBattleMons[gEffectBattler].status1) { static const u8 sDireClawEffects[] = { MOVE_EFFECT_POISON, MOVE_EFFECT_PARALYSIS, MOVE_EFFECT_SLEEP }; - gBattleScripting.moveEffect = sDireClawEffects[Random() % 3]; + gBattleScripting.moveEffect = sDireClawEffects[Random() % ARRAY_COUNT(sDireClawEffects)]; SetMoveEffect(TRUE, 0); } break; @@ -3778,7 +3777,7 @@ void SetMoveEffect(bool32 primary, u32 certain) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SPIKESSCATTERED; BattleScriptPush(gBattlescriptCurrInstr + 1); - gBattlescriptCurrInstr = BattleScript_SpikesActivate; + gBattlescriptCurrInstr = BattleScript_SpikesActivates; } break; } diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 530dacd13..22eb7ca1a 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -13328,7 +13328,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .type = TYPE_ROCK, .accuracy = 90, .pp = 15, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_SLICING_MOVE, @@ -13605,7 +13605,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .type = TYPE_DARK, .accuracy = 90, .pp = 15, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_SLICING_MOVE, From 8cf357a37ba4c57efd638a1bd22e24a3e31a649e Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Thu, 23 Mar 2023 12:29:04 +0100 Subject: [PATCH 17/17] tests for dire claw ceaseless edge barb barrage --- src/battle_message.c | 2 +- src/battle_script_commands.c | 2 +- test/move_effect_barb_barrage.c | 43 +++++++ test/move_effect_dire_claw.c | 138 +++++++++++++++++++++ test/move_effect_hit_set_entry_hazardss.c | 117 ++++++++++++++++++ test/move_effect_spikes.c | 8 +- test/move_effect_tri_attack.c | 144 ++++++++++++++++++++++ test/move_effect_venoshock.c | 27 ++++ 8 files changed, 475 insertions(+), 6 deletions(-) create mode 100644 test/move_effect_barb_barrage.c create mode 100644 test/move_effect_dire_claw.c create mode 100644 test/move_effect_hit_set_entry_hazardss.c create mode 100644 test/move_effect_tri_attack.c create mode 100644 test/move_effect_venoshock.c diff --git a/src/battle_message.c b/src/battle_message.c index 562680f89..2ecfac0c7 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -209,7 +209,7 @@ static const u8 sText_PkmnFellIntoNightmare[] = _("{B_DEF_NAME_WITH_PREFIX} fell static const u8 sText_PkmnLockedInNightmare[] = _("{B_ATK_NAME_WITH_PREFIX} is locked\nin a NIGHTMARE!"); static const u8 sText_PkmnLaidCurse[] = _("{B_ATK_NAME_WITH_PREFIX} cut its own HP and\nlaid a CURSE on {B_DEF_NAME_WITH_PREFIX}!"); static const u8 sText_PkmnAfflictedByCurse[] = _("{B_ATK_NAME_WITH_PREFIX} is afflicted\nby the CURSE!"); -static const u8 sText_SpikesScattered[] = _("Spikes were scattered all around\nthe opponent's side!"); +static const u8 sText_SpikesScattered[] = _("Spikes were scattered all around\n{B_DEF_TEAM2} team!"); static const u8 sText_PkmnHurtBySpikes[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} is hurt\nby spikes!"); static const u8 sText_PkmnIdentified[] = _("{B_ATK_NAME_WITH_PREFIX} identified\n{B_DEF_NAME_WITH_PREFIX}!"); static const u8 sText_PkmnPerishCountFell[] = _("{B_ATK_NAME_WITH_PREFIX}'s PERISH count\nfell to {B_BUFF1}!"); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index bd444e04e..34257d896 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3783,7 +3783,7 @@ void SetMoveEffect(bool32 primary, u32 certain) } break; case MOVE_EFFECT_SPIKES: - if (!(gSideStatuses[GetBattlerSide(gEffectBattler)] & SIDE_STATUS_SPIKES)) + if (gSideTimers[GetBattlerSide(gEffectBattler)].spikesAmount < 3) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SPIKESSCATTERED; BattleScriptPush(gBattlescriptCurrInstr + 1); diff --git a/test/move_effect_barb_barrage.c b/test/move_effect_barb_barrage.c new file mode 100644 index 000000000..9d9c2cc84 --- /dev/null +++ b/test/move_effect_barb_barrage.c @@ -0,0 +1,43 @@ +#include "global.h" +#include "test_battle.h" + +ASSUMPTIONS +{ + //ASSUME(gBattleMoves[MOVE_BARB_BARRAGE].effect == EFFECT_BARB_BARRAGE); +} + +SINGLE_BATTLE_TEST("Barb Barrage inflicts poison") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_BARB_BARRAGE); } + TURN {} + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_BARB_BARRAGE, player); + HP_BAR(opponent); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); + STATUS_ICON(opponent, poison: TRUE); + } +} + +SINGLE_BATTLE_TEST("Barb Barrage's power doubles if the target is poisoned/badly poisoned", s16 damage) +{ + u32 status1; + PARAMETRIZE { status1 = 0; } + PARAMETRIZE { status1 = STATUS1_POISON; } + PARAMETRIZE { status1 = STATUS1_TOXIC_POISON; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) {Status1(status1);} + } WHEN { + TURN { MOVE(player, MOVE_BARB_BARRAGE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_BARB_BARRAGE, player); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(2.0), results[1].damage); + EXPECT_MUL_EQ(results[0].damage, Q_4_12(2.0), results[2].damage); + } +} diff --git a/test/move_effect_dire_claw.c b/test/move_effect_dire_claw.c new file mode 100644 index 000000000..a5270ce3f --- /dev/null +++ b/test/move_effect_dire_claw.c @@ -0,0 +1,138 @@ +#include "global.h" +#include "test_battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_DIRE_CLAW].effect == EFFECT_DIRE_CLAW); +} + +// found by brute-force +#define RNG_SLEEP 0xcb0 +#define RNG_POISON 0x2BE +#define RNG_PARALYSIS 5 + +SINGLE_BATTLE_TEST("Dire Claw can inflict poison, paralysis or sleep") +{ + u8 statusAnim; + u32 rng; + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PSN; rng = RNG_POISON; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_SLP; rng = RNG_SLEEP; } + GIVEN { + RNGSeed(rng); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_DIRE_CLAW); } + TURN {} + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_DIRE_CLAW, player); + HP_BAR(opponent); + ANIMATION(ANIM_TYPE_STATUS, statusAnim, opponent); + if (statusAnim == B_ANIM_STATUS_PRZ) { + STATUS_ICON(opponent, paralysis: TRUE); + } + else if (statusAnim == B_ANIM_STATUS_SLP) { + STATUS_ICON(opponent, sleep: TRUE); + } + else if (statusAnim == B_ANIM_STATUS_PSN) { + STATUS_ICON(opponent, poison: TRUE); + } + } +} + +SINGLE_BATTLE_TEST("Dire Claw cannot poison/paralyze poison/electric types respectively") +{ + u8 statusAnim; + u16 species; + u32 rng; + #if B_PARALYZE_ELECTRIC >= GEN_6 + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; species = SPECIES_RAICHU; } + #endif // B_PARALYZE_ELECTRIC + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PSN; rng = RNG_POISON; species = SPECIES_ARBOK;} + GIVEN { + RNGSeed(rng); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(species); + } WHEN { + TURN { MOVE(player, MOVE_DIRE_CLAW); } + TURN {} + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_DIRE_CLAW, player); + HP_BAR(opponent); + NOT ANIMATION(ANIM_TYPE_STATUS, statusAnim, opponent); + if (statusAnim == B_ANIM_STATUS_PRZ) { + NOT STATUS_ICON(opponent, paralysis: TRUE); + } + else if (statusAnim == B_ANIM_STATUS_PSN) { + NOT STATUS_ICON(opponent, poison: TRUE); + } + } +} + +SINGLE_BATTLE_TEST("Dire Claw cannot poison/paralyze/cause to fall asleep pokemon with abilities preventing respective statuses") +{ + u8 statusAnim; + u16 species, ability; + u32 rng; + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; species = SPECIES_RAICHU; ability = ABILITY_LIGHTNING_ROD; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; species = SPECIES_JOLTEON; ability = ABILITY_VOLT_ABSORB; } + #if P_GEN_4_POKEMON == TRUE + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; species = SPECIES_ELECTIVIRE; ability = ABILITY_MOTOR_DRIVE; } + #endif // P_GEN_4_POKEMON + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PSN; rng = RNG_POISON; species = SPECIES_ZANGOOSE; ability = ABILITY_IMMUNITY; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_SLP; rng = RNG_SLEEP; species = SPECIES_VIGOROTH; ability = ABILITY_VITAL_SPIRIT; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_SLP; rng = RNG_SLEEP; species = SPECIES_HYPNO; ability = ABILITY_INSOMNIA; } + + GIVEN { + RNGSeed(rng); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(species) {Ability(ability);} + } WHEN { + TURN { MOVE(player, MOVE_DIRE_CLAW); } + TURN {} + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_DIRE_CLAW, player); + HP_BAR(opponent); + NOT ANIMATION(ANIM_TYPE_STATUS, statusAnim, opponent); + if (statusAnim == B_ANIM_STATUS_PRZ) { + NOT STATUS_ICON(opponent, paralysis: TRUE); + } + else if (statusAnim == B_ANIM_STATUS_SLP) { + NOT STATUS_ICON(opponent, sleep: TRUE); + } + else if (statusAnim == B_ANIM_STATUS_PSN) { + NOT STATUS_ICON(opponent, poison: TRUE); + } + } +} + +SINGLE_BATTLE_TEST("Dire Claw cannot poison/paralyze/cause to fall asleep a mon which is already statused") +{ + u8 statusAnim; + u32 rng; + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PSN; rng = RNG_POISON; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_SLP; rng = RNG_SLEEP; } + GIVEN { + RNGSeed(rng); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) {Status1(STATUS1_BURN);} + } WHEN { + TURN { MOVE(player, MOVE_DIRE_CLAW); } + TURN {} + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_DIRE_CLAW, player); + HP_BAR(opponent); + NOT ANIMATION(ANIM_TYPE_STATUS, statusAnim, opponent); + if (statusAnim == B_ANIM_STATUS_PRZ) { + NOT STATUS_ICON(opponent, paralysis: TRUE); + } + else if (statusAnim == B_ANIM_STATUS_SLP) { + NOT STATUS_ICON(opponent, sleep: TRUE); + } + else if (statusAnim == B_ANIM_STATUS_PSN) { + NOT STATUS_ICON(opponent, poison: TRUE); + } + } +} diff --git a/test/move_effect_hit_set_entry_hazardss.c b/test/move_effect_hit_set_entry_hazardss.c new file mode 100644 index 000000000..4e9761aac --- /dev/null +++ b/test/move_effect_hit_set_entry_hazardss.c @@ -0,0 +1,117 @@ +#include "global.h" +#include "test_battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_STONE_AXE].effect == EFFECT_HIT_SET_ENTRY_HAZARD); + ASSUME(gBattleMoves[MOVE_CEASELESS_EDGE].effect == EFFECT_HIT_SET_ENTRY_HAZARD); +} + +SINGLE_BATTLE_TEST("Stone Axe / Ceaseless Edge set up hazards after hitting the target") +{ + u16 move; + PARAMETRIZE {move = MOVE_STONE_AXE; } + PARAMETRIZE {move = MOVE_CEASELESS_EDGE; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, move); } + TURN { SWITCH(opponent, 1); } + } SCENE { + s32 maxHP = GetMonData(&OPPONENT_PARTY[1], MON_DATA_MAX_HP); + ANIMATION(ANIM_TYPE_MOVE, move, player); + HP_BAR(opponent); + if (move == MOVE_CEASELESS_EDGE) { + MESSAGE("Spikes were scattered all around the opposing team!"); + } + else { + MESSAGE("Pointed stones float in the air around the opposing team!"); + } + MESSAGE("2 sent out Wobbuffet!"); + if (move == MOVE_CEASELESS_EDGE) { + HP_BAR(opponent, damage: maxHP / 8); + MESSAGE("Foe Wobbuffet is hurt by spikes!"); + } + else { + HP_BAR(opponent, damage: maxHP / 8); + MESSAGE("Pointed stones dug into Foe Wobbuffet!"); + } + } +} + +SINGLE_BATTLE_TEST("Ceaseless Edge can set up to 3 layers of Spikes") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WYNAUT); + } WHEN { + TURN { MOVE(player, MOVE_CEASELESS_EDGE); } + TURN { MOVE(player, MOVE_CEASELESS_EDGE); } + TURN { MOVE(player, MOVE_CEASELESS_EDGE); } + TURN { MOVE(player, MOVE_CEASELESS_EDGE); } + TURN { SWITCH(opponent, 1); } + } SCENE { + s32 maxHP = GetMonData(&OPPONENT_PARTY[1], MON_DATA_MAX_HP); + + ANIMATION(ANIM_TYPE_MOVE, MOVE_CEASELESS_EDGE, player); + HP_BAR(opponent); + MESSAGE("Spikes were scattered all around the opposing team!"); + + ANIMATION(ANIM_TYPE_MOVE, MOVE_CEASELESS_EDGE, player); + HP_BAR(opponent); + MESSAGE("Spikes were scattered all around the opposing team!"); + + ANIMATION(ANIM_TYPE_MOVE, MOVE_CEASELESS_EDGE, player); + HP_BAR(opponent); + MESSAGE("Spikes were scattered all around the opposing team!"); + + ANIMATION(ANIM_TYPE_MOVE, MOVE_CEASELESS_EDGE, player); + HP_BAR(opponent); + NOT MESSAGE("Spikes were scattered all around the opposing team!"); + + MESSAGE("2 sent out Wynaut!"); + HP_BAR(opponent, damage: maxHP / 4); + MESSAGE("Foe Wynaut is hurt by spikes!"); + } +} + +SINGLE_BATTLE_TEST("Stone Axe can set up pointed stones only once") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WYNAUT); + } WHEN { + TURN { MOVE(player, MOVE_STONE_AXE); } + TURN { MOVE(player, MOVE_STONE_AXE); } + TURN { MOVE(player, MOVE_STONE_AXE); } + TURN { MOVE(player, MOVE_STONE_AXE); } + TURN { SWITCH(opponent, 1); } + } SCENE { + s32 maxHP = GetMonData(&OPPONENT_PARTY[1], MON_DATA_MAX_HP); + + ANIMATION(ANIM_TYPE_MOVE, MOVE_STONE_AXE, player); + HP_BAR(opponent); + MESSAGE("Pointed stones float in the air around the opposing team!"); + + ANIMATION(ANIM_TYPE_MOVE, MOVE_STONE_AXE, player); + HP_BAR(opponent); + NOT MESSAGE("Pointed stones float in the air around the opposing team!"); + + ANIMATION(ANIM_TYPE_MOVE, MOVE_STONE_AXE, player); + HP_BAR(opponent); + NOT MESSAGE("Pointed stones float in the air around the opposing team!"); + + ANIMATION(ANIM_TYPE_MOVE, MOVE_STONE_AXE, player); + HP_BAR(opponent); + NOT MESSAGE("Pointed stones float in the air around the opposing team!"); + + MESSAGE("2 sent out Wynaut!"); + HP_BAR(opponent, damage: maxHP / 8); + MESSAGE("Pointed stones dug into Foe Wynaut!"); + } +} + diff --git a/test/move_effect_spikes.c b/test/move_effect_spikes.c index 33b0bad4b..0c84a5fb1 100644 --- a/test/move_effect_spikes.c +++ b/test/move_effect_spikes.c @@ -28,7 +28,7 @@ SINGLE_BATTLE_TEST("Spikes damage on switch in") s32 maxHP = GetMonData(&OPPONENT_PARTY[1], MON_DATA_MAX_HP); for (count = 0; count < layers; ++count) { ANIMATION(ANIM_TYPE_MOVE, MOVE_SPIKES, player); - MESSAGE("Spikes were scattered all around the opponent's side!"); + MESSAGE("Spikes were scattered all around the opposing team!"); } MESSAGE("2 sent out Wynaut!"); HP_BAR(opponent, damage: maxHP / divisor); @@ -51,11 +51,11 @@ SINGLE_BATTLE_TEST("Spikes fails after 3 layers") } SCENE { s32 maxHP = GetMonData(&OPPONENT_PARTY[1], MON_DATA_MAX_HP); ANIMATION(ANIM_TYPE_MOVE, MOVE_SPIKES, player); - MESSAGE("Spikes were scattered all around the opponent's side!"); + MESSAGE("Spikes were scattered all around the opposing team!"); ANIMATION(ANIM_TYPE_MOVE, MOVE_SPIKES, player); - MESSAGE("Spikes were scattered all around the opponent's side!"); + MESSAGE("Spikes were scattered all around the opposing team!"); ANIMATION(ANIM_TYPE_MOVE, MOVE_SPIKES, player); - MESSAGE("Spikes were scattered all around the opponent's side!"); + MESSAGE("Spikes were scattered all around the opposing team!"); MESSAGE("Wobbuffet used Spikes!"); MESSAGE("But it failed!"); MESSAGE("2 sent out Wynaut!"); diff --git a/test/move_effect_tri_attack.c b/test/move_effect_tri_attack.c new file mode 100644 index 000000000..31627ef2d --- /dev/null +++ b/test/move_effect_tri_attack.c @@ -0,0 +1,144 @@ +#include "global.h" +#include "test_battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_TRI_ATTACK].effect == EFFECT_TRI_ATTACK); +} + +// found by brute-force +#define RNG_PARALYSIS 0xcb0 +#define RNG_BURN 0x2BE +#define RNG_FREEZE 5 + +SINGLE_BATTLE_TEST("Tri Attack can inflict paralysis, burn or freeze") +{ + u8 statusAnim; + u32 rng; + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_BRN; rng = RNG_BURN; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_FRZ; rng = RNG_FREEZE; } + GIVEN { + RNGSeed(rng); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_TRI_ATTACK); } + TURN {} + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TRI_ATTACK, player); + HP_BAR(opponent); + ANIMATION(ANIM_TYPE_STATUS, statusAnim, opponent); + if (statusAnim == B_ANIM_STATUS_BRN) { + STATUS_ICON(opponent, burn: TRUE); + } + else if (statusAnim == B_ANIM_STATUS_FRZ) { + STATUS_ICON(opponent, freeze: TRUE); + } + else if (statusAnim == B_ANIM_STATUS_PRZ) { + STATUS_ICON(opponent, paralysis: TRUE); + } + } +} + +SINGLE_BATTLE_TEST("Tri Attack cannot paralyze/burn/freeze electric/fire/ice types respectively") +{ + u8 statusAnim; + u16 species; + u32 rng; + #if B_PARALYZE_ELECTRIC >= GEN_6 + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; species = SPECIES_RAICHU;} + #endif // B_PARALYZE_ELECTRIC + PARAMETRIZE { statusAnim = B_ANIM_STATUS_BRN; rng = RNG_BURN; species = SPECIES_ARCANINE; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_FRZ; rng = RNG_FREEZE; species = SPECIES_GLALIE; } + GIVEN { + RNGSeed(rng); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(species); + } WHEN { + TURN { MOVE(player, MOVE_TRI_ATTACK); } + TURN {} + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TRI_ATTACK, player); + HP_BAR(opponent); + NOT ANIMATION(ANIM_TYPE_STATUS, statusAnim, opponent); + if (statusAnim == B_ANIM_STATUS_BRN) { + NOT STATUS_ICON(opponent, burn: TRUE); + } + else if (statusAnim == B_ANIM_STATUS_FRZ) { + NOT STATUS_ICON(opponent, freeze: TRUE); + } + else if (statusAnim == B_ANIM_STATUS_PRZ) { + NOT STATUS_ICON(opponent, paralysis: TRUE); + } + } +} + +SINGLE_BATTLE_TEST("Tri Attack cannot paralyze/burn/freeze pokemon with abilities preventing respective statuses") +{ + u8 statusAnim; + u16 species, ability; + u32 rng; + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; species = SPECIES_RAICHU; ability = ABILITY_LIGHTNING_ROD; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; species = SPECIES_JOLTEON; ability = ABILITY_VOLT_ABSORB; } + #if P_GEN_4_POKEMON == TRUE + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; species = SPECIES_ELECTIVIRE; ability = ABILITY_MOTOR_DRIVE; } + #endif // P_GEN_4_POKEMON + #if P_GEN_7_POKEMON == TRUE + PARAMETRIZE { statusAnim = B_ANIM_STATUS_BRN; rng = RNG_BURN; species = SPECIES_DEWPIDER; ability = ABILITY_WATER_BUBBLE; } + #endif // P_GEN_7_POKEMON + PARAMETRIZE { statusAnim = B_ANIM_STATUS_BRN; rng = RNG_BURN; species = SPECIES_SEAKING; ability = ABILITY_WATER_VEIL; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_FRZ; rng = RNG_FREEZE; species = SPECIES_CAMERUPT; ability = ABILITY_MAGMA_ARMOR; } + + GIVEN { + RNGSeed(rng); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(species) {Ability(ability);} + } WHEN { + TURN { MOVE(player, MOVE_TRI_ATTACK); } + TURN {} + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TRI_ATTACK, player); + HP_BAR(opponent); + NOT ANIMATION(ANIM_TYPE_STATUS, statusAnim, opponent); + if (statusAnim == B_ANIM_STATUS_BRN) { + NOT STATUS_ICON(opponent, burn: TRUE); + } + else if (statusAnim == B_ANIM_STATUS_FRZ) { + NOT STATUS_ICON(opponent, freeze: TRUE); + } + else if (statusAnim == B_ANIM_STATUS_PRZ) { + NOT STATUS_ICON(opponent, paralysis: TRUE); + } + } +} + +SINGLE_BATTLE_TEST("Tri Attack cannot paralyze/burn/freeze a mon which is already statused") +{ + u8 statusAnim; + u32 rng; + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_BRN; rng = RNG_BURN; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_FRZ; rng = RNG_FREEZE; } + GIVEN { + RNGSeed(rng); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) {Status1(STATUS1_SLEEP);} + } WHEN { + TURN { MOVE(player, MOVE_TRI_ATTACK); } + TURN {} + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TRI_ATTACK, player); + HP_BAR(opponent); + NOT ANIMATION(ANIM_TYPE_STATUS, statusAnim, opponent); + if (statusAnim == B_ANIM_STATUS_BRN) { + NOT STATUS_ICON(opponent, burn: TRUE); + } + else if (statusAnim == B_ANIM_STATUS_FRZ) { + NOT STATUS_ICON(opponent, freeze: TRUE); + } + else if (statusAnim == B_ANIM_STATUS_PRZ) { + NOT STATUS_ICON(opponent, paralysis: TRUE); + } + } +} diff --git a/test/move_effect_venoshock.c b/test/move_effect_venoshock.c new file mode 100644 index 000000000..876f611c9 --- /dev/null +++ b/test/move_effect_venoshock.c @@ -0,0 +1,27 @@ +#include "global.h" +#include "test_battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_VENOSHOCK].effect == EFFECT_VENOSHOCK); +} + +SINGLE_BATTLE_TEST("Venoshock's power doubles if the target is poisoned/badly poisoned", s16 damage) +{ + u32 status1; + PARAMETRIZE { status1 = 0; } + PARAMETRIZE { status1 = STATUS1_POISON; } + PARAMETRIZE { status1 = STATUS1_TOXIC_POISON; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) {Status1(status1);} + } WHEN { + TURN { MOVE(player, MOVE_VENOSHOCK); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_VENOSHOCK, player); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(2.0), results[1].damage); + EXPECT_MUL_EQ(results[0].damage, Q_4_12(2.0), results[2].damage); + } +}