diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java index 49399a7889b..1ba65e80b42 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java @@ -507,7 +507,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { if (target instanceof TargetDiscard || target instanceof TargetCardInHand) { if (outcome.isGood()) { ArrayList cardsInHand = new ArrayList<>(hand.getCards(game)); - while (!target.isChosen() && !cardsInHand.isEmpty() && target.getMaxNumberOfTargets() < target.getTargets().size()) { + while (!target.isChosen() && !cardsInHand.isEmpty() && target.getMaxNumberOfTargets() > target.getTargets().size()) { Card card = pickBestCard(cardsInHand, null, target, source, game); if (card != null) { if (target.canTarget(card.getId(), source, game)) { diff --git a/Mage.Sets/src/mage/sets/archenemy/Fertilid.java b/Mage.Sets/src/mage/sets/archenemy/Fertilid.java new file mode 100644 index 00000000000..df59cab005e --- /dev/null +++ b/Mage.Sets/src/mage/sets/archenemy/Fertilid.java @@ -0,0 +1,52 @@ +/* + * 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.sets.archenemy; + +import java.util.UUID; + +/** + * + * @author ilcartographer + */ +public class Fertilid extends mage.sets.commander.Fertilid { + + public Fertilid(UUID ownerId) { + super(ownerId); + this.cardNumber = 54; + this.expansionSetCode = "ARC"; + } + + public Fertilid(final Fertilid card) { + super(card); + } + + @Override + public Fertilid copy() { + return new Fertilid(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/DescendantsPath.java b/Mage.Sets/src/mage/sets/avacynrestored/DescendantsPath.java index d181d91f344..a6f0e7964a5 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/DescendantsPath.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/DescendantsPath.java @@ -27,7 +27,6 @@ */ package mage.sets.avacynrestored; -import java.util.ArrayList; import java.util.UUID; import mage.constants.CardType; @@ -42,11 +41,10 @@ import mage.cards.CardsImpl; import mage.constants.Outcome; import mage.constants.TargetController; import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.Predicate; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; +import mage.game.permanent.Permanent; import mage.players.Player; +import mage.util.CardUtil; /** * @@ -59,7 +57,6 @@ public class DescendantsPath extends CardImpl { super(ownerId, 173, "Descendants' Path", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); this.expansionSetCode = "AVR"; - // At the beginning of your upkeep, reveal the top card of your library. If it's a creature card that shares a creature type with a creature you control, you may cast that card without paying its mana cost. Otherwise, put that card on the bottom of your library. Ability ability = new BeginningOfUpkeepTriggeredAbility(new DescendantsPathEffect(), TargetController.YOU, false); this.addAbility(ability); @@ -93,36 +90,39 @@ class DescendantsPathEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player != null) { - if (player.getLibrary().size() > 0) { - Card card = player.getLibrary().getFromTop(game); - player.revealCards("DescendantsPath", new CardsImpl(card), game); - if (card.getCardType().contains(CardType.CREATURE)) { + Player controller = game.getPlayer(source.getControllerId()); + MageObject sourceObject = source.getSourceObject(game); + if (controller != null && sourceObject != null) { + if (controller.getLibrary().size() > 0) { + Card card = controller.getLibrary().getFromTop(game); + if (card == null) { + return false; + } + controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game); + if (card.getCardType().contains(CardType.CREATURE)) { FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(); - - ArrayList> subtypes = new ArrayList<>(); - for (String subtype: card.getSubtype()) { - subtypes.add(new SubtypePredicate(subtype)); + boolean found = false; + for (Permanent permanent: game.getBattlefield().getAllActivePermanents(filter, controller.getId(), game)) { + if (CardUtil.shareSubtypes(card, permanent)) { + found = true; + break; + } } - filter.add(Predicates.or(subtypes)); - - int count = game.getBattlefield().getAllActivePermanents(filter, player.getId(), game).size(); - if (count > 0) { - game.informPlayers("DescendantsPath: Found a creature that shares a creature type with the revealed card."); - if (player.chooseUse(Outcome.Benefit, "Cast the card?", game)) { - player.cast(card.getSpellAbility(), game, true); + if (found) { + game.informPlayers(sourceObject.getLogName() + ": Found a creature that shares a creature type with the revealed card."); + if (controller.chooseUse(Outcome.Benefit, "Cast the card?", game)) { + controller.cast(card.getSpellAbility(), game, true); } else { - game.informPlayers("DescendantsPath: " + player.getLogName() + " canceled casting the card."); - player.getLibrary().putOnBottom(card, game); + game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " canceled casting the card."); + controller.getLibrary().putOnBottom(card, game); } } else { - game.informPlayers("DescendantsPath: No creature that shares a creature type with the revealed card."); - player.getLibrary().putOnBottom(card, game); + game.informPlayers(sourceObject.getLogName() + ": No creature that shares a creature type with the revealed card."); + controller.getLibrary().putOnBottom(card, game); } } else { - game.informPlayers("DescendantsPath: put " + card.getName() + " on the bottom."); - player.getLibrary().putOnBottom(card, game); + game.informPlayers(sourceObject.getLogName() + ": Put " + card.getLogName() + " on the bottom."); + controller.getLibrary().putOnBottom(card, game); } return true; diff --git a/Mage.Sets/src/mage/sets/commander/DreambornMuse.java b/Mage.Sets/src/mage/sets/commander/DreambornMuse.java new file mode 100644 index 00000000000..93fbd3f00b2 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander/DreambornMuse.java @@ -0,0 +1,52 @@ +/* + * 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.sets.commander; + +import java.util.UUID; + +/** + * + * @author anonymous + */ +public class DreambornMuse extends mage.sets.legions.DreambornMuse { + + public DreambornMuse(UUID ownerId) { + super(ownerId); + this.cardNumber = 44; + this.expansionSetCode = "CMD"; + } + + public DreambornMuse(final DreambornMuse card) { + super(card); + } + + @Override + public DreambornMuse copy() { + return new DreambornMuse(this); + } +} diff --git a/Mage.Sets/src/mage/sets/commander/Fertilid.java b/Mage.Sets/src/mage/sets/commander/Fertilid.java new file mode 100644 index 00000000000..c0b3132f69c --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander/Fertilid.java @@ -0,0 +1,80 @@ +/* + * 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.sets.commander; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.RemoveCountersSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInPlayTargetPlayerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.common.FilterBasicLandCard; +import mage.target.TargetPlayer; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author ilcartographer + */ +public class Fertilid extends CardImpl { + + public Fertilid(UUID ownerId) { + super(ownerId, 154, "Fertilid", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{G}"); + this.expansionSetCode = "CMD"; + this.subtype.add("Elemental"); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Fertilid enters the battlefield with two +1/+1 counters on it. + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)), "with two +1/+1 counters on it")); + + // {1}{G}, Remove a +1/+1 counter from Fertilid: Target player searches his or her library for a basic land card and puts it onto the battlefield tapped. Then that player shuffles his or her library. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, + new SearchLibraryPutInPlayTargetPlayerEffect(new TargetCardInLibrary(new FilterBasicLandCard()), true, true), new ManaCostsImpl("{1}{G}")); + ability.addCost(new RemoveCountersSourceCost(CounterType.P1P1.createInstance(1))); + ability.addTarget(new TargetPlayer()); + this.addAbility(ability); + } + + public Fertilid(final Fertilid card) { + super(card); + } + + @Override + public Fertilid copy() { + return new Fertilid(this); + } +} diff --git a/Mage.Sets/src/mage/sets/darksteel/GreaterHarvester.java b/Mage.Sets/src/mage/sets/darksteel/GreaterHarvester.java new file mode 100644 index 00000000000..b5dc2a20201 --- /dev/null +++ b/Mage.Sets/src/mage/sets/darksteel/GreaterHarvester.java @@ -0,0 +1,106 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.sets.darksteel; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.SacrificeEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.game.Game; +import mage.game.events.DamagedPlayerEvent; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author wanderer120 + */ +public class GreaterHarvester extends CardImpl { + + public static final FilterPermanent filter = new FilterPermanent("a permanent"); + + static { + filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), + new CardTypePredicate(CardType.CREATURE), + new CardTypePredicate(CardType.ENCHANTMENT), + new CardTypePredicate(CardType.PLANESWALKER), + new CardTypePredicate(CardType.LAND))); + } + + public GreaterHarvester(UUID ownerId) { + super(ownerId, 44, "Greater Harvester", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{B}{B}{B}"); + this.expansionSetCode = "DST"; + this.subtype.add("Horror"); + + this.power = new MageInt(5); + this.toughness = new MageInt(6); + + // At the beginning of your upkeep, sacrifice a permanent. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new SacrificeEffect(filter, 1, ""), TargetController.YOU, false)); + + //Whenever Greater Harvester deals combat damage to a player, that player sacrifices two permanents. + this.addAbility(new GreaterHarvesterAbility()); + } + + public GreaterHarvester(final GreaterHarvester card) { + super(card); + } + + @Override + public GreaterHarvester copy() { + return new GreaterHarvester(this); + } +} + +class GreaterHarvesterAbility extends TriggeredAbilityImpl { + + public GreaterHarvesterAbility() { + super(Zone.BATTLEFIELD, new SacrificeEffect(new FilterPermanent(), 2, "")); + } + + public GreaterHarvesterAbility(final GreaterHarvesterAbility ability) { + super(ability); + } + + @Override + public GreaterHarvesterAbility copy() { + return new GreaterHarvesterAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return EventType.DAMAGED_PLAYER.equals(event.getType()); + } + + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; + if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); + } + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever {this} deals combat damage to a player, that player sacrifices two permanent."; + } +} diff --git a/Mage.Sets/src/mage/sets/dissension/PainMagnification.java b/Mage.Sets/src/mage/sets/dissension/PainMagnification.java new file mode 100644 index 00000000000..418356ea74f --- /dev/null +++ b/Mage.Sets/src/mage/sets/dissension/PainMagnification.java @@ -0,0 +1,105 @@ +/* + * 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.sets.dissension; + +import java.util.UUID; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.discard.DiscardTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author ilcartographer + */ +public class PainMagnification extends CardImpl { + + public PainMagnification(UUID ownerId) { + super(ownerId, 121, "Pain Magnification", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}{R}"); + this.expansionSetCode = "DIS"; + + // Whenever an opponent is dealt 3 or more damage by a single source, that player discards a card. + this.addAbility(new PainMagnificationTriggeredAbility()); + } + + public PainMagnification(final PainMagnification card) { + super(card); + } + + @Override + public PainMagnification copy() { + return new PainMagnification(this); + } +} + +class PainMagnificationTriggeredAbility extends TriggeredAbilityImpl { + + public PainMagnificationTriggeredAbility() { + super(Zone.BATTLEFIELD, new DiscardTargetEffect(1), false); + } + + public PainMagnificationTriggeredAbility(final PainMagnificationTriggeredAbility ability) { + super(ability); + } + + @Override + public PainMagnificationTriggeredAbility copy() { + return new PainMagnificationTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + // If the damaged player is an opponent + if (game.getOpponents(getControllerId()).contains(event.getPlayerId())) { + if(event.getAmount() >= 3) { + // If at least 3 damage is dealt, set the opponent as the Discard target + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); + } + return true; + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever an opponent is dealt 3 or more damage by a single source, that player discards a card."; + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/TeysaEnvoyOfGhosts.java b/Mage.Sets/src/mage/sets/dragonsmaze/TeysaEnvoyOfGhosts.java index 720cbf0e21c..bab770d4b87 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/TeysaEnvoyOfGhosts.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/TeysaEnvoyOfGhosts.java @@ -100,16 +100,19 @@ class TeysaEnvoyOfGhostsTriggeredAbility extends TriggeredAbilityImpl { return new TeysaEnvoyOfGhostsTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - Permanent p = game.getPermanent(event.getSourceId()); - if (damageEvent.getPlayerId().equals(controllerId) && damageEvent.isCombatDamage() && p != null && p.getCardType().contains(CardType.CREATURE)) { - game.getState().setValue(sourceId.toString(), p.getControllerId()); - getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId())); - return true; - } + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; + Permanent sourcePermanent = game.getPermanent(event.getSourceId()); + if (damageEvent.getPlayerId().equals(getControllerId()) && damageEvent.isCombatDamage() && sourcePermanent != null && sourcePermanent.getCardType().contains(CardType.CREATURE)) { + game.getState().setValue(sourceId.toString(), sourcePermanent.getControllerId()); + getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/exodus/ElvishBerserker.java b/Mage.Sets/src/mage/sets/exodus/ElvishBerserker.java new file mode 100644 index 00000000000..1f8625c7cf2 --- /dev/null +++ b/Mage.Sets/src/mage/sets/exodus/ElvishBerserker.java @@ -0,0 +1,52 @@ +/* + * 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.sets.exodus; + +import java.util.UUID; + +/** + * + * @author ilcartographer + */ +public class ElvishBerserker extends mage.sets.ninthedition.ElvishBerserker { + + public ElvishBerserker(UUID ownerId) { + super(ownerId); + this.cardNumber = 110; + this.expansionSetCode = "EXO"; + } + + public ElvishBerserker(final ElvishBerserker card) { + super(card); + } + + @Override + public ElvishBerserker copy() { + return new ElvishBerserker(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fifthedition/TheWretched.java b/Mage.Sets/src/mage/sets/fifthedition/TheWretched.java index 9554817d948..bfe1f16d8a4 100644 --- a/Mage.Sets/src/mage/sets/fifthedition/TheWretched.java +++ b/Mage.Sets/src/mage/sets/fifthedition/TheWretched.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.EndOfCombatTriggeredAbility; import mage.abilities.condition.common.SourceOnBattlefieldControlUnchangedCondition; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.effects.ContinuousEffect; @@ -77,7 +78,7 @@ public class TheWretched extends CardImpl { this.toughness = new MageInt(5); // At end of combat, gain control of all creatures blocking The Wretched for as long as you control The Wretched. - this.addAbility(new EndOfAnyCombatTriggeredAbility(), new BlockedAttackerWatcher()); + this.addAbility(new EndOfCombatTriggeredAbility(new TheWretchedEffect(), false), new BlockedAttackerWatcher()); } @@ -91,37 +92,6 @@ public class TheWretched extends CardImpl { } } -class EndOfAnyCombatTriggeredAbility extends TriggeredAbilityImpl { - - EndOfAnyCombatTriggeredAbility() { - super(Zone.BATTLEFIELD, new TheWretchedEffect(), false); - } - - EndOfAnyCombatTriggeredAbility(final EndOfAnyCombatTriggeredAbility ability) { - super(ability); - } - - @Override - public EndOfAnyCombatTriggeredAbility copy() { - return new EndOfAnyCombatTriggeredAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.END_COMBAT_STEP_PRE; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - return true; - } - - @Override - public String getRule() { - return "At the end of combat, gain control of all creatures blocking {this} for as long as you control {this}."; - } -} - class TheWretchedEffect extends OneShotEffect { TheWretchedEffect() { diff --git a/Mage.Sets/src/mage/sets/legions/DreambornMuse.java b/Mage.Sets/src/mage/sets/legions/DreambornMuse.java new file mode 100644 index 00000000000..f2e6b86c256 --- /dev/null +++ b/Mage.Sets/src/mage/sets/legions/DreambornMuse.java @@ -0,0 +1,68 @@ +/* + * 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.sets.legions; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.dynamicvalue.common.CardsInTargetPlayerHandCount; +import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; + +/** + * + * @author cbrianhill + */ +public class DreambornMuse extends CardImpl { + + public DreambornMuse(UUID ownerId) { + super(ownerId, 36, "Dreamborn Muse", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{U}{U}"); + this.expansionSetCode = "LGN"; + this.subtype.add("Spirit"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // At the beginning of each player's upkeep, that player puts the top X cards of his or her library into his or her graveyard, where X is the number of cards in his or her hand. + PutLibraryIntoGraveTargetEffect effect = new PutLibraryIntoGraveTargetEffect(new CardsInTargetPlayerHandCount()); + effect.setText("that player puts the top X cards of his or her library into his or her graveyard, where X is the number of cards in his or her hand."); + this.addAbility(new BeginningOfUpkeepTriggeredAbility(effect, TargetController.ANY, false)); + + } + + public DreambornMuse(final DreambornMuse card) { + super(card); + } + + @Override + public DreambornMuse copy() { + return new DreambornMuse(this); + } +} diff --git a/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java b/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java new file mode 100644 index 00000000000..a92d4b2eaa9 --- /dev/null +++ b/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java @@ -0,0 +1,112 @@ +/* + * 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.sets.lorwyn; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.continuous.BecomesBasicLandTargetEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Layer; +import mage.constants.Rarity; +import mage.constants.SubLayer; +import mage.counters.CounterType; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetLandPermanent; + +/** + * + * @author ilcartographer + */ +public class AquitectsWill extends CardImpl { + + public AquitectsWill(UUID ownerId) { + super(ownerId, 52, "Aquitect's Will", Rarity.COMMON, new CardType[]{CardType.TRIBAL, CardType.SORCERY}, "{U}"); + this.expansionSetCode = "LRW"; + this.subtype.add("Merfolk"); + + // Put a flood counter on target land. + this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.FLOOD.createInstance())); + this.getSpellAbility().addTarget(new TargetLandPermanent()); + + // That land is an Island in addition to its other types for as long as it has a flood counter on it. + this.getSpellAbility().addEffect(new AquitectsWillEffect(Duration.Custom, false, false, "Island")); + + // If you control a Merfolk, draw a card. + this.getSpellAbility().addEffect(new ConditionalOneShotEffect( + new DrawCardSourceControllerEffect(1), + new PermanentsOnTheBattlefieldCondition(new FilterControlledCreaturePermanent("Merfolk", "Merfolk")), + "If you control a Merfolk, draw a card")); + } + + public AquitectsWill(final AquitectsWill card) { + super(card); + } + + @Override + public AquitectsWill copy() { + return new AquitectsWill(this); + } +} + +class AquitectsWillEffect extends BecomesBasicLandTargetEffect { + + public AquitectsWillEffect(Duration duration, boolean chooseLandType, boolean loseType, String... landNames) { + super(duration, chooseLandType, loseType, landNames); + staticText = "That land is an Island in addition to its other types for as long as it has a flood counter on it"; + } + + public AquitectsWillEffect(final AquitectsWillEffect effect) { + super(effect); + } + + @Override + public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { + Permanent land = game.getPermanent(this.targetPointer.getFirst(game, source)); + if (land == null) { + // if permanent left battlefield the effect can be removed because it was only valid for that object + this.discard(); + } else if (land.getCounters().getCount(CounterType.FLOOD) > 0) { + // only if Flood counter is on the object it becomes an Island.(it would be possible to remove and return the counters with e.g. Fate Transfer if the land becomes a creature too) + super.apply(layer, sublayer, source, game); + } + return true; + } + + @Override + public AquitectsWillEffect copy() { + return new AquitectsWillEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/CatacombSlug.java b/Mage.Sets/src/mage/sets/magicorigins/CatacombSlug.java index 38ceb429d07..ab61208dc24 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/CatacombSlug.java +++ b/Mage.Sets/src/mage/sets/magicorigins/CatacombSlug.java @@ -37,7 +37,7 @@ public class CatacombSlug extends mage.sets.returntoravnica.CatacombSlug { public CatacombSlug(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 998; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/ChandrasFury.java b/Mage.Sets/src/mage/sets/magicorigins/ChandrasFury.java index 7aafc1d8ef6..9415221491c 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/ChandrasFury.java +++ b/Mage.Sets/src/mage/sets/magicorigins/ChandrasFury.java @@ -37,7 +37,7 @@ public class ChandrasFury extends mage.sets.magic2013.ChandrasFury { public ChandrasFury(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 997; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/ChargingGriffin.java b/Mage.Sets/src/mage/sets/magicorigins/ChargingGriffin.java index 3cbc9c975af..60c62df9cbd 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/ChargingGriffin.java +++ b/Mage.Sets/src/mage/sets/magicorigins/ChargingGriffin.java @@ -37,7 +37,7 @@ public class ChargingGriffin extends mage.sets.magic2014.ChargingGriffin { public ChargingGriffin(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 996; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/Claustrophobia.java b/Mage.Sets/src/mage/sets/magicorigins/Claustrophobia.java index b363d80e591..ef033f9db46 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/Claustrophobia.java +++ b/Mage.Sets/src/mage/sets/magicorigins/Claustrophobia.java @@ -37,7 +37,7 @@ public class Claustrophobia extends mage.sets.innistrad.Claustrophobia { public Claustrophobia(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 995; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/Cobblebrute.java b/Mage.Sets/src/mage/sets/magicorigins/Cobblebrute.java index 97349a0e0e7..7c282ccd931 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/Cobblebrute.java +++ b/Mage.Sets/src/mage/sets/magicorigins/Cobblebrute.java @@ -37,7 +37,7 @@ public class Cobblebrute extends mage.sets.returntoravnica.Cobblebrute { public Cobblebrute(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 994; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/ConclaveNaturalists.java b/Mage.Sets/src/mage/sets/magicorigins/ConclaveNaturalists.java new file mode 100644 index 00000000000..d7e12aefcca --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/ConclaveNaturalists.java @@ -0,0 +1,68 @@ +/* + * 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.sets.magicorigins; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; +import mage.target.TargetPermanent; + +/** + * + * @author emerald000 + */ +public class ConclaveNaturalists extends CardImpl { + + public ConclaveNaturalists(UUID ownerId) { + super(ownerId, 171, "Conclave Naturalists", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{4}{G}"); + this.expansionSetCode = "ORI"; + this.subtype.add("Dryad"); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // When Conclave Naturalists enters the battlefield, you may destroy target artifact or enchantment. + Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(), true); + ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); + this.addAbility(ability); + } + + public ConclaveNaturalists(final ConclaveNaturalists card) { + super(card); + } + + @Override + public ConclaveNaturalists copy() { + return new ConclaveNaturalists(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/CruelRevival.java b/Mage.Sets/src/mage/sets/magicorigins/CruelRevival.java index 7682e5befe8..c82e1c25a66 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/CruelRevival.java +++ b/Mage.Sets/src/mage/sets/magicorigins/CruelRevival.java @@ -37,7 +37,7 @@ public class CruelRevival extends mage.sets.onslaught.CruelRevival { public CruelRevival(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 993; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/Disperse.java b/Mage.Sets/src/mage/sets/magicorigins/Disperse.java index 7581651100b..962e36434b6 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/Disperse.java +++ b/Mage.Sets/src/mage/sets/magicorigins/Disperse.java @@ -37,7 +37,7 @@ public class Disperse extends mage.sets.scarsofmirrodin.Disperse { public Disperse(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 992; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/ElvishVisionary.java b/Mage.Sets/src/mage/sets/magicorigins/ElvishVisionary.java index d901aee1be2..4b13a997457 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/ElvishVisionary.java +++ b/Mage.Sets/src/mage/sets/magicorigins/ElvishVisionary.java @@ -37,7 +37,7 @@ public class ElvishVisionary extends mage.sets.shardsofalara.ElvishVisionary { public ElvishVisionary(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 991; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/FieryConclusion.java b/Mage.Sets/src/mage/sets/magicorigins/FieryConclusion.java index a973a8e8d1b..92348e1805a 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/FieryConclusion.java +++ b/Mage.Sets/src/mage/sets/magicorigins/FieryConclusion.java @@ -37,7 +37,7 @@ public class FieryConclusion extends mage.sets.ravnica.FieryConclusion { public FieryConclusion(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 990; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/GideonBattleForged.java b/Mage.Sets/src/mage/sets/magicorigins/GideonBattleForged.java new file mode 100644 index 00000000000..5c291b6c299 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/GideonBattleForged.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.sets.magicorigins; + +import java.util.UUID; +import mage.MageInt; +import mage.MageObjectReference; +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.RequirementEffect; +import mage.abilities.effects.common.PreventAllDamageToSourceEffect; +import mage.abilities.effects.common.UntapTargetEffect; +import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.IndestructibleAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.TurnPhase; +import mage.counters.CounterType; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.Token; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class GideonBattleForged extends CardImpl { + + private final static FilterCreaturePermanent filter = new FilterCreaturePermanent(); + + static { + filter.add(new ControllerPredicate(TargetController.OPPONENT)); + } + + public GideonBattleForged(UUID ownerId) { + super(ownerId, 23, "Gideon, Battle-Forged", Rarity.MYTHIC, new CardType[]{CardType.PLANESWALKER}, ""); + this.expansionSetCode = "ORI"; + this.subtype.add("Gideon"); + + this.color.setWhite(true); + + this.nightCard = true; + this.canTransform = true; + + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false)); + + // +2: Up to one target creature an opponent controls attacks Gideon, Battle-Forged during its controller's next turn if able. + LoyaltyAbility loyaltyAbility = new LoyaltyAbility(new GideonBattleForgedAttacksIfAbleTargetEffect(Duration.Custom), 2); + loyaltyAbility.addTarget(new TargetCreaturePermanent(0,1,filter, false)); + this.addAbility(loyaltyAbility); + + // +1: Until your next turn, target creature gains indestructible. Untap that creature. + Effect effect = new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.UntilYourNextTurn); + effect.setText("Until your next turn, target creature gains indestructible"); + loyaltyAbility = new LoyaltyAbility(effect, 1); + effect = new UntapTargetEffect(); + effect.setText("Untap that creature"); + loyaltyAbility.addEffect(effect); + this.addAbility(loyaltyAbility); + + // 0: Until end of turn, Gideon, Battle-Forged becomes a 4/4 Human Soldier creature with indestructible that's still a planeswalker. Prevent all damage that would be dealt to him this turn. + LoyaltyAbility ability3 = new LoyaltyAbility(new BecomesCreatureSourceEffect(new GideonBattleForgedToken(), "planeswalker", Duration.EndOfTurn), 0); + effect = new PreventAllDamageToSourceEffect(Duration.EndOfTurn); + effect.setText("Prevent all damage that would be dealt to him this turn"); + ability3.addEffect(effect); + this.addAbility(ability3); + + } + + public GideonBattleForged(final GideonBattleForged card) { + super(card); + } + + @Override + public GideonBattleForged copy() { + return new GideonBattleForged(this); + } +} + +class GideonBattleForgedToken extends Token { + + public GideonBattleForgedToken() { + super("", "4/4 Human Soldier creature with indestructible"); + cardType.add(CardType.CREATURE); + subtype.add("Human"); + subtype.add("Soldier"); + power = new MageInt(4); + toughness = new MageInt(4); + this.addAbility(IndestructibleAbility.getInstance()); + } + +} + +class GideonBattleForgedAttacksIfAbleTargetEffect extends RequirementEffect { + + int nextTurnTargetController = 0; + protected MageObjectReference targetPermanentReference; + + public GideonBattleForgedAttacksIfAbleTargetEffect(Duration duration) { + super(duration); + staticText = "Up to one target creature an opponent controls attacks {this} during its controller's next turn if able"; + } + + public GideonBattleForgedAttacksIfAbleTargetEffect(final GideonBattleForgedAttacksIfAbleTargetEffect effect) { + super(effect); + this.nextTurnTargetController = effect.nextTurnTargetController; + this.targetPermanentReference = effect.targetPermanentReference; + } + + @Override + public GideonBattleForgedAttacksIfAbleTargetEffect copy() { + return new GideonBattleForgedAttacksIfAbleTargetEffect(this); + } + + @Override + public boolean isInactive(Ability source, Game game) { + Permanent targetPermanent = targetPermanentReference.getPermanent(game); + if (targetPermanent == null) { + return false; + } + if (nextTurnTargetController == 0 && startingTurn != game.getTurnNum() && game.getActivePlayerId().equals(targetPermanent.getControllerId())) { + nextTurnTargetController = game.getTurnNum(); + } + return game.getPhase().getType() == TurnPhase.END && game.getTurnNum() > nextTurnTargetController; + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + if (permanent.getId().equals(getTargetPointer().getFirst(game, source))) { + if (game.getActivePlayerId().equals(permanent.getControllerId())) { + Permanent planeswalker = game.getPermanent(source.getSourceId()); + if (planeswalker != null) { + if (planeswalker.getCardType().contains(CardType.CREATURE)) { + return true; + } + } else { + discard(); + } + } + } + return false; + } + + @Override + public UUID mustAttackDefender(Ability source, Game game) { + return source.getSourceId(); + } + + @Override + public boolean mustAttack(Game game) { + return true; + } + + @Override + public boolean mustBlock(Game game) { + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/GoldForgedSentinel.java b/Mage.Sets/src/mage/sets/magicorigins/GoldForgedSentinel.java index 418337f87b1..6d2b6f15f2c 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/GoldForgedSentinel.java +++ b/Mage.Sets/src/mage/sets/magicorigins/GoldForgedSentinel.java @@ -37,7 +37,7 @@ public class GoldForgedSentinel extends mage.sets.journeyintonyx.GoldForgedSenti public GoldForgedSentinel(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 989; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/GraspOfTheHieromancer.java b/Mage.Sets/src/mage/sets/magicorigins/GraspOfTheHieromancer.java new file mode 100644 index 00000000000..811fabbf54a --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/GraspOfTheHieromancer.java @@ -0,0 +1,138 @@ +/* + * 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.sets.magicorigins; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.TapTargetEffect; +import mage.abilities.effects.common.continuous.BoostEnchantedEffect; +import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SetTargetPointer; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class GraspOfTheHieromancer extends CardImpl { + + public GraspOfTheHieromancer(UUID ownerId) { + super(ownerId, 15, "Grasp of the Hieromancer", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}"); + this.expansionSetCode = "ORI"; + this.subtype.add("Aura"); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature gets +1/+1 and has "Whenever this creature attacks, tap target creature defending player controls." + ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(1, 1, Duration.WhileOnBattlefield)); + Ability gainedAbility = new GraspOfTheHieromancerTriggeredAbility(new TapTargetEffect(), false); + gainedAbility.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature defending player controls"))); + Effect effect = new GainAbilityAttachedEffect(gainedAbility, AttachmentType.AURA); + effect.setText("and has \"Whenever this creature attacks, tap target creature defending player controls.\""); + ability.addEffect(effect); + this.addAbility(ability); + + } + + public GraspOfTheHieromancer(final GraspOfTheHieromancer card) { + super(card); + } + + @Override + public GraspOfTheHieromancer copy() { + return new GraspOfTheHieromancer(this); + } +} + +class GraspOfTheHieromancerTriggeredAbility extends TriggeredAbilityImpl { + + + + public GraspOfTheHieromancerTriggeredAbility(Effect effect, boolean optional) { + super(Zone.BATTLEFIELD, effect, optional); + } + + public GraspOfTheHieromancerTriggeredAbility(final GraspOfTheHieromancerTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (game.getCombat().getAttackers().contains(getSourceId()) ) { + UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(getSourceId(), game); + if (defendingPlayerId != null) { + this.getTargets().clear(); + FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls"); + UUID defenderId = game.getCombat().getDefenderId(getSourceId()); + filter.add(new ControllerIdPredicate(defenderId)); + TargetCreaturePermanent target = new TargetCreaturePermanent(filter); + this.addTarget(target); + return true; + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever {this} attacks, tap target creature defending player controls."; + } + + @Override + public GraspOfTheHieromancerTriggeredAbility copy() { + return new GraspOfTheHieromancerTriggeredAbility(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/HeavyInfantry.java b/Mage.Sets/src/mage/sets/magicorigins/HeavyInfantry.java new file mode 100644 index 00000000000..5640bfc4bc4 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/HeavyInfantry.java @@ -0,0 +1,77 @@ +/* + * 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.sets.magicorigins; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.TapTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class HeavyInfantry extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls"); + + static { + filter.add(new ControllerPredicate(TargetController.OPPONENT)); + } + + public HeavyInfantry(UUID ownerId) { + super(ownerId, 18, "Heavy Infantry", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{W}"); + this.expansionSetCode = "ORI"; + this.subtype.add("Human"); + this.subtype.add("Soldier"); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // When Heavy Infantry enters the battlefield, tap target creature an opponent controls. + Ability ability = new EntersBattlefieldTriggeredAbility(new TapTargetEffect()); + ability.addTarget(new TargetCreaturePermanent(filter)); + this.addAbility(ability); + } + + public HeavyInfantry(final HeavyInfantry card) { + super(card); + } + + @Override + public HeavyInfantry copy() { + return new HeavyInfantry(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/HixusPrisonWarden.java b/Mage.Sets/src/mage/sets/magicorigins/HixusPrisonWarden.java new file mode 100644 index 00000000000..bc5db55e567 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/HixusPrisonWarden.java @@ -0,0 +1,159 @@ +/* + * 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.sets.magicorigins; + +import java.util.UUID; +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.delayed.OnLeaveReturnExiledToBattlefieldAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.abilities.keyword.FlashAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.DamagedPlayerEvent; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.target.targetpointer.FixedTarget; +import mage.util.CardUtil; + +/** + * + * @author LevelX2 + */ +public class HixusPrisonWarden extends CardImpl { + + public HixusPrisonWarden(UUID ownerId) { + super(ownerId, 19, "Hixus, Prison Warden", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{W}{W}"); + this.expansionSetCode = "ORI"; + this.supertype.add("Legendary"); + this.subtype.add("Human"); + this.subtype.add("Soldier"); + this.power = new MageInt(4); + this.toughness = new MageInt(44); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // Whenever a creature deals combat damage to you, if Hixus, Prison Warden entered the battlefield this turn, exile that creature until Hixus leaves the battlefield. + this.addAbility(new HixusPrisonWardenTriggeredAbility(new HixusPrisonWardenExileEffect())); + } + + public HixusPrisonWarden(final HixusPrisonWarden card) { + super(card); + } + + @Override + public HixusPrisonWarden copy() { + return new HixusPrisonWarden(this); + } +} + +class HixusPrisonWardenTriggeredAbility extends TriggeredAbilityImpl { + + public HixusPrisonWardenTriggeredAbility(Effect effect) { + super(Zone.BATTLEFIELD, effect); + this.addEffect(new CreateDelayedTriggeredAbilityEffect(new OnLeaveReturnExiledToBattlefieldAbility())); + } + + public HixusPrisonWardenTriggeredAbility(final HixusPrisonWardenTriggeredAbility ability) { + super(ability); + } + + @Override + public HixusPrisonWardenTriggeredAbility copy() { + return new HixusPrisonWardenTriggeredAbility(this); + } + + @Override + public boolean checkInterveningIfClause(Game game) { + MageObject mageObject = getSourceObject(game); + return (mageObject instanceof Permanent) && ((Permanent)mageObject).getTurnsOnBattlefield() ==1; + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; + Permanent sourcePermanent = game.getPermanent(event.getSourceId()); + if (damageEvent.getPlayerId().equals(getControllerId()) && + damageEvent.isCombatDamage() && + sourcePermanent != null && + sourcePermanent.getCardType().contains(CardType.CREATURE)) { + getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId())); + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever a creature deals combat damage to you, if {this} entered the battlefield this turn, exile that creature until {this} leaves the battlefield."; + } + +} + +class HixusPrisonWardenExileEffect extends OneShotEffect { + + public HixusPrisonWardenExileEffect() { + super(Outcome.Benefit); + this.staticText = "exile that creature until {this} leaves the battlefield"; + } + + public HixusPrisonWardenExileEffect(final HixusPrisonWardenExileEffect effect) { + super(effect); + } + + @Override + public HixusPrisonWardenExileEffect copy() { + return new HixusPrisonWardenExileEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); + // If Prison Warden leaves the battlefield before its triggered ability resolves, + // the target creature won't be exiled. + if (permanent != null) { + return new ExileTargetEffect(CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()), permanent.getIdName()).apply(game, source); + } + return false; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/magicorigins/JayemdaeTome.java b/Mage.Sets/src/mage/sets/magicorigins/JayemdaeTome.java index 8588e525641..4679bf67104 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/JayemdaeTome.java +++ b/Mage.Sets/src/mage/sets/magicorigins/JayemdaeTome.java @@ -38,7 +38,7 @@ public class JayemdaeTome extends mage.sets.tenthedition.JayemdaeTome { public JayemdaeTome(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 988; this.expansionSetCode = "ORI"; this.rarity = Rarity.UNCOMMON; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/KytheonHeroOfAkros.java b/Mage.Sets/src/mage/sets/magicorigins/KytheonHeroOfAkros.java new file mode 100644 index 00000000000..0da1c307fc7 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/KytheonHeroOfAkros.java @@ -0,0 +1,120 @@ +/* + * 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.sets.magicorigins; + +import java.util.UUID; +import mage.MageInt; +import mage.MageObjectReference; +import mage.abilities.Ability; +import mage.abilities.common.EndOfCombatTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.condition.Condition; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.decorator.ConditionalTriggeredAbility; +import mage.abilities.effects.common.ExileAndReturnTransformedSourceEffect; +import mage.abilities.effects.common.ExileAndReturnTransformedSourceEffect.Gender; +import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.abilities.keyword.IndestructibleAbility; +import mage.abilities.keyword.TransformAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.watchers.common.AttackedThisCombatWatcher; + +/** + * + * @author LevelX2 + */ +public class KytheonHeroOfAkros extends CardImpl { + + public KytheonHeroOfAkros(UUID ownerId) { + super(ownerId, 23, "Kytheon, Hero of Akros", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{W}"); + this.expansionSetCode = "ORI"; + this.supertype.add("Legendary"); + this.subtype.add("Human"); + this.subtype.add("Soldier"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + this.canTransform = true; + this.secondSideCard = new GideonBattleForged(ownerId); + + // At end of combat, if Kytheon, Hero of Akros and at least two other creatures attacked this combat, exile Kytheon, + // then return him to the battlefield transformed under his owner's control. + this.addAbility(new TransformAbility()); + this.addAbility(new ConditionalTriggeredAbility(new EndOfCombatTriggeredAbility(new ExileAndReturnTransformedSourceEffect(Gender.MALE), false), + new KytheonHeroOfAkrosCondition(), "At end of combat, if {this} and at least two other creatures attacked this combat, exile {this}, " + + "then return him to the battlefield transformed under his owner's control."), new AttackedThisCombatWatcher()); + + // {2}{W}: Kytheon gains indestructible until end of turn. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl<>("{2}{W}"))); + + } + + public KytheonHeroOfAkros(final KytheonHeroOfAkros card) { + super(card); + } + + @Override + public KytheonHeroOfAkros copy() { + return new KytheonHeroOfAkros(this); + } +} + +class KytheonHeroOfAkrosCondition implements Condition { + + @Override + public boolean apply(Game game, Ability source) { + Permanent sourceObject = game.getPermanent(source.getSourceId()); + if (sourceObject != null) { + AttackedThisCombatWatcher watcher = (AttackedThisCombatWatcher) game.getState().getWatchers().get("AttackedThisCombat"); + if (watcher != null) { + boolean sourceFound = false; + int number = 0; + for (MageObjectReference mor: watcher.getAttackedThisTurnCreatures()) { + if (mor.refersTo(sourceObject, game)) { + sourceFound = true; + } else { + number++; + } + } + return sourceFound && number >= 2; + } + } + return false; + } + + @Override + public String toString() { + return "if {this} and at least two other creatures attacked this combat"; + } +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/LeafGilder.java b/Mage.Sets/src/mage/sets/magicorigins/LeafGilder.java index 5c2ef28e0af..e4346108392 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/LeafGilder.java +++ b/Mage.Sets/src/mage/sets/magicorigins/LeafGilder.java @@ -37,7 +37,7 @@ public class LeafGilder extends mage.sets.lorwyn.LeafGilder { public LeafGilder(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 987; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/MantleOfWebs.java b/Mage.Sets/src/mage/sets/magicorigins/MantleOfWebs.java new file mode 100644 index 00000000000..5cd47e569ba --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/MantleOfWebs.java @@ -0,0 +1,82 @@ +/* + * 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.sets.magicorigins; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.BoostEnchantedEffect; +import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.keyword.ReachAbility; +import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author emerald000 + */ +public class MantleOfWebs extends CardImpl { + + public MantleOfWebs(UUID ownerId) { + super(ownerId, 187, "Mantle of Webs", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}"); + this.expansionSetCode = "ORI"; + this.subtype.add("Aura"); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature gets +1/+3 and has reach. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(1, 3, Duration.WhileOnBattlefield))); + Effect effect = new GainAbilityAttachedEffect(ReachAbility.getInstance(), AttachmentType.AURA); + effect.setText("and has reach"); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); + } + + public MantleOfWebs(final MantleOfWebs card) { + super(card); + } + + @Override + public MantleOfWebs copy() { + return new MantleOfWebs(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/MaritimeGuard.java b/Mage.Sets/src/mage/sets/magicorigins/MaritimeGuard.java index ffc48924a7a..5aefd0e3821 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/MaritimeGuard.java +++ b/Mage.Sets/src/mage/sets/magicorigins/MaritimeGuard.java @@ -37,7 +37,7 @@ public class MaritimeGuard extends mage.sets.magic2011.MaritimeGuard { public MaritimeGuard(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 986; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/Meteorite.java b/Mage.Sets/src/mage/sets/magicorigins/Meteorite.java index f76704a0dba..2996f3fa423 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/Meteorite.java +++ b/Mage.Sets/src/mage/sets/magicorigins/Meteorite.java @@ -37,7 +37,7 @@ public class Meteorite extends mage.sets.magic2015.Meteorite { public Meteorite(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 985; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/MightyLeap.java b/Mage.Sets/src/mage/sets/magicorigins/MightyLeap.java index ca7871a5d01..3686162a484 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/MightyLeap.java +++ b/Mage.Sets/src/mage/sets/magicorigins/MightyLeap.java @@ -37,7 +37,7 @@ public class MightyLeap extends mage.sets.magic2011.MightyLeap { public MightyLeap(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 984; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/NissaSageAnimist.java b/Mage.Sets/src/mage/sets/magicorigins/NissaSageAnimist.java new file mode 100644 index 00000000000..ff93fac4615 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/NissaSageAnimist.java @@ -0,0 +1,198 @@ +/* + * 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.sets.magicorigins; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.UntapTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Layer; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SubLayer; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.common.FilterLandPermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.Token; +import mage.players.Player; +import mage.target.common.TargetLandPermanent; + +/** + * + * @author emerald000 + */ +public class NissaSageAnimist extends CardImpl { + + public NissaSageAnimist(UUID ownerId) { + super(ownerId, 189, "Nissa, Sage Animist", Rarity.MYTHIC, new CardType[]{CardType.PLANESWALKER}, ""); + this.expansionSetCode = "ORI"; + this.subtype.add("Nissa"); + this.color.setGreen(true); + + this.nightCard = true; + this.canTransform = true; + + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false)); + + // +1: Reveal the top card of your library. If it's a land card, put it onto the battlefield. Otherwise, put it into your hand. + this.addAbility(new LoyaltyAbility(new NissaSageAnimistPlusOneEffect(), 1)); + + // -2: Put a legendary 4/4 green Elemental creature token named Ashaya, the Awoken World onto the battlefield. + this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new NissaSageAnimistToken()), -2)); + + // -7: Untap up to six target lands. They become 6/6 Elemental creatures. They're still lands. + Ability ability = new LoyaltyAbility(new UntapTargetEffect(), -7); + ability.addTarget(new TargetLandPermanent(0, 6, new FilterLandPermanent("lands"), false)); + ability.addEffect(new NissaSageAnimistMinusSevenEffect()); + this.addAbility(ability); + } + + public NissaSageAnimist(final NissaSageAnimist card) { + super(card); + } + + @Override + public NissaSageAnimist copy() { + return new NissaSageAnimist(this); + } +} + +class NissaSageAnimistPlusOneEffect extends OneShotEffect { + + NissaSageAnimistPlusOneEffect() { + super(Outcome.Benefit); + this.staticText = "Reveal the top card of your library. If it's a land card, put it onto the battlefield. Otherwise, put it into your hand."; + } + + NissaSageAnimistPlusOneEffect(final NissaSageAnimistPlusOneEffect effect) { + super(effect); + } + + @Override + public NissaSageAnimistPlusOneEffect copy() { + return new NissaSageAnimistPlusOneEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null && controller.getLibrary().size() > 0) { + Card card = controller.getLibrary().getFromTop(game); + if (card == null) { + return false; + } + CardsImpl cards = new CardsImpl(); + cards.add(card); + controller.revealCards("Nissa, Sage Animist", cards, game); + if (card.getCardType().contains(CardType.LAND)) { + return controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId()); + } else { + return controller.moveCards(card, Zone.LIBRARY, Zone.HAND, source, game); + } + } + return true; + } +} + +class NissaSageAnimistToken extends Token { + + NissaSageAnimistToken() { + super("Ashaya, the Awoken World", "legendary 4/4 green Elemental creature token named Ashaya, the Awoken World"); + this.setOriginalExpansionSetCode("ORI"); + this.getSupertype().add("Legendary"); + this.getPower().initValue(4); + this.getToughness().initValue(4); + this.color.setGreen(true); + this.getSubtype().add("Elemental"); + this.getCardType().add(CardType.CREATURE); + } +} + +class NissaSageAnimistMinusSevenEffect extends ContinuousEffectImpl { + + NissaSageAnimistMinusSevenEffect() { + super(Duration.EndOfGame, Outcome.BecomeCreature); + this.staticText = "They become 6/6 Elemental creatures. They're still lands"; + } + + NissaSageAnimistMinusSevenEffect(final NissaSageAnimistMinusSevenEffect effect) { + super(effect); + } + + @Override + public NissaSageAnimistMinusSevenEffect copy() { + return new NissaSageAnimistMinusSevenEffect(this); + } + + @Override + public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { + for (UUID permanentId : this.getTargetPointer().getTargets(game, source)) { + Permanent permanent = game.getPermanent(permanentId); + if (permanent != null) { + switch (layer) { + case TypeChangingEffects_4: + if (!permanent.getCardType().contains(CardType.CREATURE)) { + permanent.getCardType().add(CardType.CREATURE); + } + if (!permanent.getSubtype().contains("Elemental")) { + permanent.getSubtype().add("Elemental"); + } + break; + case PTChangingEffects_7: + if (sublayer == SubLayer.SetPT_7b) { + permanent.getToughness().setValue(6); + permanent.getPower().setValue(6); + } + } + } + } + return true; + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } + + @Override + public boolean hasLayer(Layer layer) { + return layer == Layer.TypeChangingEffects_4 || layer == Layer.PTChangingEffects_7; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/magicorigins/NissaVastwoodSeer.java b/Mage.Sets/src/mage/sets/magicorigins/NissaVastwoodSeer.java new file mode 100644 index 00000000000..439cf1fb125 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/NissaVastwoodSeer.java @@ -0,0 +1,93 @@ +/* + * 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.sets.magicorigins; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition.CountType; +import mage.abilities.decorator.ConditionalTriggeredAbility; +import mage.abilities.effects.common.ExileAndReturnTransformedSourceEffect; +import mage.abilities.effects.common.ExileAndReturnTransformedSourceEffect.Gender; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.abilities.keyword.TransformAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterCard; +import mage.filter.common.FilterLandPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.predicate.mageobject.SupertypePredicate; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author emerald000 + */ +public class NissaVastwoodSeer extends CardImpl { + + private static final FilterCard filter = new FilterCard("basic Forest card"); + static { + filter.add(new SupertypePredicate("Basic")); + filter.add(new SubtypePredicate("Forest")); + } + + public NissaVastwoodSeer(UUID ownerId) { + super(ownerId, 189, "Nissa, Vastwood Seer", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{2}{G}"); + this.expansionSetCode = "ORI"; + this.supertype.add("Legendary"); + this.subtype.add("Elf"); + this.subtype.add("Scout"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + this.canTransform = true; + this.secondSideCard = new NissaSageAnimist(ownerId); + + // When Nissa, Vastwood Seer enters the battlefield, you may search your library for a basic Forest card, reveal it, put it into your hand, then shuffle your library. + this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 1, filter), true, true), true)); + + // Whenever a land enters the battlefield under your control, if you control seven or more lands, exile Nissa, then return her to the battlefield transformed under her owner's control. + this.addAbility(new TransformAbility()); + this.addAbility(new ConditionalTriggeredAbility( + new EntersBattlefieldControlledTriggeredAbility(new ExileAndReturnTransformedSourceEffect(Gender.FEMAL), new FilterLandPermanent()), + new PermanentsOnTheBattlefieldCondition(new FilterLandPermanent(), CountType.MORE_THAN, 6, true), + "Whenever a land enters the battlefield under your control, if you control seven or more lands, exile {this}, then return her to the battlefield transformed under her owner's control.")); + } + + public NissaVastwoodSeer(final NissaVastwoodSeer card) { + super(card); + } + + @Override + public NissaVastwoodSeer copy() { + return new NissaVastwoodSeer(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/RunedServitor.java b/Mage.Sets/src/mage/sets/magicorigins/RunedServitor.java index 907344659f5..71446b0a5d9 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/RunedServitor.java +++ b/Mage.Sets/src/mage/sets/magicorigins/RunedServitor.java @@ -37,7 +37,7 @@ public class RunedServitor extends mage.sets.riseoftheeldrazi.RunedServitor { public RunedServitor(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 983; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/ScrapskinDrake.java b/Mage.Sets/src/mage/sets/magicorigins/ScrapskinDrake.java index d4252ebcd87..f03d8afd2a5 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/ScrapskinDrake.java +++ b/Mage.Sets/src/mage/sets/magicorigins/ScrapskinDrake.java @@ -37,7 +37,7 @@ public class ScrapskinDrake extends mage.sets.avacynrestored.ScrapskinDrake { public ScrapskinDrake(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 982; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/SentinelOfTheEternalWatch.java b/Mage.Sets/src/mage/sets/magicorigins/SentinelOfTheEternalWatch.java new file mode 100644 index 00000000000..7571edab198 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/SentinelOfTheEternalWatch.java @@ -0,0 +1,98 @@ +/* + * 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.sets.magicorigins; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfCombatTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.TapTargetEffect; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetCreaturePermanent; +import mage.target.targetpointer.FirstTargetPointer; + +/** + * + * @author LevelX2 + */ +public class SentinelOfTheEternalWatch extends CardImpl { + + public SentinelOfTheEternalWatch(UUID ownerId) { + super(ownerId, 30, "Sentinel of the Eternal Watch", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{5}{W}"); + this.expansionSetCode = "ORI"; + this.subtype.add("Giant"); + this.subtype.add("Soldier"); + this.power = new MageInt(4); + this.toughness = new MageInt(6); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + // At the beginning of combat on each opponent's turn, tap target creature that player controls. + this.addAbility(new BeginningOfCombatTriggeredAbility(Zone.BATTLEFIELD, new TapTargetEffect("target creature that player controls"), TargetController.OPPONENT, false, true)); + + } + + public SentinelOfTheEternalWatch(final SentinelOfTheEternalWatch card) { + super(card); + } + + @Override + public SentinelOfTheEternalWatch copy() { + return new SentinelOfTheEternalWatch(this); + } + + @Override + public void adjustTargets(Ability ability, Game game) { + if (ability instanceof BeginningOfCombatTriggeredAbility) { + for (Effect effect: ability.getEffects()) { + UUID opponentId = effect.getTargetPointer().getFirst(game, ability); + Player opponent = game.getPlayer(opponentId); + if (opponent != null) { + effect.setTargetPointer(new FirstTargetPointer()); + FilterCreaturePermanent filter = new FilterCreaturePermanent("a creature from the active opponent"); + filter.add(new ControllerIdPredicate(opponentId)); + Target target = new TargetCreaturePermanent(filter); + ability.addTarget(target); + } + } + } + } + + +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/TitanicGrowth.java b/Mage.Sets/src/mage/sets/magicorigins/TitanicGrowth.java index 0a3464df340..0d1b8d2ffad 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/TitanicGrowth.java +++ b/Mage.Sets/src/mage/sets/magicorigins/TitanicGrowth.java @@ -37,7 +37,7 @@ public class TitanicGrowth extends mage.sets.magic2012.TitanicGrowth { public TitanicGrowth(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 981; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/TitansStrength.java b/Mage.Sets/src/mage/sets/magicorigins/TitansStrength.java index fbb3ca18954..a8cba796028 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/TitansStrength.java +++ b/Mage.Sets/src/mage/sets/magicorigins/TitansStrength.java @@ -37,7 +37,7 @@ public class TitansStrength extends mage.sets.theros.TitansStrength { public TitansStrength(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 980; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/TowerGeist.java b/Mage.Sets/src/mage/sets/magicorigins/TowerGeist.java index 83f4e1c1304..a80343127c6 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/TowerGeist.java +++ b/Mage.Sets/src/mage/sets/magicorigins/TowerGeist.java @@ -37,7 +37,7 @@ public class TowerGeist extends mage.sets.darkascension.TowerGeist { public TowerGeist(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 979; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/VastwoodGorger.java b/Mage.Sets/src/mage/sets/magicorigins/VastwoodGorger.java index d63e8419778..c0a4be303e3 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/VastwoodGorger.java +++ b/Mage.Sets/src/mage/sets/magicorigins/VastwoodGorger.java @@ -37,7 +37,7 @@ public class VastwoodGorger extends mage.sets.zendikar.VastwoodGorger { public VastwoodGorger(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 978; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/VeteransSidearm.java b/Mage.Sets/src/mage/sets/magicorigins/VeteransSidearm.java new file mode 100644 index 00000000000..554ce687644 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/VeteransSidearm.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.sets.magicorigins; + +import java.util.UUID; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.common.continuous.BoostEquippedEffect; +import mage.abilities.keyword.EquipAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author emerald000 + */ +public class VeteransSidearm extends CardImpl { + + public VeteransSidearm(UUID ownerId) { + super(ownerId, 242, "Veteran's Sidearm", Rarity.COMMON, new CardType[]{CardType.ARTIFACT}, "{2}"); + this.expansionSetCode = "ORI"; + this.subtype.add("Equipment"); + + // Equipped creature gets +1/+1. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(1, 1))); + + // Equip {1} + this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(1))); + } + + public VeteransSidearm(final VeteransSidearm card) { + super(card); + } + + @Override + public VeteransSidearm copy() { + return new VeteransSidearm(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/WeightOfTheUnderworld.java b/Mage.Sets/src/mage/sets/magicorigins/WeightOfTheUnderworld.java index a2152d252aa..19b5635b498 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/WeightOfTheUnderworld.java +++ b/Mage.Sets/src/mage/sets/magicorigins/WeightOfTheUnderworld.java @@ -37,7 +37,7 @@ public class WeightOfTheUnderworld extends mage.sets.bornofthegods.WeightOfTheUn public WeightOfTheUnderworld(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 977; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/YevasForcemage.java b/Mage.Sets/src/mage/sets/magicorigins/YevasForcemage.java index 9aeebb11921..3eadb733209 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/YevasForcemage.java +++ b/Mage.Sets/src/mage/sets/magicorigins/YevasForcemage.java @@ -37,7 +37,7 @@ public class YevasForcemage extends mage.sets.magic2013.YevasForcemage { public YevasForcemage(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 976; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/YokedOx.java b/Mage.Sets/src/mage/sets/magicorigins/YokedOx.java index a8782b64095..24dd1b11194 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/YokedOx.java +++ b/Mage.Sets/src/mage/sets/magicorigins/YokedOx.java @@ -37,7 +37,7 @@ public class YokedOx extends mage.sets.theros.YokedOx { public YokedOx(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 975; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/ContestedWarZone.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/ContestedWarZone.java index 18aa0237fd6..1558ed15381 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/ContestedWarZone.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/ContestedWarZone.java @@ -28,7 +28,6 @@ package mage.sets.mirrodinbesieged; import java.util.UUID; -import mage.Mana; import mage.constants.CardType; import mage.constants.Duration; @@ -46,7 +45,6 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.common.continuous.BoostAllEffect; import mage.abilities.mana.ColorlessManaAbility; -import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.filter.common.FilterAttackingCreature; import mage.game.Game; diff --git a/Mage.Sets/src/mage/sets/morningtide/Fertilid.java b/Mage.Sets/src/mage/sets/morningtide/Fertilid.java new file mode 100644 index 00000000000..3a9e5670b46 --- /dev/null +++ b/Mage.Sets/src/mage/sets/morningtide/Fertilid.java @@ -0,0 +1,52 @@ +/* + * 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.sets.morningtide; + +import java.util.UUID; + +/** + * + * @author ilcartographer + */ +public class Fertilid extends mage.sets.commander.Fertilid { + + public Fertilid(UUID ownerId) { + super(ownerId); + this.cardNumber = 122; + this.expansionSetCode = "MOR"; + } + + public Fertilid(final Fertilid card) { + super(card); + } + + @Override + public Fertilid copy() { + return new Fertilid(this); + } +} diff --git a/Mage.Sets/src/mage/sets/ninthedition/ElvishBerserker.java b/Mage.Sets/src/mage/sets/ninthedition/ElvishBerserker.java new file mode 100644 index 00000000000..b111c600ed6 --- /dev/null +++ b/Mage.Sets/src/mage/sets/ninthedition/ElvishBerserker.java @@ -0,0 +1,65 @@ +/* + * 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.sets.ninthedition; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.BecomesBlockedByCreatureTriggeredAbility; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; + +/** + * + * @author ilcartographer + */ +public class ElvishBerserker extends CardImpl { + + public ElvishBerserker(UUID ownerId) { + super(ownerId, 237, "Elvish Berserker", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{G}"); + this.expansionSetCode = "9ED"; + this.subtype.add("Elf"); + this.subtype.add("Berserker"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Whenever Elvish Berserker becomes blocked, it gets +1/+1 until end of turn for each creature blocking it. + this.addAbility(new BecomesBlockedByCreatureTriggeredAbility(new BoostSourceEffect(1, 1, Duration.EndOfTurn), false)); + } + + public ElvishBerserker(final ElvishBerserker card) { + super(card); + } + + @Override + public ElvishBerserker copy() { + return new ElvishBerserker(this); + } +} diff --git a/Mage.Sets/src/mage/sets/planechase/Fertilid.java b/Mage.Sets/src/mage/sets/planechase/Fertilid.java new file mode 100644 index 00000000000..6a3a8489195 --- /dev/null +++ b/Mage.Sets/src/mage/sets/planechase/Fertilid.java @@ -0,0 +1,52 @@ +/* + * 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.sets.planechase; + +import java.util.UUID; + +/** + * + * @author ilcartographer + */ +public class Fertilid extends mage.sets.commander.Fertilid { + + public Fertilid(UUID ownerId) { + super(ownerId); + this.cardNumber = 72; + this.expansionSetCode = "HOP"; + } + + public Fertilid(final Fertilid card) { + super(card); + } + + @Override + public Fertilid copy() { + return new Fertilid(this); + } +} diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/GideonJura.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/GideonJura.java index b52ecc52b86..d01d66c5968 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/GideonJura.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/GideonJura.java @@ -38,6 +38,7 @@ import mage.MageObjectReference; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.effects.Effect; import mage.abilities.effects.RequirementEffect; import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; @@ -85,7 +86,9 @@ public class GideonJura extends CardImpl { // 0: Until end of turn, Gideon Jura becomes a 6/6 Human Soldier creature that's still a planeswalker. Prevent all damage that would be dealt to him this turn. LoyaltyAbility ability3 = new LoyaltyAbility(new BecomesCreatureSourceEffect(new GideonJuraToken(), "planeswalker", Duration.EndOfTurn), 0); - ability3.addEffect(new PreventAllDamageToSourceEffect(Duration.EndOfTurn)); + Effect effect = new PreventAllDamageToSourceEffect(Duration.EndOfTurn); + effect.setText("Prevent all damage that would be dealt to him this turn"); + ability3.addEffect(effect); this.addAbility(ability3); } diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/SnakeUmbra.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/SnakeUmbra.java index 45efa75b0a4..5daad05f235 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/SnakeUmbra.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/SnakeUmbra.java @@ -32,6 +32,7 @@ import java.util.UUID; import mage.constants.*; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.effects.common.DrawCardSourceControllerEffect; @@ -54,7 +55,6 @@ public class SnakeUmbra extends CardImpl { this.expansionSetCode = "ROE"; this.subtype.add("Aura"); - // Enchant creature TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); @@ -63,11 +63,14 @@ public class SnakeUmbra extends CardImpl { this.addAbility(ability); // Enchanted creature gets +1/+1 - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(1, 1, Duration.WhileOnBattlefield))); + ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(1, 1, Duration.WhileOnBattlefield)); // and has "Whenever this creature deals damage to an opponent, you may draw a card." Ability gainedAbility = new DealsDamageToOpponentTriggeredAbility(new DrawCardSourceControllerEffect(1), true); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(gainedAbility, AttachmentType.AURA))); + Effect effect = new GainAbilityAttachedEffect(gainedAbility, AttachmentType.AURA); + effect.setText("and has \"Whenever this creature deals damage to an opponent, you may draw a card.\""); + ability.addEffect(effect); + this.addAbility(ability); // Totem armor this.addAbility(new TotemArmorAbility()); diff --git a/Mage.Sets/src/mage/sets/tenthedition/DreambornMuse.java b/Mage.Sets/src/mage/sets/tenthedition/DreambornMuse.java new file mode 100644 index 00000000000..5971c0c184c --- /dev/null +++ b/Mage.Sets/src/mage/sets/tenthedition/DreambornMuse.java @@ -0,0 +1,52 @@ +/* + * 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.sets.tenthedition; + +import java.util.UUID; + +/** + * + * @author anonymous + */ +public class DreambornMuse extends mage.sets.legions.DreambornMuse { + + public DreambornMuse(UUID ownerId) { + super(ownerId); + this.cardNumber = 82; + this.expansionSetCode = "10E"; + } + + public DreambornMuse(final DreambornMuse card) { + super(card); + } + + @Override + public DreambornMuse copy() { + return new DreambornMuse(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tenthedition/ElvishBerserker.java b/Mage.Sets/src/mage/sets/tenthedition/ElvishBerserker.java new file mode 100644 index 00000000000..83ff3259f95 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tenthedition/ElvishBerserker.java @@ -0,0 +1,52 @@ +/* + * 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.sets.tenthedition; + +import java.util.UUID; + +/** + * + * @author ilcartographer + */ +public class ElvishBerserker extends mage.sets.ninthedition.ElvishBerserker { + + public ElvishBerserker(UUID ownerId) { + super(ownerId); + this.cardNumber = 260; + this.expansionSetCode = "10E"; + } + + public ElvishBerserker(final ElvishBerserker card) { + super(card); + } + + @Override + public ElvishBerserker copy() { + return new ElvishBerserker(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tenthedition/MantisEngine.java b/Mage.Sets/src/mage/sets/tenthedition/MantisEngine.java index e248728b5f7..056443e3b01 100644 --- a/Mage.Sets/src/mage/sets/tenthedition/MantisEngine.java +++ b/Mage.Sets/src/mage/sets/tenthedition/MantisEngine.java @@ -53,7 +53,11 @@ public class MantisEngine extends CardImpl { this.subtype.add("Insect"); this.power = new MageInt(3); this.toughness = new MageInt(3); + + // {2}: Mantis Engine gains flying until end of turn. (It can't be blocked except by creatures with flying or reach.) this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), new GenericManaCost(2))); + + // {2}: Mantis Engine gains first strike until end of turn. (It deals combat damage before creatures without first strike.) this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn), new GenericManaCost(2))); } diff --git a/Mage.Sets/src/mage/sets/zendikar/PyromancerAscension.java b/Mage.Sets/src/mage/sets/zendikar/PyromancerAscension.java index dc5f38f7122..5eb3676dc2a 100644 --- a/Mage.Sets/src/mage/sets/zendikar/PyromancerAscension.java +++ b/Mage.Sets/src/mage/sets/zendikar/PyromancerAscension.java @@ -38,14 +38,10 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; -import mage.filter.FilterSpell; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.game.stack.Spell; -import mage.target.TargetSpell; import mage.target.targetpointer.FixedTarget; /** @@ -91,9 +87,14 @@ class PyromancerAscensionQuestTriggeredAbility extends TriggeredAbilityImpl { return new PyromancerAscensionQuestTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getPlayerId().equals(this.getControllerId())) { + if (event.getPlayerId().equals(this.getControllerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (isControlledInstantOrSorcery(spell)) { Card sourceCard = game.getCard(spell.getSourceId()); @@ -138,10 +139,15 @@ class PyromancerAscensionCopyTriggeredAbility extends TriggeredAbilityImpl { public PyromancerAscensionCopyTriggeredAbility copy() { return new PyromancerAscensionCopyTriggeredAbility(this); } - + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getPlayerId().equals(this.getControllerId())) { + if (event.getPlayerId().equals(this.getControllerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (isControlledInstantOrSorcery(spell)) { Permanent permanent = game.getBattlefield().getPermanent(this.getSourceId()); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/ReturnToHandTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/ReturnToHandTest.java index 7d4ea0d43cd..9864c33cfdb 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/ReturnToHandTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/ReturnToHandTest.java @@ -73,5 +73,46 @@ public class ReturnToHandTest extends CardTestPlayerBase { } + /** + * Return from graveyard to hand if you play a swamp + */ + @Test + public void VeilbornGhoulTest1() { + // Veilborn Ghoul can't block. + // Whenever a Swamp enters the battlefield under your control, you may return Veilborn Ghoul from your graveyard to your hand. + addCard(Zone.GRAVEYARD, playerA, "Veilborn Ghoul"); + addCard(Zone.HAND, playerA, "Swamp"); + + playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Swamp"); + setStopAt(1, PhaseStep.BEGIN_COMBAT); + + execute(); + + assertPermanentCount(playerA, "Swamp", 1); + assertHandCount(playerA, "Veilborn Ghoul", 1); + + } + /** + * Return from graveyard to hand if you play a non swamp land but Urborg, Tomb of Yawgmoth is in play + */ + @Test + public void VeilbornGhoulTest2() { + // Veilborn Ghoul can't block. + // Whenever a Swamp enters the battlefield under your control, you may return Veilborn Ghoul from your graveyard to your hand. + addCard(Zone.GRAVEYARD, playerA, "Veilborn Ghoul"); + addCard(Zone.HAND, playerA, "Flood Plain"); + + // Each land is a Swamp in addition to its other land types. + addCard(Zone.BATTLEFIELD, playerA, "Urborg, Tomb of Yawgmoth", 1); + + playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Flood Plain"); + setStopAt(1, PhaseStep.BEGIN_COMBAT); + + execute(); + + assertPermanentCount(playerA, "Flood Plain", 1); + assertHandCount(playerA, "Veilborn Ghoul", 1); + + } -} \ No newline at end of file +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/LandfallTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/LandfallTest.java index 0f4ab1f663b..5e3b1b177cc 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/LandfallTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/LandfallTest.java @@ -146,5 +146,58 @@ public class LandfallTest extends CardTestPlayerBase { assertGraveyardCount(playerB, "Silvercoat Lion" , 1); } - + + @Test + public void testGroundswellWithoutLandfall() { + // Target creature gets +2/+2 until end of turn. + //Landfall - If you had a land enter the battlefield under your control this turn, that creature gets +4/+4 until end of turn instead. + addCard(Zone.HAND, playerB, "Groundswell",1); + addCard(Zone.BATTLEFIELD, playerB, "Forest",1); + + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion",1); + + attack(2, playerB, "Silvercoat Lion"); + castSpell(2, PhaseStep.DECLARE_ATTACKERS, playerB, "Groundswell", "Silvercoat Lion"); + + + setStopAt(2, PhaseStep.END_COMBAT); + execute(); + + assertPermanentCount(playerB, "Forest", 1); + assertGraveyardCount(playerB, "Groundswell" , 1); + + assertPermanentCount(playerB, "Silvercoat Lion" , 1); + assertPowerToughness(playerB, "Silvercoat Lion", 4, 4); + + assertLife(playerA, 16); // 2 + 4 + assertLife(playerB, 20); + } + + @Test + public void testGroundswellWithLandfall() { + // Target creature gets +2/+2 until end of turn. + //Landfall - If you had a land enter the battlefield under your control this turn, that creature gets +4/+4 until end of turn instead. + addCard(Zone.HAND, playerB, "Groundswell",1); + addCard(Zone.HAND, playerB, "Forest"); + + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion",1); + + + playLand(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Forest"); + attack(2, playerB, "Silvercoat Lion"); + castSpell(2, PhaseStep.DECLARE_ATTACKERS, playerB, "Groundswell", "Silvercoat Lion"); + + + setStopAt(2, PhaseStep.END_COMBAT); + execute(); + + assertPermanentCount(playerB, "Forest", 1); + assertGraveyardCount(playerB, "Groundswell" , 1); + + assertPermanentCount(playerB, "Silvercoat Lion" , 1); + assertPowerToughness(playerB, "Silvercoat Lion", 6, 6); + + assertLife(playerA, 14); // 2 + 4 + assertLife(playerB, 20); + } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SpliceOnArcaneTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SpliceOnArcaneTest.java new file mode 100644 index 00000000000..6eff8eaae26 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SpliceOnArcaneTest.java @@ -0,0 +1,144 @@ +/* + * 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 org.mage.test.cards.abilities.keywords; + +import mage.abilities.keyword.HasteAbility; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Assert; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author LevelX2 + */ + +public class SpliceOnArcaneTest extends CardTestPlayerBase { + + /** + * Test that it works to cast Through the Breach + * by slicing it on an arcane spell + * + */ + @Test + public void testSpliceThroughTheBreach() { + + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); + // Sorcery - Arcane {R} + // Lava Spike deals 3 damage to target player. + addCard(Zone.HAND, playerA, "Lava Spike",1); + // You may put a creature card from your hand onto the battlefield. That creature gains haste. Sacrifice that creature at the beginning of the next end step. + // Splice onto Arcane {2}{R}{R} (As you cast an Arcane spell, you may reveal this card from your hand and pay its splice cost. If you do, add this card's effects to that spell.) + addCard(Zone.HAND, playerA, "Through the Breach",1); + addCard(Zone.HAND, playerA, "Silvercoat Lion",1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lava Spike", playerB); + setChoice(playerA, "Silvercoat Lion"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertLife(playerA, 20); + assertLife(playerB, 17); + + assertGraveyardCount(playerA, "Lava Spike", 1); + assertHandCount(playerA, "Through the Breach", 1); + assertPermanentCount(playerA, "Silvercoat Lion", 1); + assertAbility(playerA, "Silvercoat Lion", HasteAbility.getInstance(), true); + Assert.assertEquals("All available mana has to be used", 0, playerA.getManaAvailable(currentGame).size()); + } + + @Test + public void testSpliceTorrentOfStone() { + + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); + // Sorcery - Arcane {R} + // Lava Spike deals 3 damage to target player. + addCard(Zone.HAND, playerA, "Lava Spike",1); + // Torrent of Stone deals 4 damage to target creature. + // Splice onto Arcane-Sacrifice two Mountains. (As you cast an Arcane spell, you may reveal this card from your hand and pay its splice cost. If you do, add this card's effects to that spell.) + addCard(Zone.HAND, playerA, "Torrent of Stone",1); + + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion",1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lava Spike", playerB); + addTarget(playerA, "Silvercoat Lion"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertLife(playerA, 20); + assertLife(playerB, 17); + + assertGraveyardCount(playerA, "Lava Spike", 1); + assertHandCount(playerA, "Torrent of Stone", 1); + assertGraveyardCount(playerB, "Silvercoat Lion", 1); + assertPermanentCount(playerA, "Mountain", 0); + Assert.assertEquals("No more mana available", "[]", playerA.getManaAvailable(currentGame).toString()); + } + /** + * Nourishing Shoal's interaction with Splicing Through the Breach is + * bugged. You should still need to pay 2RR as an additional cost, which is + * not affected by the alternate casting method of Shoal, but you are able + * to Splice it for free. This is a very relevant bug right now due to the + * appearance of the deck over the weekend, and it makes the deck absurdly + * powerful. + */ + @Test + public void testSpliceThroughTheBreach2() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4); + // You may exile a green card with converted mana cost X from your hand rather than pay Nourishing Shoal's mana cost. + // You gain X life. + addCard(Zone.HAND, playerA, "Nourishing Shoal",1); + addCard(Zone.HAND, playerA, "Giant Growth",1); + // You may put a creature card from your hand onto the battlefield. That creature gains haste. Sacrifice that creature at the beginning of the next end step. + // Splice onto Arcane {2}{R}{R} (As you cast an Arcane spell, you may reveal this card from your hand and pay its splice cost. If you do, add this card's effects to that spell.) + addCard(Zone.HAND, playerA, "Through the Breach",1); + addCard(Zone.HAND, playerA, "Silvercoat Lion",1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nourishing Shoal"); + setChoice(playerA, "Yes"); + setChoice(playerA, "Silvercoat Lion"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertLife(playerA, 21); + assertLife(playerB, 20); + + assertGraveyardCount(playerA, "Nourishing Shoal", 1); + assertHandCount(playerA, "Through the Breach", 1); + assertPermanentCount(playerA, "Silvercoat Lion", 1); + assertAbility(playerA, "Silvercoat Lion", HasteAbility.getInstance(), true); + + Assert.assertEquals("All available mana has to be used","[]", playerA.getManaAvailable(currentGame).toString()); + } + + +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/StormTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/StormTest.java index 9157c8dfa34..6caa1dcf763 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/StormTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/StormTest.java @@ -30,6 +30,7 @@ package org.mage.test.cards.abilities.keywords; import mage.constants.PhaseStep; import mage.constants.Zone; +import mage.counters.CounterType; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; @@ -163,5 +164,39 @@ public class StormTest extends CardTestPlayerBase { assertLife(playerB, 16); // 3 (Lightning Bolt) + 1 from Storm copied Grapeshot } - + + /** + * I provide a game log fo the issue with storm mentioned earlier. I guess Pyromancer Ascension is a culprit. + * + * + */ + @Test + public void testStormAndPyromancerAscension() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); + addCard(Zone.BATTLEFIELD, playerA, "Island", 1); + // Whenever you cast an instant or sorcery spell that has the same name as a card in your graveyard, you may put a quest counter on Pyromancer Ascension. + // Whenever you cast an instant or sorcery spell while Pyromancer Ascension has two or more quest counters on it, you may copy that spell. You may choose new targets for the copy. + addCard(Zone.BATTLEFIELD, playerA, "Pyromancer Ascension", 1); + // Grapeshot deals 1 damage to target creature or player. - Sorcery {1}{R} + // Storm (When you cast this spell, copy it for each spell cast before it this turn. You may choose new targets for the copies.) + addCard(Zone.LIBRARY, playerA, "Grapeshot", 2); + skipInitShuffling(); + // Look at the top two cards of your library. Put one of them into your hand and the other on the bottom of your library. + addCard(Zone.HAND, playerA, "Sleight of Hand"); + addCard(Zone.HAND, playerA, "Shock", 3); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sleight of Hand"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Shock", playerB); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Shock", "targetPlayer=PlayerB", "Shock", StackClause.WHILE_NOT_ON_STACK); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Shock", "targetPlayer=PlayerB", "Shock", StackClause.WHILE_NOT_ON_STACK); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Grapeshot", playerB); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertGraveyardCount(playerA, "Shock", 3); + assertGraveyardCount(playerA, "Grapeshot", 1); + assertCounterCount("Pyromancer Ascension", CounterType.QUEST, 2); + assertLife(playerB, 8); // 6 from the Shocks + 5 from Grapeshot + 1 from Pyromancer Ascencsion copy + } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java new file mode 100644 index 00000000000..1aa83fc7929 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java @@ -0,0 +1,68 @@ +/* + * 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 org.mage.test.cards.abilities.keywords; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import mage.counters.CounterType; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author LevelX2 + */ + +public class TransformTest extends CardTestPlayerBase{ + + @Test + public void NissaVastwoodSeerTest() { + + addCard(Zone.LIBRARY, playerA, "Forest"); + + addCard(Zone.BATTLEFIELD, playerA, "Forest", 6); + // When Nissa, Vastwood Seer enters the battlefield, you may search your library for a basic Forest card, reveal it, put it into your hand, then shuffle your library. + // Whenever a land enters the battlefield under your control, if you control seven or more lands, exile Nissa, then return her to the battlefield transformed under her owner's control. + + addCard(Zone.HAND, playerA, "Nissa, Vastwood Seer"); + + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nissa, Vastwood Seer"); + playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Forest"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerA, "Forest", 7); + + assertPermanentCount(playerA, "Nissa, Vastwood Seer", 0); + assertPermanentCount(playerA, "Nissa, Sage Animist", 1); + assertCounterCount("Nissa, Sage Animist", CounterType.LOYALTY, 3); + } + +} \ No newline at end of file diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/conditional/twofaced/TwoFacedCardEffectsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/conditional/twofaced/TwoFacedCardEffectsTest.java index 4628fd55c10..69bd3a726a7 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/conditional/twofaced/TwoFacedCardEffectsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/conditional/twofaced/TwoFacedCardEffectsTest.java @@ -18,6 +18,12 @@ public class TwoFacedCardEffectsTest extends CardTestPlayerBase { */ @Test public void testEffectTurnedOffOnTransform() { + // Other Human creatures you control get +1/+1. + // At the beginning of each upkeep, if no spells were cast last turn, transform Mayor of Avabruck. + // Howlpack Alpha (transformed side) ---------------- + // Each other creature you control that's a Werewolf or a Wolf gets +1/+1. + // At the beginning of your end step, put a 2/2 green Wolf creature token onto the battlefield. + // At the beginning of each upkeep, if a player cast two or more spells last turn, transform Howlpack Alpha. addCard(Zone.BATTLEFIELD, playerA, "Mayor of Avabruck"); addCard(Zone.BATTLEFIELD, playerA, "Wolfir Avenger"); addCard(Zone.BATTLEFIELD, playerA, "Elite Inquisitor"); diff --git a/Mage/src/mage/abilities/AbilityImpl.java b/Mage/src/mage/abilities/AbilityImpl.java index c7bbd061e53..bfc6bcd22bd 100644 --- a/Mage/src/mage/abilities/AbilityImpl.java +++ b/Mage/src/mage/abilities/AbilityImpl.java @@ -329,7 +329,7 @@ public abstract class AbilityImpl implements Ability { // and/or zones become the target of a spell trigger at this point; they'll wait to be put on // the stack until the spell has finished being cast.) - if (sourceObject != null && !this.getAbilityType().equals(AbilityType.TRIGGERED)) { // triggered abilities check this already TriggeredAbilities.checkTriggers() + if (sourceObject != null && !this.getAbilityType().equals(AbilityType.TRIGGERED)) { // triggered abilities check this already in playerImpl.triggerAbility sourceObject.adjustTargets(this, game); } if (getTargets().size() > 0 && getTargets().chooseTargets(getEffects().get(0).getOutcome(), this.controllerId, this, game) == false) { diff --git a/Mage/src/mage/abilities/common/EndOfCombatTriggeredAbility.java b/Mage/src/mage/abilities/common/EndOfCombatTriggeredAbility.java new file mode 100644 index 00000000000..58926ccb9b0 --- /dev/null +++ b/Mage/src/mage/abilities/common/EndOfCombatTriggeredAbility.java @@ -0,0 +1,48 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.abilities.common; + +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; + +/** + * + * @author LevelX2 + */ + +public class EndOfCombatTriggeredAbility extends TriggeredAbilityImpl { + + public EndOfCombatTriggeredAbility(Effect effect, boolean optional) { + super(Zone.BATTLEFIELD, effect, optional); + } + + public EndOfCombatTriggeredAbility(final EndOfCombatTriggeredAbility ability) { + super(ability); + } + + @Override + public EndOfCombatTriggeredAbility copy() { + return new EndOfCombatTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.END_COMBAT_STEP_PRE; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return true; + } + + @Override + public String getRule() { + return "At the end of combat, " + super.getRule(); + } +} \ No newline at end of file diff --git a/Mage/src/mage/abilities/condition/common/OpponentControlsPermanentCondition.java b/Mage/src/mage/abilities/condition/common/OpponentControlsPermanentCondition.java index dfb0f89be91..efb94d0c482 100644 --- a/Mage/src/mage/abilities/condition/common/OpponentControlsPermanentCondition.java +++ b/Mage/src/mage/abilities/condition/common/OpponentControlsPermanentCondition.java @@ -28,31 +28,29 @@ package mage.abilities.condition.common; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.condition.Condition; -import mage.constants.TargetController; import mage.filter.FilterPermanent; -import mage.filter.predicate.permanent.ControllerPredicate; +import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; /** - * + * Checks if one opponent (each opponent is checked on its own) fulfills + * the defined condition of controlling the defined number of permanents. + * * @author LevelX2 */ public class OpponentControlsPermanentCondition implements Condition { public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO }; + private FilterPermanent filter; - private Condition condition; private CountType type; private int count; /** - * Applies a filter and delegates creation to - * {@link #ControlsPermanent(mage.filter.FilterPermanent, mage.abilities.condition.common.ControlsPermanent.CountType, int)} - * with {@link CountType#MORE_THAN}, and 0. - * * @param filter */ public OpponentControlsPermanentCondition(FilterPermanent filter) { @@ -74,46 +72,33 @@ public class OpponentControlsPermanentCondition implements Condition { this.count = count; } - /** - * Applies a filter, a {@link CountType}, and count to permanents on the - * battlefield and calls the decorated condition to see if it - * {@link #apply(mage.game.Game, mage.abilities.Ability) applies} - * as well. This will force both conditions to apply for this to be true. - * - * @param filter - * @param type - * @param count - * @param conditionToDecorate - */ - public OpponentControlsPermanentCondition ( FilterPermanent filter, CountType type, int count, Condition conditionToDecorate ) { - this(filter, type, count); - this.condition = conditionToDecorate; - } - @Override public boolean apply(Game game, Ability source) { - boolean conditionApplies = false; - - FilterPermanent localFilter = filter.copy(); - localFilter.add(new ControllerPredicate(TargetController.OPPONENT)); - - switch ( this.type ) { - case FEWER_THAN: - conditionApplies = game.getBattlefield().count(localFilter, source.getSourceId(), source.getControllerId(), game) < this.count; - break; - case MORE_THAN: - conditionApplies = game.getBattlefield().count(localFilter, source.getSourceId(), source.getControllerId(), game) > this.count; - break; - case EQUAL_TO: - conditionApplies = game.getBattlefield().count(localFilter, source.getSourceId(), source.getControllerId(), game) == this.count; - break; + boolean conditionApplies = false; + for(UUID opponentId :game.getOpponents(source.getControllerId())) { + FilterPermanent localFilter = filter.copy(); + localFilter.add(new ControllerIdPredicate(opponentId)); + switch ( this.type ) { + case FEWER_THAN: + if (game.getBattlefield().count(localFilter, source.getSourceId(), source.getControllerId(), game) < this.count) { + conditionApplies = true; + break; + } + case MORE_THAN: + if (game.getBattlefield().count(localFilter, source.getSourceId(), source.getControllerId(), game) > this.count) { + conditionApplies = true; + break; + } + break; + case EQUAL_TO: + if (game.getBattlefield().count(localFilter, source.getSourceId(), source.getControllerId(), game) == this.count) { + conditionApplies = true; + break; + } + break; + } + } - - //If a decorated condition exists, check it as well and apply them together. - if ( this.condition != null ) { - conditionApplies = conditionApplies && this.condition.apply(game, source); - } - return conditionApplies; } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/CardsInTargetPlayerHandCount.java b/Mage/src/mage/abilities/dynamicvalue/common/CardsInTargetPlayerHandCount.java new file mode 100644 index 00000000000..27bab074560 --- /dev/null +++ b/Mage/src/mage/abilities/dynamicvalue/common/CardsInTargetPlayerHandCount.java @@ -0,0 +1,34 @@ +package mage.abilities.dynamicvalue.common; + +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author cbrianhill + */ +public class CardsInTargetPlayerHandCount implements DynamicValue { + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Player player = game.getPlayer(effect.getTargetPointer().getFirst(game, sourceAbility)); + if (player != null) { + return player.getHand().size(); + } + return 0; + } + + @Override + public DynamicValue copy() { + return new CardsInTargetPlayerHandCount(); + } + + @Override + public String getMessage() { + return "cards in target player's hand"; + } + +} diff --git a/Mage/src/mage/abilities/effects/common/ExileAndReturnTransformedSourceEffect.java b/Mage/src/mage/abilities/effects/common/ExileAndReturnTransformedSourceEffect.java new file mode 100644 index 00000000000..3e6bd508bb4 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/ExileAndReturnTransformedSourceEffect.java @@ -0,0 +1,55 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.abilities.effects.common; + +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.TransformAbility; +import mage.cards.Card; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ + +public class ExileAndReturnTransformedSourceEffect extends OneShotEffect { + + public static enum Gender { MALE, FEMAL }; + + public ExileAndReturnTransformedSourceEffect(Gender gender) { + super(Outcome.Benefit); + this.staticText = "exile {this}, then return " + (gender.equals(Gender.MALE) ? "him":"her") + + " to the battlefield transformed under" + (gender.equals(Gender.MALE) ? "his":"her")+ " owner's control"; + } + + public ExileAndReturnTransformedSourceEffect(final ExileAndReturnTransformedSourceEffect effect) { + super(effect); + } + + @Override + public ExileAndReturnTransformedSourceEffect copy() { + return new ExileAndReturnTransformedSourceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + MageObject sourceObject = source.getSourceObjectIfItStillExists(game); + Player controller = game.getPlayer(source.getControllerId()); + if (sourceObject != null && controller != null) { + Card card = (Card) sourceObject; + if (controller.moveCards(card, Zone.BATTLEFIELD, Zone.EXILED, source, game)) { + game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE); + controller.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId()); + } + } + return true; + } +} diff --git a/Mage/src/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java b/Mage/src/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java index 134bae46168..39316525853 100644 --- a/Mage/src/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java @@ -59,6 +59,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl { protected boolean chooseLandType; protected ArrayList landTypes = new ArrayList(); + protected boolean loseOther; // loses all other abilities, card types, and creature types public BecomesBasicLandTargetEffect(Duration duration) { this(duration, true, new String[0]); @@ -69,10 +70,15 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl { } public BecomesBasicLandTargetEffect(Duration duration, boolean chooseLandType, String... landNames) { + this(duration, chooseLandType, true, landNames); + } + + public BecomesBasicLandTargetEffect(Duration duration, boolean chooseLandType, boolean loseOther, String... landNames) { super(duration, Outcome.Detriment); this.landTypes.addAll(Arrays.asList(landNames)); this.chooseLandType = chooseLandType; this.staticText = setText(); + this.loseOther = loseOther; } @@ -105,6 +111,19 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl { this.discard(); } } + + if(!loseOther) { + for (UUID targetPermanent : targetPointer.getTargets(game, source)) { + Permanent land = game.getPermanent(targetPermanent); + if (land != null) { + for(String type : land.getSubtype()) { + if(!landTypes.contains(type)) { + landTypes.add(type); + } + } + } + } + } } @Override @@ -116,16 +135,22 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl { case AbilityAddingRemovingEffects_6: land.removeAllAbilities(source.getSourceId(), game); for (String landType : landTypes) { - if (landType.equals("Swamp")) { - land.addAbility(new BlackManaAbility(), source.getSourceId(), game); - } else if (landType.equals("Mountain")) { - land.addAbility(new RedManaAbility(), source.getSourceId(), game); - } else if (landType.equals("Forest")) { - land.addAbility(new GreenManaAbility(), source.getSourceId(), game); - } else if (landType.equals("Island")) { - land.addAbility(new BlueManaAbility(), source.getSourceId(), game); - } else if (landType.equals("Plains")) { - land.addAbility(new WhiteManaAbility(), source.getSourceId(), game); + switch (landType) { + case "Swamp": + land.addAbility(new BlackManaAbility(), source.getSourceId(), game); + break; + case "Mountain": + land.addAbility(new RedManaAbility(), source.getSourceId(), game); + break; + case "Forest": + land.addAbility(new GreenManaAbility(), source.getSourceId(), game); + break; + case "Island": + land.addAbility(new BlueManaAbility(), source.getSourceId(), game); + break; + case "Plains": + land.addAbility(new WhiteManaAbility(), source.getSourceId(), game); + break; } } break; diff --git a/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java b/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java index 01014677be6..6776adcc8ea 100644 --- a/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java +++ b/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java @@ -45,8 +45,8 @@ import mage.target.common.TargetCardInLibrary; */ public class SearchLibraryPutInPlayEffect extends SearchEffect { - private boolean tapped; - private boolean forceShuffle; + protected boolean tapped; + protected boolean forceShuffle; public SearchLibraryPutInPlayEffect(TargetCardInLibrary target) { this(target, false, true, Outcome.PutCardInPlay); diff --git a/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java b/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java new file mode 100644 index 00000000000..74cf05fbe9f --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java @@ -0,0 +1,119 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.abilities.effects.common.search; + +import java.util.List; +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.SearchEffect; +import mage.cards.Card; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author LevelX2 + */ + +public class SearchLibraryPutInPlayTargetPlayerEffect extends SearchEffect { + + protected boolean tapped; + protected boolean forceShuffle; + + public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target) { + this(target, false, true, Outcome.PutCardInPlay); + } + + public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target, boolean tapped) { + this(target, tapped, true, Outcome.PutCardInPlay); + } + + public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target, boolean tapped, boolean forceShuffle) { + this(target, tapped, forceShuffle, Outcome.PutCardInPlay); + } + + public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target, boolean tapped, Outcome outcome) { + this(target, tapped, true, outcome); + } + + public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target, boolean tapped, boolean forceShuffle, Outcome outcome) { + super(target, outcome); + this.tapped = tapped; + this.forceShuffle = forceShuffle; + setText(); + } + + public SearchLibraryPutInPlayTargetPlayerEffect(final SearchLibraryPutInPlayTargetPlayerEffect effect) { + super(effect); + this.tapped = effect.tapped; + this.forceShuffle = effect.forceShuffle; + } + + @Override + public SearchLibraryPutInPlayTargetPlayerEffect copy() { + return new SearchLibraryPutInPlayTargetPlayerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); + if (player != null) { + if (player.searchLibrary(target, game)) { + if (target.getTargets().size() > 0) { + for (UUID cardId: target.getTargets()) { + Card card = player.getLibrary().getCard(cardId, game); + if (card != null) { + player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), tapped); + } + } + } + player.shuffleLibrary(game); + return true; + } + + if (forceShuffle) { + player.shuffleLibrary(game); + } + } + + return false; + } + + private void setText() { + StringBuilder sb = new StringBuilder(); + sb.append("target player searches his or her library for "); + if (target.getNumberOfTargets() == 0 && target.getMaxNumberOfTargets() > 0) { + if ( target.getMaxNumberOfTargets() == Integer.MAX_VALUE ) { + sb.append("any number of ").append(" "); + } + else { + sb.append("up to ").append(target.getMaxNumberOfTargets()).append(" "); + } + sb.append(target.getTargetName()).append(" and put them onto the battlefield"); + } + else { + sb.append("a ").append(target.getTargetName()).append(" and put it onto the battlefield"); + } + if (tapped) { + sb.append(" tapped"); + } + if (forceShuffle) { + sb.append(". Then that player shuffles his or her library"); + } + else { + sb.append(". If that player does, he or she shuffles his or her library"); + } + staticText = sb.toString(); + } + + public List getTargets() { + return target.getTargets(); + } + +} diff --git a/Mage/src/mage/abilities/keyword/SpliceOntoArcaneAbility.java b/Mage/src/mage/abilities/keyword/SpliceOntoArcaneAbility.java index 92d7ee0474c..06d6c201bf1 100644 --- a/Mage/src/mage/abilities/keyword/SpliceOntoArcaneAbility.java +++ b/Mage/src/mage/abilities/keyword/SpliceOntoArcaneAbility.java @@ -38,7 +38,6 @@ import mage.abilities.costs.CostsImpl; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.SpliceCardEffectImpl; import mage.cards.Card; -import mage.cards.CardsImpl; import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.SpellAbilityType; @@ -105,12 +104,12 @@ import mage.players.Player; public class SpliceOntoArcaneAbility extends SimpleStaticAbility { private static final String KEYWORD_TEXT = "Splice onto Arcane"; - private Costs spliceCosts = new CostsImpl(); + private Costs spliceCosts = new CostsImpl<>(); private boolean nonManaCosts = false; public SpliceOntoArcaneAbility(String manaString) { super(Zone.HAND, new SpliceOntoArcaneEffect()); - spliceCosts.add(new ManaCostsImpl(manaString)); + spliceCosts.add(new ManaCostsImpl<>(manaString)); } public SpliceOntoArcaneAbility(Cost cost) { @@ -144,7 +143,6 @@ public class SpliceOntoArcaneAbility extends SimpleStaticAbility { } } - class SpliceOntoArcaneEffect extends SpliceCardEffectImpl { public SpliceOntoArcaneEffect() { @@ -156,8 +154,6 @@ class SpliceOntoArcaneEffect extends SpliceCardEffectImpl { super(effect); } - - @Override public SpliceOntoArcaneEffect copy() { return new SpliceOntoArcaneEffect(this); @@ -175,12 +171,7 @@ class SpliceOntoArcaneEffect extends SpliceCardEffectImpl { splicedAbility.setSourceId(abilityToModify.getSourceId()); spell.addSpellAbility(splicedAbility); for (Iterator it = ((SpliceOntoArcaneAbility) source).getSpliceCosts().iterator(); it.hasNext();) { - Cost cost = (Cost) it.next(); - if (cost instanceof ManaCostsImpl) { - spell.getSpellAbility().getManaCostsToPay().add((ManaCostsImpl) cost.copy()); - } else { - spell.getSpellAbility().getCosts().add(cost.copy()); - } + spell.getSpellAbility().getCosts().add(((Cost) it.next()).copy()); } } return true; diff --git a/Mage/src/mage/abilities/keyword/TransformAbility.java b/Mage/src/mage/abilities/keyword/TransformAbility.java index 9b01d319c02..1d36731553d 100644 --- a/Mage/src/mage/abilities/keyword/TransformAbility.java +++ b/Mage/src/mage/abilities/keyword/TransformAbility.java @@ -44,6 +44,9 @@ public class TransformAbility extends SimpleStaticAbility { public static final String NO_SPELLS_TRANSFORM_RULE = "At the beginning of each upkeep, if no spells were cast last turn, transform {this}."; public static final String TWO_OR_MORE_SPELLS_TRANSFORM_RULE = "At the beginning of each upkeep, if a player cast two or more spells last turn, transform {this}."; + // this state value controlls if a permanent enters the battlefield already transformed + public static final String VALUE_KEY_ENTER_TRANSFORMED = "EnterTransformed"; + public TransformAbility() { super(Zone.BATTLEFIELD, new TransformEffect()); } diff --git a/Mage/src/mage/counters/CounterType.java b/Mage/src/mage/counters/CounterType.java index 00e2fe3b4bf..e446016fa61 100644 --- a/Mage/src/mage/counters/CounterType.java +++ b/Mage/src/mage/counters/CounterType.java @@ -53,6 +53,7 @@ public enum CounterType { FADE("fade"), FATE("fate"), FEATHER("feather"), + FLOOD("flood"), FUSE("fuse"), HATCHLING("hatchling"), HOOFPRINT("hoofprint"), diff --git a/Mage/src/mage/filter/common/FilterCreatureForCombatBlock.java b/Mage/src/mage/filter/common/FilterCreatureForCombatBlock.java index d8ad11777f9..fc9bb9edbfc 100644 --- a/Mage/src/mage/filter/common/FilterCreatureForCombatBlock.java +++ b/Mage/src/mage/filter/common/FilterCreatureForCombatBlock.java @@ -29,10 +29,7 @@ package mage.filter.common; import mage.constants.AsThoughEffectType; -import mage.filter.predicate.ObjectPlayer; -import mage.filter.predicate.ObjectPlayerPredicate; import mage.filter.predicate.Predicate; -import mage.game.Controllable; import mage.game.Game; import mage.game.permanent.Permanent; diff --git a/Mage/src/mage/game/combat/Combat.java b/Mage/src/mage/game/combat/Combat.java index b70442fc7e4..e5d281763cd 100644 --- a/Mage/src/mage/game/combat/Combat.java +++ b/Mage/src/mage/game/combat/Combat.java @@ -247,7 +247,9 @@ public class Combat implements Serializable, Copyable { for (Ability ability : entry.getValue()) { UUID defenderId = effect.mustAttackDefender(ability, game); if (defenderId != null) { - defendersForcedToAttack.add(defenderId); + if (defenders.contains(defenderId)) { + defendersForcedToAttack.add(defenderId); + } } break; } diff --git a/Mage/src/mage/game/permanent/PermanentCard.java b/Mage/src/mage/game/permanent/PermanentCard.java index c6994cb72ed..af54c92b1dc 100644 --- a/Mage/src/mage/game/permanent/PermanentCard.java +++ b/Mage/src/mage/game/permanent/PermanentCard.java @@ -33,6 +33,7 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.costs.mana.ManaCost; import mage.abilities.costs.mana.ManaCosts; +import mage.abilities.keyword.TransformAbility; import mage.cards.Card; import mage.cards.LevelerCard; import mage.constants.Zone; @@ -65,6 +66,13 @@ public class PermanentCard extends PermanentImpl { if (card instanceof LevelerCard) { maxLevelCounters = ((LevelerCard) card).getMaxLevelCounters(); } + if (canTransform()) { + if (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + getId()) != null) { + game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + getId(), null); + setTransformed(true); + TransformAbility.transform(this, getSecondCardFace(), game); + } + } } public PermanentCard(final PermanentCard permanent) { diff --git a/Mage/src/mage/watchers/common/AttackedThisCombatWatcher.java b/Mage/src/mage/watchers/common/AttackedThisCombatWatcher.java new file mode 100644 index 00000000000..b95a7a73142 --- /dev/null +++ b/Mage/src/mage/watchers/common/AttackedThisCombatWatcher.java @@ -0,0 +1,53 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.watchers.common; + +import java.util.HashSet; +import java.util.Set; +import mage.MageObjectReference; +import mage.constants.WatcherScope; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.watchers.Watcher; + +/** + * + * @author LevelX2 + */ + +public class AttackedThisCombatWatcher extends Watcher { + + public Set attackedThisTurnCreatures = new HashSet<>(); + + public AttackedThisCombatWatcher() { + super("AttackedThisCombat", WatcherScope.GAME); + } + + public AttackedThisCombatWatcher(final AttackedThisCombatWatcher watcher) { + super(watcher); + this.attackedThisTurnCreatures.addAll(watcher.attackedThisTurnCreatures); + } + + @Override + public void watch(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.BEGIN_COMBAT_STEP_PRE) { + this.attackedThisTurnCreatures.clear(); + } + if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED) { + this.attackedThisTurnCreatures.add(new MageObjectReference(event.getSourceId(),game)); + } + } + + public Set getAttackedThisTurnCreatures() { + return this.attackedThisTurnCreatures; + } + + @Override + public AttackedThisCombatWatcher copy() { + return new AttackedThisCombatWatcher(this); + } + +} diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index a2209b00837..8073fae95d8 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -26196,6 +26196,8 @@ Akroan Jailer|Magic Origins|1|C|{W}|Creature - Human Soldier|1|1|{2}{W}, {T}: Ta Grasp of the Hieromancer|Magic Origins|15|C|{1}{W}|Enchantment - Aura|||Enchant creature$Enchanted creature gets +1/+1 and has "Whenever this creature attacks, tap target creature defending player controls."| Heavy Infantry|Magic Origins|18|C|{4}{W}|Creature - Human Soldier|3|4|When Heavy Infantry enters the battlefield, tap target creature an opponent controls.| Hixus, Prison Warden|Magic Origins|19|R|{3}{W}{W}{3}{W}{W}|Legendary Creature - Human Soldier|4|44|4|Flash$Whenever a creature deals combat damage to you, if Hixus, Prison Warden entered the battlefield this turn, exile that creature until Hixus leaves the battlefield.$Flash$Whenever a creature deals combat damage to you, if Hixus, Prison Warden entered the battlefield this turn, exile that creature until Hixus leaves the battlefield.| +Gideon, Battle-Forged|Magic Origins|023|M||Planeswalker - Gideon|3|+2: Up to one target creature an opponent controls attacks Gideon, Battle-Forged during its controller's next turn if able.$+1: Until your next turn, target creature gains indestructible. Untap that creature.$0: Until end of turn, Gideon, Battle-Forged becomes a 4/4 Human Soldier creature with indestructible that's still a planeswalker. Prevent all damage that would be dealt to him this turn.| +Kytheon, Hero of Akros|Magic Origins|23|M|{W}|Legendary Creature - Human Soldier|2|1|At end of combat, if Kytheon, Hero of Akros and at least two other creatures attacked this combat, exile Kytheon, then return him to the battlefield transformed under his owner's control.${2}{W}: Kytheon gains indestructible until end of turn.| Sentinel of the Eternal Watch|Magic Origins|30|U|{5}{W}|Creature - Giant Soldier|4|6|Vigilance (Attacking doesn't cause this creature to tap.)$At the beginning of combat on each opponent's turn, tap target creature that player controls.| Valor in Akros|Magic Origins|39|U|{3}{W}|Enchantment|||Whenever a creature enters the battlefield under your control, creatures you control get +1/+1 until end of turn.| Aegis Angel|Magic Origins|273|R|{4}{W}{W}{4}{W}{W}|Creature - Angel|5|55|5|Flying$When Aegis Angel enters the battlefield, another target permanent gains indestructible for as long as you control Aegis Angel.$Flying$When Aegis Angel enters the battlefield, another target permanent gains indestructible for as long as you control Aegis Angel.| @@ -26235,8 +26237,10 @@ Nightmare|Magic Origins|282|R|{5}{B}{5}{B}|Creature - Nightmare Horse|0|00|0|Fly Sengir Vampire|Magic Origins|283|U|{3}{B}{B}{3}{B}{B}|Creature - Vampire|4|44|4|Flying$Whenever a creature dealt damage by Sengir Vampire this turn dies, put a +1/+1 counter on Sengir Vampire.$Flying$Whenever a creature dealt damage by Sengir Vampire this turn dies, put a +1/+1 counter on Sengir Vampire.| Act of Treason|Magic Origins|?|C|{2}{R}{2}{R}|Sorcery|||Gain control of target creature until end of turn. Untap that creature. It gains haste until end of turn.$Gain control of target creature until end of turn. Untap that creature. It gains haste until end of turn.| Chandra's Fury|Magic Origins|?|C|{4}{R}{4}{R}|Instant|||Chandra's Fury deals 4 damage to target player and 1 damage to each creature that player controls.$Chandra's Fury deals 4 damage to target player and 1 damage to each creature that player controls.| +Chandra's Ignition|Magic Origins|?|R|{3}{R}{R}{3}{R}{R}|Sorcery|||Target creature you control deals damage equal to its power to each other creature and each opponent.$Target creature you control deals damage equal to its power to each other creature and each opponent.| Cobblebrute|Magic Origins|?|C|{3}{R}{3}{R}|Creature - Elemental|5|25|2|| Fiery Conclusion|Magic Origins|?|C|{1}{R}{1}{R}|Instant|||As an additional cost to cast Fiery Conclusion, sacrifice a creature.$Fiery Conclusion deals 5 damage to target creature.$As an additional cost to cast Fiery Conclusion, sacrifice a creature.$Fiery Conclusion deals 5 damage to target creature.| +Ravaging Blaze|Magic Origins|?|U|{X}{R}{R}{X}{R}{R}|Instant|||Ravaging Blaze deals X damage to target creature. $Spell mastery — If there are two or more instant and/or sorcery cards in your graveyard, Ravaging Blaze also deals X damage to that creature's controller.$Ravaging Blaze deals X damage to target creature. $Spell mastery — If there are two or more instant and/or sorcery cards in your graveyard, Ravaging Blaze also deals X damage to that creature's controller.| Titan's Strength|Magic Origins|?|C|{R}{R}|Instant|||Target creature gets +3/+1 until end of turn. Scry 1.$Target creature gets +3/+1 until end of turn. Scry 1.| Avaricious Dragon|Magic Origins|131|M|{2}{R}{R}|Creature - Dragon|4|4|Flying$At the beginning of your draw step, draw an additional card.$At the beginning of your end step, discard your hand.| Bellows Lizard|Magic Origins|132|C|{R}{R}|Creature - Lizard|1|11|1|{1}{R}: Bellows Lizard gets +1/+0 until end of turn.${1}{R}: Bellows Lizard gets +1/+0 until end of turn.|