Merge branch 'RHH/master' into RHH/upcoming

# Conflicts:
#	data/battle_scripts_1.s
#	src/battle_util.c
#	src/battle_z_move.c
This commit is contained in:
Eduardo Quezada 2023-08-17 13:42:09 -04:00
commit a6dbb68bac
5 changed files with 21 additions and 25 deletions

View File

@ -5050,7 +5050,7 @@ BattleScript_EffectBatonPass::
goto BattleScript_MoveEnd
BattleScript_EffectRapidSpin::
.if B_SPEED_BUFFING_RAPID_SPIN == GEN_8
.if B_SPEED_BUFFING_RAPID_SPIN >= GEN_8
call BattleScript_EffectHit_Ret
jumpifhalfword CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_MoveEnd
setmoveeffect MOVE_EFFECT_RAPIDSPIN | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN

View File

@ -1409,11 +1409,10 @@ bool32 IsMegaTriggerSpriteActive(void)
void HideMegaTriggerSprite(void)
{
if (gBattleStruct->mega.triggerSpriteId != 0xFF)
{
ChangeMegaTriggerSprite(gBattleStruct->mega.triggerSpriteId, 0);
gSprites[gBattleStruct->mega.triggerSpriteId].tHide = TRUE;
}
if (gBattleStruct->mega.triggerSpriteId >= MAX_SPRITES)
return;
ChangeMegaTriggerSprite(gBattleStruct->mega.triggerSpriteId, 0);
gSprites[gBattleStruct->mega.triggerSpriteId].tHide = TRUE;
}
void HideTriggerSprites(void)

View File

@ -10141,14 +10141,14 @@ bool32 CanMegaEvolve(u8 battlerId)
species = GetMonData(mon, MON_DATA_SPECIES);
itemId = GetMonData(mon, MON_DATA_HELD_ITEM);
if (itemId == ITEM_ENIGMA_BERRY_E_READER)
holdEffect = gEnigmaBerries[battlerId].holdEffect;
else
holdEffect = ItemId_GetHoldEffect(itemId);
// Check if there is an entry in the evolution table for regular Mega Evolution.
if (GetBattleFormChangeTargetSpecies(battlerId, FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM) != SPECIES_NONE)
{
if (itemId == ITEM_ENIGMA_BERRY_E_READER)
holdEffect = gEnigmaBerries[battlerId].holdEffect;
else
holdEffect = ItemId_GetHoldEffect(itemId);
// Can Mega Evolve via Mega Stone.
if (holdEffect == HOLD_EFFECT_MEGA_STONE)
return TRUE;
@ -10156,7 +10156,11 @@ bool32 CanMegaEvolve(u8 battlerId)
// Check if there is an entry in the evolution table for Wish Mega Evolution.
if (GetBattleFormChangeTargetSpecies(battlerId, FORM_CHANGE_BATTLE_MEGA_EVOLUTION_MOVE) != SPECIES_NONE)
return TRUE;
{
// Can't Wish Mega Evolve if holding a Z Crystal.
if (holdEffect != HOLD_EFFECT_Z_CRYSTAL)
return TRUE;
}
// No checks passed, the mon CAN'T mega evolve.
return FALSE;

View File

@ -159,7 +159,6 @@ void QueueZMove(u8 battlerId, u16 baseMove)
bool32 IsViableZMove(u8 battlerId, u16 move)
{
struct Pokemon *mon;
struct MegaEvolutionData *mega = &(((struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]))->mega);
u8 battlerPosition = GetBattlerPosition(battlerId);
u8 partnerPosition = GetBattlerPosition(BATTLE_PARTNER(battlerId));
u32 item;
@ -185,15 +184,6 @@ bool32 IsViableZMove(u8 battlerId, u16 move)
if ((GetBattlerPosition(battlerId) == B_POSITION_PLAYER_LEFT || (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) && GetBattlerPosition(battlerId) == B_POSITION_PLAYER_RIGHT)) && !CheckBagHasItem(ITEM_Z_POWER_RING, 1))
return FALSE;
if (mega->alreadyEvolved[battlerPosition])
return FALSE; // Trainer has mega evolved
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
if (IsPartnerMonFromSameTrainer(battlerId) && (mega->alreadyEvolved[partnerPosition] || (mega->toEvolve & gBitTable[BATTLE_PARTNER(battlerId)])))
return FALSE; // Partner has mega evolved or is about to mega evolve
}
if (item == ITEM_ENIGMA_BERRY_E_READER)
return FALSE; // HoldEffect = gEnigmaBerries[battlerId].holdEffect;
else
@ -350,9 +340,12 @@ bool32 IsZMoveTriggerSpriteActive(void)
void HideZMoveTriggerSprite(void)
{
struct Sprite *sprite = &gSprites[gBattleStruct->zmove.triggerSpriteId];
sprite->tHide = TRUE;
struct Sprite *sprite;
gBattleStruct->zmove.viable = FALSE;
if (gBattleStruct->zmove.triggerSpriteId >= MAX_SPRITES)
return;
sprite = &gSprites[gBattleStruct->zmove.triggerSpriteId];
sprite->tHide = TRUE;
}
static void ShowZMoveTriggerSprite(u8 battlerId)

View File

@ -6,7 +6,7 @@
#define EVO_HELD_ITEM_FIELD_FUNC ItemUseOutOfBattle_CannotUse
#endif
#if I_GEM_BOOST_POWER >= GEN_5
#if I_GEM_BOOST_POWER >= GEN_6
#define GEM_BOOST_PARAM 30
#else
#define GEM_BOOST_PARAM 50