Can't Knock Off mega stones
This commit is contained in:
parent
6c71f9b57b
commit
517974ebcb
2 changed files with 9 additions and 4 deletions
|
@ -2828,7 +2828,11 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
|||
}
|
||||
break;
|
||||
case MOVE_EFFECT_KNOCK_OFF:
|
||||
if (GetBattlerAbility(gEffectBattler) == ABILITY_STICKY_HOLD)
|
||||
if (!CanBattlerGetOrLoseItem(gEffectBattler, gBattleMons[gEffectBattler].item))
|
||||
{
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
else if (GetBattlerAbility(gEffectBattler) == ABILITY_STICKY_HOLD)
|
||||
{
|
||||
if (gBattleMons[gEffectBattler].item == 0)
|
||||
{
|
||||
|
@ -2840,9 +2844,8 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
|||
gBattlescriptCurrInstr = BattleScript_StickyHoldActivates;
|
||||
RecordAbilityBattle(gEffectBattler, ABILITY_STICKY_HOLD);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (gBattleMons[gEffectBattler].item)
|
||||
else if (gBattleMons[gEffectBattler].item)
|
||||
{
|
||||
side = GetBattlerSide(gEffectBattler);
|
||||
|
||||
|
|
|
@ -6383,7 +6383,9 @@ bool32 CanBattlerGetOrLoseItem(u8 battlerId, u16 itemId)
|
|||
return FALSE;
|
||||
else if (species == SPECIES_GROUDON && itemId == ITEM_RED_ORB)
|
||||
return FALSE;
|
||||
else if (ItemId_GetHoldEffect(itemId) == HOLD_EFFECT_MEGA_STONE && GetMegaEvolutionSpecies(species, itemId) != SPECIES_NONE)
|
||||
// Mega stone cannot be lost if pokemon can mega evolve with it or is already mega evolved.
|
||||
else if (ItemId_GetHoldEffect(itemId) == HOLD_EFFECT_MEGA_STONE
|
||||
&& ((GetMegaEvolutionSpecies(species, itemId) != SPECIES_NONE) || gBattleStruct->mega.evolvedPartyIds[GetBattlerSide(battlerId)] & gBitTable[gBattlerPartyIndexes[battlerId]]))
|
||||
return FALSE;
|
||||
else if (species == SPECIES_GIRATINA && itemId == ITEM_GRISEOUS_ORB)
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in a new issue