Skip to content

Commit

Permalink
var for ability + hold effect, loaded dice comparison
Browse files Browse the repository at this point in the history
fix for small bug introduced in the latest commit
  • Loading branch information
AlexOn1ine committed Jul 29, 2023
1 parent 5fa7a6d commit 5167b01
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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 &&
Expand Down
23 changes: 23 additions & 0 deletions test/move_effect_population_bomb.c
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit 5167b01

Please sign in to comment.