EFFECT_PHOTON_GEYSER and restored EFFECT_SHELL_SIDE_ARM work for physical moves (#4923)

This commit is contained in:
sneed 2024-07-14 16:35:11 +03:00 committed by GitHub
parent 5c38532281
commit 6aa308e1d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 27 additions and 13 deletions

View File

@ -353,6 +353,7 @@ enum {
EFFECT_TERA_STARSTORM,
EFFECT_DRAGON_DARTS,
EFFECT_GUARDIAN_OF_ALOLA,
EFFECT_SHELL_SIDE_ARM,
NUM_BATTLE_MOVE_EFFECTS,
};

View File

@ -541,9 +541,9 @@ struct SimulatedDamage AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u
}
if (gMovesInfo[move].effect == EFFECT_PHOTON_GEYSER)
gBattleStruct->swapDamageCategory = (GetCategoryBasedOnStats(gBattlerAttacker) == DAMAGE_CATEGORY_PHYSICAL);
else if (move == MOVE_SHELL_SIDE_ARM && gBattleStruct->shellSideArmCategory[battlerAtk][battlerDef] == DAMAGE_CATEGORY_PHYSICAL)
gBattleStruct->swapDamageCategory = TRUE;
gBattleStruct->swapDamageCategory = (GetCategoryBasedOnStats(gBattlerAttacker) != gMovesInfo[gCurrentMove].category);
else if (gMovesInfo[move].effect == EFFECT_SHELL_SIDE_ARM)
gBattleStruct->swapDamageCategory = (gBattleStruct->shellSideArmCategory[battlerAtk][battlerDef] != gMovesInfo[gCurrentMove].category);
else if (gMovesInfo[move].effect == EFFECT_NATURE_POWER)
move = GetNaturePowerMove(battlerAtk);

View File

@ -1962,8 +1962,8 @@ static void Cmd_damagecalc(void)
u8 moveType;
GET_MOVE_TYPE(gCurrentMove, moveType);
if (gBattleStruct->shellSideArmCategory[gBattlerAttacker][gBattlerTarget] == DAMAGE_CATEGORY_PHYSICAL && gCurrentMove == MOVE_SHELL_SIDE_ARM)
gBattleStruct->swapDamageCategory = TRUE;
if (gMovesInfo[gCurrentMove].effect == EFFECT_SHELL_SIDE_ARM)
gBattleStruct->swapDamageCategory = (gBattleStruct->shellSideArmCategory[gBattlerAttacker][gBattlerTarget] != gMovesInfo[gCurrentMove].category);
gBattleMoveDamage = CalculateMoveDamage(gCurrentMove, gBattlerAttacker, gBattlerTarget, moveType, 0, gIsCriticalHit, TRUE, TRUE);
gBattlescriptCurrInstr = cmd->nextInstr;
}
@ -16865,7 +16865,7 @@ void BS_SetPhotonGeyserCategory(void)
NATIVE_ARGS();
if (!((gMovesInfo[gCurrentMove].effect == EFFECT_TERA_BLAST && GetActiveGimmick(gBattlerAttacker) != GIMMICK_TERA)
|| (gMovesInfo[gCurrentMove].effect == EFFECT_TERA_STARSTORM && GetActiveGimmick(gBattlerAttacker) != GIMMICK_TERA && gBattleMons[gBattlerAttacker].species == SPECIES_TERAPAGOS_STELLAR)))
gBattleStruct->swapDamageCategory = (GetCategoryBasedOnStats(gBattlerAttacker) == DAMAGE_CATEGORY_PHYSICAL);
gBattleStruct->swapDamageCategory = (GetCategoryBasedOnStats(gBattlerAttacker) != gMovesInfo[gCurrentMove].category);
gBattlescriptCurrInstr = cmd->nextInstr;
}

View File

