fix frisk msg + tests (#3762)

This commit is contained in:
DizzyEggg 2023-12-18 15:13:14 +01:00 committed by GitHub
parent b65b6d8a80
commit e1d4bcc04e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 83 additions and 0 deletions

View file

@ -4474,6 +4474,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
if (!gSpecialStatuses[battler].switchInAbilityDone)
{
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
gBattlerAttacker = battler;
BattleScriptPushCursorAndCallback(BattleScript_FriskActivates); // Try activate
effect++;
}

View file

@ -0,0 +1,82 @@
#include "global.h"
#include "test/battle.h"
DOUBLE_BATTLE_TEST("Frisk does not trigger when pokemon hold no items")
{
GIVEN {
PLAYER(SPECIES_FURRET) { Ability(ABILITY_FRISK); };
PLAYER(SPECIES_FURRET) { Ability(ABILITY_FRISK); };
OPPONENT(SPECIES_SENTRET) { Ability(ABILITY_FRISK); };
OPPONENT(SPECIES_SENTRET) { Ability(ABILITY_FRISK); };
} WHEN {
TURN { ; }
} SCENE {
NONE_OF {
ABILITY_POPUP(playerLeft, ABILITY_FRISK);
ABILITY_POPUP(playerRight, ABILITY_FRISK);
ABILITY_POPUP(opponentLeft, ABILITY_FRISK);
ABILITY_POPUP(opponentRight, ABILITY_FRISK);
}
}
}
SINGLE_BATTLE_TEST("Frisk triggers in a Single Battle")
{
GIVEN {
PLAYER(SPECIES_FURRET) { Ability(ABILITY_FRISK); Item(ITEM_POTION); };
OPPONENT(SPECIES_SENTRET) { Ability(ABILITY_FRISK); Item(ITEM_POTION); };
} WHEN {
TURN { ; }
} SCENE {
ABILITY_POPUP(player, ABILITY_FRISK);
MESSAGE("Furret frisked Foe Sentret and found its Potion!");
ABILITY_POPUP(opponent, ABILITY_FRISK);
MESSAGE("Foe Sentret frisked Furret and found its Potion!");
}
}
DOUBLE_BATTLE_TEST("Frisk triggers for player in a Double Battle after switching-in after fainting")
{
bool32 targetLeft;
PARAMETRIZE { targetLeft = TRUE; }
PARAMETRIZE { targetLeft = FALSE; }
GIVEN {
ASSUME(gBattleMoves[MOVE_POUND].power != 0);
PLAYER(SPECIES_WOBBUFFET) { HP(1); }
PLAYER(SPECIES_WOBBUFFET) { HP(1); }
PLAYER(SPECIES_FURRET) { Ability(ABILITY_FRISK); };
OPPONENT(SPECIES_WYNAUT) { Item(ITEM_POTION); }
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(opponentLeft, MOVE_POUND, target: targetLeft ? playerLeft : playerRight); SEND_OUT(targetLeft ? playerLeft : playerRight, 2); }
} SCENE {
MESSAGE("Foe Wynaut used Pound!");
MESSAGE("Wobbuffet fainted!");
ABILITY_POPUP(targetLeft ? playerLeft : playerRight, ABILITY_FRISK);
MESSAGE("Furret frisked Foe Wynaut and found its Potion!");
}
}
DOUBLE_BATTLE_TEST("Frisk triggers for opponent in a Double Battle after switching-in after fainting")
{
bool32 targetLeft;
PARAMETRIZE { targetLeft = TRUE; }
PARAMETRIZE { targetLeft = FALSE; }
GIVEN {
ASSUME(gBattleMoves[MOVE_POUND].power != 0);
PLAYER(SPECIES_WYNAUT) { Item(ITEM_POTION); }
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_WOBBUFFET) { HP(1); }
OPPONENT(SPECIES_WOBBUFFET) { HP(1); }
OPPONENT(SPECIES_FURRET) { Ability(ABILITY_FRISK); };
} WHEN {
TURN { MOVE(playerLeft, MOVE_POUND, target: targetLeft ? opponentLeft : opponentRight); SEND_OUT(targetLeft ? opponentLeft : opponentRight, 2); }
} SCENE {
MESSAGE("Wynaut used Pound!");
MESSAGE("Foe Wobbuffet fainted!");
ABILITY_POPUP(targetLeft ? opponentLeft : opponentRight, ABILITY_FRISK);
MESSAGE("Foe Furret frisked Wynaut and found its Potion!");
}
}