mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Some minor changes to framework functions.
This commit is contained in:
parent
11ea72beb7
commit
ee02b47d54
3 changed files with 20 additions and 2 deletions
|
@ -37,6 +37,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.target.Target;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.target.targetpointer.FirstTargetPointer;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -73,7 +74,7 @@ public class DestroyTargetEffect extends OneShotEffect<DestroyTargetEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int affectedTargets = 0;
|
||||
if (source.getTargets().size() > 1) { // for Rain of Thorns
|
||||
if (source.getTargets().size() > 1 && targetPointer instanceof FirstTargetPointer) { // for Rain of Thorns
|
||||
for (Target target : source.getTargets()) {
|
||||
for (UUID permanentId : target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(permanentId);
|
||||
|
|
|
@ -71,6 +71,9 @@ public class ReturnFromGraveyardToHandTargetEffect extends OneShotEffect<ReturnF
|
|||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Return target ").append(mode.getTargets().get(0).getTargetName()).append(" to your hand");
|
||||
return sb.toString();
|
||||
|
|
|
@ -12,17 +12,25 @@ import java.util.UUID;
|
|||
|
||||
public class TargetCardInOpponentsGraveyard extends TargetCard<TargetCardInOpponentsGraveyard> {
|
||||
|
||||
protected boolean allFromOneOpponent;
|
||||
|
||||
public TargetCardInOpponentsGraveyard(FilterCard filter) {
|
||||
this(1, 1, filter);
|
||||
this(1, 1, filter, false);
|
||||
}
|
||||
|
||||
public TargetCardInOpponentsGraveyard(int minNumTargets, int maxNumTargets, FilterCard filter) {
|
||||
this(minNumTargets, maxNumTargets, filter, false);
|
||||
}
|
||||
|
||||
public TargetCardInOpponentsGraveyard(int minNumTargets, int maxNumTargets, FilterCard filter, boolean allFromOneOpponent) {
|
||||
super(minNumTargets, maxNumTargets, Constants.Zone.GRAVEYARD, filter);
|
||||
this.targetName = filter.getMessage();
|
||||
this.allFromOneOpponent = allFromOneOpponent;
|
||||
}
|
||||
|
||||
public TargetCardInOpponentsGraveyard(final TargetCardInOpponentsGraveyard target) {
|
||||
super(target);
|
||||
this.allFromOneOpponent = target.allFromOneOpponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,6 +38,12 @@ public class TargetCardInOpponentsGraveyard extends TargetCard<TargetCardInOppon
|
|||
Card card = game.getCard(id);
|
||||
if (card != null && game.getState().getZone(card.getId()) == Constants.Zone.GRAVEYARD) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(card.getOwnerId())) {
|
||||
if (allFromOneOpponent && !targets.isEmpty()) {
|
||||
Card firstCard = game.getCard((UUID)targets.keySet().iterator().next());
|
||||
if (firstCard != null && !card.getOwnerId().equals(firstCard.getOwnerId())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return filter.match(card, game);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue