Fix gems activating for moves that don't deal type damage (#6789)

This commit is contained in:
spindrift64 2025-05-08 20:17:32 +02:00 committed by GitHub
parent 8cc289ef35
commit 5e190d0782
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 2 deletions

View File

@ -6074,7 +6074,10 @@ void SetTypeBeforeUsingMove(u32 move, u32 battler)
gBattleStruct->dynamicMoveType = TYPE_ELECTRIC | F_DYNAMIC_TYPE_SET;
// Check if a gem should activate.
if (holdEffect == HOLD_EFFECT_GEMS && GetBattleMoveType(move) == ItemId_GetSecondaryId(heldItem))
if (holdEffect == HOLD_EFFECT_GEMS
&& GetBattleMoveType(move) == ItemId_GetSecondaryId(heldItem)
&& GetMoveEffect(move) != EFFECT_PLEDGE
&& GetMovePower(move) > 1)
{
gSpecialStatuses[battler].gemParam = GetBattlerHoldEffectParam(battler);
gSpecialStatuses[battler].gemBoost = TRUE;

View File

@ -2202,7 +2202,6 @@ static void Cmd_adjustdamage(void)
&& !(gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_NO_EFFECT)
&& !(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE)
&& gBattleMons[gBattlerAttacker].item
&& moveEffect != EFFECT_PLEDGE
&& gCurrentMove != MOVE_STRUGGLE)
{
BattleScriptPushCursor();

View File

@ -87,3 +87,19 @@ SINGLE_BATTLE_TEST("Gem is consumed if the move type is changed")
ANIMATION(ANIM_TYPE_MOVE, MOVE_FEINT_ATTACK, player);
}
}
SINGLE_BATTLE_TEST("Gem is not consumed if a no type damage move is used") //ie. Counter, Psywave, Super Fang. All these moves have 1 base power.
{
ASSUME(GetMovePower(MOVE_PSYWAVE) == 1);
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_PSYCHIC_GEM); };
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_PSYWAVE); }
} SCENE {
NONE_OF {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player);
MESSAGE("The Psychic Gem strengthened Wobbuffet's power!");
}
}
}