Fixes Symbiosis not triggering when a weakness berry was consumed (#6782)
This commit is contained in:
parent
4e7b1f2a97
commit
7c4fb512a1
@ -2331,7 +2331,6 @@ static inline bool32 TryActivateWeakenessBerry(u32 battlerDef)
|
||||
{
|
||||
if (gSpecialStatuses[battlerDef].berryReduced && gBattleMons[battlerDef].item != ITEM_NONE)
|
||||
{
|
||||
gSpecialStatuses[battlerDef].berryReduced = FALSE;
|
||||
gBattleScripting.battler = battlerDef;
|
||||
gLastUsedItem = gBattleMons[battlerDef].item;
|
||||
gBattleStruct->ateBerry[battlerDef & BIT_SIDE] |= 1u << gBattlerPartyIndexes[battlerDef];
|
||||
@ -6187,14 +6186,16 @@ static bool32 TryKnockOffBattleScript(u32 battlerDef)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#define SYMBIOSIS_CHECK(battler, ally) \
|
||||
GetBattlerAbility(ally) == ABILITY_SYMBIOSIS \
|
||||
&& gBattleMons[battler].item == ITEM_NONE \
|
||||
&& gBattleMons[ally].item != ITEM_NONE \
|
||||
&& CanBattlerGetOrLoseItem(battler, gBattleMons[ally].item) \
|
||||
&& CanBattlerGetOrLoseItem(ally, gBattleMons[ally].item) \
|
||||
&& IsBattlerAlive(battler) \
|
||||
&& IsBattlerAlive(ally)
|
||||
static inline bool32 TryTriggerSymbiosis(u32 battler, u32 ally)
|
||||
{
|
||||
return GetBattlerAbility(ally) == ABILITY_SYMBIOSIS
|
||||
&& gBattleMons[battler].item == ITEM_NONE
|
||||
&& gBattleMons[ally].item != ITEM_NONE
|
||||
&& CanBattlerGetOrLoseItem(battler, gBattleMons[ally].item)
|
||||
&& CanBattlerGetOrLoseItem(ally, gBattleMons[ally].item)
|
||||
&& IsBattlerAlive(battler)
|
||||
&& IsBattlerAlive(ally);
|
||||
}
|
||||
|
||||
static u32 GetNextTarget(u32 moveTarget, bool32 excludeCurrent)
|
||||
{
|
||||
@ -7354,7 +7355,7 @@ static void Cmd_moveend(void)
|
||||
{
|
||||
if ((gSpecialStatuses[i].berryReduced
|
||||
|| (B_SYMBIOSIS_GEMS >= GEN_7 && gSpecialStatuses[i].gemBoost))
|
||||
&& SYMBIOSIS_CHECK(i, BATTLE_PARTNER(i)))
|
||||
&& TryTriggerSymbiosis(i, BATTLE_PARTNER(i)))
|
||||
{
|
||||
BestowItem(BATTLE_PARTNER(i), i);
|
||||
gLastUsedAbility = gBattleMons[BATTLE_PARTNER(i)].ability;
|
||||
@ -9108,7 +9109,7 @@ static bool32 TrySymbiosis(u32 battler, u32 itemId)
|
||||
&& (B_SYMBIOSIS_GEMS < GEN_7 || !(gSpecialStatuses[battler].gemBoost))
|
||||
&& gCurrentMove != MOVE_FLING //Fling and damage-reducing berries are handled separately.
|
||||
&& !gSpecialStatuses[battler].berryReduced
|
||||
&& SYMBIOSIS_CHECK(battler, BATTLE_PARTNER(battler)))
|
||||
&& TryTriggerSymbiosis(battler, BATTLE_PARTNER(battler)))
|
||||
{
|
||||
BestowItem(BATTLE_PARTNER(battler), battler);
|
||||
gLastUsedAbility = gBattleMons[BATTLE_PARTNER(battler)].ability;
|
||||
@ -17020,7 +17021,7 @@ void BS_TrySymbiosis(void)
|
||||
u32 battler = GetBattlerForBattleScript(cmd->battler);
|
||||
//called by Bestow, Fling, and Bug Bite, which don't work with Cmd_removeitem.
|
||||
u32 partner = BATTLE_PARTNER(battler);
|
||||
if (SYMBIOSIS_CHECK(battler, partner))
|
||||
if (TryTriggerSymbiosis(battler, partner))
|
||||
{
|
||||
BestowItem(partner, battler);
|
||||
gLastUsedAbility = gBattleMons[partner].ability;
|
||||
|
||||
@ -21,7 +21,7 @@ DOUBLE_BATTLE_TEST("Symbiosis transfers its item to an ally after it consumes an
|
||||
MESSAGE("Oranguru passed its Toxic Orb to Wobbuffet through Symbiosis!");
|
||||
// end of turn, wobb gets poisoned
|
||||
MESSAGE("Wobbuffet was badly poisoned!");
|
||||
STATUS_ICON(playerLeft, STATUS1_TOXIC_POISON);
|
||||
STATUS_ICON(playerLeft, STATUS1_TOXIC_POISON);
|
||||
} THEN {
|
||||
EXPECT_EQ(playerLeft->item, ITEM_TOXIC_ORB);
|
||||
EXPECT_EQ(playerRight->item, ITEM_NONE);
|
||||
@ -111,3 +111,24 @@ DOUBLE_BATTLE_TEST("Symbiosis triggers after partner flings its item")
|
||||
EXPECT_EQ(playerRight->item, ITEM_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
DOUBLE_BATTLE_TEST("Symbiosis transfers its item to an ally after it consumes a weakness berry")
|
||||
{
|
||||
GIVEN {
|
||||
ASSUME(gItemsInfo[ITEM_CHILAN_BERRY].holdEffect == HOLD_EFFECT_RESIST_BERRY);
|
||||
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_CHILAN_BERRY); }
|
||||
PLAYER(SPECIES_ORANGURU) { Ability(ABILITY_SYMBIOSIS); Item(ITEM_TOXIC_ORB); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(opponentLeft, MOVE_TACKLE, target: playerLeft); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, playerLeft);
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponentLeft);
|
||||
ABILITY_POPUP(playerRight, ABILITY_SYMBIOSIS);
|
||||
STATUS_ICON(playerLeft, STATUS1_TOXIC_POISON);
|
||||
} THEN {
|
||||
EXPECT_EQ(playerLeft->item, ITEM_TOXIC_ORB);
|
||||
EXPECT_EQ(playerRight->item, ITEM_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user