1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-02 03:18:09 -09:00

implemented Mask of the Mimic

This commit is contained in:
Evan Kranzler 2018-05-02 09:26:37 -04:00
parent b6bad9ca96
commit c824d012d1
2 changed files with 112 additions and 0 deletions
Mage.Sets/src/mage

View file

@ -0,0 +1,111 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.m;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterCard;
import static mage.filter.StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public class MaskOfTheMimic extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nontoken creature");
static {
filter.add(Predicates.not(new TokenPredicate()));
}
public MaskOfTheMimic(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}");
// As an additional cost to cast Mask of the Mimic, sacrifice a creature.
this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT)));
// Search your library for a card with the same name as target nontoken creature and put that card onto the battlefield. Then shuffle your library.
this.getSpellAbility().addEffect(new MaskOfTheMimicEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
}
public MaskOfTheMimic(final MaskOfTheMimic card) {
super(card);
}
@Override
public MaskOfTheMimic copy() {
return new MaskOfTheMimic(this);
}
}
class MaskOfTheMimicEffect extends OneShotEffect {
MaskOfTheMimicEffect() {
super(Outcome.Benefit);
this.staticText = "Search your library for a card with the same name as target nontoken creature "
+ "and put that card onto the battlefield. Then shuffle your library.";
}
MaskOfTheMimicEffect(final MaskOfTheMimicEffect effect) {
super(effect);
}
@Override
public MaskOfTheMimicEffect copy() {
return new MaskOfTheMimicEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(source.getFirstTarget());
if (creature == null) {
return false;
}
FilterCard filter = new FilterCard("a card named " + creature.getName());
filter.add(new NamePredicate(creature.getName()));
return new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)).apply(game, source);
}
}

View file

@ -113,6 +113,7 @@ public class Stronghold extends ExpansionSet {
cards.add(new SetCardInfo("Leap", 35, Rarity.COMMON, mage.cards.l.Leap.class));
cards.add(new SetCardInfo("Lowland Basilisk", 59, Rarity.COMMON, mage.cards.l.LowlandBasilisk.class));
cards.add(new SetCardInfo("Mana Leak", 36, Rarity.COMMON, mage.cards.m.ManaLeak.class));
cards.add(new SetCardInfo("Mask of the Mimic", 37, Rarity.UNCOMMON, mage.cards.m.MaskOfTheMimic.class));
cards.add(new SetCardInfo("Megrim", 12, Rarity.UNCOMMON, mage.cards.m.Megrim.class));
cards.add(new SetCardInfo("Mind Games", 38, Rarity.COMMON, mage.cards.m.MindGames.class));
cards.add(new SetCardInfo("Mind Peel", 13, Rarity.UNCOMMON, mage.cards.m.MindPeel.class));