forked from External/mage
Delve abilities - removed unnecessary windows with exiled cards (except few cards that can use it);
This commit is contained in:
parent
e2557c1d1b
commit
ba0e5a1aed
29 changed files with 75 additions and 39 deletions
|
|
@ -18,7 +18,6 @@ import mage.util.CardUtil;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
|
|
@ -27,6 +26,7 @@ public class ExileFromGraveCost extends CostImpl {
|
|||
|
||||
private final List<Card> exiledCards = new ArrayList<>();
|
||||
private boolean setTargetPointer = false;
|
||||
private boolean useSourceExileZone = true;
|
||||
|
||||
public ExileFromGraveCost(TargetCardInYourGraveyard target) {
|
||||
target.withNotTarget(true);
|
||||
|
|
@ -73,6 +73,7 @@ public class ExileFromGraveCost extends CostImpl {
|
|||
super(cost);
|
||||
this.exiledCards.addAll(cost.getExiledCards());
|
||||
this.setTargetPointer = cost.setTargetPointer;
|
||||
this.useSourceExileZone = cost.useSourceExileZone;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -90,11 +91,23 @@ public class ExileFromGraveCost extends CostImpl {
|
|||
}
|
||||
Cards cardsToExile = new CardsImpl();
|
||||
cardsToExile.addAllCards(exiledCards);
|
||||
|
||||
|
||||
UUID exileZoneId = null;
|
||||
String exileZoneName = "";
|
||||
if (useSourceExileZone) {
|
||||
exileZoneId = CardUtil.getExileZoneId(game, source);
|
||||
exileZoneName = CardUtil.getSourceName(game, source);
|
||||
}
|
||||
controller.moveCardsToExile(
|
||||
cardsToExile.getCards(game), source, game, true,
|
||||
CardUtil.getExileZoneId(game, source),
|
||||
CardUtil.getSourceName(game, source)
|
||||
cardsToExile.getCards(game),
|
||||
source,
|
||||
game,
|
||||
true,
|
||||
exileZoneId,
|
||||
exileZoneName
|
||||
);
|
||||
|
||||
if (setTargetPointer) {
|
||||
source.getEffects().setTargetPointer(new FixedTargets(cardsToExile.getCards(game), game));
|
||||
}
|
||||
|
|
@ -118,4 +131,12 @@ public class ExileFromGraveCost extends CostImpl {
|
|||
public List<Card> getExiledCards() {
|
||||
return exiledCards;
|
||||
}
|
||||
|
||||
/**
|
||||
* Put exiled cards to source zone, so next linked ability can find it
|
||||
*/
|
||||
public ExileFromGraveCost withSourceExileZone(boolean useSourceExileZone) {
|
||||
this.useSourceExileZone = useSourceExileZone;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,10 +63,16 @@ public class DelveAbility extends SimpleStaticAbility implements AlternateManaPa
|
|||
|
||||
private static final DynamicValue cardsInGraveyard = new CardsInControllerGraveyardCount();
|
||||
|
||||
public DelveAbility() {
|
||||
private boolean useSourceExileZone;
|
||||
|
||||
/**
|
||||
* @param useSourceExileZone - keep exiled cards in linked source zone, so next ability can find it
|
||||
*/
|
||||
public DelveAbility(boolean useSourceExileZone) {
|
||||
super(Zone.ALL, null);
|
||||
this.setRuleAtTheTop(true);
|
||||
this.addHint(new ValueHint("Cards in your graveyard", cardsInGraveyard));
|
||||
this.useSourceExileZone = useSourceExileZone;
|
||||
}
|
||||
|
||||
protected DelveAbility(final DelveAbility ability) {
|
||||
|
|
@ -101,8 +107,11 @@ public class DelveAbility extends SimpleStaticAbility implements AlternateManaPa
|
|||
unpaidAmount = 1;
|
||||
}
|
||||
specialAction.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(
|
||||
0, Math.min(controller.getGraveyard().size(), unpaidAmount),
|
||||
new FilterCard("cards from your graveyard"), true)));
|
||||
0,
|
||||
Math.min(controller.getGraveyard().size(), unpaidAmount),
|
||||
new FilterCard("cards from your graveyard"),
|
||||
true
|
||||
)).withSourceExileZone(this.useSourceExileZone));
|
||||
if (specialAction.canActivate(source.getControllerId(), game).canActivate()) {
|
||||
game.getState().getSpecialActions().add(specialAction);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue