Implemented Watcher for Tomorrow

This commit is contained in:
Evan Kranzler 2019-06-01 19:43:39 -04:00
parent fc9c8287c3
commit 7130b5acd4
3 changed files with 96 additions and 4 deletions

View file

@ -0,0 +1,82 @@
package mage.cards.w;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.HideawayAbility;
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.game.ExileZone;
import mage.game.Game;
import mage.players.Player;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class WatcherForTomorrow extends CardImpl {
public WatcherForTomorrow(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Hideaway
this.addAbility(new HideawayAbility("creatures"));
// When Watcher for Tomorrow leaves the battlefield, put the exiled card into its owner's hand.
this.addAbility(new LeavesBattlefieldTriggeredAbility(new WatcherForTomorrowEffect(), false));
}
private WatcherForTomorrow(final WatcherForTomorrow card) {
super(card);
}
@Override
public WatcherForTomorrow copy() {
return new WatcherForTomorrow(this);
}
}
class WatcherForTomorrowEffect extends OneShotEffect {
WatcherForTomorrowEffect() {
super(Outcome.Benefit);
staticText = "put the exiled card into its owner's hand";
}
private WatcherForTomorrowEffect(final WatcherForTomorrowEffect effect) {
super(effect);
}
@Override
public WatcherForTomorrowEffect copy() {
return new WatcherForTomorrowEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
ExileZone zone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source));
if (zone == null) {
return false;
}
Cards cards = new CardsImpl(zone.getCards(game));
return player.moveCards(cards, Zone.HAND, source, game);
}
}

View file

@ -255,6 +255,7 @@ public final class ModernHorizons extends ExpansionSet {
cards.add(new SetCardInfo("Wall of Blossoms", 190, Rarity.UNCOMMON, mage.cards.w.WallOfBlossoms.class));
cards.add(new SetCardInfo("Wall of One Thousand Cuts", 36, Rarity.COMMON, mage.cards.w.WallOfOneThousandCuts.class));
cards.add(new SetCardInfo("Warteye Witch", 115, Rarity.COMMON, mage.cards.w.WarteyeWitch.class));
cards.add(new SetCardInfo("Watcher for Tomorrow", 76, Rarity.UNCOMMON, mage.cards.w.WatcherForTomorrow.class));
cards.add(new SetCardInfo("Waterlogged Grove", 249, Rarity.RARE, mage.cards.w.WaterloggedGrove.class));
cards.add(new SetCardInfo("Weather the Storm", 191, Rarity.COMMON, mage.cards.w.WeatherTheStorm.class));
cards.add(new SetCardInfo("Webweaver Changeling", 192, Rarity.UNCOMMON, mage.cards.w.WebweaverChangeling.class));

View file

@ -1,7 +1,6 @@
package mage.abilities.keyword;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.StaticAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -25,9 +24,11 @@ import mage.players.Player;
import mage.target.TargetCard;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author LevelX2
*
* <p>
* 702.74. Hideaway 702.74a Hideaway represents a static ability and a triggered
* ability. "Hideaway" means "This permanent enters the battlefield tapped" and
* "When this permanent enters the battlefield, look at the top four cards of
@ -38,7 +39,13 @@ import mage.util.CardUtil;
*/
public class HideawayAbility extends StaticAbility {
private final String name;
public HideawayAbility() {
this("land");
}
public HideawayAbility(String name) {
super(Zone.ALL, new EntersBattlefieldEffect(new TapSourceEffect(true)));
Ability ability = new EntersBattlefieldTriggeredAbility(new HideawayExileEffect(), false);
ability.setRuleVisible(false);
@ -47,15 +54,17 @@ public class HideawayAbility extends StaticAbility {
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new HideawayLookAtFaceDownCardEffect());
ability.setRuleVisible(false);
addSubAbility(ability);
this.name = name;
}
public HideawayAbility(final HideawayAbility ability) {
private HideawayAbility(final HideawayAbility ability) {
super(ability);
this.name = ability.name;
}
@Override
public String getRule() {
return "Hideaway <i>(This land enters the battlefield tapped. When it does, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.)</i>";
return "Hideaway <i>(This " + this.name + " enters the battlefield tapped. When it does, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.)</i>";
}
@Override