diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index fa59e58ce6..769ef1daae 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6189,6 +6189,25 @@ BattleScript_IllusionOff:: waitmessage 0x40 return +BattleScript_CottonDownActivates:: + setbyte gBattlerTarget, 0x1 +BattleScript_CottonDownLoop: + setstatchanger STAT_SPEED, 1, TRUE + statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED | STAT_BUFF_ALLOW_PTR, BattleScript_CottonDownActivatesLoopIncrement + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_CottonDownEnd + call BattleScript_AbilityPopUp + setgraphicalstatchangevalues + playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 + setbyte gBattleCommunication STAT_SPEED + stattextbuffer BS_TARGET + printfromtable gStatDownStringIds + waitmessage 0x40 +BattleScript_CottonDownActivatesLoopIncrement: + addbyte gBattlerTarget, 0x1 + jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_CottonDownLoop +BattleScript_CottonDownEnd: + end3 + BattleScript_AnticipationActivates:: pause 0x5 call BattleScript_AbilityPopUp diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 7799e721fb..62c5ce2e0e 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -351,5 +351,6 @@ extern const u8 BattleScript_EmergencyExitWildNoPopUp[]; extern const u8 BattleScript_CheekPouchActivates[]; extern const u8 BattleScript_AnnounceAirLockCloudNine[]; extern const u8 BattleScript_TargetAbilityStatRaiseOnSwitchin[]; +extern const u8 BattleScript_CottonDownActivates[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/src/battle_util.c b/src/battle_util.c index ef414b7110..9372fe6942 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4608,6 +4608,21 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_COTTON_DOWN: + if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) + && gBattleMons[gBattlerTarget].hp != 0 + && !gProtectStructs[gBattlerAttacker].confusionSelfDmg + && TARGET_TURN_DAMAGED) + { + for (i = 0; i < gBattlersCount; i++) + { + gBattlerAttacker = i; + BattleScriptPushCursorAndCallback(BattleScript_CottonDownActivates); + effect++; + break; + } + } + break; } break; case ABILITYEFFECT_MOVE_END_ATTACKER: // Same as above, but for attacker