Fixes Sticky Barb never getting transferred to attacker + tests
This commit is contained in:
parent
4d60c9e83f
commit
e62be0b3a9
@ -588,7 +588,7 @@ static enum ItemEffect TryStickyBarbOnTargetHit(u32 battlerDef, u32 battlerAtk,
|
||||
&& !DoesSubstituteBlockMove(battlerAtk, battlerDef, gCurrentMove)
|
||||
&& IsBattlerAlive(battlerAtk)
|
||||
&& CanStealItem(battlerAtk, battlerDef, item)
|
||||
&& item == ITEM_NONE)
|
||||
&& gBattleMons[battlerAtk].item == ITEM_NONE)
|
||||
{
|
||||
// No sticky hold checks.
|
||||
gEffectBattler = battlerDef;
|
||||
|
||||
48
test/battle/hold_effect/sticky_barb.c
Normal file
48
test/battle/hold_effect/sticky_barb.c
Normal file
@ -0,0 +1,48 @@
|
||||
#include "global.h"
|
||||
#include "test/battle.h"
|
||||
|
||||
ASSUMPTIONS
|
||||
{
|
||||
ASSUME(gItemsInfo[ITEM_STICKY_BARB].holdEffect == HOLD_EFFECT_STICKY_BARB);
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Sticky Barb hurts its holder at the end of the turn", s16 damage)
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_STICKY_BARB); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { }
|
||||
} SCENE {
|
||||
HP_BAR(player, captureDamage: &results[i].damage);
|
||||
} THEN {
|
||||
EXPECT_EQ(results[0].damage, player->maxHP / 8);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Sticky Barb gets transferred if its holder is hit by a contact move")
|
||||
{
|
||||
u32 move;
|
||||
PARAMETRIZE { move = MOVE_SCRATCH; }
|
||||
PARAMETRIZE { move = MOVE_GROWL; }
|
||||
PARAMETRIZE { move = MOVE_HYPER_VOICE; }
|
||||
GIVEN {
|
||||
ASSUME(MoveMakesContact(MOVE_SCRATCH));
|
||||
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_STICKY_BARB); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, move); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, move, opponent);
|
||||
if (MoveMakesContact(move))
|
||||
{
|
||||
MESSAGE("The Sticky Barb attached itself to the opposing Wobbuffet!");
|
||||
MESSAGE("The opposing Wobbuffet was hurt by the Sticky Barb!");
|
||||
}
|
||||
else
|
||||
{
|
||||
NOT MESSAGE("The Sticky Barb attached itself to the opposing Wobbuffet!");
|
||||
MESSAGE("Wobbuffet was hurt by the Sticky Barb!");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user