forked from External/mage
implement [MH3] Essence Reliquary
This commit is contained in:
parent
eadf214b42
commit
18bcfb5498
2 changed files with 94 additions and 0 deletions
93
Mage.Sets/src/mage/cards/e/EssenceReliquary.java
Normal file
93
Mage.Sets/src/mage/cards/e/EssenceReliquary.java
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
package mage.cards.e;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||
import mage.abilities.condition.common.MyTurnCondition;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
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.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public final class EssenceReliquary extends CardImpl {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("another target permanent you control");
|
||||
|
||||
static {
|
||||
filter.add(AnotherPredicate.instance);
|
||||
}
|
||||
|
||||
public EssenceReliquary(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{W}");
|
||||
|
||||
// {T}: Return another target permanent you control and all Auras you control attached to it to their owner's hand. Activate only during your turn.
|
||||
Ability ability = new ActivateIfConditionActivatedAbility(
|
||||
new EssenceReliquaryTargetEffect(),
|
||||
new TapSourceCost(), MyTurnCondition.instance
|
||||
);
|
||||
ability.addTarget(new TargetControlledPermanent(filter));
|
||||
}
|
||||
|
||||
private EssenceReliquary(final EssenceReliquary card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EssenceReliquary copy() {
|
||||
return new EssenceReliquary(this);
|
||||
}
|
||||
}
|
||||
|
||||
class EssenceReliquaryTargetEffect extends OneShotEffect {
|
||||
|
||||
EssenceReliquaryTargetEffect() {
|
||||
super(Outcome.ReturnToHand);
|
||||
this.staticText = "Return target creature you control and all Auras you control attached to it to their owner's hand";
|
||||
}
|
||||
|
||||
private EssenceReliquaryTargetEffect(final EssenceReliquaryTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EssenceReliquaryTargetEffect copy() {
|
||||
return new EssenceReliquaryTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
if (player == null || permanent == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(permanent);
|
||||
cards.addAll(permanent.getAttachments()
|
||||
.stream()
|
||||
.map(game::getPermanent)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(p -> p.isControlledBy(source.getControllerId()))
|
||||
.filter(p -> p.hasSubtype(SubType.AURA, game))
|
||||
.map(Permanent::getId)
|
||||
.collect(Collectors.toList()));
|
||||
return player.moveCards(cards, Zone.HAND, source, game);
|
||||
}
|
||||
}
|
||||
|
|
@ -92,6 +92,7 @@ public final class ModernHorizons3 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Emrakul's Messenger", 61, Rarity.UNCOMMON, mage.cards.e.EmrakulsMessenger.class));
|
||||
cards.add(new SetCardInfo("Emrakul, the World Anew", 6, Rarity.MYTHIC, mage.cards.e.EmrakulTheWorldAnew.class));
|
||||
cards.add(new SetCardInfo("Envoy of the Ancestors", 23, Rarity.UNCOMMON, mage.cards.e.EnvoyOfTheAncestors.class));
|
||||
cards.add(new SetCardInfo("Essence Reliquary", 24, Rarity.UNCOMMON, mage.cards.e.EssenceReliquary.class));
|
||||
cards.add(new SetCardInfo("Estrid's Invocation", 269, Rarity.RARE, mage.cards.e.EstridsInvocation.class));
|
||||
cards.add(new SetCardInfo("Etherium Pteramander", 92, Rarity.UNCOMMON, mage.cards.e.EtheriumPteramander.class));
|
||||
cards.add(new SetCardInfo("Eviscerator's Insight", 93, Rarity.COMMON, mage.cards.e.EvisceratorsInsight.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue