diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 785625e32..00fb0ba27 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7656,6 +7656,17 @@ BattleScript_BallFetch:: waitmessage B_WAIT_TIME_LONG end3 +BattleScript_CudChewActivates:: + pause B_WAIT_TIME_SHORTEST + call BattleScript_AbilityPopUp + setbyte sBERRY_OVERRIDE, 1 @ override the requirements for eating berries + consumeberry BS_TARGET, FALSE + orword gHitMarker, HITMARKER_SKIP_DMG_TRACK | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE + healthbarupdate BS_ATTACKER + datahpupdate BS_ATTACKER + setbyte sBERRY_OVERRIDE, 0 + end3 + BattleScript_TargetFormChange:: pause 5 copybyte gBattlerAbility, gBattlerTarget diff --git a/include/battle.h b/include/battle.h index 14037b72c..4b33062d3 100644 --- a/include/battle.h +++ b/include/battle.h @@ -104,6 +104,7 @@ struct DisableStruct u8 noRetreat:1; u8 tarShot:1; u8 octolock:1; + u8 cudChew:1; }; struct ProtectStruct diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 33138189b..13fa5a4a6 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -444,6 +444,7 @@ extern const u8 BattleScript_ProtosynthesisActivates[]; extern const u8 BattleScript_QuarkDriveActivates[]; extern const u8 BattleScript_GoodAsGoldActivates[]; extern const u8 BattleScript_RuinAbilityActivates[]; +extern const u8 BattleScript_CudChewActivates[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[]; diff --git a/src/battle_util.c b/src/battle_util.c index 38504e1bb..7fdd63eb4 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2696,6 +2696,7 @@ enum ENDTURN_THROAT_CHOP, ENDTURN_SLOW_START, ENDTURN_PLASMA_FISTS, + ENDTURN_CUD_CHEW, ENDTURN_BATTLER_COUNT }; @@ -3238,6 +3239,11 @@ u8 DoBattlerEndTurnEffects(void) gStatuses4[i] &= ~STATUS4_PLASMA_FISTS; gBattleStruct->turnEffectsTracker++; break; + case ENDTURN_CUD_CHEW: + if (GetBattlerAbility(gActiveBattler) == ABILITY_CUD_CHEW && !gDisableStructs[gActiveBattler].cudChew && GetUsedHeldItem(gActiveBattler) != ITEM_NONE) + gDisableStructs[gActiveBattler].cudChew = TRUE; + gBattleStruct->turnEffectsTracker++; + break; case ENDTURN_BATTLER_COUNT: // done gBattleStruct->turnEffectsTracker = 0; gBattleStruct->turnEffectsBattlerId++; @@ -5154,6 +5160,15 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_CUD_CHEW: + if (ItemId_GetPocket(GetUsedHeldItem(battler)) == POCKET_BERRIES && gDisableStructs[gActiveBattler].cudChew == TRUE) + { + gLastUsedItem = gBattleStruct->usedHeldItems[battler][GetBattlerSide(battler)]; + gBattleStruct->usedHeldItems[battler][GetBattlerSide(battler)] = ITEM_NONE; + BattleScriptPushCursorAndCallback(BattleScript_CudChewActivates); + effect++; + } + break; } } break;