diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index bcf918503..0057fd5c5 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -8688,6 +8688,14 @@ BattleScript_QuickClawActivation:: waitmessage B_WAIT_TIME_LONG end2 +BattleScript_QuickDrawActivation:: + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 + call BattleScript_AbilityPopUp + printstring STRINGID_CANACTFASTERTHANKSTO + waitmessage B_WAIT_TIME_LONG + end2 + BattleScript_CustapBerryActivation:: printstring STRINGID_EMPTYSTRING3 waitmessage 1 diff --git a/include/battle.h b/include/battle.h index 8377ad0be..c1ac57686 100644 --- a/include/battle.h +++ b/include/battle.h @@ -151,6 +151,7 @@ struct ProtectStruct u32 disableEjectPack:1; u32 statFell:1; u32 pranksterElevated:1; + u32 quickDraw:1; u32 physicalDmg; u32 specialDmg; u8 physicalBattlerId; diff --git a/include/battle_scripts.h b/include/battle_scripts.h index c77188240..1994aef50 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -366,6 +366,7 @@ extern const u8 BattleScript_PerishBodyActivates[]; extern const u8 BattleScript_ActivateAsOne[]; extern const u8 BattleScript_RaiseStatOnFaintingTarget[]; extern const u8 BattleScript_QuickClawActivation[]; +extern const u8 BattleScript_QuickDrawActivation[]; extern const u8 BattleScript_CustapBerryActivation[]; extern const u8 BattleScript_MicleBerryActivateEnd2[]; extern const u8 BattleScript_MicleBerryActivateRet[]; diff --git a/src/battle_main.c b/src/battle_main.c index 38d638038..d86d9f59b 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4399,20 +4399,32 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) u32 holdEffectBattler1 = 0, holdEffectBattler2 = 0; s8 priority1 = 0, priority2 = 0; + // Battler 1 speedBattler1 = GetBattlerTotalSpeedStat(battler1); holdEffectBattler1 = GetBattlerHoldEffect(battler1, TRUE); - if ((holdEffectBattler1 == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (0xFFFF * GetBattlerHoldEffectParam(battler1)) / 100) + // Quick Draw + if (!ignoreChosenMoves && GetBattlerAbility(battler1) == ABILITY_QUICK_DRAW && !IS_MOVE_STATUS(gChosenMoveByBattler[battler1]) && Random() % 100 < 30) + gProtectStructs[battler1].quickDraw = TRUE; + // Quick Claw and Custap Berry + if (!gProtectStructs[battler1].quickDraw + && ((holdEffectBattler1 == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (0xFFFF * GetBattlerHoldEffectParam(battler1)) / 100) || (!IsAbilityOnOpposingSide(battler1, ABILITY_UNNERVE) && holdEffectBattler1 == HOLD_EFFECT_CUSTAP_BERRY - && HasEnoughHpToEatBerry(battler1, 4, gBattleMons[battler1].item))) + && HasEnoughHpToEatBerry(battler1, 4, gBattleMons[battler1].item)))) gProtectStructs[battler1].custap = TRUE; + // Battler 2 speedBattler2 = GetBattlerTotalSpeedStat(battler2); holdEffectBattler2 = GetBattlerHoldEffect(battler2, TRUE); - if ((holdEffectBattler2 == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (0xFFFF * GetBattlerHoldEffectParam(battler2)) / 100) + // Quick Draw + if (!ignoreChosenMoves && GetBattlerAbility(battler2) == ABILITY_QUICK_DRAW && !IS_MOVE_STATUS(gChosenMoveByBattler[battler2]) && Random() % 100 < 30) + gProtectStructs[battler2].quickDraw = TRUE; + // Quick Claw and Custap Berry + if (!gProtectStructs[battler2].quickDraw + && ((holdEffectBattler2 == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (0xFFFF * GetBattlerHoldEffectParam(battler2)) / 100) || (!IsAbilityOnOpposingSide(battler2, ABILITY_UNNERVE) && holdEffectBattler2 == HOLD_EFFECT_CUSTAP_BERRY - && HasEnoughHpToEatBerry(battler2, 4, gBattleMons[battler2].item))) + && HasEnoughHpToEatBerry(battler2, 4, gBattleMons[battler2].item)))) gProtectStructs[battler2].custap = TRUE; if (!ignoreChosenMoves) @@ -4428,8 +4440,12 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) // QUICK CLAW / CUSTAP - always first // LAGGING TAIL - always last // STALL - always last - - if (gProtectStructs[battler1].custap && !gProtectStructs[battler2].custap) + + if (gProtectStructs[battler1].quickDraw && !gProtectStructs[battler2].quickDraw) + strikesFirst = 0; + else if (!gProtectStructs[battler1].quickDraw && gProtectStructs[battler2].quickDraw) + strikesFirst = 1; + else if (gProtectStructs[battler1].custap && !gProtectStructs[battler2].custap) strikesFirst = 0; else if (gProtectStructs[battler2].custap && !gProtectStructs[battler1].custap) strikesFirst = 1; @@ -4690,22 +4706,34 @@ static void CheckQuickClaw_CustapBerryActivation(void) gBattleStruct->quickClawBattlerId++; if (gChosenActionByBattler[gActiveBattler] == B_ACTION_USE_MOVE && gChosenMoveByBattler[gActiveBattler] != MOVE_FOCUS_PUNCH // quick claw message doesn't need to activate here - && gProtectStructs[gActiveBattler].custap + && (gProtectStructs[gActiveBattler].custap || gProtectStructs[gActiveBattler].quickDraw) && !(gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP) && !(gDisableStructs[gBattlerAttacker].truantCounter) && !(gProtectStructs[gActiveBattler].noValidMoves)) { - gProtectStructs[gActiveBattler].custap = FALSE; - gLastUsedItem = gBattleMons[gActiveBattler].item; - if (GetBattlerHoldEffect(gActiveBattler, FALSE) == HOLD_EFFECT_CUSTAP_BERRY) + if (gProtectStructs[gActiveBattler].custap) { - // don't record berry since its gone now - BattleScriptExecute(BattleScript_CustapBerryActivation); + gProtectStructs[gActiveBattler].custap = FALSE; + gLastUsedItem = gBattleMons[gActiveBattler].item; + PREPARE_ITEM_BUFFER(gBattleTextBuff1, gLastUsedItem); + if (GetBattlerHoldEffect(gActiveBattler, FALSE) == HOLD_EFFECT_CUSTAP_BERRY) + { + // don't record berry since its gone now + BattleScriptExecute(BattleScript_CustapBerryActivation); + } + else + { + RecordItemEffectBattle(gActiveBattler, GetBattlerHoldEffect(gActiveBattler, FALSE)); + BattleScriptExecute(BattleScript_QuickClawActivation); + } } - else + else if (gProtectStructs[gActiveBattler].quickDraw) { - RecordItemEffectBattle(gActiveBattler, GetBattlerHoldEffect(gActiveBattler, FALSE)); - BattleScriptExecute(BattleScript_QuickClawActivation); + gProtectStructs[gActiveBattler].quickDraw = FALSE; + gLastUsedAbility = gBattleMons[gActiveBattler].ability; + PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility); + RecordAbilityBattle(gActiveBattler, gLastUsedAbility); + BattleScriptExecute(BattleScript_QuickDrawActivation); } return; } diff --git a/src/battle_message.c b/src/battle_message.c index e586784c5..444d32671 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -692,7 +692,7 @@ static const u8 sText_PkmnsWillPerishIn3Turns[] = _("Both Pokémon will perish\n static const u8 sText_AbilityRaisedStatDrastically[] = _("{B_DEF_ABILITY} raised {B_DEF_NAME_WITH_PREFIX}'s\n{B_BUFF1} drastically!"); static const u8 sText_AsOneEnters[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} has two Abilities!"); static const u8 sText_CuriousMedicineEnters[] = _("{B_EFF_NAME_WITH_PREFIX}'s\nstat changes were reset!"); -static const u8 sText_CanActFaster[] = _("{B_ATK_NAME_WITH_PREFIX} can act faster,\nthanks to {B_LAST_ITEM}!"); +static const u8 sText_CanActFaster[] = _("{B_ATK_NAME_WITH_PREFIX} can act faster,\nthanks to {B_BUFF1}!"); static const u8 sText_MicleBerryActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} boosted the accuracy of its\nnext move using {B_LAST_ITEM}!"); static const u8 sText_PkmnShookOffTheTaunt[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} shook off\nthe taunt!"); static const u8 sText_PkmnGotOverItsInfatuation[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} got over\nits infatuation!");