Fix potential issue when destiny knot fail after proccing from cute charm (#8459)

This commit is contained in:
FosterProgramming 2025-12-07 18:35:39 +01:00 committed by GitHub
parent 22dcef88c2
commit 86ba8c3191
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 1 deletions

View File

@ -3526,10 +3526,15 @@ BattleScript_TryDestinyKnotTarget:
playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT
waitanimation
printstring STRINGID_DESTINYKNOTACTIVATES
tryinfatuating BattleScript_ButItFailed
tryinfatuating BattleScript_TryDestinyKnotTargetFailed
volatileanimation BS_TARGET, VOLATILE_INFATUATION
waitanimation
waitmessage B_WAIT_TIME_LONG
goto BattleScript_TryDestinyKnotTargetRet
BattleScript_TryDestinyKnotTargetFailed:
pause B_WAIT_TIME_SHORT
printstring STRINGID_BUTITFAILED
waitmessage B_WAIT_TIME_LONG
BattleScript_TryDestinyKnotTargetRet:
return

View File

@ -64,3 +64,17 @@ SINGLE_BATTLE_TEST("Destiny Knot procs but fails if the target is oblivious")
EXPECT(!player->volatiles.infatuation);
}
}
SINGLE_BATTLE_TEST("Destiny Knot procs but fails if the target is already infatuated (cute charm)")
{
GIVEN {
PLAYER(SPECIES_CLEFAIRY) { Gender(MON_MALE); Ability(ABILITY_CUTE_CHARM);}
OPPONENT(SPECIES_WOBBUFFET) { Gender(MON_FEMALE); Item(ITEM_DESTINY_KNOT); }
} WHEN {
TURN { MOVE(opponent, MOVE_ATTRACT);}
TURN { MOVE(opponent, MOVE_TACKLE);}
} SCENE {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
MESSAGE("But it failed!");
}
}