@ -8456,7 +8456,7 @@ bool32 IsMoveMakingContact(u32 move, u32 battlerAtk)
if (!gMovesInfo[move].makesContact)
{
if (move == MOVE_SHELL_SIDE_ARM && gBattleStruct->shellSideArmCategory[battlerAtk][gBattlerTarget] == DAMAGE_CATEGORY_PHYSICAL)
if (gMovesInfo[move].effect == EFFECT_SHELL_SIDE_ARM && gBattleStruct->shellSideArmCategory[battlerAtk][gBattlerTarget] == DAMAGE_CATEGORY_PHYSICAL)
return TRUE;
else
return FALSE;
@ -8496,7 +8496,8 @@ bool32 IsBattlerProtected(u32 battlerAtk, u32 battlerDef, u32 move)
// Protective Pads doesn't stop Unseen Fist from bypassing Protect effects, so IsMoveMakingContact() isn't used here.
// This means extra logic is needed to handle Shell Side Arm.
if (GetBattlerAbility(gBattlerAttacker) == ABILITY_UNSEEN_FIST
&& (gMovesInfo[move].makesContact || (move == MOVE_SHELL_SIDE_ARM && gBattleStruct->shellSideArmCategory[battlerAtk][battlerDef] == DAMAGE_CATEGORY_PHYSICAL))
&& (gMovesInfo[move].makesContact
|| (gMovesInfo[move].effect == EFFECT_SHELL_SIDE_ARM && gBattleStruct->shellSideArmCategory[battlerAtk][battlerDef] == DAMAGE_CATEGORY_PHYSICAL))
&& !gProtectStructs[battlerDef].maxGuarded) // Max Guard cannot be bypassed by Unseen Fist
return FALSE;
else if (gMovesInfo[move].ignoresProtect)
@ -10990,10 +10991,17 @@ bool32 ShouldGetStatBadgeBoost(u16 badgeFlag, u32 battler)
return FALSE;
}
static u32 SwapMoveDamageCategory(u32 move)
{
if (gMovesInfo[move].category == DAMAGE_CATEGORY_PHYSICAL)
return DAMAGE_CATEGORY_SPECIAL;
return DAMAGE_CATEGORY_PHYSICAL;
}
u8 GetBattleMoveCategory(u32 moveId)
{
if (gBattleStruct != NULL && gBattleStruct->swapDamageCategory) // Photon Geyser, Shell Side Arm, Light That Burns the Sky, Tera Blast
return DAMAGE_CATEGORY_PHYSICAL;
return SwapMoveDamageCategory(moveId);
if (gBattleStruct != NULL && (IsZMove(moveId) || IsMaxMove(moveId))) // TODO: Might be buggy depending on when this is called.
return gBattleStruct->categoryOverride;
if (B_PHYSICAL_SPECIAL_SPLIT >= GEN_4)

View File

@ -2250,4 +2250,9 @@ const struct BattleMoveEffect gBattleMoveEffects[NUM_BATTLE_MOVE_EFFECTS] =
.battleTvScore = 0, // TODO: Assign points
},
[EFFECT_SHELL_SIDE_ARM] =
{
.battleScript = BattleScript_EffectHit,
.battleTvScore = 0, // TODO: Assign points
},
};

View File

@ -18079,7 +18079,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_DYNAMAX] =
.description = COMPOUND_STRING(
"Deals better of physical and\n"
"special damage. May poison."),
.effect = EFFECT_HIT, // The effect is hardcoded to the move since SetShellSideArmCategory() can't be used with anything but Shell Side Arm because of the BP requirement
.effect = EFFECT_SHELL_SIDE_ARM,
.power = 90,
.type = TYPE_POISON,
.accuracy = 100,

View File

@ -23,7 +23,7 @@ SINGLE_BATTLE_TEST("Photon Geyser can be mirror coated if it is a special move")
}
}
SINGLE_BATTLE_TEST("Photon Geyser can be countered if it is a physcal move")
SINGLE_BATTLE_TEST("Photon Geyser can be countered if it is a physical move")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Attack(110); SpAttack(100); }

View File

@ -31,7 +31,7 @@ SINGLE_BATTLE_TEST("Shell Side Arm can be mirror coated if it is special")
}
}
SINGLE_BATTLE_TEST("Shell Side Arm does not change catogory mid-turn")
SINGLE_BATTLE_TEST("Shell Side Arm does not change category mid-turn")
{
s16 damage[3];
@ -56,7 +56,7 @@ SINGLE_BATTLE_TEST("Shell Side Arm does not change catogory mid-turn")
}
}
DOUBLE_BATTLE_TEST("Shell Side Arm is choosing it's type for each battler on the field")
DOUBLE_BATTLE_TEST("Shell Side Arm chooses its category for each battler on the field")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Speed(10); Moves(MOVE_SHELL_SIDE_ARM); }