From 5fa7a6d4c6710e0a447358fd8e4b8ccb49969619 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 28 Jul 2023 13:20:06 +0200 Subject: [PATCH] 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 36965c465c..6a3ccde0cb 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 e64cc50194..a84521f111 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 0000000000..d3a265ebb8 --- /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 0000000000..439cbe8097 --- /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 e0a91b0112..4e47d6cc6e 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 21debc7305..0c71d67313 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;