Implemented Cud Chew's effect

This commit is contained in:
LOuroboros 2022-12-05 23:36:18 -03:00
parent 7c67f1ac27
commit f96137eb5e
4 changed files with 28 additions and 0 deletions

View File

@ -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

View File

@ -104,6 +104,7 @@ struct DisableStruct
u8 noRetreat:1;
u8 tarShot:1;
u8 octolock:1;
u8 cudChew:1;
};
struct ProtectStruct

View File

@ -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[];

View File

@ -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;