mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-17 03:57:38 +01:00
Fix mega evo indicator priority on lvl-up-box
This commit is contained in:
parent
2c2b807a57
commit
9823d2bdf1
@ -6045,6 +6045,17 @@ static void atk6B_atknameinbuff1(void)
|
|||||||
gBattlescriptCurrInstr++;
|
gBattlescriptCurrInstr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Because the indicator must have priority 0 to be properly displayed on healthbox, it needs to be temporarily changed while displaying lvl-up-box.
|
||||||
|
static void ChangeMegaIndicatorsPriority(u32 priority)
|
||||||
|
{
|
||||||
|
s32 i;
|
||||||
|
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||||
|
{
|
||||||
|
if (gBattleStruct->mega.indicatorSpriteIds[i] != 0xFF)
|
||||||
|
gSprites[gBattleStruct->mega.indicatorSpriteIds[i]].oam.priority = priority;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void atk6C_drawlvlupbox(void)
|
static void atk6C_drawlvlupbox(void)
|
||||||
{
|
{
|
||||||
if (gBattleScripting.atk6C_state == 0)
|
if (gBattleScripting.atk6C_state == 0)
|
||||||
@ -6075,6 +6086,7 @@ static void atk6C_drawlvlupbox(void)
|
|||||||
SetBgAttribute(1, BG_ATTR_PRIORITY, 0);
|
SetBgAttribute(1, BG_ATTR_PRIORITY, 0);
|
||||||
ShowBg(0);
|
ShowBg(0);
|
||||||
ShowBg(1);
|
ShowBg(1);
|
||||||
|
ChangeMegaIndicatorsPriority(1);
|
||||||
HandleBattleWindow(0x12, 7, 0x1D, 0x13, WINDOW_x80);
|
HandleBattleWindow(0x12, 7, 0x1D, 0x13, WINDOW_x80);
|
||||||
gBattleScripting.atk6C_state = 4;
|
gBattleScripting.atk6C_state = 4;
|
||||||
break;
|
break;
|
||||||
@ -6127,6 +6139,7 @@ static void atk6C_drawlvlupbox(void)
|
|||||||
case 10:
|
case 10:
|
||||||
if (!IsDma3ManagerBusyWithBgCopy())
|
if (!IsDma3ManagerBusyWithBgCopy())
|
||||||
{
|
{
|
||||||
|
ChangeMegaIndicatorsPriority(0);
|
||||||
SetBgAttribute(0, BG_ATTR_PRIORITY, 0);
|
SetBgAttribute(0, BG_ATTR_PRIORITY, 0);
|
||||||
SetBgAttribute(1, BG_ATTR_PRIORITY, 1);
|
SetBgAttribute(1, BG_ATTR_PRIORITY, 1);
|
||||||
ShowBg(0);
|
ShowBg(0);
|
||||||
|
@ -5750,7 +5750,7 @@ static u32 CalcDefenseStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sandstorm sp.def boost for rock types
|
// sandstorm sp.def boost for rock types
|
||||||
if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_SANDSTORM_ANY && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ROCK) && !usesDefStat)
|
if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_ROCK) && WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_SANDSTORM_ANY && !usesDefStat)
|
||||||
MulModifier(&modifier, UQ_4_12(1.5));
|
MulModifier(&modifier, UQ_4_12(1.5));
|
||||||
|
|
||||||
return ApplyModifier(modifier, defStat);
|
return ApplyModifier(modifier, defStat);
|
||||||
@ -6170,10 +6170,12 @@ bool32 CanMegaEvolve(u8 battlerId)
|
|||||||
mon = &gPlayerParty[gBattlerPartyIndexes[battlerId]];
|
mon = &gPlayerParty[gBattlerPartyIndexes[battlerId]];
|
||||||
|
|
||||||
itemId = GetMonData(mon, MON_DATA_HELD_ITEM);
|
itemId = GetMonData(mon, MON_DATA_HELD_ITEM);
|
||||||
if (itemId != ITEM_ENIGMA_BERRY)
|
if (USE_BATTLE_DEBUG && gBattleStruct->debugHoldEffects[battlerId])
|
||||||
holdEffect = ItemId_GetHoldEffect(itemId);
|
holdEffect = gBattleStruct->debugHoldEffects[battlerId];
|
||||||
else
|
else if (itemId == ITEM_ENIGMA_BERRY)
|
||||||
holdEffect = gEnigmaBerries[battlerId].holdEffect;
|
holdEffect = gEnigmaBerries[battlerId].holdEffect;
|
||||||
|
else
|
||||||
|
holdEffect = ItemId_GetHoldEffect(itemId);
|
||||||
|
|
||||||
if (holdEffect != HOLD_EFFECT_MEGA_STONE)
|
if (holdEffect != HOLD_EFFECT_MEGA_STONE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user