mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
AI: added support of TargetCard targeting in hand, graveyard, exile zones. Added additional checks for tests.
This commit is contained in:
parent
98b758e95e
commit
4d0761fa27
1 changed files with 21 additions and 5 deletions
|
@ -2314,6 +2314,8 @@ public class TestPlayer implements Player {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set<Zone> targetCardZonesChecked = new HashSet<>(); // control miss implementation
|
||||||
|
|
||||||
// player
|
// player
|
||||||
if (target.getOriginalTarget() instanceof TargetPlayer
|
if (target.getOriginalTarget() instanceof TargetPlayer
|
||||||
|| target.getOriginalTarget() instanceof TargetAnyTarget
|
|| target.getOriginalTarget() instanceof TargetAnyTarget
|
||||||
|
@ -2397,9 +2399,12 @@ public class TestPlayer implements Player {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// card in hand
|
// card in hand (only own hand supports here)
|
||||||
|
// TODO: add not own hand too, example
|
||||||
if (target.getOriginalTarget() instanceof TargetCardInHand
|
if (target.getOriginalTarget() instanceof TargetCardInHand
|
||||||
|| target.getOriginalTarget() instanceof TargetDiscard) {
|
|| target.getOriginalTarget() instanceof TargetDiscard
|
||||||
|
|| (target.getOriginalTarget() instanceof TargetCard && target.getOriginalTarget().getZone() == Zone.HAND)) {
|
||||||
|
targetCardZonesChecked.add(Zone.HAND);
|
||||||
for (String targetDefinition : targets) {
|
for (String targetDefinition : targets) {
|
||||||
checkTargetDefinitionMarksSupport(target, targetDefinition, "^");
|
checkTargetDefinitionMarksSupport(target, targetDefinition, "^");
|
||||||
String[] targetList = targetDefinition.split("\\^");
|
String[] targetList = targetDefinition.split("\\^");
|
||||||
|
@ -2424,8 +2429,9 @@ public class TestPlayer implements Player {
|
||||||
|
|
||||||
// card in exile
|
// card in exile
|
||||||
if (target.getOriginalTarget() instanceof TargetCardInExile
|
if (target.getOriginalTarget() instanceof TargetCardInExile
|
||||||
|| target.getOriginalTarget() instanceof TargetPermanentOrSuspendedCard) {
|
|| target.getOriginalTarget() instanceof TargetPermanentOrSuspendedCard
|
||||||
|
|| (target.getOriginalTarget() instanceof TargetCard && target.getOriginalTarget().getZone() == Zone.EXILED)) {
|
||||||
|
targetCardZonesChecked.add(Zone.EXILED);
|
||||||
FilterCard filter = null;
|
FilterCard filter = null;
|
||||||
if (target.getOriginalTarget().getFilter() instanceof FilterCard) {
|
if (target.getOriginalTarget().getFilter() instanceof FilterCard) {
|
||||||
filter = (FilterCard) target.getOriginalTarget().getFilter();
|
filter = (FilterCard) target.getOriginalTarget().getFilter();
|
||||||
|
@ -2488,7 +2494,9 @@ public class TestPlayer implements Player {
|
||||||
if (target.getOriginalTarget() instanceof TargetCardInOpponentsGraveyard
|
if (target.getOriginalTarget() instanceof TargetCardInOpponentsGraveyard
|
||||||
|| target.getOriginalTarget() instanceof TargetCardInYourGraveyard
|
|| target.getOriginalTarget() instanceof TargetCardInYourGraveyard
|
||||||
|| target.getOriginalTarget() instanceof TargetCardInGraveyard
|
|| target.getOriginalTarget() instanceof TargetCardInGraveyard
|
||||||
|| target.getOriginalTarget() instanceof TargetCardInGraveyardOrBattlefield) {
|
|| target.getOriginalTarget() instanceof TargetCardInGraveyardOrBattlefield
|
||||||
|
|| (target.getOriginalTarget() instanceof TargetCard && target.getOriginalTarget().getZone() == Zone.GRAVEYARD)) {
|
||||||
|
targetCardZonesChecked.add(Zone.GRAVEYARD);
|
||||||
TargetCard targetFull = (TargetCard) target.getOriginalTarget();
|
TargetCard targetFull = (TargetCard) target.getOriginalTarget();
|
||||||
|
|
||||||
List<UUID> needPlayers = game.getState().getPlayersInRange(getId(), game).toList();
|
List<UUID> needPlayers = game.getState().getPlayersInRange(getId(), game).toList();
|
||||||
|
@ -2560,6 +2568,14 @@ public class TestPlayer implements Player {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// uninplemented TargetCard's zone
|
||||||
|
if (target.getOriginalTarget() instanceof TargetCard && !targetCardZonesChecked.contains(target.getOriginalTarget().getZone())) {
|
||||||
|
Assert.fail("Found unimplemented TargetCard's zone or TargetCard's extented class: "
|
||||||
|
+ target.getOriginalTarget().getClass().getCanonicalName()
|
||||||
|
+ ", zone " + target.getOriginalTarget().getZone()
|
||||||
|
+ ", from " + (source == null ? "unknown source" : source.getSourceObject(game)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// wrong target settings by addTarget
|
// wrong target settings by addTarget
|
||||||
|
|
Loading…
Reference in a new issue