some quick claw/custap berry fixes

This commit is contained in:
Evan 2021-01-31 23:31:27 -07:00
parent 4611c71bd1
commit f428e5e2dc
5 changed files with 17 additions and 17 deletions

View file

@ -7853,6 +7853,8 @@ BattleScript_AnnounceAirLockCloudNine::
end3
BattleScript_QuickClawActivation::
printstring STRINGID_EMPTYSTRING3
waitmessage 0x1
playanimation BS_ATTACKER, B_ANIM_FOCUS_PUNCH_SETUP, NULL
waitanimation
printstring STRINGID_CANACTFASTERTHANKSTO
@ -7860,6 +7862,8 @@ BattleScript_QuickClawActivation::
end2
BattleScript_CustapBerryActivation::
printstring STRINGID_EMPTYSTRING3
waitmessage 0x1
playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL
waitanimation
printstring STRINGID_CANACTFASTERTHANKSTO

View file

@ -140,6 +140,8 @@ struct ProtectStruct
u32 usedGravityPreventedMove:1;
u32 powderSelfDmg:1;
u32 usedThroatChopPreventedMove:1;
u32 micle:1;
u32 custap:1; // also quick claw
u32 physicalDmg;
u32 specialDmg;
u8 physicalBattlerId;
@ -427,13 +429,6 @@ struct Illusion
struct Pokemon *mon;
};
struct PinchBerry
{
u8 micle:1;
u8 custap:1; // also quick claw
};
struct BattleStruct
{
u8 turnEffectsTracker;
@ -549,7 +544,6 @@ struct BattleStruct
u8 sameMoveTurns[MAX_BATTLERS_COUNT]; // For Metronome, number of times the same moves has been SUCCESFULLY used.
u16 moveEffect2; // For Knock Off
u16 changedSpecies[PARTY_SIZE]; // For Zygarde or future forms when multiple mons can change into the same pokemon.
struct PinchBerry pinchBerry[MAX_BATTLERS_COUNT];
u8 quickClawBattlerId;
};

View file

@ -4353,7 +4353,7 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves)
|| (!IsAbilityOnOpposingSide(battler1, ABILITY_UNNERVE)
&& holdEffectBattler1 == HOLD_EFFECT_CUSTAP_BERRY
&& HasEnoughHpToEatBerry(battler1, 4, gBattleMons[battler1].item)))
gBattleStruct->pinchBerry[battler1].custap = TRUE;
gProtectStructs[battler1].custap = TRUE;
speedBattler2 = GetBattlerTotalSpeedStat(battler2);
holdEffectBattler2 = GetBattlerHoldEffect(battler2, TRUE);
@ -4361,7 +4361,7 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves)
|| (!IsAbilityOnOpposingSide(battler2, ABILITY_UNNERVE)
&& holdEffectBattler2 == HOLD_EFFECT_CUSTAP_BERRY
&& HasEnoughHpToEatBerry(battler2, 4, gBattleMons[battler2].item)))
gBattleStruct->pinchBerry[battler2].custap = TRUE;
gProtectStructs[battler2].custap = TRUE;
if (!ignoreChosenMoves)
{
@ -4377,9 +4377,9 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves)
// LAGGING TAIL - always last
// STALL - always last
if (gBattleStruct->pinchBerry[battler1].custap && !gBattleStruct->pinchBerry[battler2].custap)
if (gProtectStructs[battler1].custap && !gProtectStructs[battler2].custap)
strikesFirst = 0;
else if (gBattleStruct->pinchBerry[battler2].custap && !gBattleStruct->pinchBerry[battler1].custap)
else if (gProtectStructs[battler2].custap && !gProtectStructs[battler1].custap)
strikesFirst = 1;
else if (holdEffectBattler1 == HOLD_EFFECT_LAGGING_TAIL && holdEffectBattler2 != HOLD_EFFECT_LAGGING_TAIL)
strikesFirst = 1;
@ -4630,12 +4630,14 @@ static void CheckQuickClaw_CustapBerryActivation(void)
{
gActiveBattler = gBattlerAttacker = gBattleStruct->quickClawBattlerId;
gBattleStruct->quickClawBattlerId++;
if (gBattleStruct->pinchBerry[gActiveBattler].custap
if (gChosenActionByBattler[gActiveBattler] == B_ACTION_USE_MOVE
&& gChosenMoveByBattler[gActiveBattler] != MOVE_FOCUS_PUNCH // quick claw message doesn't need to activate here
&& gProtectStructs[gActiveBattler].custap
&& !(gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP)
&& !(gDisableStructs[gBattlerAttacker].truantCounter)
&& !(gProtectStructs[gActiveBattler].noValidMoves))
{
gBattleStruct->pinchBerry[gActiveBattler].custap = FALSE;
gProtectStructs[gActiveBattler].custap = FALSE;
gLastUsedItem = gBattleMons[gActiveBattler].item;
if (GetBattlerHoldEffect(gActiveBattler, FALSE) == HOLD_EFFECT_CUSTAP_BERRY)
{

View file

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

View file

@ -5221,7 +5221,7 @@ 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
gProtectStructs[battlerId].micle = TRUE; // battler's next attack has increased accuracy
if (end2)
{