Fixes Triple Dive effect (#2947)

This commit is contained in:
Alex 2023-05-02 21:06:21 +02:00 committed by GitHub
parent ae2d5f7d1e
commit dd43d62a12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 96 additions and 7 deletions

View File

@ -242,8 +242,9 @@
#define FLAG_THAW_USER (1 << 25)
#define FLAG_HIT_IN_SUBSTITUTE (1 << 26) // Hyperspace Fury
#define FLAG_TWO_STRIKES (1 << 27) // A move with this flag will strike twice, and may apply its effect on each hit
#define FLAG_WIND_MOVE (1 << 28)
#define FLAG_SLICING_MOVE (1 << 29)
#define FLAG_THREE_STRIKES (1 << 28) // A move with this flag will strike thrice, and may apply its effect on each hit
#define FLAG_WIND_MOVE (1 << 29)
#define FLAG_SLICING_MOVE (1 << 30)
// Split defines.
#define SPLIT_PHYSICAL 0x0

View File

@ -856,7 +856,7 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 *typeEffectiveness,
// Handle other multi-strike moves
if (gBattleMoves[move].flags & FLAG_TWO_STRIKES)
dmg *= 2;
else if (move == MOVE_SURGING_STRIKES || (move == MOVE_WATER_SHURIKEN && gBattleMons[battlerAtk].species == SPECIES_GRENINJA_ASH))
else if (gBattleMoves[move].flags & FLAG_THREE_STRIKES || (move == MOVE_WATER_SHURIKEN && gBattleMons[battlerAtk].species == SPECIES_GRENINJA_ASH))
dmg *= 3;
if (dmg == 0)

View File

@ -3779,7 +3779,7 @@ u8 AtkCanceller_UnableToUseMove(void)
// TODO
}
}
else if (gBattleMoves[gCurrentMove].effect == EFFECT_TRIPLE_KICK || gCurrentMove == MOVE_SURGING_STRIKES)
else if (gBattleMoves[gCurrentMove].effect == EFFECT_TRIPLE_KICK || gBattleMoves[gCurrentMove].flags & FLAG_THREE_STRIKES)
{
gMultiHitCounter = 3;
PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0)

View File

@ -12338,7 +12338,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.secondaryEffectChance = 0,
.target = MOVE_TARGET_SELECTED,
.priority = 0,
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST,
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_THREE_STRIKES,
.split = SPLIT_PHYSICAL,
.zMoveEffect = Z_EFFECT_NONE,
},
@ -13106,7 +13106,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
[MOVE_TRIPLE_DIVE] =
{
.effect = EFFECT_TRIPLE_KICK,
.effect = EFFECT_HIT,
.power = 30,
.type = TYPE_WATER,
.accuracy = 95,
@ -13114,7 +13114,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.secondaryEffectChance = 0,
.target = MOVE_TARGET_SELECTED,
.priority = 0,
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED,
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_THREE_STRIKES,
.split = SPLIT_PHYSICAL,
.zMoveEffect = Z_EFFECT_NONE,
},

View File

@ -0,0 +1,31 @@
#include "global.h"
#include "test_battle.h"
ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_TRIPLE_KICK].effect & EFFECT_TRIPLE_KICK);
}
SINGLE_BATTLE_TEST("Triple Kick damage is increaased by its base damage for each hit")
{
s16 firstHit;
s16 secondHit;
s16 thirdHit;
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TRIPLE_KICK); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRIPLE_KICK, player);
HP_BAR(opponent, captureDamage: &firstHit);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRIPLE_KICK, player);
HP_BAR(opponent, captureDamage: &secondHit);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRIPLE_KICK, player);
HP_BAR(opponent, captureDamage: &thirdHit);
} FINALLY {
EXPECT_EQ(secondHit, firstHit * 2);
EXPECT_EQ(thirdHit, firstHit * 3);
}
}

View File

@ -0,0 +1,57 @@
#include "global.h"
#include "test_battle.h"
SINGLE_BATTLE_TEST("Three-strike flag turns a move into a 3-hit move")
{
s16 firstHit;
s16 secondHit;
s16 thirdHit;
GIVEN {
ASSUME(gBattleMoves[MOVE_TRIPLE_DIVE].flags & FLAG_THREE_STRIKES);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TRIPLE_DIVE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRIPLE_DIVE, player);
HP_BAR(opponent, captureDamage: &firstHit);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRIPLE_DIVE, player);
HP_BAR(opponent, captureDamage: &secondHit);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRIPLE_DIVE, player);
HP_BAR(opponent, captureDamage: &thirdHit);
} FINALLY {
EXPECT_EQ(firstHit, secondHit);
EXPECT_EQ(secondHit, thirdHit);
EXPECT_EQ(firstHit, thirdHit);
}
}
SINGLE_BATTLE_TEST("Surging Strikes hits 3 times with each hit being a critical hit")
{
s16 firstHit;
s16 secondHit;
s16 thirdHit;
GIVEN {
ASSUME(gBattleMoves[MOVE_SURGING_STRIKES].flags & FLAG_THREE_STRIKES);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_SURGING_STRIKES); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SURGING_STRIKES, player);
HP_BAR(opponent, captureDamage: &firstHit);
MESSAGE("A critical hit!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_SURGING_STRIKES, player);
HP_BAR(opponent, captureDamage: &secondHit);
MESSAGE("A critical hit!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_SURGING_STRIKES, player);
HP_BAR(opponent, captureDamage: &thirdHit);
MESSAGE("A critical hit!");
} FINALLY {
EXPECT_EQ(firstHit, secondHit);
EXPECT_EQ(secondHit, thirdHit);
EXPECT_EQ(firstHit, thirdHit);
}
}