Fix Knock Off healing berries (#3509)

This commit is contained in:
DizzyEggg 2023-11-01 14:47:31 +01:00 committed by GitHub
parent e281103575
commit 7eb1b12224
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 63 additions and 10 deletions

View File

@ -302,16 +302,16 @@
#define MOVEEND_ATTACKER_VISIBLE 10
#define MOVEEND_TARGET_VISIBLE 11
#define MOVEEND_ITEM_EFFECTS_TARGET 12
#define MOVEEND_ITEM_EFFECTS_ALL 13
#define MOVEEND_KINGSROCK 14 // These item effects will occur each strike of a multi-hit move
#define MOVEEND_SUBSTITUTE 15
#define MOVEEND_SKY_DROP_CONFUSE 16
#define MOVEEND_UPDATE_LAST_MOVES 17
#define MOVEEND_MIRROR_MOVE 18
#define MOVEEND_NEXT_TARGET 19 // Everything up until here is handled for each strike of a multi-hit move
#define MOVEEND_MULTIHIT_MOVE 20
#define MOVEEND_DEFROST 21
#define MOVEEND_MOVE_EFFECTS2 22
#define MOVEEND_MOVE_EFFECTS2 13
#define MOVEEND_ITEM_EFFECTS_ALL 14
#define MOVEEND_KINGSROCK 15 // These item effects will occur each strike of a multi-hit move
#define MOVEEND_SUBSTITUTE 16
#define MOVEEND_SKY_DROP_CONFUSE 17
#define MOVEEND_UPDATE_LAST_MOVES 18
#define MOVEEND_MIRROR_MOVE 19
#define MOVEEND_NEXT_TARGET 20 // Everything up until here is handled for each strike of a multi-hit move
#define MOVEEND_MULTIHIT_MOVE 21
#define MOVEEND_DEFROST 22
#define MOVEEND_RECOIL 23
#define MOVEEND_MAGICIAN 24 // Occurs after final multi-hit strike, and after other items/abilities would activate
#define MOVEEND_EJECT_BUTTON 25

View File

@ -0,0 +1,53 @@
#include "global.h"
#include "test/battle.h"
ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_KNOCK_OFF].effect == EFFECT_KNOCK_OFF);
}
SINGLE_BATTLE_TEST("Knock Off knocks a healing berry before it has the chance to activate")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SITRUS_BERRY); MaxHP(500); HP(255); }
} WHEN {
TURN { MOVE(player, MOVE_KNOCK_OFF); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_KNOCK_OFF, player);
NONE_OF {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
MESSAGE("Foe Wobbuffet's Sitrus Berry restored health!");
}
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_ITEM_KNOCKOFF);
MESSAGE("Wobbuffet knocked off Foe Wobbuffet's Sitrus Berry!");
}
}
SINGLE_BATTLE_TEST("Knock Off activates after Rocky Helmet and Weakness Policy")
{
u16 item = 0;
PARAMETRIZE { item = ITEM_WEAKNESS_POLICY; }
PARAMETRIZE { item = ITEM_ROCKY_HELMET; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Item(item); }
} WHEN {
TURN { MOVE(player, MOVE_KNOCK_OFF); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_KNOCK_OFF, player);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
if (item == ITEM_WEAKNESS_POLICY) {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE);
MESSAGE("Using WeaknssPolicy, the Attack of Foe Wobbuffet sharply rose!");
MESSAGE("Using WeaknssPolicy, the Sp. Atk of Foe Wobbuffet sharply rose!");
} else if (item == ITEM_ROCKY_HELMET) {
HP_BAR(player);
MESSAGE("Wobbuffet was hurt by Foe Wobbuffet's Rocky Helmet!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_ITEM_KNOCKOFF);
MESSAGE("Wobbuffet knocked off Foe Wobbuffet's Rocky Helmet!");
}
}
}