Implemented Ether Well

This commit is contained in:
Evan Kranzler 2019-01-27 09:29:52 -05:00
parent eff0bb0e63
commit f537ae2aea
2 changed files with 75 additions and 0 deletions

View file

@ -0,0 +1,74 @@
package mage.cards.e;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class EtherWell extends CardImpl {
public EtherWell(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}");
// Put target creature on top of its owner's library. If that creature is red, you may put it on the bottom of its owner's library instead.
this.getSpellAbility().addEffect(new EtherWellEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
private EtherWell(final EtherWell card) {
super(card);
}
@Override
public EtherWell copy() {
return new EtherWell(this);
}
}
class EtherWellEffect extends OneShotEffect {
EtherWellEffect() {
super(Outcome.Benefit);
staticText = "Put target creature on top of its owner's library. " +
"If that creature is red, you may put it on the bottom of its owner's library instead.";
}
private EtherWellEffect(final EtherWellEffect effect) {
super(effect);
}
@Override
public EtherWellEffect copy() {
return new EtherWellEffect(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;
}
if (permanent.getColor(game).isRed()
&& player.chooseUse(outcome, "Put " + permanent.getLogName() +
" on the bottom of its owner's library?", source, game
)) {
player.putCardsOnBottomOfLibrary(permanent, game, source, true);
return true;
}
player.putCardsOnTopOfLibrary(new CardsImpl(permanent), game, source, true);
return true;
}
}

View file

@ -106,6 +106,7 @@ public final class Mirage extends ExpansionSet {
cards.add(new SetCardInfo("Enfeeblement", 121, Rarity.COMMON, mage.cards.e.Enfeeblement.class));
cards.add(new SetCardInfo("Enlightened Tutor", 14, Rarity.UNCOMMON, mage.cards.e.EnlightenedTutor.class));
cards.add(new SetCardInfo("Ersatz Gnomes", 301, Rarity.UNCOMMON, mage.cards.e.ErsatzGnomes.class));
cards.add(new SetCardInfo("Ether Well", 65, Rarity.UNCOMMON, mage.cards.e.EtherWell.class));
cards.add(new SetCardInfo("Ethereal Champion", 15, Rarity.RARE, mage.cards.e.EtherealChampion.class));
cards.add(new SetCardInfo("Fallow Earth", 214, Rarity.UNCOMMON, mage.cards.f.FallowEarth.class));
cards.add(new SetCardInfo("Favorable Destiny", 16, Rarity.UNCOMMON, mage.cards.f.FavorableDestiny.class));