Unified multi-strike move flags (#3126)

* Unified twoStrikes and threeStrikes flags into strikeCount

* Decreased strikeCount max from 255 to 15.
This commit is contained in:
Eduardo Quezada D'Ottone 2023-07-18 03:07:14 -04:00 committed by GitHub
parent ab33b7d863
commit 43ad1a4d3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 31 deletions

View File

@ -376,8 +376,7 @@ struct BattleMove
u32 ignoreTypeIfFlyingAndUngrounded:1; u32 ignoreTypeIfFlyingAndUngrounded:1;
u32 thawsUser:1; u32 thawsUser:1;
u32 ignoresSubstitute:1; u32 ignoresSubstitute:1;
u32 twoStrikes:1; // May apply its effect on each hit. u32 strikeCount:4; // Max 15 hits. Defaults to 1 if not set. May apply its effect on each hit.
u32 threeStrikes:1; // May apply its effect on each hit.
u32 meFirstBanned:1; u32 meFirstBanned:1;
u32 gravityBanned:1; u32 gravityBanned:1;
u32 mimicBanned:1; u32 mimicBanned:1;

View File

@ -864,9 +864,9 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 *typeEffectiveness,
} }
// Handle other multi-strike moves // Handle other multi-strike moves
if (gBattleMoves[move].twoStrikes) if (gBattleMoves[move].strikeCount > 1)
dmg *= 2; dmg *= gBattleMoves[move].strikeCount;
else if (gBattleMoves[move].threeStrikes || (move == MOVE_WATER_SHURIKEN && gBattleMons[battlerAtk].species == SPECIES_GRENINJA_ASH)) else if (move == MOVE_WATER_SHURIKEN && gBattleMons[battlerAtk].species == SPECIES_GRENINJA_ASH)
dmg *= 3; dmg *= 3;
if (dmg == 0) if (dmg == 0)

View File

@ -16034,8 +16034,7 @@ bool8 IsMoveAffectedByParentalBond(u16 move, u8 battlerId)
{ {
if (move != MOVE_NONE && move != MOVE_STRUGGLE if (move != MOVE_NONE && move != MOVE_STRUGGLE
&& gBattleMoves[move].split != SPLIT_STATUS && gBattleMoves[move].split != SPLIT_STATUS
&& !gBattleMoves[move].twoStrikes && !gBattleMoves[move].strikeCount > 2)
&& !gBattleMoves[move].threeStrikes)
{ {
u32 i; u32 i;
for (i = 0; i < ARRAY_COUNT(sParentalBondBannedEffects); i++) for (i = 0; i < ARRAY_COUNT(sParentalBondBannedEffects); i++)

View File

@ -3743,21 +3743,17 @@ u8 AtkCanceller_UnableToUseMove(void)
PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0) PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0)
} }
else if (gBattleMoves[gCurrentMove].twoStrikes) else if (gBattleMoves[gCurrentMove].strikeCount > 1)
{ {
gMultiHitCounter = 2; gMultiHitCounter = gBattleMoves[gCurrentMove].strikeCount;
PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0) PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 3, 0)
if (gCurrentMove == MOVE_DRAGON_DARTS)
{
// TODO
}
} }
else if (gBattleMoves[gCurrentMove].effect == EFFECT_TRIPLE_KICK || gBattleMoves[gCurrentMove].threeStrikes) else if (gBattleMoves[gCurrentMove].effect == EFFECT_TRIPLE_KICK)
{ {
gMultiHitCounter = 3; gMultiHitCounter = 3;
PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0) PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0)
} }
#if B_BEAT_UP >= GEN_5 #if B_BEAT_UP >= GEN_5
else if (gBattleMoves[gCurrentMove].effect == EFFECT_BEAT_UP) else if (gBattleMoves[gCurrentMove].effect == EFFECT_BEAT_UP)
{ {
struct Pokemon* party = GetBattlerParty(gBattlerAttacker); struct Pokemon* party = GetBattlerParty(gBattlerAttacker);
@ -3775,7 +3771,7 @@ u8 AtkCanceller_UnableToUseMove(void)
gBattleStruct->beatUpSlot = 0; gBattleStruct->beatUpSlot = 0;
PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0) PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0)
} }
#endif #endif
gBattleStruct->atkCancellerTracker++; gBattleStruct->atkCancellerTracker++;
break; break;
case CANCELLER_END: case CANCELLER_END:

View File

@ -428,7 +428,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.split = SPLIT_PHYSICAL, .split = SPLIT_PHYSICAL,
.zMoveEffect = Z_EFFECT_NONE, .zMoveEffect = Z_EFFECT_NONE,
.makesContact = TRUE, .makesContact = TRUE,
.twoStrikes = TRUE, .strikeCount = 2,
}, },
[MOVE_MEGA_KICK] = [MOVE_MEGA_KICK] =
@ -716,7 +716,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.zMoveEffect = Z_EFFECT_NONE, .zMoveEffect = Z_EFFECT_NONE,
.sheerForceBoost = TRUE, .sheerForceBoost = TRUE,
.ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_5, // && B_UPDATED_MOVE_FLAGS > GEN_2 .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_5, // && B_UPDATED_MOVE_FLAGS > GEN_2
.twoStrikes = TRUE, .strikeCount = 2,
}, },
[MOVE_PIN_MISSILE] = [MOVE_PIN_MISSILE] =
@ -2680,7 +2680,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.priority = 0, .priority = 0,
.split = SPLIT_PHYSICAL, .split = SPLIT_PHYSICAL,
.zMoveEffect = Z_EFFECT_NONE, .zMoveEffect = Z_EFFECT_NONE,
.twoStrikes = TRUE, .strikeCount = 2,
}, },
[MOVE_REST] = [MOVE_REST] =
@ -7767,7 +7767,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.split = SPLIT_PHYSICAL, .split = SPLIT_PHYSICAL,
.zMoveEffect = Z_EFFECT_NONE, .zMoveEffect = Z_EFFECT_NONE,
.makesContact = TRUE, .makesContact = TRUE,
.twoStrikes = TRUE, .strikeCount = 2,
}, },
[MOVE_ROAR_OF_TIME] = [MOVE_ROAR_OF_TIME] =
@ -8930,7 +8930,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.split = SPLIT_PHYSICAL, .split = SPLIT_PHYSICAL,
.zMoveEffect = Z_EFFECT_NONE, .zMoveEffect = Z_EFFECT_NONE,
.makesContact = TRUE, .makesContact = TRUE,
.twoStrikes = TRUE, .strikeCount = 2,
}, },
[MOVE_HEART_STAMP] = [MOVE_HEART_STAMP] =
@ -9158,7 +9158,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.split = SPLIT_PHYSICAL, .split = SPLIT_PHYSICAL,
.zMoveEffect = Z_EFFECT_NONE, .zMoveEffect = Z_EFFECT_NONE,
.makesContact = TRUE, .makesContact = TRUE,
.twoStrikes = TRUE, .strikeCount = 2,
}, },
[MOVE_SEARING_SHOT] = [MOVE_SEARING_SHOT] =
@ -11540,7 +11540,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.makesContact = TRUE, .makesContact = TRUE,
.punchingMove = TRUE, .punchingMove = TRUE,
.sheerForceBoost = TRUE, .sheerForceBoost = TRUE,
.twoStrikes = TRUE, .strikeCount = 2,
.minimizeDoubleDamage = B_UPDATED_MOVE_FLAGS < GEN_8, .minimizeDoubleDamage = B_UPDATED_MOVE_FLAGS < GEN_8,
.metronomeBanned = TRUE, .metronomeBanned = TRUE,
}, },
@ -11668,7 +11668,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.priority = 0, .priority = 0,
.split = SPLIT_PHYSICAL, .split = SPLIT_PHYSICAL,
.zMoveEffect = Z_EFFECT_NONE, .zMoveEffect = Z_EFFECT_NONE,
.twoStrikes = TRUE, .strikeCount = 2,
}, },
[MOVE_TEATIME] = [MOVE_TEATIME] =
@ -12372,7 +12372,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.split = SPLIT_PHYSICAL, .split = SPLIT_PHYSICAL,
.zMoveEffect = Z_EFFECT_NONE, .zMoveEffect = Z_EFFECT_NONE,
.makesContact = TRUE, .makesContact = TRUE,
.twoStrikes = TRUE, .strikeCount = 2,
}, },
[MOVE_SCORCHING_SANDS] = [MOVE_SCORCHING_SANDS] =
@ -12441,7 +12441,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.zMoveEffect = Z_EFFECT_NONE, .zMoveEffect = Z_EFFECT_NONE,
.makesContact = TRUE, .makesContact = TRUE,
.punchingMove = TRUE, .punchingMove = TRUE,
.threeStrikes = TRUE, .strikeCount = 3,
.metronomeBanned = TRUE, .metronomeBanned = TRUE,
}, },
@ -13241,7 +13241,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.split = SPLIT_PHYSICAL, .split = SPLIT_PHYSICAL,
.zMoveEffect = Z_EFFECT_NONE, .zMoveEffect = Z_EFFECT_NONE,
.makesContact = TRUE, .makesContact = TRUE,
.threeStrikes = TRUE, .strikeCount = 3,
}, },
[MOVE_MORTAL_SPIN] = [MOVE_MORTAL_SPIN] =
@ -13566,7 +13566,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.priority = 0, .priority = 0,
.split = SPLIT_SPECIAL, .split = SPLIT_SPECIAL,
.zMoveEffect = Z_EFFECT_NONE, .zMoveEffect = Z_EFFECT_NONE,
.twoStrikes = TRUE, .strikeCount = 2,
.metronomeBanned = TRUE, .metronomeBanned = TRUE,
}, },

View File

@ -8,7 +8,7 @@ SINGLE_BATTLE_TEST("Three-strike flag turns a move into a 3-hit move")
s16 thirdHit; s16 thirdHit;
GIVEN { GIVEN {
ASSUME(gBattleMoves[MOVE_TRIPLE_DIVE].threeStrikes); ASSUME(gBattleMoves[MOVE_TRIPLE_DIVE].strikeCount == 3);
PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET);
} WHEN { } WHEN {
@ -34,7 +34,7 @@ SINGLE_BATTLE_TEST("Surging Strikes hits 3 times with each hit being a critical
s16 thirdHit; s16 thirdHit;
GIVEN { GIVEN {
ASSUME(gBattleMoves[MOVE_SURGING_STRIKES].threeStrikes); ASSUME(gBattleMoves[MOVE_SURGING_STRIKES].strikeCount == 3);
PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET);
} WHEN { } WHEN {