mirror of
https://github.com/correl/mage.git
synced 2024-12-27 03:00:13 +00:00
Cleanup SearchLibraryPutInPlayTargetPlayerEffect
This commit is contained in:
parent
a850e3660b
commit
8eb8a163af
5 changed files with 15 additions and 33 deletions
|
@ -38,7 +38,7 @@ public final class Fertilid extends CardImpl {
|
|||
|
||||
// {1}{G}, Remove a +1/+1 counter from Fertilid: Target player searches their library for a basic land card and puts it onto the battlefield tapped. Then that player shuffles their library.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||
new SearchLibraryPutInPlayTargetPlayerEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND), true, true), new ManaCostsImpl<>("{1}{G}"));
|
||||
new SearchLibraryPutInPlayTargetPlayerEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND), true), new ManaCostsImpl<>("{1}{G}"));
|
||||
ability.addCost(new RemoveCountersSourceCost(CounterType.P1P1.createInstance(1)));
|
||||
ability.addTarget(new TargetPlayer());
|
||||
this.addAbility(ability);
|
||||
|
|
|
@ -24,7 +24,7 @@ public final class FertilidsFavor extends CardImpl {
|
|||
|
||||
// Target player searches their library for a basic land card, puts it onto the battlefield tapped, then shuffles. Put two +1/+1 counters on up to one target artifact or creature.
|
||||
this.getSpellAbility().addEffect(new SearchLibraryPutInPlayTargetPlayerEffect(
|
||||
new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND), true, true
|
||||
new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND), true
|
||||
));
|
||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||
this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance(2))
|
||||
|
|
|
@ -89,7 +89,7 @@ class OathOfLiegesEffect extends OneShotEffect {
|
|||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
if (activePlayer.chooseUse(outcome, "Search your library for a basic land card, put that card onto the battlefield, then shuffle?", source, game)) {
|
||||
Effect effect = new SearchLibraryPutInPlayTargetPlayerEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND), false, false, Outcome.PutLandInPlay, true);
|
||||
Effect effect = new SearchLibraryPutInPlayTargetPlayerEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND), false, true);
|
||||
effect.setTargetPointer(new FixedTarget(game.getActivePlayerId()));
|
||||
return effect.apply(game, source);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public final class PatternOfRebirth extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// When enchanted creature dies, that creature's controller may search their library for a creature card and put that card onto the battlefield. If that player does, they shuffle their library.
|
||||
Effect effect = new SearchLibraryPutInPlayTargetPlayerEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD_CREATURE), false, false, Outcome.PutCreatureInPlay);
|
||||
Effect effect = new SearchLibraryPutInPlayTargetPlayerEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD_CREATURE), false);
|
||||
effect.setText("that creature's controller may search their library for a creature card and put that card onto the battlefield. If that player does, they shuffle");
|
||||
this.addAbility(new DiesAttachedTriggeredAbility(effect, "enchanted creature", true, true, SetTargetPointer.ATTACHED_TO_CONTROLLER));
|
||||
|
||||
|
|
|
@ -16,40 +16,26 @@ import mage.target.common.TargetCardInLibrary;
|
|||
public class SearchLibraryPutInPlayTargetPlayerEffect extends SearchEffect {
|
||||
|
||||
protected boolean tapped;
|
||||
protected boolean forceShuffle;
|
||||
protected boolean ownerIsController;
|
||||
|
||||
public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target) {
|
||||
this(target, false, true, Outcome.PutCardInPlay);
|
||||
}
|
||||
|
||||
public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target, boolean tapped) {
|
||||
this(target, tapped, true, Outcome.PutCardInPlay);
|
||||
this(target, tapped, false);
|
||||
}
|
||||
|
||||
public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target, boolean tapped, boolean forceShuffle) {
|
||||
this(target, tapped, forceShuffle, Outcome.PutCardInPlay);
|
||||
}
|
||||
|
||||
public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target, boolean tapped, Outcome outcome) {
|
||||
this(target, tapped, true, outcome);
|
||||
}
|
||||
|
||||
public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target, boolean tapped, boolean forceShuffle, Outcome outcome) {
|
||||
this(target, tapped, forceShuffle, outcome, false);
|
||||
}
|
||||
|
||||
public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target, boolean tapped, boolean forceShuffle, Outcome outcome, boolean ownerIsController) {
|
||||
super(target, outcome);
|
||||
public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target, boolean tapped, boolean ownerIsController) {
|
||||
super(target, Outcome.PutCardInPlay);
|
||||
this.tapped = tapped;
|
||||
this.forceShuffle = forceShuffle;
|
||||
this.ownerIsController = ownerIsController;
|
||||
if (target.getDescription().contains("land")) {
|
||||
this.outcome = Outcome.PutLandInPlay;
|
||||
} else if (target.getDescription().contains("creature")) {
|
||||
this.outcome = Outcome.PutCreatureInPlay;
|
||||
}
|
||||
}
|
||||
|
||||
public SearchLibraryPutInPlayTargetPlayerEffect(final SearchLibraryPutInPlayTargetPlayerEffect effect) {
|
||||
super(effect);
|
||||
this.tapped = effect.tapped;
|
||||
this.forceShuffle = effect.forceShuffle;
|
||||
this.ownerIsController = effect.ownerIsController;
|
||||
}
|
||||
|
||||
|
@ -70,12 +56,8 @@ public class SearchLibraryPutInPlayTargetPlayerEffect extends SearchEffect {
|
|||
player.shuffleLibrary(source, game);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (forceShuffle) {
|
||||
player.shuffleLibrary(source, game);
|
||||
}
|
||||
player.shuffleLibrary(source, game);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -87,9 +69,9 @@ public class SearchLibraryPutInPlayTargetPlayerEffect extends SearchEffect {
|
|||
return getTargetPointer().describeTargets(mode.getTargets(), "that player")
|
||||
+ " searches their library for "
|
||||
+ target.getDescription()
|
||||
+ (forceShuffle ? ", " : " and ")
|
||||
+ ", "
|
||||
+ (target.getMaxNumberOfTargets() > 1 ? "puts them onto the battlefield" : "puts it onto the battlefield")
|
||||
+ (tapped ? " tapped" : "")
|
||||
+ (forceShuffle ? ", then shuffles" : ". If that player does, they shuffle");
|
||||
+ ", then shuffles";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue