mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Implemented Escape to the Wilds
This commit is contained in:
parent
d557e6a27e
commit
2bc056278d
2 changed files with 120 additions and 0 deletions
119
Mage.Sets/src/mage/cards/e/EscapeToTheWilds.java
Normal file
119
Mage.Sets/src/mage/cards/e/EscapeToTheWilds.java
Normal file
|
@ -0,0 +1,119 @@
|
|||
package mage.cards.e;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.PlayAdditionalLandsControllerEffect;
|
||||
import mage.cards.*;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class EscapeToTheWilds extends CardImpl {
|
||||
|
||||
public EscapeToTheWilds(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}{G}");
|
||||
|
||||
// Exile the top five cards of your library. You may play cards exiled this way until the end of your next turn.
|
||||
// You may play an additional land this turn.
|
||||
this.getSpellAbility().addEffect(new EscapeToTheWildsEffect());
|
||||
}
|
||||
|
||||
private EscapeToTheWilds(final EscapeToTheWilds card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EscapeToTheWilds copy() {
|
||||
return new EscapeToTheWilds(this);
|
||||
}
|
||||
}
|
||||
|
||||
class EscapeToTheWildsEffect extends OneShotEffect {
|
||||
|
||||
EscapeToTheWildsEffect() {
|
||||
super(Outcome.PlayForFree);
|
||||
this.staticText = "Exile the top five cards of your library. " +
|
||||
"You may play cards exiled this way until the end of your next turn.<br>" +
|
||||
"You may play an additional land this turn.";
|
||||
}
|
||||
|
||||
private EscapeToTheWildsEffect(final EscapeToTheWildsEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EscapeToTheWildsEffect copy() {
|
||||
return new EscapeToTheWildsEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 5));
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
controller.moveCards(cards, Zone.EXILED, source, game);
|
||||
|
||||
cards.getCards(game).stream().forEach(card -> {
|
||||
ContinuousEffect effect = new EscapeToTheWildsMayPlayEffect();
|
||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||
game.addEffect(effect, source);
|
||||
});
|
||||
game.addEffect(new PlayAdditionalLandsControllerEffect(1, Duration.EndOfTurn), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class EscapeToTheWildsMayPlayEffect extends AsThoughEffectImpl {
|
||||
|
||||
private int castOnTurn = 0;
|
||||
|
||||
EscapeToTheWildsMayPlayEffect() {
|
||||
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.Custom, Outcome.Benefit);
|
||||
this.staticText = "Until the end of your next turn, you may play that card.";
|
||||
}
|
||||
|
||||
private EscapeToTheWildsMayPlayEffect(final EscapeToTheWildsMayPlayEffect effect) {
|
||||
super(effect);
|
||||
castOnTurn = effect.castOnTurn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EscapeToTheWildsMayPlayEffect copy() {
|
||||
return new EscapeToTheWildsMayPlayEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
castOnTurn = game.getTurnNum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInactive(Ability source, Game game) {
|
||||
return castOnTurn != game.getTurnNum()
|
||||
&& game.getPhase().getStep().getType() == PhaseStep.END_TURN
|
||||
&& game.isActivePlayer(source.getControllerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
|
||||
return source.isControlledBy(affectedControllerId)
|
||||
&& getTargetPointer().getTargets(game, source).contains(sourceId);
|
||||
}
|
||||
}
|
|
@ -75,6 +75,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Emry, Lurker of the Loch", 43, Rarity.RARE, mage.cards.e.EmryLurkerOfTheLoch.class));
|
||||
cards.add(new SetCardInfo("Enchanted Carriage", 218, Rarity.UNCOMMON, mage.cards.e.EnchantedCarriage.class));
|
||||
cards.add(new SetCardInfo("Epic Downfall", 85, Rarity.UNCOMMON, mage.cards.e.EpicDownfall.class));
|
||||
cards.add(new SetCardInfo("Escape to the Wilds", 189, Rarity.RARE, mage.cards.e.EscapeToTheWilds.class));
|
||||
cards.add(new SetCardInfo("Eye Collector", 86, Rarity.COMMON, mage.cards.e.EyeCollector.class));
|
||||
cards.add(new SetCardInfo("Faeburrow Elder", 190, Rarity.RARE, mage.cards.f.FaeburrowElder.class));
|
||||
cards.add(new SetCardInfo("Faerie Formation", 316, Rarity.RARE, mage.cards.f.FaerieFormation.class));
|
||||
|
|
Loading…
Reference in a new issue