From 5167b01b14db8a3062d2db35d5428600911f4800 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 29 Jul 2023 12:44:21 +0200 Subject: [PATCH] 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 6a3ccde0cb..2adfcdcc25 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 439cbe8097..1305f456c4 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")