diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index c7f3cc663a..3a503315a3 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7754,3 +7754,17 @@ BattleScript_MicleBerryActivateRet_Anim: removeitem BS_SCRIPTING return +BattleScript_JabocaRowapBerryActivates:: + jumpifability BS_TARGET, ABILITY_RIPEN, BattleScript_JabocaRowapBerryActivate_Ripen + goto BattleScript_JabocaRowapBerryActivate_Anim +BattleScript_JabocaRowapBerryActivate_Ripen: + call BattleScript_AbilityPopUp +BattleScript_JabocaRowapBerryActivate_Anim: + jumpifabsent BS_TARGET, BattleScript_JabocaRowapBerryActivate_Dmg @ dont play the animation for a fainted target + playanimation BS_TARGET, B_ANIM_HELD_ITEM_EFFECT, NULL + waitanimation +BattleScript_JabocaRowapBerryActivate_Dmg: + call BattleScript_HurtAttacker + removeitem BS_TARGET + return + diff --git a/include/battle_scripts.h b/include/battle_scripts.h index aec8dbc6e0..4ca82e3bf6 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -354,5 +354,6 @@ extern const u8 BattleScript_QuickClawActivation[]; extern const u8 BattleScript_CustapBerryActivation[]; extern const u8 BattleScript_MicleBerryActivateEnd2[]; extern const u8 BattleScript_MicleBerryActivateRet[]; +extern const u8 BattleScript_JabocaRowapBerryActivates[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/hold_effects.h b/include/constants/hold_effects.h index 3de2e7b43b..52a3ffda4b 100644 --- a/include/constants/hold_effects.h +++ b/include/constants/hold_effects.h @@ -107,6 +107,7 @@ #define HOLD_EFFECT_MICLE_BERRY 101 #define HOLD_EFFECT_JABOCA_BERRY 102 #define HOLD_EFFECT_CUSTAP_BERRY 103 +#define HOLD_EFFECT_RETALIATE_BERRY 104 // rowap, jaboca // Gen5 hold effects #define HOLD_EFFECT_FLOAT_STONE 115 diff --git a/src/battle_util.c b/src/battle_util.c index 54df2df63b..b6d83d9576 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5890,6 +5890,25 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gBattleScripting.statChanger = SET_STATCHANGER(STAT_SPATK, 1, FALSE); } break; + case HOLD_EFFECT_RETALIATE_BERRY: + if (IsBattlerAlive(battlerId) + && TARGET_TURN_DAMAGED + && !DoesSubstituteBlockMove(gBattlerAttacker, battlerId, gCurrentMove) + && GetBattleMoveSplit(gCurrentMove) == ItemId_GetHoldEffectParam(gLastUsedItem)) + { + gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 8; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + if (GetBattlerAbility(battlerId) == ABILITY_RIPEN) + gBattleMoveDamage *= 2; + + effect = ITEM_HP_CHANGE; + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_JabocaRowapBerryActivates; + PREPARE_ITEM_BUFFER(gBattleTextBuff1, gLastUsedItem); + RecordItemEffectBattle(battlerId, HOLD_EFFECT_ROCKY_HELMET); + } + break; } } break;