Refactor: improved choose cards method to use source param (fixed NPE like #10233, #9974 and other bugs with choose cards)

This commit is contained in:
Oleg Agafonov 2023-04-21 11:02:57 +04:00
parent 5474787641
commit 689b93d005
280 changed files with 341 additions and 342 deletions

View file

@ -67,7 +67,7 @@ class AethermagesTouchEffect extends OneShotEffect {
FilterCreatureCard filter = new FilterCreatureCard("a creature card to put onto the battlefield");
controller.revealCards(sourceObject.getIdName(), cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, filter);
if (cards.count(filter, game) > 0 && controller.choose(outcome, cards, target, game)) {
if (cards.count(filter, game) > 0 && controller.choose(outcome, cards, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
cards.remove(card);

View file

@ -110,7 +110,7 @@ class AetherspoutsEffect extends OneShotEffect {
if (!player.canRespond()) {
return false;
}
player.choose(Outcome.Neutral, cards, target, game);
player.choose(Outcome.Neutral, cards, target, source, game);
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
cards.remove(card);
@ -147,7 +147,7 @@ class AetherspoutsEffect extends OneShotEffect {
}
target = new TargetCard(Zone.BATTLEFIELD, new FilterCard("order to put on bottom of library (last chosen will be bottommost card)"));
while (player.canRespond() && cards.size() > 1) {
player.choose(Outcome.Neutral, cards, target, game);
player.choose(Outcome.Neutral, cards, target, source, game);
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {

View file

@ -72,7 +72,7 @@ class AgonizingMemoriesEffect extends OneShotEffect {
private void chooseCardInHandAndPutOnTopOfLibrary(Game game, Ability source, Player you, Player targetPlayer) {
if (!targetPlayer.getHand().isEmpty()) {
TargetCard target = new TargetCard(Zone.HAND, new FilterCard("card to put on the top of library (last chosen will be on top)"));
if (you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) {
if (you.choose(Outcome.Benefit, targetPlayer.getHand(), target, source, game)) {
Card card = targetPlayer.getHand().get(target.getFirstTarget(), game);
if (card != null) {
targetPlayer.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, false);

View file

@ -81,7 +81,7 @@ class AgonizingRemorseEffect extends OneShotEffect {
target.setNotTarget(true);
cards = opponent.getGraveyard();
}
if (controller.choose(outcome, cards, target, game)) {
if (controller.choose(outcome, cards, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
controller.moveCards(card, Zone.EXILED, source, game);

View file

@ -70,7 +70,7 @@ class AladdinsLampEffect extends ReplacementEffectImpl {
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, source.getManaCostsToPay().getX()));
controller.lookAtCards(source, null, cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to stay at the top of library"));
if (controller.choose(outcome, cards, target, game)) {
if (controller.choose(outcome, cards, target, source, game)) {
cards.remove(target.getFirstTarget());
}
controller.putCardsOnBottomOfLibrary(cards, game, source, false);

View file

@ -77,7 +77,7 @@ class AllureOfTheUnknownEffect extends OneShotEffect {
return false;
}
TargetCard targetCard = new TargetCardInLibrary(StaticFilters.FILTER_CARD_A_NON_LAND);
opponent.choose(Outcome.Exile, cards, targetCard, game);
opponent.choose(Outcome.Exile, cards, targetCard, source, game);
Card card = game.getCard(targetCard.getFirstTarget());
if (player.moveCards(card, Zone.EXILED, source, game)
&& card != null

View file

@ -68,7 +68,7 @@ class AmassTheComponentsEffect extends OneShotEffect {
FilterCard filter = new FilterCard("card from your hand to put on the bottom of your library");
TargetCard target = new TargetCard(Zone.HAND, filter);
if (player.choose(Outcome.Detriment, player.getHand(), target, game)) {
if (player.choose(Outcome.Detriment, player.getHand(), target, source, game)) {
Card card = player.getHand().get(target.getFirstTarget(), game);
if (card != null) {
return player.putCardsOnBottomOfLibrary(card, game, source, true);

View file

@ -102,7 +102,7 @@ class AminatousAuguryEffect extends OneShotEffect {
if (cardsToCast.count(StaticFilters.FILTER_CARD_LAND, game) > 0) {
if (controller.chooseUse(Outcome.PutLandInPlay, "Put a land from among the exiled cards into play?", source, game)) {
if (controller.choose(Outcome.PutLandInPlay, cardsToCast, target, game)) {
if (controller.choose(Outcome.PutLandInPlay, cardsToCast, target, source, game)) {
Card card = cardsToCast.get(target.getFirstTarget(), game);
if (card != null) {
cardsToCast.remove(card);

View file

@ -71,7 +71,7 @@ class AncestralKnowledgeEffect extends OneShotEffect {
if (!cards.isEmpty()) {
controller.lookAtCards(source, null, cards, game);
TargetCard target = new TargetCard(0, Integer.MAX_VALUE, Zone.LIBRARY, new FilterCard("cards to exile"));
controller.choose(Outcome.Exile, cards, target, game);
controller.choose(Outcome.Exile, cards, target, source, game);
Cards toExile = new CardsImpl(target.getTargets());
controller.moveCards(toExile, Zone.EXILED, source, game);
cards.removeAll(toExile);

View file

@ -100,7 +100,7 @@ class AoTheDawnSkyEffect extends OneShotEffect {
}
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 7));
TargetCard target = new AoTheDawnSkyTarget();
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game);
cards.retainZone(Zone.LIBRARY, game);
player.putCardsOnBottomOfLibrary(cards, game, source, false);

View file

@ -98,7 +98,7 @@ class ArachnusSpinnerEffect extends OneShotEffect {
Card card = null;
if (controller.chooseUse(Outcome.Neutral, "Search your graveyard for Arachnus Web?", source, game)) {
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filter);
if (controller.choose(Outcome.PutCardInPlay, controller.getGraveyard(), target, game)) {
if (controller.choose(Outcome.PutCardInPlay, controller.getGraveyard(), target, source, game)) {
card = game.getCard(target.getFirstTarget());
}
}

View file

@ -87,7 +87,7 @@ class ArmoredSkyhunterEffect extends OneShotEffect {
}
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 6));
TargetCardInLibrary targetCard = new TargetCardInLibrary(0, 1, filter);
player.choose(outcome, cards, targetCard, game);
player.choose(outcome, cards, targetCard, source, game);
Card card = game.getCard(targetCard.getFirstTarget());
if (card == null) {
return player.putCardsOnBottomOfLibrary(cards, game, source, false);

View file

@ -86,7 +86,7 @@ class AshiokNightmareMuseBounceEffect extends OneShotEffect {
return true;
}
TargetCardInHand target = new TargetCardInHand();
if (!player.choose(outcome, player.getHand(), target, game)) {
if (!player.choose(outcome, player.getHand(), target, source, game)) {
return false;
}
return player.moveCards(game.getCard(target.getFirstTarget()), Zone.EXILED, source, game);

View file

@ -72,7 +72,7 @@ class AshnodsCylixEffect extends OneShotEffect {
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 3));
player.lookAtCards(source, null, cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put on top of your library"));
if (player.choose(Outcome.Benefit, cards, target, game)) {
if (player.choose(Outcome.Benefit, cards, target, source, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
cards.remove(card);

View file

@ -87,7 +87,7 @@ class AtraxaGrandUnifierEffect extends OneShotEffect {
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 10));
player.revealCards(source, cards, game);
TargetCard target = new AtraxaGrandUnifierTarget();
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
Cards toHand = new CardsImpl(target.getTargets());
player.moveCardsToHandWithInfo(toHand, source, game, true);
cards.retainZone(Zone.LIBRARY, game);

View file

@ -83,7 +83,7 @@ class AtrisOracleOfHalfTruthsEffect extends OneShotEffect {
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 3));
TargetCard target = new TargetCard(0, Integer.MAX_VALUE, Zone.LIBRARY, filter);
targetOpponent.choose(outcome, cards, target, game);
targetOpponent.choose(outcome, cards, target, source, game);
Cards faceDownPile = new CardsImpl(target.getTargets());
cards.removeAll(target.getTargets());
controller.revealCards(sourceObject.getIdName() + " - cards in face-up pile", cards, game);

View file

@ -88,7 +88,7 @@ class AuthorOfShadowsEffect extends OneShotEffect {
TargetCard target = new TargetCardInExile(StaticFilters.FILTER_CARD_A_NON_LAND);
target.setNotTarget(true);
controller.choose(outcome, cards, target, game);
controller.choose(outcome, cards, target, source, game);
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
return true;

View file

@ -78,7 +78,7 @@ class BalshanBeguilerEffect extends OneShotEffect {
}
player.revealCards(source, cards, game);
TargetCard target = new TargetCardInLibrary();
if (you.choose(Outcome.Benefit, cards, target, game)) {
if (you.choose(Outcome.Benefit, cards, target, source, game)) {
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
you.moveCards(card, Zone.GRAVEYARD, source, game);
}

View file

@ -69,7 +69,7 @@ class BamboozleEffect extends OneShotEffect {
}
targetPlayer.revealCards("Bamboozle Reveal", putOnTopLibrary, game);
TargetCard target = new TargetCard(2, Zone.LIBRARY, new FilterCard("2 cards out of this stack to put into their graveyard"));
if (controller.choose(Outcome.Discard, putOnTopLibrary, target, game)) {
if (controller.choose(Outcome.Discard, putOnTopLibrary, target, source, game)) {
for (UUID cardId : target.getTargets()) {
putInGraveyard.add(game.getCard(cardId));
putOnTopLibrary.remove(game.getCard(cardId));

View file

@ -76,14 +76,14 @@ class BloodForBonesEffect extends OneShotEffect {
return false;
}
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filter);
if (player.choose(outcome, player.getGraveyard(), target, game)) {
if (player.choose(outcome, player.getGraveyard(), target, source, game)) {
player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game);
}
if (player.getGraveyard().getCards(game).stream().noneMatch(card -> card.isCreature(game))) {
return true;
}
target = new TargetCardInYourGraveyard(filter2);
if (player.choose(outcome, player.getGraveyard(), target, game)) {
if (player.choose(outcome, player.getGraveyard(), target, source, game)) {
player.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game);
}
return true;

View file

@ -84,7 +84,7 @@ class BoneyardParleyEffect extends OneShotEffect {
if (opponent != null) {
TargetCard targetCards = new TargetCard(0, cards.size(), Zone.EXILED, new FilterCard("cards to put in the first pile"));
List<Card> pile1 = new ArrayList<>();
if (opponent.choose(Outcome.Neutral, cards, targetCards, game)) {
if (opponent.choose(Outcome.Neutral, cards, targetCards, source, game)) {
List<UUID> targets = targetCards.getTargets();
for (UUID targetId : targets) {
Card card = cards.get(targetId, game);

View file

@ -84,7 +84,7 @@ class BoonweaverGiantEffect extends OneShotEffect {
// Choose card from graveyard
if (controller.chooseUse(Outcome.Neutral, "Search your graveyard for an Aura card?", source, game)) {
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filter);
if (controller.choose(Outcome.PutCardInPlay, controller.getGraveyard(), target, game)) {
if (controller.choose(Outcome.PutCardInPlay, controller.getGraveyard(), target, source, game)) {
card = game.getCard(target.getFirstTarget());
}
}
@ -92,7 +92,7 @@ class BoonweaverGiantEffect extends OneShotEffect {
// Choose card from your hand
if (card == null && controller.chooseUse(Outcome.Neutral, "Search your Hand for an Aura card?", source, game)) {
TargetCardInHand target = new TargetCardInHand(filter);
if (controller.choose(Outcome.PutCardInPlay, controller.getHand(), target, game)) {
if (controller.choose(Outcome.PutCardInPlay, controller.getHand(), target, source, game)) {
card = game.getCard(target.getFirstTarget());
}
}

View file

@ -91,7 +91,7 @@ class BoosterTutorEffect extends OneShotEffect {
game.loadCards(cardsToLoad, controller.getId());
CardsImpl cards = new CardsImpl();
cards.addAll(boosterPack);
if (controller.choose(Outcome.Benefit, cards, targetCard, game)) {
if (controller.choose(Outcome.Benefit, cards, targetCard, source, game)) {
Card card = game.getCard(targetCard.getFirstTarget());
if (card != null) {
controller.moveCards(card, Zone.HAND, source, game);

View file

@ -122,7 +122,7 @@ class BoreasChargerEffect extends OneShotEffect {
}
TargetCard target3 = new TargetCard(Zone.LIBRARY, filter3);
Card cardToBattlefield = null;
if (controller.choose(outcome, cardsToHand, target3, game)) {
if (controller.choose(outcome, cardsToHand, target3, source, game)) {
cardToBattlefield = cardsToHand.get(target2.getFirstTarget(), game);
cardsToHand.remove(cardToBattlefield);
}

View file

@ -71,7 +71,7 @@ class BountyOfSkemfarEffect extends OneShotEffect {
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 6));
player.revealCards(source, cards, game);
TargetCard target = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_LAND);
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
Card land = cards.get(target.getFirstTarget(), game);
if (land != null) {
player.moveCards(
@ -81,7 +81,7 @@ class BountyOfSkemfarEffect extends OneShotEffect {
}
cards.removeIf(uuid -> game.getState().getZone(uuid) != Zone.LIBRARY);
target = new TargetCardInLibrary(0, 1, filter);
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
Card elf = cards.get(target.getFirstTarget(), game);
if (elf != null) {
player.moveCardToHandWithInfo(elf, source, game, true);

View file

@ -82,7 +82,7 @@ class BrainMaggotExileEffect extends OneShotEffect {
FilterCard filter = new FilterNonlandCard("nonland card to exile");
TargetCard target = new TargetCard(Zone.HAND, filter);
if (opponent.getHand().count(filter, game) > 0 && controller.choose(Outcome.Exile, opponent.getHand(), target, game)) {
if (opponent.getHand().count(filter, game) > 0 && controller.choose(Outcome.Exile, opponent.getHand(), target, source, game)) {
Card card = opponent.getHand().get(target.getFirstTarget(), game);
// If source permanent leaves the battlefield before its triggered ability resolves, the target card won't be exiled.
if (card != null && game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) {

View file

@ -87,7 +87,7 @@ class BreachTheMultiverseEffect extends OneShotEffect {
}
target.clearChosen();
target.withChooseHint("from " + player.getName() + "'s graveyard");
controller.choose(Outcome.PutCreatureInPlay, player.getGraveyard(), target, game);
controller.choose(Outcome.PutCreatureInPlay, player.getGraveyard(), target, source, game);
cards.add(target.getFirstTarget());
}
return controller.moveCards(cards, Zone.BATTLEFIELD, source, game);

View file

@ -77,7 +77,7 @@ class BrilliantUltimatumEffect extends OneShotEffect {
Cards pile1 = new CardsImpl();
List<Card> pileOne = new ArrayList<>();
List<Card> pileTwo = new ArrayList<>();
if (opponent.choose(Outcome.Neutral, pile2, target, game)) {
if (opponent.choose(Outcome.Neutral, pile2, target, source, game)) {
List<UUID> targets = target.getTargets();
for (UUID targetId : targets) {
Card card = pile2.get(targetId, game);

View file

@ -63,7 +63,7 @@ class BrowseEffect extends OneShotEffect {
if (!cards.isEmpty()) {
controller.lookAtCards(source, null, cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put in your hand"));
if (controller.choose(Outcome.Benefit, cards, target, game)) {
if (controller.choose(Outcome.Benefit, cards, target, source, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
controller.moveCards(card, Zone.HAND, source, game);

View file

@ -121,7 +121,7 @@ class BrunaLightOfAlabasterEffect extends OneShotEffect {
&& countHand > 0
&& controller.chooseUse(Outcome.Benefit, "Attach an Aura from your hand?", source, game)) {
TargetCard targetAura = new TargetCard(Zone.HAND, filterAuraCard);
if (!controller.choose(Outcome.Benefit, controller.getHand(), targetAura, game)) { continue; }
if (!controller.choose(Outcome.Benefit, controller.getHand(), targetAura, source, game)) { continue; }
Card aura = game.getCard(targetAura.getFirstTarget());
if (aura == null) { continue; }
@ -139,7 +139,7 @@ class BrunaLightOfAlabasterEffect extends OneShotEffect {
&& countGraveyard > 0
&& controller.chooseUse(Outcome.Benefit, "Attach an Aura from your graveyard?", source, game)) {
TargetCard targetAura = new TargetCard(Zone.GRAVEYARD, filterAuraCard);
if (!controller.choose(Outcome.Benefit, controller.getGraveyard(), targetAura, game)) { continue; }
if (!controller.choose(Outcome.Benefit, controller.getGraveyard(), targetAura, source, game)) { continue; }
Card aura = game.getCard(targetAura.getFirstTarget());
if (aura == null) { continue; }

View file

@ -92,7 +92,7 @@ class CallToTheKindredEffect extends OneShotEffect {
if (cards.count(filter, game) > 0) {
TargetCard target = new TargetCardInLibrary(0, 1, filter);
controller.choose(Outcome.PutCreatureInPlay, cards, target, game);
controller.choose(Outcome.PutCreatureInPlay, cards, target, source, game);
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
cards.remove(card);

View file

@ -84,7 +84,7 @@ class CapriciousHellraiserEffect extends OneShotEffect {
controller.moveCards(toExile, Zone.EXILED, source, game);
if (cardsToChooseFrom.size() > 0) {
TargetCard targetCard = new TargetCard(1, Zone.EXILED, StaticFilters.FILTER_CARD);
controller.choose(Outcome.Copy, cardsToChooseFrom, targetCard, game);
controller.choose(Outcome.Copy, cardsToChooseFrom, targetCard, source, game);
Card cardToCopy = game.getCard(targetCard.getTargets().get(0));
if (cardToCopy == null) {
return true;

View file

@ -76,7 +76,7 @@ class CauldronsGiftEffect extends OneShotEffect {
}
TargetCard target = new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD);
target.setNotTarget(true);
if (!player.choose(outcome, player.getGraveyard(), target, game)) {
if (!player.choose(outcome, player.getGraveyard(), target, source, game)) {
return false;
}
Card card = game.getCard(target.getFirstTarget());

View file

@ -70,7 +70,7 @@ class CheckForTrapsEffect extends OneShotEffect {
TargetCard target = new TargetCard(Zone.HAND, StaticFilters.FILTER_CARD_NON_LAND);
target.setNotTarget(true);
boolean opponentLoseLife = false;
if (controller.choose(outcome, opponent.getHand(), target, game)) {
if (controller.choose(outcome, opponent.getHand(), target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
controller.moveCards(card, Zone.EXILED, source, game);

View file

@ -83,7 +83,7 @@ class ChromeCourierEffect extends OneShotEffect {
default:
TargetCard target = new TargetCardInLibrary();
target.withChooseHint("to hand");
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
card = cards.get(target.getFirstTarget(), game);
}
player.moveCards(card, Zone.HAND, source, game);

View file

@ -94,7 +94,7 @@ class CitystalkerConnoisseurEffect extends OneShotEffect {
return true;
}
TargetCardInHand target = new TargetCardInHand();
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
player.discard(cards.get(target.getFirstTarget(), game), false, source, game);
return true;
}

View file

@ -69,7 +69,7 @@ class CloneShellEffect extends OneShotEffect {
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 4));
if (!cards.isEmpty()) {
TargetCard target1 = new TargetCard(Zone.LIBRARY, filter1);
if (controller.choose(Outcome.Benefit, cards, target1, game)) {
if (controller.choose(Outcome.Benefit, cards, target1, source, game)) {
Card card = cards.get(target1.getFirstTarget(), game);
if (card != null) {
cards.remove(card);

View file

@ -77,7 +77,7 @@ class CongregationAtDawnEffect extends OneShotEffect {
TargetCard targetToLib = new TargetCard(Zone.LIBRARY, new FilterCard(textTop));
while (revealed.size() > 1 && controller.canRespond()) {
controller.choose(Outcome.Neutral, revealed, targetToLib, game);
controller.choose(Outcome.Neutral, revealed, targetToLib, source, game);
Card card = revealed.get(targetToLib.getFirstTarget(), game);
if (card != null) {
revealed.remove(card);

View file

@ -123,7 +123,7 @@ class ConspiracyTheoristEffect extends OneShotEffect {
boolean validTarget = cards.stream()
.anyMatch(card -> target.canTarget(card, game));
if (validTarget && controller.chooseUse(Outcome.Benefit, "Exile a card?", source, game)) {
if (controller.choose(Outcome.Benefit, cards, target, game)) {
if (controller.choose(Outcome.Benefit, cards, target, source, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null && controller.moveCards(card, Zone.EXILED, source, game)) {
// you may cast it this turn

View file

@ -73,7 +73,7 @@ class ContagiousVorracEffect extends OneShotEffect {
}
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 4));
TargetCard target = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_LAND);
player.choose(Outcome.DrawCard, cards, target, game);
player.choose(Outcome.DrawCard, cards, target, source, game);
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
player.revealCards(source, new CardsImpl(card), game);

View file

@ -83,7 +83,7 @@ class CorpseAppraiserEffect extends OneShotEffect {
return true;
}
TargetCard target = new TargetCardInLibrary();
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
player.moveCards(cards.get(target.getFirstTarget(), game), Zone.HAND, source, game);
cards.retainZone(Zone.LIBRARY, game);
player.moveCards(cards, Zone.GRAVEYARD, source, game);

View file

@ -76,10 +76,10 @@ class CovetousUrgeEffect extends OneShotEffect {
return true;
}
target = new TargetCard(Zone.HAND, StaticFilters.FILTER_CARD_A_NON_LAND);
controller.choose(Outcome.Exile, player.getHand(), target, game);
controller.choose(Outcome.Exile, player.getHand(), target, source, game);
} else {
target = new TargetCard(Zone.GRAVEYARD, StaticFilters.FILTER_CARD_A_NON_LAND);
controller.choose(Outcome.Exile, player.getGraveyard(), target, game);
controller.choose(Outcome.Exile, player.getGraveyard(), target, source, game);
}
// use same player's zone for all Covetous Urge instances

View file

@ -76,7 +76,7 @@ class CreepingDreadEffect extends OneShotEffect {
if(!controller.getHand().isEmpty()) {
TargetCard controllerTarget = new TargetCard(Zone.HAND, new FilterCard());
if(controller.choose(Outcome.Discard, controller.getHand(), controllerTarget, game)) {
if(controller.choose(Outcome.Discard, controller.getHand(), controllerTarget, source, game)) {
Card card = controller.getHand().get(controllerTarget.getFirstTarget(), game);
if (card != null) {
typesChosen = new HashSet<>(card.getCardType(game));
@ -91,7 +91,7 @@ class CreepingDreadEffect extends OneShotEffect {
// opponent discards a card - if it is same card type as controller, add to opponentsAffected
if(opponent != null && !opponent.getHand().isEmpty()) {
TargetCard target = new TargetCard(Zone.HAND, new FilterCard());
if(opponent.choose(Outcome.Discard, opponent.getHand(), target, game)) {
if(opponent.choose(Outcome.Discard, opponent.getHand(), target, source, game)) {
Card card = opponent.getHand().get(target.getFirstTarget(), game);
if (card != null) {
if (!typesChosen.isEmpty()) {

View file

@ -69,7 +69,7 @@ class CruelFateEffect extends OneShotEffect {
return controller.moveCards(cards, Zone.GRAVEYARD, source, game);
}
TargetCard targetCard = new TargetCardInLibrary();
controller.choose(outcome, cards, targetCard, game);
controller.choose(outcome, cards, targetCard, source, game);
Card card = game.getCard(targetCard.getFirstTarget());
if (card != null) {
controller.moveCards(card, Zone.GRAVEYARD, source, game);

View file

@ -74,7 +74,7 @@ class CultivateEffect extends OneShotEffect {
controller.revealCards(sourceObject.getIdName(), revealed, game);
if (target.getTargets().size() == 2) {
TargetCard target2 = new TargetCard(Zone.LIBRARY, filter);
controller.choose(Outcome.Benefit, revealed, target2, game);
controller.choose(Outcome.Benefit, revealed, target2, source, game);
Card card = revealed.get(target2.getFirstTarget(), game);
if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);

View file

@ -75,7 +75,7 @@ class CunningAbductionExileEffect extends OneShotEffect {
Card card = null;
if (cardsHand > 0) {
TargetCard target = new TargetCard(Zone.HAND, filter);
if (controller.choose(Outcome.Benefit, opponent.getHand(), target, game)) {
if (controller.choose(Outcome.Benefit, opponent.getHand(), target, source, game)) {
card = opponent.getHand().get(target.getFirstTarget(), game);
}
}

View file

@ -117,7 +117,7 @@ class CurrencyConverterTokenEffect extends OneShotEffect {
Card card;
if (exileZone.size() > 1) {
TargetCard target = new TargetCardInExile(StaticFilters.FILTER_CARD);
player.choose(outcome, exileZone, target, game);
player.choose(outcome, exileZone, target, source, game);
card = exileZone.get(target.getFirstTarget(), game);
} else {
card = exileZone.getRandom(game);

View file

@ -111,7 +111,7 @@ class CustodiSquireVote extends VoteHandler<Card> {
TargetCardInGraveyard target = new TargetCardInGraveyard(filter);
target.withChooseHint(voteInfo + " (from graveyard to hand)");
target.setNotTarget(true);
decidingPlayer.choose(Outcome.ReturnToHand, controller.getGraveyard(), target, game);
decidingPlayer.choose(Outcome.ReturnToHand, controller.getGraveyard(), target, source, game);
return controller.getGraveyard().get(target.getFirstTarget(), game);
}

View file

@ -89,7 +89,7 @@ class DarkSupplicantEffect extends OneShotEffect {
// Graveyard check
if (controller.chooseUse(Outcome.Benefit, "Search your graveyard for Scion of Darkness?", source, game)) {
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(1, 1, filter, true);
if (controller.choose(outcome, controller.getGraveyard(), target, game)) {
if (controller.choose(outcome, controller.getGraveyard(), target, source, game)) {
selectedCard = game.getCard(target.getFirstTarget());
}
}
@ -97,7 +97,7 @@ class DarkSupplicantEffect extends OneShotEffect {
if (selectedCard == null
&& controller.chooseUse(Outcome.Benefit, "Search your hand for Scion of Darkness?", source, game)) {
TargetCardInHand target = new TargetCardInHand(0, 1, filter);
if (controller.choose(Outcome.PutCardInPlay, controller.getHand(), target, game)) {
if (controller.choose(Outcome.PutCardInPlay, controller.getHand(), target, source, game)) {
if (!target.getTargets().isEmpty()) {
selectedCard = game.getCard(target.getFirstTarget());
}

View file

@ -109,7 +109,7 @@ class DeadlyBrewEffect extends OneShotEffect {
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(
0, 1, StaticFilters.FILTER_CARD_PERMANENT, true
);
controller.choose(outcome, yourGrave, target, game);
controller.choose(outcome, yourGrave, target, source, game);
Card card = controller.getGraveyard().get(target.getFirstTarget(), game);
if (card != null) {
controller.moveCards(card, Zone.HAND, source, game);

View file

@ -63,7 +63,7 @@ class DeathOrGloryEffect extends OneShotEffect {
if (!cards.isEmpty()) {
TargetCard targetCards = new TargetCard(0, cards.size(), Zone.GRAVEYARD, new FilterCard("cards to put in the first pile"));
List<Card> pile1 = new ArrayList<>();
if (controller.choose(Outcome.Neutral, cards, targetCards, game)) {
if (controller.choose(Outcome.Neutral, cards, targetCards, source, game)) {
List<UUID> targets = targetCards.getTargets();
for (UUID targetId : targets) {
Card card = cards.get(targetId, game);

View file

@ -130,7 +130,7 @@ class DeathsOasisEffect extends OneShotEffect {
}
TargetCard target = new TargetCardInYourGraveyard(filter);
target.setNotTarget(true);
if (!player.choose(outcome, player.getGraveyard(), target, game)) {
if (!player.choose(outcome, player.getGraveyard(), target, source, game)) {
return false;
}
return player.moveCards(game.getCard(target.getFirstTarget()), Zone.HAND, source, game);

View file

@ -93,7 +93,7 @@ class DeliverUntoEvilEffect extends OneShotEffect {
return false;
}
TargetCard targetCard = new TargetCardInGraveyard(Math.min(2, cards.size()), filter2);
if (!opponent.choose(outcome, cards, targetCard, game)) {
if (!opponent.choose(outcome, cards, targetCard, source, game)) {
return false;
}
cards.removeAll(targetCard.getTargets());

View file

@ -175,7 +175,7 @@ class DescentIntoMadnessEffect extends OneShotEffect {
}
filterInHand.add(Predicates.not(Predicates.or(uuidPredicates)));
if (targetInHand.canChoose(player.getId(), source, game) &&
player.choose(Outcome.Exile, player.getHand(), targetInHand, game)) {
player.choose(Outcome.Exile, player.getHand(), targetInHand, source, game)) {
Card card = player.getHand().get(targetInHand.getFirstTarget(), game);
if (card != null) {

View file

@ -86,7 +86,7 @@ class DesecratorHagEffect extends OneShotEffect {
return true;
}
if (cards.size() > 1
&& you.choose(Outcome.DrawCard, cards, target, game)) {
&& you.choose(Outcome.DrawCard, cards, target, source, game)) {
if (target != null) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {

View file

@ -164,7 +164,7 @@ class DimensionalBreachReturnEffect extends OneShotEffect {
if (cards.size() > 1) {
TargetCard target = new TargetCardInExile(StaticFilters.FILTER_CARD);
target.setNotTarget(true);
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
cards.clear();
cards.add(target.getFirstTarget());
}

View file

@ -71,7 +71,7 @@ class DimirMachinationsEffect extends OneShotEffect {
if (!cards.isEmpty()) {
controller.lookAtCards(source, null, cards, game);
TargetCard targetExile = new TargetCard(0, Integer.MAX_VALUE, Zone.LIBRARY, new FilterCard("cards to exile"));
if (controller.choose(Outcome.Exile, cards, targetExile, game)) {
if (controller.choose(Outcome.Exile, cards, targetExile, source, game)) {
Cards toExile = new CardsImpl(targetExile.getTargets());
controller.moveCards(toExile, Zone.EXILED, source, game);
cards.removeAll(toExile);

View file

@ -83,7 +83,7 @@ class DiscordantDirgeEffect extends OneShotEffect {
controller.lookAtCards(targetOpponent.getName() + " hand", targetOpponent.getHand(), game);
TargetCard target = new TargetCard(0, verseCounters, Zone.HAND, new FilterCard());
target.setNotTarget(true);
if (!controller.choose(Outcome.Benefit, targetOpponent.getHand(), target, game)) {
if (!controller.choose(Outcome.Benefit, targetOpponent.getHand(), target, source, game)) {
return false;
}
targetOpponent.discard(new CardsImpl(target.getTargets()), false, source, game);

View file

@ -76,7 +76,7 @@ class DiscoverTheImpossibleEffect extends OneShotEffect {
return false;
}
TargetCard target = new TargetCardInLibrary();
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
player.putCardsOnBottomOfLibrary(card, game, source, false);

View file

@ -94,7 +94,7 @@ class DjeruAndHazoretEffect extends OneShotEffect {
}
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 6));
TargetCard target = new TargetCardInLibrary(0, 1, filter);
player.choose(Outcome.PlayForFree, cards, target, game);
player.choose(Outcome.PlayForFree, cards, target, source, game);
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
player.moveCards(card, Zone.EXILED, source, game);

View file

@ -68,7 +68,7 @@ class DoomsdayEffect extends OneShotEffect {
int number = Math.min(5, allCards.size());
TargetCard target = new TargetCard(number, number, Zone.ALL, new FilterCard());
if (controller.choose(Outcome.Benefit, allCards, target, game)) {
if (controller.choose(Outcome.Benefit, allCards, target, source, game)) {
Cards toLibrary = new CardsImpl(target.getTargets());
allCards.removeAll(toLibrary);
// Exile the rest

View file

@ -93,7 +93,7 @@ class DranaTheLastBloodchiefEffect extends OneShotEffect {
}
TargetCard target = new TargetCardInGraveyard(filter);
target.setNotTarget(true);
player.choose(outcome, controller.getGraveyard(), target, game);
player.choose(outcome, controller.getGraveyard(), target, source, game);
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
return false;

View file

@ -70,7 +70,7 @@ class DredgeTheMireEffect extends OneShotEffect {
}
TargetCard target = new TargetCardInGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD);
target.setNotTarget(true);
if (!player.choose(outcome, player.getGraveyard(), target, game)) {
if (!player.choose(outcome, player.getGraveyard(), target, source, game)) {
continue;
}
cards.add(target.getFirstTarget());

View file

@ -65,7 +65,7 @@ class DubiousChallengeEffect extends OneShotEffect {
topCards.addAll(controller.getLibrary().getTopCards(game, 10));
controller.lookAtCards(sourceObject.getIdName(), topCards, game);
TargetCard targetCreatures = new TargetCard(0, 2, Zone.LIBRARY, StaticFilters.FILTER_CARD_CREATURE);
controller.choose(outcome, topCards, targetCreatures, game);
controller.choose(outcome, topCards, targetCreatures, source, game);
Cards exiledCards = new CardsImpl(targetCreatures.getTargets());
if (!exiledCards.isEmpty()) {
controller.moveCards(exiledCards, Zone.EXILED, source, game);
@ -75,7 +75,7 @@ class DubiousChallengeEffect extends OneShotEffect {
TargetCard targetOpponentCreature = new TargetCard(0, 1, Zone.EXILED, StaticFilters.FILTER_CARD_CREATURE);
DubiousChallengeMoveToBattlefieldEffect opponentEffect = (DubiousChallengeMoveToBattlefieldEffect) source.getEffects().get(1);
DubiousChallengeMoveToBattlefieldEffect controllerEffect = (DubiousChallengeMoveToBattlefieldEffect) source.getEffects().get(2);
if (opponent.choose(outcome, exiledCards, targetOpponentCreature, game)) {
if (opponent.choose(outcome, exiledCards, targetOpponentCreature, source, game)) {
Card card = game.getCard(targetOpponentCreature.getFirstTarget());
if (card != null) {
opponentEffect.setPlayerAndCards(opponent, new CardsImpl(card));

View file

@ -104,7 +104,7 @@ class EcologicalAppreciationEffect extends OneShotEffect {
};
targetCardsInGY.setNotTarget(true);
targetCardsInGY.withChooseHint("Step 2 of 2: Search graveyard");
player.choose(Outcome.PutCreatureInPlay, player.getGraveyard(), targetCardsInGY, game);
player.choose(Outcome.PutCreatureInPlay, player.getGraveyard(), targetCardsInGY, source, game);
cards.addAll(targetCardsInGY.getTargets());
cards.removeIf(uuid -> {
Zone zone = game.getState().getZone(uuid);
@ -120,7 +120,7 @@ class EcologicalAppreciationEffect extends OneShotEffect {
if (opponent != null) {
TargetCard chosenCards = new TargetCard(2, Zone.ALL, StaticFilters.FILTER_CARD);
chosenCards.setNotTarget(true);
opponent.choose(outcome, cards, chosenCards, game);
opponent.choose(outcome, cards, chosenCards, source, game);
Cards toShuffle = new CardsImpl(chosenCards.getTargets().stream()
.map(game::getCard)
.collect(Collectors.toList()));

View file

@ -66,7 +66,7 @@ class EerieUltimatumEffect extends OneShotEffect {
return false;
}
TargetCard target = new EerieUltimatumTarget();
if (!player.choose(outcome, player.getGraveyard(), target, game)) {
if (!player.choose(outcome, player.getGraveyard(), target, source, game)) {
return false;
}
return player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game);

View file

@ -104,7 +104,7 @@ class EliteArcanistImprintEffect extends OneShotEffect {
if (player != null && !player.getHand().isEmpty()) {
TargetCard target = new TargetCard(Zone.HAND, filter);
if (target.canChoose(source.getControllerId(), source, game)
&& player.choose(Outcome.Benefit, player.getHand(), target, game)) {
&& player.choose(Outcome.Benefit, player.getHand(), target, source, game)) {
Card card = player.getHand().get(target.getFirstTarget(), game);
if (card != null) {
card.moveToExile(source.getSourceId(), "Elite Arcanist", source, game);

View file

@ -81,7 +81,7 @@ class EliteSpellbinderEffect extends OneShotEffect {
TargetCard target = new TargetCardInHand(
0, 1, StaticFilters.FILTER_CARD_A_NON_LAND
);
controller.choose(outcome, opponent.getHand(), target, game);
controller.choose(outcome, opponent.getHand(), target, source, game);
Card card = opponent.getHand().get(target.getFirstTarget(), game);
if (card == null) {
return false;

View file

@ -76,7 +76,7 @@ class EllywickTumblestrumEffect extends OneShotEffect {
}
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 6));
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_CREATURE);
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
player.revealCards(source, new CardsImpl(card), game);

View file

@ -132,7 +132,7 @@ class ElspethResplendentLookEffect extends OneShotEffect {
}
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 7));
TargetCard target = new TargetCardInLibrary(0, 1, filter);
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
player.moveCards(card, Zone.BATTLEFIELD, source, game);

View file

@ -97,7 +97,7 @@ class EmergentUltimatumEffect extends OneShotEffect {
}
TargetCardInExile targetCardInExile = new TargetCardInExile(StaticFilters.FILTER_CARD);
targetCardInExile.setNotTarget(true);
opponent.choose(outcome, cards, targetCardInExile, game);
opponent.choose(outcome, cards, targetCardInExile, source, game);
Card toShuffle = game.getCard(targetCardInExile.getFirstTarget());
if (toShuffle != null) {
player.putCardsOnBottomOfLibrary(toShuffle, game, source, false);

View file

@ -85,7 +85,7 @@ class EtherealForagerEffect extends OneShotEffect {
}
TargetCard targetCard = new TargetCardInExile(0, 1, StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY, null, true);
;
player.choose(Outcome.DrawCard, delvedCards, targetCard, game);
player.choose(Outcome.DrawCard, delvedCards, targetCard, source, game);
Card card = game.getCard(targetCard.getFirstTarget());
if (card == null || !player.moveCards(card, Zone.HAND, source, game)) {
return false;

View file

@ -97,7 +97,7 @@ class EvershrikeEffect extends OneShotEffect {
int count = controller.getHand().count(filterAuraCard, game);
if (count > 0 && controller.chooseUse(Outcome.Benefit, "Put an Aura card from your hand onto the battlefield attached to " + evershrikeCard.getIdName() + "?", source, game)) {
TargetCard targetAura = new TargetCard(Zone.HAND, filterAuraCard);
if (controller.choose(Outcome.Benefit, controller.getHand(), targetAura, game)) {
if (controller.choose(Outcome.Benefit, controller.getHand(), targetAura, source, game)) {
Card aura = game.getCard(targetAura.getFirstTarget());
if (aura != null) {
game.getState().setValue("attachTo:" + aura.getId(), evershrikePermanent);

View file

@ -72,7 +72,7 @@ class ExperimentalOverloadEffect extends OneShotEffect {
TargetCard target = new TargetCardInYourGraveyard(
0, 1, StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY, true
);
player.choose(outcome, player.getGraveyard(), target, game);
player.choose(outcome, player.getGraveyard(), target, source, game);
return player.moveCards(game.getCard(target.getFirstTarget()), Zone.HAND, source, game);
}
}

View file

@ -72,7 +72,7 @@ class ExpressiveIterationEffect extends OneShotEffect {
cards.size() == 3 ? 1 : 0, 1, StaticFilters.FILTER_CARD
);
target.withChooseHint("To put into your hand");
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
player.moveCards(card, Zone.HAND, source, game);
@ -85,7 +85,7 @@ class ExpressiveIterationEffect extends OneShotEffect {
cards.size() == 2 ? 1 : 0, 1, StaticFilters.FILTER_CARD
);
target.withChooseHint("To put on the bottom of your library");
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
card = game.getCard(target.getFirstTarget());
if (card != null) {
player.putCardsOnBottomOfLibrary(card, game, source, false);
@ -96,7 +96,7 @@ class ExpressiveIterationEffect extends OneShotEffect {
}
target = new TargetCardInLibrary();
target.withChooseHint("To exile (you may play it this turn)");
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
card = game.getCard(target.getFirstTarget());
if (card == null) {
return true;

View file

@ -60,7 +60,7 @@ class ExtortionEffect extends OneShotEffect {
you.lookAtCards("Discard", targetPlayer.getHand(), game);
TargetCard target = new TargetCardInHand(0, 2, StaticFilters.FILTER_CARD_CARDS);
target.setNotTarget(true);
you.choose(Outcome.Discard, targetPlayer.getHand(), target, game);
you.choose(Outcome.Discard, targetPlayer.getHand(), target, source, game);
targetPlayer.discard(new CardsImpl(target.getTargets()), false, source, game);
return true;
}

View file

@ -68,7 +68,7 @@ class ExtractBrainEffect extends OneShotEffect {
TargetCardInHand target = new TargetCardInHand(
Math.min(opponent.getHand().size(), xValue), StaticFilters.FILTER_CARD
);
opponent.choose(Outcome.Detriment, opponent.getHand(), target, game);
opponent.choose(Outcome.Detriment, opponent.getHand(), target, source, game);
Cards cards = new CardsImpl(target.getTargets());
controller.lookAtCards(source, null, cards, game);
CardUtil.castSpellWithAttributesForFree(controller, source, game, cards, StaticFilters.FILTER_CARD);

View file

@ -147,7 +147,7 @@ class EyeOfTheStormEffect1 extends OneShotEffect {
cardToCopy = copiedCards.getCards(game).iterator().next();
} else {
TargetCard target = new TargetCard(1, Zone.EXILED, new FilterCard("card to copy"));
spellController.choose(Outcome.Copy, copiedCards, target, game);
spellController.choose(Outcome.Copy, copiedCards, target, source, game);
cardToCopy = copiedCards.get(target.getFirstTarget(), game);
copiedCards.remove(cardToCopy);
}

View file

@ -83,7 +83,7 @@ class EyeOfYawgmothEffect extends OneShotEffect {
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, power));
controller.revealCards(source, cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put into your hand"));
if (controller.choose(Outcome.DrawCard, cards, target, game)) {
if (controller.choose(Outcome.DrawCard, cards, target, source, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
controller.moveCards(card, Zone.HAND, source, game);

View file

@ -88,7 +88,7 @@ class FeldonRonomExcavatorEffect extends OneShotEffect {
default:
TargetCard target = new TargetCardInExile(StaticFilters.FILTER_CARD);
target.setNotTarget(true);
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
card = game.getCard(target.getFirstTarget());
}
if (card != null) {

View file

@ -70,7 +70,7 @@ class FinalPartingEffect extends OneShotEffect {
}
if (target.getTargets().size() == 2) {
TargetCard target2 = new TargetCard(Zone.LIBRARY, filter);
controller.choose(Outcome.Benefit, searched, target2, game);
controller.choose(Outcome.Benefit, searched, target2, source, game);
Card card = searched.get(target2.getFirstTarget(), game);
controller.moveCards(card, Zone.HAND, source, game);
searched.remove(card);

View file

@ -68,7 +68,7 @@ class FireProphecyEffect extends OneShotEffect {
return false;
}
TargetCard target = new TargetCardInHand();
player.choose(outcome, player.getHand(), target, game);
player.choose(outcome, player.getHand(), target, source, game);
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
return false;

View file

@ -78,7 +78,7 @@ class ForkInTheRoadEffect extends OneShotEffect {
controller.revealCards(sourceObject.getIdName(), revealed, game);
if (!target.getTargets().isEmpty()) {
TargetCard target2 = new TargetCard(Zone.LIBRARY, filter);
controller.choose(Outcome.Benefit, revealed, target2, game);
controller.choose(Outcome.Benefit, revealed, target2, source, game);
Card card = revealed.get(target2.getFirstTarget(), game);
if (card != null) {
controller.moveCards(card, Zone.HAND, source, game);

View file

@ -67,7 +67,7 @@ class FortunesFavorEffect extends OneShotEffect {
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 4));
TargetCard target = new TargetCard(0, Integer.MAX_VALUE, Zone.LIBRARY, new FilterCard("cards for the face-down pile"));
targetOpponent.choose(outcome, cards, target, game);
targetOpponent.choose(outcome, cards, target, source, game);
Cards faceDownPile = new CardsImpl(target.getTargets());
cards.removeAll(target.getTargets());
controller.revealCards(sourceObject.getIdName() + " - cards in face-up pile", cards, game);

View file

@ -97,14 +97,14 @@ class GateToTheAfterlifeEffect extends OneShotEffect {
// Graveyard check
if (controller.chooseUse(Outcome.Benefit, "Search your graveyard for " + cardName + "?", source, game)) {
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(1, 1, filter, true);
if (controller.choose(outcome, controller.getGraveyard(), target, game)) {
if (controller.choose(outcome, controller.getGraveyard(), target, source, game)) {
card = game.getCard(target.getFirstTarget());
}
}
// Hand check
if (card == null && controller.chooseUse(Outcome.Benefit, "Search your hand for " + cardName + "?", source, game)) {
TargetCardInHand target = new TargetCardInHand(0, 1, filter);
if (controller.choose(Outcome.PutCardInPlay, controller.getHand(), target, game)) {
if (controller.choose(Outcome.PutCardInPlay, controller.getHand(), target, source, game)) {
card = game.getCard(target.getFirstTarget());
}
}

View file

@ -81,7 +81,7 @@ class GenesisHydraPutOntoBattlefieldEffect extends OneShotEffect {
TargetCard target1 = new TargetCard(Zone.LIBRARY, filter);
target1.setRequired(false);
if (cards.count(filter, source.getSourceId(), source, game) > 0) {
if (controller.choose(Outcome.PutCardInPlay, cards, target1, game)) {
if (controller.choose(Outcome.PutCardInPlay, cards, target1, source, game)) {
Card card = cards.get(target1.getFirstTarget(), game);
if (card != null) {
cards.remove(card);

View file

@ -67,7 +67,7 @@ class GenesisWaveEffect extends OneShotEffect {
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, xValue + 1));
TargetCard target1 = new TargetCard(0, Integer.MAX_VALUE, Zone.LIBRARY, filter);
target1.setNotTarget(true);
controller.choose(Outcome.PutCardInPlay, cards, target1, game);
controller.choose(Outcome.PutCardInPlay, cards, target1, source, game);
Cards toBattlefield = new CardsImpl(target1.getTargets());
cards.removeAll(toBattlefield);
controller.moveCards(toBattlefield.getCards(game), Zone.BATTLEFIELD, source, game, false, false, false, null);

View file

@ -64,7 +64,7 @@ class GiftOfTheGargantuanEffect extends OneShotEffect {
}
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 4));
TargetCard target = new GiftOfTheGargantuanTarget();
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
Cards toHand = new CardsImpl();
toHand.addAll(target.getTargets());
player.revealCards(source, toHand, game);

View file

@ -83,7 +83,7 @@ class GiftsUngivenEffect extends OneShotEffect {
Cards cardsToKeep = new CardsImpl();
cardsToKeep.addAll(cards);
TargetCard targetDiscard = new TargetCard(2, Zone.LIBRARY, filter2);
if (opponent.choose(Outcome.Discard, cards, targetDiscard, game)) {
if (opponent.choose(Outcome.Discard, cards, targetDiscard, source, game)) {
cardsToKeep.removeIf(targetDiscard.getTargets()::contains);
cards.removeAll(cardsToKeep);
}

View file

@ -91,7 +91,7 @@ class GishathSunsAvatarEffect extends OneShotEffect {
filter.add(SubType.DINOSAUR.getPredicate());
TargetCard target1 = new TargetCard(0, Integer.MAX_VALUE, Zone.LIBRARY, filter);
target1.setNotTarget(true);
controller.choose(Outcome.PutCardInPlay, cards, target1, game);
controller.choose(Outcome.PutCardInPlay, cards, target1, source, game);
Cards toBattlefield = new CardsImpl(target1.getTargets());
cards.removeAll(toBattlefield);
controller.moveCards(toBattlefield.getCards(game), Zone.BATTLEFIELD, source, game, false, false, false, null);

View file

@ -95,7 +95,7 @@ class GlacianPowerstoneEngineerEffect extends OneShotEffect {
return false;
}
TargetCard targetCard = new TargetCardInLibrary(1, StaticFilters.FILTER_CARD);
player.choose(outcome, cards, targetCard, game);
player.choose(outcome, cards, targetCard, source, game);
Card card = game.getCard(targetCard.getFirstTarget());
if (card != null && player.moveCards(card, Zone.HAND, source, game)) {
cards.remove(card);

View file

@ -87,7 +87,7 @@ class GontiLordOfLuxuryEffect extends OneShotEffect {
Cards topCards = new CardsImpl();
topCards.addAll(opponent.getLibrary().getTopCards(game, 4));
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to exile"));
controller.choose(outcome, topCards, target, game);
controller.choose(outcome, topCards, target, source, game);
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
controller.putCardsOnBottomOfLibrary(topCards, game, source, false);

View file

@ -76,7 +76,7 @@ class GuildFeudEffect extends OneShotEffect {
TargetCard target = new TargetCard(Zone.LIBRARY,
new FilterCreatureCard(
"creature card to put on the battlefield"));
if (player.choose(Outcome.PutCreatureInPlay, topThreeCards, target, game)) {
if (player.choose(Outcome.PutCreatureInPlay, topThreeCards, target, source, game)) {
creatureToBattlefield = topThreeCards.get(target.getFirstTarget(), game);
if (creatureToBattlefield != null) {
topThreeCards.remove(creatureToBattlefield);

View file

@ -117,7 +117,7 @@ class GyrudaDoomOfDepthsEffect extends OneShotEffect {
// the creature card chosen can be in any zone, not just the graveyard
TargetCard targetCard = new TargetCard(0, 1, Zone.ALL, filter);
targetCard.setNotTarget(true);
controller.choose(outcome, cards, targetCard, game);
controller.choose(outcome, cards, targetCard, source, game);
Card card = game.getCard(targetCard.getFirstTarget());
return card != null
&& controller.moveCards(card, Zone.BATTLEFIELD, source, game);

View file

@ -76,7 +76,7 @@ class HarperRecruiterEffect extends OneShotEffect {
}
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 4));
TargetCard target = new HarperRecruiterTarget();
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
Cards toHand = new CardsImpl(target.getTargets());
player.revealCards(source, toHand, game);
player.moveCards(toHand, Zone.HAND, source, game);

View file

@ -96,7 +96,7 @@ class HelmOfObedienceEffect extends OneShotEffect {
default:
TargetCardInGraveyard target = new TargetCardInGraveyard(StaticFilters.FILTER_CARD_CREATURE);
target.setNotTarget(true);
controller.choose(Outcome.PutCreatureInPlay, cards, target, game);
controller.choose(Outcome.PutCreatureInPlay, cards, target, source, game);
card = game.getCard(target.getFirstTarget());
}
Permanent permanent = source.getSourcePermanentIfItStillExists(game);

View file

@ -84,7 +84,7 @@ class HolyAvengerEffect extends OneShotEffect {
filter.add(SubType.AURA.getPredicate());
filter.add(new AuraCardCanAttachToPermanentId(permanent.getId()));
TargetCardInHand target = new TargetCardInHand(0, 1, filter);
player.choose(Outcome.PutCardInPlay, player.getHand(), target, game);
player.choose(Outcome.PutCardInPlay, player.getHand(), target, source, game);
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
return false;

View file

@ -86,7 +86,7 @@ class HowlpackPiperEffect extends OneShotEffect {
return false;
}
TargetCard target = new TargetCardInHand(0, 1, StaticFilters.FILTER_CARD_CREATURE);
player.choose(outcome, player.getHand(), target, game);
player.choose(outcome, player.getHand(), target, source, game);
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
return false;

View file

@ -92,7 +92,7 @@ class HurkylMasterWizardEffect extends OneShotEffect {
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 5));
player.revealCards(source, cards, game);
TargetCard target = new HurkylMasterWizardTarget(source, game);
player.choose(outcome, cards, target, game);
player.choose(outcome, cards, target, source, game);
Cards toHand = new CardsImpl(target.getTargets());
player.moveCardsToHandWithInfo(toHand, source, game, true);
cards.retainZone(Zone.LIBRARY, game);

View file

@ -81,7 +81,7 @@ class IlhargTheRazeBoarEffect extends OneShotEffect {
return false;
}
TargetCard target = new TargetCardInHand(0, 1, StaticFilters.FILTER_CARD_CREATURE);
if (!player.choose(outcome, player.getHand(), target, game)) {
if (!player.choose(outcome, player.getHand(), target, source, game)) {
return false;
}
Card card = game.getCard(target.getFirstTarget());

Some files were not shown because too many files have changed in this diff Show more