tests: added verify check for wrong target tags usage, improved work with tagged targets (related to 8b2a81cb42)

This commit is contained in:
Oleg Agafonov 2025-06-01 08:54:24 +04:00
parent 3223d99b2a
commit 71b0613355
4 changed files with 121 additions and 36 deletions

View file

@ -43,6 +43,7 @@ import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.custom.CreatureToken;
import mage.game.permanent.token.custom.XmageToken;
import mage.sets.TherosBeyondDeath;
import mage.target.Target;
import mage.target.targetpointer.TargetPointer;
import mage.tournament.cubes.CubeFromDeck;
import mage.util.CardUtil;
@ -2279,6 +2280,19 @@ public class VerifyCardDataTest {
}
});
// special check: target tags must be used for all targets and starts with 1
card.getAbilities().stream().filter(a -> a.getTargets().size() >= 2).forEach(a -> {
Set<Integer> tags = a.getTargets().stream().map(Target::getTargetTag).collect(Collectors.toSet());
if (tags.size() == 1 && tags.stream().findFirst().get().equals(0)) {
// no tags usage
return;
}
if (tags.size() != a.getTargets().size() || (tags.size() > 1 && tags.contains(0))) {
// how-to fix: make sure each target has it's own target tag like 1 and 2 (don't use 0 because it's default)
fail(card, "abilities", "wrong target tags: miss tag in one of the targets, current list: " + tags);
}
});
// spells have only 1 ability
if (card.isInstantOrSorcery()) {
return;