From bca29d8586cce1b7d8af6e2174fa895590a3cc53 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 26 Jul 2023 17:17:33 +0200 Subject: [PATCH 1/3] Adds Mortal Spin and Population Bomb --- data/battle_scripts_1.s | 13 ++++++++++++- include/constants/battle_move_effects.h | 4 +++- src/battle_ai_main.c | 2 ++ src/battle_ai_util.c | 2 +- src/battle_script_commands.c | 6 +++--- src/battle_util.c | 5 ----- src/data/battle_moves.h | 9 ++++++--- test/move_effect_mortal_spin.c | 24 ++++++++++++++++++++++++ 8 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 test/move_effect_mortal_spin.c diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index ec6958d94..db0cebc4b 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -435,6 +435,17 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectHit @ EFFECT_COLLISION_COURSE .4byte BattleScript_EffectSpinOut @ EFFECT_SPIN_OUT .4byte BattleScript_EffectMakeItRain @ EFFECT_MAKE_IT_RAIN + .4byte BattleScript_EffectHit @ EFFECT_POPULATION_BOMB + .4byte BattleScript_EffectMortalSpin @ EFFECT_MORTAL_SPIN + +BattleScript_EffectMortalSpin: + call BattleScript_EffectHit_Ret + rapidspinfree + setmoveeffect MOVE_EFFECT_POISON + seteffectwithchance + tryfaintmon BS_TARGET + moveendall + end BattleScript_EffectMakeItRain: setmoveeffect MOVE_EFFECT_PAYDAY @@ -7790,7 +7801,7 @@ BattleScript_WishMegaEvolution:: BattleScript_PrimalReversion:: call BattleScript_PrimalReversionRet end2 - + BattleScript_PrimalReversionRestoreAttacker:: call BattleScript_PrimalReversionRet copybyte gBattlerAttacker, sSAVED_BATTLER diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index bb38d8659..c12f6fbc0 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -412,7 +412,9 @@ #define EFFECT_COLLISION_COURSE 406 #define EFFECT_SPIN_OUT 407 #define EFFECT_MAKE_IT_RAIN 408 +#define EFFECT_POPULATION_BOMB 409 +#define EFFECT_MORTAL_SPIN 410 -#define NUM_BATTLE_MOVE_EFFECTS 409 +#define NUM_BATTLE_MOVE_EFFECTS 411 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 9243bacb9..e231d3d1f 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -3571,6 +3571,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_TOXIC: case EFFECT_POISON: case EFFECT_BARB_BARRAGE: + case EFFECT_MORTAL_SPIN: IncreasePoisonScore(battlerAtk, battlerDef, move, &score); break; case EFFECT_LIGHT_SCREEN: @@ -4246,6 +4247,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case MOVE_RAPID_SPIN: + case MOVE_MORTAL_SPIN: if (gStatuses3[battlerAtk] & STATUS3_LEECHSEED || gBattleMons[battlerAtk].status2 & STATUS2_WRAPPED) score += 3; break; diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index c18209314..dcf653d41 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -865,7 +865,7 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 *typeEffectiveness, } // Handle other multi-strike moves - if (gBattleMoves[move].strikeCount > 1) + if (gBattleMoves[move].strikeCount > 1 && gBattleMoves[move].effect != EFFECT_TRIPLE_KICK) dmg *= gBattleMoves[move].strikeCount; else if (move == MOVE_WATER_SHURIKEN && gBattleMons[battlerAtk].species == SPECIES_GRENINJA_ASH) dmg *= 3; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 1059967ed..36965c465 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1722,10 +1722,10 @@ static void Cmd_accuracycheck(void) gBattlescriptCurrInstr = cmd->nextInstr; } else if (gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_2ND_HIT - || (gSpecialStatuses[gBattlerAttacker].multiHitOn && (gBattleMoves[move].effect != EFFECT_TRIPLE_KICK - || GetBattlerAbility(gBattlerAttacker) == ABILITY_SKILL_LINK))) + || (gSpecialStatuses[gBattlerAttacker].multiHitOn && (GetBattlerAbility(gBattlerAttacker) == ABILITY_SKILL_LINK + || !(gBattleMoves[move].effect == EFFECT_TRIPLE_KICK || gBattleMoves[move].effect == EFFECT_POPULATION_BOMB)))) { - // No acc checks for second hit of Parental Bond or multi hit moves, except Triple Kick/Triple Axel + // No acc checks for second hit of Parental Bond or multi hit moves, except Triple Kick/Triple Axel/Population Bomb gBattlescriptCurrInstr = cmd->nextInstr; } else diff --git a/src/battle_util.c b/src/battle_util.c index 1170ddea7..e64cc5019 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3748,11 +3748,6 @@ u8 AtkCanceller_UnableToUseMove(void) gMultiHitCounter = gBattleMoves[gCurrentMove].strikeCount; PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 3, 0) } - else if (gBattleMoves[gCurrentMove].effect == EFFECT_TRIPLE_KICK) - { - gMultiHitCounter = 3; - PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0) - } #if B_BEAT_UP >= GEN_5 else if (gBattleMoves[gCurrentMove].effect == EFFECT_BEAT_UP) { diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index bb1db2f7d..4e03d68c5 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -2886,6 +2886,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, .makesContact = TRUE, + .strikeCount = 3, }, [MOVE_THIEF] = @@ -12357,6 +12358,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, .makesContact = TRUE, + .strikeCount = 3, }, [MOVE_DUAL_WINGBEAT] = @@ -13152,7 +13154,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = [MOVE_POPULATION_BOMB] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_MULTI_HIT maybe? + .effect = EFFECT_POPULATION_BOMB, .power = 20, .type = TYPE_NORMAL, .accuracy = 90, @@ -13165,6 +13167,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .makesContact = TRUE, .slicingMove = TRUE, .metronomeBanned = TRUE, + .strikeCount = 10, }, [MOVE_ICE_SPINNER] = @@ -13246,12 +13249,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = [MOVE_MORTAL_SPIN] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_MORTAL_SPIN + .effect = EFFECT_MORTAL_SPIN, .power = 30, .type = TYPE_POISON, .accuracy = 100, .pp = 15, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_BOTH, .priority = 0, .split = SPLIT_PHYSICAL, diff --git a/test/move_effect_mortal_spin.c b/test/move_effect_mortal_spin.c new file mode 100644 index 000000000..c3dd04527 --- /dev/null +++ b/test/move_effect_mortal_spin.c @@ -0,0 +1,24 @@ +#include "global.h" +#include "test_battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_MORTAL_SPIN].effect == EFFECT_MORTAL_SPIN); +} + +SINGLE_BATTLE_TEST("Mortal Spin blows away hazards and poisons foe") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_STEALTH_ROCK); MOVE(player, MOVE_MORTAL_SPIN); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_STEALTH_ROCK, opponent); + ANIMATION(ANIM_TYPE_MOVE, MOVE_MORTAL_SPIN, player); + MESSAGE("Wobbuffet blew away Stealth Rock!"); + MESSAGE("Foe Wobbuffet was poisoned!"); + STATUS_ICON(opponent, poison: TRUE); + } +} + From 5fa7a6d4c6710e0a447358fd8e4b8ccb49969619 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 28 Jul 2023 13:20:06 +0200 Subject: [PATCH 2/3] Skill Link Tests, Loaded Dice stuff --- src/battle_script_commands.c | 3 +- src/battle_util.c | 11 +- test/move_effect_multi_hit.c | 135 ++++++++++++++++++ test/move_effect_population_bomb.c | 6 + test/move_effect_triple_kick.c | 6 +- ...ree_strikes.c => move_flag_strike_count.c} | 17 ++- 6 files changed, 173 insertions(+), 5 deletions(-) create mode 100644 test/move_effect_multi_hit.c create mode 100644 test/move_effect_population_bomb.c rename test/{move_flag_three_strikes.c => move_flag_strike_count.c} (76%) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 36965c465..6a3ccde0c 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1722,7 +1722,8 @@ static void Cmd_accuracycheck(void) gBattlescriptCurrInstr = cmd->nextInstr; } else if (gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_2ND_HIT - || (gSpecialStatuses[gBattlerAttacker].multiHitOn && (GetBattlerAbility(gBattlerAttacker) == ABILITY_SKILL_LINK + || (gSpecialStatuses[gBattlerAttacker].multiHitOn + && (GetBattlerAbility(gBattlerAttacker) == ABILITY_SKILL_LINK || GetBattlerHoldEffect(gBattlerAttacker, TRUE) || !(gBattleMoves[move].effect == EFFECT_TRIPLE_KICK || gBattleMoves[move].effect == EFFECT_POPULATION_BOMB)))) { // No acc checks for second hit of Parental Bond or multi hit moves, except Triple Kick/Triple Axel/Population Bomb diff --git a/src/battle_util.c b/src/battle_util.c index e64cc5019..a84521f11 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3745,8 +3745,15 @@ u8 AtkCanceller_UnableToUseMove(void) } else if (gBattleMoves[gCurrentMove].strikeCount > 1) { - gMultiHitCounter = gBattleMoves[gCurrentMove].strikeCount; - PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 3, 0) + if (gBattleMoves[gCurrentMove].effect == EFFECT_POPULATION_BOMB && GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_LOADED_DICE) + { + gMultiHitCounter = RandomUniform(RNG_LOADED_DICE, 4, 10); + } + else + { + gMultiHitCounter = gBattleMoves[gCurrentMove].strikeCount; + PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 3, 0) + } } #if B_BEAT_UP >= GEN_5 else if (gBattleMoves[gCurrentMove].effect == EFFECT_BEAT_UP) diff --git a/test/move_effect_multi_hit.c b/test/move_effect_multi_hit.c new file mode 100644 index 000000000..d3a265ebb --- /dev/null +++ b/test/move_effect_multi_hit.c @@ -0,0 +1,135 @@ +#include "global.h" +#include "test_battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_BULLET_SEED].effect == EFFECT_MULTI_HIT); +} + +SINGLE_BATTLE_TEST("Multi hit Moves hit the maximum amount with Skill Link") +{ + PASSES_RANDOMLY(100, 100, RNG_HITS); + + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_SKILL_LINK); }; + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_BULLET_SEED); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + MESSAGE("Hit 5 time(s)!"); + } +} + +SINGLE_BATTLE_TEST("Multi hit Moves hit twice 35 Percent of the time") +{ + PASSES_RANDOMLY(35, 100, RNG_HITS); + + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_BULLET_SEED); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + MESSAGE("Hit 2 time(s)!"); + } +} + +SINGLE_BATTLE_TEST("Multi hit Moves hit thrice 35 Percent of the time") +{ + PASSES_RANDOMLY(35, 100, RNG_HITS); + + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_BULLET_SEED); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + MESSAGE("Hit 3 time(s)!"); + } +} + +SINGLE_BATTLE_TEST("Multi hit Moves hit four times 35 Percent of the time") +{ + PASSES_RANDOMLY(15, 100, RNG_HITS); + + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_BULLET_SEED); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + MESSAGE("Hit 4 time(s)!"); + } +} + +SINGLE_BATTLE_TEST("Multi hit Moves hit four times 35 Percent of the time") +{ + PASSES_RANDOMLY(15, 100, RNG_HITS); + + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_BULLET_SEED); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + MESSAGE("Hit 5 time(s)!"); + } +} + +SINGLE_BATTLE_TEST("Multi hit Moves hit at least four times with Loaded Dice") +{ + PASSES_RANDOMLY(50, 100, RNG_LOADED_DICE); + + GIVEN { + ASSUME(gItems[ITEM_LOADED_DICE].holdEffect == HOLD_EFFECT_LOADED_DICE); + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_LOADED_DICE); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_BULLET_SEED); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + MESSAGE("Hit 4 time(s)!"); + } +} + +SINGLE_BATTLE_TEST("Multi hit Moves hit five times 50 Percent of the time with Loaded Dice") +{ + PASSES_RANDOMLY(50, 100, RNG_LOADED_DICE); + + GIVEN { + ASSUME(gItems[ITEM_LOADED_DICE].holdEffect == HOLD_EFFECT_LOADED_DICE); + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_LOADED_DICE); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_BULLET_SEED); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLET_SEED, player); + MESSAGE("Hit 5 time(s)!"); + } +} diff --git a/test/move_effect_population_bomb.c b/test/move_effect_population_bomb.c new file mode 100644 index 000000000..439cbe809 --- /dev/null +++ b/test/move_effect_population_bomb.c @@ -0,0 +1,6 @@ +#include "global.h" +#include "test_battle.h" + +TO_DO_BATTLE_TEST("Accuracy for Population Bomb is checked independently for each hit") +TO_DO_BATTLE_TEST("Accuracy for Population Bomb is only checked for the first hit with Skill Link") +TO_DO_BATTLE_TEST("Accuracy for Population Bomb is only checked for the first hit with Loaded Dice") diff --git a/test/move_effect_triple_kick.c b/test/move_effect_triple_kick.c index e0a91b011..4e47d6cc6 100644 --- a/test/move_effect_triple_kick.c +++ b/test/move_effect_triple_kick.c @@ -3,7 +3,7 @@ ASSUMPTIONS { - ASSUME(gBattleMoves[MOVE_TRIPLE_KICK].effect & EFFECT_TRIPLE_KICK); + ASSUME(gBattleMoves[MOVE_TRIPLE_KICK].effect == EFFECT_TRIPLE_KICK); } SINGLE_BATTLE_TEST("Triple Kick damage is increased by its base damage for each hit") @@ -29,3 +29,7 @@ SINGLE_BATTLE_TEST("Triple Kick damage is increased by its base damage for each EXPECT_MUL_EQ(firstHit, Q_4_12(3.0), thirdHit); } } + +TO_DO_BATTLE_TEST("Accuracy for Triple Kick is checked independently for each hit") +TO_DO_BATTLE_TEST("Accuracy for Triple Kick is only checked for the first hit with Skill Link") +TO_DO_BATTLE_TEST("Accuracy for Triple Kick is only checked for the first hit with Loaded Dice") diff --git a/test/move_flag_three_strikes.c b/test/move_flag_strike_count.c similarity index 76% rename from test/move_flag_three_strikes.c rename to test/move_flag_strike_count.c index 21debc730..0c71d6731 100644 --- a/test/move_flag_three_strikes.c +++ b/test/move_flag_strike_count.c @@ -1,7 +1,22 @@ #include "global.h" #include "test_battle.h" -SINGLE_BATTLE_TEST("Three-strike flag turns a move into a 3-hit move") +SINGLE_BATTLE_TEST("Two strike count turns a move into a 2-hit move") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_DOUBLE_KICK].strikeCount == 2); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_DOUBLE_KICK); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_DOUBLE_KICK, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_DOUBLE_KICK, player); + MESSAGE("Hit 2 time(s)!"); + } +} + +SINGLE_BATTLE_TEST("Three strike count turns a move into a 3-hit move") { s16 firstHit; s16 secondHit; From 5167b01b14db8a3062d2db35d5428600911f4800 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 29 Jul 2023 12:44:21 +0200 Subject: [PATCH 3/3] var for ability + hold effect, loaded dice comparison fix for small bug introduced in the latest commit --- src/battle_script_commands.c | 10 ++++++---- test/move_effect_population_bomb.c | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 6a3ccde0c..2adfcdcc2 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1708,6 +1708,8 @@ static void Cmd_accuracycheck(void) u16 type, move = cmd->move; u16 moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, move); + u16 gBattlerAttackerAbility = GetBattlerAbility(gBattlerAttacker); + u8 gBattlerAttackerHoldEffect = GetBattlerHoldEffect(gBattlerAttacker, TRUE); if (move == ACC_CURR_MOVE) move = gCurrentMove; @@ -1723,7 +1725,7 @@ static void Cmd_accuracycheck(void) } else if (gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_2ND_HIT || (gSpecialStatuses[gBattlerAttacker].multiHitOn - && (GetBattlerAbility(gBattlerAttacker) == ABILITY_SKILL_LINK || GetBattlerHoldEffect(gBattlerAttacker, TRUE) + && (gBattlerAttackerAbility == ABILITY_SKILL_LINK || gBattlerAttackerHoldEffect == HOLD_EFFECT_LOADED_DICE || !(gBattleMoves[move].effect == EFFECT_TRIPLE_KICK || gBattleMoves[move].effect == EFFECT_POPULATION_BOMB)))) { // No acc checks for second hit of Parental Bond or multi hit moves, except Triple Kick/Triple Axel/Population Bomb @@ -1743,16 +1745,16 @@ static void Cmd_accuracycheck(void) gBattlerAttacker, gBattlerTarget, move, - GetBattlerAbility(gBattlerAttacker), + gBattlerAttackerAbility, GetBattlerAbility(gBattlerTarget), - GetBattlerHoldEffect(gBattlerAttacker, TRUE), + gBattlerAttackerHoldEffect, GetBattlerHoldEffect(gBattlerTarget, TRUE) ); if (!RandomPercentage(RNG_ACCURACY, accuracy)) { gMoveResultFlags |= MOVE_RESULT_MISSED; - if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_BLUNDER_POLICY) + if (gBattlerAttackerHoldEffect == HOLD_EFFECT_BLUNDER_POLICY) gBattleStruct->blunderPolicy = TRUE; // Only activates from missing through acc/evasion checks if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && diff --git a/test/move_effect_population_bomb.c b/test/move_effect_population_bomb.c index 439cbe809..1305f456c 100644 --- a/test/move_effect_population_bomb.c +++ b/test/move_effect_population_bomb.c @@ -1,6 +1,29 @@ #include "global.h" #include "test_battle.h" +SINGLE_BATTLE_TEST("Population Bomb can hit ten times") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_POPULATION_BOMB].strikeCount == 10); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_POPULATION_BOMB); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + MESSAGE("Hit 10 time(s)!"); + } +} + TO_DO_BATTLE_TEST("Accuracy for Population Bomb is checked independently for each hit") TO_DO_BATTLE_TEST("Accuracy for Population Bomb is only checked for the first hit with Skill Link") TO_DO_BATTLE_TEST("Accuracy for Population Bomb is only checked for the first hit with Loaded Dice")