forked from External/mage
refactored zone changes, letters I through L
fixed some issues with Immortal Coil, simplified Increasing Ambition, reworked Induced Amnesia and Legion's Initiative, corrected Khalni Gem targeting on trigger
This commit is contained in:
parent
73f594583f
commit
50071b59a0
8 changed files with 274 additions and 369 deletions
|
|
@ -6,18 +6,16 @@ import mage.abilities.common.SimpleActivatedAbility;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.ExileFromGraveCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.abilities.effects.common.LoseGameSourceControllerEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
|
|
@ -37,11 +35,13 @@ public final class ImmortalCoil extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{B}{B}");
|
||||
|
||||
// {tap}, Exile two cards from your graveyard: Draw a card.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new TapSourceCost());
|
||||
ability.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(2, new FilterCard("cards from your graveyard"))));
|
||||
Ability ability = new SimpleActivatedAbility(new DrawCardSourceControllerEffect(1), new TapSourceCost());
|
||||
ability.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(2, StaticFilters.FILTER_CARD_CARDS)));
|
||||
this.addAbility(ability);
|
||||
|
||||
// If damage would be dealt to you, prevent that damage. Exile a card from your graveyard for each 1 damage prevented this way.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PreventAllDamageToControllerEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(new ImmortalCoilPreventionEffect()));
|
||||
|
||||
// When there are no cards in your graveyard, you lose the game.
|
||||
this.addAbility(new ImmortalCoilAbility());
|
||||
}
|
||||
|
|
@ -58,12 +58,11 @@ public final class ImmortalCoil extends CardImpl {
|
|||
|
||||
class ImmortalCoilAbility extends StateTriggeredAbility {
|
||||
|
||||
public ImmortalCoilAbility() {
|
||||
super(Zone.BATTLEFIELD, new SacrificeSourceEffect());
|
||||
this.addEffect(new LoseGameEffect());
|
||||
ImmortalCoilAbility() {
|
||||
super(Zone.BATTLEFIELD, new LoseGameSourceControllerEffect());
|
||||
}
|
||||
|
||||
public ImmortalCoilAbility(final ImmortalCoilAbility ability) {
|
||||
private ImmortalCoilAbility(final ImmortalCoilAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
|
|
@ -82,50 +81,23 @@ class ImmortalCoilAbility extends StateTriggeredAbility {
|
|||
public String getRule() {
|
||||
return "When there are no cards in your graveyard, you lose the game";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class LoseGameEffect extends OneShotEffect {
|
||||
class ImmortalCoilPreventionEffect extends PreventionEffectImpl {
|
||||
|
||||
public LoseGameEffect() {
|
||||
super(Outcome.Neutral);
|
||||
staticText = "you lose the game";
|
||||
}
|
||||
|
||||
public LoseGameEffect(final LoseGameEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoseGameEffect copy() {
|
||||
return new LoseGameEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.lost(game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class PreventAllDamageToControllerEffect extends PreventionEffectImpl {
|
||||
|
||||
public PreventAllDamageToControllerEffect() {
|
||||
ImmortalCoilPreventionEffect() {
|
||||
super(Duration.WhileOnBattlefield);
|
||||
staticText = "If damage would be dealt to you, prevent that damage. Exile a card from your graveyard for each 1 damage prevented this way";
|
||||
staticText = "If damage would be dealt to you, prevent that damage. " +
|
||||
"Exile a card from your graveyard for each 1 damage prevented this way";
|
||||
}
|
||||
|
||||
public PreventAllDamageToControllerEffect(final PreventAllDamageToControllerEffect effect) {
|
||||
private ImmortalCoilPreventionEffect(final ImmortalCoilPreventionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreventAllDamageToControllerEffect copy() {
|
||||
return new PreventAllDamageToControllerEffect(this);
|
||||
public ImmortalCoilPreventionEffect copy() {
|
||||
return new ImmortalCoilPreventionEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -135,33 +107,30 @@ class PreventAllDamageToControllerEffect extends PreventionEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage());
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
int damage = event.getAmount();
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(Math.min(damage, player.getGraveyard().size()), new FilterCard());
|
||||
if (target.choose(Outcome.Exile, source.getControllerId(), source.getSourceId(), game)) {
|
||||
for (UUID targetId : target.getTargets()) {
|
||||
Card card = player.getGraveyard().get(targetId, game);
|
||||
if (card != null) {
|
||||
card.moveToZone(Zone.EXILED, source, game, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
event.setAmount(0);
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage));
|
||||
if (game.replaceEvent(new PreventDamageEvent(
|
||||
event.getTargetId(), source.getSourceId(), source, source.getControllerId(),
|
||||
event.getAmount(), ((DamageEvent) event).isCombatDamage()
|
||||
))) {
|
||||
return false;
|
||||
}
|
||||
int damage = event.getAmount();
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(Math.min(damage, player.getGraveyard().size()), StaticFilters.FILTER_CARD);
|
||||
target.setNotTarget(true);
|
||||
player.choose(outcome, target, source.getSourceId(), game);
|
||||
player.moveCards(new CardsImpl(target.getTargets()), Zone.EXILED, source, game);
|
||||
}
|
||||
event.setAmount(0);
|
||||
game.fireEvent(new PreventedDamageEvent(
|
||||
event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage
|
||||
));
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (super.applies(event, source, game)) {
|
||||
return event.getTargetId().equals(source.getControllerId());
|
||||
}
|
||||
return false;
|
||||
return super.applies(event, source, game)
|
||||
&& event.getTargetId().equals(source.getControllerId());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package mage.cards.i;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
|
|
@ -14,8 +12,11 @@ import mage.filter.StaticFilters;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class ImmortalServitude extends CardImpl {
|
||||
|
|
@ -39,12 +40,12 @@ public final class ImmortalServitude extends CardImpl {
|
|||
|
||||
class ImmortalServitudeEffect extends OneShotEffect {
|
||||
|
||||
public ImmortalServitudeEffect() {
|
||||
ImmortalServitudeEffect() {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
this.staticText = "Return each creature card with converted mana cost X from your graveyard to the battlefield";
|
||||
}
|
||||
|
||||
public ImmortalServitudeEffect(final ImmortalServitudeEffect effect) {
|
||||
private ImmortalServitudeEffect(final ImmortalServitudeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
|
@ -56,13 +57,14 @@ class ImmortalServitudeEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you == null) {
|
||||
return false;
|
||||
}
|
||||
int count = source.getManaCostsToPay().getX();
|
||||
Set<Card> cards = you.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game);
|
||||
for (Card card : cards) {
|
||||
if (card != null && card.getConvertedManaCost() == count) {
|
||||
card.moveToZone(Zone.BATTLEFIELD, source, game, false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
cards.removeIf(Objects::isNull);
|
||||
cards.removeIf(card -> !card.isCreature());
|
||||
cards.removeIf(card -> card.getConvertedManaCost() != count);
|
||||
return you.moveCards(cards, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,36 +1,40 @@
|
|||
|
||||
package mage.cards.i;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.SearchEffect;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
|
||||
import mage.abilities.keyword.FlashbackAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward
|
||||
*/
|
||||
public final class IncreasingAmbition extends CardImpl {
|
||||
|
||||
public IncreasingAmbition(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{B}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{B}");
|
||||
|
||||
// Search your library for a card and put that card into your hand. If this spell was cast from a graveyard, instead search your library for two cards and put those cards into your hand. Then shuffle your library.
|
||||
this.getSpellAbility().addEffect(new IncreasingAmbitionEffect());
|
||||
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
|
||||
new SearchLibraryPutInHandEffect(new TargetCardInLibrary(2, StaticFilters.FILTER_CARD)),
|
||||
new SearchLibraryPutInHandEffect(new TargetCardInLibrary()),
|
||||
IncreasingAmbitionCondition.instance, "Search your library for a card " +
|
||||
"and put that card into your hand. If this spell was cast from a graveyard, " +
|
||||
"instead search your library for two cards and put those cards into your hand. " +
|
||||
"Then shuffle your library."
|
||||
));
|
||||
|
||||
// Flashback {7}{B}
|
||||
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{7}{B}"), TimingRule.SORCERY));
|
||||
|
|
@ -46,50 +50,12 @@ public final class IncreasingAmbition extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class IncreasingAmbitionEffect extends SearchEffect {
|
||||
|
||||
public IncreasingAmbitionEffect() {
|
||||
super(new TargetCardInLibrary(), Outcome.DrawCard);
|
||||
staticText = "Search your library for a card and put that card into your hand. If this spell was cast from a graveyard, instead search your library for two cards and put those cards into your hand. Then shuffle your library";
|
||||
}
|
||||
|
||||
public IncreasingAmbitionEffect(final IncreasingAmbitionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IncreasingAmbitionEffect copy() {
|
||||
return new IncreasingAmbitionEffect(this);
|
||||
}
|
||||
enum IncreasingAmbitionCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
Spell spell = (Spell) game.getStack().getStackObject(source.getSourceId());
|
||||
if (spell != null) {
|
||||
if (spell.getFromZone() == Zone.GRAVEYARD) {
|
||||
target = new TargetCardInLibrary(2, new FilterCard());
|
||||
}
|
||||
else {
|
||||
target = new TargetCardInLibrary();
|
||||
}
|
||||
if (player.searchLibrary(target, source, game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
for (UUID cardId: target.getTargets()) {
|
||||
Card card = player.getLibrary().remove(cardId, game);
|
||||
if (card != null) {
|
||||
card.moveToZone(Zone.HAND, source, game, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// shuffle anyway
|
||||
player.shuffleLibrary(source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
Spell spell = game.getSpell(source.getSourceId());
|
||||
return spell != null && spell.getFromZone() == Zone.GRAVEYARD;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
|
||||
package mage.cards.i;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
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.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class InducedAmnesia extends CardImpl {
|
||||
|
|
@ -49,12 +49,12 @@ public final class InducedAmnesia extends CardImpl {
|
|||
|
||||
class InducedAmnesiaExileEffect extends OneShotEffect {
|
||||
|
||||
public InducedAmnesiaExileEffect() {
|
||||
InducedAmnesiaExileEffect() {
|
||||
super(Outcome.Detriment);
|
||||
this.staticText = "target player exiles all the cards in their hand face down, then draws that many cards";
|
||||
}
|
||||
|
||||
public InducedAmnesiaExileEffect(final InducedAmnesiaExileEffect effect) {
|
||||
private InducedAmnesiaExileEffect(final InducedAmnesiaExileEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
|
@ -66,33 +66,36 @@ class InducedAmnesiaExileEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (targetPlayer != null && sourcePermanent != null) {
|
||||
int numberOfCards = targetPlayer.getHand().size();
|
||||
if (numberOfCards > 0) {
|
||||
UUID exileId = CardUtil.getCardExileZoneId(game, source);
|
||||
for (Card card : targetPlayer.getHand().getCards(game)) {
|
||||
card.moveToExile(exileId, sourcePermanent.getName(), source, game);
|
||||
card.setFaceDown(true, game);
|
||||
}
|
||||
game.informPlayers(sourcePermanent.getLogName() + ": " + targetPlayer.getLogName() + " exiles their hand face down (" + numberOfCards + "card" + (numberOfCards > 1 ? "s" : "") + ')');
|
||||
game.getState().processAction(game);
|
||||
targetPlayer.drawCards(numberOfCards, source, game);
|
||||
}
|
||||
return true;
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (targetPlayer == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
int numberOfCards = targetPlayer.getHand().size();
|
||||
if (numberOfCards < 1) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(targetPlayer.getHand());
|
||||
targetPlayer.moveCardsToExile(
|
||||
cards.getCards(game), source, game, false,
|
||||
CardUtil.getExileZoneId(game, source), sourceObject.getIdName()
|
||||
);
|
||||
cards.getCards(game)
|
||||
.stream()
|
||||
.filter(card -> game.getState().getZone(card.getId()) == Zone.EXILED)
|
||||
.forEach(card -> card.setFaceDown(true, game));
|
||||
targetPlayer.drawCards(numberOfCards, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class InducedAmnesiaReturnEffect extends OneShotEffect {
|
||||
|
||||
public InducedAmnesiaReturnEffect() {
|
||||
InducedAmnesiaReturnEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "return the exiled cards to their owner's hand";
|
||||
}
|
||||
|
||||
public InducedAmnesiaReturnEffect(final InducedAmnesiaReturnEffect effect) {
|
||||
private InducedAmnesiaReturnEffect(final InducedAmnesiaReturnEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
|
@ -104,23 +107,10 @@ class InducedAmnesiaReturnEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (controller != null && sourcePermanent != null) {
|
||||
UUID exileId = CardUtil.getCardExileZoneId(game, source.getSourceId(), true);
|
||||
int numberOfCards = 0;
|
||||
ExileZone exileZone = game.getExile().getExileZone(exileId);
|
||||
if (exileZone != null) {
|
||||
for (Card card : exileZone.getCards(game)) {
|
||||
numberOfCards++;
|
||||
card.moveToZone(Zone.HAND, source, game, true);
|
||||
card.setFaceDown(false, game);
|
||||
}
|
||||
}
|
||||
if (numberOfCards > 0) {
|
||||
game.informPlayers(sourcePermanent.getLogName() + ": " + controller.getLogName() + " returns " + numberOfCards + " card" + (numberOfCards > 1 ? "s" : "") + " from exile to hand");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source));
|
||||
return controller != null
|
||||
&& exileZone != null
|
||||
&& !exileZone.isEmpty()
|
||||
&& controller.moveCards(exileZone, Zone.HAND, source, game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public final class KarnScionOfUrza extends CardImpl {
|
|||
this.addAbility(ability2);
|
||||
|
||||
// -2: Create a 0/0 colorless Construct artifact creature token with "This creature gets +1/+1 for each artifact you control."
|
||||
LoyaltyAbility ability3 = new LoyaltyAbility(new KarnConstructEffect(), -2);
|
||||
LoyaltyAbility ability3 = new LoyaltyAbility(new CreateTokenEffect(new KarnConstructToken(), 1), -2);
|
||||
ability3.addHint(ArtifactYouControlHint.instance);
|
||||
this.addAbility(ability3);
|
||||
}
|
||||
|
|
@ -61,12 +61,13 @@ public final class KarnScionOfUrza extends CardImpl {
|
|||
|
||||
class KarnPlus1Effect extends OneShotEffect {
|
||||
|
||||
public KarnPlus1Effect() {
|
||||
KarnPlus1Effect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "Reveal the top two cards of your library. An opponent chooses one of them. Put that card into your hand and exile the other with a silver counter on it.";
|
||||
this.staticText = "Reveal the top two cards of your library. An opponent chooses one of them. " +
|
||||
"Put that card into your hand and exile the other with a silver counter on it.";
|
||||
}
|
||||
|
||||
public KarnPlus1Effect(final KarnPlus1Effect effect) {
|
||||
private KarnPlus1Effect(final KarnPlus1Effect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
|
@ -79,43 +80,44 @@ class KarnPlus1Effect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (sourceObject != null && controller != null) {
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 2));
|
||||
if (sourceObject == null || controller == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 2));
|
||||
|
||||
if (!cards.isEmpty()) {
|
||||
controller.revealCards(staticText, cards, game);
|
||||
Card cardToHand;
|
||||
if (cards.size() == 1) {
|
||||
cardToHand = cards.getRandom(game);
|
||||
} else {
|
||||
Player opponent;
|
||||
Set<UUID> opponents = game.getOpponents(controller.getId());
|
||||
if (opponents.size() == 1) {
|
||||
opponent = game.getPlayer(opponents.iterator().next());
|
||||
} else {
|
||||
Target target = new TargetOpponent(true);
|
||||
controller.chooseTarget(Outcome.Detriment, target, source, game);
|
||||
opponent = game.getPlayer(target.getFirstTarget());
|
||||
}
|
||||
TargetCard target = new TargetCard(1, Zone.LIBRARY, new FilterCard());
|
||||
opponent.chooseTarget(outcome, cards, target, source, game);
|
||||
cardToHand = game.getCard(target.getFirstTarget());
|
||||
}
|
||||
if (cardToHand != null) {
|
||||
controller.moveCards(cardToHand, Zone.HAND, source, game);
|
||||
cards.remove(cardToHand);
|
||||
}
|
||||
|
||||
if (!cards.isEmpty()) {
|
||||
controller.moveCards(cards, Zone.EXILED, source, game);
|
||||
for (Card c : cards.getCards(game)) {
|
||||
c.addCounters(CounterType.SILVER.createInstance(1), source.getControllerId(), source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cards.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
controller.revealCards(staticText, cards, game);
|
||||
Card cardToHand;
|
||||
if (cards.size() == 1) {
|
||||
cardToHand = cards.getRandom(game);
|
||||
} else {
|
||||
Player opponent;
|
||||
Set<UUID> opponents = game.getOpponents(controller.getId());
|
||||
if (opponents.size() == 1) {
|
||||
opponent = game.getPlayer(opponents.iterator().next());
|
||||
} else {
|
||||
Target target = new TargetOpponent(true);
|
||||
controller.chooseTarget(Outcome.Detriment, target, source, game);
|
||||
opponent = game.getPlayer(target.getFirstTarget());
|
||||
}
|
||||
TargetCard target = new TargetCard(1, Zone.LIBRARY, new FilterCard());
|
||||
opponent.chooseTarget(outcome, cards, target, source, game);
|
||||
cardToHand = game.getCard(target.getFirstTarget());
|
||||
}
|
||||
if (cardToHand != null) {
|
||||
controller.moveCards(cardToHand, Zone.HAND, source, game);
|
||||
cards.remove(cardToHand);
|
||||
}
|
||||
|
||||
if (!cards.isEmpty()) {
|
||||
controller.moveCards(cards, Zone.EXILED, source, game);
|
||||
for (Card c : cards.getCards(game)) {
|
||||
c.addCounters(CounterType.SILVER.createInstance(1), source.getControllerId(), source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -127,12 +129,12 @@ class KarnMinus1Effect extends OneShotEffect {
|
|||
filter.add(CounterType.SILVER.getPredicate());
|
||||
}
|
||||
|
||||
public KarnMinus1Effect() {
|
||||
KarnMinus1Effect() {
|
||||
super(Outcome.ReturnToHand);
|
||||
this.staticText = "Put a card you own with a silver counter on it from exile into your hand";
|
||||
}
|
||||
|
||||
public KarnMinus1Effect(final KarnMinus1Effect effect) {
|
||||
private KarnMinus1Effect(final KarnMinus1Effect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
|
@ -144,71 +146,41 @@ class KarnMinus1Effect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
ExileZone exZone = game.getExile().getPermanentExile(); // getExileZone(Zone.EXILED);
|
||||
if (exZone != null) {
|
||||
Card card = null;
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
ExileZone exZone = game.getExile().getPermanentExile(); // getExileZone(Zone.EXILED);
|
||||
if (exZone == null) {
|
||||
return true;
|
||||
}
|
||||
Card card = null;
|
||||
|
||||
List<Card> exile = game.getExile().getAllCards(game);
|
||||
boolean noTargets = exile.isEmpty();
|
||||
if (noTargets) {
|
||||
game.informPlayer(controller, "You have no exiled cards.");
|
||||
return true;
|
||||
}
|
||||
List<Card> exile = game.getExile().getAllCards(game);
|
||||
boolean noTargets = exile.isEmpty();
|
||||
if (noTargets) {
|
||||
game.informPlayer(controller, "You have no exiled cards.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Cards filteredCards = new CardsImpl();
|
||||
Cards filteredCards = new CardsImpl();
|
||||
|
||||
for (Card exileCard : exile) {
|
||||
if (exileCard.isOwnedBy(source.getControllerId()) && filter.match(exileCard, game)) {
|
||||
filteredCards.add(exileCard);
|
||||
}
|
||||
}
|
||||
|
||||
TargetCard target = new TargetCard(Zone.EXILED, filter);
|
||||
target.setNotTarget(true);
|
||||
if (controller.choose(Outcome.Benefit, filteredCards, target, game)) {
|
||||
if (card == null) {
|
||||
card = game.getCard(target.getFirstTarget());
|
||||
}
|
||||
if (card != null) {
|
||||
card.moveToZone(Zone.HAND, source, game, false);
|
||||
Cards revealCard = new CardsImpl();
|
||||
revealCard.add(card);
|
||||
controller.revealCards("BLAHALJALJDSLAKJD", revealCard, game);
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
}
|
||||
}
|
||||
for (Card exileCard : exile) {
|
||||
if (exileCard.isOwnedBy(source.getControllerId()) && filter.match(exileCard, game)) {
|
||||
filteredCards.add(exileCard);
|
||||
}
|
||||
}
|
||||
|
||||
TargetCard target = new TargetCard(Zone.EXILED, filter);
|
||||
target.setNotTarget(true);
|
||||
if (!controller.choose(Outcome.Benefit, filteredCards, target, game)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class KarnConstructEffect extends OneShotEffect {
|
||||
|
||||
public KarnConstructEffect() {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
this.staticText = "Create a 0/0 colorless Construct artifact creature token with \"This creature gets +1/+1 for each artifact you control.\"";
|
||||
}
|
||||
|
||||
public KarnConstructEffect(final KarnConstructEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public KarnConstructEffect copy() {
|
||||
return new KarnConstructEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
CreateTokenEffect effect = new CreateTokenEffect(new KarnConstructToken(), 1);
|
||||
effect.apply(game, source);
|
||||
return true;
|
||||
if (card == null) {
|
||||
card = game.getCard(target.getFirstTarget());
|
||||
}
|
||||
return false;
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
|
||||
|
||||
package mage.cards.k;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
|
|
@ -11,38 +8,35 @@ import mage.abilities.effects.mana.AddManaOfAnyColorEffect;
|
|||
import mage.abilities.mana.SimpleManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledLandPermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author maurer.it_at_gmail.com
|
||||
*/
|
||||
public final class KhalniGem extends CardImpl {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledLandPermanent();
|
||||
|
||||
public KhalniGem (UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}");
|
||||
public KhalniGem(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
|
||||
|
||||
// When Khalni Gem enters the battlefield, return two lands you control to their owner's hand.
|
||||
Ability etbAbility = new EntersBattlefieldTriggeredAbility(new KhalniGemReturnToHandTargetEffect());
|
||||
Target target = new TargetControlledPermanent(2, 2, filter, false);
|
||||
etbAbility.addTarget(target);
|
||||
this.addAbility(etbAbility);
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new KhalniGemReturnToHandTargetEffect()));
|
||||
|
||||
// {tap}: Add two mana of any one color.
|
||||
SimpleManaAbility ability = new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(2), new TapSourceCost());
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new SimpleManaAbility(
|
||||
Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(2), new TapSourceCost()
|
||||
));
|
||||
}
|
||||
|
||||
public KhalniGem (final KhalniGem card) {
|
||||
private KhalniGem(final KhalniGem card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
@ -50,36 +44,41 @@ public final class KhalniGem extends CardImpl {
|
|||
public KhalniGem copy() {
|
||||
return new KhalniGem(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class KhalniGemReturnToHandTargetEffect extends OneShotEffect {
|
||||
|
||||
private static final String effectText = "return two lands you control to their owner's hand";
|
||||
|
||||
KhalniGemReturnToHandTargetEffect ( ) {
|
||||
KhalniGemReturnToHandTargetEffect() {
|
||||
super(Outcome.ReturnToHand);
|
||||
staticText = effectText;
|
||||
}
|
||||
|
||||
KhalniGemReturnToHandTargetEffect ( KhalniGemReturnToHandTargetEffect effect ) {
|
||||
private KhalniGemReturnToHandTargetEffect(KhalniGemReturnToHandTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for ( UUID target : targetPointer.getTargets(game, source) ) {
|
||||
Permanent permanent = game.getPermanent(target);
|
||||
if ( permanent != null ) {
|
||||
permanent.moveToZone(Zone.HAND, source, game, true);
|
||||
}
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
int landCount = game.getBattlefield().count(
|
||||
StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND,
|
||||
source.getSourceId(), source.getControllerId(), game
|
||||
);
|
||||
if (player == null || landCount < 1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
TargetPermanent target = new TargetPermanent(
|
||||
Math.min(landCount, 2), StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND
|
||||
);
|
||||
target.setNotTarget(true);
|
||||
player.choose(outcome, target, source.getSourceId(), game);
|
||||
return player.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public KhalniGemReturnToHandTargetEffect copy() {
|
||||
return new KhalniGemReturnToHandTargetEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package mage.cards.l;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
|
@ -7,32 +8,43 @@ import mage.abilities.common.SimpleStaticAbility;
|
|||
import mage.abilities.common.delayed.AtTheBeginOfCombatDelayedTriggeredAbility;
|
||||
import mage.abilities.costs.common.ExileSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTargets;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class LegionsInitiative extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filterRedCreature = new FilterCreaturePermanent("Red creatures");
|
||||
private static final FilterCreaturePermanent filterWhiteCreature = new FilterCreaturePermanent("White creatures");
|
||||
private static final FilterCreaturePermanent filterRedCreature
|
||||
= new FilterCreaturePermanent("Red creatures");
|
||||
private static final FilterCreaturePermanent filterWhiteCreature
|
||||
= new FilterCreaturePermanent("White creatures");
|
||||
|
||||
static {
|
||||
filterRedCreature.add(new ColorPredicate(ObjectColor.RED));
|
||||
|
|
@ -43,13 +55,20 @@ public final class LegionsInitiative extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{R}{W}");
|
||||
|
||||
// Red creatures you control get +1/+0.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 0, Duration.WhileOnBattlefield, filterRedCreature)));
|
||||
this.addAbility(new SimpleStaticAbility(new BoostControlledEffect(
|
||||
1, 0, Duration.WhileOnBattlefield, filterRedCreature
|
||||
)));
|
||||
|
||||
// White creatures you control get +0/+1.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(0, 1, Duration.WhileOnBattlefield, filterWhiteCreature)));
|
||||
this.addAbility(new SimpleStaticAbility(new BoostControlledEffect(
|
||||
0, 1, Duration.WhileOnBattlefield, filterWhiteCreature
|
||||
)));
|
||||
|
||||
// {R}{W}, Exile Legion's Initiative: Exile all creatures you control. At the beginning of the next combat, return those cards to the battlefield under their owner's control and those creatures gain haste until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new LegionsInitiativeExileEffect(), new ManaCostsImpl("{R}{W}"));
|
||||
Ability ability = new SimpleActivatedAbility(new LegionsInitiativeExileEffect(), new ManaCostsImpl("{R}{W}"));
|
||||
ability.addEffect(new CreateDelayedTriggeredAbilityEffect(
|
||||
new AtTheBeginOfCombatDelayedTriggeredAbility(new LegionsInitiativeReturnFromExileEffect())
|
||||
));
|
||||
ability.addCost(new ExileSourceCost());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
@ -66,38 +85,31 @@ public final class LegionsInitiative extends CardImpl {
|
|||
|
||||
class LegionsInitiativeExileEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent("all creatures you control");
|
||||
|
||||
static {
|
||||
filter.add(TargetController.YOU.getControllerPredicate());
|
||||
filter.add(CardType.CREATURE.getPredicate());
|
||||
}
|
||||
|
||||
public LegionsInitiativeExileEffect() {
|
||||
LegionsInitiativeExileEffect() {
|
||||
super(Outcome.Detriment);
|
||||
staticText = "Exile all creatures you control. At the beginning of the next combat, return those cards to the battlefield under their owner's control and those creatures gain haste until end of turn";
|
||||
staticText = "Exile all creatures you control.";
|
||||
}
|
||||
|
||||
public LegionsInitiativeExileEffect(final LegionsInitiativeExileEffect effect) {
|
||||
private LegionsInitiativeExileEffect(final LegionsInitiativeExileEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
boolean creatureExiled = false;
|
||||
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||
if (creature != null) {
|
||||
if (creature.moveToExile(source.getSourceId(), "Legion's Initiative", source, game)) {
|
||||
creatureExiled = true;
|
||||
}
|
||||
}
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (player == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
if (creatureExiled) {
|
||||
//create delayed triggered ability
|
||||
AtTheBeginOfCombatDelayedTriggeredAbility delayedAbility = new AtTheBeginOfCombatDelayedTriggeredAbility(new LegionsInitiativeReturnFromExileEffect());
|
||||
game.addDelayedTriggeredAbility(delayedAbility, source);
|
||||
}
|
||||
return true;
|
||||
Cards cards = new CardsImpl();
|
||||
game.getBattlefield().getActivePermanents(
|
||||
StaticFilters.FILTER_CONTROLLED_CREATURE,
|
||||
source.getControllerId(), source.getSourceId(), game
|
||||
).stream().filter(Objects::nonNull).forEach(cards::add);
|
||||
return player.moveCardsToExile(
|
||||
cards.getCards(game), source, game, true,
|
||||
CardUtil.getExileZoneId(game, source), sourceObject.getIdName()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -108,12 +120,13 @@ class LegionsInitiativeExileEffect extends OneShotEffect {
|
|||
|
||||
class LegionsInitiativeReturnFromExileEffect extends OneShotEffect {
|
||||
|
||||
public LegionsInitiativeReturnFromExileEffect() {
|
||||
LegionsInitiativeReturnFromExileEffect() {
|
||||
super(Outcome.PutCardInPlay);
|
||||
staticText = "At the beginning of the next combat, return those cards to the battlefield under their owner's control and those creatures gain haste until end of turn";
|
||||
staticText = "return those cards to the battlefield under their owner's control " +
|
||||
"and those creatures gain haste until end of turn";
|
||||
}
|
||||
|
||||
public LegionsInitiativeReturnFromExileEffect(final LegionsInitiativeReturnFromExileEffect effect) {
|
||||
private LegionsInitiativeReturnFromExileEffect(final LegionsInitiativeReturnFromExileEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
|
@ -124,25 +137,20 @@ class LegionsInitiativeReturnFromExileEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
ExileZone exile = game.getExile().getExileZone(source.getSourceId());
|
||||
if (exile != null) {
|
||||
exile = exile.copy();
|
||||
for (UUID cardId : exile) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
card.moveToZone(Zone.BATTLEFIELD, source, game, false);
|
||||
Permanent returnedCreature = game.getPermanent(cardId);
|
||||
if (returnedCreature != null) {
|
||||
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(returnedCreature.getId()));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
game.getExile().getExileZone(source.getSourceId()).clear();
|
||||
return true;
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source));
|
||||
if (player == null || exile == null || exile.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
Cards cards = new CardsImpl(exile);
|
||||
player.moveCards(cards, Zone.BATTLEFIELD, source, game);
|
||||
List<Permanent> permanents = cards.stream().map(game::getPermanent).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
if (permanents.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
game.addEffect(new GainAbilityTargetEffect(
|
||||
HasteAbility.getInstance(), Duration.EndOfTurn
|
||||
).setTargetPointer(new FixedTargets(permanents, game)), source);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CounterTargetEffect;
|
||||
|
|
@ -12,18 +10,19 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.TargetSpell;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public final class LostInTheMist extends CardImpl {
|
||||
|
||||
public LostInTheMist(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{U}{U}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}{U}");
|
||||
|
||||
// Counter target spell. Return target permanent to its owner's hand.
|
||||
this.getSpellAbility().addTarget(new TargetSpell());
|
||||
|
|
@ -44,12 +43,12 @@ public final class LostInTheMist extends CardImpl {
|
|||
|
||||
class LostInTheMistEffect extends OneShotEffect {
|
||||
|
||||
public LostInTheMistEffect() {
|
||||
LostInTheMistEffect() {
|
||||
super(Outcome.ReturnToHand);
|
||||
this.staticText = "Return target permanent to its owner's hand";
|
||||
}
|
||||
|
||||
public LostInTheMistEffect(final LostInTheMistEffect effect) {
|
||||
private LostInTheMistEffect(final LostInTheMistEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
|
@ -60,10 +59,10 @@ class LostInTheMistEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
if (permanent != null) {
|
||||
return permanent.moveToZone(Zone.HAND, source, game, false);
|
||||
}
|
||||
return false;
|
||||
return player != null
|
||||
&& permanent != null
|
||||
&& player.moveCards(permanent, Zone.HAND, source, game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue