Fix enigma berry

This commit is contained in:
kittenchilly 2023-09-07 17:10:25 -05:00
parent 8f8705929a
commit 40ac214764
2 changed files with 15 additions and 9 deletions

View File

@ -6802,6 +6802,21 @@ static u8 ItemEffectMoveEnd(u32 battlerId, u16 holdEffect)
case HOLD_EFFECT_SP_DEFENSE_UP: case HOLD_EFFECT_SP_DEFENSE_UP:
effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, FALSE); effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, FALSE);
break; break;
case HOLD_EFFECT_ENIGMA_BERRY: // consume and heal if hit by super effective move
if (IsBattlerAlive(battlerId)
&& TARGET_TURN_DAMAGED
&& (gBattleScripting.overrideBerryRequirements
|| (!DoesSubstituteBlockMove(gBattlerAttacker, battlerId, gCurrentMove) && (gMoveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE))))
{
gBattleMoveDamage = (gBattleMons[battlerId].maxHP * 25 / 100) * -1;
if (GetBattlerAbility(battlerId) == ABILITY_RIPEN)
gBattleMoveDamage *= 2;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ItemHealHP_RemoveItemRet;
return ITEM_HP_CHANGE;
}
break;
case HOLD_EFFECT_KEE_BERRY: // consume and boost defense if used physical move case HOLD_EFFECT_KEE_BERRY: // consume and boost defense if used physical move
effect = DamagedStatBoostBerryEffect(battlerId, STAT_DEF, SPLIT_PHYSICAL); effect = DamagedStatBoostBerryEffect(battlerId, STAT_DEF, SPLIT_PHYSICAL);
break; break;
@ -7761,14 +7776,6 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
gBattleScripting.statChanger = SET_STATCHANGER(STAT_SPATK, 1, FALSE); gBattleScripting.statChanger = SET_STATCHANGER(STAT_SPATK, 1, FALSE);
} }
break; break;
case HOLD_EFFECT_ENIGMA_BERRY: // consume and heal if hit by super effective move
if (IsBattlerAlive(battlerId)
&& TARGET_TURN_DAMAGED
&& gMoveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE)
{
effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, TRUE);
}
break;
case HOLD_EFFECT_JABOCA_BERRY: // consume and damage attacker if used physical move case HOLD_EFFECT_JABOCA_BERRY: // consume and damage attacker if used physical move
if (IsBattlerAlive(battlerId) if (IsBattlerAlive(battlerId)
&& TARGET_TURN_DAMAGED && TARGET_TURN_DAMAGED

View File

@ -7630,7 +7630,6 @@ const struct Item gItems[] =
.itemId = ITEM_ENIGMA_BERRY, .itemId = ITEM_ENIGMA_BERRY,
.price = 20, .price = 20,
.holdEffect = HOLD_EFFECT_ENIGMA_BERRY, .holdEffect = HOLD_EFFECT_ENIGMA_BERRY,
.holdEffectParam = 25,
.description = sEnigmaBerryDesc, .description = sEnigmaBerryDesc,
.pocket = POCKET_BERRIES, .pocket = POCKET_BERRIES,
.type = ITEM_USE_BAG_MENU, .type = ITEM_USE_BAG_MENU,