Fixes Cutton Down / Defiant interaction (#3657)

This commit is contained in:
Alex 2023-12-08 17:29:29 +01:00 committed by GitHub
parent 748259284d
commit d86a2136a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 106 additions and 5 deletions

View file

@ -7887,10 +7887,11 @@ BattleScript_IllusionOff::
return return
BattleScript_CottonDownActivates:: BattleScript_CottonDownActivates::
setbyte sFIXED_ABILITY_POPUP, TRUE showabilitypopup BS_TARGET
call BattleScript_AbilityPopUp pause B_WAIT_TIME_LONG
destroyabilitypopup
copybyte gEffectBattler, gBattlerTarget copybyte gEffectBattler, gBattlerTarget
savetarget swapattackerwithtarget
setbyte gBattlerTarget, 0 setbyte gBattlerTarget, 0
BattleScript_CottonDownLoop: BattleScript_CottonDownLoop:
jumpiffainted BS_TARGET, TRUE, BattleScript_CottonDownLoopIncrement jumpiffainted BS_TARGET, TRUE, BattleScript_CottonDownLoopIncrement
@ -7909,8 +7910,7 @@ BattleScript_CottonDownLoopIncrement:
addbyte gBattlerTarget, 1 addbyte gBattlerTarget, 1
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_CottonDownLoop jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_CottonDownLoop
BattleScript_CottonDownReturn: BattleScript_CottonDownReturn:
restoretarget swapattackerwithtarget
destroyabilitypopup
return return
BattleScript_AnticipationActivates:: BattleScript_AnticipationActivates::

View file

@ -0,0 +1,64 @@
#include "global.h"
#include "test/battle.h"
SINGLE_BATTLE_TEST("Cotton Down drops speed by one of opposing battler if hit by a damaging move")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_ELDEGOSS) { Ability(ABILITY_COTTON_DOWN); }
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player);
ABILITY_POPUP(opponent, ABILITY_COTTON_DOWN);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Wobbuffet's Speed fell!");
} THEN {
EXPECT_EQ(player->statStages[STAT_SPEED], DEFAULT_STAT_STAGE - 1);
}
}
SINGLE_BATTLE_TEST("Cotton Down drops speed by one for each multi hit")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_ELDEGOSS) { Ability(ABILITY_COTTON_DOWN); }
} WHEN {
TURN { MOVE(player, MOVE_DOUBLE_KICK); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_DOUBLE_KICK, player);
ABILITY_POPUP(opponent, ABILITY_COTTON_DOWN);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Wobbuffet's Speed fell!");
ABILITY_POPUP(opponent, ABILITY_COTTON_DOWN);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Wobbuffet's Speed fell!");
} THEN {
EXPECT_EQ(player->statStages[STAT_SPEED], DEFAULT_STAT_STAGE - 2);
}
}
DOUBLE_BATTLE_TEST("Cotton Down drops speed by one of all other battlers on the field")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_ELDEGOSS) { Ability(ABILITY_COTTON_DOWN); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(playerLeft, MOVE_TACKLE, target: opponentLeft); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerLeft);
ABILITY_POPUP(opponentLeft, ABILITY_COTTON_DOWN);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft);
MESSAGE("Wobbuffet's Speed fell!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerRight);
MESSAGE("Wynaut's Speed fell!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentRight);
MESSAGE("Foe Wobbuffet's Speed fell!");
} THEN {
EXPECT_EQ(playerLeft->statStages[STAT_SPEED], DEFAULT_STAT_STAGE - 1);
EXPECT_EQ(playerRight->statStages[STAT_SPEED], DEFAULT_STAT_STAGE - 1);
EXPECT_EQ(opponentRight->statStages[STAT_SPEED], DEFAULT_STAT_STAGE - 1);
}
}

View file

@ -138,3 +138,40 @@ SINGLE_BATTLE_TEST("Defiant activates after Sticky Web lowers Speed")
MESSAGE("Mankey's Attack sharply rose!"); MESSAGE("Mankey's Attack sharply rose!");
} }
} }
DOUBLE_BATTLE_TEST("Defiant is activated by Cotton Down for non-ally pokemon")
{
GIVEN {
PLAYER(SPECIES_MANKEY) { Ability(ABILITY_DEFIANT); }
PLAYER(SPECIES_MANKEY) { Ability(ABILITY_DEFIANT); }
OPPONENT(SPECIES_ELDEGOSS) { Ability(ABILITY_COTTON_DOWN); }
OPPONENT(SPECIES_MANKEY) { Ability(ABILITY_DEFIANT); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_TACKLE, target: opponentLeft); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerLeft);
ABILITY_POPUP(opponentLeft, ABILITY_COTTON_DOWN);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft);
MESSAGE("Mankey's Speed fell!");
ABILITY_POPUP(playerLeft, ABILITY_DEFIANT);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft);
MESSAGE("Mankey's Attack sharply rose!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerRight);
MESSAGE("Mankey's Speed fell!");
ABILITY_POPUP(playerRight, ABILITY_DEFIANT);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerRight);
MESSAGE("Mankey's Attack sharply rose!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentRight);
MESSAGE("Foe Mankey's Speed fell!");
} THEN {
EXPECT_EQ(playerLeft->statStages[STAT_SPEED], DEFAULT_STAT_STAGE - 1);
EXPECT_EQ(playerRight->statStages[STAT_SPEED], DEFAULT_STAT_STAGE - 1);
EXPECT_EQ(opponentRight->statStages[STAT_SPEED], DEFAULT_STAT_STAGE - 1);
EXPECT_EQ(playerLeft->statStages[STAT_ATK], DEFAULT_STAT_STAGE + 2);
EXPECT_EQ(playerRight->statStages[STAT_ATK], DEFAULT_STAT_STAGE + 2);
}
}