[WOE] Implement The End (without breaking morph tests this time) (#11041)

* [WOE] Implement The End

* add cost reduction

* apply review

* fix tests looking for morphs
This commit is contained in:
Susucre 2023-08-27 01:34:21 +02:00 committed by GitHub
parent e39e5ee1b0
commit c4e48a6f95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 101 additions and 5 deletions

View file

@ -60,11 +60,11 @@ public abstract class SearchTargetGraveyardHandLibraryForCardNameAndExileEffect
if (cardName != null && controller != null) {
Player targetPlayer = game.getPlayer(targetPlayerId);
if (targetPlayer != null) {
FilterCard filter = new FilterCard("card named " + cardName);
FilterCard filter = new FilterCard("card named \"" + cardName + "\"");
filter.add(new NamePredicate(cardName));
// cards in Graveyard
int cardsCount = (cardName.isEmpty() ? 0 : targetPlayer.getGraveyard().count(filter, game));
int cardsCount = targetPlayer.getGraveyard().count(filter, game);
if (cardsCount > 0) {
filter.setMessage("card named " + cardName + " in the graveyard of " + targetPlayer.getName());
TargetCard target = new TargetCard((graveyardExileOptional ? 0 : cardsCount), cardsCount, Zone.GRAVEYARD, filter);
@ -74,7 +74,7 @@ public abstract class SearchTargetGraveyardHandLibraryForCardNameAndExileEffect
}
// cards in Hand
cardsCount = (cardName.isEmpty() ? 0 : targetPlayer.getHand().count(filter, game));
cardsCount = targetPlayer.getHand().count(filter, game);
filter.setMessage("card named " + cardName + " in the hand of " + targetPlayer.getName());
TargetCard target = new TargetCard(0, cardsCount, Zone.HAND, filter);
if (controller.choose(Outcome.Exile, targetPlayer.getHand(), target, source, game)) {
@ -84,7 +84,7 @@ public abstract class SearchTargetGraveyardHandLibraryForCardNameAndExileEffect
// cards in Library
Cards cardsInLibrary = new CardsImpl();
cardsInLibrary.addAllCards(targetPlayer.getLibrary().getCards(game));
cardsCount = (cardName.isEmpty() ? 0 : cardsInLibrary.count(filter, game));
cardsCount = cardsInLibrary.count(filter, game);
filter.setMessage("card named " + cardName + " in the library of " + targetPlayer.getLogName());
TargetCardInLibrary targetLib = new TargetCardInLibrary(0, cardsCount, filter);
if (controller.choose(Outcome.Exile, cardsInLibrary, targetLib, source, game)) {

View file

@ -28,7 +28,7 @@ public class NamePredicate implements Predicate<MageObject> {
@Override
public boolean apply(MageObject input, Game game) {
if (name == null) {
if (name == null || (name.isEmpty() && !this.ignoreMtgRuleForEmptyNames)) {
return false;
}
// If a player names a card, the player may name either half of a split card, but not both.