Move PutCards enum to constants package

This commit is contained in:
Alex W. Jackson 2022-10-10 16:40:53 -04:00
parent 761021c7d3
commit cbe610d339
204 changed files with 289 additions and 416 deletions

View file

@ -35,6 +35,7 @@ import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.PutCards;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
@ -157,12 +158,12 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
sb.append(plural ? "them" : "it");
}
sb.append(" ");
sb.append(putPickedCards.getMessage(plural));
sb.append(putPickedCards.getMessage(false, plural));
return sb.append("?").toString();
}
protected String getChooseHint() {
return "to put " + putPickedCards.getMessage(numberToPick > 1);
return "to put " + putPickedCards.getMessage(false, numberToPick > 1);
}
@Override
@ -201,7 +202,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
sb.append("and put ");
sb.append(plural ? "them " : "it ");
}
sb.append(putPickedCards.getMessage(plural));
sb.append(putPickedCards.getMessage(false, plural));
plural = optional
|| upTo
@ -218,7 +219,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
if (putPickedCards == PutCards.GRAVEYARD && putLookedCards == PutCards.TOP_ANY) {
sb.append("back ");
}
sb.append(putLookedCards.getMessage(plural));
sb.append(putLookedCards.getMessage(false, plural));
// get text frame from super class and inject action text
return setText(mode, sb.toString());

View file

@ -9,6 +9,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.Outcome;
import mage.constants.PutCards;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
@ -20,44 +21,6 @@ import mage.util.CardUtil;
*/
public class LookLibraryControllerEffect extends OneShotEffect {
public enum PutCards {
HAND(Outcome.DrawCard, Zone.HAND, "into your hand"),
GRAVEYARD(Outcome.Discard, Zone.GRAVEYARD, "into your graveyard"),
BATTLEFIELD(Outcome.PutCardInPlay, Zone.BATTLEFIELD, "onto the battlefield"),
BATTLEFIELD_TAPPED(Outcome.PutCardInPlay, Zone.BATTLEFIELD, "onto the battlefield tapped"),
TOP_ANY(Outcome.Benefit, Zone.LIBRARY, "on top of your library", " in any order"),
BOTTOM_ANY(Outcome.Benefit, Zone.LIBRARY, "on the bottom of your library", " in any order"),
BOTTOM_RANDOM(Outcome.Benefit, Zone.LIBRARY, "on the bottom of your library", " in a random order");
private final Outcome outcome;
private final Zone zone;
private final String message;
private final String order;
PutCards(Outcome outcome, Zone zone, String message) {
this(outcome, zone, message, "");
}
PutCards(Outcome outcome, Zone zone, String message, String order) {
this.outcome = outcome;
this.zone = zone;
this.message = message;
this.order = order;
}
public Outcome getOutcome() {
return outcome;
}
public Zone getZone() {
return zone;
}
public String getMessage(boolean withOrder) {
return withOrder ? message + order : message;
}
}
protected DynamicValue numberOfCards;
protected PutCards putLookedCards;
protected boolean revealCards;
@ -167,7 +130,7 @@ public class LookLibraryControllerEffect extends OneShotEffect {
sb.append(middleText);
} else if (!oneCard) {
sb.append(", then put them ");
sb.append(putLookedCards == PutCards.TOP_ANY ? "back in any order" : putLookedCards.getMessage(true));
sb.append(putLookedCards == PutCards.TOP_ANY ? "back in any order" : putLookedCards.getMessage(false, true));
}
return sb.toString();
}

View file

@ -1,5 +1,6 @@
package mage.abilities.effects.common;
import mage.constants.PutCards;
import mage.filter.FilterCard;
/**

View file

@ -0,0 +1,49 @@
package mage.constants;
/**
*
* @author awjackson
*/
public enum PutCards {
HAND(Outcome.DrawCard, Zone.HAND, "into your hand"),
GRAVEYARD(Outcome.Discard, Zone.GRAVEYARD, "into your graveyard"),
BATTLEFIELD(Outcome.PutCardInPlay, Zone.BATTLEFIELD, "onto the battlefield"),
BATTLEFIELD_TAPPED(Outcome.PutCardInPlay, Zone.BATTLEFIELD, "onto the battlefield tapped"),
EXILED(Outcome.Exile, Zone.EXILED, "into exile"), // may need special case code to generate correct text
TOP_OR_BOTTOM(Outcome.Benefit, Zone.LIBRARY, "on the top or bottom of your library"),
TOP_ANY(Outcome.Benefit, Zone.LIBRARY, "on top of your library", " in any order"),
BOTTOM_ANY(Outcome.Benefit, Zone.LIBRARY, "on the bottom of your library", " in any order"),
BOTTOM_RANDOM(Outcome.Benefit, Zone.LIBRARY, "on the bottom of your library", " in a random order");
private final Outcome outcome;
private final Zone zone;
private final String messageYour;
private final String messageOwner;
private final String order;
PutCards(Outcome outcome, Zone zone, String message) {
this(outcome, zone, message, "");
}
PutCards(Outcome outcome, Zone zone, String message, String order) {
this.outcome = outcome;
this.zone = zone;
this.messageYour = message;
this.messageOwner = message.replace("your", "its owner's");
this.order = order;
}
public Outcome getOutcome() {
return outcome;
}
public Zone getZone() {
return zone;
}
public String getMessage(boolean owner, boolean withOrder) {
String message = owner ? messageOwner : messageYour;
return withOrder ? message + order : message;
}
}

View file

@ -12,7 +12,7 @@ import mage.target.TargetPermanent;
public class TargetLandPermanent extends TargetPermanent {
public TargetLandPermanent() {
this(1, 1, StaticFilters.FILTER_LAND, false);
this(1);
}
public TargetLandPermanent(FilterLandPermanent filter) {
@ -20,11 +20,11 @@ public class TargetLandPermanent extends TargetPermanent {
}
public TargetLandPermanent(int numTargets) {
this(numTargets, numTargets, StaticFilters.FILTER_LAND, false);
this(numTargets, numTargets);
}
public TargetLandPermanent(int numTargets, int maxNumTargets) {
this(numTargets, maxNumTargets, StaticFilters.FILTER_LAND, false);
this(numTargets, maxNumTargets, maxNumTargets > 1 ? StaticFilters.FILTER_LANDS : StaticFilters.FILTER_LAND, false);
}
public TargetLandPermanent(int minNumTargets, int maxNumTargets, FilterLandPermanent filter, boolean notTarget) {