mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
Convert UnsealTheNecropolis and AnotherChance to use OneShotNonTargetEffect
This commit is contained in:
parent
bcba45652f
commit
99bdfe3a1a
2 changed files with 15 additions and 67 deletions
|
|
@ -2,17 +2,15 @@ package mage.cards.a;
|
|||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.OneShotNonTargetEffect;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -26,7 +24,9 @@ public final class AnotherChance extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{B}");
|
||||
|
||||
// You may mill two cards. Then return up to two creature cards from your graveyard to your hand.
|
||||
this.getSpellAbility().addEffect(new AnotherChanceEffect());
|
||||
this.getSpellAbility().addEffect(new AnotherChanceMillEffect());
|
||||
this.getSpellAbility().addEffect(new OneShotNonTargetEffect(new ReturnFromGraveyardToHandTargetEffect().setText("Then return up to two creature cards from your graveyard to your hand."),
|
||||
new TargetCardInYourGraveyard(0, 2, StaticFilters.FILTER_CARD_CREATURES_YOUR_GRAVEYARD, true)).withTargetDescription("up to two creature cards").concatBy("Then "));
|
||||
}
|
||||
|
||||
private AnotherChance(final AnotherChance card) {
|
||||
|
|
@ -39,23 +39,20 @@ public final class AnotherChance extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inspired by {@link mage.cards.u.UnsealTheNecropolis}
|
||||
*/
|
||||
class AnotherChanceEffect extends OneShotEffect {
|
||||
class AnotherChanceMillEffect extends OneShotEffect {
|
||||
|
||||
AnotherChanceEffect() {
|
||||
AnotherChanceMillEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "You may mill two cards. Then return up to two creature cards from your graveyard to your hand";
|
||||
staticText = "You may mill two cards.";
|
||||
}
|
||||
|
||||
private AnotherChanceEffect(final AnotherChanceEffect effect) {
|
||||
private AnotherChanceMillEffect(final AnotherChanceMillEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnotherChanceEffect copy() {
|
||||
return new AnotherChanceEffect(this);
|
||||
public AnotherChanceMillEffect copy() {
|
||||
return new AnotherChanceMillEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -68,18 +65,6 @@ class AnotherChanceEffect extends OneShotEffect {
|
|||
if (player.chooseUse(outcome, "Mill two cards?", source, game)) {
|
||||
player.millCards(2, source, game);
|
||||
}
|
||||
|
||||
// Make sure the mill has been processed.
|
||||
game.processAction();
|
||||
|
||||
TargetCard target = new TargetCardInYourGraveyard(
|
||||
0, 2, StaticFilters.FILTER_CARD_CREATURES_YOUR_GRAVEYARD, true
|
||||
);
|
||||
player.choose(outcome, target, source, game);
|
||||
Cards cards = new CardsImpl(target.getTargets());
|
||||
if (!cards.isEmpty()) {
|
||||
player.moveCards(cards, Zone.HAND, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,13 @@
|
|||
package mage.cards.u;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.OneShotNonTargetEffect;
|
||||
import mage.abilities.effects.common.MillCardsEachPlayerEffect;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -29,7 +22,8 @@ public final class UnsealTheNecropolis extends CardImpl {
|
|||
|
||||
// Each player mills three cards. Then you return up to two creature cards from your graveyard to your hand.
|
||||
this.getSpellAbility().addEffect(new MillCardsEachPlayerEffect(3, TargetController.EACH_PLAYER));
|
||||
this.getSpellAbility().addEffect(new UnsealTheNecropolisEffect());
|
||||
this.getSpellAbility().addEffect(new OneShotNonTargetEffect(new ReturnFromGraveyardToHandTargetEffect().setText("Then you return up to two creature cards from your graveyard to your hand"),
|
||||
new TargetCardInYourGraveyard(0, 2, StaticFilters.FILTER_CARD_CREATURES_YOUR_GRAVEYARD, true)));
|
||||
}
|
||||
|
||||
private UnsealTheNecropolis(final UnsealTheNecropolis card) {
|
||||
|
|
@ -41,34 +35,3 @@ public final class UnsealTheNecropolis extends CardImpl {
|
|||
return new UnsealTheNecropolis(this);
|
||||
}
|
||||
}
|
||||
|
||||
class UnsealTheNecropolisEffect extends OneShotEffect {
|
||||
|
||||
UnsealTheNecropolisEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Then you return up to two creature cards from your graveyard to your hand";
|
||||
}
|
||||
|
||||
private UnsealTheNecropolisEffect(final UnsealTheNecropolisEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnsealTheNecropolisEffect copy() {
|
||||
return new UnsealTheNecropolisEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
TargetCard target = new TargetCardInYourGraveyard(
|
||||
0, 2, StaticFilters.FILTER_CARD_CREATURES_YOUR_GRAVEYARD, true
|
||||
);
|
||||
player.choose(outcome, target, source, game);
|
||||
Cards cards = new CardsImpl(target.getTargets());
|
||||
return !cards.isEmpty() && player.moveCards(cards, Zone.HAND, source, game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue