micle berry

This commit is contained in:
Evan 2021-01-06 10:47:07 -07:00
parent f2e486eb0d
commit efa4fe89ad
7 changed files with 70 additions and 3 deletions

View File

@ -7729,3 +7729,28 @@ BattleScript_CustapBerryActivation::
waitmessage 0x40 waitmessage 0x40
removeitem BS_ATTACKER removeitem BS_ATTACKER
end2 end2
BattleScript_MicleBerryActivateEnd2::
jumpifability BS_ATTACKER, ABILITY_RIPEN, BattleScript_MicleBerryActivateEnd2_Ripen
goto BattleScript_MicleBerryActivateEnd2_Anim
BattleScript_MicleBerryActivateEnd2_Ripen:
call BattleScript_AbilityPopUp
BattleScript_MicleBerryActivateEnd2_Anim:
playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL
printstring STRINGID_MICLEBERRYACTIVATES
waitmessage 0x40
removeitem BS_ATTACKER
end2
BattleScript_MicleBerryActivateRet::
jumpifability BS_SCRIPTING, ABILITY_RIPEN, BattleScript_MicleBerryActivateRet_Ripen
goto BattleScript_MicleBerryActivateRet_Anim
BattleScript_MicleBerryActivateRet_Ripen:
call BattleScript_AbilityPopUp
BattleScript_MicleBerryActivateRet_Anim:
playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, NULL
printstring STRINGID_MICLEBERRYACTIVATES
waitmessage 0x40
removeitem BS_SCRIPTING
return

View File

@ -429,7 +429,7 @@ struct Illusion
struct PinchBerry struct PinchBerry
{ {
u8 micleBerry:1; u8 micle:1;
u8 custap:1; // also quick claw u8 custap:1; // also quick claw
}; };

View File

@ -352,5 +352,7 @@ extern const u8 BattleScript_CheekPouchActivates[];
extern const u8 BattleScript_AnnounceAirLockCloudNine[]; extern const u8 BattleScript_AnnounceAirLockCloudNine[];
extern const u8 BattleScript_QuickClawActivation[]; extern const u8 BattleScript_QuickClawActivation[];
extern const u8 BattleScript_CustapBerryActivation[]; extern const u8 BattleScript_CustapBerryActivation[];
extern const u8 BattleScript_MicleBerryActivateEnd2[];
extern const u8 BattleScript_MicleBerryActivateRet[];
#endif // GUARD_BATTLE_SCRIPTS_H #endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -559,8 +559,9 @@
#define STRINGID_COMATOSEENTERS 555 #define STRINGID_COMATOSEENTERS 555
#define STRINGID_SCREENCLEANERENTERS 556 #define STRINGID_SCREENCLEANERENTERS 556
#define STRINGID_CANACTFASTERTHANKSTO 557 #define STRINGID_CANACTFASTERTHANKSTO 557
#define STRINGID_MICLEBERRYACTIVATES 558
#define BATTLESTRINGS_COUNT 558 #define BATTLESTRINGS_COUNT 559
//// multichoice message IDs //// multichoice message IDs
// switch in ability message // switch in ability message

View File

@ -685,10 +685,12 @@ static const u8 sText_FairyAuraActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}
static const u8 sText_AuraBreakActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} reversed all\nother POKéMON's auras!"); static const u8 sText_AuraBreakActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} reversed all\nother POKéMON's auras!");
static const u8 sText_ComatoseActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} is drowsing!"); static const u8 sText_ComatoseActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} is drowsing!");
static const u8 sText_ScreenCleanerActivates[] = _("All screens on the field were\ncleansed!"); static const u8 sText_ScreenCleanerActivates[] = _("All screens on the field were\ncleansed!");
static const u8 sText_CanActFaster[] = _("{B_ATK_NAME_WITH_PREFIX} can act\nfaster, thanks to {B_LAST_ITEM}!"); static const u8 sText_CanActFaster[] = _("{B_ATK_NAME_WITH_PREFIX} can act faster,\nthanks to {B_LAST_ITEM}!");
static const u8 sText_MicleBerryActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} boosted the accuracy of its\nnext move using {B_LAST_ITEM}!");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{ {
[STRINGID_MICLEBERRYACTIVATES - 12] = sText_MicleBerryActivates,
[STRINGID_CANACTFASTERTHANKSTO - 12] = sText_CanActFaster, [STRINGID_CANACTFASTERTHANKSTO - 12] = sText_CanActFaster,
[STRINGID_STATWASNOTLOWERED - 12] = sText_StatWasNotLowered, [STRINGID_STATWASNOTLOWERED - 12] = sText_StatWasNotLowered,
[STRINGID_CLOAKEDINAFREEZINGLIGHT - 12] = sText_CloakedInAFreezingLight, [STRINGID_CLOAKEDINAFREEZINGLIGHT - 12] = sText_CloakedInAFreezingLight,

View File

@ -1563,6 +1563,15 @@ u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move)
calc = (calc * (100 + atkParam)) / 100; calc = (calc * (100 + atkParam)) / 100;
else if (atkHoldEffect == HOLD_EFFECT_ZOOM_LENS && GetBattlerTurnOrderNum(battlerAtk) > GetBattlerTurnOrderNum(battlerDef)); else if (atkHoldEffect == HOLD_EFFECT_ZOOM_LENS && GetBattlerTurnOrderNum(battlerAtk) > GetBattlerTurnOrderNum(battlerDef));
calc = (calc * (100 + atkParam)) / 100; calc = (calc * (100 + atkParam)) / 100;
if (gBattleStruct->pinchBerry[battlerAtk].micle)
{
gBattleStruct->pinchBerry[battlerAtk].micle = FALSE;
if (atkAbility == ABILITY_RIPEN)
calc = (calc * 140) / 100; // ripen gives 40% acc boost
else
calc = (calc * 120) / 100; // 20% acc boost
}
return calc; return calc;
} }

View File

@ -5073,6 +5073,26 @@ static u8 RandomStatRaiseBerry(u32 battlerId, u32 itemId)
return 0; return 0;
} }
static u8 TrySetMicleBerry(u32 battlerId, u32 itemId, bool32 end2)
{
if (HasEnoughHpToEatBerry(battlerId, 4, itemId))
{
gBattleStruct->pinchBerry[battlerId].micle = TRUE; // battler's next attack has increased accuracy
if (end2)
{
BattleScriptExecute(BattleScript_MicleBerryActivateEnd2);
}
else
{
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_MicleBerryActivateRet;
}
return ITEM_EFFECT_OTHER;
}
return 0;
}
static u8 ItemHealHp(u32 battlerId, u32 itemId, bool32 end2, bool32 percentHeal) static u8 ItemHealHp(u32 battlerId, u32 itemId, bool32 end2, bool32 percentHeal)
{ {
if (HasEnoughHpToEatBerry(battlerId, 2, itemId)) if (HasEnoughHpToEatBerry(battlerId, 2, itemId))
@ -5569,6 +5589,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
effect = ITEM_EFFECT_OTHER; effect = ITEM_EFFECT_OTHER;
} }
break; break;
case HOLD_EFFECT_MICLE_BERRY:
if (!moveTurn)
effect = TrySetMicleBerry(battlerId, gLastUsedItem, TRUE);
break;
} }
if (effect) if (effect)
@ -5595,6 +5619,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
battlerHoldEffect = GetBattlerHoldEffect(battlerId, TRUE); battlerHoldEffect = GetBattlerHoldEffect(battlerId, TRUE);
switch (battlerHoldEffect) switch (battlerHoldEffect)
{ {
case HOLD_EFFECT_MICLE_BERRY:
if (B_HP_BERRIES >= GEN_4)
effect = TrySetMicleBerry(battlerId, gLastUsedItem, FALSE);
break;
case HOLD_EFFECT_RESTORE_HP: case HOLD_EFFECT_RESTORE_HP:
if (B_HP_BERRIES >= GEN_4) if (B_HP_BERRIES >= GEN_4)
effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, FALSE); effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, FALSE);