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 goto BattleScript_MoveEnd
BattleScript_EffectRapidSpin:: BattleScript_EffectRapidSpin::
.if B_SPEED_BUFFING_RAPID_SPIN == GEN_8 .if B_SPEED_BUFFING_RAPID_SPIN >= GEN_8
call BattleScript_EffectHit_Ret call BattleScript_EffectHit_Ret
jumpifhalfword CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_MoveEnd jumpifhalfword CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_MoveEnd
setmoveeffect MOVE_EFFECT_RAPIDSPIN | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN setmoveeffect MOVE_EFFECT_RAPIDSPIN | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN

View File

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

View File

@ -10141,14 +10141,14 @@ bool32 CanMegaEvolve(u8 battlerId)
species = GetMonData(mon, MON_DATA_SPECIES); species = GetMonData(mon, MON_DATA_SPECIES);
itemId = GetMonData(mon, MON_DATA_HELD_ITEM); 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. // 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 (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. // Can Mega Evolve via Mega Stone.
if (holdEffect == HOLD_EFFECT_MEGA_STONE) if (holdEffect == HOLD_EFFECT_MEGA_STONE)
return TRUE; return TRUE;
@ -10156,7 +10156,11 @@ bool32 CanMegaEvolve(u8 battlerId)
// Check if there is an entry in the evolution table for Wish Mega Evolution. // 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) 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. // No checks passed, the mon CAN'T mega evolve.
return FALSE; return FALSE;

View File

@ -159,7 +159,6 @@ void QueueZMove(u8 battlerId, u16 baseMove)
bool32 IsViableZMove(u8 battlerId, u16 move) bool32 IsViableZMove(u8 battlerId, u16 move)
{ {
struct Pokemon *mon; struct Pokemon *mon;
struct MegaEvolutionData *mega = &(((struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]))->mega);
u8 battlerPosition = GetBattlerPosition(battlerId); u8 battlerPosition = GetBattlerPosition(battlerId);
u8 partnerPosition = GetBattlerPosition(BATTLE_PARTNER(battlerId)); u8 partnerPosition = GetBattlerPosition(BATTLE_PARTNER(battlerId));
u32 item; 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)) 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; 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) if (item == ITEM_ENIGMA_BERRY_E_READER)
return FALSE; // HoldEffect = gEnigmaBerries[battlerId].holdEffect; return FALSE; // HoldEffect = gEnigmaBerries[battlerId].holdEffect;
else else
@ -350,9 +340,12 @@ bool32 IsZMoveTriggerSpriteActive(void)
void HideZMoveTriggerSprite(void) void HideZMoveTriggerSprite(void)
{ {
struct Sprite *sprite = &gSprites[gBattleStruct->zmove.triggerSpriteId]; struct Sprite *sprite;
sprite->tHide = TRUE;
gBattleStruct->zmove.viable = FALSE; gBattleStruct->zmove.viable = FALSE;
if (gBattleStruct->zmove.triggerSpriteId >= MAX_SPRITES)
return;
sprite = &gSprites[gBattleStruct->zmove.triggerSpriteId];
sprite->tHide = TRUE;
} }
static void ShowZMoveTriggerSprite(u8 battlerId) static void ShowZMoveTriggerSprite(u8 battlerId)

View File

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