From 2b4bf16cecad0fce1a6e4c24741d56c2ad04bc3c Mon Sep 17 00:00:00 2001 From: spjspj Date: Sun, 2 Jul 2017 12:15:05 +1000 Subject: [PATCH] Implement 2 HOU cards --- .../src/mage/cards/v/VizierOfTheAnointed.java | 194 ++++++++++++++++++ .../src/mage/cards/w/WithoutWeakness.java | 67 ++++++ .../src/mage/sets/HourOfDevastation.java | 2 + 3 files changed, 263 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/v/VizierOfTheAnointed.java create mode 100644 Mage.Sets/src/mage/cards/w/WithoutWeakness.java diff --git a/Mage.Sets/src/mage/cards/v/VizierOfTheAnointed.java b/Mage.Sets/src/mage/cards/v/VizierOfTheAnointed.java new file mode 100644 index 00000000000..c96f633ee1c --- /dev/null +++ b/Mage.Sets/src/mage/cards/v/VizierOfTheAnointed.java @@ -0,0 +1,194 @@ +/* + * 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.v; + +import java.util.UUID; +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Abilities; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.SearchEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.keyword.EmbalmAbility; +import mage.abilities.keyword.EternalizeAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicate; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.stack.StackAbility; +import mage.players.Player; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author spjspj + */ +public class VizierOfTheAnointed extends CardImpl { + + private static final FilterCard filter = new FilterCard("a creature card with eternalize or embalm"); + + static { + filter.add(new CardTypePredicate(CardType.CREATURE)); + filter.add(new VizierOfTheAnointedAbilityPredicate()); + } + + public VizierOfTheAnointed(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}"); + + this.subtype.add("Human"); + this.subtype.add("Cleric"); + this.power = new MageInt(2); + this.toughness = new MageInt(4); + + // When Vizier of the Anointed enters the battlefield, you may search your library for a creature card with eternalize or embalm, put that card into your graveyard, then shuffle your library. + this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInGraveyard(filter), true)); + + // Whenever you activate an eternalize or embalm ability, draw a card. + this.addAbility(new VizierOfTheAnointedTriggeredAbility()); + + } + + public VizierOfTheAnointed(final VizierOfTheAnointed card) { + super(card); + } + + @Override + public VizierOfTheAnointed copy() { + return new VizierOfTheAnointed(this); + } +} + +class VizierOfTheAnointedAbilityPredicate implements Predicate { + + public VizierOfTheAnointedAbilityPredicate() { + } + + @Override + public boolean apply(MageObject input, Game game) { + Abilities abilities = input.getAbilities(); + for (int i = 0; i < abilities.size(); i++) { + if (abilities.get(i) instanceof EmbalmAbility) { + return true; + } + if (abilities.get(i) instanceof EternalizeAbility) { + return true; + } + } + return false; + } + + @Override + public String toString() { + return "Creature card with Eternalize or Embalm"; + } +} + +class VizierOfTheAnointedTriggeredAbility extends TriggeredAbilityImpl { + + VizierOfTheAnointedTriggeredAbility() { + super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), true); + } + + VizierOfTheAnointedTriggeredAbility(final VizierOfTheAnointedTriggeredAbility ability) { + super(ability); + } + + @Override + public VizierOfTheAnointedTriggeredAbility copy() { + return new VizierOfTheAnointedTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getPlayerId().equals(getControllerId())) { + Card source = game.getPermanentOrLKIBattlefield(event.getSourceId()); + if (source != null) { + StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId()); + if (stackAbility.getStackAbility() instanceof EternalizeAbility + || stackAbility.getStackAbility() instanceof EmbalmAbility) { + return true; + } + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever you activate an ability of an artifact or creature that isn't a mana ability, " + super.getRule(); + } +} + +class SearchLibraryPutInGraveyard extends SearchEffect { + + public SearchLibraryPutInGraveyard(FilterCard filter) { + super(new TargetCardInLibrary(filter), Outcome.Neutral); + staticText = "a creature card with eternalize or embalm, put that card into your graveyard, then shuffle your library."; + } + + public SearchLibraryPutInGraveyard(final SearchLibraryPutInGraveyard effect) { + super(effect); + } + + @Override + public SearchLibraryPutInGraveyard copy() { + return new SearchLibraryPutInGraveyard(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + if (controller.searchLibrary(target, game)) { + if (!target.getTargets().isEmpty()) { + Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); + if (card != null) { + controller.moveCards(card, Zone.GRAVEYARD, source, game); + } + } + } + controller.shuffleLibrary(source, game); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/cards/w/WithoutWeakness.java b/Mage.Sets/src/mage/cards/w/WithoutWeakness.java new file mode 100644 index 00000000000..b847c3a379c --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WithoutWeakness.java @@ -0,0 +1,67 @@ +/* + * 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.w; + +import java.util.UUID; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.CyclingAbility; +import mage.abilities.keyword.IndestructibleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author spjspj + */ +public class WithoutWeakness extends CardImpl { + + public WithoutWeakness(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}"); + + // Target creature you control gains indestructible until end of turn. + this.getSpellAbility().addEffect(new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn)); + this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); + + // Cycling {2} + this.addAbility(new CyclingAbility(new ManaCostsImpl("{2}"))); + + } + + public WithoutWeakness(final WithoutWeakness card) { + super(card); + } + + @Override + public WithoutWeakness copy() { + return new WithoutWeakness(this); + } +} diff --git a/Mage.Sets/src/mage/sets/HourOfDevastation.java b/Mage.Sets/src/mage/sets/HourOfDevastation.java index e5d04fe9bd7..b320a23f775 100644 --- a/Mage.Sets/src/mage/sets/HourOfDevastation.java +++ b/Mage.Sets/src/mage/sets/HourOfDevastation.java @@ -147,10 +147,12 @@ public class HourOfDevastation extends ExpansionSet { cards.add(new SetCardInfo("Unraveling Mummy", 147, Rarity.UNCOMMON, mage.cards.u.UnravelingMummy.class)); cards.add(new SetCardInfo("Unsummon", 54, Rarity.COMMON, mage.cards.u.Unsummon.class)); cards.add(new SetCardInfo("Visage of Bolas", 208, Rarity.RARE, mage.cards.v.VisageOfBolas.class)); + cards.add(new SetCardInfo("Vizier of the Anointed", 55, Rarity.UNCOMMON, mage.cards.v.VizierOfTheAnointed.class)); cards.add(new SetCardInfo("Vizier of the True", 28, Rarity.UNCOMMON, mage.cards.v.VizierOfTheTrue.class)); cards.add(new SetCardInfo("Wall of Forgotten Pharaohs", 168, Rarity.COMMON, mage.cards.w.WallOfForgottenPharaohs.class)); cards.add(new SetCardInfo("Wasp of the Bitter End", 206, Rarity.UNCOMMON, mage.cards.w.WaspOfTheBitterEnd.class)); cards.add(new SetCardInfo("Wildfire Eternal", 109, Rarity.RARE, mage.cards.w.WildfireEternal.class)); + cards.add(new SetCardInfo("Without Weakness", 81, Rarity.COMMON, mage.cards.w.WithoutWeakness.class)); cards.add(new SetCardInfo("Woodland Stream", 204, Rarity.COMMON, mage.cards.w.WoodlandStream.class)); cards.add(new SetCardInfo("Wretched Camel", 82, Rarity.COMMON, mage.cards.w.WretchedCamel.class)); cards.add(new SetCardInfo("Zealot of the God-Pharaoh", 207, Rarity.COMMON, mage.cards.z.ZealotOfTheGodPharaoh.class));